[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 // searches for admin settings 4 5 require_once('../config.php'); 6 require_once($CFG->libdir.'/adminlib.php'); 7 8 $query = trim(optional_param('query', '', PARAM_NOTAGS)); // Search string 9 10 $PAGE->set_context(context_system::instance()); 11 12 admin_externalpage_setup('search', '', array('query' => $query)); // now hidden page 13 14 $adminroot = admin_get_root(); // need all settings here 15 $adminroot->search = $query; // So we can reference it in search boxes later in this invocation 16 $statusmsg = ''; 17 $errormsg = ''; 18 $focus = ''; 19 20 // now we'll deal with the case that the admin has submitted the form with changed settings 21 if ($data = data_submitted() and confirm_sesskey()) { 22 if (admin_write_settings($data)) { 23 redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS); 24 } 25 26 if (!empty($adminroot->errors)) { 27 $errormsg = get_string('errorwithsettings', 'admin'); 28 $firsterror = reset($adminroot->errors); 29 $focus = $firsterror->id; 30 } else { 31 redirect($PAGE->url); 32 } 33 } 34 35 // and finally, if we get here, then there are matching settings and we have to print a form 36 // to modify them 37 echo $OUTPUT->header($focus); 38 39 if ($errormsg !== '') { 40 echo $OUTPUT->notification($errormsg); 41 42 } else if ($statusmsg !== '') { 43 echo $OUTPUT->notification($statusmsg, 'notifysuccess'); 44 } 45 46 $resultshtml = admin_search_settings_html($query); // case insensitive search only 47 48 echo '<form action="' . $PAGE->url->out(true) . '" method="post" id="adminsettings">'; 49 echo '<div>'; 50 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'; 51 // HACK to prevent browsers from automatically inserting the user's password into the wrong fields. 52 echo prevent_form_autofill_password(); 53 echo '</div>'; 54 echo '<fieldset>'; 55 echo '<div class="clearer"><!-- --></div>'; 56 if ($resultshtml != '') { 57 echo $resultshtml; 58 } else { 59 echo get_string('noresults','admin'); 60 } 61 echo '</fieldset>'; 62 echo '</form>'; 63 64 echo $OUTPUT->footer(); 65 66
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |