vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Admin Quick Stats (https://vborg.vbsupport.ru/showthread.php?t=37193)

KuraFire 05-06-2002 09:35 AM

Thx for the hack Freddie, works great. :):up:

I had to remove a small section of the query for Registered Users Today though (the Where clause) because it didn't show up without. Why was it in there, anyway?

ZiRu$ 05-06-2002 08:14 PM

nice stuff :) I will install

Lethal 05-07-2002 10:21 AM

Nice hack freddie, works like a charm.

Dark Odin 05-07-2002 11:39 PM

Is there any plans to make this work with Attachments as Files?

Amasov 05-27-2002 04:31 AM

Great Hack :)

I love this one, since my provider was'nt able to tell me the usage of my database :D :D

Henry-RS 05-27-2002 05:35 AM

Heh....I didn't really like it much above the "Useful Admin Stuff" section, so I put it below it.

If you want to do the same...

Find & Delete:
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>";
  }
}

Then Find:
Code:

<tr class="secondalt">
        <td>Useful Links</td>
        <td><select onchange="jumpto(this.options[this.selectedIndex].value)">
                <option>&raquo; Useful Links &laquo;</option>
                <option value="http://www.vbulletin.com/">vBulletin Home Page</option>
                <option value="http://www.vbulletin.com/members/">vBulletin Members' Area</option>
                <option value="http://www.vbulletin.com/forum/">vBulletin Support Forums</option>
                <option value="http://www.vbulletin.com/manual/">vBulletin Online Manual</option>
                <option value="http://www.php.net/">PHP Home Page</option>
                <option value="http://www.php.net/manual/">PHP Online Manual</option>
                <option value="http://www.mysql.com/">MySQL Home Page</option>
                <option value="http://www.mysql.com/documentation/">MySQL Documentation</option>
        </select></td>
</tr>
</form>
</table>
</td></tr></table>
</form>

Add this below:
Code:

<?php

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();
?>


:)

Hopefully that'll work for anyone who would actually do it. ;)

cdrforum 05-27-2002 04:26 PM

Superb easy hack well done m8 !! 5 out of 5 !!

yetdog11 06-04-2002 03:11 AM

I am running vB 2.2.2 - I seemingly have installed it correctly, but nothing in my CP looks different. Do I need at least 2.2.5?

Matt
matt@antsmarching.org

Boofo 06-05-2002 06:42 PM

Did you ever get this done and posted? I can't seem to find it in here. Did I miss it? BTW: Great hack, Freddie! :)

Quote:

Originally posted by freddie
I have the version that supports the attachments as files hack as well as some additional stats / averages. I will post it tonight when I get home.

GuruXL 06-05-2002 09:05 PM

Good Hack man, i installed it and it works flawlessly. :p


All times are GMT. The time now is 05:05 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01124 seconds
  • Memory Usage 1,757KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete