-
Notifications
You must be signed in to change notification settings - Fork 1
/
news.php
88 lines (74 loc) · 3.02 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* News display, which is the first page shown when a user visits a chan's index
*
* Any news added by an administrator in the manage panel will show here, with
* the newest entry on the top.
*
* @package kusaba
*/
// ========================================
// get config
require_once 'config.php';
// redundant call
//require KU_ROOTDIR.'inc/functions.php';
// get dwoo
require_once KU_ROOTDIR.'lib/dwoo.php';
$dwoo_tpl = new Dwoo_Template_File(KU_TEMPLATEDIR.'/news.tpl');
// we're ad free, thanks
/*$topads = $tc_db->GetOne("SELECT code FROM `" . KU_DBPREFIX . "ads` WHERE `position` = 'top' AND `disp` = '1'");
$botads = $tc_db->GetOne("SELECT code FROM `" . KU_DBPREFIX . "ads` WHERE `position` = 'bot' AND `disp` = '1'");
$dwoo_data->assign('topads', $topads);
$dwoo_data->assign('botads', $botads);*/
// get the type of page
// kusaba-helma
$page = isset($_GET['p']) ? $_GET['p'] : '';
$entries = null;
if ($page == 'links') {
$entries = $tc_db->GetAll('SELECT `id`, `subject`, `poster`, `timestamp`, `message` FROM `front` WHERE `page` = 1 ORDER BY `order` ASC');
}
else if ($page == 'rules') {
$entries = $tc_db->GetAll('SELECT `id`, `subject`, `poster`, `timestamp`, `message` FROM `front` WHERE `page` = 2 ORDER BY `order` ASC');
}
else {
$entries = $tc_db->GetAll('SELECT `id`, `subject`, `poster`, `timestamp`, `message` FROM `front` WHERE `page` = 0 ORDER BY `timestamp` DESC');
$page = 'news';
}
$dwoo_data->assign('page', $page);
// we'll handle styles our way
//$styles = explode(':', KU_MENUSTYLES);
//$dwoo_data->assign('styles', $styles);
// why?
//$dwoo_data->assign('ku_webpath', getCWebPath());
//vanilla
//if (!isset($_GET['p'])) $_GET['p'] = '';
//if ($_GET['p'] == 'links') {
// $entries = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "front` WHERE `page` = 1 ORDER BY `order` ASC");
//} elseif ($_GET['p'] == 'rules') {
// $entries = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "front` WHERE `page` = 2 ORDER BY `order` ASC");
//} else {
// $entries = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "front` WHERE `page` = 0 ORDER BY `timestamp` DESC");
//}
// sideload attempts
if (isset($_GET['mode']) && $_GET['mode'] == 'sideload') {
$dwoo_data->assign('sideload', true);
}
// assign the entries and output
$dwoo_data->assign('entries', $entries);
$dwoo->output($dwoo_tpl, $dwoo_data);