AdminCP Quick Stats Improvement
Improved AdminCP Quick Stats:
In admincp/index.php CHANGE LINE 21 FROM: Code:
$specialtemplates = array('maxloggedin', 'acpstats'); Code:
$specialtemplates = array('maxloggedin'); CHANGE LINE 177-179 FROM: (adds "New Window" link at top of AdminCP) Code:
<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> TO: Code:
<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> FIND THIS STARTING AT LINE 817: Code:
// ##### 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 "); REPLACE WITH THIS: Code:
// ##### 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 "); FIND IN LINE 868: (reorganizes stats and adds additional stats) Code:
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 { REPLACE WITH: Code:
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 { FIND IN LINE 910/911: (Adds Memory Usage data block) Code:
print_table_footer(); ($hook = vBulletinHook::fetch_hook('admin_index_main1')) ? eval($hook) : false; REPLACE WITH: Code:
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; FIND IN LINE 1020: Code:
'http://www.vbulletin.com/docs/html/' => $vbphrase['reference_manual'] PLACE THIS DIRECTLY BELOW IT: (Adds vbulletin.org in the quick links) Code:
'http://www.vbulletin.org/' => 'vBulletin.org' Add the attached file (server_info.php) to your AdminCP folder. (Edit line 116 to include your database information: "localhost", "dbuser", "dbpassword", "dbname") See attached images for the enhancements. Enjoy! Download
server_info.php (5.0 KB, 26 downloads) Screenshots |
Similar Mods
Add-On Releases Top 10 stats in admincp. | vBulletin 4.x Add-ons |
Add [View] link to New Users Today (AdminCP Quick Stats) | vBulletin 3.5 Add-ons |
[Improvement] vBStats -> Top Posters list PHP-code improvement (much less queries) | vBulletin 2.x Full Releases |
[Improvement] vBStats -> Member Referrer list PHP-code improvement (much less queries | vBulletin 2.x Full Releases |