Skip to content

Commit

Permalink
Merge branch 'MDL-66965' of https://github.com/stronk7/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
snake committed Oct 29, 2019
2 parents b57c47c + 88d29a1 commit 72a5ab2
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.
12 changes: 6 additions & 6 deletions backup/cc/cc_lib/gral_lib/pathutils.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ function stripUrl($path, $rootDir='') {
*/
function toNativePath(&$path) {
for ($count = 0 ; $count < strlen($path); ++$count) {
$chr = $path{$count};
$chr = $path[$count];
if (($chr == '\\') || ($chr == '/')) {
$path{$count} = '/';
$path[$count] = '/';
}
}
}
Expand All @@ -104,9 +104,9 @@ function toNativePath(&$path) {
*/
function toNativePath2(&$path) {
for ($count = 0 ; $count < strlen($path); ++$count) {
$chr = $path{$count};
$chr = $path[$count];
if (($chr == '\\') || ($chr == '/')) {
$path{$count} = DIRECTORY_SEPARATOR;
$path[$count] = DIRECTORY_SEPARATOR;
}
}
}
Expand All @@ -118,9 +118,9 @@ function toNativePath2(&$path) {
*/
function toUrlPath(&$path) {
for ($count = 0 ; $count < strlen($path); ++$count) {
$chr = $path{$count};
$chr = $path[$count];
if (($chr == '\\')) {
$path{$count} = '/';
$path[$count] = '/';
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion draftfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
// relative path must start with '/'
if (!$relativepath) {
print_error('invalidargorconf');
} else if ($relativepath{0} != '/') {
} else if ($relativepath[0] != '/') {
print_error('pathdoesnotstartslash');
}

Expand Down
2 changes: 1 addition & 1 deletion enrol/ldap/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public function sync_enrolments(progress_trace $trace, $onecourse = null) {
$ignorehidden = $this->get_config('ignorehiddencourses');
foreach($flat_records as $course) {
$course = array_change_key_case($course, CASE_LOWER);
$idnumber = $course{$this->config->course_idnumber}[0];
$idnumber = $course[$this->config->course_idnumber][0];
$trace->output(get_string('synccourserole', 'enrol_ldap', array('idnumber'=>$idnumber, 'role_shortname'=>$role->shortname)));

// Does the course exist in moodle already?
Expand Down
2 changes: 1 addition & 1 deletion file.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
// relative path must start with '/', because of backup/restore!!!
if (!$relativepath) {
print_error('invalidargorconf');
} else if ($relativepath{0} != '/') {
} else if ($relativepath[0] != '/') {
print_error('pathdoesnotstartslash');
}

Expand Down
8 changes: 4 additions & 4 deletions lib/classes/text.php
Original file line number Diff line number Diff line change
Expand Up @@ -721,19 +721,19 @@ public static function utf8ord($utf8char) {
if ($utf8char == '') {
return 0;
}
$ord0 = ord($utf8char{0});
$ord0 = ord($utf8char[0]);
if ($ord0 >= 0 && $ord0 <= 127) {
return $ord0;
}
$ord1 = ord($utf8char{1});
$ord1 = ord($utf8char[1]);
if ($ord0 >= 192 && $ord0 <= 223) {
return ($ord0 - 192) * 64 + ($ord1 - 128);
}
$ord2 = ord($utf8char{2});
$ord2 = ord($utf8char[2]);
if ($ord0 >= 224 && $ord0 <= 239) {
return ($ord0 - 224) * 4096 + ($ord1 - 128) * 64 + ($ord2 - 128);
}
$ord3 = ord($utf8char{3});
$ord3 = ord($utf8char[3]);
if ($ord0 >= 240 && $ord0 <= 247) {
return ($ord0 - 240) * 262144 + ($ord1 - 128 )* 4096 + ($ord2 - 128) * 64 + ($ord3 - 128);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -5734,7 +5734,7 @@ function moodle_process_email($modargs, $body) {
global $DB;

// The first char should be an unencoded letter. We'll take this as an action.
switch ($modargs{0}) {
switch ($modargs[0]) {
case 'B': { // Bounce.
list(, $userid) = unpack('V', base64_decode(substr($modargs, 1, 8)));
if ($user = $DB->get_record("user", array('id' => $userid), "id,email")) {
Expand Down
6 changes: 3 additions & 3 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2978,10 +2978,10 @@ function obfuscate_email($email) {
$length = strlen($email);
$obfuscated = '';
while ($i < $length) {
if (rand(0, 2) && $email{$i}!='@') { // MDL-20619 some browsers have problems unobfuscating @.
$obfuscated.='%'.dechex(ord($email{$i}));
if (rand(0, 2) && $email[$i]!='@') { // MDL-20619 some browsers have problems unobfuscating @.
$obfuscated.='%'.dechex(ord($email[$i]));
} else {
$obfuscated.=$email{$i};
$obfuscated.=$email[$i];
}
$i++;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/wiki_to_markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function do_list( $line, $blank=false ) {
$count = 0;
}
else {
$listchar = $line{0};
$listchar = $line[0];
$count = strspn( $line, $listchar );
$line = preg_replace( "/^[".$listchar."]+ /i", "", $line );
}
Expand Down
4 changes: 2 additions & 2 deletions mod/quiz/report/statistics/tests/statistics_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ public function get_fields_from_csv($line) {
$cnt = count($items);
for ($key = 0; $key < $cnt; $key++) {
if ($items[$key]!='') {
if ($start = ($items[$key]{0}=='"')) {
if ($start = ($items[$key][0]=='"')) {
$items[$key] = substr($items[$key], 1);
while (!$end = ($items[$key]{strlen($items[$key])-1}=='"')) {
while (!$end = ($items[$key][strlen($items[$key])-1]=='"')) {
$item = $items[$key];
unset($items[$key]);
$key++;
Expand Down
2 changes: 1 addition & 1 deletion question/engine/questionusage.php
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ public function prepare_simulated_post_data($simulatedresponses) {
// Behaviour vars should not be processed by question type, just add prefix.
$behaviourvars = $this->get_question_attempt($slot)->get_behaviour()->get_expected_data();
foreach (array_keys($responsedata) as $responsedatakey) {
if ($responsedatakey{0} === '-') {
if ($responsedatakey[0] === '-') {
$behaviourvarname = substr($responsedatakey, 1);
if (isset($behaviourvars[$behaviourvarname])) {
// Expected behaviour var found.
Expand Down
2 changes: 1 addition & 1 deletion question/format/gift/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public function readquestion($lines) {
} else if ($answertext == '') {
$question->qtype = 'essay';

} else if ($answertext{0} == '#') {
} else if ($answertext[0] == '#') {
$question->qtype = 'numerical';

} else if (strpos($answertext, '~') !== false) {
Expand Down

0 comments on commit 72a5ab2

Please sign in to comment.