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-08-18 08:25:02 +00:00
|
|
|
|
|
|
|
if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
|
|
|
|
|
2006-08-19 02:21:44 +00:00
|
|
|
if (isset($USER->preference['admin_bookmarks'])) {
|
2006-08-18 08:25:02 +00:00
|
|
|
|
|
|
|
$bookmarks = explode(',', $USER->preference['admin_bookmarks']);
|
|
|
|
|
|
|
|
$key = array_search($section, $bookmarks);
|
|
|
|
|
|
|
|
if ($key === false) {
|
2006-09-06 02:23:23 +00:00
|
|
|
error(get_string('nonexistentbookmark','admin'));
|
2006-08-18 08:25:02 +00:00
|
|
|
die;
|
|
|
|
}
|
|
|
|
|
|
|
|
unset($bookmarks[$key]);
|
|
|
|
$bookmarks = implode(',',$bookmarks);
|
|
|
|
set_user_preference('admin_bookmarks', $bookmarks);
|
|
|
|
|
2006-09-02 13:14:57 +00:00
|
|
|
$temp = $adminroot->locate($section);
|
2006-08-18 08:25:02 +00:00
|
|
|
|
2006-08-19 01:40:54 +00:00
|
|
|
if (is_a($temp, 'admin_externalpage')) {
|
2006-09-06 02:23:23 +00:00
|
|
|
redirect($temp->url, get_string('bookmarkdeleted','admin'),1);
|
2006-08-19 01:40:54 +00:00
|
|
|
} elseif (is_a($temp, 'admin_settingpage')) {
|
2006-08-21 04:08:57 +00:00
|
|
|
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section, 'Bookmark deleted.',1);
|
2006-08-18 08:25:02 +00:00
|
|
|
} else {
|
2006-09-06 02:23:23 +00:00
|
|
|
redirect($CFG->wwwroot, get_string('bookmarkdeleted', 'admin'),1);
|
2006-08-18 08:25:02 +00:00
|
|
|
}
|
|
|
|
die;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-09-06 02:23:23 +00:00
|
|
|
error(get_string('nobookmarksforuser','admin'));
|
2006-08-18 08:25:02 +00:00
|
|
|
die;
|
|
|
|
|
|
|
|
} else {
|
2006-09-06 02:23:23 +00:00
|
|
|
error(get_string('invalidsection', 'admin'));
|
2006-08-18 08:25:02 +00:00
|
|
|
die;
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|