mirror of
https://github.com/moodle/moodle.git
synced 2025-06-01 21:55:12 +02:00
MDL-34460 Librairies: Replaced deprecated get_context_instance()
This commit is contained in:
parent
42b60b2755
commit
4373103084
@ -85,7 +85,7 @@ if ($token==="$inttoken") {
|
||||
|
||||
foreach ($modinfo->instances[$componentname] as $modinstanceid=>$cm) {
|
||||
if ($modinstanceid==$instanceid) {
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$context = context_module::instance($cm->id, IGNORE_MISSING);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ require_once('../config.php');
|
||||
|
||||
require_login();
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemcontext = context_system::instance();
|
||||
require_capability('moodle/tag:create', $systemcontext);
|
||||
|
||||
if (empty($CFG->usetags)) {
|
||||
|
@ -59,7 +59,7 @@ if ($courseid != SITEID) {
|
||||
}
|
||||
|
||||
// Permissions
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$sitecontext = context_system::instance();
|
||||
require_login($course);
|
||||
$canedit = has_capability('moodle/tag:create', $sitecontext);
|
||||
|
||||
@ -85,7 +85,7 @@ if ($data = data_submitted()) {
|
||||
// The title and breadcrumb
|
||||
$title = get_string('edittitle', $tagslang);
|
||||
$coursefullname = format_string($course->fullname);
|
||||
$courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
|
||||
$courseshortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));
|
||||
$PAGE->navbar->add($title);
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
|
@ -65,7 +65,7 @@ if ($courseid) {
|
||||
}
|
||||
|
||||
if ($courseid) {
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_COURSE, $courseid));
|
||||
$PAGE->set_context(context_course::instance($courseid));
|
||||
} else {
|
||||
$PAGE->set_context(get_system_context());
|
||||
}
|
||||
@ -86,7 +86,7 @@ $welcome = get_string('morewelcome', $tagslang);
|
||||
|
||||
// The title and breadcrumb
|
||||
if ($courseid) {
|
||||
$courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $courseid)));
|
||||
$courseshortname = format_string($course->shortname, true, array('context' => context_course::instance($courseid)));
|
||||
$PAGE->navbar->add($courseshortname, new moodle_url('/course/view.php', array('id'=>$courseid)));
|
||||
}
|
||||
$PAGE->navbar->add($title);
|
||||
@ -183,7 +183,7 @@ if ($loggedin) {
|
||||
}
|
||||
}
|
||||
if ($courseid) {
|
||||
$fullname = format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
|
||||
$fullname = format_string($course->fullname, true, array('context' => context_course::instance($course->id)));
|
||||
if ($show == 'course') {
|
||||
$link1 .= ' | <b>'.get_string('moreshowcoursetags', $tagslang, $fullname).'</b>';
|
||||
} else {
|
||||
|
@ -232,7 +232,7 @@ function coursetag_print_cloud($tagcloud, $return=false, $max_size=180, $min_siz
|
||||
|
||||
$step = ($max_size - $min_size)/($spread);
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemcontext = context_system::instance();
|
||||
$can_manage_tags = has_capability('moodle/tag:manage', $systemcontext);
|
||||
|
||||
//prints the tag cloud
|
||||
|
@ -36,7 +36,7 @@ if (empty($CFG->usetags)) {
|
||||
}
|
||||
|
||||
//Editing a tag requires moodle/tag:edit capability
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemcontext = context_system::instance();
|
||||
require_capability('moodle/tag:edit', $systemcontext);
|
||||
|
||||
if ($tag_name) {
|
||||
|
@ -51,7 +51,7 @@ class tag_edit_form extends moodleform {
|
||||
$mform->addElement('hidden', 'id');
|
||||
$mform->setType('id', PARAM_INT);
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemcontext = context_system::instance();
|
||||
|
||||
if (has_capability('moodle/tag:manage', $systemcontext)) {
|
||||
$mform->addElement('text', 'rawname', get_string('name', 'tag'),
|
||||
|
@ -41,7 +41,7 @@ $edit = optional_param('edit', -1, PARAM_BOOL);
|
||||
$userpage = optional_param('userpage', 0, PARAM_INT); // which page to show
|
||||
$perpage = optional_param('perpage', 24, PARAM_INT);
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemcontext = context_system::instance();
|
||||
|
||||
if ($tagname) {
|
||||
$tag = tag_get('name', $tagname, '*');
|
||||
|
@ -600,7 +600,7 @@ function tag_delete($tagids) {
|
||||
}
|
||||
|
||||
$success = true;
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
foreach ($tagids as $tagid) {
|
||||
if (is_null($tagid)) { // can happen if tag doesn't exists
|
||||
continue;
|
||||
|
@ -39,7 +39,7 @@ require_once($CFG->libdir.'/filelib.php');
|
||||
function tag_print_cloud($nr_of_tags=150, $return=false) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$can_manage_tags = has_capability('moodle/tag:manage', get_context_instance(CONTEXT_SYSTEM));
|
||||
$can_manage_tags = has_capability('moodle/tag:manage', context_system::instance());
|
||||
|
||||
if ( !$tagsincloud = $DB->get_records_sql('SELECT tg.rawname, tg.id, tg.name, tg.tagtype, COUNT(ti.id) AS count, tg.flag
|
||||
FROM {tag_instance} ti JOIN {tag} tg ON tg.id = ti.tagid
|
||||
@ -146,7 +146,7 @@ function tag_print_description_box($tag_object, $return=false) {
|
||||
$options = new stdClass();
|
||||
$options->para = false;
|
||||
$options->overflowdiv = true;
|
||||
$tag_object->description = file_rewrite_pluginfile_urls($tag_object->description, 'pluginfile.php', get_context_instance(CONTEXT_SYSTEM)->id, 'tag', 'description', $tag_object->id);
|
||||
$tag_object->description = file_rewrite_pluginfile_urls($tag_object->description, 'pluginfile.php', context_system::instance()->id, 'tag', 'description', $tag_object->id);
|
||||
$output .= format_text($tag_object->description, $tag_object->descriptionformat, $options);
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ function tag_print_management_box($tag_object, $return=false) {
|
||||
|
||||
if (!isguestuser()) {
|
||||
$output .= $OUTPUT->box_start('box','tag-management-box');
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemcontext = context_system::instance();
|
||||
$links = array();
|
||||
|
||||
// Add a link for users to add/remove this from their interests
|
||||
@ -356,7 +356,7 @@ function tag_print_tagged_users_table($tag_object, $limitfrom='', $limitnum='',
|
||||
function tag_print_user_box($user, $return=false) {
|
||||
global $CFG, $OUTPUT;
|
||||
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
$usercontext = context_user::instance($user->id);
|
||||
$profilelink = '';
|
||||
|
||||
if ($usercontext and (has_capability('moodle/user:viewdetails', $usercontext) || has_coursecontact_role($user->id))) {
|
||||
|
@ -41,7 +41,7 @@ if (empty($CFG->usetags)) {
|
||||
print_error('tagsaredisabled', 'tag');
|
||||
}
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemcontext = context_system::instance();
|
||||
require_capability('moodle/tag:manage', $systemcontext);
|
||||
|
||||
$params = array();
|
||||
@ -151,7 +151,7 @@ switch($action) {
|
||||
// tag exists, change the type
|
||||
tag_type_set($new_otag_id, 'official');
|
||||
} else {
|
||||
require_capability('moodle/tag:create', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('moodle/tag:create', context_system::instance());
|
||||
tag_add($new_otag, 'official');
|
||||
}
|
||||
$notice .= get_string('addedotag', 'tag', $new_otag) .' ';
|
||||
|
@ -47,10 +47,10 @@ if ($perpage !== 18) {
|
||||
$params['perpage'] = $perpage;
|
||||
}
|
||||
$PAGE->set_url(new moodle_url('/tag/search.php', $params));
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_pagelayout('standard');
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemcontext = context_system::instance();
|
||||
$manage_link = ' ';
|
||||
|
||||
$PAGE->set_title(get_string('tags', 'tag'));
|
||||
|
@ -44,7 +44,7 @@ class theme_mymobile_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
public function settings_tree(settings_navigation $navigation) {
|
||||
$content = $this->navigation_node($navigation, array('class' => 'settings'));
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if (has_capability('moodle/site:config', context_system::instance())) {
|
||||
// TODO: Work out whether something is missing from here.
|
||||
}
|
||||
return $content;
|
||||
@ -326,7 +326,7 @@ class theme_mymobile_core_renderer extends core_renderer {
|
||||
// $course->id is not defined during installation
|
||||
return '';
|
||||
} else if (isloggedin()) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
$fullname = fullname($USER, true);
|
||||
|
||||
// Since Moodle 2.0 this link always goes to the public profile page (not the course profile page)
|
||||
@ -364,7 +364,7 @@ class theme_mymobile_core_renderer extends core_renderer {
|
||||
} else {
|
||||
$loggedinas .= get_string('failedloginattemptsall', '', $count);
|
||||
}
|
||||
if (file_exists("$CFG->dirroot/report/log/index.php") and has_capability('report/log:view', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if (file_exists("$CFG->dirroot/report/log/index.php") and has_capability('report/log:view', context_system::instance())) {
|
||||
$loggedinas .= ' (<a href="'.$CFG->wwwroot.'/course/report/log/index.php?chooselog=1&id=1&modid=site_errors">'.get_string('logs').'</a>)';
|
||||
}
|
||||
$loggedinas .= '</div>';
|
||||
@ -405,7 +405,7 @@ class theme_mymobile_core_renderer extends core_renderer {
|
||||
// $course->id is not defined during installation
|
||||
return '';
|
||||
} else if (isloggedin()) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
$fullname = fullname($USER, true);
|
||||
// Since Moodle 2.0 this link always goes to the public profile page (not the course profile page)
|
||||
@ -447,7 +447,7 @@ class theme_mymobile_core_renderer extends core_renderer {
|
||||
} else {
|
||||
$loggedinas .= get_string('failedloginattemptsall', '', $count);
|
||||
}
|
||||
if (has_capability('report/log:view', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if (has_capability('report/log:view', context_system::instance())) {
|
||||
$loggedinas .= ' (<a href="'.$CFG->wwwroot.'/course/report/log/index.php?chooselog=1&id=1&modid=site_errors">'.get_string('logs').'</a>)';
|
||||
}
|
||||
$loggedinas .= '</div>';
|
||||
|
@ -37,7 +37,7 @@ if (! $course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
$context = context_course::instance($id);
|
||||
require_login($course);
|
||||
|
||||
// to create notes the current user needs a capability
|
||||
|
@ -97,12 +97,12 @@ if ($editurl = $userauth->edit_profile_url()) {
|
||||
}
|
||||
|
||||
if ($course->id == SITEID) {
|
||||
$coursecontext = get_context_instance(CONTEXT_SYSTEM); // SYSTEM context
|
||||
$coursecontext = context_system::instance(); // SYSTEM context
|
||||
} else {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // Course context
|
||||
$coursecontext = context_course::instance($course->id); // Course context
|
||||
}
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
$systemcontext = context_system::instance();
|
||||
$personalcontext = context_user::instance($user->id);
|
||||
|
||||
// check access control
|
||||
if ($user->id == $USER->id) {
|
||||
@ -244,7 +244,7 @@ if ($usernew = $userform->get_data()) {
|
||||
|
||||
$a = new stdClass();
|
||||
$a->url = $CFG->wwwroot . '/user/emailupdate.php?key=' . $usernew->preference_newemailkey . '&id=' . $user->id;
|
||||
$a->site = format_string($SITE->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
|
||||
$a->site = format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID)));
|
||||
$a->fullname = fullname($user, true);
|
||||
|
||||
$emailupdatemessage = get_string('emailupdatemessage', 'auth', $a);
|
||||
|
@ -83,7 +83,7 @@ class user_edit_form extends moodleform {
|
||||
|
||||
// print picture
|
||||
if (!empty($CFG->gdversion)) {
|
||||
$context = get_context_instance(CONTEXT_USER, $user->id, MUST_EXIST);
|
||||
$context = context_user::instance($user->id, MUST_EXIST);
|
||||
$fs = get_file_storage();
|
||||
$hasuploadedpicture = ($fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.png') || $fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.jpg'));
|
||||
if (!empty($user->picture) && $hasuploadedpicture) {
|
||||
@ -147,7 +147,7 @@ class user_edit_form extends moodleform {
|
||||
$errors['email'] = get_string('toomanybounces');
|
||||
}
|
||||
|
||||
if (isset($usernew->email) and !empty($CFG->verifychangedemail) and !isset($errors['email']) and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if (isset($usernew->email) and !empty($CFG->verifychangedemail) and !isset($errors['email']) and !has_capability('moodle/user:update', context_system::instance())) {
|
||||
$errorstr = email_is_not_allowed($usernew->email);
|
||||
if ($errorstr !== false) {
|
||||
$errors['email'] = $errorstr;
|
||||
|
@ -49,11 +49,11 @@ if (!empty($USER->newadminuser)) {
|
||||
}
|
||||
|
||||
if ($course->id == SITEID) {
|
||||
$coursecontext = get_context_instance(CONTEXT_SYSTEM); // SYSTEM context
|
||||
$coursecontext = context_system::instance(); // SYSTEM context
|
||||
} else {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // Course context
|
||||
$coursecontext = context_course::instance($course->id); // Course context
|
||||
}
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemcontext = context_system::instance();
|
||||
|
||||
if ($id == -1) {
|
||||
// creating new user
|
||||
@ -68,7 +68,7 @@ if ($id == -1) {
|
||||
// editing existing user
|
||||
require_capability('moodle/user:update', $systemcontext);
|
||||
$user = $DB->get_record('user', array('id'=>$id), '*', MUST_EXIST);
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_USER, $user->id));
|
||||
$PAGE->set_context(context_user::instance($user->id));
|
||||
if ($user->id == $USER->id) {
|
||||
if ($course->id != SITEID && $node = $PAGE->navigation->find($course->id, navigation_node::TYPE_COURSE)) {
|
||||
$node->make_active();
|
||||
@ -112,7 +112,7 @@ if (!empty($CFG->usetags)) {
|
||||
}
|
||||
|
||||
if ($user->id !== -1) {
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
$usercontext = context_user::instance($user->id);
|
||||
$editoroptions = array(
|
||||
'maxfiles' => EDITOR_UNLIMITED_FILES,
|
||||
'maxbytes' => $CFG->maxbytes,
|
||||
@ -203,7 +203,7 @@ if ($usernew = $userform->get_data()) {
|
||||
$usercreated = false;
|
||||
}
|
||||
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $usernew->id);
|
||||
$usercontext = context_user::instance($usernew->id);
|
||||
|
||||
//update preferences
|
||||
useredit_update_user_preference($usernew);
|
||||
|
@ -130,7 +130,7 @@ class user_editadvanced_form extends moodleform {
|
||||
// print picture
|
||||
if (!empty($CFG->gdversion) and empty($USER->newadminuser)) {
|
||||
if ($user) {
|
||||
$context = get_context_instance(CONTEXT_USER, $user->id, MUST_EXIST);
|
||||
$context = context_user::instance($user->id, MUST_EXIST);
|
||||
$fs = get_file_storage();
|
||||
$hasuploadedpicture = ($fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.png') || $fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.jpg'));
|
||||
if (!empty($user->picture) && $hasuploadedpicture) {
|
||||
|
@ -46,7 +46,7 @@ function useredit_update_picture(stdClass $usernew, moodleform $userform, $filem
|
||||
global $CFG, $DB;
|
||||
require_once("$CFG->libdir/gdlib.php");
|
||||
|
||||
$context = get_context_instance(CONTEXT_USER, $usernew->id, MUST_EXIST);
|
||||
$context = context_user::instance($usernew->id, MUST_EXIST);
|
||||
$user = $DB->get_record('user', array('id'=>$usernew->id), 'id, picture', MUST_EXIST);
|
||||
|
||||
$newpicture = $user->picture;
|
||||
|
@ -31,7 +31,7 @@ $key = required_param('key', PARAM_ALPHANUM);
|
||||
$id = required_param('id', PARAM_INT);
|
||||
|
||||
$PAGE->set_url('/user/emailupdate.php', array('id'=>$id, 'key'=>$key));
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
|
||||
if (!$user = $DB->get_record('user', array('id' => $id))) {
|
||||
print_error('invaliduserid');
|
||||
|
@ -100,7 +100,7 @@ class core_user_external extends external_api {
|
||||
require_once($CFG->dirroot."/user/profile/lib.php"); //required for customfields related function
|
||||
|
||||
// Ensure the current user is allowed to run this function
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
self::validate_context($context);
|
||||
require_capability('moodle/user:create', $context);
|
||||
|
||||
@ -226,7 +226,7 @@ class core_user_external extends external_api {
|
||||
require_once($CFG->dirroot."/user/lib.php");
|
||||
|
||||
// Ensure the current user is allowed to run this function
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
require_capability('moodle/user:delete', $context);
|
||||
self::validate_context($context);
|
||||
|
||||
@ -324,7 +324,7 @@ class core_user_external extends external_api {
|
||||
require_once($CFG->dirroot."/user/profile/lib.php"); //required for customfields related function
|
||||
|
||||
// Ensure the current user is allowed to run this function
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
require_capability('moodle/user:update', $context);
|
||||
self::validate_context($context);
|
||||
|
||||
@ -413,7 +413,7 @@ class core_user_external extends external_api {
|
||||
continue;
|
||||
}
|
||||
context_instance_preload($user);
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
$usercontext = context_user::instance($user->id, IGNORE_MISSING);
|
||||
self::validate_context($usercontext);
|
||||
$currentuser = ($user->id == $USER->id);
|
||||
|
||||
@ -576,7 +576,7 @@ class core_user_external extends external_api {
|
||||
}
|
||||
context_instance_preload($user);
|
||||
$course = $courses[$courseids[$user->id]];
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseids[$user->id]);
|
||||
$context = context_course::instance($courseids[$user->id], IGNORE_MISSING);
|
||||
self::validate_context($context);
|
||||
if ($userarray = user_get_user_details($user, $course)) {
|
||||
$result[] = $userarray;
|
||||
|
@ -38,7 +38,7 @@ if (empty($returnurl)) {
|
||||
$returnurl = new moodle_url('/user/files.php');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$context = context_user::instance($USER->id);
|
||||
require_capability('moodle/user:manageownfiles', $context);
|
||||
|
||||
$title = get_string('myfiles');
|
||||
|
@ -21,7 +21,7 @@ class user_filter_courserole extends user_filter_type {
|
||||
* @return array of availble roles
|
||||
*/
|
||||
function get_roles() {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
$roles = array(0=> get_string('anyrole','filters')) + get_default_enrol_roles($context);
|
||||
return $roles;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class user_filter_globalrole extends user_filter_type {
|
||||
* @return array of availble roles
|
||||
*/
|
||||
function get_roles() {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
$roles = array(0=> get_string('anyrole','filters')) + get_assignable_roles($context);
|
||||
return $roles;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ if (! $course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
$context = context_course::instance($id);
|
||||
require_login($course);
|
||||
|
||||
// to create notes the current user needs a capability
|
||||
|
@ -41,7 +41,7 @@
|
||||
$course = $DB->get_record('course', array('id'=>$context->instanceid), '*', MUST_EXIST);
|
||||
} else {
|
||||
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$context = context_course::instance($course->id, MUST_EXIST);
|
||||
}
|
||||
// not needed anymore
|
||||
unset($contextid);
|
||||
@ -49,10 +49,10 @@
|
||||
|
||||
require_login($course);
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemcontext = context_system::instance();
|
||||
$isfrontpage = ($course->id == SITEID);
|
||||
|
||||
$frontpagectx = get_context_instance(CONTEXT_COURSE, SITEID);
|
||||
$frontpagectx = context_course::instance(SITEID);
|
||||
|
||||
if ($isfrontpage) {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
@ -190,7 +190,7 @@
|
||||
$courselist = array();
|
||||
$popupurl = new moodle_url('/user/index.php?roleid='.$roleid.'&sifirst=&silast=');
|
||||
foreach ($mycourses as $mycourse) {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $mycourse->id);
|
||||
$coursecontext = context_course::instance($mycourse->id);
|
||||
$courselist[$mycourse->id] = format_string($mycourse->shortname, true, array('context' => $coursecontext));
|
||||
}
|
||||
if (has_capability('moodle/site:viewparticipants', $systemcontext)) {
|
||||
@ -579,8 +579,8 @@
|
||||
|
||||
context_instance_preload($user);
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
$context = context_course::instance($course->id);
|
||||
$usercontext = context_user::instance($user->id);
|
||||
|
||||
$countries = get_string_manager()->get_list_of_countries();
|
||||
|
||||
@ -719,7 +719,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
$usercontext = context_user::instance($user->id);
|
||||
|
||||
if ($piclink = ($USER->id == $user->id || has_capability('moodle/user:viewdetails', $context) || has_capability('moodle/user:viewdetails', $usercontext))) {
|
||||
$profilelink = '<strong><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$course->id.'">'.fullname($user).'</a></strong>';
|
||||
|
12
user/lib.php
12
user/lib.php
@ -70,7 +70,7 @@ function user_create_user($user) {
|
||||
$newuser = $DB->get_record('user', array('id' => $newuserid));
|
||||
|
||||
// create USER context for this user
|
||||
get_context_instance(CONTEXT_USER, $newuserid);
|
||||
context_user::instance($newuserid);
|
||||
|
||||
// update user password if necessary
|
||||
if (isset($userpassword)) {
|
||||
@ -225,11 +225,11 @@ function user_get_user_details($user, $course = null, array $userfields = array(
|
||||
}
|
||||
|
||||
if (!empty($course)) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
$context = context_course::instance($course->id);
|
||||
$usercontext = context_user::instance($user->id);
|
||||
$canviewdetailscap = (has_capability('moodle/user:viewdetails', $context) || has_capability('moodle/user:viewdetails', $usercontext));
|
||||
} else {
|
||||
$context = get_context_instance(CONTEXT_USER, $user->id);
|
||||
$context = context_user::instance($user->id);
|
||||
$usercontext = $context;
|
||||
$canviewdetailscap = has_capability('moodle/user:viewdetails', $usercontext);
|
||||
}
|
||||
@ -448,10 +448,10 @@ function user_get_user_details($user, $course = null, array $userfields = array(
|
||||
if ($mycourses = enrol_get_users_courses($user->id, true)) {
|
||||
foreach ($mycourses as $mycourse) {
|
||||
if ($mycourse->category) {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $mycourse->id);
|
||||
$coursecontext = context_course::instance($mycourse->id);
|
||||
$enrolledcourse = array();
|
||||
$enrolledcourse['id'] = $mycourse->id;
|
||||
$enrolledcourse['fullname'] = format_string($mycourse->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $mycourse->id)));
|
||||
$enrolledcourse['fullname'] = format_string($mycourse->fullname, true, array('context' => context_course::instance($mycourse->id)));
|
||||
$enrolledcourse['shortname'] = format_string($mycourse->shortname, true, array('context' => $coursecontext));
|
||||
$enrolledcourses[] = $enrolledcourse;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ require('../config.php');
|
||||
require_login();
|
||||
require_sesskey();
|
||||
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
|
||||
$PAGE->set_context($usercontext);
|
||||
$PAGE->set_url('/user/managetoken.php');
|
||||
|
@ -58,7 +58,7 @@ if ($deluser !== 0) {
|
||||
$url->param('deluser', $deluser);
|
||||
}
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error('invalidcourseid');
|
||||
@ -66,8 +66,8 @@ if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
|
||||
require_login();
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $id); // Course context
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM); // SYSTEM context
|
||||
$coursecontext = context_course::instance($id); // Course context
|
||||
$systemcontext = context_system::instance(); // SYSTEM context
|
||||
require_capability('moodle/course:bulkmessaging', $coursecontext);
|
||||
|
||||
if (empty($SESSION->emailto)) {
|
||||
|
@ -42,7 +42,7 @@ if (count($args) == 2) {
|
||||
} else {
|
||||
$image = 'f2';
|
||||
}
|
||||
if ($usercontext = get_context_instance(CONTEXT_USER, $userid)) {
|
||||
if ($usercontext = context_user::instance($userid, IGNORE_MISSING)) {
|
||||
$url = moodle_url::make_pluginfile_url($usercontext->id, 'user', 'icon', NULL, '/', $image);
|
||||
redirect($url);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ $strpolicyagree = get_string('policyagree');
|
||||
$strpolicyagreement = get_string('policyagreement');
|
||||
$strpolicyagreementclick = get_string('policyagreementclick');
|
||||
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_title($strpolicyagreement);
|
||||
$PAGE->set_heading($SITE->fullname);
|
||||
$PAGE->navbar->add($strpolicyagreement);
|
||||
|
@ -58,7 +58,7 @@ $display = true; // set this to false in the conditions to stop processing
|
||||
require_login($course, false);
|
||||
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_USER, $user->id));
|
||||
$PAGE->set_context(context_user::instance($user->id));
|
||||
$PAGE->set_title("$course->fullname: $fullname: $strportfolios");
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_pagelayout('standard');
|
||||
|
@ -60,7 +60,7 @@ if ($perpage !== 0) {
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_title("$course->fullname: $fullname: $strportfolios");
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_USER, $user->id));
|
||||
$PAGE->set_context(context_user::instance($user->id));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
@ -59,7 +59,7 @@ $userid = $userid ? $userid : $USER->id; // Owner of the page
|
||||
$user = $DB->get_record('user', array('id' => $userid));
|
||||
|
||||
if ($user->deleted) {
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('userdeleted'));
|
||||
echo $OUTPUT->footer();
|
||||
@ -67,7 +67,7 @@ if ($user->deleted) {
|
||||
}
|
||||
|
||||
$currentuser = ($user->id == $USER->id);
|
||||
$context = $usercontext = get_context_instance(CONTEXT_USER, $userid, MUST_EXIST);
|
||||
$context = $usercontext = context_user::instance($userid, MUST_EXIST);
|
||||
|
||||
if (!$currentuser &&
|
||||
!empty($CFG->forceloginforprofiles) &&
|
||||
@ -76,7 +76,7 @@ if (!$currentuser &&
|
||||
|
||||
// Course managers can be browsed at site level. If not forceloginforprofiles, allow access (bug #4366)
|
||||
$struser = get_string('user');
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_title("$SITE->shortname: $struser"); // Do not leak the name
|
||||
$PAGE->set_heading("$SITE->shortname: $struser");
|
||||
$PAGE->set_url('/user/profile.php', array('id'=>$userid));
|
||||
@ -93,7 +93,7 @@ if (!$currentpage = my_get_page($userid, MY_PAGE_PUBLIC)) {
|
||||
}
|
||||
|
||||
if (!$currentpage->userid) {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM); // A trick so that we even see non-sticky blocks
|
||||
$context = context_system::instance(); // A trick so that we even see non-sticky blocks
|
||||
}
|
||||
|
||||
$PAGE->set_context($context);
|
||||
@ -306,7 +306,7 @@ if (!isset($hiddenfields['mycourses'])) {
|
||||
if ($mycourse->category) {
|
||||
$class = '';
|
||||
if ($mycourse->visible == 0) {
|
||||
$ccontext = get_context_instance(CONTEXT_COURSE, $mycourse->id);
|
||||
$ccontext = context_course::instance($mycourse->id);
|
||||
if (!has_capability('moodle/course:viewhiddencourses', $ccontext)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class profile_field_checkbox extends profile_field_base {
|
||||
$checkbox->setChecked(true);
|
||||
}
|
||||
$mform->setType($this->inputname, PARAM_BOOL);
|
||||
if ($this->is_required() and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if ($this->is_required() and !has_capability('moodle/user:update', context_system::instance())) {
|
||||
$mform->addRule($this->inputname, get_string('required'), 'nonzero', null, 'client');
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ class profile_field_menu extends profile_field_base {
|
||||
if (!$mform->elementExists($this->inputname)) {
|
||||
return;
|
||||
}
|
||||
if ($this->is_locked() and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if ($this->is_locked() and !has_capability('moodle/user:update', context_system::instance())) {
|
||||
$mform->hardFreeze($this->inputname);
|
||||
$mform->setConstant($this->inputname, $this->datakey);
|
||||
}
|
||||
|
@ -67,7 +67,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))) {
|
||||
or has_capability('moodle/user:update', context_system::instance())) {
|
||||
|
||||
$this->edit_field_add($mform);
|
||||
$this->edit_field_set_default($mform);
|
||||
@ -85,7 +85,7 @@ class profile_field_base {
|
||||
function edit_after_data($mform) {
|
||||
|
||||
if ($this->field->visible != PROFILE_VISIBLE_NONE
|
||||
or has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
or has_capability('moodle/user:update', context_system::instance())) {
|
||||
$this->edit_field_set_locked($mform);
|
||||
return true;
|
||||
}
|
||||
@ -183,7 +183,7 @@ class profile_field_base {
|
||||
if (!$mform->elementExists($this->inputname)) {
|
||||
return;
|
||||
}
|
||||
if ($this->is_locked() and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if ($this->is_locked() and !has_capability('moodle/user:update', context_system::instance())) {
|
||||
$mform->hardFreeze($this->inputname);
|
||||
$mform->setConstant($this->inputname, $this->data);
|
||||
}
|
||||
@ -283,11 +283,11 @@ class profile_field_base {
|
||||
return true;
|
||||
} else {
|
||||
return has_capability('moodle/user:viewalldetails',
|
||||
get_context_instance(CONTEXT_USER, $this->userid));
|
||||
context_user::instance($this->userid));
|
||||
}
|
||||
default:
|
||||
return has_capability('moodle/user:viewalldetails',
|
||||
get_context_instance(CONTEXT_USER, $this->userid));
|
||||
context_user::instance($this->userid));
|
||||
}
|
||||
}
|
||||
|
||||
@ -359,7 +359,7 @@ function profile_definition($mform, $userid = 0) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// if user is "admin" fields are displayed regardless
|
||||
$update = has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM));
|
||||
$update = has_capability('moodle/user:update', context_system::instance());
|
||||
|
||||
if ($categories = $DB->get_records('user_info_category', null, 'sortorder ASC')) {
|
||||
foreach ($categories as $category) {
|
||||
|
@ -37,7 +37,7 @@ $edit = optional_param('edit', null, PARAM_BOOL); // Turn editing on and of
|
||||
|
||||
require_login();
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$context = context_system::instance();
|
||||
require_capability('moodle/my:configsyspages', $context);
|
||||
$PAGE->set_blocks_editing_capability('moodle/my:configsyspages');
|
||||
$header = "$SITE->shortname: ".get_string('publicprofile')." (".get_string('myprofile', 'admin').")";
|
||||
|
@ -84,7 +84,7 @@ class user_files_tree implements renderable {
|
||||
public $dir;
|
||||
public function __construct() {
|
||||
global $USER;
|
||||
$this->context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$this->context = context_user::instance($USER->id);
|
||||
$fs = get_file_storage();
|
||||
$this->dir = $fs->get_area_tree($this->context->id, 'user', 'private', 0);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ $configstr = get_string('manageuserrepository', 'repository');
|
||||
$pluginstr = get_string('plugin', 'repository');
|
||||
|
||||
require_login($course, false);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
|
||||
$coursecontext = context_course::instance($course->id, MUST_EXIST);
|
||||
|
||||
$link = new moodle_url('/user/view.php', array('id'=>$user->id));
|
||||
$PAGE->navbar->add($fullname, $link);
|
||||
|
@ -98,7 +98,7 @@ abstract class user_selector_base {
|
||||
if (isset($options['accesscontext'])) {
|
||||
$this->accesscontext = $options['accesscontext'];
|
||||
} else {
|
||||
$this->accesscontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$this->accesscontext = context_system::instance();
|
||||
}
|
||||
|
||||
if (isset($options['extrafields'])) {
|
||||
@ -676,7 +676,7 @@ abstract class groups_user_selector_base extends user_selector_base {
|
||||
*/
|
||||
public function __construct($name, $options) {
|
||||
global $CFG;
|
||||
$options['accesscontext'] = get_context_instance(CONTEXT_COURSE, $options['courseid']);
|
||||
$options['accesscontext'] = context_course::instance($options['courseid']);
|
||||
parent::__construct($name, $options);
|
||||
$this->groupid = $options['groupid'];
|
||||
$this->courseid = $options['courseid'];
|
||||
@ -809,7 +809,7 @@ class group_non_members_selector extends groups_user_selector_base {
|
||||
global $DB;
|
||||
|
||||
// Get list of allowed roles.
|
||||
$context = get_context_instance(CONTEXT_COURSE, $this->courseid);
|
||||
$context = context_course::instance($this->courseid);
|
||||
if ($validroleids = groups_get_possible_roles($context)) {
|
||||
list($roleids, $roleparams) = $DB->get_in_or_equal($validroleids, SQL_PARAMS_NAMED, 'r');
|
||||
} else {
|
||||
|
@ -26,7 +26,7 @@
|
||||
require_once(dirname(__FILE__) . '/../../config.php');
|
||||
require_once($CFG->dirroot . '/user/selector/lib.php');
|
||||
|
||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_url('/user/selector/search.php');
|
||||
|
||||
// In developer debug mode, when there is a debug=1 in the URL send as plain text
|
||||
|
@ -46,9 +46,9 @@ $user = $DB->get_record('user', array('id'=>$id), '*', MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
|
||||
$currentuser = ($user->id == $USER->id);
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $user->id, IGNORE_MISSING);
|
||||
$systemcontext = context_system::instance();
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
$usercontext = context_user::instance($user->id, IGNORE_MISSING);
|
||||
|
||||
// Require login first
|
||||
if (isguestuser($user)) {
|
||||
@ -288,7 +288,7 @@ if (!isset($hiddenfields['mycourses'])) {
|
||||
$courselisting = '';
|
||||
foreach ($mycourses as $mycourse) {
|
||||
if ($mycourse->category) {
|
||||
$ccontext = get_context_instance(CONTEXT_COURSE, $mycourse->id);;
|
||||
$ccontext = context_course::instance($mycourse->id);;
|
||||
$cfullname = format_string($mycourse->fullname, true, array('context' => $ccontext));
|
||||
if ($mycourse->id != $course->id){
|
||||
$class = '';
|
||||
|
@ -13,7 +13,7 @@ $PAGE->set_url('/userpix/index.php');
|
||||
require_login();
|
||||
|
||||
/// Remove the following three lines if you want everyone to access it
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$syscontext = context_system::instance();
|
||||
require_capability('moodle/site:config', $syscontext);
|
||||
|
||||
$title = get_string("users");
|
||||
|
@ -71,7 +71,7 @@ class core_webservice_external extends external_api {
|
||||
array('serviceshortnames'=>$serviceshortnames));
|
||||
|
||||
$profileimageurl = moodle_url::make_pluginfile_url(
|
||||
get_context_instance(CONTEXT_USER, $USER->id)->id, 'user', 'icon', NULL, '/', 'f1');
|
||||
context_user::instance($USER->id)->id, 'user', 'icon', NULL, '/', 'f1');
|
||||
|
||||
//site information
|
||||
$siteinfo = array(
|
||||
|
@ -102,7 +102,7 @@ class webservice {
|
||||
}
|
||||
|
||||
//Non admin can not authenticate if maintenance mode
|
||||
$hassiteconfig = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM), $user);
|
||||
$hassiteconfig = has_capability('moodle/site:config', context_system::instance(), $user);
|
||||
if (!empty($CFG->maintenance_enabled) and !$hassiteconfig) {
|
||||
//this is usually temporary, client want to implement code logic => moodle_exception
|
||||
throw new moodle_exception('sitemaintenance', 'admin');
|
||||
@ -116,7 +116,7 @@ class webservice {
|
||||
}
|
||||
|
||||
//check if there is any required system capability
|
||||
if ($service->requiredcapability and !has_capability($service->requiredcapability, get_context_instance(CONTEXT_SYSTEM), $user)) {
|
||||
if ($service->requiredcapability and !has_capability($service->requiredcapability, context_system::instance(), $user)) {
|
||||
throw new webservice_access_exception('The capability ' . $service->requiredcapability . ' is required.');
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ class webservice {
|
||||
global $CFG, $DB;
|
||||
|
||||
// generate a token for non admin if web service are enable and the user has the capability to create a token
|
||||
if (!is_siteadmin() && has_capability('moodle/webservice:createtoken', get_context_instance(CONTEXT_SYSTEM), $userid) && !empty($CFG->enablewebservices)) {
|
||||
if (!is_siteadmin() && has_capability('moodle/webservice:createtoken', context_system::instance(), $userid) && !empty($CFG->enablewebservices)) {
|
||||
// for every service than the user is authorised on, create a token (if it doesn't already exist)
|
||||
|
||||
// get all services which are set to all user (no restricted to specific users)
|
||||
@ -298,7 +298,7 @@ class webservice {
|
||||
$newtoken->userid = $userid;
|
||||
$newtoken->externalserviceid = $serviceid;
|
||||
// TODO MDL-31190 find a way to get the context - UPDATE FOLLOWING LINE
|
||||
$newtoken->contextid = get_context_instance(CONTEXT_SYSTEM)->id;
|
||||
$newtoken->contextid = context_system::instance()->id;
|
||||
$newtoken->creatorid = $userid;
|
||||
$newtoken->timecreated = time();
|
||||
|
||||
@ -835,7 +835,7 @@ abstract class webservice_server implements webservice_server_interface {
|
||||
throw new webservice_access_exception('The web service authentication plugin is missing.');
|
||||
}
|
||||
|
||||
$this->restricted_context = get_context_instance(CONTEXT_SYSTEM);
|
||||
$this->restricted_context = context_system::instance();
|
||||
|
||||
if (!$this->username) {
|
||||
throw new moodle_exception('missingusername', 'webservice');
|
||||
@ -860,7 +860,7 @@ abstract class webservice_server implements webservice_server_interface {
|
||||
}
|
||||
|
||||
//Non admin can not authenticate if maintenance mode
|
||||
$hassiteconfig = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM), $user);
|
||||
$hassiteconfig = has_capability('moodle/site:config', context_system::instance(), $user);
|
||||
if (!empty($CFG->maintenance_enabled) and !$hassiteconfig) {
|
||||
throw new moodle_exception('sitemaintenance', 'admin');
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ $webservicelib = new webservice();
|
||||
$authenticationinfo = $webservicelib->authenticate_user($token);
|
||||
|
||||
// check the user can manage his own files (can upload)
|
||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$context = context_user::instance($USER->id);
|
||||
require_capability('moodle/user:manageownfiles', $context);
|
||||
|
||||
$fs = get_file_storage();
|
||||
|
@ -29,7 +29,7 @@ require($CFG->dirroot . '/webservice/lib.php');
|
||||
require_login();
|
||||
require_sesskey();
|
||||
|
||||
$usercontext = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
$tokenid = required_param('id', PARAM_INT);
|
||||
|
||||
// PAGE settings
|
||||
|
Loading…
x
Reference in New Issue
Block a user