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')) {
12 $bookmarks = explode(',',get_user_preferences('admin_bookmarks'));
14 if (in_array($section, $bookmarks)) {
15 error(get_string('bookmarkalreadyexists','admin'));
23 $temp = $adminroot->locate($section);
25 if (is_a($temp, 'admin_settingpage') ||
is_a($temp, 'admin_externalpage')) {
27 $bookmarks[] = $section;
29 $bookmarks = implode(',',$bookmarks);
31 set_user_preference('admin_bookmarks', $bookmarks);
35 error(get_string('invaludsection','admin'));
40 if (is_a($temp, 'admin_settingpage')) {
42 redirect($CFG->wwwroot
. '/' . $CFG->admin
. '/settings.php?section=' . $section);
44 } elseif (is_a($temp, 'admin_externalpage')) {
51 error(get_string('invalidsection','admin'));