From ef35441d27755bdce7da418884f84dce6b8c474f Mon Sep 17 00:00:00 2001 From: dongsheng Date: Tue, 22 Apr 2008 06:24:14 +0000 Subject: [PATCH] MDL-14460, fix get_context_instance, merged from MOODLE_19_STABLE, see tracker. --- calendar/lib.php | 4 ++-- calendar/view.php | 2 +- mnet/testclient.php | 2 +- user/profile/lib.php | 8 ++++---- userpix/index.php | 2 +- userpix/upgrade.php | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index 7038eb10ac7bd..c12b9546614ba 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -1292,7 +1292,7 @@ function calendar_set_filters(&$courses, &$group, &$user, $courseeventsfrom = NU } // XXX TODO: not sure how to replace $CFG->calendar_adminseesall - if(has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID)) && !empty($CFG->calendar_adminseesall)) { + if(has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM)) && !empty($CFG->calendar_adminseesall)) { $group = true; } else { @@ -1377,7 +1377,7 @@ function calendar_edit_event_allowed($event) { return false; } - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); // if user has manageentries at site level, return true if (has_capability('moodle/calendar:manageentries', $sitecontext)) { return true; diff --git a/calendar/view.php b/calendar/view.php index a8c9431222c7f..6eb8184ff4798 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -608,7 +608,7 @@ function calendar_course_filter_selector($getvars = '') { return ''; } - if (has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID)) && !empty($CFG->calendar_adminseesall)) { + if (has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM)) && !empty($CFG->calendar_adminseesall)) { $courses = get_courses('all', 'c.shortname','c.id,c.shortname'); } else { $courses = get_my_courses($USER->id, 'shortname'); diff --git a/mnet/testclient.php b/mnet/testclient.php index 8349e8d9598bd..1f8d15643d899 100644 --- a/mnet/testclient.php +++ b/mnet/testclient.php @@ -14,7 +14,7 @@ require_once $CFG->dirroot.'/mnet/xmlrpc/client.php'; // Site admins only, thanks. -$context = get_context_instance(CONTEXT_SYSTEM, SITEID); +$context = get_context_instance(CONTEXT_SYSTEM); require_capability('moodle/site:config', $context); error_reporting(E_ALL); diff --git a/user/profile/lib.php b/user/profile/lib.php index c45074e936fb7..84878f6a384b4 100644 --- a/user/profile/lib.php +++ b/user/profile/lib.php @@ -65,7 +65,7 @@ function display_data() { function edit_field(&$mform) { if ($this->field->visible != PROFILE_VISIBLE_NONE - or has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + or has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM))) { $this->edit_field_add($mform); $this->edit_field_set_default($mform); @@ -127,7 +127,7 @@ function edit_field_set_default(&$mform) { * @param object instance of the moodleform class */ function edit_field_set_required(&$mform) { - if ($this->is_required() and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if ($this->is_required() and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM))) { $mform->addRule($this->inputname, get_string('required'), 'required', null, 'client'); } } @@ -137,7 +137,7 @@ function edit_field_set_required(&$mform) { * @param object instance of the moodleform class */ function edit_field_set_locked(&$mform) { - if ($this->is_locked() and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if ($this->is_locked() and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM))) { $mform->hardFreeze($this->inputname); } } @@ -229,7 +229,7 @@ function is_visible() { case PROFILE_VISIBLE_PRIVATE: return ($this->userid == $USER->id); default: - return has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SITEID)); + return has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM)); } } diff --git a/userpix/index.php b/userpix/index.php index a88ae2e34a6b9..543af8976e330 100644 --- a/userpix/index.php +++ b/userpix/index.php @@ -11,7 +11,7 @@ require_login(); /// Remove the following three lines if you want everyone to access it - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); if (!$users = get_records("user", "picture", "1", "lastaccess DESC", "id,firstname,lastname")) { print_error("no users!"); diff --git a/userpix/upgrade.php b/userpix/upgrade.php index c0fe0a7babf90..43f25750416c1 100644 --- a/userpix/upgrade.php +++ b/userpix/upgrade.php @@ -7,7 +7,7 @@ require_login(); - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); if (!$users = get_records("user", "picture", "1", "lastaccess DESC", "id,firstname,lastname")) { print_error("no users!");