forked from science-ation/science-ation
Separate configuration into Variables and Category/Divison
This commit is contained in:
parent
e7140302d2
commit
f33be12001
10
config/catdiv.php
Normal file
10
config/catdiv.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?
|
||||
require("../common.inc.php");
|
||||
send_header("Configuration - Categories and Divisions");
|
||||
|
||||
if($_POST['action']=="save")
|
||||
{
|
||||
}
|
||||
|
||||
send_footer();
|
||||
?>
|
@ -3,48 +3,8 @@
|
||||
send_header("Configuration");
|
||||
echo error(i18n("Note: this section will normally be password protected. It is left open for now for debugging and testing purposes"));
|
||||
|
||||
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>";
|
||||
echo "<a href=\"variables.php\">Configuration Variables</a> <br />";
|
||||
echo "<a href=\"catdiv.php\">Categories and Divisions</a> <br />";
|
||||
|
||||
send_footer();
|
||||
?>
|
||||
|
50
config/variables.php
Normal file
50
config/variables.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?
|
||||
require("../common.inc.php");
|
||||
send_header("Configuration - Variables");
|
||||
echo error(i18n("Note: this section will normally be password protected. It is left open for now for debugging and testing purposes"));
|
||||
|
||||
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();
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user