Jump to content

ADDON - Maintenance Mode


sparky

Recommended Posts

######################################

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

You forgot to open the {php}{/php} tag for the code to be added to the header.tpl
No 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}

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 #####

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
  • 2 weeks later...

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!

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated