diff options
author | Christian Klinger | 2016-07-05 11:20:53 +0200 |
---|---|---|
committer | Christian Klinger | 2016-07-05 11:20:53 +0200 |
commit | 3b7e02631c89641d94534c13bebf646385c518a8 (patch) | |
tree | cf0fefd63963178d0b644ae6bb8dea131dd55fdf /modules-available/news | |
parent | i18n for bootstrap_datepicker. (diff) | |
download | slx-admin-3b7e02631c89641d94534c13bebf646385c518a8.tar.gz slx-admin-3b7e02631c89641d94534c13bebf646385c518a8.tar.xz slx-admin-3b7e02631c89641d94534c13bebf646385c518a8.zip |
fixed bug.
Diffstat (limited to 'modules-available/news')
-rw-r--r-- | modules-available/news/page.inc.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/modules-available/news/page.inc.php b/modules-available/news/page.inc.php index f77f1881..50e07458 100644 --- a/modules-available/news/page.inc.php +++ b/modules-available/news/page.inc.php @@ -48,8 +48,9 @@ class Page_News extends Page $this->newsContent = false; $this->newsDate = false; } elseif ($action === 'show') { - /* load latest help */ - $this->loadLatestHelp(Request::any('newsid')); + /* load latest things */ + $this->loadLatest('help'); + $this->loadLatest('news'); /* and also the news (or help) with the given id */ if (!$this->loadNews(Request::any('newsid'))) { @@ -158,6 +159,7 @@ class Page_News extends Page $this->newsTitle = $row['title']; $this->newsContent = $row['content']; $this->newsDate = $row['dateline']; + $this->editHelp = false; } else { $this->editHelp = true; $this->helpContent = $row['content']; @@ -167,11 +169,18 @@ class Page_News extends Page return $row !== false; } - private function loadLatestHelp() + private function loadLatest($type) { - $row = Database::queryFirst("SELECT newsid, content, dateline, type FROM vmchooser_pages WHERE type='help' ORDER BY dateline DESC LIMIT 1", []); + $row = Database::queryFirst("SELECT newsid, title, content, dateline, type FROM vmchooser_pages WHERE type=:type ORDER BY dateline DESC LIMIT 1", ['type' => $type]); if ($row !== false) { - $this->helpContent = $row['content']; + if ($row['type'] == 'news') { + $this->newsId = $row['newsid']; + $this->newsTitle = $row['title']; + $this->newsContent = $row['content']; + $this->newsDate = $row['dateline']; + } else { + $this->helpContent = $row['content']; + } } } |