forked from science-ation/science-ation
Move the conference block above the configuration/dates loading, so we can load the right dates for the conference (and probably soon, the right configuration variables too!)
This commit is contained in:
parent
c44068929a
commit
122248a03c
@ -195,6 +195,36 @@ if(get_magic_quotes_gpc()) {
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
//move the conference stuff before the configuration loading, so we can load the right configuration for the conference :)
|
||||
if(isset($_GET['switchconference'])) {
|
||||
//make sure its good
|
||||
$cid=intval($_GET['switchconference']);
|
||||
// echo "cid=$cid";
|
||||
if($cid==0) {
|
||||
//default for old science fair system
|
||||
$_SESSION['conferenceid']=0;
|
||||
}
|
||||
else {
|
||||
$q=mysql_query("SELECT * FROM conferences WHERE id='$cid' AND status='running'");
|
||||
if($r=mysql_fetch_object($q)) {
|
||||
$_SESSION['conferenceid']=$cid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_SESSION['conferenceid']) {
|
||||
$q=mysql_query("SELECT * FROM conferences WHERE id='".$_SESSION['conferenceid']."'");
|
||||
$conference=mysql_fetch_assoc($q);
|
||||
}
|
||||
else {
|
||||
$conference['id']=0;
|
||||
$conference['name']=$config['fairname'];
|
||||
$conference['type']="sciencefair";
|
||||
}
|
||||
|
||||
|
||||
|
||||
//now pull the rest of the configuration
|
||||
$q=mysql_query("SELECT * FROM config WHERE year='".$config['FAIRYEAR']."'");
|
||||
while($r=mysql_fetch_object($q))
|
||||
@ -203,9 +233,12 @@ while($r=mysql_fetch_object($q))
|
||||
}
|
||||
|
||||
//now pull the dates
|
||||
$q=mysql_query("SELECT * FROM dates WHERE year='".$config['FAIRYEAR']."'");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($conference['id'])
|
||||
$q=mysql_query("SELECT * FROM dates WHERE conferences_id='".$conference['id']."'");
|
||||
else
|
||||
$q=mysql_query("SELECT * FROM dates WHERE year='".$config['FAIRYEAR']."'");
|
||||
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
$config['dates'][$r->name]=$r->date;
|
||||
}
|
||||
|
||||
@ -251,32 +284,6 @@ if(!$_SESSION['lang']) {
|
||||
$_SESSION['lang']="en";
|
||||
}
|
||||
|
||||
if(isset($_GET['switchconference'])) {
|
||||
//make sure its good
|
||||
$cid=intval($_GET['switchconference']);
|
||||
// echo "cid=$cid";
|
||||
if($cid==0) {
|
||||
//default for old science fair system
|
||||
$_SESSION['conferenceid']=0;
|
||||
}
|
||||
else {
|
||||
$q=mysql_query("SELECT * FROM conferences WHERE id='$cid' AND status='running'");
|
||||
if($r=mysql_fetch_object($q)) {
|
||||
$_SESSION['conferenceid']=$cid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_SESSION['conferenceid']) {
|
||||
$q=mysql_query("SELECT * FROM conferences WHERE id='".$_SESSION['conferenceid']."'");
|
||||
$conference=mysql_fetch_assoc($q);
|
||||
}
|
||||
else {
|
||||
$conference['id']=0;
|
||||
$conference['name']=$config['fairname'];
|
||||
$conference['type']="sciencefair";
|
||||
}
|
||||
|
||||
//only allow debug to get set if we're using a development version (odd numbered ending)
|
||||
if(substr($config['version'], -1) % 2 != 0)
|
||||
if($_GET['debug']) $_SESSION['debug']=$_GET['debug'];
|
||||
|
Loading…
Reference in New Issue
Block a user