diff --git a/admin/dbperformance.php b/admin/dbperformance.php index e3080608ce1..648a2ec8c95 100644 --- a/admin/dbperformance.php +++ b/admin/dbperformance.php @@ -12,7 +12,7 @@ require_login(); - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); $strdatabaseperformance = get_string("databaseperformance"); $stradministration = get_string("administration"); diff --git a/admin/delete.php b/admin/delete.php index afc7ea9933e..55f52c8e09d 100644 --- a/admin/delete.php +++ b/admin/delete.php @@ -13,7 +13,7 @@ $sure = optional_param('sure', 0, PARAM_BOOL); $reallysure = optional_param('reallysure', 0, PARAM_BOOL); - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); $deletedir = $CFG->dataroot; // The directory to delete! diff --git a/admin/health.php b/admin/health.php index 4ad667da05c..e9fe728ed77 100644 --- a/admin/health.php +++ b/admin/health.php @@ -24,7 +24,7 @@ $solution = optional_param('solution', 0, PARAM_SAFEDIR); //in fact it is class name alhanumeric and _ require_login(); - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); $site = get_site(); diff --git a/admin/index.php b/admin/index.php index 3800408e829..1ed262cb73e 100644 --- a/admin/index.php +++ b/admin/index.php @@ -545,7 +545,7 @@ /// Check for valid admin user - no guest autologin require_login(0, false); - $context = get_context_instance(CONTEXT_SYSTEM, SITEID); + $context = get_context_instance(CONTEXT_SYSTEM); require_capability('moodle/site:config', $context); diff --git a/admin/innodb.php b/admin/innodb.php index 77cbe205141..e7d82ac2b44 100644 --- a/admin/innodb.php +++ b/admin/innodb.php @@ -9,7 +9,7 @@ require_login(); - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); admin_externalpage_print_header(); print_heading('Convert all MySQL tables from MYISAM to InnoDB'); diff --git a/admin/lang.php b/admin/lang.php index 84930877dfc..43157369cfc 100644 --- a/admin/lang.php +++ b/admin/lang.php @@ -14,7 +14,7 @@ admin_externalpage_setup('langedit'); - $context = get_context_instance(CONTEXT_SYSTEM, SITEID); + $context = get_context_instance(CONTEXT_SYSTEM); define('LANG_SUBMIT_REPEAT', 1); // repeat displaying submit button? define('LANG_SUBMIT_REPEAT_EVERY', 20); // if so, after how many lines? diff --git a/admin/pagelib.php b/admin/pagelib.php index 7870020e6f6..971ae09d3d3 100644 --- a/admin/pagelib.php +++ b/admin/pagelib.php @@ -51,7 +51,7 @@ class page_admin extends page_base { // seems reasonable that the only people that can edit blocks on the admin pages // are the admins... but maybe we want a role for this? function user_allowed_editing() { - return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID)); + return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM)); } // has to be fixed. i know there's a "proper" way to do this diff --git a/admin/register.php b/admin/register.php index bb0ce172665..f213c6322ed 100644 --- a/admin/register.php +++ b/admin/register.php @@ -5,7 +5,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 (!$site = get_site()) { redirect("index.php"); diff --git a/admin/report/backups/index.php b/admin/report/backups/index.php index 4591676982a..a332670fc0e 100644 --- a/admin/report/backups/index.php +++ b/admin/report/backups/index.php @@ -11,7 +11,7 @@ $courseid = optional_param('courseid', 0, PARAM_INT); - require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM)); /// Scheduled backups are disabled by the server admin if (!empty($CFG->disablescheduledbackups)) { diff --git a/admin/report/courseoverview/index.php b/admin/report/courseoverview/index.php index 7bbd95c4911..3977d3ab969 100644 --- a/admin/report/courseoverview/index.php +++ b/admin/report/courseoverview/index.php @@ -12,7 +12,7 @@ $time = optional_param('time', 0, PARAM_INT); $numcourses = optional_param('numcourses', 20, PARAM_INT); - require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID)); // needed? + require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM)); // needed? if (empty($CFG->enablestats)) { redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3); diff --git a/admin/report/simpletest/index.php b/admin/report/simpletest/index.php index 974966e4196..635a7f66f14 100644 --- a/admin/report/simpletest/index.php +++ b/admin/report/simpletest/index.php @@ -17,7 +17,7 @@ require_once('ex_simple_test.php'); require_once('ex_reporter.php'); require_login(); -require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); +require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); /* The UNITTEST constant can be checked elsewhere if you need to know * when your code is being run as part of a unit test. */ diff --git a/admin/roles/allowassign.php b/admin/roles/allowassign.php index 0827a6a1b4c..5657b0a230c 100755 --- a/admin/roles/allowassign.php +++ b/admin/roles/allowassign.php @@ -13,7 +13,7 @@ admin_externalpage_setup('defineroles'); - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); require_capability('moodle/role:manage', $sitecontext); /// form processiong here diff --git a/admin/roles/allowoverride.php b/admin/roles/allowoverride.php index 17c28c68c62..4bb41fe5997 100755 --- a/admin/roles/allowoverride.php +++ b/admin/roles/allowoverride.php @@ -11,7 +11,7 @@ admin_externalpage_setup('defineroles'); - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); require_capability('moodle/role:manage', $sitecontext); /// form processiong here diff --git a/admin/stickyblocks.php b/admin/stickyblocks.php index 9c6103e8bb6..c2aefae6e9a 100644 --- a/admin/stickyblocks.php +++ b/admin/stickyblocks.php @@ -24,7 +24,7 @@ require_login(); - require_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM)); // first thing to do is print the dropdown menu diff --git a/admin/timezone.php b/admin/timezone.php index 73a9d24e6cb..94993cc644e 100644 --- a/admin/timezone.php +++ b/admin/timezone.php @@ -6,7 +6,7 @@ require_login(); - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); $strtimezone = get_string("timezone"); $strsavechanges = get_string("savechanges"); diff --git a/admin/uploadpicture.php b/admin/uploadpicture.php index e39111e1029..54aace9d457 100644 --- a/admin/uploadpicture.php +++ b/admin/uploadpicture.php @@ -32,7 +32,7 @@ admin_externalpage_setup('uploadpictures', $adminroot); require_login(); -require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM, SITEID)); +require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM)); if (!$site = get_site()) { print_error('cannotfindsite', 'error'); diff --git a/admin/xmldb/index.php b/admin/xmldb/index.php index 58964ccccf6..88ceae5a1d6 100644 --- a/admin/xmldb/index.php +++ b/admin/xmldb/index.php @@ -79,7 +79,7 @@ } require_login(); - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); /// Body of the script, based on action, we delegate the work $action = optional_param ('action', 'main_view', PARAM_ALPHAEXT); diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php index d9e89e167c4..2381ca70fe8 100644 --- a/auth/mnet/auth.php +++ b/auth/mnet/auth.php @@ -171,7 +171,7 @@ class auth_plugin_mnet extends auth_plugin_base { require_once $CFG->dirroot . '/mnet/xmlrpc/client.php'; // check remote login permissions - if (! has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM, SITEID)) + if (! has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM)) or is_mnet_remote_user($USER) or $USER->username == 'guest' or empty($USER->id)) { diff --git a/auth/shibboleth/index.php b/auth/shibboleth/index.php index e01489458cc..3cf39a78495 100644 --- a/auth/shibboleth/index.php +++ b/auth/shibboleth/index.php @@ -21,7 +21,7 @@ // Check whether Shibboleth is configured properly if (empty($pluginconfig->user_attribute)) { - error(get_string( 'shib_not_set_up_error', 'auth')); + print_error('shib_not_set_up_error', 'auth'); } /// If we can find the Shibboleth attribute, save it in session and return to main login page @@ -66,7 +66,7 @@ } /// Go to my-moodle page instead of homepage if mymoodleredirect enabled - if (!has_capability('moodle/site:config',get_context_instance(CONTEXT_SYSTEM, SITEID)) and !empty($CFG->mymoodleredirect) and !isguest()) { + if (!has_capability('moodle/site:config',get_context_instance(CONTEXT_SYSTEM)) and !empty($CFG->mymoodleredirect) and !isguest()) { if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot.'/' or $urltogo == $CFG->wwwroot.'/index.php') { $urltogo = $CFG->wwwroot.'/my/'; } @@ -88,9 +88,9 @@ // If we can find any (user independent) Shibboleth attributes but no user // attributes we probably didn't receive any user attributes elseif (!empty($_SERVER['HTTP_SHIB_APPLICATION_ID'])) { - error(get_string( 'shib_no_attributes_error', 'auth' , '\''.$pluginconfig->user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\'')); + print_error('shib_no_attributes_error', 'auth' , '', '\''.$pluginconfig->user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\''); } else { - error(get_string( 'shib_not_set_up_error', 'auth')); + print_error('shib_not_set_up_error', 'auth'); } ?> diff --git a/backup/backup_check.html b/backup/backup_check.html index 62469cc3372..f17be59115a 100644 --- a/backup/backup_check.html +++ b/backup/backup_check.html @@ -15,7 +15,7 @@ } } } else { - if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) { print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); } } diff --git a/backup/backup_execute.html b/backup/backup_execute.html index 65fada8ab77..2e754d7ab67 100644 --- a/backup/backup_execute.html +++ b/backup/backup_execute.html @@ -15,7 +15,7 @@ } } } else { - if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) { print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); } } diff --git a/backup/backuplib.php b/backup/backuplib.php index c93c72732c9..ccdaaf92cef 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -641,7 +641,7 @@ fwrite ($bf, start_tag('ROLES', 1, true)); $roles = backup_fetch_roles($preferences); - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); foreach ($roles as $role) { fwrite ($bf,start_tag('ROLE',2,true)); diff --git a/backup/log.php b/backup/log.php index 48e02509384..7ef38b1591e 100644 --- a/backup/log.php +++ b/backup/log.php @@ -6,7 +6,7 @@ require_login(); - require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM)); redirect("$CFG->wwwroot/$CFG->admin/report/backups/index.php", '', 'admin', 1); diff --git a/backup/restore.php b/backup/restore.php index 475054aba7d..37f1328fe20 100644 --- a/backup/restore.php +++ b/backup/restore.php @@ -62,7 +62,7 @@ } } } else { - if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) { print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php"); } } @@ -122,7 +122,7 @@ } //Print header - if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { $navlinks[] = array('name' => basename($file), 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); diff --git a/backup/restore_check.html b/backup/restore_check.html index 746b846dfb3..3210bd184d9 100644 --- a/backup/restore_check.html +++ b/backup/restore_check.html @@ -192,7 +192,7 @@ print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); } } else { - if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) { print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); } } diff --git a/backup/restore_execute.html b/backup/restore_execute.html index d87a8fc9d98..58757595d37 100644 --- a/backup/restore_execute.html +++ b/backup/restore_execute.html @@ -33,7 +33,7 @@ } } } else { - if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) { print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); } } diff --git a/backup/restore_precheck.html b/backup/restore_precheck.html index a63ab169380..b0e052de49d 100644 --- a/backup/restore_precheck.html +++ b/backup/restore_precheck.html @@ -25,7 +25,7 @@ } } } else { - if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) { print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); } } diff --git a/backup/restorelib.php b/backup/restorelib.php index f8b4919ff8f..0cac2801f69 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -8127,7 +8127,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); if ($CFG->creatornewroleid) { role_assign($CFG->creatornewroleid, $USER->id, 0, $newcontext->id); } else { - if ($legacyteachers = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if ($legacyteachers = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM))) { if ($legacyteacher = array_shift($legacyteachers)) { role_assign($legacyteacher->id, $USER->id, 0, $newcontext->id); } @@ -8273,7 +8273,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); } $info = restore_read_xml_roles($xmlfile); - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); // the following code creates new roles // but we could use more intelligent detection, and role mapping diff --git a/backup/try.php b/backup/try.php index a845a6c3c4d..ec4fc821d4c 100644 --- a/backup/try.php +++ b/backup/try.php @@ -7,7 +7,7 @@ require_login(); - require_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM)); //Check site if (!$site = get_site()) { diff --git a/blocks/blog_menu/block_blog_menu.php b/blocks/blog_menu/block_blog_menu.php index 6625303a026..04aed2e2e8e 100755 --- a/blocks/blog_menu/block_blog_menu.php +++ b/blocks/blog_menu/block_blog_menu.php @@ -51,7 +51,7 @@ class block_blog_menu extends block_base { $addentrylink = ''; $coursearg = ''; - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); if ($COURSE->id != SITEID) { diff --git a/blocks/blog_tags/block_blog_tags.php b/blocks/blog_tags/block_blog_tags.php index d3508888c3e..b7c6a44a92f 100644 --- a/blocks/blog_tags/block_blog_tags.php +++ b/blocks/blog_tags/block_blog_tags.php @@ -80,7 +80,7 @@ class block_blog_tags extends block_base { $sql .= 'AND p.id = ti.itemid '; // admins should be able to read all tags - if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM))) { $sql .= 'AND (p.publishstate = \'site\' or p.publishstate=\'public\') '; } $sql .= "AND ti.timemodified > {$timewithin} "; diff --git a/blocks/rss_client/block_rss_client_action.php b/blocks/rss_client/block_rss_client_action.php index 5339b7cb676..bfe3aa5eef5 100644 --- a/blocks/rss_client/block_rss_client_action.php +++ b/blocks/rss_client/block_rss_client_action.php @@ -63,7 +63,7 @@ if (!empty($id)) { $context = get_context_instance(CONTEXT_COURSE, $id); } } else { - $context = get_context_instance(CONTEXT_SYSTEM, SITEID); + $context = get_context_instance(CONTEXT_SYSTEM); } diff --git a/enrol/database/config.html b/enrol/database/config.html index 6d2bea35e92..2387823db0c 100644 --- a/enrol/database/config.html +++ b/enrol/database/config.html @@ -156,7 +156,7 @@ enrol_db_defaultcourseroleid: get_string('default')) + $assignableroles; diff --git a/enrol/imsenterprise/config.html b/enrol/imsenterprise/config.html index 73215ec2467..63b1179b56c 100644 --- a/enrol/imsenterprise/config.html +++ b/enrol/imsenterprise/config.html @@ -104,7 +104,7 @@ Photo processing is deactivated until we hear from Moodle dev forum about modifi get_string('ignore')) + $assignableroles; diff --git a/message/discussion.php b/message/discussion.php index 1ac476e9cc6..b4b66082672 100644 --- a/message/discussion.php +++ b/message/discussion.php @@ -93,7 +93,7 @@ /// Check that the user is not blocking us!! if ($contact = get_record('message_contacts', 'userid', $user->id, 'contactid', $USER->id)) { - if ($contact->blocked and !has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if ($contact->blocked and !has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM))) { print_heading(get_string('userisblockingyou', 'message')); exit; } diff --git a/message/history.php b/message/history.php index 6b9f2b4df96..0dc906c92fe 100644 --- a/message/history.php +++ b/message/history.php @@ -20,7 +20,7 @@ print_error("User ID 1 was incorrect"); } - if (has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) { // Able to see any discussion + if (has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM))) { // Able to see any discussion $userid2 = optional_param('user2', $USER->id, PARAM_INT); if (! $user2 = get_record("user", "id", $userid2)) { // Check print_error("User ID 2 was incorrect"); diff --git a/message/search.html b/message/search.html index f37fd95fcbe..0d032a641e3 100644 --- a/message/search.html +++ b/message/search.html @@ -41,7 +41,7 @@     - +   diff --git a/message/send.php b/message/send.php index 573a59744e9..4c79804779b 100644 --- a/message/send.php +++ b/message/send.php @@ -48,7 +48,7 @@ if (has_capability('moodle/site:sendmessage', get_context_instance(CONTEXT_SYSTE /// Check that the user is not blocking us!! if ($contact = get_record('message_contacts', 'userid', $user->id, 'contactid', $USER->id)) { - if ($contact->blocked and !has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if ($contact->blocked and !has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM))) { print_heading(get_string('userisblockingyou', 'message')); exit; } diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 07173dbee9d..c583f2a5a4a 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -39,7 +39,7 @@ function glossary_add_instance($glossary) { $glossary->globalglossary = 0; } - if (!has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (!has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM))) { $glossary->globalglossary = 0; } @@ -72,7 +72,7 @@ function glossary_update_instance($glossary) { $glossary->globalglossary = 0; } - if (!has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (!has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM))) { // keep previous unset($glossary->globalglossary); } @@ -558,7 +558,7 @@ function glossary_get_entries_search($concept, $courseid) { //Check if the user is an admin $bypassadmin = 1; //This means NO (by default) - if (has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_SYSTEM))) { $bypassadmin = 0; //This means YES } diff --git a/mod/glossary/mod_form.php b/mod/glossary/mod_form.php index 134b49b3458..86f0f51c28d 100644 --- a/mod/glossary/mod_form.php +++ b/mod/glossary/mod_form.php @@ -25,7 +25,7 @@ class mod_glossary_mod_form extends moodleform_mod { $mform->addRule('entbypage', null, 'required', null, 'client'); $mform->addRule('entbypage', null, 'numeric', null, 'client'); - if (has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM))) { $mform->addElement('checkbox', 'globalglossary', get_string('isglobal', 'glossary')); $mform->setHelpButton('globalglossary', array('globalglossary', get_string('globalglossary', 'glossary'), 'glossary')); diff --git a/mod/hotpot/index.php b/mod/hotpot/index.php index 88870004c43..f5722376872 100644 --- a/mod/hotpot/index.php +++ b/mod/hotpot/index.php @@ -14,7 +14,7 @@ require_login($course->id); $coursecontext = get_context_instance(CONTEXT_COURSE, $id); - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); add_to_log($course->id, "hotpot", "view all", "index.php?id=$course->id", ""); @@ -233,7 +233,7 @@ $select .= " AND a.userid='$USER->id'"; } $usejoin = 0; - if (has_capability('mod/hotpot:grade', get_context_instance(CONTEXT_SYSTEM, SITEID)) && $usejoin) { + if (has_capability('mod/hotpot:grade', get_context_instance(CONTEXT_SYSTEM)) && $usejoin) { // join attempts table and details table $tables .= ",{$CFG->prefix}hotpot_details d"; $fields .= ',COUNT(DISTINCT d.id) AS detailcount'; @@ -244,7 +244,7 @@ } $totals = get_records_sql("SELECT $fields FROM $tables WHERE $select GROUP BY a.hotpot"); - if (has_capability('mod/hotpot:grade', get_context_instance(CONTEXT_SYSTEM, SITEID)) && empty($usejoin)) { + if (has_capability('mod/hotpot:grade', get_context_instance(CONTEXT_SYSTEM)) && empty($usejoin)) { foreach ($hotpots as $hotpot) { $totals[$hotpot->id]->detailcount = 0; if ($ids = get_records('hotpot_attempts', 'hotpot', $hotpot->id)) { diff --git a/mod/hotpot/mod_form.php b/mod/hotpot/mod_form.php index e6b612905a1..2802c00ef49 100644 --- a/mod/hotpot/mod_form.php +++ b/mod/hotpot/mod_form.php @@ -61,7 +61,7 @@ class mod_hotpot_mod_form extends moodleform_mod { $mform->setType('name', PARAM_TEXT); // Location - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); if (has_capability('moodle/course:managefiles', $sitecontext)) { $site = get_site(); if ($COURSE->id==$site->id) { @@ -272,7 +272,7 @@ class mod_hotpot_mod_form extends moodleform_mod { } else { if ($data['location']==$COURSE->id) { // this is normal - } else if ($data['location']==SITEID && has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + } else if ($data['location']==SITEID && has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_SYSTEM))) { // admin can access site files } else { // location is invalid or missing, so set to default diff --git a/mod/hotpot/report.php b/mod/hotpot/report.php index d7b2c2a1f4b..4e429656734 100644 --- a/mod/hotpot/report.php +++ b/mod/hotpot/report.php @@ -32,7 +32,7 @@ } // get the roles context for this course - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); $modulecontext = get_context_instance(CONTEXT_MODULE, $cm->id); // set homeurl of couse (for error messages) diff --git a/mod/hotpot/show.php b/mod/hotpot/show.php index 23d7b1dca09..6b9761103e7 100644 --- a/mod/hotpot/show.php +++ b/mod/hotpot/show.php @@ -13,7 +13,7 @@ if (!has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $params->course))) { print_error("You are not allowed to view this page!"); } - if (has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_SYSTEM))) { $params->location = optional_param('location', HOTPOT_LOCATION_COURSEFILES, PARAM_INT); } else { $params->location = HOTPOT_LOCATION_COURSEFILES; diff --git a/mod/resource/type/ims/finder.php b/mod/resource/type/ims/finder.php index ff52cdb0eca..91ff27fa165 100644 --- a/mod/resource/type/ims/finder.php +++ b/mod/resource/type/ims/finder.php @@ -64,7 +64,7 @@ ims_print_crumbtrail($directory, $choose); /// If admin, add extra buttons - redeploy & help. - if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { echo " | ($strdeployall) "; helpbutton("deploy", get_string("deployall", "resource"), "resource", true); } @@ -96,7 +96,7 @@ } else if ($item->type == 'not deployed') { /// Only displays non-deployed IMS CP's if admin user. - if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { echo "
  • \"IMS $item->path - $strnotdeployed (path\">$strdeploy)
  • \n"; } } diff --git a/mod/resource/type/ims/repository_deploy.php b/mod/resource/type/ims/repository_deploy.php index f3509958374..8c58ead3c11 100644 --- a/mod/resource/type/ims/repository_deploy.php +++ b/mod/resource/type/ims/repository_deploy.php @@ -46,7 +46,7 @@ require_once('repository_config.php'); /// Security - Admin Only - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); $file = required_param ('file', PARAM_PATH); $all = optional_param ('all', '', PARAM_ALPHA); diff --git a/theme/chameleon/ui/chameleon.php b/theme/chameleon/ui/chameleon.php index 86b3d8c57a2..2e9b9c8b146 100644 --- a/theme/chameleon/ui/chameleon.php +++ b/theme/chameleon/ui/chameleon.php @@ -2,7 +2,7 @@ if (!empty($THEME->chameleonenabled)) { - $chameleon_isadmin = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + $chameleon_isadmin = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); $chameleon_isteacher = false; if ($COURSE->id == SITEID) { $chameleon_courseparam = ''; diff --git a/theme/chameleon/ui/css.php b/theme/chameleon/ui/css.php index 63125fbc867..258fab8e105 100644 --- a/theme/chameleon/ui/css.php +++ b/theme/chameleon/ui/css.php @@ -19,7 +19,7 @@ if ($id != SITEID and !empty($CFG->allowcoursethemes) and !empty($course->theme) if (!has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $id))) { die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme'); } -} else if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) { +} else if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme'); } diff --git a/theme/preview.php b/theme/preview.php index 64995f37016..99b89e2c993 100644 --- a/theme/preview.php +++ b/theme/preview.php @@ -14,7 +14,7 @@ require_login(); - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); $CFG->theme = $preview;