mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
admin bookmark cleanup
This commit is contained in:
parent
a3d23679e6
commit
62f62bf984
3 changed files with 34 additions and 32 deletions
|
@ -4,8 +4,9 @@ require('../../config.php');
|
|||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
$adminroot = admin_get_root();
|
||||
require_login();
|
||||
|
||||
if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
|
||||
if ($section = optional_param('section', '', PARAM_ALPHAEXT) and confirm_sesskey()) {
|
||||
|
||||
if (isset($USER->preference['admin_bookmarks'])) {
|
||||
|
||||
|
@ -21,13 +22,13 @@ if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
|
|||
unset($bookmarks[$key]);
|
||||
$bookmarks = implode(',',$bookmarks);
|
||||
set_user_preference('admin_bookmarks', $bookmarks);
|
||||
|
||||
|
||||
$temp = $adminroot->locate($section);
|
||||
|
||||
|
||||
if (is_a($temp, 'admin_externalpage')) {
|
||||
redirect($temp->url, get_string('bookmarkdeleted','admin'),1);
|
||||
redirect($temp->url, get_string('bookmarkdeleted','admin'));
|
||||
} elseif (is_a($temp, 'admin_settingpage')) {
|
||||
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section, 'Bookmark deleted.',1);
|
||||
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section, get_string('bookmarkdeleted','admin'), 1);
|
||||
} else {
|
||||
redirect($CFG->wwwroot, get_string('bookmarkdeleted', 'admin'),1);
|
||||
}
|
||||
|
@ -35,7 +36,7 @@ if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
error(get_string('nobookmarksforuser','admin'));
|
||||
die;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue