forked from science-ation/science-ation
implement configuration of variables in the config table
This commit is contained in:
parent
0786cf99d2
commit
4dce799338
@ -2,7 +2,47 @@
|
||||
require("../common.inc.php");
|
||||
send_header("Configuration");
|
||||
|
||||
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>";
|
||||
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();
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user