2006-08-18 08:25:02 +00:00
|
|
|
<?php // $Id$
|
|
|
|
|
|
|
|
require('../../config.php');
|
|
|
|
|
2006-09-02 13:14:57 +00:00
|
|
|
require_once($CFG->libdir.'/adminlib.php');
|
2006-09-26 09:25:37 +00:00
|
|
|
require_login();
|
2007-12-19 17:35:20 +00:00
|
|
|
$adminroot =& admin_get_root(false, false); // settings not required - only pages
|
2006-08-18 08:25:02 +00:00
|
|
|
|
2007-12-19 17:35:20 +00:00
|
|
|
if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey()) {
|
2006-08-18 08:25:02 +00:00
|
|
|
|
2007-03-06 10:45:49 +00:00
|
|
|
if (get_user_preferences('admin_bookmarks')) {
|
2007-12-19 17:35:20 +00:00
|
|
|
$bookmarks = explode(',', get_user_preferences('admin_bookmarks'));
|
2006-09-26 09:25:37 +00:00
|
|
|
|
2006-08-18 08:25:02 +00:00
|
|
|
if (in_array($section, $bookmarks)) {
|
2008-06-25 17:31:23 +00:00
|
|
|
print_error('bookmarkalreadyexists','admin');
|
2006-09-20 20:31:09 +00:00
|
|
|
die;
|
|
|
|
}
|
2006-09-26 09:25:37 +00:00
|
|
|
|
2006-09-20 20:31:09 +00:00
|
|
|
} else {
|
|
|
|
$bookmarks = array();
|
|
|
|
}
|
2006-08-18 08:25:02 +00:00
|
|
|
|
2006-09-02 13:14:57 +00:00
|
|
|
$temp = $adminroot->locate($section);
|
2006-09-26 09:25:37 +00:00
|
|
|
|
2006-08-19 01:40:54 +00:00
|
|
|
if (is_a($temp, 'admin_settingpage') || is_a($temp, 'admin_externalpage')) {
|
2006-08-18 08:25:02 +00:00
|
|
|
$bookmarks[] = $section;
|
2007-12-19 17:35:20 +00:00
|
|
|
$bookmarks = implode(',', $bookmarks);
|
2006-09-20 20:31:09 +00:00
|
|
|
set_user_preference('admin_bookmarks', $bookmarks);
|
2006-09-26 09:25:37 +00:00
|
|
|
|
2006-08-18 08:25:02 +00:00
|
|
|
} else {
|
2008-06-25 17:31:23 +00:00
|
|
|
print_error('invalidsection','admin');
|
2006-08-18 08:25:02 +00:00
|
|
|
die;
|
|
|
|
}
|
2006-09-26 09:25:37 +00:00
|
|
|
|
2006-09-20 20:31:09 +00:00
|
|
|
if (is_a($temp, 'admin_settingpage')) {
|
2007-03-06 10:45:49 +00:00
|
|
|
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section);
|
2006-09-26 09:25:37 +00:00
|
|
|
|
2006-08-19 01:40:54 +00:00
|
|
|
} elseif (is_a($temp, 'admin_externalpage')) {
|
2007-03-06 10:45:49 +00:00
|
|
|
redirect($temp->url);
|
2006-08-18 08:25:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
2008-06-25 17:31:23 +00:00
|
|
|
print_error('invalidsection','admin');
|
2006-09-06 02:23:23 +00:00
|
|
|
die;
|
2006-08-18 08:25:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|