3 require('../../config.php');
5 require_once($CFG->libdir
.'/adminlib.php');
8 $adminroot =& admin_get_root(false, false); // settings not required - only pages
10 if ($section = optional_param('section', '', PARAM_SAFEDIR
) and confirm_sesskey()) {
12 if (get_user_preferences('admin_bookmarks')) {
14 $bookmarks = explode(',', get_user_preferences('admin_bookmarks'));
16 $key = array_search($section, $bookmarks);
19 print_error('nonexistentbookmark','admin');
23 unset($bookmarks[$key]);
24 $bookmarks = implode(',', $bookmarks);
25 set_user_preference('admin_bookmarks', $bookmarks);
27 $temp = $adminroot->locate($section);
29 if (is_a($temp, 'admin_externalpage')) {
30 redirect($temp->url
, get_string('bookmarkdeleted','admin'));
31 } elseif (is_a($temp, 'admin_settingpage')) {
32 redirect($CFG->wwwroot
. '/' . $CFG->admin
. '/settings.php?section=' . $section);
34 redirect($CFG->wwwroot
);
41 print_error('nobookmarksforuser','admin');
45 print_error('invalidsection', 'admin');