"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Upload/online.php" between
mybb_1821.zip and mybb_1822.zip

About: MyBB is a multilingual, standards-compliant and free forum (discussion board) software.

online.php  (mybb_1821):online.php  (mybb_1822)
skipping to change at line 87 skipping to change at line 87
$invisiblemark = ''; $invisiblemark = '';
if($online['invisible'] == 1) if($online['invisible'] == 1)
{ {
$invisiblemark = "*"; $invisiblemark = "*";
} }
if($online['invisible'] != 1 || $mybb->usergroup['canviewwolinvis '] == 1 || $online['uid'] == $mybb->user['uid']) if($online['invisible'] != 1 || $mybb->usergroup['canviewwolinvis '] == 1 || $online['uid'] == $mybb->user['uid'])
{ {
$username = format_name(htmlspecialchars_uni($online['use rname']), $online['usergroup'], $online['displaygroup']); $username = format_name(htmlspecialchars_uni($online['use rname']), $online['usergroup'], $online['displaygroup']);
$online['profilelink'] = build_profile_link($username, $o nline['uid']); $online['profilelink'] = build_profile_link($username, $o nline['uid']);
$onlinetime = my_date($mybb->settings['timeformat'], $onl ine['lastactive']); $onlinetime = my_date('normal', $online['lastactive']);
eval("\$todayrows .= \"".$templates->get("online_today_ro w")."\";"); eval("\$todayrows .= \"".$templates->get("online_today_ro w")."\";");
} }
} }
$multipage = multipage($todaycount, $perpage, $page, "online.php?action=t oday"); $multipage = multipage($todaycount, $perpage, $page, "online.php?action=t oday");
$todaycount = my_number_format($todaycount); $todaycount = my_number_format($todaycount);
$invis_count = my_number_format($invis_count); $invis_count = my_number_format($invis_count);
skipping to change at line 146 skipping to change at line 146
$sql = "s.location, s.time DESC"; $sql = "s.location, s.time DESC";
$refresh_string = "?sortby=location"; $refresh_string = "?sortby=location";
} }
// Otherwise sort by last refresh // Otherwise sort by last refresh
else else
{ {
switch($db->type) switch($db->type)
{ {
case "sqlite": case "sqlite":
case "pgsql": case "pgsql":
$sql = "s.time DESC"; $sql = "CASE WHEN s.uid > 0 THEN 1 ELSE 0 END DES C, s.time DESC";
break; break;
default: default:
$sql = "IF( s.uid >0, 1, 0 ) DESC, s.time DESC"; $sql = "IF( s.uid >0, 1, 0 ) DESC, s.time DESC";
break; break;
} }
$refresh_string = ''; $refresh_string = '';
} }
$timesearch = TIME_NOW - $mybb->settings['wolcutoffmins']*60; $timesearch = TIME_NOW - $mybb->settings['wolcutoffmins']*60;
// Exactly how many users are currently online? $query = $db->query("
switch($db->type) SELECT COUNT(*) AS online FROM (
{ SELECT 1
case "sqlite": FROM " . TABLE_PREFIX . "sessions
$sessions = array(); WHERE time > $timesearch
$query = $db->simple_select("sessions", "sid", "time > {$ GROUP BY uid, ip
timesearch}"); ) s
while($sid = $db->fetch_field($query, "sid")) ");
{
$sessions[$sid] = 1; $online_count = $db->fetch_field($query, "online");
}
$online_count = count($sessions);
unset($sessions);
break;
case "pgsql":
default:
$query = $db->simple_select("sessions", "COUNT(sid) as on
line", "time > {$timesearch}");
$online_count = $db->fetch_field($query, "online");
break;
}
if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsper page'] < 1) if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsper page'] < 1)
{ {
$mybb->settings['threadsperpage'] = 20; $mybb->settings['threadsperpage'] = 20;
} }
// How many pages are there? // How many pages are there?
$perpage = $mybb->settings['threadsperpage']; $perpage = $mybb->settings['threadsperpage'];
if($mybb->get_input('page', MyBB::INPUT_INT) > 0) if($mybb->get_input('page', MyBB::INPUT_INT) > 0)
skipping to change at line 206 skipping to change at line 197
else else
{ {
$start = 0; $start = 0;
$page = 1; $page = 1;
} }
// Assemble page URL // Assemble page URL
$multipage = multipage($online_count, $perpage, $page, "online.php".$refr esh_string); $multipage = multipage($online_count, $perpage, $page, "online.php".$refr esh_string);
// Query for active sessions // Query for active sessions
$query = $db->query(" $dbversion = $db->get_version();
SELECT DISTINCT s.sid, s.ip, s.uid, s.time, s.location, u.usernam if(
e, s.nopermission, u.invisible, u.usergroup, u.displaygroup (
FROM ".TABLE_PREFIX."sessions s $db->type == 'mysqli' && (
LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid) version_compare($dbversion, '10.2.0', '>=') || (
WHERE s.time>'$timesearch' // MariaDB
ORDER BY $sql version_compare($dbversion, '10', '<') &&
LIMIT {$start}, {$perpage} version_compare($dbversion, '8.0.2', '>='
"); )
)
)
) ||
($db->type == 'pgsql' && version_compare($dbversion, '8.4.0', '>=
')) ||
($db->type == 'sqlite' && version_compare($dbversion, '3.25.0', '
>='))
)
{
$query = $db->query("
SELECT * FROM (
SELECT
s.sid, s.ip, s.uid, s.time, s.location, u
.username, s.nopermission, u.invisible, u.usergroup, u.displaygroup,
row_number() OVER (PARTITION BY s.uid, s.
ip ORDER BY time DESC) AS row_num
FROM
".TABLE_PREFIX."sessions s
LEFT JOIN ".TABLE_PREFIX."users u ON (s.u
id = u.uid)
WHERE s.time > $timesearch
) s
WHERE row_num = 1
ORDER BY $sql
LIMIT {$start}, {$perpage}
");
}
else
{
$query = $db->query("
SELECT
s.sid, s.ip, s.uid, s.time, s.location, u.usernam
e, s.nopermission, u.invisible, u.usergroup, u.displaygroup
FROM
".TABLE_PREFIX."sessions s
INNER JOIN (
SELECT
MIN(s2.sid) AS sid
FROM
".TABLE_PREFIX."sessions s2
LEFT JOIN ".TABLE_PREFIX."session
s s3 ON (s2.sid = s3.sid AND s2.time < s3.time)
WHERE s2.time > $timesearch AND s3.sid IS
NULL
GROUP BY s2.uid, s2.ip
) s2 ON (s.sid = s2.sid)
LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid = u.u
id)
ORDER BY $sql
LIMIT {$start}, {$perpage}
");
}
// Fetch spiders // Fetch spiders
$spiders = $cache->read("spiders"); $spiders = $cache->read("spiders");
while($user = $db->fetch_array($query)) while($user = $db->fetch_array($query))
{ {
$plugins->run_hooks("online_user"); $plugins->run_hooks("online_user");
// Fetch the WOL activity // Fetch the WOL activity
$user['activity'] = fetch_wol_activity($user['location'], $user[' nopermission']); $user['activity'] = fetch_wol_activity($user['location'], $user[' nopermission']);
 End of changes. 4 change blocks. 
32 lines changed or deleted 73 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)