mirror of
https://git.code.sf.net/p/quake/website
synced 2024-11-30 16:01:24 +00:00
Cleanups to the developer news pages.
This commit is contained in:
parent
048c12ede6
commit
26e9f1b525
3 changed files with 13 additions and 42 deletions
|
@ -3,12 +3,13 @@
|
||||||
$need = 'auth';
|
$need = 'auth';
|
||||||
require "parts/preamble.php"; // Load most of document
|
require "parts/preamble.php"; // Load most of document
|
||||||
|
|
||||||
$newsText = addSlashes ($_REQUEST['newsText']);
|
need ('boxes html news sql');
|
||||||
|
|
||||||
|
$newsText = addSlashes($_REQUEST['newsText']);
|
||||||
$mode = $_REQUEST['mode'];
|
$mode = $_REQUEST['mode'];
|
||||||
$user = $userInfo['u_displayname'];
|
$user = $userInfo['u_displayname'];
|
||||||
|
|
||||||
if ($newsText && $mode == "Post") {
|
if ($newsText && $mode == "Post") {
|
||||||
need ('sql');
|
|
||||||
|
|
||||||
$query = 'INSERT into news_main (n_date, n_user, n_news) VALUES ('
|
$query = 'INSERT into news_main (n_date, n_user, n_news) VALUES ('
|
||||||
."NOW(), '$user', '$newsText')";
|
."NOW(), '$user', '$newsText')";
|
||||||
|
@ -24,8 +25,6 @@
|
||||||
} else {
|
} else {
|
||||||
$date = date ('d M Y');
|
$date = date ('d M Y');
|
||||||
|
|
||||||
need ('boxes news');
|
|
||||||
|
|
||||||
newsBoxOpen ();
|
newsBoxOpen ();
|
||||||
if ($newsText) {
|
if ($newsText) {
|
||||||
newsBoxTitle ("Latest News (Preview)");
|
newsBoxTitle ("Latest News (Preview)");
|
||||||
|
@ -34,7 +33,7 @@
|
||||||
newsBoxTitle ("Post News");
|
newsBoxTitle ("Post News");
|
||||||
$form = '<FORM action="' . thisURL . '" method="post">'
|
$form = '<FORM action="' . thisURL . '" method="post">'
|
||||||
. '<TEXTAREA name="newsText" rows="25" cols="64">'
|
. '<TEXTAREA name="newsText" rows="25" cols="64">'
|
||||||
. stripSlashes ($newsText)
|
. convertFromHTML (stripSlashes ($newsText))
|
||||||
. '</TEXTAREA><BR>'
|
. '</TEXTAREA><BR>'
|
||||||
. '<INPUT align="center" type="submit" name="mode" value="Post"></INPUT>'
|
. '<INPUT align="center" type="submit" name="mode" value="Post"></INPUT>'
|
||||||
. '<INPUT align="center" type="submit" name="mode" value="Preview"></INPUT>'
|
. '<INPUT align="center" type="submit" name="mode" value="Preview"></INPUT>'
|
||||||
|
|
22
news_del.php
22
news_del.php
|
@ -6,25 +6,9 @@
|
||||||
if (!$userInfo['u_admin']) // no access from non-admin yet
|
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>");
|
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)
|
function newsEntrySummary ($it)
|
||||||
{
|
{
|
||||||
need ("date");
|
need ('date html');
|
||||||
|
|
||||||
return
|
return
|
||||||
'<TR>'
|
'<TR>'
|
||||||
|
@ -37,7 +21,7 @@
|
||||||
|
|
||||||
function newsEntryConfirmation ($a)
|
function newsEntryConfirmation ($a)
|
||||||
{
|
{
|
||||||
need ("date");
|
need ('boxes date html news');
|
||||||
|
|
||||||
$id = $a['n_id'];
|
$id = $a['n_id'];
|
||||||
|
|
||||||
|
@ -47,6 +31,8 @@
|
||||||
newsBoxClose ();
|
newsBoxClose ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
need ('boxes sql');
|
||||||
|
|
||||||
$newsID = addSlashes ($_REQUEST['newsID']);
|
$newsID = addSlashes ($_REQUEST['newsID']);
|
||||||
$confirm = $_REQUEST['confirm'];
|
$confirm = $_REQUEST['confirm'];
|
||||||
|
|
||||||
|
|
|
@ -6,43 +6,29 @@
|
||||||
if (!$userInfo['u_admin']) // no access from non-admin yet
|
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>");
|
bailout ("<P>You don't have access to this page (yet?). Bug an admin to delete a news post.</P>");
|
||||||
|
|
||||||
need ('sql');
|
need ('html 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)
|
function newsEntrySummary ($it)
|
||||||
{
|
{
|
||||||
need ("date");
|
need ('date html');
|
||||||
|
|
||||||
return
|
return
|
||||||
'<TR>'
|
'<TR>'
|
||||||
.' <TD><A href="' . thisURL . '?newsID=' . $it['n_id'] . '">' . $it['n_id'] . '</A></TD>'
|
.' <TD><A href="' . thisURL . '?newsID=' . $it['n_id'] . '">' . $it['n_id'] . '</A></TD>'
|
||||||
.' <TD>' . dateFromSQLDateTime ($it['n_date']) . '</TD>'
|
.' <TD>' . dateFromSQLDateTime ($it['n_date']) . '</TD>'
|
||||||
.' <TD>' . $it['n_user'] . '</TD>'
|
.' <TD>' . $it['n_user'] . '</TD>'
|
||||||
.' <TD>' . substr (convertFromHTML (StripSlashes ($it['n_news'])), 0, 50) . '…</TD>'
|
.' <TD>' . substr (convertFromHTML (stripSlashes ($it['n_news'])), 0, 50) . '…</TD>'
|
||||||
.'</TR>';
|
.'</TR>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function newsEntryEditor ($array)
|
function newsEntryEditor ($array)
|
||||||
{
|
{
|
||||||
need ("boxes date news");
|
need ('boxes html date');
|
||||||
|
|
||||||
$id = $array['n_id'];
|
$id = $array['n_id'];
|
||||||
$usr = $array['n_user'];
|
$usr = $array['n_user'];
|
||||||
$txt = convertFromHTML (stripSlashes ($array['n_news']));
|
|
||||||
$date = dateFromSQLDateTime ($array['n_date']);
|
$date = dateFromSQLDateTime ($array['n_date']);
|
||||||
|
$txt = convertFromHTML (stripSlashes ($array['n_news']));
|
||||||
|
|
||||||
newsBoxOpen ("Edit News Entry #$id");
|
newsBoxOpen ("Edit News Entry #$id");
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue