forked from ZonD80/appaddict.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnews.php
38 lines (26 loc) · 868 Bytes
/
news.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require_once 'init.php';
$id = $API->getval('id', 'int');
$API->TPL->assign('pagetitle', $API->LANG->_('Site News'));
$API->TPL->assign('footername', $API->LANG->_('Site News'));
$cache = $API->CACHE->get('news', 'all');
if ($cache === false) {
$allnews = $API->DB->query_return("SELECT id,title FROM news ORDER BY added DESC");
$API->CACHE->set('news', 'all', $allnews);
}
else
$allnews = $cache;
if (!$allnews) {
$API->TPL->assign('message', $API->LANG->_('There are no news yet. Come back later.'));
$API->TPL->display('message.tpl');
die();
}
$API->TPL->assign('allnews', $allnews);
if (!$id)
$id = $allnews[0]['id'];
$news = $API->DB->query_row("SELECT * FROM news WHERE id=$id");
if (!$news)
$API->error($API->LANG->_('No news with such ID'));
$API->TPL->assign('news', $news);
$API->TPL->display('news.tpl');
?>