mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
admin bookmark cleanup
This commit is contained in:
parent
a3d23679e6
commit
62f62bf984
3 changed files with 34 additions and 32 deletions
|
@ -58,9 +58,9 @@ class block_admin_bookmarks extends block_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($section = (isset($PAGE->section) ? $PAGE->section : '')) && (in_array($section, $bookmarks))) {
|
if (($section = (isset($PAGE->section) ? $PAGE->section : '')) && (in_array($section, $bookmarks))) {
|
||||||
$this->content->footer = '<a href="' . $CFG->wwwroot . '/blocks/admin_bookmarks/delete.php?section=' . $section . '&returnurl=' . $CFG->wwwroot . '">' . get_string('unbookmarkthispage','admin') . '</a>';
|
$this->content->footer = '<a href="' . $CFG->wwwroot . '/blocks/admin_bookmarks/delete.php?section=' . $section . '&sesskey='.sesskey().'">' . get_string('unbookmarkthispage','admin') . '</a>';
|
||||||
} elseif ($section = (isset($PAGE->section) ? $PAGE->section : '')) {
|
} elseif ($section = (isset($PAGE->section) ? $PAGE->section : '')) {
|
||||||
$this->content->footer = '<a href="' . $CFG->wwwroot . '/blocks/admin_bookmarks/create.php?section=' . $section . '">' . get_string('bookmarkthispage','admin') . '</a>';
|
$this->content->footer = '<a href="' . $CFG->wwwroot . '/blocks/admin_bookmarks/create.php?section=' . $section . '&sesskey='.sesskey().'">' . get_string('bookmarkthispage','admin') . '</a>';
|
||||||
} else {
|
} else {
|
||||||
$this->content->footer = '';
|
$this->content->footer = '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,9 @@ require('../../config.php');
|
||||||
|
|
||||||
require_once($CFG->libdir.'/adminlib.php');
|
require_once($CFG->libdir.'/adminlib.php');
|
||||||
$adminroot = admin_get_root();
|
$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'])) {
|
if (isset($USER->preference['admin_bookmarks'])) {
|
||||||
$bookmarks = explode(',',$USER->preference['admin_bookmarks']);
|
$bookmarks = explode(',',$USER->preference['admin_bookmarks']);
|
||||||
|
@ -38,7 +39,7 @@ if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
|
||||||
|
|
||||||
if (is_a($temp, 'admin_settingpage')) {
|
if (is_a($temp, 'admin_settingpage')) {
|
||||||
|
|
||||||
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section, 'Bookmark added.',1);
|
redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section, get_string('bookmarkadded','admin'), 1);
|
||||||
|
|
||||||
} elseif (is_a($temp, 'admin_externalpage')) {
|
} elseif (is_a($temp, 'admin_externalpage')) {
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,9 @@ require('../../config.php');
|
||||||
|
|
||||||
require_once($CFG->libdir.'/adminlib.php');
|
require_once($CFG->libdir.'/adminlib.php');
|
||||||
$adminroot = admin_get_root();
|
$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'])) {
|
if (isset($USER->preference['admin_bookmarks'])) {
|
||||||
|
|
||||||
|
@ -25,9 +26,9 @@ if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
|
||||||
$temp = $adminroot->locate($section);
|
$temp = $adminroot->locate($section);
|
||||||
|
|
||||||
if (is_a($temp, 'admin_externalpage')) {
|
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')) {
|
} 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 {
|
} else {
|
||||||
redirect($CFG->wwwroot, get_string('bookmarkdeleted', 'admin'),1);
|
redirect($CFG->wwwroot, get_string('bookmarkdeleted', 'admin'),1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue