Hướng dẫn cải tiến chức năng thống kê nhanh trong admincp cho vBulletin

Admin

AdminAdmin is verified member.

Well-Known Member
Staff member
Administrator
Demo ảnh

19335985118_fb5b4dd35e_o.jpg


Hướng dẫn
Bạn đăng nhập host, vào admincp/index.php và làm theo hướng dẫn
Tìm
PHP:
$specialtemplates = array('maxloggedin', 'acpstats');
Thay thế thành
PHP:
$specialtemplates = array('maxloggedin');
Tìm
PHP:
			<a href="<?php echo $forumhomelink; ?>" target="_blank"><?php echo $vbphrase['forum_home_page']; ?></a>
			|
			<a href="index.php?<?php echo $vbulletin->session->vars['sessionurl']; ?>do=cplogout" onclick="return confirm('<?php echo $vbphrase['sure_you_want_to_log_out_of_cp']; ?>');"  target="_top"><?php echo $vbphrase['log_out']; ?></a>
		</td>
Thay thế thành
PHP:
			<a href="../<?php echo $vbulletin->options['forumhome']; ?>.php<?php echo $vbulletin->session->vars['sessionurl_q']; ?>" ><?php echo $vbphrase['forum_home_page']; ?></a>
			|
			<a href="../<?php echo $vbulletin->options['forumhome']; ?>.php<?php echo $vbulletin->session->vars['sessionurl_q']; ?>" target="_blank">Forum Home (new window)</a>
			|
			<a href="index.php?<?php echo $vbulletin->session->vars['sessionurl']; ?>do=cplogout" onclick="return confirm('<?php echo $vbphrase['sure_you_want_to_log_out_of_cp']; ?>');"  target="_top"><?php echo $vbphrase['log_out']; ?></a>
		</td>
Tìm
PHP:
// ##### Messages to Moderate
$messagecount = $db->query_first("
	SELECT COUNT(*) AS count
	FROM " . TABLE_PREFIX . "moderation AS moderation
	INNER JOIN " . TABLE_PREFIX . "visitormessage AS visitormessage ON (visitormessage.vmid = moderation.primaryid)
	WHERE moderation.type = 'visitormessage'
");

$mailqueue = $vbulletin->db->query_first("
	SELECT COUNT(mailqueueid) AS queued FROM " . TABLE_PREFIX . "mailqueue
");
Thay thế thành
PHP:
// ##### Messages to Moderate
$messagecount = $db->query_first("
	SELECT COUNT(*) AS count
	FROM " . TABLE_PREFIX . "moderation AS moderation
	INNER JOIN " . TABLE_PREFIX . "visitormessage AS visitormessage ON (visitormessage.vmid = moderation.primaryid)
	WHERE moderation.type = 'visitormessage'
");

// ##### Server Load
if ($_REQUEST['show'] == 'serverload' || empty($_REQUEST['show'])) {
	$loadavg = @file_get_contents("/proc/loadavg");
	$method = '';
	if ($loadavg) {
		$regs = explode(" ",$loadavg);
		$serverload='Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2];
		$method = 'file_get_contents("/proc/loadavg")';
    } elseif ( $stats = @exec('uptime') ) {
        preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
        $serverload = '<b>Server Load:</b> ' . $regs[0] .' <font size="1">(1 min, 5 min, 15 min)</font>';
		$method = 'exec(uptime)';
	} else {
		$serverload = 'failed';
	}


	};

// ##### Users Online	
	$datecut = TIMENOW - $vbulletin->options['cookietimeout'];
	$guestsarry = $db->query_first("SELECT COUNT(host) AS sessions FROM " . TABLE_PREFIX . "session WHERE userid = 0 AND lastactivity > $datecut");
	$membersarry = $db->query_read("SELECT DISTINCT userid FROM " . TABLE_PREFIX . "session WHERE userid <> 0 AND lastactivity > $datecut");
	$guests = intval($guestsarry['sessions']);
	$members = intval($db->num_rows($membersarry));

$mailqueue = $vbulletin->db->query_first("
	SELECT COUNT(mailqueueid) AS queued FROM " . TABLE_PREFIX . "mailqueue
");
Tìm
PHP:
	print_cells_row(array(
		$vbphrase['mysql_max_packet_size'], vb_number_format($maxpacket, 2, 1),
		$vbphrase['new_posts_today'], vb_number_format($vbulletin->acpstats['newposts']),
		$vbphrase['queued_emails'], vb_number_format($mailqueue['queued'])
	), 0, 0, -5, 'top', 1, 1);
}
else
{
Thay thế thành
PHP:
	print_cells_row(array(
		$vbphrase['mysql_max_packet_size'], vb_number_format($maxpacket, 2, 1),
		$vbphrase['users_online'], construct_phrase($vbphrase['x_y_members_z_guests'], vb_number_format($guests + $members), vb_number_format($members), vb_number_format($guests)),
		$vbphrase['new_posts_today'], vb_number_format($vbulletin->acpstats['newposts'])
	), 0, 0, -5, 'top', 1, 1);
	print_cells_row(array(
		'vBulletin Software Version', $vbulletin->options['templateversion'],
		'Server Load (1 min, 5 min, 15 min)', $loadavg = '' . $regs[1] .'  |  '. $regs[2] .'  |  '. $regs[3] .'',
		$vbphrase['queued_emails'], vb_number_format($mailqueue['queued'])
	), 0, 0, -5, 'top', 1, 1);
}
else
{
Tìm
PHP:
print_table_footer();
($hook = vBulletinHook::fetch_hook('admin_index_main1')) ? eval($hook) : false;
Thay thế thành
PHP:
print_table_footer();
if ($_REQUEST['show'] == 'memoryusage' || empty($_REQUEST['show'])) {
	print_form_header('', '');
	exec('free -m', $mem);
	print_table_header('Memory Usage');print_description_row('<pre>'.implode('<br />', $mem).'</pre>');
	print_table_footer();
	}
($hook = vBulletinHook::fetch_hook('admin_index_main1')) ? eval($hook) : false;
Tìm
PHP:
				'http://www.vbulletin.com/docs/html/' => $vbphrase['reference_manual']

Và thêm vào dưới

PHP:
				'http://tuoitreit.vn/' => 'tuoitreit.vn'
Chúc các bạn thành công!
 

Facebook Comments

Similar threads

Admin
Replies
0
Views
1K
AdminAdmin is verified member.
Admin
Admin
Replies
0
Views
764
AdminAdmin is verified member.
Admin
Admin
Replies
0
Views
1K
AdminAdmin is verified member.
Admin
Admin
Replies
0
Views
1K
AdminAdmin is verified member.
Admin
Back
Top