Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Admin Quick Stats Details »»
Admin Quick Stats
Version: 1.00, by Freddie Bingham Freddie Bingham is offline
Developer Last Online: Aug 2016 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 04-08-2002 Last Update: Never Installs: 97
 
No support by the author.

I don't use vBhacker so you will have to do this the old fashioned way. Also forgive me if something like this has already been released. I think everything is good but it is hard to code in vb2 style after working on the vb3 style so much.

This hack shows some quick stats on your Admin index page such as PHP version, server type, mysql version, Database usage, attachment usage, avatar usage, moderation and forum stats. I can add support for calculating attachments from PPN's attachments as files but I have to actually look at it first, which I will do tomorrow. In vb3 there is a filesize column in the attachment table so you don't need to do anything different if the attachments are currently in the file system (you can move them back and forth) but I assume I will have to run through the directory with filesize() to get an attachment total with the hack.

Anyway open admin/index.php and find:
Code:
if ($moderatenewmembers==1 or $usecoppa==1) {
  $waiting=$DB_site->query_first("SELECT COUNT(*) AS users FROM user WHERE usergroupid=4");
  if ($waiting[users]==0) {
    echo "<font size='1'>There are currently $waiting[users] user(s) awaiting <a href=\"user.php?s=$session[sessionhash]&action=moderate\">moderation</a>.</font>";
  } else {
    echo "<b><a href=\"user.php?s=$session[sessionhash]&action=moderate\">There are currently $waiting[users] user(s) awaiting moderation</a>.</b>";
  }
}
Delete that and replace it with:

Code:
function kbtomb($value) {
	if ($value == 'N/A') {
		return $value;
	} elseif (!$value) {
		return '0.0 MB';
	} else {
		return sprintf('%.2f', $value / 1024000) . ' MB';
	}
}

$starttime = mktime(0, 0, 0, date('m'), date('d'), date('Y'));

$attach = $DB_site->query_first("SELECT SUM(LENGTH(filedata)) AS size FROM attachment");
$avatar = $DB_site->query_first("SELECT SUM(LENGTH(avatardata)) AS size FROM customavatar");

$newusers = $DB_site->query_first("SELECT COUNT(*) AS count FROM user WHERE joindate >= $starttime");
$newthreads = $DB_site->query_first("SELECT COUNT(*) AS count FROM thread WHERE dateline >= $starttime");
$newposts = $DB_site->query_first("SELECT COUNT(*) AS count FROM post WHERE dateline >= $starttime");
$users = $DB_site->query_first("SELECT COUNT(*) AS count FROM user WHERE lastactivity >= $starttime");

$mysqlversion = $DB_site->query_first("SELECT VERSION() AS version");

$indexsize = 0;
$datasize = 0;
if ($mysqlversion['version'] >= '3.23') {
	$DB_site->reporterror = 0;
	$tables = $DB_site->query("SHOW TABLE STATUS");
	$errno = $DB_site->errno;
	$DB_site->reporterror = 1;
	if (!$errno) {
		while ($table = $DB_site->fetch_array($tables)) {
			$datasize += $table['Data_length'];
			$indexsize += $table['Index_length'];
		}
		if (!$indexsize) {
			$indexsize = 'N/A';
		}
		if (!datasize) {
			$datasize = 'N/A';
		}
	} else {
		$datasize = 'N/A';
		$indexsize = 'N/A';
	}
}

$attachcount = $DB_site->query_first("SELECT COUNT(*) AS count FROM attachment WHERE visible = 0");

$serverinfo = PHP_OS . ' / PHP v' . phpversion();

if (phpversion() >= '4.0.3') {
	$serverinfo .= iif(ini_get('safe_mode'), ' Safe Mode', '');
	$serverinfo .= iif(ini_get('file_uploads'), '', '<br />FILE_UPLOADS disabled');
}

doformheader('', '');
maketableheader('Quick Stats');
makelabelcode('Server Type', $serverinfo);
makelabelcode('MySQL', 'v' . $mysqlversion['version']);
makelabelcode('Database Data Usage:', kbtomb($datasize));
makelabelcode('Database Index Usage:', kbtomb($indexsize));
makelabelcode('Attachment Usage:', kbtomb($attach['size']));
makelabelcode('Custom Avatar Usage:', kbtomb($avatar['size']));

