Vergleich online.php - 1.8.2 - 1.8.38

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 11Zeile 11
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'online.php');


define("IN_MYBB", 1);
define('THIS_SCRIPT', 'online.php');


$templatelist = "online,online_row,online_row_ip,online_today,online_today_row,online_row_ip_lookup,multipage,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start";


$templatelist = "online,online_row,online_row_ip,online_today,online_today_row,online_row_ip_lookup,online_refresh,multipage,multipage_end,multipage_start";
$templatelist .= ",multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage";


require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";


require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";

Zeile 43Zeile 44
	$query = $db->simple_select("users", "COUNT(uid) AS users", "lastactive > '{$threshold}' AND invisible = '1'");
$invis_count = $db->fetch_field($query, "users");


	$query = $db->simple_select("users", "COUNT(uid) AS users", "lastactive > '{$threshold}' AND invisible = '1'");
$invis_count = $db->fetch_field($query, "users");


	if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
{
$mybb->settings['threadsperpage'] = 20;
}


	if(!$mybb->settings['wolusersperpage'] || (int)$mybb->settings['wolusersperpage'] < 1)
{
$mybb->settings['wolusersperpage'] = 20;
}


	// Add pagination

	// Add pagination

	$perpage = $mybb->settings['threadsperpage'];

	$perpage = $mybb->settings['wolusersperpage'];





	if($mybb->get_input('page', 1) > 0)
{
$page = $mybb->get_input('page', 1);

	if($mybb->get_input('page', MyBB::INPUT_INT) > 0)
{
$page = $mybb->get_input('page', MyBB::INPUT_INT);

		$start = ($page-1) * $perpage;
$pages = ceil($todaycount / $perpage);

		$start = ($page-1) * $perpage;
$pages = ceil($todaycount / $perpage);

		if($page > $pages)
{
$start = 0;
$page = 1;
}
}
else
{

		if($page > $pages)
{
$start = 0;
$page = 1;
}
}
else
{

		$start = 0;
$page = 1;
}

		$start = 0;
$page = 1;
}

Zeile 80Zeile 81
		}

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 = $online['username'];
$username = format_name($username, $online['usergroup'], $online['displaygroup']);

		{
$username = format_name(htmlspecialchars_uni($online['username']), $online['usergroup'], $online['displaygroup']);


			$online['profilelink'] = build_profile_link($username, $online['uid']);

			$online['profilelink'] = build_profile_link($username, $online['uid']);

			$onlinetime = my_date($mybb->settings['timeformat'], $online['lastactive']);

			$onlinetime = my_date('normal', $online['lastactive']);


eval("\$todayrows .= \"".$templates->get("online_today_row")."\";");
}


eval("\$todayrows .= \"".$templates->get("online_today_row")."\";");
}

	}



	}

$multipage = multipage($todaycount, $perpage, $page, "online.php?action=today");


$todaycount = my_number_format($todaycount);
$invis_count = my_number_format($invis_count);

if($todaycount == 1)


$todaycount = my_number_format($todaycount);
$invis_count = my_number_format($invis_count);

if($todaycount == 1)

	{

	{

		$onlinetoday = $lang->member_online_today;
}
else
{
$onlinetoday = $lang->sprintf($lang->members_were_online_today, $todaycount);

		$onlinetoday = $lang->member_online_today;
}
else
{
$onlinetoday = $lang->sprintf($lang->members_were_online_today, $todaycount);

	}


	}


	if($invis_count)
{
$string = $lang->members_online_hidden;

	if($invis_count)
{
$string = $lang->members_online_hidden;





		if($invis_count == 1)
{
$string = $lang->member_online_hidden;
}

		if($invis_count == 1)
{
$string = $lang->member_online_hidden;
}





		$onlinetoday .= $lang->sprintf($string, $invis_count);

		$onlinetoday .= $lang->sprintf($string, $invis_count);

	}

$multipage = multipage($todaycount, $perpage, $page, "online.php?action=today");

$plugins->run_hooks("online_today_end");


	}

$plugins->run_hooks("online_today_end");




	eval("\$today = \"".$templates->get("online_today")."\";");
output_page($today);
}

	eval("\$today = \"".$templates->get("online_today")."\";");
output_page($today);
}

