Copyright (C) 2005-2010 James Grant This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ?> *'); //figure out the directory to prepend to directoroy names, depending on if we are in a subdirectory or not if(substr(getcwd(),-6)=="/admin") $prependdir="../"; else if(substr(getcwd(),-6)=="/super") $prependdir="../"; else if(substr(getcwd(),-7)=="/config") $prependdir="../"; else if(substr(getcwd(),-3)=="/db") $prependdir="../"; else if(substr(getcwd(),-8)=="/scripts") $prependdir="../"; else $prependdir=""; $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")) { echo "SFIAB ERROR"; echo "

Science Fair In A Box - ERROR

"; echo "data/ subdirectory is not writable by the web server"; echo "
"; echo "

Details

"; echo "The data/ subdirectory is used to store files uploaded through the SFIAB software. The web server must have write access to this directory in order to function properly. Please contact your system administrator (if you are the system administrator, chown/chmod the data directory appropriately)."; echo "
"; echo ""; exit; } if(file_exists($prependdir."data/config.inc.php")) { require_once($prependdir."data/config.inc.php"); } else { echo "SFIAB"; echo "

Science Fair In A Box - Installation

"; echo "It looks like this is a new installation of SFIAB, and the database has not yet been configured. Please choose from the following options:
"; echo "
"; echo "Proceed with Fresh SFIAB Installation"; echo "
"; echo ""; exit; } if(!mysql_connect($DBHOST,$DBUSER,$DBPASS)) { echo "SFIAB ERROR"; echo "

Science Fair In A Box - ERROR

"; echo "Cannot connect to database!"; echo ""; exit; } if(!mysql_select_db($DBNAME)) { echo "SFIAB ERROR"; echo "

Science Fair In A Box - ERROR

"; echo "Cannot select database!"; echo ""; exit; } //this will silently fail on mysql 4.x, but is needed on mysql5.x to ensure we're only using utf8 encodings @mysql_query("SET NAMES utf8"); //find out the fair year and any other 'year=0' configuration parameters (things that dont change as the years go on) $q=@mysql_query("SELECT * FROM config WHERE conferences_id=0 OR year=0"); //we might get an error if installation step 2 is not done (ie, the config table doesnt even exist) if(mysql_error()) { echo "SFIAB ERROR"; echo "

Science Fair In A Box - ERROR

"; echo "SFIAB installation is not complete. Please go to Installer Step 2 to complete the installation process"; echo "
"; echo ""; exit; } //if we have 0 (<1) then install2 is not done, which would get caught above, //if we have 1 (<2) then insatll3 is not done (no entries for FAIRYEAR and SFIABDIRECTORY) if(mysql_num_rows($q)<2) { echo "SFIAB ERROR"; echo "

Science Fair In A Box - ERROR

"; echo "SFIAB installation is not complete. Please go to Installer Step 3 to complete the installation process"; echo "
"; echo ""; exit; } else { while($r=mysql_fetch_object($q)) { $config[$r->var]=$r->val; } } $dbdbversion=$config['DBVERSION']; $dbcodeversion=@file($prependdir."db/db.code.version.txt"); $dbcodeversion=trim($dbcodeversion[0]); if(!$dbdbversion) { echo "SFIAB ERROR"; echo "

Science Fair In A Box - ERROR

"; echo "SFIAB installation is not complete. Please go to Installer Step 2 to complete the installation process"; echo "
"; echo ""; exit; } if($dbcodeversion!=$dbdbversion) { echo "SFIAB ERROR"; echo "

Science Fair In A Box - ERROR

"; echo "SFIAB database and code are mismatched"; echo "
"; echo "Please run the db_update.php script in order to update"; echo "
"; echo "your database to the same version as the code"; echo "
"; echo "
"; echo "
"; echo "

Details

"; echo "Current SFIAB codebase requires DB version: ".$dbcodeversion; echo "
"; echo "Current SFIAB database is detected as version: ".$dbdbversion; echo "
"; echo ""; exit; } /* Check that magic_quotes is OFF */ if(get_magic_quotes_gpc()) { ?> SFIAB ERROR

Science Fair In A Box - ERROR

Your PHP configuration has magic_quotes ENABLED. They should be disabled, and are disabled in the .htaccess file, so your server is ignoring the .htaccess file or overriding it.

Magic quotes is DEPRECATED as of PHP 5.3.0, REMOVE as of 6.0, but ON by default for any PHP < 5.3.0.

Add

