Title: Empty Logs Tool v1.0

Author: John Briggs

Description:
This mod will provide a new tool in admin panel to empty mod and admin logs if it is quite large and you would like to.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.5 Final

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

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

Author Note:
You downloaded this hack from XMBMods.com, the #1 source for XMB related downloads.
Please visit http://www.xmbmods.com/ for support.

=======================================================================================================================================
=======
Step 1:
=======

=====================================
Edit File: include/admin.user.inc.php
=====================================

==========
Find Code:
==========

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

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

    &raquo;&nbsp;<a href="tools.php?action=emptylogs"><?php echo $lang['emptylogstool']?></a><br />

=======================================================================================================================================
=======
Step 2:
=======

====================
Edit File: tools.php
====================

==========
Find Code:
==========

    case 'fixorphanedattachments':
        /*
            function generously donated by vanderaj
        */
        if (!isset($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 {
            // discover the total number of attachments
            $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) {
                    // take action against this row as it has no parent post to attach to.
                    $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:
===============

    case 'emptylogs':
        if (!isset($_POST['yessubmit'])) {
            echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['emptylogs_confirm'].'<br /><form action="tools.php?action=emptylogs" method="post"><input class="submit" type="submit" name="yessubmit" value="'.$lang['textyes'].'" /> - <input class="submit" type="submit" name="yessubmit" value="'.$lang['textno'].'" /></form></td></tr>';
        } elseif ($lang['textyes'] == $_POST['yessubmit']) {
            $db->query("TRUNCATE `$table_logs`");
            nav($lang['tools']);
            echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['tool_completed'].' - '.$lang['tool_emptylogs'].'</td></tr></table></table>';
            end_time();
            eval("echo (\"".template('footer')."\");");
            exit();
        } else {
            redirect('cp.php', 0);
        }
        break;

=======================================================================================================================================
=======
Step 4:
=======

================================
Edit File: lang/English.lang.php
================================

================================
Add Code At Very Bottom Of File:
================================

// Empty Logs Tool Mod Begin
$lang['emptylogs_confirm'] = "Are you sure you want to empty mod and admin logs?";
$lang['tool_emptylogs'] = "All mod and admin logs emptied.";
$lang['emptylogstool'] = "Empty Logs";
// Empty Logs Tool Mod End

=======================================================================================================================================