| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Summary view] [Print] [Text view]
1 <?php // $Id: maintenance.php,v 1.12 2007/04/30 17:08:44 skodak Exp $ 2 // Enables/disables maintenance mode 3 4 require ('../config.php'); 5 require_once($CFG->libdir.'/adminlib.php'); 6 7 $action = optional_param('action', '', PARAM_ALPHA); 8 9 admin_externalpage_setup('maintenancemode'); 10 11 //Check folder exists 12 if (! make_upload_directory(SITEID)) { // Site folder 13 error("Could not create site folder. The site administrator needs to fix the file permissions"); 14 } 15 16 $filename = $CFG->dataroot.'/'.SITEID.'/maintenance.html'; 17 18 if ($form = data_submitted()) { 19 if (confirm_sesskey()) { 20 if ($form->action == "disable") { 21 unlink($filename); 22 redirect('maintenance.php', get_string('sitemaintenanceoff','admin')); 23 } else { 24 $file = fopen($filename, 'w'); 25 fwrite($file, stripslashes($form->text)); 26 fclose($file); 27 redirect('maintenance.php', get_string('sitemaintenanceon', 'admin')); 28 } 29 } 30 } 31 32 /// Print the header stuff 33 34 admin_externalpage_print_header(); 35 36 /// Print the appropriate form 37 38 if (file_exists($filename)) { // We are in maintenance mode 39 echo '<div style="margin-left:auto;margin-right:auto">'; 40 echo '<form action="maintenance.php" method="post">'; 41 echo '<input type="hidden" name="action" value="disable" />'; 42 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'; 43 echo '<p><input type="submit" value="'.get_string('disable').'" /></p>'; 44 echo '</form>'; 45 echo '</div>'; 46 } else { // We are not in maintenance mode 47 $usehtmleditor = can_use_html_editor(); 48 49 echo '<div style="text-align:center;margin-left:auto;margin-right:auto">'; 50 echo '<form action="maintenance.php" method="post">'; 51 echo '<div>'; 52 echo '<input type="hidden" name="action" value="enable" />'; 53 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'; 54 echo '<p><input type="submit" value="'.get_string('enable').'" /></p>'; 55 echo '<p>'.get_string('optionalmaintenancemessage', 'admin').':</p>'; 56 echo '<table><tr><td>'; 57 print_textarea($usehtmleditor, 20, 50, 600, 400, "text"); 58 echo '</td></tr></table>'; 59 echo '</div>'; 60 echo '</form>'; 61 echo '</div>'; 62 63 if ($usehtmleditor) { 64 use_html_editor(); 65 } 66 } 67 68 admin_externalpage_print_footer(); 69 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |