Section Maintenance v1.4
PHP-Fusion v7.00
Original Author: HobbyMan
Email: hobbyman@hobbysites.net
Web: http://www.php-fusion.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.3, 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:

Contact, 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. For this to work, you must insert the file modification code.


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

Open photogallery.php and showphoto.php

Find 

include LOCALE.LOCALESET."photogallery.php";

Add under;

// Section Maintenance mod
include INFUSIONS."section_maintenance/infusion_db.php";
$smastatus = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($smastatus['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($smastatus['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";
$smastatus = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($smastatus['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($smastatus['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
include INFUSIONS."section_maintenance/infusion_db.php";
$smastatus = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($smastatus['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($smastatus['sma_news'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
//end mod

Save and close

-------------------------------------------------------------------
Open forum/index.php, forum/viewforum.php and forum/viewthread.php

Find

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

Add under;

// Section Maintenance mod
include INFUSIONS."section_maintenance/infusion_db.php";
$smastatus = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($smastatus['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($smastatus['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";
$smastatus = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($smastatus['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($smastatus['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";
$smastatus = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($smastatus['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($smastatus['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";
$smastatus = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($smastatus['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($smastatus['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";
$smastatus = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($smastatus['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($smastatus['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";
$smastatus = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($smastatus['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($smastatus['sma_submit'] == "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
include INFUSIONS."section_maintenance/infusion_db.php";
$smastatus = dbarray(dbquery("SELECT * FROM ".DB_SECTION_MAINTENANCE));
if ($smastatus['sma_all'] == "1" && !iADMIN) redirect(BASEDIR."infusions/section_maintenance/section_closed.php");
if ($smastatus['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;

To view the closed section page, click the ? link below the submit button
___________________________________
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 14 files. So don't install it if you're not sure you need this facility.
2. If you just want to test it, just log out and try a link you've made offline..
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 section_maintenance_include.php.
7. If you want to change the date and time format, open section_maintenance_admin.php, find in line 375;

".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.* v1.3], overwrite ALL php files. Go to System Admin - Infusions, you'll see the Section Maintenance in the drop down list is now blue indicating an upgrade is available, just select it and click Ifuse. No changes to section files.
2. The non-english locales will need to be updated to work with version 1.3. [Updated Dutch locale now included.]
--------------------------------------------------------------------------

CHANGELOG
----------------
v1.4 Added contact.php to list. Added link to view section closed message. Add "This section is temporarily offline" to title. French Locale added [Thanks to Mndrs78].

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

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

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

