Permalink
Browse files

Merge branch 'master' of https://github.com/moodle/moodle

  • Loading branch information...
2 parents b0b6ead + 55a568f commit 2ecdfa526a1b80b66ee46fcdb77b92828a0528b9 @pcharsle pcharsle committed Jul 27, 2012
Showing 702 changed files with 6,430 additions and 49,071 deletions.
View
@@ -12,13 +12,13 @@
require_once($CFG->libdir.'/tablelib.php');
require_login();
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+require_capability('moodle/site:config', context_system::instance());
$returnurl = new moodle_url('/admin/settings.php', array('section'=>'manageauths'));
$PAGE->set_url($returnurl);
-$action = optional_param('action', '', PARAM_ACTION);
+$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$auth = optional_param('auth', '', PARAM_PLUGIN);
get_enabled_auth_plugins(true); // fix the list of enabled auths
View
@@ -32,7 +32,7 @@
/// no guest autologin
require_login(0, false);
-$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
+$PAGE->set_context(context_system::instance());
$PAGE->set_url('/admin/category.php', array('category' => $category));
$PAGE->set_pagetype('admin-setting-' . $category);
$PAGE->set_pagelayout('admin');
View
@@ -9,11 +9,11 @@
require_once($CFG->libdir.'/tablelib.php');
require_login();
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+require_capability('moodle/site:config', context_system::instance());
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageeditors";
-$action = optional_param('action', '', PARAM_ACTION);
+$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$editor = optional_param('editor', '', PARAM_PLUGIN);
// get currently installed and enabled auth plugins
View
@@ -26,15 +26,15 @@
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
-$action = required_param('action', PARAM_ACTION);
+$action = required_param('action', PARAM_ALPHANUMEXT);
$enrol = required_param('enrol', PARAM_PLUGIN);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$PAGE->set_url('/admin/enrol.php');
$PAGE->set_context(context_system::instance());
require_login();
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+require_capability('moodle/site:config', context_system::instance());
require_sesskey();
$enabled = enrol_get_plugins(true);
@@ -33,7 +33,7 @@
require_once($CFG->libdir.'/componentlib.class.php');
// Parameters
-$action = optional_param('action', '', PARAM_ACTION);
+$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$version = optional_param('version', '', PARAM_FILE); //
$extraurlparams = array();
View
@@ -34,11 +34,11 @@
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir . '/adminlib.php');
- $action = optional_param('action', '', PARAM_ACTION);
+ $action = optional_param('action', '', PARAM_ALPHANUMEXT);
$filterpath = optional_param('filterpath', '', PARAM_PATH);
require_login();
- $systemcontext = get_context_instance(CONTEXT_SYSTEM);
+ $systemcontext = context_system::instance();
require_capability('moodle/site:config', $systemcontext);
$returnurl = "$CFG->wwwroot/$CFG->admin/filters.php";
@@ -68,7 +68,7 @@
switch ($action) {
case 'setstate':
- if ($newstate = optional_param('newstate', '', PARAM_INTEGER)) {
+ if ($newstate = optional_param('newstate', '', PARAM_INT)) {
filter_set_global_state($filterpath, $newstate);
if ($newstate == TEXTFILTER_DISABLED) {
filter_set_applies_to_strings($filterpath, false);
@@ -49,7 +49,7 @@
$a->date = userdate($log->time);
$a->action = $action;
- $a->course = format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
+ $a->course = format_string($course->fullname, true, array('context' => context_course::instance($course->id)));
$a->user = fullname($user);
notify_user($user,$subject,$a);
View
@@ -104,10 +104,6 @@
print_error('withoutversion', 'debug'); // without version, stop
}
-// Turn off xmlstrictheaders during upgrade.
-$origxmlstrictheaders = !empty($CFG->xmlstrictheaders);
-$CFG->xmlstrictheaders = false;
-
if (!core_tables_exist()) {
$PAGE->set_pagelayout('maintenance');
$PAGE->set_popup_notification_allowed(false);
@@ -189,7 +185,7 @@
// and upgrade if possible.
$stradministration = get_string('administration');
-$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
+$PAGE->set_context(context_system::instance());
if (empty($CFG->version)) {
print_error('missingconfigversion', 'debug');
@@ -380,13 +376,9 @@
upgrade_finished('upgradesettings.php');
}
-// Turn xmlstrictheaders back on now.
-$CFG->xmlstrictheaders = $origxmlstrictheaders;
-unset($origxmlstrictheaders);
-
// Check for valid admin user - no guest autologin
require_login(0, false);
-$context = get_context_instance(CONTEXT_SYSTEM);
+$context = context_system::instance();
require_capability('moodle/site:config', $context);
// check that site is properly customized
View
@@ -24,11 +24,11 @@
require_once($CFG->libdir.'/licenselib.php');
require_login();
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+require_capability('moodle/site:config', context_system::instance());
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managelicenses";
-$action = optional_param('action', '', PARAM_ACTION);
+$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$license = optional_param('license', '', PARAM_SAFEDIR);
////////////////////////////////////////////////////////////////////////////////
View
@@ -29,7 +29,7 @@
admin_externalpage_setup('managemessageoutputs');
// Require site configuration capability
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+require_capability('moodle/site:config', context_system::instance());
// Get the submitted params
$disable = optional_param('disable', 0, PARAM_INT);
@@ -82,7 +82,7 @@
redirect($url);
}
// Page settings
-$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
+$PAGE->set_context(context_system::instance());
// Grab the renderer
$renderer = $PAGE->get_renderer('core', 'message');
@@ -22,7 +22,7 @@
print_error('requiresopenssl', 'mnet');
}
-$sitecontext = get_context_instance(CONTEXT_SYSTEM);
+$sitecontext = context_system::instance();
$sesskey = sesskey();
$formerror = array();
@@ -36,7 +36,7 @@
require_login();
-$context = get_context_instance(CONTEXT_SYSTEM);
+$context = context_system::instance();
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
$mnet = get_mnet_environment();
@@ -9,7 +9,7 @@
require_login();
admin_externalpage_setup('net');
- $context = get_context_instance(CONTEXT_SYSTEM);
+ $context = context_system::instance();
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
@@ -34,7 +34,7 @@
require_login();
-$context = get_context_instance(CONTEXT_SYSTEM);
+$context = context_system::instance();
require_capability('moodle/site:config', $context, $USER->id, true, 'nopermissions');
/// Initialize variables.
@@ -34,7 +34,7 @@
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
-$context = get_context_instance(CONTEXT_SYSTEM);
+$context = context_system::instance();
require_capability('moodle/site:config', $context, $USER->id, true, 'nopermissions');
admin_externalpage_setup('mnetpeers');
@@ -33,7 +33,7 @@
require_login();
admin_externalpage_setup('mnetpeers');
-$context = get_context_instance(CONTEXT_SYSTEM);
+$context = context_system::instance();
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
$hostid = required_param('hostid', PARAM_INT);
@@ -24,7 +24,7 @@
require_login();
admin_externalpage_setup('mnettestclient');
-$context = get_context_instance(CONTEXT_SYSTEM);
+$context = context_system::instance();
require_capability('moodle/site:config', $context);
error_reporting(DEBUG_ALL);
@@ -8,7 +8,7 @@
require_login();
admin_externalpage_setup('trustedhosts');
- $context = get_context_instance(CONTEXT_SYSTEM);
+ $context = context_system::instance();
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
View
@@ -49,7 +49,7 @@ function online_assignment_cleanup($output=false) {
/// cycle through each course
foreach ($courses as $course) {
context_instance_preload($course);
- $context = get_context_instance(CONTEXT_COURSE, $course->id);
+ $context = context_course::instance($course->id);
if (empty($course->fullname)) {
$fullname = get_string('course').': '.$course->id;
View
@@ -28,7 +28,7 @@
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->libdir . '/pluginlib.php');
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+require_capability('moodle/site:config', context_system::instance());
admin_externalpage_setup('pluginsoverview');
$fetchremote = optional_param('fetchremote', false, PARAM_BOOL);
View
@@ -5,7 +5,7 @@
require_once($CFG->libdir . '/portfolio/forms.php');
require_once($CFG->libdir . '/adminlib.php');
-$portfolio = optional_param('pf', '', PARAM_FORMAT);
+$portfolio = optional_param('pf', '', PARAM_ALPHANUMEXT);
$action = optional_param('action', '', PARAM_ALPHA);
$sure = optional_param('sure', '', PARAM_ALPHA);
@@ -35,7 +35,7 @@
admin_externalpage_setup($pagename);
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+require_capability('moodle/site:config', context_system::instance());
$baseurl = "$CFG->wwwroot/$CFG->admin/portfolio.php";
$sesskeyurl = "$CFG->wwwroot/$CFG->admin/portfolio.php?sesskey=" . sesskey();
@@ -31,7 +31,7 @@
admin_externalpage_setup('purgecaches');
require_login();
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+require_capability('moodle/site:config', context_system::instance());
if ($confirm) {
require_sesskey();
@@ -33,7 +33,7 @@
// Check permissions.
require_login();
-$systemcontext = get_context_instance(CONTEXT_SYSTEM);
+$systemcontext = context_system::instance();
require_capability('moodle/question:config', $systemcontext);
admin_externalpage_setup('manageqbehaviours');
View
@@ -33,7 +33,7 @@
// Check permissions.
require_login();
-$systemcontext = get_context_instance(CONTEXT_SYSTEM);
+$systemcontext = context_system::instance();
require_capability('moodle/question:config', $systemcontext);
$canviewreports = has_capability('report/questioninstances:view', $systemcontext);
@@ -203,7 +203,7 @@ public function definition() {
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
$sitename = get_config('hub', 'site_name_' . $cleanhuburl);
if ($sitename === false) {
- $sitename = format_string($site->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
+ $sitename = format_string($site->fullname, true, array('context' => context_course::instance(SITEID)));
}
$sitedescription = get_config('hub', 'site_description_' . $cleanhuburl);
if ($sitedescription === false) {
@@ -19,7 +19,7 @@
require_once($CFG->libdir . '/adminlib.php');
$repository = optional_param('repos', '', PARAM_ALPHANUMEXT);
-$action = optional_param('action', '', PARAM_ACTION);
+$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$sure = optional_param('sure', '', PARAM_ALPHA);
$downloadcontents = optional_param('downloadcontents', false, PARAM_BOOL);
@@ -47,7 +47,7 @@
$visible = false;
}
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+require_capability('moodle/site:config', context_system::instance());
admin_externalpage_setup($pagename);
$sesskeyurl = $CFG->wwwroot.'/'.$CFG->admin.'/repository.php?sesskey=' . sesskey();
@@ -28,7 +28,7 @@
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/roles/lib.php');
-$mode = required_param('mode', PARAM_ACTION);
+$mode = required_param('mode', PARAM_ALPHANUMEXT);
$classformode = array(
'assign' => 'role_allow_assign_page',
'override' => 'role_allow_override_page',
@@ -41,7 +41,7 @@
$baseurl = new moodle_url('/admin/roles/allow.php', array('mode'=>$mode));
admin_externalpage_setup('defineroles', '', array(), $baseurl);
-$syscontext = get_context_instance(CONTEXT_SYSTEM);
+$syscontext = context_system::instance();
require_capability('moodle/role:manage', $syscontext);
$controller = new $classformode[$mode]();
@@ -38,7 +38,7 @@
throw new moodle_exception('invalidaccess');
}
if ($action != 'add') {
- $roleid = required_param('roleid', PARAM_INTEGER);
+ $roleid = required_param('roleid', PARAM_INT);
} else {
$roleid = 0;
}
@@ -56,7 +56,7 @@
}
/// Check access permissions.
- $systemcontext = get_context_instance(CONTEXT_SYSTEM);
+ $systemcontext = context_system::instance();
require_login();
require_capability('moodle/role:manage', $systemcontext);
admin_externalpage_setup('defineroles', '', array('action' => $action, 'roleid' => $roleid), $defineurl);
View
@@ -604,7 +604,7 @@ public function read_submitted_permissions() {
}
// Role name.
- $name = optional_param('name', null, PARAM_MULTILANG);
+ $name = optional_param('name', null, PARAM_TEXT);
if (!is_null($name)) {
$this->role->name = $name;
// Hack: short names of standard roles are equal to archetypes, empty name means localised via lang packs.
@@ -1270,7 +1270,7 @@ public function __construct($tablename, $targetcolname) {
*/
protected function load_required_roles() {
/// Get all roles
- $this->roles = role_fix_names(get_all_roles(), get_context_instance(CONTEXT_SYSTEM), ROLENAME_ORIGINAL);
+ $this->roles = role_fix_names(get_all_roles(), context_system::instance(), ROLENAME_ORIGINAL);
}
/**
@@ -47,7 +47,7 @@
$defineurl = $CFG->wwwroot . '/' . $CFG->admin . '/roles/define.php';
/// Check access permissions.
- $systemcontext = get_context_instance(CONTEXT_SYSTEM);
+ $systemcontext = context_system::instance();
require_login();
require_capability('moodle/role:manage', $systemcontext);
admin_externalpage_setup('defineroles');
Oops, something went wrong.

0 comments on commit 2ecdfa5

Please sign in to comment.