forked from science-ation/science-ation
Remove a bunch of conferenceid=0 checks -- we now always have a conference id
This commit is contained in:
parent
4f65058f59
commit
e02e5ba687
@ -51,7 +51,6 @@ else
|
||||
$sfiabversion=@file($prependdir."version.txt");
|
||||
$config['version']=trim($sfiabversion[0]);
|
||||
|
||||
|
||||
//make sure the data subdirectory is writable, if its not, then we're screwed, so make sure it is!
|
||||
if(!is_writable($prependdir."data"))
|
||||
{
|
||||
@ -130,8 +129,7 @@ if(mysql_num_rows($q)<2)
|
||||
}
|
||||
else
|
||||
{
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
$config[$r->var]=$r->val;
|
||||
}
|
||||
}
|
||||
@ -204,37 +202,48 @@ if($config['SFIABDIRECTORY'] == '') {
|
||||
}
|
||||
session_start();
|
||||
|
||||
if(!$_SESSION['conferenceid']) {
|
||||
$q=mysql_query("SELECT * FROM conferences WHERE status='running' ORDER BY name LIMIT 1");
|
||||
if($r=mysql_fetch_object($q)) {
|
||||
$_SESSION['conferenceid']=$r->id;
|
||||
}
|
||||
else {
|
||||
echo "No conferences defined!";
|
||||
}
|
||||
}
|
||||
|
||||
//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']) {
|
||||
if(intval($_SESSION['conferenceid'])>0) {
|
||||
$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";
|
||||
|
||||
/*
|
||||
******* THIS IS TEMPORARY.. probably remove it in a year or so ********
|
||||
if the conference year is set, this is temporary for migratory purposes, so set the FAIRYEAR = confierence year - this will
|
||||
gracefully handle the science fair parts that still rely on FAIRYEAR
|
||||
|
||||
if conference year is NOT set, then make sure config['FAIRYEAR'] is NOT set, so we can weed out any code that relies on
|
||||
FAIRYEAR from the conference system
|
||||
*/
|
||||
if($conference['year'])
|
||||
$config['FAIRYEAR']=$conference['year'];
|
||||
else
|
||||
$config['FAIRYEAR']=NULL;
|
||||
}
|
||||
|
||||
//now pull the rest of the configuration
|
||||
$q=mysql_query("SELECT * FROM config WHERE year='".$config['FAIRYEAR']."'");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
$config[$r->var]=$r->val;
|
||||
}
|
||||
|
||||
@ -518,15 +527,9 @@ echo "</div>";
|
||||
|
||||
<div id="left">
|
||||
<?
|
||||
$q=mysql_query("SELECT * FROM conferences WHERE status='running'");
|
||||
$q=mysql_query("SELECT * FROM conferences WHERE status='running' ORDER BY name");
|
||||
if(mysql_num_rows($q)) {
|
||||
echo "<ul class=\"conferencenav\">";
|
||||
if($_SESSION['conferenceid']==0)
|
||||
$cl="class=\"selected\"";
|
||||
else
|
||||
$cl="";
|
||||
|
||||
echo "<li $cl><a $cl href=\"".$_SERVER['PHP_SELF']."?switchconference=0\">".i18n("Science Fair")."</a></li>\n";
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
if($_SESSION['conferenceid']==$r->id)
|
||||
$cl="class=\"selected\"";
|
||||
@ -537,15 +540,7 @@ echo "</div>";
|
||||
echo "</ul>\n";
|
||||
echo "<br />";
|
||||
}
|
||||
else {
|
||||
$_SESSION['conferenceid']=0;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?
|
||||
if(is_array($nav)) {
|
||||
$navkeys=array_keys($nav);
|
||||
switch($navkeys[2]) {
|
||||
|
Loading…
Reference in New Issue
Block a user