Fix curly brace syntax. PHP 7.3 deprecations in inc/ directory.

This commit is contained in:
Syntaxseed 2019-10-30 19:03:45 -04:00 committed by Andreas Gohr
parent 1fd2aeba4d
commit 2401f18d30
15 changed files with 61 additions and 61 deletions

View File

@ -73,7 +73,7 @@ class Resendpwd extends AbstractAclAction {
if($token) {
// we're in token phase - get user info from token
$tfile = $conf['cachedir'] . '/' . $token{0} . '/' . $token . '.pwauth';
$tfile = $conf['cachedir'] . '/' . $token[0] . '/' . $token . '.pwauth';
if(!file_exists($tfile)) {
msg($lang['resendpwdbadauth'], -1);
$INPUT->remove('pwauth');
@ -148,7 +148,7 @@ class Resendpwd extends AbstractAclAction {
// generate auth token
$token = md5(auth_randombytes(16)); // random secret
$tfile = $conf['cachedir'] . '/' . $token{0} . '/' . $token . '.pwauth';
$tfile = $conf['cachedir'] . '/' . $token[0] . '/' . $token . '.pwauth';
$url = wl('', array('do' => 'resendpwd', 'pwauth' => $token), true, '&');
io_saveFile($tfile, $user);

View File

@ -116,7 +116,7 @@ class LegacyForm extends Form {
$control = array();
foreach($legacy as $key => $val) {
if($key{0} == '_') {
if($key[0] == '_') {
$control[substr($key, 1)] = $val;
} elseif($key == 'name') {
$control[$key] = $val;

View File

@ -414,7 +414,7 @@ class JpegMeta {
// make sure datetimes are in correct format
if(strlen($field) >= 8 && strtolower(substr($field, 0, 8)) == 'datetime') {
if(strlen($value) < 8 || $value{4} != ':' || $value{7} != ':') {
if(strlen($value) < 8 || $value[4] != ':' || $value[7] != ':') {
$value = date('Y:m:d H:i:s', strtotime($value));
}
}
@ -649,8 +649,8 @@ class JpegMeta {
$dates['ExifDateTime'] = $this->_info['exif']['DateTime'];
$aux = $this->_info['exif']['DateTime'];
$aux{4} = "-";
$aux{7} = "-";
$aux[4] = "-";
$aux[7] = "-";
$t = strtotime($aux);
if ($t && $t > $latestTime) {
@ -668,8 +668,8 @@ class JpegMeta {
$dates['ExifDateTimeOriginal'] = $this->_info['exif']['DateTime'];
$aux = $this->_info['exif']['DateTimeOriginal'];
$aux{4} = "-";
$aux{7} = "-";
$aux[4] = "-";
$aux[7] = "-";
$t = strtotime($aux);
if ($t && $t > $latestTime) {
@ -687,8 +687,8 @@ class JpegMeta {
$dates['ExifDateTimeDigitized'] = $this->_info['exif']['DateTime'];
$aux = $this->_info['exif']['DateTimeDigitized'];
$aux{4} = "-";
$aux{7} = "-";
$aux[4] = "-";
$aux[7] = "-";
$t = strtotime($aux);
if ($t && $t > $latestTime) {
@ -2402,7 +2402,7 @@ class JpegMeta {
$pos += 1;
$header = '';
for ($i = 0; $i < $strlen; $i++) {
$header .= $data{$pos + $i};
$header .= $data[$pos + $i];
}
$pos += $strlen + 1 - ($strlen % 2); // The string is padded to even length, counting the length byte itself
@ -2983,7 +2983,7 @@ class JpegMeta {
* @return int
*/
function _getByte(&$data, $pos) {
return ord($data{$pos});
return ord($data[$pos]);
}
/*************************************************************/
@ -2999,7 +2999,7 @@ class JpegMeta {
function _putByte(&$data, $pos, $val) {
$val = intval($val);
$data{$pos} = chr($val);
$data[$pos] = chr($val);
return $pos + 1;
}
@ -3007,11 +3007,11 @@ class JpegMeta {
/*************************************************************/
function _getShort(&$data, $pos, $bigEndian = true) {
if ($bigEndian) {
return (ord($data{$pos}) << 8)
+ ord($data{$pos + 1});
return (ord($data[$pos]) << 8)
+ ord($data[$pos + 1]);
} else {
return ord($data{$pos})
+ (ord($data{$pos + 1}) << 8);
return ord($data[$pos])
+ (ord($data[$pos + 1]) << 8);
}
}
@ -3020,11 +3020,11 @@ class JpegMeta {
$val = intval($val);
if ($bigEndian) {
$data{$pos + 0} = chr(($val & 0x0000FF00) >> 8);
$data{$pos + 1} = chr(($val & 0x000000FF) >> 0);
$data[$pos + 0] = chr(($val & 0x0000FF00) >> 8);
$data[$pos + 1] = chr(($val & 0x000000FF) >> 0);
} else {
$data{$pos + 0} = chr(($val & 0x00FF) >> 0);
$data{$pos + 1} = chr(($val & 0xFF00) >> 8);
$data[$pos + 0] = chr(($val & 0x00FF) >> 0);
$data[$pos + 1] = chr(($val & 0xFF00) >> 8);
}
return $pos + 2;
@ -3042,15 +3042,15 @@ class JpegMeta {
*/
function _getLong(&$data, $pos, $bigEndian = true) {
if ($bigEndian) {
return (ord($data{$pos}) << 24)
+ (ord($data{$pos + 1}) << 16)
+ (ord($data{$pos + 2}) << 8)
+ ord($data{$pos + 3});
return (ord($data[$pos]) << 24)
+ (ord($data[$pos + 1]) << 16)
+ (ord($data[$pos + 2]) << 8)
+ ord($data[$pos + 3]);
} else {
return ord($data{$pos})
+ (ord($data{$pos + 1}) << 8)
+ (ord($data{$pos + 2}) << 16)
+ (ord($data{$pos + 3}) << 24);
return ord($data[$pos])
+ (ord($data[$pos + 1]) << 8)
+ (ord($data[$pos + 2]) << 16)
+ (ord($data[$pos + 3]) << 24);
}
}
@ -3069,15 +3069,15 @@ class JpegMeta {
$val = intval($val);
if ($bigEndian) {
$data{$pos + 0} = chr(($val & 0xFF000000) >> 24);
$data{$pos + 1} = chr(($val & 0x00FF0000) >> 16);
$data{$pos + 2} = chr(($val & 0x0000FF00) >> 8);
$data{$pos + 3} = chr(($val & 0x000000FF) >> 0);
$data[$pos + 0] = chr(($val & 0xFF000000) >> 24);
$data[$pos + 1] = chr(($val & 0x00FF0000) >> 16);
$data[$pos + 2] = chr(($val & 0x0000FF00) >> 8);
$data[$pos + 3] = chr(($val & 0x000000FF) >> 0);
} else {
$data{$pos + 0} = chr(($val & 0x000000FF) >> 0);
$data{$pos + 1} = chr(($val & 0x0000FF00) >> 8);
$data{$pos + 2} = chr(($val & 0x00FF0000) >> 16);
$data{$pos + 3} = chr(($val & 0xFF000000) >> 24);
$data[$pos + 0] = chr(($val & 0x000000FF) >> 0);
$data[$pos + 1] = chr(($val & 0x0000FF00) >> 8);
$data[$pos + 2] = chr(($val & 0x00FF0000) >> 16);
$data[$pos + 3] = chr(($val & 0xFF000000) >> 24);
}
return $pos + 4;
@ -3089,10 +3089,10 @@ class JpegMeta {
$max = strlen($data);
while ($pos < $max) {
if (ord($data{$pos}) == 0) {
if (ord($data[$pos]) == 0) {
return $str;
} else {
$str .= $data{$pos};
$str .= $data[$pos];
}
$pos++;
}
@ -3114,7 +3114,7 @@ class JpegMeta {
function _putString(&$data, $pos, &$str) {
$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
$data{$pos + $i} = $str{$i};
$data[$pos + $i] = $str[$i];
}
return $pos + $len;
@ -3138,7 +3138,7 @@ class JpegMeta {
echo sprintf('%04d', $count) . ': ';
}
$c = ord($data{$start});
$c = ord($data[$start]);
$count++;
$start++;

View File

@ -206,7 +206,7 @@ class PassHash {
$text .= substr($bin, 0, min(16, $i));
}
for($i = $len; $i > 0; $i >>= 1) {
$text .= ($i & 1) ? chr(0) : $clear{0};
$text .= ($i & 1) ? chr(0) : $clear[0];
}
$bin = pack("H32", md5($text));
for($i = 0; $i < 1000; $i++) {

View File

@ -65,8 +65,8 @@ class Clean
$ascii = '';
$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
if (ord($str{$i}) < 128) {
$ascii .= $str{$i};
if (ord($str[$i]) < 128) {
$ascii .= $str[$i];
}
}
return $ascii;

View File

@ -46,7 +46,7 @@ class Unicode
for ($i = 0; $i < $len; $i++) {
$in = ord($str{$i});
$in = ord($str[$i]);
if ($mState === 0) {

View File

@ -139,7 +139,7 @@ function auth_loadACL() {
$out = array();
foreach($acl as $line) {
$line = trim($line);
if(empty($line) || ($line{0} == '#')) continue; // skip blank lines & comments
if(empty($line) || ($line[0] == '#')) continue; // skip blank lines & comments
list($id,$rest) = preg_split('/[ \t]+/',$line,2);
// substitute user wildcard first (its 1:1)
@ -737,7 +737,7 @@ function auth_nameencode($name, $skip_group = false) {
if($name == '%GROUP%') return $name;
if(!isset($cache[$name][$skip_group])) {
if($skip_group && $name{0} == '@') {
if($skip_group && $name[0] == '@') {
$cache[$name][$skip_group] = '@'.preg_replace_callback(
'/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/',
'auth_nameencode_callback', substr($name, 1)
@ -1076,7 +1076,7 @@ function act_resendpwd() {
if($token) {
// we're in token phase - get user info from token
$tfile = $conf['cachedir'].'/'.$token{0}.'/'.$token.'.pwauth';
$tfile = $conf['cachedir'].'/'.$token[0].'/'.$token.'.pwauth';
if(!file_exists($tfile)) {
msg($lang['resendpwdbadauth'], -1);
$INPUT->remove('pwauth');
@ -1151,7 +1151,7 @@ function act_resendpwd() {
// generate auth token
$token = md5(auth_randombytes(16)); // random secret
$tfile = $conf['cachedir'].'/'.$token{0}.'/'.$token.'.pwauth';
$tfile = $conf['cachedir'].'/'.$token[0].'/'.$token.'.pwauth';
$url = wl('', array('do'=> 'resendpwd', 'pwauth'=> $token), true, '&');
io_saveFile($tfile, $user);

View File

@ -402,13 +402,13 @@ class DokuCLI_Options {
}
// first non-option
if($arg{0} != '-') {
if($arg[0] != '-') {
$non_opts = array_merge($non_opts, array_slice($this->args, $i));
break;
}
// long option
if(strlen($arg) > 1 && $arg{1} == '-') {
if(strlen($arg) > 1 && $arg[1] == '-') {
list($opt, $val) = explode('=', substr($arg, 2), 2);
if(!isset($this->setup[$this->command]['opts'][$opt])) {

View File

@ -370,7 +370,7 @@ function buildAttributes($params, $skipempty = false) {
$url = '';
$white = false;
foreach($params as $key => $val) {
if($key{0} == '_') continue;
if($key[0] == '_') continue;
if($val === '' && $skipempty) continue;
if($white) $url .= ' ';

View File

@ -1585,7 +1585,7 @@ function html_insert_softbreaks($diffhtml) {
*/
function html_softbreak_callback($match){
// if match is an html tag, return it intact
if ($match[0]{0} == '<') return $match[0];
if ($match[0][0] == '<') return $match[0];
// its a long string without a breaking character,
// make certain characters into breaking characters by inserting a

View File

@ -576,7 +576,7 @@ function fullpath($path,$exists=false){
$iswin = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' || !empty($GLOBALS['DOKU_UNITTEST_ASSUME_WINDOWS']));
// find the (indestructable) root of the path - keeps windows stuff intact
if($path{0} == '/'){
if($path[0] == '/'){
$root = '/';
}elseif($iswin){
// match drive letter and UNC paths

View File

@ -308,7 +308,7 @@ function mail_quotedprintable_encode($sText,$maxlen=74,$bEmulate_imap_8bit=true)
// encode x09,x20 at lineends
{
$iLength = strlen($sLine);
$iLastChar = ord($sLine{$iLength-1});
$iLastChar = ord($sLine[$iLength-1]);
// !!!!!!!!
// imap_8_bit does not encode x20 at the very end of a text,
@ -317,7 +317,7 @@ function mail_quotedprintable_encode($sText,$maxlen=74,$bEmulate_imap_8bit=true)
// or comment next line for RFC2045 conformance, if you like
if (!($bEmulate_imap_8bit && ($i==count($aLines)-1))){
if (($iLastChar==0x09)||($iLastChar==0x20)) {
$sLine{$iLength-1}='=';
$sLine[$iLength-1]='=';
$sLine .= ($iLastChar==0x09)?'09':'20';
}
}

View File

@ -464,7 +464,7 @@ function resolve_id($ns,$id,$clean=true){
// if the id starts with a dot we need to handle the
// relative stuff
if($id && $id{0} == '.'){
if($id && $id[0] == '.'){
// normalize initial dots without a colon
$id = preg_replace('/^(\.+)(?=[^:\.])/','\1:',$id);
// prepend the current namespace
@ -619,7 +619,7 @@ function resolve_pageid($ns,&$page,&$exists,$rev='',$date_at=false ){
function getCacheName($data,$ext=''){
global $conf;
$md5 = md5($data);
$file = $conf['cachedir'].'/'.$md5{0}.'/'.$md5.$ext;
$file = $conf['cachedir'].'/'.$md5[0].'/'.$md5.$ext;
io_makeFileDir($file);
return $file;
}

View File

@ -863,7 +863,7 @@ abstract class Doku_Renderer extends Plugin {
//use placeholders
$url = str_replace('{URL}', rawurlencode($reference), $url);
//wiki names will be cleaned next, otherwise urlencode unsafe chars
$url = str_replace('{NAME}', ($url{0} === ':') ? $reference :
$url = str_replace('{NAME}', ($url[0] === ':') ? $reference :
preg_replace_callback('/[[\\\\\]^`{|}#%]/', function($match) {
return rawurlencode($match[0]);
}, $reference), $url);
@ -885,7 +885,7 @@ abstract class Doku_Renderer extends Plugin {
$url = $url.rawurlencode($reference);
}
//handle as wiki links
if($url{0} === ':') {
if($url[0] === ':') {
$urlparam = null;
$id = $url;
if (strpos($url, '?') !== false) {

View File

@ -680,7 +680,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$this->doc .= '</a></dt>'.DOKU_LF.'<dd>';
}
if($text{0} == "\n") {
if($text[0] == "\n") {
$text = substr($text, 1);
}
if(substr($text, -1) == "\n") {