47 lines
1.2 KiB
PHP
Raw Normal View History

2006-08-18 08:25:02 +00:00
<?php // $Id$
require('../../config.php');
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)) {
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) {
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);
$temp = $adminroot->locate($section);
2006-08-18 08:25:02 +00:00
if (is_a($temp, 'admin_externalpage')) {
redirect($temp->url, get_string('bookmarkdeleted','admin'),1);
} elseif (is_a($temp, 'admin_settingpage')) {
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section, 'Bookmark deleted.',1);
2006-08-18 08:25:02 +00:00
} else {
redirect($CFG->wwwroot, get_string('bookmarkdeleted', 'admin'),1);
2006-08-18 08:25:02 +00:00
}
die;
}
error(get_string('nobookmarksforuser','admin'));
2006-08-18 08:25:02 +00:00
die;
} else {
error(get_string('invalidsection', 'admin'));
2006-08-18 08:25:02 +00:00
die;
}
?>