science-ation/config/variables.php
2010-07-13 03:30:23 +00:00

96 lines
3.3 KiB
PHP

<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
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.
*/
?>
<?
require("../common.inc.php");
require_once("../user.inc.php");
require_once("../config_editor.inc.php");
user_auth_required('config');
$q=mysql_query("SELECT * FROM config WHERE conferences_id='-1' AND conferencetypes LIKE '%{$conference['type']}%'");
while($r=mysql_fetch_object($q)) {
mysql_query("INSERT INTO config (var,val,category,type,type_values,ord,description,conferences_id,section,conferencetypes) VALUES (
'".mysql_escape_string($r->var)."',
'".mysql_escape_string($r->val)."',
'".mysql_escape_string($r->category)."',
'".mysql_escape_string($r->type)."',
'".mysql_escape_string($r->type_values)."',
'".mysql_escape_string($r->ord)."',
'".mysql_escape_string($r->description)."',
'".mysql_escape_string($conference['id'])."',
'".mysql_escape_string($r->section)."',
'".mysql_escape_string($r->conferencetypes)."')");
}
//get the category, and if nothing is chosen, default to Global
if($_GET['category']) $category=$_GET['category'];
else if($_POST['category']) $category=$_POST['category'];
else $category="Global";
$action = config_editor_handle_actions($category, $conference['id'], "var");
if($action == 'update') {
header("Location: variables.php?category=$category");
exit;
}
send_header("Conference Configuration Variables",
array('Committee Main' => 'committee_main.php',
'Conference Configuration' => 'config/index.php')
,"configuration_variables"
);
$q=mysql_query("SELECT DISTINCT(category) AS cat FROM config WHERE conferences_id='{$conference['id']}' ORDER BY cat");
echo "\n<table valign=\"top\" cellspacing=0 cellpadding=5 border=0>";
echo "<tr><td width=\"120\" style=\"border-right: 1px solid black;\">";
echo "<table cellspacing=0 cellpadding=3 border=0>";
$trclass = 'odd';
while($r=mysql_fetch_object($q)) {
$trclass = ($trclass == 'odd') ? 'even' : 'odd';
echo "<tr class=\"$trclass\">";
echo "<td align=\"right\">";
if($r->cat==$category)
echo "<b>".i18n($r->cat)."</b>";
else
echo "<a href=\"".$_SERVER['PHP_SELF']."?category=".urlencode($r->cat)."\">".i18n($r->cat)."</a>";
echo "</td>";
echo "</tr>\n";
}
echo "</table>";
echo "</td><td>";
if($category) {
echo "<h3>".i18n($category)." ({$conference['name']})</h3>";
config_editor($category, $conference['id'], "var", $_SERVER['PHP_SELF']);
}
else {
echo i18n("Please choose a configuration category");
}
echo "</td></tr></table>";
send_footer();
?>