libdir.'/adminlib.php'); $action = optional_param('action', '', PARAM_ALPHA); $adminroot = admin_get_root(); admin_externalpage_setup('maintenancemode', $adminroot); //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($adminroot); /// Print the appropriate form if (file_exists($filename)) { // We are in maintenance mode echo '