============================================================================================================================
Modification Title: Prevent Guests From Downloading Attachments v1.0

Author: John Briggs

Description:
This modification 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:  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:
=======
====================================
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:
==========

        $resetSigOn = $resetSigOff = '';
        if($SETTINGS['resetsigs'] == 'on') {
            $resetSigOn = $selHTML;
        } else {
            $resetSigOff = $selHTML;
        }

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

        // 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:
==========

        $resetSigNew = ($resetSigNew == 'on') ? 'on' : 'off';

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

        // Prevent Guests From Downloading Attachments Mod Begin
        $allowguestnew = ($allowguestnew == 'on') ? 'on' : 'off';
        // Prevent Guests From Downloading Attachments Mod End

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

$db->query("UPDATE $table_settings SET

==================================
Find Code In-Line In Above Query Statement:
==================================

");

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

, allowguest='$allowguestnew'");

============================================================================================================================
=======
Step 4:
=======
===================
Edit File: viewthread.php
===================
==========
Find Code:
==========

} elseif ($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

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