Cleanups to the developer news pages.

This commit is contained in:
Jeff Teunissen 2007-03-22 05:41:10 +00:00
parent 048c12ede6
commit 26e9f1b525
3 changed files with 13 additions and 42 deletions

View file

@ -3,12 +3,13 @@
$need = 'auth';
require "parts/preamble.php"; // Load most of document
$newsText = addSlashes ($_REQUEST['newsText']);
need ('boxes html news sql');
$newsText = addSlashes($_REQUEST['newsText']);
$mode = $_REQUEST['mode'];
$user = $userInfo['u_displayname'];
if ($newsText && $mode == "Post") {
need ('sql');
$query = 'INSERT into news_main (n_date, n_user, n_news) VALUES ('
."NOW(), '$user', '$newsText')";
@ -24,8 +25,6 @@
} else {
$date = date ('d M Y');
need ('boxes news');
newsBoxOpen ();
if ($newsText) {
newsBoxTitle ("Latest News (Preview)");
@ -34,7 +33,7 @@
newsBoxTitle ("Post News");
$form = '<FORM action="' . thisURL . '" method="post">'
. '<TEXTAREA name="newsText" rows="25" cols="64">'
. stripSlashes ($newsText)
. convertFromHTML (stripSlashes ($newsText))
. '</TEXTAREA><BR>'
. '<INPUT align="center" type="submit" name="mode" value="Post"></INPUT>'
. '<INPUT align="center" type="submit" name="mode" value="Preview"></INPUT>'

View file

@ -6,25 +6,9 @@
if (!$userInfo['u_admin']) // no access from non-admin yet
bailout ("<P>You don't have access to this page (yet?). Bug an admin to delete a news post.</P>");
need ('boxes news sql');
function convertToHTML ($string)
{
$table = array_flip (get_html_translation_table (HTML_ENTITIES));
return strtr ($string, $table);
}
function convertFromHTML ($string)
{
$table = get_html_translation_table (HTML_ENTITIES);
return strtr ($string, $table);
}
function newsEntrySummary ($it)
{
need ("date");
need ('date html');
return
'<TR>'
@ -37,7 +21,7 @@
function newsEntryConfirmation ($a)
{
need ("date");
need ('boxes date html news');
$id = $a['n_id'];
@ -47,6 +31,8 @@
newsBoxClose ();
}
need ('boxes sql');
$newsID = addSlashes ($_REQUEST['newsID']);
$confirm = $_REQUEST['confirm'];

View file

@ -6,43 +6,29 @@
if (!$userInfo['u_admin']) // no access from non-admin yet
bailout ("<P>You don't have access to this page (yet?). Bug an admin to delete a news post.</P>");
need ('sql');
function convertToHTML ($string)
{
$table = array_flip (get_html_translation_table (HTML_ENTITIES));
return strtr ($string, $table);
}
function convertFromHTML ($string)
{
$table = get_html_translation_table (HTML_ENTITIES);
return strtr ($string, $table);
}
need ('html sql');
function newsEntrySummary ($it)
{
need ("date");
need ('date html');
return
'<TR>'
.' <TD><A href="' . thisURL . '?newsID=' . $it['n_id'] . '">' . $it['n_id'] . '</A></TD>'
.' <TD>' . dateFromSQLDateTime ($it['n_date']) . '</TD>'
.' <TD>' . $it['n_user'] . '</TD>'
.' <TD>' . substr (convertFromHTML (StripSlashes ($it['n_news'])), 0, 50) . '&#8230;</TD>'
.' <TD>' . substr (convertFromHTML (stripSlashes ($it['n_news'])), 0, 50) . '&#8230;</TD>'
.'</TR>';
}
function newsEntryEditor ($array)
{
need ("boxes date news");
need ('boxes html date');
$id = $array['n_id'];
$usr = $array['n_user'];
$txt = convertFromHTML (stripSlashes ($array['n_news']));
$date = dateFromSQLDateTime ($array['n_date']);
$txt = convertFromHTML (stripSlashes ($array['n_news']));
newsBoxOpen ("Edit News Entry #$id");
?>