forked from science-ation/science-ation
8b5fc1c905
Add the content management front-end file Add the content management back-end file - its not quite done yet
137 lines
4.4 KiB
PHP
137 lines
4.4 KiB
PHP
<?
|
|
/*
|
|
This file is part of the 'Science Fair In A Box' project
|
|
SFIAB Website: http://www.sfiab.ca
|
|
|
|
Copyright (C) 2008 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");
|
|
user_auth_required('committee', 'config');
|
|
|
|
//make sure storage folder exists
|
|
if(!file_exists("../data/userfiles"))
|
|
mkdir("../data/userfiles");
|
|
|
|
|
|
send_header("Website Content Manager",
|
|
array('Committee Main' => 'committee_main.php',
|
|
'SFIAB Configuration' => 'config/index.php')
|
|
);
|
|
|
|
if($_POST['action']=="save")
|
|
{
|
|
|
|
echo happy(i18n("Page text successfully saved"));
|
|
echo "no, actually its not saving yet, im not done!<br />";
|
|
|
|
}
|
|
|
|
if($_GET['filename'] || $_GET['id'] || $_GET['action']=="create")
|
|
{
|
|
echo "<a href=\"cms.php\"><< Back to file list</a><br />\n";
|
|
echo "<form method=\"post\" action=\"cms.php\">";
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
|
if($_GET['filename'])
|
|
echo "<input type=\"hidden\" name=\"filename\" value=\"".htmlspecialchars($r->textname)."\">\n";
|
|
else
|
|
echo "Choose filename to create: /web/<input type=\"text\" name=\"filename\" size=\"15\">.html<hr />";
|
|
|
|
echo "<table width=\"100%\" cellpadding=\"3\">";
|
|
foreach($config['languages'] AS $lang=>$langname) {
|
|
echo "<tr><td>";
|
|
echo "<table class=\"tableview\" width=\"100%\">";
|
|
echo "<tr><th>";
|
|
$q=mysql_query("SELECT * FROM cms WHERE filename='".mysql_escape_string($_GET['filename'])."' AND lang='$lang' ORDER BY dt DESC LIMIT 1");
|
|
if($r=mysql_fetch_object($q)) {
|
|
if($r->dt=="0000-00-00 00:00:00" || !$r->dt) $dt="Never";
|
|
else $dt=$r->dt;
|
|
echo "<b>".htmlspecialchars($_GET['filename'])." - $langname</b> ".i18n("Last updated").": $dt<br />";
|
|
}
|
|
else
|
|
{
|
|
echo "<b>$langname</b><br />"; // ".i18n("Last updated").": $dt<br />";
|
|
}
|
|
echo "</th></tr>\n";
|
|
echo "<tr><td>";
|
|
require_once("../fckeditor/fckeditor.php");
|
|
|
|
$oFCKeditor = new FCKeditor("text_$lang") ;
|
|
$oFCKeditor->BasePath = "../fckeditor/";
|
|
$oFCKeditor->Value = $r->text;
|
|
$oFCKeditor->Width="100%";
|
|
$oFCKeditor->Height=400;
|
|
$oFCKeditor->Create() ;
|
|
|
|
echo "</td></tr></table>\n";
|
|
|
|
echo "</td><td width=\"130\" valign=\"top\">";
|
|
echo "<table class=\"tableview\" width=\"130\">";
|
|
|
|
if($_GET['historylimit']) $historylimit=$_GET['historylimit'];
|
|
else $historylimit=30;
|
|
|
|
echo "<tr><th>".i18n("File History")."</th></tr>\n";
|
|
$q=mysql_query("SELECT id,dt FROM cms WHERE filename='".$_GET['filename']."' ORDER BY dt DESC LIMIT $historylimit");
|
|
if(mysql_num_rows($q)) {
|
|
echo "<tr><td><a href=\"cms.php?filename=".rawurlencode($_GET['filename'])."&id=$r->id\" style=\"font-size: 0.75em;\">$r->dt</a></td></tr>\n";
|
|
|
|
}
|
|
else
|
|
echo "<tr><td><i>No History</i></td></tr>\n";
|
|
echo "</table>\n";
|
|
echo "</td></tr>\n";
|
|
echo "<tr><td colspan=\"2\"><hr /></td></tr>\n";
|
|
}
|
|
echo "<tr><td>";
|
|
echo "<table><tr><td>";
|
|
echo "<input type=\"submit\" value=\"".i18n("Save Page")."\" />\n";
|
|
echo "</form>";
|
|
echo "</td><td>";
|
|
echo "<form method=\"get\" action=\"cms.php\">";
|
|
echo "<input type=\"submit\" value=\"".i18n("Cancel Changes")."\" />\n";
|
|
echo "</form>\n";
|
|
echo "</td></tr></table>\n";
|
|
|
|
echo "</td></tr></table>\n";
|
|
|
|
}
|
|
else
|
|
{
|
|
echo i18n("Choose a web page filename to edit");
|
|
echo "<table class=\"summarytable\">";
|
|
|
|
$q=mysql_query("SELECT DISTINCT(filename) AS filename, dt FROM cms ORDER BY filename");
|
|
echo "<tr><th>".i18n("Filename")."</th><th>".i18n("Last Update")."</th></tr>";
|
|
while($r=mysql_fetch_object($q))
|
|
{
|
|
echo "<tr><td><a href=\"cms.php?filename=".rawurlencode($r->filename)."\">/web/$r->filename</a></td>";
|
|
if($r->dt=="0000-00-00 00:00:00") $dt="Never";
|
|
else $dt=$r->dt;
|
|
echo "<td>$dt</td>";
|
|
echo "</tr>";
|
|
|
|
|
|
}
|
|
echo "</table>";
|
|
}
|
|
|
|
send_footer();
|
|
?>
|