Zeile 143Zeile 143
		{
case "sqlite":
case "pgsql":

		{
case "sqlite":
case "pgsql":

				$sql = "s.time DESC";

				$sql = "CASE WHEN s.uid > 0 THEN 1 ELSE 0 END DESC, s.time DESC";

				break;
default:
$sql = "IF( s.uid >0, 1, 0 ) DESC, s.time DESC";

				break;
default:
$sql = "IF( s.uid >0, 1, 0 ) DESC, s.time DESC";

Zeile 154Zeile 154

$timesearch = TIME_NOW - $mybb->settings['wolcutoffmins']*60;



$timesearch = TIME_NOW - $mybb->settings['wolcutoffmins']*60;


	// Exactly how many users are currently online?
switch($db->type)
{
case "sqlite":
$sessions = array();
$query = $db->simple_select("sessions", "sid", "time > {$timesearch}");
while($sid = $db->fetch_field($query, "sid"))
{
$sessions[$sid] = 1;
}
$online_count = count($sessions);
unset($sessions);
break;
case "pgsql":
default:
$query = $db->simple_select("sessions", "COUNT(sid) as online", "time > {$timesearch}");
$online_count = $db->fetch_field($query, "online");
break;
}


	$query = $db->query("
SELECT COUNT(*) AS online FROM (
SELECT 1
FROM " . TABLE_PREFIX . "sessions
WHERE time > $timesearch
GROUP BY uid, ip
) s
");

$online_count = $db->fetch_field($query, "online");











	if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
{
$mybb->settings['threadsperpage'] = 20;

	if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
{
$mybb->settings['threadsperpage'] = 20;

Zeile 182Zeile 173
	// How many pages are there?
$perpage = $mybb->settings['threadsperpage'];


	// How many pages are there?
$perpage = $mybb->settings['threadsperpage'];


	if($mybb->get_input('page', 1) > 0)

	if($mybb->get_input('page', MyBB::INPUT_INT) > 0)

	{

	{

		$page = $mybb->get_input('page', 1);

		$page = $mybb->get_input('page', MyBB::INPUT_INT);

		$start = ($page-1) * $perpage;
$pages = ceil($online_count / $perpage);
if($page > $pages)

		$start = ($page-1) * $perpage;
$pages = ceil($online_count / $perpage);
if($page > $pages)

Zeile 203Zeile 194
	$multipage = multipage($online_count, $perpage, $page, "online.php".$refresh_string);

// Query for active sessions

	$multipage = multipage($online_count, $perpage, $page, "online.php".$refresh_string);

// Query for active sessions

	$query = $db->query("
SELECT DISTINCT s.sid, s.ip, s.uid, s.time, s.location, u.username, s.nopermission, u.invisible, u.usergroup, u.displaygroup
FROM ".TABLE_PREFIX."sessions s
LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)
WHERE s.time>'$timesearch'
ORDER BY $sql
LIMIT {$start}, {$perpage}
");













































	$dbversion = $db->get_version();
if(
(
$db->type == 'mysqli' && (
version_compare($dbversion, '10.2.0', '>=') || ( // MariaDB
version_compare($dbversion, '10', '<') &&
version_compare($dbversion, '8.0.2', '>=')
)
)
) ||
($db->type == 'pgsql' && version_compare($dbversion, '8.4.0', '>=')) ||
($db->type == 'sqlite' && version_compare($dbversion, '3.25.0', '>='))
)
{
$sql = str_replace('u.username', 's.username', $sql);

$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.uid = 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.username, 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."sessions 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.uid)
ORDER BY $sql
LIMIT {$start}, {$perpage}
");
}


// Fetch spiders
$spiders = $cache->read("spiders");


// Fetch spiders
$spiders = $cache->read("spiders");

Zeile 274Zeile 309
	if($mybb->settings['refreshwol'] > 0)
{
$refresh_time = $mybb->settings['refreshwol'] * 60;

	if($mybb->settings['refreshwol'] > 0)
{
$refresh_time = $mybb->settings['refreshwol'] * 60;

		$refresh = "<meta http-equiv=\"refresh\" content=\"{$refresh_time};URL=online.php{$refresh_string}\" />";

		eval("\$refresh = \"".$templates->get("online_refresh")."\";");

	}

$plugins->run_hooks("online_end");

	}

$plugins->run_hooks("online_end");