3 require('../../config.php');
5 require_once($CFG->libdir
.'/adminlib.php');
7 $adminroot =& admin_get_root(false, false); // settings not required - only pages
9 if ($section = optional_param('section', '', PARAM_SAFEDIR
) and confirm_sesskey()) {
11 if (get_user_preferences('admin_bookmarks')) {
12 $bookmarks = explode(',', get_user_preferences('admin_bookmarks'));
14 if (in_array($section, $bookmarks)) {
15 print_error('bookmarkalreadyexists','admin');
23 $temp = $adminroot->locate($section);
25 if (is_a($temp, 'admin_settingpage') ||
is_a($temp, 'admin_externalpage')) {
26 $bookmarks[] = $section;
27 $bookmarks = implode(',', $bookmarks);
28 set_user_preference('admin_bookmarks', $bookmarks);
31 print_error('invalidsection','admin');
35 if (is_a($temp, 'admin_settingpage')) {
36 redirect($CFG->wwwroot
. '/' . $CFG->admin
. '/settings.php?section=' . $section);
38 } elseif (is_a($temp, 'admin_externalpage')) {
43 print_error('invalidsection','admin');