============================================================================================================================
Modification Title: Forum Information v1.0

Author: John Briggs

Description:
This modification will provide a new tool in admin panel to view general stats and information pertaining to your forums.

Copyright:  2010 John Briggs. All rights reserved.

Compatability: XMB 1.9.5 SP1

Install Note: Before adding this modification to your forum, you should back up all files related to this modification.

License Note: This modification is released under the GPL License. A copy is provided with this software package.

Author Note:
You downloaded this modification from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.
============================================================================================================================
=======
Step 1:
=======
===========================
Edit File: include/admin.user.inc.php
===========================
==========
Find Code:
==========

    &raquo;&nbsp;<a href="cp2.php?action=censor"><?php echo $lang['textcensors']?></a><br />

===============
Add Code Below:
===============

    <!-- Forum Information Mod Begin -->
    &raquo;&nbsp;<a href="tools.php?action=foruminfo"><?php echo $lang['finfo_foruminfo']?></a><br />
    <!-- Forum Information Mod End -->

============================================================================================================================
=======
Step 2:
=======
===============
Edit File: tools.php
===============
==========
Find Code:
==========

    case 'fixorphanedattachments':
        if (!isset($_POST['orphattachsubmit'])) {
            echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>';
            echo '<form action="tools.php?action=fixorphanedattachments" method="post">';
            echo '<input type="submit" name="orphattachsubmit" value="'.$lang['o_attach_submit'].'" />';
            echo '</form>';
        } else {
            $i = 0;
            $q = $db->query("SELECT aid, pid FROM $table_attachments");
            while ($a = $db->fetch_array($q)) {
                $result = $db->query("SELECT pid FROM $table_posts WHERE pid='$a[pid]'");
                if ($db->num_rows($result) == 0) {
                    $db->query("DELETE FROM $table_attachments WHERE aid='$a[aid]'");
                    $i++;
                }
            }
            echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>';
            echo $i . $lang['o_attachments_found'];
        }
        break;

===============
Add Code Below:
===============

    // Forum Information Mod Begin
    case 'foruminfo':
        if (!X_SADMIN) {
            error($lang['superadminonly'], false, '</td></tr></table></td></tr></table><br />');
        }

        $query = $db->query("SELECT COUNT(uid) FROM $table_members");
        $members = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(tid) FROM $table_threads");
        $threads = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(pid) FROM $table_posts");
        $posts = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(u2uid) FROM $table_u2u");
        $u2us = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(username) FROM $table_whosonline WHERE username LIKE 'xguest123'");
        $gonline = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(username) FROM $table_whosonline WHERE username NOT LIKE 'xguest123'");
        $monline = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(status) FROM $table_members WHERE status = 'Moderator'");
        $mods = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(status) FROM $table_members WHERE status = 'Administrator'");
        $admins = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(fid) FROM $table_forums WHERE type = 'forum' OR type = 'sub'");
        $forums = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(fid) FROM $table_forums WHERE type = 'forum' OR type = 'sub' AND status = 'on'");
        $forumsa = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(postnum) FROM $table_members WHERE postnum = '0'");
        $inactive = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(readstatus) FROM $table_u2u WHERE readstatus = 'yes'");
        $readu2us = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(status) FROM $table_members WHERE status = 'Super Moderator'");
        $supmods = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(status) FROM $table_members WHERE status = 'Super Administrator'");
        $supadmins = $db->result($query, 0);
        $db->free_result($query);

        $query = $db->query("SELECT COUNT(filesize) FROM $table_attachments");
        $attacht = $db->result($query, 0);
        $db->free_result($query);

        $mysqlver = mysql_get_server_info();
        $phpver = phpversion();
        $zendver = zend_version();
        ?>
        <tr bgcolor="<?php echo $altbg2?>">
        <td align="center">
        <table cellspacing="0" cellpadding="0" border="0" width="<?php echo $tablewidth?>" align="center">
        <tr>
        <td bgcolor="<?php echo $bordercolor?>">
        <table border="0" cellspacing="<?php echo $borderwidth?>" cellpadding="<?php echo $tablespace?>" width="100%">
        <tr class="category">
        <td colspan="8" class="ctrtablerow"><strong><font color="<?php echo $cattext?>"><?php echo $lang['finfo_foruminfo']?></font></strong></td>
        </tr>
        <tr>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_boardvers']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $versiongeneral?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_boardbld']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $versionbuild?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_totalforums']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $forums?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_activeforums']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $forumsa?></td>
        </tr>
        <tr>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_totalmems']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $members?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_totalthreads']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $threads?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_totalposts']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $posts?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_totalu2us']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $u2us?></td>
        </tr>
        <tr>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_guestsonline']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $gonline?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_membersonline']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $monline?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_admins']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $admins?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_mods']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $mods?></td>
        </tr>
        <tr>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_inactive']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $inactive?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_readu2us']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $readu2us?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_supadmins']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $supadmins?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_supmods']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $supmods?></td>
        </tr>
        <tr>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_totattach']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $attacht?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_mysql']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $mysqlver?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_phpver']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $phpver?></td>
        <td class="tablerow" bgcolor="<?php echo $altbg1?>"><strong><?php echo $lang['finfo_zend']?></strong></td>
        <td class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><?php echo $zendver?></td>
        </tr>
        </table>
        </td>
        </tr>
        </table>
        <?php
        break;
    // Forum Information Mod End

============================================================================================================================
=======
Step 3:
=======
=======================
Edit File: lang/English.lang.php
=======================
============================
Add Code To End Of File Above  ?>
============================

// Forum Information Mod Begin
$lang['finfo_foruminfo'] = 'Forum Information';
$lang['finfo_boardvers'] = 'Board Version:';
$lang['finfo_boardbld'] = 'Board Build:';
$lang['finfo_totalforums'] = 'Total Forums:';
$lang['finfo_activeforums'] = 'Active Forums:';
$lang['finfo_totalmems'] = 'Total Members:';
$lang['finfo_totalthreads'] = 'Total Threads:';
$lang['finfo_totalposts'] = 'Total Posts:';
$lang['finfo_totalu2us'] = 'Total U2Us:';
$lang['finfo_guestsonline'] = 'Guests Online:';
$lang['finfo_membersonline'] = 'Members Online:';
$lang['finfo_admins'] = 'Administrators:';
$lang['finfo_mods'] = 'Moderators:';
$lang['finfo_inactive'] = 'Inactive Members:';
$lang['finfo_readu2us'] = 'Total Read U2Us:';
$lang['finfo_supadmins'] = 'Super Administrators:';
$lang['finfo_supmods'] = 'Super Moderators:';
$lang['finfo_totattach'] = 'Total Attachments:';
$lang['finfo_mysql'] = 'MySQL Version:';
$lang['finfo_phpver'] = 'PHP Version:';
$lang['finfo_zend'] = 'Zend Version:';
// Forum Information Mod End

============================================================================================================================
Enjoy!