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');
|
|
|
|
$adminroot = admin_get_root();
|
2006-09-26 09:25:37 +00:00
|
|
|
require_login();
|
2006-08-18 08:25:02 +00:00
|
|
|
|
2006-09-26 09:25:37 +00:00
|
|
|
if ($section = optional_param('section', '', PARAM_ALPHAEXT) 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')) {
|
2006-08-18 08:25:02 +00:00
|
|
|
|
2007-03-06 10:45:49 +00:00
|
|
|
$bookmarks = explode(',', get_user_preferences('admin_bookmarks'));
|
2006-08-18 08:25:02 +00:00
|
|
|
|
|
|
|
$key = array_search($section, $bookmarks);
|
|
|
|
|
|
|
|
if ($key === false) {
|
2006-09-06 02:23:23 +00:00
|
|
|
error(get_string('nonexistentbookmark','admin'));
|
2006-09-20 20:31:09 +00:00
|
|
|
die;
|
|
|
|
}
|
2006-08-18 08:25:02 +00:00
|
|
|
|
2006-09-20 20:31:09 +00:00
|
|
|
unset($bookmarks[$key]);
|
|
|
|
$bookmarks = implode(',',$bookmarks);
|
2006-08-18 08:25:02 +00:00
|
|
|
set_user_preference('admin_bookmarks', $bookmarks);
|
2006-09-26 09:25:37 +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_externalpage')) {
|
2006-09-26 09:25:37 +00:00
|
|
|
redirect($temp->url, get_string('bookmarkdeleted','admin'));
|
2006-08-19 01:40:54 +00:00
|
|
|
} elseif (is_a($temp, 'admin_settingpage')) {
|
2007-03-06 10:45:49 +00:00
|
|
|
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section);
|
2006-08-18 08:25:02 +00:00
|
|
|
} else {
|
2007-03-06 10:45:49 +00:00
|
|
|
redirect($CFG->wwwroot);
|
2006-08-18 08:25:02 +00:00
|
|
|
}
|
2006-09-20 20:31:09 +00:00
|
|
|
die;
|
2006-08-18 08:25:02 +00:00
|
|
|
|
|
|
|
|
2006-09-20 20:31:09 +00:00
|
|
|
}
|
2006-09-26 09:25:37 +00:00
|
|
|
|
2006-09-06 02:23:23 +00:00
|
|
|
error(get_string('nobookmarksforuser','admin'));
|
2006-09-20 20:31:09 +00:00
|
|
|
die;
|
2006-08-18 08:25:02 +00:00
|
|
|
|
|
|
|
} else {
|
2006-09-06 02:23:23 +00:00
|
|
|
error(get_string('invalidsection', 'admin'));
|
2006-09-20 20:31:09 +00:00
|
|
|
die;
|
2006-08-18 08:25:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|