php_flag magic_quotes_gpc off
to the .htacces, or add
php_flag magic_quotes_gpc=off
to php.ini
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"; $q=mysql_query("SELECT * FROM conferences WHERE id='$cid' AND status='running'"); if($r=mysql_fetch_object($q)) { $_SESSION['conferences_id']=$cid; } } if(intval($_SESSION['conferences_id'])>0) { $q=mysql_query("SELECT * FROM conferences WHERE id='{$_SESSION['conferences_id']}'"); $conference=mysql_fetch_assoc($q); /* ******* 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 conferences_id='".$conference['id']."'"); while($r=mysql_fetch_object($q)) { $config[$r->var]=$r->val; } //now pull the dates if($conference['id']) $q=mysql_query("SELECT * FROM dates WHERE conferences_id='".$conference['id']."'"); else $config['dates']=array(); while($r=mysql_fetch_object($q)) { $config['dates'][$r->name]=$r->date; } //load roles $roles=array(); $q = mysql_query("SELECT * FROM roles"); while(($r = mysql_fetch_assoc($q))) { $roles[$r['type']] = $r; } //and now pull the theme require_once("theme/{$config['theme']}/theme.php"); require_once("theme/{$config['theme_icons']}/icons.php"); //detect the browser first, so we know what icons to use - we store this in the config array as well //even though its not configurable by the fair if(stristr($_SERVER['HTTP_USER_AGENT'],"MSIE")) $config['icon_extension']="gif"; else $config['icon_extension']="png"; //now get the languages, and make sure we have at least one active language $q=mysql_query("SELECT * FROM languages WHERE active='Y' ORDER BY langname"); if(mysql_num_rows($q)==0) { echo "No active languages defined, defaulting to English"; $config['languages']['en']="English"; } else { while($r=mysql_fetch_object($q)) { $config['languages'][$r->lang]=$r->langname; } } //now if no language has been set yet, lets set it to the default language if(!$_SESSION['lang']) { //first try the default language, if that doesnt work, use "en" if($config['default_language']) $_SESSION['lang']=$config['default_language']; else $_SESSION['lang']="en"; } //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']; //if the user has switched languages, go ahead and switch the session variable if($_GET['switchlanguage']) { //first, make sure its a valid language: if($config['languages'][$_GET['switchlanguage']]) { $_SESSION['lang']=$_GET['switchlanguage']; } else { //invalid language, dont do anything } } $CWSFDivisions=array( 1=>"Automotive", 2=>"Biotechnology & Pharmaceutical Sciences", 3=>"Computing & Information Technology", 4=>"Earth & Environmental Sciences", 5=>"Engineering", 6=>"Environmental Innovation", 7=>"Health Sciences", 8=>"Life Sciences", 9=>"Physical & Mathematical Sciences" ); //refator all functions except for the header/footer functions to another file require_once("common.inc.functions.php"); $HEADER_SENT=false; function send_header($title="", $nav=null, $icon=null, $titletranslated=false) { global $HEADER_SENT; global $config; global $roles; global $prependdir; global $conference; //do this so we can use send_header() a little more loosly and not worry about it being sent more than once. if($HEADER_SENT) return; else $HEADER_SENT=true; ?> <? if($title && !$titletranslated) echo i18n($title); else if($title) echo $title; else echo i18n($config['fairname']); ?>
"; echo "".i18n("Contact Us")."   |   \n"; if(count($config['languages'])>1) { echo i18n("Language").": "; echo ""; } echo ""; ?>
\n"; echo "
  • ".i18n("Fundraising")."

  • \n"; echo "
  • ".i18n("Fundraising Dashboard").'
  • '; echo "
  • ".i18n("Fundraising Setup").'
  • '; echo "
  • ".i18n("Manage Appeals").'
  • '; echo "
  • ".i18n("Manage Donors/Sponsors").'
  • '; echo "
  • ".i18n("Fundraising Reports").'
  • '; echo "
    \n"; break; default: //no special menu break; } } ?>
    "; echo " $(document).ready(function() {\n"; echo "taskNav({$_SESSION['nav']['primary']},0,0);"; echo " });"; echo "\n"; } if($_SESSION['nav']['secondary']) { echo "\n"; } //take SFIABDIRECTORY off of the current URL $pageurl=substr($_SERVER['PHP_SELF'],strlen($config['SFIABDIRECTORY'])); $q=mysql_query("SELECT * FROM rolestasks WHERE link='".mysql_real_escape_string($pageurl)."'"); if($r=mysql_fetch_object($q)) { //okay we found it, now what do we do? //FIXME: we need to populate the secondarynva, tertiarynav, and select the right thing in the accordion, //because we cannot assume that the user navigated to this page via the pri/sec/ter nav menus $navTree=array(); upTree($r->id,&$navTree); foreach($navTree AS $t) { print_r($t); echo "
    "; } } ?> ".i18n('You are here:').' '; foreach($nav as $t=>$l) { echo "".i18n($t).' » '; } if(!$titletranslated) echo i18n($title); else echo $title; echo ''; } */ ?>
    "; echo theme_icon($icon); echo "
    "; } //if we're under /admin or /config then we want to show the ? help icon if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config" || substr(getcwd(),-6)=="/super") { if($_SERVER['REDIRECT_SCRIPT_URL']) $fname=substr($_SERVER['REDIRECT_SCRIPT_URL'],strlen($config['SFIABDIRECTORY'])+1); else $fname=substr($_SERVER['PHP_SELF'],strlen($config['SFIABDIRECTORY'])+1); echo "
    "; } if($title && !$titletranslated) echo "

    ".i18n($title)."

    "; else if($title) echo "

    ".$title."

    "; display_messages(); } /* END OF send_header */ function send_footer() { global $config; ?>
    Debug...
    \n"; ?> <?=i18n($title)?>
    ".i18n($title).""; } function send_popup_footer() { ?>

    Debug...