Copyright (C) 2005 James Grant Copyright (C) 2007 David 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. */ ?> 'Feeder Fair', 'sfiab' => 'SFIAB Upstream', 'ysc' => 'YSC/CWSF Upstream'); /* Sort out who we're editting */ if($_POST['users_id']) $eid = intval($_POST['users_id']); /* From a save form */ else if(array_key_exists('embed_edit_id', $_SESSION)) $eid = $_SESSION['embed_edit_id']; /* From the embedded editor */ else $eid = $_SESSION['users_id']; /* Regular entry */ if($eid != $_SESSION['users_id']) { /* Not editing ourself, we had better be * a committee member */ user_auth_required('committee','admin'); } $u = user_load($eid); switch($_GET['action']) { case 'save': $fairs_id = intval($u['fairs_id']); if($fairs_id == 0) { $q = mysql_query("INSERT INTO fairs(`id`,`name`) VALUES('','new entry')"); $id = mysql_insert_id(); } else { $id = intval($fairs_id); } $name = mysql_real_escape_string(stripslashes($_POST['name'])); $abbrv = mysql_real_escape_string(stripslashes($_POST['abbrv'])); $url = mysql_real_escape_string($_POST['url']); $website = mysql_real_escape_string($_POST['website']); $type = array_key_exists($_POST['type'], $fair_type) ? $_POST['type'] : ''; $username = mysql_real_escape_string(stripslashes($_POST['username'])); $password = mysql_real_escape_string(stripslashes($_POST['password'])); $enable_stats = ($_POST['enable_stats'] == 'yes') ? 'yes' : 'no'; $enable_awards = ($_POST['enable_awards'] == 'yes') ? 'yes' : 'no'; $enable_winners = ($_POST['enable_winners'] == 'yes') ? 'yes' : 'no'; $q = mysql_query("UPDATE fairs SET `name`='$name', `abbrv`='$abbrv', `url`='$url', `website`='$website', `type`='$type' , `username`='$username', `password`='$password', `enable_stats`='$enable_stats', `enable_awards`='$enable_awards', `enable_winners`='$enable_winners' WHERE id=$id"); echo mysql_error(); $u['fairs_id'] = $id; user_save($u); happy_("Fair Informaiton successfully updated"); exit; } function yesno($name, $val) { echo ""; } /* update overall status */ fair_status_update($u); if($_SESSION['embed'] != true) { //output the current status $newstatus=fair_status_info($u); if($newstatus!='complete') message_push(error(i18n("Fair Information Incomplete"))); else message_push(happy(i18n("Fair Information Complete"))); } if($_SESSION['embed'] == true) { echo "
"; display_messages(); echo "

".i18n('Fair Information')."

"; echo "
"; } else { //send the header send_header("Fair Information", array("Science Fair Main" => "fair_main.php") ); } ?> \n"; echo "\n"; echo "\n"; echo '"; echo ''; echo '
'.i18n('Fair Type').':'; echo "
'.i18n('Fair Name').':'; echo ""; echo '
'.i18n('Fair Abbreviation').':'; echo ""; echo '
'.i18n('Fair Website').':'; if($f['website'] == '') $f['website'] = 'http://'; echo ""; echo '
'; /* All upstream stuff */ echo '
'; echo "\n"; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; /* End upstream stuff */ echo "
'.i18n('Upstream URL').':'; if($f['url'] == '') $f['url'] = 'http://'; echo ""; echo '
'; echo i18n(($f['type'] == 'ysc') ? 'YSC Region ID' : 'Upstream Username'); echo ':'; echo ""; echo '
'; echo i18n(($f['type'] == 'ysc') ? 'YSC Region Password' : 'Upstream Password'); echo ':'; echo ""; echo '
'.i18n('Enable stats upload').':'; yesno('enable_stats', $f['enable_stats']); echo '
'.i18n('Enable awards download').':'; yesno('enable_awards', $f['enable_awards']); echo '
'.i18n('Enable winners upload').':'; yesno('enable_winners', $f['enable_winners']); echo '
"; echo i18n('* Use the \'Personal\' tab to specify contact information for someone at this fair.'); echo '
'; echo '
'; echo i18n('* The feeder fair must login to this SFIAB to download award lists and upload statistics and winners. Use the \'Personal\' tab to specify an email and password for the feeder fair, use the email address of a contact at the feeder fair. Then give the email/password to that person so they can configure their own SFIAB to upload data to this SFIAB.'); echo '
'; echo "
"; echo "\n"; echo ""; echo "
"; if($_SESSION['embed'] != true) send_footer(); ?>