From eaf0dc418bb8338a0de53c6ca6d2469ce3b70214 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sat, 20 Dec 2008 21:41:09 -0500 Subject: Added Maintenance switcher to Admin Also fixed spelling of maintenance in places where it was incorrectly spelled. Maintenance Required: Rename "mantainenceMode" config to "maintenanceMode" --- includes/maintenance.php | 39 +++++++++++++++++++++++++++++++++++++++ includes/mantainence.php | 39 --------------------------------------- index.php | 2 +- pages/admin.php | 38 ++++++++++++++++++++++++++++++++++++++ theme/admin/index.tpl | 1 + theme/admin/maintenanceMode.tpl | 15 +++++++++++++++ theme/maintenance.tpl | 6 ++++++ theme/mantainence.tpl | 6 ------ 8 files changed, 100 insertions(+), 46 deletions(-) create mode 100755 includes/maintenance.php delete mode 100755 includes/mantainence.php create mode 100644 theme/admin/maintenanceMode.tpl create mode 100755 theme/maintenance.tpl delete mode 100755 theme/mantainence.tpl diff --git a/includes/maintenance.php b/includes/maintenance.php new file mode 100755 index 0000000..79466f9 --- /dev/null +++ b/includes/maintenance.php @@ -0,0 +1,39 @@ +display($template); + + exit; + } +} + +?> diff --git a/includes/mantainence.php b/includes/mantainence.php deleted file mode 100755 index 6e595a1..0000000 --- a/includes/mantainence.php +++ /dev/null @@ -1,39 +0,0 @@ -display($template); - - exit; - } -} - -?> diff --git a/index.php b/index.php index 6a04591..bea38b7 100755 --- a/index.php +++ b/index.php @@ -25,7 +25,7 @@ header('X-Pingback: http://fourisland.com/xmlrpc.php'); include('../security/config.php'); include('includes/db.php'); include('includes/template.php'); -include('includes/mantainence.php'); +include('includes/maintenance.php'); include('includes/session.php'); include('includes/parsers.php'); include('includes/xmlrpc/xmlrpc.inc'); diff --git a/pages/admin.php b/pages/admin.php index 579feed..a3b1783 100755 --- a/pages/admin.php +++ b/pages/admin.php @@ -692,6 +692,44 @@ if (isLoggedIn()) system('hg update'); $template->add('MSG', ob_get_contents()); ob_end_clean(); + } else if ($_GET['page'] == 'maintenanceMode') + { + if (isset($_GET['submit'])) + { + if ($_POST['mode'] == 'on') + { + $set = 1; + } else if ($_POST['mode'] == 'off') + { + $set = 0; + } else { + $template = new FITemplate('msg'); + $template->add('MSG', 'You seem to have somehow messed up the form. That\'s weird.'); + $template->add('BACK', 'the Maintenance Mode form'); + } + + if (isset($set)) + { + $setconfig = "UPDATE config SET value = \"" . $set . "\" WHERE name = \"maintenanceMode\""; + $setconfig2 = mysql_query($setconfig); + + $template = new FITemplate('msg'); + $template->add('MSG', 'Maintenance Mode has successfully been set to "' . $_POST['mode'] . '"'); + $template->add('BACK', 'the Maintenance Mode form'); + } + } else { + $template = new FITemplate('admin/maintenanceMode'); + + $getconfig = "SELECT * FROM config WHERE name = \"maintenanceMode\""; + $getconfig2 = mysql_query($getconfig); + $getconfig3 = mysql_fetch_array($getconfig2); + if ($getconfig3['value'] == '1') + { + $template->add('ON', ' CHECKED="CHECKED"'); + } else { + $template->add('OFF', ' CHECKED="CHECKED"'); + } + } } else { generateError(404); } diff --git a/theme/admin/index.tpl b/theme/admin/index.tpl index 66fbae3..866c900 100755 --- a/theme/admin/index.tpl +++ b/theme/admin/index.tpl @@ -28,4 +28,5 @@ Welcome to the ubiquitous administration panel!

diff --git a/theme/admin/maintenanceMode.tpl b/theme/admin/maintenanceMode.tpl new file mode 100644 index 0000000..401d0ab --- /dev/null +++ b/theme/admin/maintenanceMode.tpl @@ -0,0 +1,15 @@ +

Maintenance Mode

+ +

Here you can enable/disable Maintenance Mode. When Maintenance Mode is enabled, no one can access Four Island except localhost.

+ +
+
+ >On
+ >Off
+ +
+
+ +

+ Back to Admin Panel +

diff --git a/theme/maintenance.tpl b/theme/maintenance.tpl new file mode 100755 index 0000000..0a50a51 --- /dev/null +++ b/theme/maintenance.tpl @@ -0,0 +1,6 @@ +

Four Island is under maintenance

+ +

I'm sorry, but you've caught Four Island off guard. We're currently upgrading the website to accomidate for some fun new features we've thrown in, +so Four Island'll be down for a few minutes. Please try again soon and thanks for your interest in Four Island!

+ +

--Starla Insigna

diff --git a/theme/mantainence.tpl b/theme/mantainence.tpl deleted file mode 100755 index dab4ef5..0000000 --- a/theme/mantainence.tpl +++ /dev/null @@ -1,6 +0,0 @@ -

Four Island is under mantainence

- -

I'm sorry, but you've caught Four Island off guard. We're currently upgrading the website to accomidate for some fun new features we've thrown in, -so Four Island'll be down for a few minutes. Please try again soon and thanks for your interest in Four Island!

- -

--Starla Insigna

-- cgit 1.4.1