Index: trunk/admin/configuration.php
===================================================================
--- trunk/admin/configuration.php	(revision 12956)
+++ trunk/admin/configuration.php	(revision 13001)
@@ -47,5 +47,4 @@
 
 $main_checkboxes = array(
-    'gallery_locked',
     'allow_user_registration',
     'obligatory_user_mail_address',
@@ -173,14 +172,4 @@
       }
       
-      if (empty($_POST['gallery_locked']) and $conf['gallery_locked'])
-      {
-        $tpl_var = & $template->get_template_vars('header_msgs');
-        $msg_key = array_search(l10n('The gallery is locked for maintenance. Please, come back later.'), $tpl_var);
-        unset($tpl_var[$msg_key]);
-      }
-      elseif (!empty($_POST['gallery_locked']) and !$conf['gallery_locked'])
-      {
-        $template->append('header_msgs', l10n('The gallery is locked for maintenance. Please, come back later.'));
-      }
       foreach( $main_checkboxes as $checkbox)
       {
Index: trunk/admin/maintenance.php
===================================================================
--- trunk/admin/maintenance.php	(revision 12956)
+++ trunk/admin/maintenance.php	(revision 13001)
@@ -48,4 +48,17 @@
 switch ($action)
 {
+  case 'lock_gallery' :
+  {
+    conf_update_param('gallery_locked', 'true');
+    redirect(get_root_url().'admin.php?page=maintenance');
+    break;
+  }
+  case 'unlock_gallery' :
+  {
+    conf_update_param('gallery_locked', 'false');
+    $_SESSION['page_infos'] = array(l10n('Gallery unlocked'));
+    redirect(get_root_url().'admin.php?page=maintenance');
+    break;
+  }
   case 'categories' :
   {
@@ -165,4 +178,21 @@
   );
 
+if ($conf['gallery_locked'])
+{
+  $template->assign(
+    array(
+      'U_MAINT_UNLOCK_GALLERY' => sprintf($url_format, 'unlock_gallery'),
+      )
+    );
+}
+else
+{
+  $template->assign(
+    array(
+      'U_MAINT_LOCK_GALLERY' => sprintf($url_format, 'lock_gallery'),
+      )
+    );
+}
+
 // +-----------------------------------------------------------------------+
 // | Define advanced features                                              |
Index: trunk/admin/themes/default/template/configuration.tpl
===================================================================
--- trunk/admin/themes/default/template/configuration.tpl	(revision 12956)
+++ trunk/admin/themes/default/template/configuration.tpl	(revision 13001)
@@ -33,11 +33,4 @@
   <legend></legend>
   <ul>
-    <li>
-      <label>
-        <span class="property">{'Lock gallery'|@translate}</span>
-        <input type="checkbox" name="gallery_locked" {if ($main.gallery_locked)}checked="checked"{/if}>
-      </label>
-    </li>
-
     <li>
       <label>
Index: trunk/admin/themes/default/template/maintenance.tpl
===================================================================
--- trunk/admin/themes/default/template/maintenance.tpl	(revision 12956)
+++ trunk/admin/themes/default/template/maintenance.tpl	(revision 13001)
@@ -4,11 +4,15 @@
 
 <ul>
+{if (isset($U_MAINT_LOCK_GALLERY))}
+  <li><a href="{$U_MAINT_LOCK_GALLERY}" onclick="return confirm('{'A locked gallery is only visible to administrators'|@translate|@escape:'javascript'}');">{'Lock gallery'|@translate}</a></li>
+{else}
+  <li><a href="{$U_MAINT_UNLOCK_GALLERY}">{'Unlock gallery'|@translate}</a></li>
+{/if}
+</ul>
+
+<ul>
   {foreach from=$advanced_features item=feature}
     <li><a href="{$feature.URL}">{$feature.CAPTION}</a></li>
   {/foreach}
-</ul>
-
-<ul>
-	<li><a href="{$U_MAINT_ORPHAN_TAGS}">{'Delete orphan tags'|@translate}</a></li>
 </ul>
 
@@ -24,4 +28,5 @@
 
 <ul>
+	<li><a href="{$U_MAINT_ORPHAN_TAGS}">{'Delete orphan tags'|@translate}</a></li>
 	<li><a href="{$U_MAINT_HISTORY_DETAIL}" onclick="return confirm('{'Purge history detail'|@translate|@escape:'javascript'}');">{'Purge history detail'|@translate}</a></li>
 	<li><a href="{$U_MAINT_HISTORY_SUMMARY}" onclick="return confirm('{'Purge history summary'|@translate|@escape:'javascript'}');">{'Purge history summary'|@translate}</a></li>
