summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2008-12-20 21:41:09 -0500
committerStarla Insigna <hatkirby@fourisland.com>2008-12-20 21:41:09 -0500
commiteaf0dc418bb8338a0de53c6ca6d2469ce3b70214 (patch)
tree8b5ae56f2080d1dbdb261e04f71e11ddaacef12e
parent03d6589fefd850f793215cb6805c0f0c0989f93f (diff)
downloadfourisland-eaf0dc418bb8338a0de53c6ca6d2469ce3b70214.tar.gz
fourisland-eaf0dc418bb8338a0de53c6ca6d2469ce3b70214.tar.bz2
fourisland-eaf0dc418bb8338a0de53c6ca6d2469ce3b70214.zip
Added Maintenance switcher to Admin
Also fixed spelling of maintenance in places where it was incorrectly spelled.

Maintenance Required: Rename "mantainenceMode" config to "maintenanceMode"
-rwxr-xr-xincludes/maintenance.php (renamed from includes/mantainence.php)6
-rwxr-xr-xindex.php2
-rwxr-xr-xpages/admin.php38
-rwxr-xr-xtheme/admin/index.tpl1
-rw-r--r--theme/admin/maintenanceMode.tpl15
-rwxr-xr-xtheme/maintenance.tpl (renamed from theme/mantainence.tpl)2
6 files changed, 59 insertions, 5 deletions
diff --git a/includes/mantainence.php b/includes/maintenance.php index 6e595a1..79466f9 100755 --- a/includes/mantainence.php +++ b/includes/maintenance.php
@@ -8,7 +8,7 @@
8 4::::4 4::::4 8 4::::4 4::::4
9 4::::4 4::::4 Written and maintained by Starla Insigna 9 4::::4 4::::4 Written and maintained by Starla Insigna
104::::444444::::444 104::::444444::::444
114::::::::::::::::4 includes/mantainence.php 114::::::::::::::::4 includes/maintenance.php
124444444444:::::444 124444444444:::::444
13 4::::4 Please do not use, reproduce or steal the 13 4::::4 Please do not use, reproduce or steal the
14 4::::4 contents of this file without explicit 14 4::::4 contents of this file without explicit
@@ -22,14 +22,14 @@ if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22 22
23require('headerproc.php'); 23require('headerproc.php');
24 24
25$getconfig = "SELECT * FROM config WHERE name = \"mantainenceMode\""; 25$getconfig = "SELECT * FROM config WHERE name = \"maintenanceMode\"";
26$getconfig2 = mysql_query($getconfig); 26$getconfig2 = mysql_query($getconfig);
27$getconfig3 = mysql_fetch_array($getconfig2); 27$getconfig3 = mysql_fetch_array($getconfig2);
28if ($getconfig3['value'] == '1') 28if ($getconfig3['value'] == '1')
29{ 29{
30 if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') 30 if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1')
31 { 31 {
32 $template = new FITemplate('mantainence'); 32 $template = new FITemplate('maintenance');
33 $template->display($template); 33 $template->display($template);
34 34
35 exit; 35 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');
25include('../security/config.php'); 25include('../security/config.php');
26include('includes/db.php'); 26include('includes/db.php');
27include('includes/template.php'); 27include('includes/template.php');
28include('includes/mantainence.php'); 28include('includes/maintenance.php');
29include('includes/session.php'); 29include('includes/session.php');
30include('includes/parsers.php'); 30include('includes/parsers.php');
31include('includes/xmlrpc/xmlrpc.inc'); 31include('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())
692 system('hg update'); 692 system('hg update');
693 $template->add('MSG', ob_get_contents()); 693 $template->add('MSG', ob_get_contents());
694 ob_end_clean(); 694 ob_end_clean();
695 } else if ($_GET['page'] == 'maintenanceMode')
696 {
697 if (isset($_GET['submit']))
698 {
699 if ($_POST['mode'] == 'on')
700 {
701 $set = 1;
702 } else if ($_POST['mode'] == 'off')
703 {
704 $set = 0;
705 } else {
706 $template = new FITemplate('msg');
707 $template->add('MSG', 'You seem to have somehow messed up the form. That\'s weird.');
708 $template->add('BACK', 'the Maintenance Mode form');
709 }
710
711 if (isset($set))
712 {
713 $setconfig = "UPDATE config SET value = \"" . $set . "\" WHERE name = \"maintenanceMode\"";
714 $setconfig2 = mysql_query($setconfig);
715
716 $template = new FITemplate('msg');
717 $template->add('MSG', 'Maintenance Mode has successfully been set to "' . $_POST['mode'] . '"');
718 $template->add('BACK', 'the Maintenance Mode form');
719 }
720 } else {
721 $template = new FITemplate('admin/maintenanceMode');
722
723 $getconfig = "SELECT * FROM config WHERE name = \"maintenanceMode\"";
724 $getconfig2 = mysql_query($getconfig);
725 $getconfig3 = mysql_fetch_array($getconfig2);
726 if ($getconfig3['value'] == '1')
727 {
728 $template->add('ON', ' CHECKED="CHECKED"');
729 } else {
730 $template->add('OFF', ' CHECKED="CHECKED"');
731 }
732 }
695 } else { 733 } else {
696 generateError(404); 734 generateError(404);
697 } 735 }
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!<P>
28 28
29<UL> 29<UL>
30 <LI><A HREF="/admin/hgUpdate.php">HG Update</A></LI> 30 <LI><A HREF="/admin/hgUpdate.php">HG Update</A></LI>
31 <LI><A HREF="/admin/maintenanceMode.php">Maintenance Mode</A></LI>
31</UL> 32</UL>
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 @@
1<H2>Maintenance Mode</H2>
2
3<P>Here you can enable/disable Maintenance Mode. When Maintenance Mode is enabled, no one can access Four Island except localhost.</P>
4
5<FORM ACTION="/admin/maintenanceMode.php?submit=" METHOD="POST">
6 <CENTER>
7 <INPUT TYPE="radio" NAME="mode" VALUE="on"<!--ON-->>On</INPUT><BR />
8 <INPUT TYPE="radio" NAME="mode" VALUE="off"<!--OFF-->>Off</INPUT><BR />
9 <INPUT TYPE="submit" />
10 </CENTER>
11</FORM>
12
13<P>
14 <A HREF="/admin/">Back to Admin Panel</A>
15</P>
diff --git a/theme/mantainence.tpl b/theme/maintenance.tpl index dab4ef5..0a50a51 100755 --- a/theme/mantainence.tpl +++ b/theme/maintenance.tpl
@@ -1,4 +1,4 @@
1<CENTER><H1>Four Island is under mantainence</H1></CENTER> 1<CENTER><H1>Four Island is under maintenance</H1></CENTER>
2 2
3<P>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, 3<P>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,
4so Four Island'll be down for a few minutes. Please try again soon and thanks for your interest in Four Island!</P> 4so Four Island'll be down for a few minutes. Please try again soon and thanks for your interest in Four Island!</P>