Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-14-2008, 02:42 PM
Casual Pligger
 
Join Date: Feb 2008
Posts: 33
Thanks: 3
Thanked 13 Times in 6 Posts
Talking Maintence mode - new modifiaction for free

That's my first modification so there could be some bugs, maybe someone who know php better than me should check it

Maintenance mode is modification which give as the possibility to put our site in maintenance mode. For example we need to close site for few minutes, we click on the button On an now people only see your web site logo and text "This site is currently under construction."

So let's start:

Files used in that modification:
smm.php (included in package)
admin_maintenance (included in package)
maintenance_main_center.tpl (included in package)

Files modified in that modification:
index.php
languages/lang_english.conf
templates/your_template_name/admin_templates/admin_main_center.tpl

Other:
Database query

Instruction:

1) Database query:

Code:
CREATE TABLE `pligg_maintenance` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR( 20 ) NOT NULL ,
`valuemm` VARCHAR( 50 ) NOT NULL
) ENGINE = MYISAM

INSERT INTO `pligg_maintenance` (
`id` ,
`name` ,
`valuemm`
)
VALUES (
'1', 'state', '0'
);
2) Put files from package into your Pligg directory:
smm.php to your root directory
admin_maintenance.php to your root directory
maintenance_main_center.tpl to templates/your_template_name/admin_templates/

3) Edit files:

Open index.php from root directory:

before
Code:
include_once('Smarty.class.php');
add
Code:
include('smm.php');
Open lang_english.conf from languages directory:

add this at the end:
Code:
//<SECTION>Pligg Maintenance</SECTION><ADDED>0.1</ADDED>
PLIGG_Visual_Header_AdminPanel_Maintenance="Site under maintence"
PLIGG_Visual_Header_AdminPanel_Maintenance_Display="Maintenance"
Open admin_main_center.tpl from templates/your_template_name/admin_templates/

after
Code:
<img src="{$my_pligg_base}/templates/{$the_template}/images/paypal.gif" align="absmiddle"/> <a href="http://forums.pligg.com/donate.php" target="_blank">{#PLIGG_Visual_Header_AdminPanel_Donate#}</a>
add
Code:
<br/>
<img src="{$my_pligg_base}/templates/{$the_template}/images/manage_config.png" align="absmiddle"/> <a href="{$my_pligg_base}/admin_maintenance.php">{#PLIGG_Visual_Header_AdminPanel_Maintenance#}</a>
Open maintence_main_center.tpl from templates/your_template_name/

Add your website name:
Code:
<input type="submit" name="On" id="On" value="On" onClick="parent.location='http://your_web_address/admin_maintenance.php?action=on'" />
Code:
<input type="submit" name="Off" id="Off" value="Off" onClick="parent.location='http://your_web_address/admin_maintenance.php?action=off'" />
4) Customization:

To change the logo and text displayed when site is under maintenance you need edit smm.php file.

You can change:

title:
Code:
<title>Site maintenance</title>
logo:
Code:
<img src="http://your_web_address/logo.png" alt="logo">
text:
Code:
<h2>This site is currently under construction.</h2>
5) Using:

To use modification go to the admin pane, the you find on the end of list modification mode. Then you can click On and Off. Actually the status is not displayed. I will change that in future version.


TODO list:
-add display status (maintenance On/Off)

Version 0.1

If you don't understand something please write questions here

Modification is free but if you like you can send me some cash to my paypal account: admin.ddluk@gmail.com

Edited:
Small bug in smm.php. New version uploaded.
Attached Files
File Type: rar maintenance_mode.rar (2.1 KB, 2 views)

Last edited by ddluk; 07-14-2008 at 04:55 PM..
Reply With Quote
The Following 2 Users Say Thank You to ddluk For This Useful Post:
  #2 (permalink)  
Old 07-14-2008, 02:55 PM
chuckroast's Avatar
Coder/Designer
Pligg Version: 1.0
Pligg Template: ExpertVision
 
Join Date: Jun 2006
Location: PA
Posts: 2,399
Thanks: 171
Thanked 439 Times in 278 Posts
Thanks for sharing..
__________________
Visit PliggPro the official Pligg Mods & Template Shop!

Reply With Quote
  #3 (permalink)  
Old 07-14-2008, 08:24 PM
glorify's Avatar
New Pligger
Pligg Version: 9.9
Pligg Template: Custom
 
Join Date: Jul 2008
Location: Hebron, IN
Posts: 20
Thanks: 1
Thanked 10 Times in 1 Post
Looks promising. Any way god users can still see the site as normal even with maintenance mode on?
Reply With Quote
  #4 (permalink)  
Old 07-15-2008, 06:20 AM
Casual Pligger
 
Join Date: Feb 2008
Posts: 33
Thanks: 3
Thanked 13 Times in 6 Posts
@glorify

In version 0.1 now. But in version 0.2 which is included in that post it's possible.

Changes:
No it's possible to simple god access to site.

Instruction:
To access to site when maintenance mode is switched on you need go to your web site using special address written below:

Code:
http://www.your_website_address.com/?access=access_code
where access_code is code which you can change in smm.php file:

Code:
$pass = 'access_code';

Changelog:

0.2 (15.07.2008)
added god access to site when is on maintenance

0.1 (14.07.2008)
First version
Attached Files
File Type: rar maintenance_mode0.2.rar (2.1 KB, 2 views)
Reply With Quote
  #5 (permalink)  
Old 07-15-2008, 03:00 PM
catchpen's Avatar
Pligg Donor
 
Join Date: Jan 2008
Posts: 210
Thanks: 30
Thanked 18 Times in 13 Posts
Should be added to the core - a must for high traffic Pligg sites.
Reply With Quote
  #6 (permalink)  
Old 07-15-2008, 03:03 PM
Casual Pligger
 
Join Date: Feb 2008
Posts: 33
Thanks: 3
Thanked 13 Times in 6 Posts
Maybe future version should be added. There are few things that should be done before including into core
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
[Fixed] MySQL 5 in Strict Mode av613 Bug Report 1 04-25-2007 12:33 PM
How to return the mode God? Chupa General Help 1 12-12-2006 09:39 AM


Search Engine Friendly URLs by vBSEO 3.2.0