Modification Name: Mass Edit Forum Access Lists v1.0

Modification Author: GuldantheWarlock (GuldantheWarlock@xmbgarage.com)

Updated for 1.9.8 by: WormHole @ XMB Garage

Last Updated: August 05, 2009

Modification Description:
This modification will add a new feature in the admin panel where you can manage all your forums user access lists on page instead of having to go into each forum and editing the lists manually.
As new forums are added they will be automatically added to the access list page.
This modification also feature a Clear List link for each access list for deletion of usernames.

Supported Version: XMB 1.9.8 SP3

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

Please backup your files before installing this modification. Neither XMBGarage nor the author can be held 
responsible if your board stops functioning properly due to you installing this modification.

=======================================================================================================
=======
Step 1:
=======
==========
Edit cp.php
==========
==========
Find Code:
==========

if ($action == "mods") {

===============
Add Code Above:
===============

if ($action == 'accesslists') {
    if (isset($acupdate)) {
        $query = $db->query("SELECT fid FROM ".X_PREFIX."forums WHERE type != 'group'");
        while($forum = $db->fetch_array($query)) {
            $userlist = "userlist$forum[fid]";
            $userlist = "${$userlist}";
            
            $db->query("UPDATE ".X_PREFIX."forums SET userlist='".trim($userlist)."' WHERE fid='$forum[fid]'");
        }
        echo "<tr bgcolor=\"$THEME[altbg2]\" class=\"tablerow\"><td align=\"center\">$lang[textforumupdate]</td></tr>";
    } else {
        $query = $db->query("SELECT fid, name, userlist FROM ".X_PREFIX."forums WHERE type != 'group' ORDER BY fup ASC, displayorder ASC");
        ?>
        <script language="JavaScript">
        function clearBox(id) {
            document.getElementById('userlist'+id).value = '';
        }
        </script>
        <tr bgcolor="<?php echo $THEME[altbg2]?>">
        <td>
        <form method="post" action="cp.php?action=accesslists">
        <table cellspacing="0" cellpadding="0" border="0" width="90%" align="center">
        <tr>
        <td bgcolor="<?php echo $THEME[bordercolor]?>">
        <table border="0" cellspacing="<?php echo $THEME[borderwidth]?>" cellpadding="<?php echo $THEME[tablespace]?>" width="100%">
        <tr>
        <td class="category" colspan="2"><font color="<?php echo $THEME[cattext]?>"><strong><?php echo $lang['mefal1']?></strong></font></td>
        </tr>
        <tr>
        <td class="header" width="50%"><?php echo $lang['textforumnew']?></td>
        <td class="header" width="50%"><?php echo $lang['textuserlist']?></td>
        </tr>
        <?php
        while($forum = $db->fetch_array($query)) {
            ?>
            <tr bgcolor="<?php echo $THEME[altbg1]?>" class="tablerow">
            <td><?php echo stripslashes($forum['name'])?></td>
            <td><textarea rows="4" cols="30" id="userlist<?php echo $forum['fid']?>" name="userlist<?php echo $forum['fid']?>"><?php echo $forum['userlist']?></textarea>&nbsp;
            <a onClick="clearBox('<?php echo $forum['fid']?>');" style="cursor:hand"><?php echo $lang['mefal2']?></a></td>
            </tr>
            <?php
        }
        ?>
        <tr>
        <td bgcolor="<?php echo $THEME[altbg2]?>" class="tablerow" align="center" colspan="2"><input type="submit" name="acupdate" value="<?php echo $lang['textsubmitchanges']?>" class="submit" /></td>
        </tr>
        </table>
        </td>
        </tr>
        </table>
        </form>
        </td>
        </tr>
        <?php
    }
}

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

// Mass Edit Forum Access Lists Mod Begin
$lang['mefal1'] = 'Access Lists';
$lang['mefal2'] = 'Clear List';
$lang['mefal3'] = 'Access Lists successfully updated!';
$lang['mefal4'] = 'Mass Edit Access Lists';
// Mass Edit Forum Access Lists Mod End

=======================================================================================================
=======
Step 3:
=======
=======================
Edit File: include/admin.inc.php
=======================
==========
Find Code:
==========

    &raquo;&nbsp;<a href="cp.php?action=forum"><?php echo $lang['textforums']?></a><br />
    
===============
Add Code Below:
===============

    <!-- Mass Edit Forum Access Lists Mod Begin -->
    &raquo;&nbsp;<a href="cp.php?action=accesslists"><?php echo $lang['mefal4']?></a><br />
    <!-- Mass Edit Forum Access Lists Mod End -->

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