3 require('../../config.php');
5 require_once($CFG->libdir
.'/adminlib.php');
6 $adminroot = admin_get_root();
9 if ($section = optional_param('section', '', PARAM_ALPHAEXT
) and confirm_sesskey()) {
11 if (get_user_preferences('admin_bookmarks')) {
13 $bookmarks = explode(',', get_user_preferences('admin_bookmarks'));
15 $key = array_search($section, $bookmarks);
18 error(get_string('nonexistentbookmark','admin'));
22 unset($bookmarks[$key]);
23 $bookmarks = implode(',',$bookmarks);
24 set_user_preference('admin_bookmarks', $bookmarks);
26 $temp = $adminroot->locate($section);
28 if (is_a($temp, 'admin_externalpage')) {
29 redirect($temp->url
, get_string('bookmarkdeleted','admin'));
30 } elseif (is_a($temp, 'admin_settingpage')) {
31 redirect($CFG->wwwroot
. '/' . $CFG->admin
. '/settings.php?section=' . $section);
33 redirect($CFG->wwwroot
);
40 error(get_string('nobookmarksforuser','admin'));
44 error(get_string('invalidsection', 'admin'));