<?php
#######################################################|#
#|                    HabboMCMS - TheRox
#|                    Powered by HoloCMS 
#|            Copyright 2011-2012 ALL RIGHTS RESERVED
#######################################################|#



require_once('../global.php');
if($hkzone !== true){ header("Location: index.php?throwBack=true"); exit; }
if(!session_is_registered(acp)){ header("Location: index.php?p=login"); exit; }

$pagename = "Maintenance";

if(isset($_POST['site_closed'])){

	$site_closed = Filter($_POST['site_closed']);

	mysql_query("UPDATE site_config SET maintenance = '".$site_closed."' LIMIT 1") or die(mysql_error());
	$msg = "<div class=\"alert success\">La modification à bien été prise en compte</div>";

	mysql_query("INSERT INTO system_stafflog (action,message,note,userid,targetid,timestamp) VALUES ('Administration','Updated CMS Settings (Turn your site on/off)','maintenance.php','".$my_id."','','".$date_full."')") or die(mysql_error());

}

if(isset($_POST['client_closed'])){

	$client_closed = Filter($_POST['client_closed']);

	mysql_query("UPDATE site_content SET contentvalue = '".$client_closed."' WHERE contentkey = 'hotel-enabled' LIMIT 1") or die(mysql_error());
	$msg = "<div class=\"alert success\">La modification à bien été prise en compte</div>";

	mysql_query("INSERT INTO system_stafflog (action,message,note,userid,targetid,timestamp) VALUES ('Administration','Updated CMS Settings (Turn your site on/off)','maintenance.php','".$my_id."','','".$date_full."')") or die(mysql_error());

}

if(isset($_POST['forum_closed'])){

	$forum_closed = Filter($_POST['forum_closed']);

	mysql_query("UPDATE site_content SET contentvalue = '".$forum_closed."' WHERE contentkey = 'forum-enabled' LIMIT 1") or die(mysql_error());
	$msg = "<div class=\"alert success\">La modification à bien été prise en compte</div>";

	mysql_query("INSERT INTO system_stafflog (action,message,note,userid,targetid,timestamp) VALUES ('Administration','Updated CMS Settings (Turn your site on/off)','maintenance.php','".$my_id."','','".$date_full."')") or die(mysql_error());

}

if(isset($_POST['clans_closed'])){

	$clans_closed = Filter($_POST['clans_closed']);

	mysql_query("UPDATE site_content SET contentvalue = '".$clans_closed."' WHERE contentkey = 'allow-group-purchase' LIMIT 1") or die(mysql_error());
	$msg = "<div class=\"alert success\">La modification à bien été prise en compte</div>";

	mysql_query("INSERT INTO system_stafflog (action,message,note,userid,targetid,timestamp) VALUES ('Administration','Updated CMS Settings (Turn your site on/off)','maintenance.php','".$my_id."','','".$date_full."')") or die(mysql_error());

}

require_once('subheader.php');
require_once('header.php');
?>
<table cellpadding='0' cellspacing='8' width='100%' id='tablewrap'>
<tr> <td width='22%' valign='top' id='leftblock'>
 <div>
 <!-- LEFT CONTEXT SENSITIVE MENU -->
<?php require_once('sitemenu.php'); ?>
 <!-- / LEFT CONTEXT SENSITIVE MENU -->
 </div>
 </td>
 <td width='78%' valign='top' id='rightblock'>
 <div><!-- RIGHT CONTENT BLOCK -->
 
 
<form action='index.php?p=maintenance&do=save' method='post' name='theAdminForm' id='theAdminForm'>
<div class='tableborder'>
<div class='tableheaderalt'>Gestion des services</div>

<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Mettre en maintenance le site</b><div class='graytext'>Une fois le site en maintenance, il ne sera accéssible que par l'administration de l'hotel.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><select name='site_closed'  class='dropdown'>
									<option value='1'>Maintenance</option>
									<option value='0' <?php if($config['maintenance'] == "0"){ echo "selected='selected'"; } ?>>Disponible</option>
								    </select>
</td>
</tr>

<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Mettre en maintenance le client</b><div class='graytext'>Une fois le client en maintenance, il sera donc impossible d'accès pour les Habbos. Le site est quand à lui toujours visible.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><select  name='client_closed'  class='dropdown'>
									<option value='1'>Maintenance</option>
									<option value='0' <?php if(getContent('hotel-enabled') == "0"){ echo "selected='selected'"; } ?>>Disponible</option>
								    </select>
</td>
</tr>


<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Forum de discussion</b><div class='graytext'>En cas de publicité non autorisé, il est préférable de désactivé le forum pour évité un coup de publicité important.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><select name='forum_closed'  class='dropdown'>
									<option value='1'>Désactiver</option>
									<option value='0' <?php if(getContent('forum-enabled') == "0"){ echo "selected='selected'"; } ?>>Activer</option>
								    </select>
</td>
</tr>

<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Achat de clans</b><div class='graytext'>En cas de mises à jour dans les clans, il est préférable de désactiver les achats de clans, par mesure de sécurité.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><select name='clans_closed'  class='dropdown'>
									<option value='1'>Désactiver</option>
									<option value='0' <?php if(getContent('allow-group-purchase') == "0"){ echo "selected='selected'"; } ?>>Activer</option>
								    </select>
</td>
</tr>

<tr>
<tr><td align='center' class='tablesubheader' colspan='2' ><input type='submit' value='Appliquer' class='realbutton' accesskey='s'></td></tr>
</form></table></div><br />	 </div><!-- / RIGHT CONTENT BLOCK -->
	 </td></tr>
</table>
</div><!-- / OUTERDIV -->
<div align='center'><br />
<?php
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
printf('Time: %.3f', $totaltime);
?>
</div>