forked from science-ation/science-ation
4d54bdbb1c
Update i18n function to accept a third parameter, which is an array that describes the arguments in the string to make translation much easier Update some of the config/admin pages to make sure i18n is properly used, and that argument descriptions are set
90 lines
3.0 KiB
PHP
90 lines
3.0 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");
|
|
auth_required('config');
|
|
send_header("Configuration - Page Texts");
|
|
echo "<a href=\"index.php\"><< ".i18n("Back to Configuration")."</a><br />";
|
|
|
|
$q=mysql_query("SELECT * FROM pagetext WHERE year='-1' ORDER BY textname");
|
|
while($r=mysql_fetch_object($q))
|
|
{
|
|
mysql_query("INSERT INTO pagetext (textname,text,year) VALUES (
|
|
'".mysql_escape_string($r->textname)."',
|
|
'".mysql_escape_string($r->text)."',
|
|
'".$config['FAIRYEAR']."')");
|
|
}
|
|
|
|
|
|
if($_POST['action']=="save")
|
|
{
|
|
mysql_query("UPDATE pagetext SET lastupdate=NOW(), text='".mysql_escape_string(stripslashes($_POST['text']))."' WHERE textname='".$_POST['textname']."' AND year='".$config['FAIRYEAR']."'");
|
|
|
|
echo happy(i18n("Page text successfully saved"));
|
|
|
|
}
|
|
|
|
if($_GET['textname'])
|
|
{
|
|
$q=mysql_query("SELECT * FROM pagetext WHERE textname='".$_GET['textname']."' AND year='".$config['FAIRYEAR']."'");
|
|
if($r=mysql_fetch_object($q))
|
|
{
|
|
if($r->lastupdate=="0000-00-00 00:00:00") $lastupdate="Never";
|
|
else $lastupdate=$r->lastupdate;
|
|
echo "<b>$r->textname</b> Last updated: $lastupdate<br />";
|
|
echo "<form method=\"post\" action=\"pagetexts.php\">";
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
|
echo "<input type=\"hidden\" name=\"textname\" value=\"$r->textname\">\n";
|
|
echo "<textarea rows=8 cols=60 name=\"text\">".htmlspecialchars($r->text)."</textarea>";
|
|
echo "<br />";
|
|
echo "<input type=\"submit\" value=\"".i18n("Save Page Text")."\" />\n";
|
|
echo "</form>";
|
|
echo "<hr />";
|
|
}
|
|
else
|
|
{
|
|
echo error(i18n("Invalid text name"));
|
|
}
|
|
}
|
|
echo "<br />";
|
|
echo i18n("Choose a page text to edit");
|
|
echo "<table class=\"summarytable\">";
|
|
|
|
$q=mysql_query("SELECT * FROM pagetext WHERE year='".$config['FAIRYEAR']."' ORDER BY textname");
|
|
echo "<tr><th>".i18n("Page Text Name")."</th><th>".i18n("Last Update")."</th></tr>";
|
|
while($r=mysql_fetch_object($q))
|
|
{
|
|
echo "<tr><td><a href=\"pagetexts.php?textname=$r->textname\">$r->textname</a></td>";
|
|
if($r->lastupdate=="0000-00-00 00:00:00") $lastupdate="Never";
|
|
else $lastupdate=$r->lastupdate;
|
|
echo "<td>$lastupdate</td>";
|
|
echo "</tr>";
|
|
|
|
|
|
}
|
|
echo "</table>";
|
|
|
|
send_footer();
|
|
?>
|