This repository was archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathonline.php
181 lines (146 loc) · 7.21 KB
/
online.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
/**
* Подробно показывает всех кто есть на форуме.
*
* @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org
* @modified Copyright (C) 2008-2009 Flazy.ru
* @license http://www.gnu.org/licenses/gpl.html GPL версии 2 или выше
* @package Flazy
*/
if (!defined('FORUM_ROOT'))
define('FORUM_ROOT', './');
require FORUM_ROOT.'include/common.php';
($hook = get_hook('on_start')) ? eval($hook) : null;
// Check for use of incorrect URLs
confirm_current_url(forum_link($forum_url['online']));
if (!$forum_user['g_read_board'] || !$forum_config['o_users_online'])
message($lang_common['No view']);
function ip($ip)
{
$ip = ereg('([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})', $ip, $array) ? $array[1].'.'.$array[2] : '0.0';
return $ip.'.*.*';
}
// Load the online.php language file
require FORUM_ROOT.'lang/'.$forum_user['language'].'/online.php';
// Setup breadcrumbs
$forum_page['crumbs'] = array(
array($forum_config['o_board_title'], forum_link($forum_url['index'])),
array($lang_online['Online List'],forum_link($forum_url['online']))
);
define('FORUM_ALLOW_INDEX', 1);
define('FORUM_PAGE', 'online');
require FORUM_ROOT.'header.php';
// START SUBST - <!-- forum_main -->
ob_start();
?>
<div class="main-content main-frm">
<div class="ct-group">
<table cellspacing="0">
<thead>
<th class="tc0" style="width:25%" scope="col"><?php echo $lang_online['Name'] ?></th>
<th class="tc1" style="width:50%" scope="col"><?php echo $lang_online['Last action'] ?></th>
<th class="tc2" style="width:25%" scope="col"><?php echo $lang_online['Time'] ?></th>
</thead>
<tbody>
<?php
// Получим список участников
$query = array(
'SELECT' => 'o.user_id, o.ident, o.logged, o.idle, o.current_page, o.current_page_id, o.current_ip ',
'FROM' => 'online AS o',
'WHERE' => 'o.idle=0 AND o.user_id>0',
'ORDER BY' => 'o.ident'
);
($hook = get_hook('on_online_list_qr_get')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
$num_users_page = $forum_db->num_rows($result);
if ($num_users_page)
{
$num = 0;
while ($user_data = $forum_db->fetch_assoc($result))
{
if ($user_data['current_page'])
{
if ($user_data['user_id'] > 1)
{
$ip = ($forum_user['is_admmod']) ? '<sup><a href="'.forum_link($forum_url['get_host'], $user_data['current_ip']).'">'.forum_htmlencode($user_data['current_ip']).'</a> <a href="'.forum_link('click.php').'?http://www.ripe.net/whois?form_type=simple&full_query_string=&searchtext='.forum_htmlencode($user_data['current_ip']).'&do_search=Search" onclick="window.open(this.href); return false">Whois</a></sup>' : '';
$list['user'] = '<td class="tc0"><a href="'.forum_link($forum_url['user'], $user_data['user_id']).'">'.forum_htmlencode($user_data['ident']).'</a> '.$ip.'</td>';
}
else
$list['user'] = '<td class="tc0">'.$lang_online['Guest'].''.(($forum_user['is_admmod']) ? ' <sup><a href="'.forum_link($forum_url['get_host'], forum_htmlencode($user_data['current_ip'])).'">'.forum_htmlencode($user_data['current_ip']).'</a> <a href="'.forum_link('click.php').'?http://www.ripe.net/whois?form_type=simple&full_query_string=&searchtext='.forum_htmlencode($user_data['current_ip']).'&do_search=Search" onclick="window.open(this.href); return false">Whois</a></sup>' : '<sup> IP: '.ip(forum_htmlencode($user_data['ident'])).'</sup>').'</td>';
($hook = get_hook('on_pre_current_page_id')) ? eval($hook) : null;
// Если форум находится не в корне
$pathinfo = pathinfo($_SERVER['PHP_SELF']);
$lang_page = substr($user_data['current_page'], strlen($pathinfo['dirname']));
$pathinfo_sec = pathinfo($user_data['current_page']);
$cur_page = $pathinfo_sec['basename'];
if (substr($cur_page, 0, 5) == 'admin')
$cur_page = 'admin';
if ($user_data['current_page_id'] > 0)
{
if ($cur_page == 'viewtopic' || $cur_page == 'post')
$page_name = $forum_db->query('SELECT subject FROM '.$forum_db->prefix.'topics WHERE id=\''.$user_data['current_page_id'].'\'');
if ($cur_page == 'postedit')
$page_name = $forum_db->query('SELECT t.subject FROM '.$forum_db->prefix.'topics AS t INNER JOIN '.$forum_db->prefix.'posts AS p ON t.id=p.topic_id WHERE p.id=\''.$user_data['current_page_id'].'\'');
if ($cur_page == 'viewforum')
$page_name = $forum_db->query('SELECT forum_name FROM '.$forum_db->prefix.'forums WHERE id=\''.$user_data['current_page_id'].'\'');
if ($cur_page == 'profile-about' && $cur_page != 'profile-pm' || $cur_page == 'reputation' || $cur_page == 'positive')
$page_name = $forum_db->query('SELECT username FROM '.$forum_db->prefix.'users WHERE id=\''.$user_data['current_page_id'].'\'');
($hook = get_hook('on_after_current_page_id_qr_get')) ? eval($hook) : null;
if (!empty($page_name))
{
$page_name = $forum_db->result($page_name, 0);
if ($forum_config['o_censoring'])
$page_name = censor_words($page_name);
if ($cur_page == 'post')
$list['page'] = '<td class="tc1">'.$lang_online[$cur_page].': <strong><a href="'.forum_link($forum_url['topic'], array($user_data['current_page_id'], sef_friendly($page_name))).'">'.forum_htmlencode($page_name).'</a></strong></td>';
if ($cur_page == 'postedit')
$list['page'] = '<td class="tc1">'.$lang_online[$cur_page].': <strong><a href="'.forum_link($forum_url['post'], array($user_data['current_page_id'], sef_friendly($page_name))).'">'.forum_htmlencode($page_name).'</a></strong></td>';
if ($cur_page != 'post' && $cur_page != 'postedit' && $page_name != '')
$list['page'] = '<td class="tc1">'.$lang_online[$cur_page].': <strong><a href="'.forum_link($forum_url[$url_online[$cur_page]], array($user_data['current_page_id'], sef_friendly($page_name))).'">'.forum_htmlencode($page_name).'</a></strong></td>';
($hook = get_hook('on_current_cur_page_id')) ? eval($hook) : null;
}
else
$list['page'] = '<td class="tc1">'.$lang_online[$cur_page].'</td>';
($hook = get_hook('on_pre_not_page_name')) ? eval($hook) : null;
}
else if ((@$lang_online[$cur_page]) == '')
$list['page'] = '<td class="tc1">'.$lang_online['Hiding Somewhere'].'</td>';
else
{
if (!empty($url_online[$cur_page]))
$list['page'] = '<td class="tc1"><a href="'.forum_link( $forum_url[$url_online[$cur_page]]).'">'.$lang_online[$cur_page].'</a></td>';
else
$list['page'] = '<td class="tc1">'.$lang_online[$cur_page].'</td>';
}
($hook = get_hook('on_pre_list_time')) ? eval($hook) : null;
$list['time'] = '<td class="tc2">'.format_time($user_data['logged']).'</td>';
$num++;
}
?>
<tr class="<?php echo ($num % 2 == 0 ? 'even' : 'odd') ?>">
<?php echo implode("\n\t\t\t\t\t", $list)."\n"; ?>
</tr>
<?php
}
}
else
{
?>
<tr>
<tr><td colspan="4"><? echo $lang_online['Nobody'] ?></td>
</tr>
<?php
($hook = get_hook('on_after_nobody')) ? eval($hook) : null;
}
?>
</tbody>
</table>
</div>
</div>
<?php
($hook = get_hook('on_end')) ? eval($hook) : null;
$tpl_temp = forum_trim(ob_get_contents());
$tpl_main = str_replace('<!-- forum_main -->', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <!-- forum_main -->
require FORUM_ROOT.'footer.php';