sort news by date

This commit is contained in:
Philip Häusler 2014-12-26 18:39:16 +01:00
parent 47b52bc3f6
commit 9007bb6790
2 changed files with 8 additions and 2 deletions

View File

@ -38,7 +38,13 @@ function admin_news() {
case 'save': case 'save':
list($news) = $news; list($news) = $news;
sql_query("UPDATE `News` SET `Datum`='" . sql_escape(time()) . "', `Betreff`='" . sql_escape($_POST["eBetreff"]) . "', `Text`='" . sql_escape($_POST["eText"]) . "', `UID`='" . sql_escape($user['UID']) . "', `Treffen`='" . sql_escape($_POST["eTreffen"]) . "' WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); sql_query("UPDATE `News` SET
`Datum`='" . sql_escape(time()) . "',
`Betreff`='" . sql_escape($_POST["eBetreff"]) . "',
`Text`='" . sql_escape($_POST["eText"]) . "',
`UID`='" . sql_escape($user['UID']) . "',
`Treffen`='" . sql_escape($_POST["eTreffen"]) . "'
WHERE `ID`=" . sql_escape($id));
engelsystem_log("News updated: " . $_POST["eBetreff"]); engelsystem_log("News updated: " . $_POST["eBetreff"]);
success(_("News entry updated.")); success(_("News entry updated."));
redirect(page_link_to("news")); redirect(page_link_to("news"));

View File

@ -132,7 +132,7 @@ function user_news() {
else else
$page = 0; $page = 0;
$news = sql_select("SELECT * FROM `News` ORDER BY `ID` DESC LIMIT " . sql_escape($page * $DISPLAY_NEWS) . ", " . sql_escape($DISPLAY_NEWS)); $news = sql_select("SELECT * FROM `News` ORDER BY `Datum` DESC LIMIT " . sql_escape($page * $DISPLAY_NEWS) . ", " . sql_escape($DISPLAY_NEWS));
foreach ($news as $entry) foreach ($news as $entry)
$html .= display_news($entry); $html .= display_news($entry);