48 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-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) {
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
$temp = $adminroot->locate($section);
2006-09-26 09:25:37 +00:00
if (is_a($temp, 'admin_externalpage')) {
2006-09-26 09:25:37 +00:00
redirect($temp->url, get_string('bookmarkdeleted','admin'));
} 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
error(get_string('nobookmarksforuser','admin'));
2006-09-20 20:31:09 +00:00
die;
2006-08-18 08:25:02 +00:00
} else {
error(get_string('invalidsection', 'admin'));
2006-09-20 20:31:09 +00:00
die;
2006-08-18 08:25:02 +00:00
}
?>