Skip to content

Commit

Permalink
MDL-14460, fix get_context_instance, merged from MOODLE_19_STABLE, se…
Browse files Browse the repository at this point in the history
…e tracker.
  • Loading branch information
dongsheng committed Apr 22, 2008
1 parent dde73b9 commit ef35441
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions calendar/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion calendar/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion mnet/testclient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions user/profile/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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');
}
}
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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));
}
}

Expand Down
2 changes: 1 addition & 1 deletion userpix/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
Expand Down
2 changes: 1 addition & 1 deletion userpix/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
Expand Down

0 comments on commit ef35441

Please sign in to comment.