Section Maintenance v1.3
PHP-Fusion v7.00
Original Author: HobbyMan
Email: philip@hobbysites.net
Web: http://www.hobbysites.net/
+--------------------------------------------------
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+----------------------------------------------------*

** See Notes at bottom before installing

*** To ugrade from version 1.0-1.2, see notes

This infusion allows you to enable or disable access to certain areas of your site to Members and Guests for maintenance or upgrading without the need to shut down the entire site. It allows you to have as many sections as you want offline at any one time or all of them if needed. 

Sections:

Photogallery, Articles, News and News Categories, Forums, Members List, Downloads, Private Messaging, Weblinks, Submissions , FAQ's or all of the above.

INSTALLATION
-----------------------

Upload the section_maintenance folder to your infusions folder. Upload the infusion image [if desired] to administration - images. Go to Admin Panel - System Admin - Infusions. In the dropdown menu, choose Section Maintenance and Infuse. Go to Infusions and click Section Maintenance. See configuration below on how to use.

FILE MODIFICATIONS
------------------------

Open photogallery.php

Find 

include LOCALE.LOCALESET."photogallery.php";

Add under;

// Section Maintenance mod
include INFUSIONS."section_maintenance/infusion_db.php";
$settings3 = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($settings3['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($settings3['sma_photo'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
//end mod

Save and close

-------------------------------------------------------------------
Open articles.php

Find 

include LOCALE.LOCALESET."articles.php";

Add under;

// Section Maintenance mod
include INFUSIONS."section_maintenance/infusion_db.php";
$settings3 = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($settings3['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($settings3['sma_articles'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
//end mod

Save and close

-------------------------------------------------------------------
Open news.php AND news_cats.php

Find in news.php:   require_once THEMES."templates/header.php";
and in news_cats.php: include LOCALE.LOCALESET."news_cats.php";

Add under;

// Section Maintenance mod
{
$settings3 = dbarray(dbquery("SELECT * FROM ".$db_prefix."section_maintenance"));
if ($settings3['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($settings3['sma_news'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
}
// end mod

Save and close

-------------------------------------------------------------------
Open forum/index.php AND forum/viewforum.php

Find

include LOCALE.LOCALESET."forum/main.php";

Add under;

// Section Maintenance mod
include INFUSIONS."section_maintenance/infusion_db.php";
$settings3 = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($settings3['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($settings3['sma_forum'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
//end mod

Save and close

-------------------------------------------------------------------
open members.php

Find 

include LOCALE.LOCALESET."members.php";

Add under;

// Section Maintenance mod
include INFUSIONS."section_maintenance/infusion_db.php";
$settings3 = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($settings3['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($settings3['sma_members'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
//end mod


Save and close

-------------------------------------------------------------------
Open downloads.php

Find

include LOCALE.LOCALESET."downloads.php";

Add under;

// Section Maintenance mod
include INFUSIONS."section_maintenance/infusion_db.php";
$settings3 = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($settings3['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($settings3['sma_down'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
//end mod

Save and close

-------------------------------------------------------------------
Open messages.php

Find

include LOCALE.LOCALESET."messages.php";

Add Under

// Section Maintenance mod
include INFUSIONS."section_maintenance/infusion_db.php";
$settings3 = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($settings3['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($settings3['sma_pm'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
//end mod

Save and Close

-------------------------------------------------------------------
Open weblinks.php

Find

include LOCALE.LOCALESET."weblinks.php";

Add Under

// Section Maintenance mod
include INFUSIONS."section_maintenance/infusion_db.php";
$settings3 = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($settings3['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($settings3['sma_weblinks'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
//end mod

Save and Close

-------------------------------------------------------------------
Open submit.php

Find 

include LOCALE.LOCALESET."submit.php";

Add under

// Section Maintenance mod
include INFUSIONS."section_maintenance/infusion_db.php";
$settings3 = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($settings3['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($settings3['sma_submissions'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
//end mod

Save and Close

-------------------------------------------------------------------
Open faq.php

Find

include LOCALE.LOCALESET."faq.php";

Add under

// Section Maintenance mod
{
$settings3 = dbarray(dbquery("SELECT * FROM ".$db_prefix."section_maintenance"));
if ($settings3['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($settings3['sma_faq'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
}
// end mod

Save and Close
-------------------------------------------------------------------


CONFIGURATION
--------------------------------

Go to Admin Panel - Infusions - Section Maintenance

Choose which section you want to put offline, enter a reason in the text box. This will be visible to guests and members. A traffic light beside each section shows you which section is on or offline.

When a guest or member visits an offline section, they will see a message;
___________________________________
This section is temporarily offline.
 
[Reason] 

Please try again later. 
____________________________________

If you leave the Reason box empty, they will just see the top and bottom lines.

If you want ALL sections offline, just select the "Select All" choice at the bottom, this will override the other choices.

[Optional]
Footer: It should be offline for no longer than...  
If you enter a number eg;5. A message will appear under "Please try again later;

"It should be offline for no longer than 5 hours"
If you don't want this to appear, leave 0 [zero] in box.

[Optional]
Taken offline by ..... on: 00/00/2008 00:00
Choose Yes or No to show "Taken offline by [username] on: 00/00/2008 00:00"

[Optional]
Show Image: 
Choose Yes or No to show image on offline page. [Image path: /infusions/section_maintenance/images/offline.jpg]
-------------------------------------------------------------------------

**Notes:

1. This is both an infusion and a modification and requires the alteration of 12 files. So don't install it if you're not sure you need this facility.
2. If you just want to test it, just modify one or two files to see it in action as the Infusion works independently of the file modifications.
3. All modified code is positioned between  // Section Maintenance mod and // End Mod. Leave this in place, as it makes it easier to uninstall.
4. If you want to remove the infusion, defuse it as normal. The site will work as normal even if you leave the modified code in place.
5. The original Maintenance mode in Admin Panel - System Admin - Miscellaneous remains unaffected. You can still take the entire site offline as before.
6. If you want to exclude Admins and give access to SuperAdmins only, change ADMIN to SUPERADMIN in the file modifications.
7. If you want to change the date and time format, open section_maintenance_admin.php, find in line 344;

".strftime('%d/%m/%Y %H:%M', $data_sm['sma_datestamp']+($settings['timeoffset']*3600))."

Change '%d/%m/%Y %H:%M to suit. Do the same in section_closed.php, line 65.



***Notes:

1 If you have a previous version installed [V1.0-V1.2], defuse and delete the exisiting infusion, upload ALL files. No changes to section files.
2. The non-english locales will need to be updated to work with version 1.3
--------------------------------------------------------------------------

CHANGELOG
----------------
v1.1 Cleaned up form code, added 2 optional extras

v1.2 Danish, German, Bulgarian, Spanish and Dutch Locales added [Thanks to helmuth, gozoc, Haunted, Super and rob]

v1.3 Choice of time periods in footer. Added datestamp to footer notice. Added image to offline page.