Title: Prevent Guests From Downloading Attachments v1.0

Author: John Briggs

Description:
This mod will allow you to enable or disable the option for guests to download attachments in admin settings.
Not be confused with the Forum Based Guest Download Attachment Status.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.8 Final Engage SP2

Updated for 1.9.8 by: WormHole @ XMB Garage

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 XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.

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

============================================
Go To Administration Panel -> Insert Raw SQL
============================================

====================
Add Code And Submit:
====================

ALTER TABLE `$table_settings` ADD `allowguest` set('on','off') NOT NULL default 'on';

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

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

================================
Add Code To End Of File Above ?>
================================

// Prevent Guests From Downloading Attachments Mod Begin
$lang['allowguest'] = 'Allow guests to download attachment?<br /><span class="smalltxt">Turn off to disable guests from downloading attachments.</span>';
$lang['allowguestmsg'] = 'Sorry, you must be a registered user to download.';
// Prevent Guests From Downloading Attachments Mod End

=======================================================================================================================================
=======
Step 3:
=======

=================
Edit File: cp.php
=================

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

        $avataron = $avataroff = $avatarlist = '';
        if ($SETTINGS['avastatus'] == 'on') {
            $avataron = $selHTML;
        } else if ($avastatus == 'list') {
            $avatarlist = $selHTML;
        } else {
            $avataroff = $selHTML;
        }

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

        // Prevent Guests From Downloading Attachments Mod Begin
        $allowgueston = $allowguestoff = '';
        switch ($SETTINGS['allowguest']) {
            case 'on':
                $allowgueston = $selHTML;
                break;
            default:
                $allowguestoff = $selHTML;
                break;
        }
        // Prevent Guests From Downloading Attachments Mod End

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

        printsetting1($lang['reportpoststatus'], 'reportpostnew', $reportposton, $reportpostoff);

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

        // Prevent Guests From Downloading Attachments Mod Begin
        printsetting1($lang['allowguest'], 'allowguestnew', $allowgueston, $allowguestoff);
        // Prevent Guests From Downloading Attachments Mod End

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

        $smileyinsertnew = formOnOff('smileyinsertnew');

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

        // Prevent Guests From Downloading Attachments Mod Begin
        $allowguestnew = formOnOff('allowguestnew');
        // Prevent Guests From Downloading Attachments Mod End

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

            onlinetoday_status='$onlinetoday_statusnew'
        ");

==================
Replace Code With:
==================

            onlinetoday_status='$onlinetoday_statusnew',
            allowguest='$allowguestnew'
        ");

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

=========================
Edit File: viewthread.php
=========================

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

} else if ($action == 'attachment' && $forum['attachstatus'] != 'off' && $pid > 0 && $tid > 0) {

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

    // Prevent Guests From Downloading Attachments Mod Begin
    if ($SETTINGS['allowguest'] == 'off' && X_GUEST) {
        error($lang['allowguestmsg']);
    }
    // Prevent Guests From Downloading Attachments Mod End

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