3 // detects settings that were added during an upgrade, displays a screen for the admin to
4 // modify them, and then processes modifications
6 require_once('../config.php');
7 require_once($CFG->libdir
.'/adminlib.php');
9 $return = optional_param('return', '', PARAM_ALPHA
);
11 /// no guest autologin
12 require_login(0, false);
14 $adminroot =& admin_get_root(); // need all settings
15 admin_externalpage_setup('upgradesettings'); // now hidden page
17 // now we'll deal with the case that the admin has submitted the form with new settings
18 if ($data = data_submitted() and confirm_sesskey()) {
19 $count = admin_write_settings($data);
20 $adminroot =& admin_get_root(true); //reload tree
23 $newsettingshtml = admin_output_new_settings_by_page($adminroot);
26 if (empty($adminroot->errors
) and $newsettingshtml === '') {
27 // there must be either redirect without message or continue button or else upgrade would be sometimes broken
28 if ($return == 'site') {
29 redirect("$CFG->wwwroot/");
31 redirect("$CFG->wwwroot/$CFG->admin/index.php");
35 if (!empty($adminroot->errors
)) {
36 $firsterror = reset($adminroot->errors
);
37 $focus = $firsterror->id
;
40 // and finally, if we get here, then there are new settings and we have to print a form
42 admin_externalpage_print_header($focus);
44 print_box(get_string('upgradesettingsintro','admin'), 'generalbox');
46 echo '<form action="upgradesettings.php" method="post" id="adminsettings">';
48 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
49 echo '<input type="hidden" name="return" value="'.$return.'" />';
51 echo '<div class="clearer"><!-- --></div>';
52 echo $newsettingshtml;
54 echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges','admin').'" /></div>';
58 if (!empty($CFG->adminusehtmleditor
)) {