Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications

Reply
 
Thread Tools
AdminCP Quick Stats Improvement Details »»
AdminCP Quick Stats Improvement
Version: 1.00, by Falcon Capt Falcon Capt is offline
Developer Last Online: Jun 2023 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 4.2.2 Rating:
Released: 07-04-2015 Last Update: 07-23-2015 Installs: 8
Code Changes  
No support by the author.

Improved AdminCP Quick Stats:

In admincp/index.php

CHANGE LINE 21 FROM:

Code:
$specialtemplates = array('maxloggedin', 'acpstats');
TO:

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 Now

File Type: php server_info.php (5.0 KB, 23 views)

Screenshots

File Type: jpg AdminCP_new_window_link.jpg (11.5 KB, 0 views)
File Type: jpg AdminCP_quick_stats.jpg (106.7 KB, 0 views)
File Type: jpg AdminCP_useful_links.jpg (55.4 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 07-08-2015, 12:53 AM
Manoel J?nior Manoel J?nior is offline
 
Join Date: Feb 2009
Location: SP / Brasil
Posts: 778
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Love this. Please plugin this.
Reply With Quote
  #3  
Old 07-08-2015, 06:08 PM
Alan_SP's Avatar
Alan_SP Alan_SP is offline
 
Join Date: Nov 2009
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It can't be done. It requires editing files.

Plugins can do some useful staff, but can't touch files.
Reply With Quote
  #4  
Old 07-17-2015, 09:09 PM
Darkman7030 Darkman7030 is offline
 
Join Date: Nov 2014
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you help me vb 4.2.0?
Attached Images
File Type: jpg Unbenannt.jpg (18.0 KB, 0 views)
Reply With Quote
  #5  
Old 07-17-2015, 09:36 PM
Falcon Capt Falcon Capt is offline
 
Join Date: May 2006
Location: U.S.
Posts: 123
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Darkman7030 View Post
Can you help me vb 4.2.0?
Looks like you may have forgetten to add this part:


Code:
*************************************


FIND IN LINE 817:



// ##### 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'

");




And place this directly after:


// ##### 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));


**************************************





and this:


Code:
*************************************

FIND near Line 910:

print_table_footer();

($hook = vBulletinHook::fetch_hook('admin_index_main1')) ? eval($hook) : false;


REPLACE WITH:


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;


*************************************
Reply With Quote
  #6  
Old 07-17-2015, 09:47 PM
Darkman7030 Darkman7030 is offline
 
Join Date: Nov 2014
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes done everything exactly
here is my index.php have tried everything without success
Attached Files
File Type: txt index.txt (48.6 KB, 10 views)
Reply With Quote
  #7  
Old 07-17-2015, 10:06 PM
Falcon Capt Falcon Capt is offline
 
Join Date: May 2006
Location: U.S.
Posts: 123
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this one, it is the full AdminCP index.php file minus the header and footer, just cut and paste it into yours and see if it works.

Let me know!
Reply With Quote
  #8  
Old 07-17-2015, 10:28 PM
Darkman7030 Darkman7030 is offline
 
Join Date: Nov 2014
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Unfortunately it did not work
Reply With Quote
  #9  
Old 07-17-2015, 10:33 PM
Falcon Capt Falcon Capt is offline
 
Join Date: May 2006
Location: U.S.
Posts: 123
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Darkman7030 View Post
Unfortunately it did not work
Must be something with 4.2.0, if you upgrade to 4.2.2 or 4.2.3 it'll work.
Reply With Quote
  #10  
Old 07-23-2015, 06:29 AM
Darkman7030 Darkman7030 is offline
 
Join Date: Nov 2014
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Falcon Capt View Post
Must be something with 4.2.0, if you upgrade to 4.2.2 or 4.2.3 it'll work.

so have now update made to 4.2.3
but still it does not work still same error
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:23 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07530 seconds
  • Memory Usage 2,343KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (14)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (6)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete