Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Create admin bookmarks. 19 * 20 * @package block_admin_bookmarks 21 * @copyright 2006 vinkmar 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 require('../../config.php'); 26 27 require_once($CFG->libdir.'/adminlib.php'); 28 require_login(); 29 $context = context_system::instance(); 30 $PAGE->set_context($context); 31 $adminroot = admin_get_root(false, false); // settings not required - only pages 32 33 if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey()) { 34 35 if (get_user_preferences('admin_bookmarks')) { 36 $bookmarks = explode(',', get_user_preferences('admin_bookmarks')); 37 38 if (in_array($section, $bookmarks)) { 39 print_error('bookmarkalreadyexists','admin'); 40 die; 41 } 42 43 } else { 44 $bookmarks = array(); 45 } 46 47 $temp = $adminroot->locate($section); 48 49 if ($temp instanceof admin_settingpage || $temp instanceof admin_externalpage || $temp instanceof admin_category) { 50 $bookmarks[] = $section; 51 $bookmarks = implode(',', $bookmarks); 52 set_user_preference('admin_bookmarks', $bookmarks); 53 54 } else { 55 print_error('invalidsection','admin'); 56 die; 57 } 58 59 if ($temp instanceof admin_settingpage) { 60 redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section); 61 62 } elseif ($temp instanceof admin_externalpage) { 63 redirect($temp->url); 64 65 } else if ($temp instanceof admin_category) { 66 redirect($CFG->wwwroot . '/' . $CFG->admin . '/category.php?category=' . $section); 67 68 } 69 70 } else { 71 print_error('invalidsection','admin'); 72 die; 73 } 74 75
title
Description
Body
title
Description
Body
title
Description
Body
title
Body