That above code was quickly concocted. Here is a better version
`
<?php
/* Places site "under construction"
*
* @package plugins
*/
$plugin_is_filter = 5;
$plugin_description = gettext('Provides an overview button to place site "Under Construction" allowing for orderly upgrades to the site.');
$plugin_author = "Stephen Billard (sbillard)";
function under_construction_button($buttons) {
if (isset($_GET['construction'])) {
XSRFdefender('construction');
if ($_GET['construction']=='under') {
setOption('under_construction_blocked',1);
} else {
setOption('under_construction_blocked',0);
}
}
if (getOption('under_construction_blocked')) {
$buttons[] = array(
'enable'=>true,
'button_text'=>gettext('Under Construction'),
'formname'=>'under_construction_button',
'action'=>'?construction=done',
'icon'=>'images/lock_open.png',
'title'=>gettext('Set site to normal'),
'alt'=>'',
'hidden'=> '<input type="hidden" name="construction" value="done" />',
'rights'=> ADMIN_RIGHTS,
'XSRFTag' => 'construction'
);
} else {
$buttons[] = array(
'enable'=>true,
'button_text'=>gettext('Under Construction'),
'formname'=>'under_construction_button',
'action'=>'?construction=under',
'icon'=>'images/lock_2.png',
'title'=>gettext('Set site to Under Construction'),
'alt'=>'',
'hidden'=> '<input type="hidden" name="construction" value="under" />',
'rights'=> ADMIN_RIGHTS,
'XSRFTag' => 'construction'
);
}
return $buttons;
}
function under_construction_blocker($file) {
if (!zp_loggedin(ADMIN_RIGHTS) && getOption('under_construction_blocked')) {
header("Location: " . FULLWEBPATH . "/" . USER_PLUGIN_FOLDER . "/under_construction/upgrading.htm");
exit();
}
return($file);
}
zp_register_filter('admin_utilities_buttons', 'under_construction_button');
zp_register_filter('load_theme_script', 'under_construction_blocker');
?>
`