From 26e9f1b525889312760c93445f7c248a8f2d1867 Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Thu, 22 Mar 2007 05:41:10 +0000 Subject: [PATCH] Cleanups to the developer news pages. --- news_add.php | 9 ++++----- news_del.php | 22 ++++------------------ news_edit.php | 24 +++++------------------- 3 files changed, 13 insertions(+), 42 deletions(-) diff --git a/news_add.php b/news_add.php index d7c86f5..0cc5ffe 100644 --- a/news_add.php +++ b/news_add.php @@ -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 = '
' . '
' . '' . '' diff --git a/news_del.php b/news_del.php index 8035509..0e661a9 100644 --- a/news_del.php +++ b/news_del.php @@ -6,25 +6,9 @@ if (!$userInfo['u_admin']) // no access from non-admin yet bailout ("

You don't have access to this page (yet?). Bug an admin to delete a news post.

"); - 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 '' @@ -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']; diff --git a/news_edit.php b/news_edit.php index aef72b8..17b28bb 100644 --- a/news_edit.php +++ b/news_edit.php @@ -6,43 +6,29 @@ if (!$userInfo['u_admin']) // no access from non-admin yet bailout ("

You don't have access to this page (yet?). Bug an admin to delete a news post.

"); - 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 '' .' ' . $it['n_id'] . '' .' ' . dateFromSQLDateTime ($it['n_date']) . '' .' ' . $it['n_user'] . '' - .' ' . substr (convertFromHTML (StripSlashes ($it['n_news'])), 0, 50) . '…' + .' ' . substr (convertFromHTML (stripSlashes ($it['n_news'])), 0, 50) . '…' .''; } 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"); ?>