// Only display if the admin has moderation enabled on an active postable forum.
if ($DB_site->query_first("SELECT forumid FROM forum WHERE moderatenew = 1 AND cancontainthreads = 1 AND active = 1 AND allowposting = 1")) {
	$postcount = $DB_site->query_first("SELECT COUNT(*) AS count FROM post WHERE visible=0");
	$threadcount = $DB_site->query_first("SELECT COUNT(*) AS count FROM thread WHERE visible=0");
	makelabelcode("Threads Awaiting <a href=\"../mod/moderate.php?s=$session[sessionhash]&action=posts\">Moderation</a>:", $threadcount['count']);
	makelabelcode("Posts Awaiting <a href=\"../mod/moderate.php?s=$session[sessionhash]&action=posts\">Moderation</a>:", $postcount['count']);
}
if ($moderatenewmembers==1 or $usecoppa==1) {
	$waiting=$DB_site->query_first("SELECT COUNT(*) AS users FROM user WHERE usergroupid=4");
	makelabelcode("Users Awaiting <a href=\"user.php?s=$session[sessionhash]&action=moderate\">Moderation</a>:", $waiting['users']);
}
makelabelcode("Attachments Awaiting <a href=\"../mod/moderate.php?s=$session[sessionhash]&action=attachments\">Moderation</a>:", $attachcount['count']);
makelabelcode('New Users Today:', $newusers['count']);
makelabelcode('Registered Visitors Today:', $users['count']);
makelabelcode('New Threads Today:', $newthreads['count']);
makelabelcode('New Posts Today:', $newposts['count']);
dotablefooter();

Show Your Support

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

Comments
  #62  
Old 04-26-2002, 09:11 AM
ceo_tfw's Avatar
ceo_tfw ceo_tfw is offline
 
Join Date: Mar 2002
Posts: 87
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have installed this and it did not take that long to put in, however I would like to add the visits from non.members, how can I did that,
can anyone help
Reply With Quote
  #63  
Old 04-26-2002, 09:59 AM
Harvey Harvey is offline
 
Join Date: Nov 2001
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@ceo_tfw: this would require to develop an extra hack. You would have to store the sessions in the DB for 1 day.

-----------

I made an extension to show modified threads (without # of new threads)
after freddie's
PHP Code:
$newthreads $DB_site->query_first("SELECT count(*) AS count FROM thread WHERE dateline >= $starttime"); 
add
PHP Code:
$changedthreads $DB_site->query_first("SELECT count(*) AS count FROM thread WHERE lastpost >= $starttime"); 
after freddie's
PHP Code:
makelabelcode('New Threads Today:'$newthreads['count']); 
add
PHP Code:
makelabelcode('Modified Threads Today:'$changedthreads['count']-$newthreads['count']); 
Replace 'Modified Threads Today:' by better english if nessesary.
Reply With Quote
  #64  
Old 04-26-2002, 03:33 PM
ceo_tfw's Avatar
ceo_tfw ceo_tfw is offline
 
Join Date: Mar 2002
Posts: 87
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for that, I have added it great stuff,
I still would like to know how to do the above
thanks
Reply With Quote
  #65  
Old 04-30-2002, 06:18 PM
inetd inetd is offline
 
Join Date: Nov 2001
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

freddir, why "Post Awaiting Moderation:" in Admin Quick Stats don't show? I enable premoderation in some forums.
Reply With Quote
  #66  
Old 05-01-2002, 11:48 AM
LouChipher LouChipher is offline
 
Join Date: Oct 2001
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

New Threads Today: 8605
Modified Threads Today: -8553

funny effect... and i can't see any reason..
Reply With Quote
  #67  
Old 05-01-2002, 02:08 PM
The Realist's Avatar
The Realist The Realist is offline
 
Join Date: Oct 2001
Location: UK
Posts: 842
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Working fine, well done

Here is my stats:
Reply With Quote
  #68  
Old 05-01-2002, 02:16 PM
The Realist's Avatar
The Realist The Realist is offline
 
Join Date: Oct 2001
Location: UK
Posts: 842
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Working fine, well done

Here is my stats:
Reply With Quote
  #69  
Old 05-01-2002, 05:44 PM
Harvey Harvey is offline
 
Join Date: Nov 2001
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by LouChipher
New Threads Today: 8605
Modified Threads Today: -8553

funny effect... and i can't see any reason..
Hi,

this can't be my modification. I didn't touch "New Threads".

uff, my english I can't explain, but I guess you have 52 modified threads and an unknown number of new threads.

You have to add my lines below freddies lines, not to change anything. But i think you do so.

Our site is OK.

If you don't understand my english, sorry, don't worry. I copuld not help.
Reply With Quote
  #70  
Old 05-03-2002, 12:30 PM
cihangir's Avatar
cihangir cihangir is offline
 
Join Date: Oct 2001
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i thicnk i have a little problem with this hack

Code:
Server Type
 Linux / PHP v4.1.2
 
MySQL
 v3.23.41
 
Database Data Usage:
 56.02 MB
 
Database Index Usage:
 32.15 MB
 
Attachment Usage:
 0.0 MB
 
Custom Avatar Usage:
 0.03 MB
 
Users Awaiting Moderation:
 0
 
Attachments Awaiting Moderation:
 0
 
New Users Today:
 2
 
Registered Visitors Today:
 58
 
New Threads Today:
 1097
 
New Posts Today:
 17
17 new posts, but 1097 new threads
Reply With Quote
  #71  
Old 05-03-2002, 03:50 PM
Mntsnow Mntsnow is offline
 
Join Date: Dec 2001
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very cool! Thanks
Reply With Quote
Reply


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 11:07 AM.


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.04602 seconds
  • Memory Usage 2,324KB
  • Queries Executed 25 (?)
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
  • (3)bbcode_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete