MDL-14460, fix get_context_instance, merged from MOODLE_19_STABLE, see tracker.
authordongsheng <dongsheng>
Tue, 22 Apr 2008 06:24:14 +0000 (06:24 +0000)
committerdongsheng <dongsheng>
Tue, 22 Apr 2008 06:24:14 +0000 (06:24 +0000)
calendar/lib.php
calendar/view.php
mnet/testclient.php
user/profile/lib.php
userpix/index.php
userpix/upgrade.php

index 7038eb1..c12b954 100644 (file)
@@ -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;
index a8c9431..6eb8184 100644 (file)
@@ -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');
index 8349e8d..1f8d156 100644 (file)
@@ -14,7 +14,7 @@ require_once(dirname(dirname(__FILE__)) . '/config.php');
 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);
index c45074e..84878f6 100644 (file)
@@ -65,7 +65,7 @@ class profile_field_base {
     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 @@ class profile_field_base {
      * @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 @@ class profile_field_base {
      * @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 @@ class profile_field_base {
             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));
         }
     }
 
index a88ae2e..543af89 100644 (file)
@@ -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!");
index c0fe0a7..43f2575 100644 (file)
@@ -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!");