forked from flazyforum/Flazy-Core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathonline.php
157 lines (135 loc) · 8.57 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
<?php
/**
* Подробно показывает всех кто есть на форуме.
*
* @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org
* @modified Copyright (C) 2014-2018 Flazy
* @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_fl_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']);
// 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']))
);
($hook = get_hook('on_fl_pre_header_load')) ? eval($hook) : null;
define('FORUM_ALLOW_INDEX', 1);
define('FORUM_PAGE', 'online');
require FORUM_ROOT . 'header.php';
// START SUBST - <forum_main>
ob_start();
$forum_page['table_header'] = array();
$forum_page['table_header']['username'] = '<th class="tc' . count($forum_page['table_header']) . '" style="width:25%" scope="col">' . $lang_common['Username'] . '</th>';
$forum_page['table_header']['action'] = '<th class="tc' . count($forum_page['table_header']) . '" style="width:50%" scope="col">' . $lang_online['Last action'] . '</th>';
$forum_page['table_header']['time'] = '<th class="tc' . count($forum_page['table_header']) . '" style="width:25%" scope="col">' . $lang_online['Time'] . '</th>';
($hook = get_hook('on_fl_results_pre_header_output')) ? eval($hook) : null;
?>
<div class="main-content main-frm">
<table cellspacing="0">
<thead>
<tr>
<?php echo implode("\n\t\t\t\t", $forum_page['table_header']) . "\n" ?>
</tr>
</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, t.subject, u.username, f.forum_name, t1.subject AS subject_edit',
'FROM' => 'online AS o',
'JOINS' => array(
array(
'LEFT JOIN' => 'topics AS t',
'ON' => 't.id=o.current_page_id'
),
array(
'LEFT JOIN' => 'users AS u',
'ON' => 'u.id=o.current_page_id'
),
array(
'LEFT JOIN' => 'forums AS f',
'ON' => 'f.id=o.current_page_id'
),
array(
'LEFT JOIN' => 'posts AS p',
'ON' => 'p.id=o.current_page_id'
),
array(
'LEFT JOIN' => 'topics AS t1',
'ON' => 't1.id=p.topic_id'
),
),
'WHERE' => 'o.idle=0',
'ORDER BY' => 'o.ident'
);
($hook = get_hook('on_fl_online_list_qr_get')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
if ($forum_db->num_rows($result)) {
$forum_page['item_count'] = 0;
while ($cur_online = $forum_db->fetch_assoc($result)) {
$list = array();
if ($cur_online['user_id'] > 1) {
$ip = ($forum_user['is_admmod']) ? '<sup><a href="' . forum_link($forum_url['get_host'], $cur_online['current_ip']) . '">' . forum_htmlencode($cur_online['current_ip']) . '</a> <a href="' . forum_link('click.php') . '?http://www.ripe.net/whois?form_type=simple&full_query_string=&searchtext=' . forum_htmlencode($cur_online['current_ip']) . '&do_search=Search" onclick="window.open(this.href); return false">Whois</a></sup>' : '';
$page_user = '<a href="' . forum_link($forum_url['user'], $cur_online['user_id']) . '">' . forum_htmlencode($cur_online['ident']) . '</a> ' . $ip . '';
} else {
$ip = (preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', $cur_online['ident'], $matches) || preg_match('/^([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4}):([0-9A-Fa-f]{1,4})$/', $cur_online['ident'], $matches)) ? $matches[1] . '.' . $matches[2] . '.*.*' : intval($cur_online['ident']);
$page_user = $lang_online['Guest'] . '' . (($forum_user['is_admmod']) ? ' <sup><a href="' . forum_link($forum_url['get_host'], forum_htmlencode($cur_online['current_ip'])) . '">' . forum_htmlencode($cur_online['current_ip']) . '</a> <a href="' . forum_link('click.php') . '?http://www.ripe.net/whois?form_type=simple&full_query_string=&searchtext=' . forum_htmlencode($cur_online['current_ip']) . '&do_search=Search" onclick="window.open(this.href); return false">Whois</a></sup>' : '<sup> IP: ' . $ip . '</sup>');
}
($hook = get_hook('on_fl_pre_current_page')) ? eval($hook) : null;
$cur_page = $cur_online['current_page'];
if (substr($cur_page, 0, 5) == 'admin')
$cur_page = 'admin';
else if ((@$lang_online[$cur_page]) == '')
$cur_page = 'Hiding Somewhere';
if ($cur_page == 'viewtopic' || $cur_page == 'post')
$page_name = ': <strong><a href="' . forum_link($forum_url['topic'], array($cur_online['current_page_id'], sef_friendly($cur_online['subject']))) . '">' . forum_htmlencode($cur_online['subject']) . '</a></strong>';
else if ($cur_page == 'postedit')
$page_name = ': <strong><a href="' . forum_link($forum_url['post'], array($cur_online['current_page_id'], sef_friendly($cur_online['subject']))) . '">' . forum_htmlencode($cur_online['subject_edit']) . '</a></strong>';
else if ($cur_page == 'profile-about' || $cur_page == 'profile' || $cur_page == 'reputation' || $cur_page == 'positive')
$page_name = ': <strong><a href="' . forum_link($forum_url['user'], array($cur_online['current_page_id'])) . '">' . forum_htmlencode($cur_online['username']) . '</a></strong>';
else if ($cur_page == 'viewforum')
$page_name = ': <strong><a href="' . forum_link($forum_url['forum'], $cur_online['current_page_id']) . '">' . forum_htmlencode($cur_online['forum_name']) . '</a></strong>';
else
$page_name = '';
$forum_page['table_row'] = array();
$forum_page['table_row']['user'] = '<td class="tc' . count($forum_page['table_row']) . '">' . $page_user . '</td>';
$forum_page['table_row']['page'] = '<td class="tc' . count($forum_page['table_row']) . '">' . $lang_online[$cur_page] . $page_name . '</td>';
$forum_page['table_row']['time'] = '<td class="tc' . count($forum_page['table_row']) . '">' . format_time($cur_online['logged']) . '</td>';
($hook = get_hook('on_fl_results_row_pre_data_output')) ? eval($hook) : null;
++$forum_page['item_count'];
?>
<tr class="<?php echo ($forum_page['item_count'] % 2 != 0) ? 'odd' : 'even' ?><?php echo ($forum_page['item_count'] == 1) ? ' row1' : '' ?>">
<?php echo implode("\n\t\t\t\t", $forum_page['table_row']) . "\n" ?>
</tr>
<?php
}
}
else {
?>
<tr>
<td colspan="4"><? echo $lang_online['Nobody'] ?></td>
</tr>
<?php
($hook = get_hook('on_fl_after_nobody')) ? eval($hook) : null;
}
?>
</tbody>
</table>
</div>
<?php
($hook = get_hook('on_fl_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';