libdir.'/adminlib.php'); $action = optional_param('action', '', PARAM_ALPHA); admin_externalpage_setup('maintenancemode'); //Check folder exists if (! make_upload_directory(SITEID)) { // Site folder error("Could not create site folder. The site administrator needs to fix the file permissions"); } $filename = $CFG->dataroot.'/'.SITEID.'/maintenance.html'; if ($form = data_submitted()) { if (confirm_sesskey()) { if ($form->action == "disable") { unlink($filename); redirect('maintenance.php', get_string('sitemaintenanceoff','admin')); } else { $file = fopen($filename, 'w'); fwrite($file, stripslashes($form->text)); fclose($file); redirect('maintenance.php', get_string('sitemaintenanceon', 'admin')); } } } /// Print the header stuff admin_externalpage_print_header(); print_heading(get_string('sitemaintenancemode', 'admin')); print_box_start(); /// Print the appropriate form if (file_exists($filename)) { // We are in maintenance mode echo '
'; echo '

'.get_string('sitemaintenanceon', 'admin').'

'; echo '
'; echo '
'; echo ''; echo ''; echo '

'; echo '
'; echo '
'; echo '
'; } else { // We are not in maintenance mode $usehtmleditor = can_use_html_editor(); echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '

'; echo '

'.get_string('optionalmaintenancemessage', 'admin').':

'; echo '
'; // contains the editor print_textarea($usehtmleditor, 20, 50, 600, 400, "text"); echo '
'; echo '
'; echo '
'; echo '
'; if ($usehtmleditor) { use_html_editor(); } } print_box_end(); admin_externalpage_print_footer(); ?>