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");
|
$sfiabversion=@file($prependdir."version.txt");
|
||||||
$config['version']=trim($sfiabversion[0]);
|
$config['version']=trim($sfiabversion[0]);
|
||||||
|
|
||||||
|
|
||||||
//make sure the data subdirectory is writable, if its not, then we're screwed, so make sure it is!
|
//make sure the data subdirectory is writable, if its not, then we're screwed, so make sure it is!
|
||||||
if(!is_writable($prependdir."data"))
|
if(!is_writable($prependdir."data"))
|
||||||
{
|
{
|
||||||
@ -130,8 +129,7 @@ if(mysql_num_rows($q)<2)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while($r=mysql_fetch_object($q))
|
while($r=mysql_fetch_object($q)) {
|
||||||
{
|
|
||||||
$config[$r->var]=$r->val;
|
$config[$r->var]=$r->val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,37 +202,48 @@ if($config['SFIABDIRECTORY'] == '') {
|
|||||||
}
|
}
|
||||||
session_start();
|
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 :)
|
//move the conference stuff before the configuration loading, so we can load the right configuration for the conference :)
|
||||||
if(isset($_GET['switchconference'])) {
|
if(isset($_GET['switchconference'])) {
|
||||||
//make sure its good
|
//make sure its good
|
||||||
$cid=intval($_GET['switchconference']);
|
$cid=intval($_GET['switchconference']);
|
||||||
// echo "cid=$cid";
|
// echo "cid=$cid";
|
||||||
if($cid==0) {
|
$q=mysql_query("SELECT * FROM conferences WHERE id='$cid' AND status='running'");
|
||||||
//default for old science fair system
|
if($r=mysql_fetch_object($q)) {
|
||||||
$_SESSION['conferenceid']=0;
|
$_SESSION['conferenceid']=$cid;
|
||||||
}
|
|
||||||
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']."'");
|
$q=mysql_query("SELECT * FROM conferences WHERE id='".$_SESSION['conferenceid']."'");
|
||||||
$conference=mysql_fetch_assoc($q);
|
$conference=mysql_fetch_assoc($q);
|
||||||
}
|
|
||||||
else {
|
/*
|
||||||
$conference['id']=0;
|
******* THIS IS TEMPORARY.. probably remove it in a year or so ********
|
||||||
$conference['name']=$config['fairname'];
|
if the conference year is set, this is temporary for migratory purposes, so set the FAIRYEAR = confierence year - this will
|
||||||
$conference['type']="sciencefair";
|
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
|
//now pull the rest of the configuration
|
||||||
$q=mysql_query("SELECT * FROM config WHERE year='".$config['FAIRYEAR']."'");
|
$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;
|
$config[$r->var]=$r->val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,15 +527,9 @@ echo "</div>";
|
|||||||
|
|
||||||
<div id="left">
|
<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)) {
|
if(mysql_num_rows($q)) {
|
||||||
echo "<ul class=\"conferencenav\">";
|
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)) {
|
while($r=mysql_fetch_object($q)) {
|
||||||
if($_SESSION['conferenceid']==$r->id)
|
if($_SESSION['conferenceid']==$r->id)
|
||||||
$cl="class=\"selected\"";
|
$cl="class=\"selected\"";
|
||||||
@ -537,15 +540,7 @@ echo "</div>";
|
|||||||
echo "</ul>\n";
|
echo "</ul>\n";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$_SESSION['conferenceid']=0;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?
|
|
||||||
if(is_array($nav)) {
|
if(is_array($nav)) {
|
||||||
$navkeys=array_keys($nav);
|
$navkeys=array_keys($nav);
|
||||||
switch($navkeys[2]) {
|
switch($navkeys[2]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user