Skip to content

Commit

Permalink
Merge branch 'MDL-35198-MOODLE_22_STABLE' of git://github.com/mouneyr…
Browse files Browse the repository at this point in the history
…ac/moodle into MOODLE_22_STABLE
  • Loading branch information
Sam Hemelryk committed Oct 16, 2012
2 parents cecd632 + 71daa4a commit d270f6c
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion admin/webservice/service_users.php
Expand Up @@ -97,7 +97,7 @@


//add the missing capabilities to the allowed users object to be displayed by renderer //add the missing capabilities to the allowed users object to be displayed by renderer
foreach ($allowedusers as &$alloweduser) { foreach ($allowedusers as &$alloweduser) {
if (!is_siteadmin($alloweduser->id) and key_exists($alloweduser->id, $usersmissingcaps)) { if (!is_siteadmin($alloweduser->id) and array_key_exists($alloweduser->id, $usersmissingcaps)) {
$alloweduser->missingcapabilities = implode(', ', $usersmissingcaps[$alloweduser->id]); $alloweduser->missingcapabilities = implode(', ', $usersmissingcaps[$alloweduser->id]);
} }
} }
Expand Down
2 changes: 1 addition & 1 deletion blocks/community/forms.php
Expand Up @@ -140,7 +140,7 @@ public function definition() {
$options = array(); $options = array();
$firsthub = false; $firsthub = false;
foreach ($hubs as $hub) { foreach ($hubs as $hub) {
if (key_exists('id', $hub)) { if (array_key_exists('id', $hub)) {
$params = array('hubid' => $hub['id'], $params = array('hubid' => $hub['id'],
'filetype' => HUB_HUBSCREENSHOT_FILE_TYPE); 'filetype' => HUB_HUBSCREENSHOT_FILE_TYPE);
$imgurl = new moodle_url(HUB_HUBDIRECTORYURL . $imgurl = new moodle_url(HUB_HUBDIRECTORYURL .
Expand Down
10 changes: 5 additions & 5 deletions course/externallib.php
Expand Up @@ -267,7 +267,7 @@ public static function get_courses($options = array()) {
array('options' => $options)); array('options' => $options));


//retrieve courses //retrieve courses
if (!key_exists('ids', $params['options']) if (!array_key_exists('ids', $params['options'])
or empty($params['options']['ids'])) { or empty($params['options']['ids'])) {
$courses = $DB->get_records('course'); $courses = $DB->get_records('course');
} else { } else {
Expand Down Expand Up @@ -504,13 +504,13 @@ public static function create_courses($courses) {
require_capability('moodle/course:create', $context); require_capability('moodle/course:create', $context);


// Make sure lang is valid // Make sure lang is valid
if (key_exists('lang', $course) and empty($availablelangs[$course['lang']])) { if (array_key_exists('lang', $course) and empty($availablelangs[$course['lang']])) {
throw new moodle_exception( throw new moodle_exception(
get_string('errorinvalidparam', 'webservice', 'lang')); get_string('errorinvalidparam', 'webservice', 'lang'));
} }


// Make sure theme is valid // Make sure theme is valid
if (key_exists('forcetheme', $course)) { if (array_key_exists('forcetheme', $course)) {
if (!empty($CFG->allowcoursethemes)) { if (!empty($CFG->allowcoursethemes)) {
if (empty($availablethemes[$course['forcetheme']])) { if (empty($availablethemes[$course['forcetheme']])) {
throw new moodle_exception( throw new moodle_exception(
Expand All @@ -530,10 +530,10 @@ public static function create_courses($courses) {
//set default value for completion //set default value for completion
$courseconfig = get_config('moodlecourse'); $courseconfig = get_config('moodlecourse');
if (completion_info::is_enabled_for_site()) { if (completion_info::is_enabled_for_site()) {
if (!key_exists('enablecompletion', $course)) { if (!array_key_exists('enablecompletion', $course)) {
$course['enablecompletion'] = $courseconfig->enablecompletion; $course['enablecompletion'] = $courseconfig->enablecompletion;
} }
if (!key_exists('completionstartonenrol', $course)) { if (!array_key_exists('completionstartonenrol', $course)) {
$course['completionstartonenrol'] = $courseconfig->completionstartonenrol; $course['completionstartonenrol'] = $courseconfig->completionstartonenrol;
} }
} else { } else {
Expand Down
4 changes: 2 additions & 2 deletions enrol/externallib.php
Expand Up @@ -371,7 +371,7 @@ public static function assign_roles($assignments) {
// throw an exception if user is not able to assign the role in this context // throw an exception if user is not able to assign the role in this context
$roles = get_assignable_roles($context, ROLENAME_SHORT); $roles = get_assignable_roles($context, ROLENAME_SHORT);


if (!key_exists($assignment['roleid'], $roles)) { if (!array_key_exists($assignment['roleid'], $roles)) {
throw new invalid_parameter_exception('Can not assign roleid='.$assignment['roleid'].' in contextid='.$assignment['contextid']); throw new invalid_parameter_exception('Can not assign roleid='.$assignment['roleid'].' in contextid='.$assignment['contextid']);
} }


Expand Down Expand Up @@ -433,7 +433,7 @@ public static function unassign_roles($unassignments) {


// throw an exception if user is not able to unassign the role in this context // throw an exception if user is not able to unassign the role in this context
$roles = get_assignable_roles($context, ROLENAME_SHORT); $roles = get_assignable_roles($context, ROLENAME_SHORT);
if (!key_exists($unassignment['roleid'], $roles)) { if (!array_key_exists($unassignment['roleid'], $roles)) {
throw new invalid_parameter_exception('Can not unassign roleid='.$unassignment['roleid'].' in contextid='.$unassignment['contextid']); throw new invalid_parameter_exception('Can not unassign roleid='.$unassignment['roleid'].' in contextid='.$unassignment['contextid']);
} }


Expand Down
2 changes: 1 addition & 1 deletion enrol/manual/externallib.php
Expand Up @@ -90,7 +90,7 @@ public static function enrol_users($enrolments) {


//throw an exception if user is not able to assign the role //throw an exception if user is not able to assign the role
$roles = get_assignable_roles($context); $roles = get_assignable_roles($context);
if (!key_exists($enrolment['roleid'], $roles)) { if (!array_key_exists($enrolment['roleid'], $roles)) {
$errorparams = new stdClass(); $errorparams = new stdClass();
$errorparams->roleid = $enrolment['roleid']; $errorparams->roleid = $enrolment['roleid'];
$errorparams->courseid = $enrolment['courseid']; $errorparams->courseid = $enrolment['courseid'];
Expand Down
2 changes: 1 addition & 1 deletion lib/adminlib.php
Expand Up @@ -7584,7 +7584,7 @@ public function output_html($data, $query='') {
array(array('id' => $token->userid)), $token->serviceid); array(array('id' => $token->userid)), $token->serviceid);


if (!is_siteadmin($token->userid) and if (!is_siteadmin($token->userid) and
key_exists($token->userid, $usermissingcaps)) { array_key_exists($token->userid, $usermissingcaps)) {
$missingcapabilities = implode(', ', $missingcapabilities = implode(', ',
$usermissingcaps[$token->userid]); $usermissingcaps[$token->userid]);
if (!empty($missingcapabilities)) { if (!empty($missingcapabilities)) {
Expand Down
4 changes: 2 additions & 2 deletions lib/upgradelib.php
Expand Up @@ -877,7 +877,7 @@ function external_update_descriptions($component) {
$dbfunction->classpath = $function['classpath']; $dbfunction->classpath = $function['classpath'];
$update = true; $update = true;
} }
$functioncapabilities = key_exists('capabilities', $function)?$function['capabilities']:''; $functioncapabilities = array_key_exists('capabilities', $function)?$function['capabilities']:'';
if ($dbfunction->capabilities != $functioncapabilities) { if ($dbfunction->capabilities != $functioncapabilities) {
$dbfunction->capabilities = $functioncapabilities; $dbfunction->capabilities = $functioncapabilities;
$update = true; $update = true;
Expand All @@ -893,7 +893,7 @@ function external_update_descriptions($component) {
$dbfunction->methodname = $function['methodname']; $dbfunction->methodname = $function['methodname'];
$dbfunction->classpath = empty($function['classpath']) ? null : $function['classpath']; $dbfunction->classpath = empty($function['classpath']) ? null : $function['classpath'];
$dbfunction->component = $component; $dbfunction->component = $component;
$dbfunction->capabilities = key_exists('capabilities', $function)?$function['capabilities']:''; $dbfunction->capabilities = array_key_exists('capabilities', $function)?$function['capabilities']:'';
$dbfunction->id = $DB->insert_record('external_functions', $dbfunction); $dbfunction->id = $DB->insert_record('external_functions', $dbfunction);
} }
unset($functions); unset($functions);
Expand Down
2 changes: 1 addition & 1 deletion webservice/lib.php
Expand Up @@ -511,7 +511,7 @@ public function get_missing_capabilities_by_users($users, $serviceid) {
//detect the missing capabilities //detect the missing capabilities
foreach ($servicecaps as $functioname => $functioncaps) { foreach ($servicecaps as $functioname => $functioncaps) {
foreach ($functioncaps as $functioncap) { foreach ($functioncaps as $functioncap) {
if (!key_exists($functioncap, $usercaps)) { if (!array_key_exists($functioncap, $usercaps)) {
if (!isset($usersmissingcaps[$user->id]) if (!isset($usersmissingcaps[$user->id])
or array_search($functioncap, $usersmissingcaps[$user->id]) === false) { or array_search($functioncap, $usersmissingcaps[$user->id]) === false) {
$usersmissingcaps[$user->id][] = $functioncap; $usersmissingcaps[$user->id][] = $functioncap;
Expand Down
6 changes: 3 additions & 3 deletions webservice/simpletest/testwebservice.php
Expand Up @@ -448,15 +448,15 @@ function moodle_course_get_courses($client) {
$dbcourses[$course['id']]->timecreated); $dbcourses[$course['id']]->timecreated);
$this->assertEqual($course['timemodified'], $this->assertEqual($course['timemodified'],
$dbcourses[$course['id']]->timemodified); $dbcourses[$course['id']]->timemodified);
if (key_exists('enablecompletion', $course)) { if (array_key_exists('enablecompletion', $course)) {
$this->assertEqual($course['enablecompletion'], $this->assertEqual($course['enablecompletion'],
$dbcourses[$course['id']]->enablecompletion); $dbcourses[$course['id']]->enablecompletion);
} }
if (key_exists('completionstartonenrol', $course)) { if (array_key_exists('completionstartonenrol', $course)) {
$this->assertEqual($course['completionstartonenrol'], $this->assertEqual($course['completionstartonenrol'],
$dbcourses[$course['id']]->completionstartonenrol); $dbcourses[$course['id']]->completionstartonenrol);
} }
if (key_exists('completionnotify', $course)) { if (array_key_exists('completionnotify', $course)) {
$this->assertEqual($course['completionnotify'], $this->assertEqual($course['completionnotify'],
$dbcourses[$course['id']]->completionnotify); $dbcourses[$course['id']]->completionnotify);
} }
Expand Down

0 comments on commit d270f6c

Please sign in to comment.