-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.php
163 lines (133 loc) · 6.22 KB
/
index.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
/**
* Copyright (C) 2008-2012 FluxBB
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/
define('PUN_ROOT', dirname(__FILE__).'/');
require PUN_ROOT.'include/common.php';
if ($pun_user['g_read_board'] == '0')
message($lang_common['No view'], false, '403 Forbidden');
// Load the index.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
// Get list of forums and topics with new posts since last visit
//if (!$pun_user['is_guest'])
//{
// $result = $db->query('SELECT t.forum_id, t.id, t.last_post FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.$pun_user['last_visit'].' AND t.moved_to IS NULL') or error('Unable to fetch new topics', __FILE__, __LINE__, $db->error());
//
// $new_topics = array();
// while ($cur_topic = $db->fetch_assoc($result))
// $new_topics[$cur_topic['forum_id']][$cur_topic['id']] = $cur_topic['last_post'];
//
// $tracked_topics = get_tracked_topics();
//}
if ($pun_config['o_feed_type'] == '1')
$page_head = array('feed' => '<link rel="alternate" type="application/rss+xml" href="extern.php?action=feed&type=rss" title="'.$lang_common['RSS active topics feed'].'" />');
else if ($pun_config['o_feed_type'] == '2')
$page_head = array('feed' => '<link rel="alternate" type="application/atom+xml" href="extern.php?action=feed&type=atom" title="'.$lang_common['Atom active topics feed'].'" />');
$forum_actions = array();
// Display a "mark all as read" link
if (!$pun_user['is_guest'])
$forum_actions[] = '<a href="misc.php?action=markread&csrf_hash='.csrf_hash('misc.php').'">'.$lang_common['Mark all as read'].'</a>';
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']));
define('PUN_ALLOW_INDEX', 1);
define('PUN_ACTIVE_PAGE', 'index');
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/subforums_view.php'; // MOD subforums - Visman
// Collect some statistics from the database
if (file_exists(FORUM_CACHE_DIR.'cache_users_info.php'))
include FORUM_CACHE_DIR.'cache_users_info.php';
if (!defined('PUN_USERS_INFO_LOADED'))
{
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
require PUN_ROOT.'include/cache.php';
generate_users_info_cache();
require FORUM_CACHE_DIR.'cache_users_info.php';
}
$result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());
list($stats['total_topics'], $stats['total_posts']) = array_map('intval', $db->fetch_row($result));
if ($pun_user['g_view_users'] == '1')
$stats['newest_user'] = '<a href="profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a>';
else
$stats['newest_user'] = pun_htmlspecialchars($stats['last_user']['username']);
if (!empty($forum_actions))
{
?>
<div class="linksb">
<div class="inbox crumbsplus">
<p class="subscribelink clearb"><?php echo implode(' - ', $forum_actions); ?></p>
</div>
</div>
<?php
}
?>
<div id="brdstats" class="block">
<h2><span><?php echo $lang_index['Board info'] ?></span></h2>
<div class="box">
<div class="inbox">
<dl class="conr">
<dt><strong><?php echo $lang_index['Board stats'] ?></strong></dt>
<dd><span><?php printf($lang_index['No of users'], '<strong>'.forum_number_format($stats['total_users']).'</strong>') ?></span></dd>
<dd><span><?php printf($lang_index['No of topics'], '<strong>'.forum_number_format($stats['total_topics']).'</strong>') ?></span></dd>
<dd><span><?php printf($lang_index['No of posts'], '<strong>'.forum_number_format($stats['total_posts']).'</strong>') ?></span></dd>
</dl>
<dl class="conl">
<dt><strong><?php echo $lang_index['User info'] ?></strong></dt>
<dd><span><?php printf($lang_index['Newest user'], $stats['newest_user']) ?></span></dd>
<?php
if ($pun_config['o_users_online'] == '1')
{
// Fetch users online info and generate strings for output
$num_guests = count($onl_g);
$num_bots = 0;
$num_users = count($onl_u);
$users = $bots = array();
foreach ($onl_u as $online_id => $online_name)
{
if ($pun_user['g_view_users'] == '1')
$users[] = "\n\t\t\t\t".'<dd><a href="profile.php?id='.$online_id.'">'.pun_htmlspecialchars($online_name).'</a>';
else
$users[] = "\n\t\t\t\t".'<dd>'.pun_htmlspecialchars($online_name);
}
foreach ($onl_g as $online_name)
{
if (strpos($online_name, '[Bot]') !== false)
{
++$num_bots;
$arr_o_name = explode('[Bot]', $online_name);
if (empty($bots[$arr_o_name[1]]))
$bots[$arr_o_name[1]] = 1;
else
++$bots[$arr_o_name[1]];
}
}
foreach ($bots as $online_name => $online_id)
{
$users[] = "\n\t\t\t\t".'<dd>[Bot] '.pun_htmlspecialchars($online_name.($online_id > 1 ? ' ('.$online_id.')' : ''));
}
echo "\t\t\t\t".'<dd><span>'.sprintf($lang_index['Users online'], '<strong>'.forum_number_format($num_users).'</strong>').', '.sprintf($lang_index['Guests online'], '<strong>'.forum_number_format($num_guests).'</strong>').'</span></dd>'."\n";
// max users - Visman
echo "\t\t\t\t".'<dd><span>'. $lang_index['Most online1'].' ('.$pun_config['st_max_users'].') '.$lang_index['Most online2'].' '.format_time($pun_config['st_max_users_time']).'</span></dd>'."\n\t\t\t".'</dl>'."\n";
if ($num_users + $num_bots > 0)
echo "\t\t\t".'<dl id="onlinelist" class="clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].' </strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
else
echo "\t\t\t".'<div class="clearer"></div>'."\n";
}
else
echo "\t\t\t".'</dl>'."\n\t\t\t".'<div class="clearer"></div>'."\n";
?>
</div>
</div>
</div>
<?php
// Mod collapse - Visman
$page_js['f']['collapse'] = 'js/collapse.js';
$page_js['c'][] = 'if (typeof FluxBB === \'undefined\' || !FluxBB) {var FluxBB = {};}
FluxBB.vars = {
collapse_cookieid: "'.$cookie_name.'_",
collapse_folder: "'.(file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/exp_down.png') ? 'style/'.$pun_user['style'].'/' : 'img/').'"
};
FluxBB.collapse.init();';
// Mod collapse - Visman
$footer_style = 'index';
require PUN_ROOT.'footer.php';