sparky Posted September 22, 2008 Share Posted September 22, 2008 ###################################### WHMCS ADDON - Maintenance Mode Author - Sparky Website - http://tshosting.com.au/ Version - 1.0.0 ###################################### This addon will enable you to put your site into Maintenance Mode. To install this addon 1. From the rar file, upload the modules directory to the WHMCS root folder. 2. Open header.tpl (from your current template being used) and paste the code from the readme file to the very top (line 1). To activate maintenance mode 1. Go to Admin => Addon Modules => Maintenance Mode 2. Select the box and click "Change Mode". To de-activate maintenance mode 1. Go to Admin => Addon Modules => Maintenance Mode 2. de-select the box and click "Change Mode". Enjoy!. Sparky ######################################### Download Link http://tshosting.com.au/dl.php?type=d&id=5 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted September 22, 2008 Share Posted September 22, 2008 Thanks Sparky! You forgot to open the {php}{/php} tag for the code to be added to the header.tpl I needed to change your doctype to what I use. I also removed the //die("<div style='border: 1px dashed #cc0000;font-family:Tahoma;background-color:#FBEEEB;width:50%;padding:10px;margin:100px auto;color:#cc0000;'><strong>System Maintenance</strong><br>Sorry, the system is currently down for routine maintenance. ETA 1 hour.</div>"); and // End Maintenance Code Because I was getting some error and my page wasn't showing correct. Works good otherwise. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted September 22, 2008 Author Share Posted September 22, 2008 You forgot to open the {php}{/php} tag for the code to be added to the header.tplNo they were there No Problem... You can change anything in the code that goes in the header.tpl to suit your doc type or the look of the maintenance page. I forgot to remove the comented die line. Thanks for pointing that out. I have modified the readme.txt file in the rar file. This it the new version of the readme.txt below ###################################### # WHMCS ADDON - Maintenance Mode # # Author - Sparky # Website - http://tshosting.com.au/ # Version - 1.0.0 # ###################################### This addon will enable you to put your site into Maintenance Mode. To install this addon 1. From the rar file, upload the modules directory to the WHMCS root folder. 2. Open header.tpl (from your current template being used) and paste the below code to the very top (line 1). To activate maintenance mode 1. Go to Admin => Addon Modules => Maintenance Mode 2. Select the box and click "Change Mode". To de-activate maintenance mode 1. Go to Admin => Addon Modules => Maintenance Mode 2. de-select the box and click "Change Mode". Enjoy!. Sparky ############################################################### Copy and paste code to your header.tpl file 1. At the beginning of line 1 press enter key to put the existing code to line 2 2. Copy and paste everything below this line to line 1 of your header.tpl file and save. {php} // Begin Maintenance Code ###################################### # WHMCS ADDON - Maintenance Mode # # # # Author - Sparky # # Website - http://tshosting.com.au/ # # Version - 1.0.0 # # # ###################################### // Place this code on the very top line in your header.tpl file $maintenancefilename = 'maintenance.txt'; if (file_exists($maintenancefilename)) { die(" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\"> <head> <title>Down for Maintenance</title> <link href=\"/favicon.ico\" rel=\"shortcut icon\" type=\"image/x-icon\" /> </head> <body> <div align=\"center\" style=\"border:1px solid #000000;font-family:Tahoma;width:50%;padding:0;margin:100px auto;\"> <table width=\"100%\"> <tr style=\"background-color:red;color:white;text-align:center;\"><td><strong><h1>System Maintenance</h1></strong></td></tr> <tr style=\"background-color:#FBEEEB;color:black;text-align:center;\"><td><div style=\"margin:30px;padding:0;font-weight:600;\"><p>Sorry, the system is currently down for routine maintenance.<p>We apologise for the inconvenience.<p>Approximate ETA is 1 hour.</div></td></tr> </table> </div> </body> </html> "); } // End Maintenance Code {/php} 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted September 22, 2008 Author Share Posted September 22, 2008 Updated readme.txt file with credits and description 0 Quote Link to comment Share on other sites More sharing options...
Drac0 Posted September 23, 2008 Share Posted September 23, 2008 Hi Sparky, Nice mod. I followed your directions to install this mod, however my server doesn't allow the admin side to create the maintenance.txt file in my root directory, so it does not go into admin mode from the control panel. There was an error creating the maintenance file. YOU ARE IN LIVE MODE. I'm hesitant to give write permissions where they are not needed, and since my root directory is public_html, I don't feel comfortable doing that. I can ssh to my system and touch maintenance.txt and the script works fine, I just have manually remove it as well. Can you make this so we can select where we want the maintenance.txt file to go? Perhaps a public_html/tmp directory? 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted September 23, 2008 Author Share Posted September 23, 2008 Ahh...thankyou for pointing that out, what a stupid mistake on my part I hadn't set the variable $filemode for the chmod. That is why you are getting that error Please download again and retry New version should say V1.0.1 0 Quote Link to comment Share on other sites More sharing options...
Drac0 Posted September 24, 2008 Share Posted September 24, 2008 Looks like the link is still pointing to version 1.0.0 From the readme.txt file of the newly downloaded file: ###################################### # WHMCS ADDON - Maintenance Mode # # # # Author - Sparky # # Website - [url]http://tshosting.com.au/[/url] # # Version - 1.0.0 # # # ###################################### And from maintenance_mode.php // ###################################### // # WHMCS ADDON - Maintenance Mode # // # # // # Author - Sparky's Mods # // # Website - [url]http://tshosting.com.au/[/url] # // # Version - 1.0.0 # // # # // ###################################### I installed the files, but still have the same problem. I look forward to getting the latest version 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted September 24, 2008 Author Share Posted September 24, 2008 Please see the wiki for details http://wiki.whmcs.com/Contribution:MaintenanceMode You can also click the link in my signature to download this addon @Drac0 - I have PM'd you 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted September 24, 2008 Share Posted September 24, 2008 Got a feature you can add Sparky, similar to how whmcs is when an admin logs in and then goes to the frontend it show "Logged in as Administrator | Return to Admin Area" maybe you can add to that or have one on the upper left corner that show "System Is Offline" or something to that affect. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted September 24, 2008 Author Share Posted September 24, 2008 Check the new version 1.0.2 it already does that There is some extra lines to add in the header.tpl file 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted September 24, 2008 Share Posted September 24, 2008 I just updated it with that version and when I put it in Demo and go to the frontend it doesn't show any status like Whmcs does. What should I look for? Thanks! 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted September 24, 2008 Author Share Posted September 24, 2008 Have you replaced the old code to your header.tpl (you have to change the whole lot) If you had already installed the code for the previous version you have to change it with the latest code TO INSTALL THE ADDON 1. From the rar file, upload the modules directory to the WHMCS root folder. 2. Open header.tpl (from your current template being used) then see COPY AND PASTE instructions bellow. 3. At the beginning of line 1 press enter key to put the existing code to line 2 4. Copy and paste everything between the "FIRST CUT & PASTE" lines to line 1 of your header.tpl file. 5. Now copy and paste everything between the "SECOND CUT & PASTE" lines between the </head> and <body> tags in your original header.tpl file and save. eg.. </head> #### PASTE HERE #### <body> ##### START FIRST CUT & PASTE ##### {php} // WHMCS ADDON - Maintenance Mode by Sparky // Place this code on the very top line in your header.tpl file $maintenancefilename = 'maintenance.txt'; if (file_exists($maintenancefilename) && (!$_SESSION['adminloggedinstatus'])) { die(" <html> <head> <title>Down for Maintenance</title> <link href=\"/favicon.ico\" rel=\"shortcut icon\" type=\"image/x-icon\" /> </head> <body> <div align=\"center\" style=\"border:1px solid #000000;font-family:Tahoma;width:50%;padding:0;margin:100px auto;\"> <table width=\"100%\"> <tr style=\"background-color:red;color:white;text-align:center;\"><td><strong><h1>System Maintenance</h1></strong></td></tr> <tr style=\"background-color:#FBEEEB;color:black;text-align:center;\"><td><div style=\"margin:30px;padding:0;font-weight:600;\"><p>Sorry, the system is currently down for routine maintenance.<p>We apologise for the inconvenience.<p>Approximate ETA is 1 hour.</div></td></tr> </table> </div> </body> </html> "); } {/php} ##### END FIRST CUT & PASTE ##### ##### START SECOND CUT & PASTE ##### {php} // WHMCS ADDON - Maintenance Mode by Sparky // Place this code in between the </head> and <body> tags in your original header.tpl file if (file_exists($maintenancefilename) && ($_SESSION['adminloggedinstatus'])) { echo "<div align=\"center\"><div style=\"text-align:center;border:1px solid #000000;background-color:red;color:white;font-family:Tahoma;width:50%;padding:0;margin:10px auto;\">MAINTENANCE MODE ON</div></div>"; } {/php} ##### END SECOND CUT & PASTE ##### 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted September 24, 2008 Share Posted September 24, 2008 Yeah I added the new code and updated the old one. I guess the latter code is what suppose to show that. Let me check again. 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted September 24, 2008 Share Posted September 24, 2008 Ok I got it! I added the code to external files then included them which cause the bar not to show above. Thanks again! 0 Quote Link to comment Share on other sites More sharing options...
AVeal Posted October 21, 2008 Share Posted October 21, 2008 Does this work for 3.7.2? 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted October 21, 2008 Author Share Posted October 21, 2008 (edited) Yes it does Use the link in my signature to download the Addon The link in the first post no longer works Edited October 21, 2008 by sparky 0 Quote Link to comment Share on other sites More sharing options...
Phile Posted December 8, 2008 Share Posted December 8, 2008 I'm getting the cant create maintenance file error. where does it try to write to? 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted December 8, 2008 Author Share Posted December 8, 2008 It creates a file in the whmcs root directory The directory perms are normally supposed to be 0755 Are you running suphp? 0 Quote Link to comment Share on other sites More sharing options...
wizzerd Posted December 10, 2008 Share Posted December 10, 2008 Hello, Sorry to interrupt but I am experiencing the same issue and I am running suphp and my whmcs root directory does have 755 perms. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted December 11, 2008 Author Share Posted December 11, 2008 Hello, Sorry to interrupt but I am experiencing the same issue and I am running suphp and my whmcs root directory does have 755 perms. Please open a support ticket at tshosting.com.au so I can look at it for you. 0 Quote Link to comment Share on other sites More sharing options...
barco57 Posted December 18, 2008 Share Posted December 18, 2008 Works like a champ! Good work 0 Quote Link to comment Share on other sites More sharing options...
easyhosting Posted December 20, 2008 Share Posted December 20, 2008 Thanks Sparky works a treat 0 Quote Link to comment Share on other sites More sharing options...
Gazza Posted December 21, 2008 Share Posted December 21, 2008 (edited) works great but can only get it to create the file by changing perms to 777 WHMCS is set in sub directory thank you Edited December 21, 2008 by Gazza 0 Quote Link to comment Share on other sites More sharing options...
bubbasheeko Posted January 1, 2009 Share Posted January 1, 2009 Hey Sparky, I installed as per your instructions from the link provided. Documentation states it is 1.0.2. I am receiving the same error that you released 1.0.1 to fix: There was an error creating the maintenance file. Any suggestions? (besides changing the chmod of the whmcs folder?) Thanks! 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted January 1, 2009 Author Share Posted January 1, 2009 Hey Sparky, I installed as per your instructions from the link provided. Documentation states it is 1.0.2. I am receiving the same error that you released 1.0.1 to fix: Any suggestions? (besides changing the chmod of the whmcs folder?) Thanks! Are you running suphp? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.