2005-11-21 20:33:18 +00:00
< ?
/*
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 " ;
2007-10-23 21:24:01 +00:00
if ( is_dir ( " ../fckeditor " ) && file_exists ( " ../fckeditor/fckeditor.php " ))
{
require_once ( " ../fckeditor/fckeditor.php " );
$oFCKeditor = new FCKeditor ( 'text' ) ;
$oFCKeditor -> BasePath = " ../fckeditor/ " ;
$oFCKeditor -> Value = $r -> text ;
$oFCKeditor -> Width = " 100% " ;
$oFCKeditor -> Height = 500 ;
$oFCKeditor -> Create () ;
}
else
{
2005-11-21 20:33:18 +00:00
echo " <textarea rows=8 cols=60 name= \" text \" > " . htmlspecialchars ( $r -> text ) . " </textarea> " ;
echo " <br /> " ;
2007-10-23 21:24:01 +00:00
}
2005-11-21 20:33:18 +00:00
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 " );
2006-01-19 17:15:07 +00:00
echo " <tr><th> " . i18n ( " Page Text Name " ) . " </th><th> " . i18n ( " Last Update " ) . " </th></tr> " ;
2005-11-21 20:33:18 +00:00
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 ();
?>