XOOPS
2.6.0
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
online.php
Go to the documentation of this file.
1
<?php
2
/*
3
You may not change or alter any portion of this comment or credits
4
of supporting developers from this source code or any supporting source code
5
which is considered copyrighted (c) material of the original comment or credit authors.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
use
Xoops\Core\Kernel\Criteria
;
13
24
function
b_system_online_show
()
25
{
26
$xoops
=
Xoops::getInstance
();
27
$online_handler =
$xoops
->getHandlerOnline();
28
mt_srand((
double
)microtime() * 1000000);
29
// set gc probabillity to 10% for now..
30
if
(mt_rand(1, 100) < 11) {
31
$online_handler->gc(300);
32
}
33
if
(
$xoops
->isUser()) {
34
$uid
=
$xoops
->user->getVar(
'uid'
);
35
$uname
=
$xoops
->user->getVar(
'uname'
);
36
}
else
{
37
$uid
= 0;
38
$uname
=
''
;
39
}
40
if
(
$xoops
->isModule()) {
41
$online_handler->write(
$uid
,
$uname
, time(),
$xoops
->module->getVar(
'mid'
),
$_SERVER
[
'REMOTE_ADDR'
]);
42
}
else
{
43
$online_handler->write(
$uid
,
$uname
, time(), 0,
$_SERVER
[
'REMOTE_ADDR'
]);
44
}
45
$onlines = $online_handler->getAll(null, null,
false
,
false
);
46
if
(
false
!= $onlines) {
47
$total = count($onlines);
48
$block = array();
49
$guests = 0;
50
$members =
''
;
51
for
(
$i
= 0;
$i
< $total; ++
$i
) {
52
if
($onlines[
$i
][
'online_uid'
] > 0) {
53
$members .=
' <a href="'
.
\XoopsBaseConfig::get
(
'url'
) .
'/userinfo.php?uid='
. $onlines[
$i
][
'online_uid'
] .
'" title="'
. $onlines[
$i
][
'online_uname'
] .
'">'
. $onlines[
$i
][
'online_uname'
] .
'</a>,'
;
54
}
else
{
55
++$guests;
56
}
57
}
58
$block[
'online_total'
] = sprintf(
XoopsLocale::F_USERS_ONLINE
, $total);
59
if
(
$xoops
->isModule()) {
60
$mytotal = $online_handler->getCount(
new
Criteria
(
'online_module'
,
$xoops
->module->getVar(
'mid'
)));
61
$block[
'online_total'
] .=
' ('
. sprintf(
XoopsLocale::F_USERS_BROWSING
, $mytotal,
$xoops
->module->getVar(
'name'
)) .
')'
;
62
}
63
$block[
'lang_members'
] =
XoopsLocale::MEMBERS
;
64
$block[
'lang_guests'
] =
XoopsLocale::GUESTS
;
65
$block[
'online_names'
] = $members;
66
$block[
'online_members'
] = $total - $guests;
67
$block[
'online_guests'
] = $guests;
68
$block[
'lang_more'
] =
XoopsLocale::MORE
;
69
return
$block;
70
}
else
{
71
return
false
;
72
}
73
}
$i
$i
Definition:
dialog.php:68
XoopsLocaleEn_US\GUESTS
const GUESTS
Definition:
en_US.php:457
Xoops\getInstance
static getInstance()
Definition:
Xoops.php:160
XoopsLocaleEn_US\MORE
const MORE
Definition:
en_US.php:842
Xoops\Core\Kernel\Criteria
Definition:
Criteria.php:30
XoopsLocaleEn_US\MEMBERS
const MEMBERS
Definition:
en_US.php:833
$_SERVER
$_SERVER['REQUEST_URI']
Definition:
comment_delete.php:23
XoopsLocaleEn_US\F_USERS_BROWSING
const F_USERS_BROWSING
Definition:
en_US.php:443
b_system_online_show
b_system_online_show()
Definition:
online.php:24
$xoops
$xoops
Definition:
admin.php:25
XoopsBaseConfig\get
static get($name)
Definition:
XoopsBaseConfig.php:117
$uid
if(!$xoops->isUser()) $uid
Definition:
index.php:31
Criteria
XoopsLocaleEn_US\F_USERS_ONLINE
const F_USERS_ONLINE
Definition:
en_US.php:445
$uname
$uname
Definition:
checklogin.php:37
usr64
htdocs
modules
system
blocks
online.php
Generated on Fri May 22 2015 03:07:02 for XOOPS by
1.8.9.1