science-ation/config/variables.php
james 38638140b9 separate cat/div into categories and divisions
fully implement the age categories configuration
add "back to configuration" links to each sub-config
2004-12-20 16:35:15 +00:00

51 lines
1.7 KiB
PHP

<?
require("../common.inc.php");
send_header("Configuration - Variables");
echo "<a href=\"index.php\">&lt;&lt; ".i18n("Back to Configuration")."</a><br />";
if($_POST['action']=="save")
{
if($_POST['specialconfig'])
{
foreach($_POST['specialconfig'] as $key=>$val)
{
mysql_query("UPDATE config SET val='".mysql_escape_string(stripslashes($val))."' WHERE year='0' AND var='$key'");
}
}
if($_POST['saveconfig'])
{
foreach($_POST['saveconfig'] as $key=>$val)
{
mysql_query("UPDATE config SET val='".mysql_escape_string(stripslashes($val))."' WHERE year='".$config['FAIRYEAR']."' AND var='$key'");
}
}
echo happy(i18n("Configuration successfully saved"));
}
$q=mysql_query("SELECT * FROM config WHERE year=0 ORDER BY var");
echo "<form method=\"post\" action=\"index.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
echo "<table>";
echo "<tr><td colspan=\"3\"><h3>".i18n("Global configuration settings")."</h3></td></tr>";
while($r=mysql_fetch_object($q))
{
echo "<tr><td>$r->var</td><td>".i18n($r->description)."</td><td><input type=\"text\" name=\"specialconfig[$r->var]\" value=\"$r->val\" /></td></tr>";
}
echo "<tr><td colspan=\"3\"><hr /><br /><h3>".i18n("Configuration settings for fair year %1",array($config['FAIRYEAR']))."</h3></td></tr>";
$q=mysql_query("SELECT * FROM config WHERE year='".$config['FAIRYEAR']."' ORDER BY var");
while($r=mysql_fetch_object($q))
{
echo "<tr><td>$r->var</td><td>".i18n($r->description)."</td><td><input type=\"text\" name=\"saveconfig[$r->var]\" value=\"$r->val\" /></td></tr>";
}
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Save Configuration")."\" />\n";
echo "</form>";
send_footer();
?>