From 4663e9dbc14017a8dba57437b3654c5ae604c5f7 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Sat, 6 Feb 2021 07:22:06 +0000 Subject: [PATCH] Stop using curly braces git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@14892 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- class/deliver/Deliver.class.php | 6 +-- class/deliver/Deliver_SMTP.class.php | 4 +- class/mime/Message.class.php | 50 ++++++++++++------------- class/mime/Rfc822Header.class.php | 30 +++++++-------- class/template/Template.class.php | 2 +- functions/strings.php | 12 +++--- plugins/mail_fetch/class.mail_fetch.php | 2 +- src/configtest.php | 2 +- 8 files changed, 54 insertions(+), 54 deletions(-) diff --git a/class/deliver/Deliver.class.php b/class/deliver/Deliver.class.php index 95ae3e25..daa52c23 100644 --- a/class/deliver/Deliver.class.php +++ b/class/deliver/Deliver.class.php @@ -892,7 +892,7 @@ class Deliver { if (!$allow_fold_after_header_name && ($header_name_end_pos = strpos($header, ':')) && strlen($header) > $header_name_end_pos + 1 - && in_array($header{$header_name_end_pos + 1}, $whitespace)) + && in_array($header[$header_name_end_pos + 1], $whitespace)) $header_name_end_pos++; // if using an indent string, reduce wrap limits by its size @@ -1073,7 +1073,7 @@ class Deliver { // if (strlen($header) > $pos + 1) { $header = substr($header, $pos + 1); - if (!in_array($header{0}, $whitespace)) + if (!in_array($header[0], $whitespace)) $header = ' ' . $indent . $header; } else { $header = ''; @@ -1098,7 +1098,7 @@ class Deliver { // if (strlen($header) > strlen($hard_wrapped_line)) { $header = substr($header, strlen($hard_wrapped_line)); - if (!in_array($header{0}, $whitespace)) + if (!in_array($header[0], $whitespace)) $header = ' ' . $indent . $header; } else { $header = ''; diff --git a/class/deliver/Deliver_SMTP.class.php b/class/deliver/Deliver_SMTP.class.php index 7f522bb5..8ba78521 100644 --- a/class/deliver/Deliver_SMTP.class.php +++ b/class/deliver/Deliver_SMTP.class.php @@ -57,7 +57,7 @@ class Deliver_SMTP extends Deliver { function preWriteToStream(&$s) { if ($s) { - if ($s{0} == '.') $s = '.' . $s; + if ($s[0] == '.') $s = '.' . $s; $s = str_replace("\n.","\n..",$s); } } @@ -408,7 +408,7 @@ class Deliver_SMTP extends Deliver { $server_msg .= substr($line, 4); } - if ( ((int) $err_num{0}) < 4) { + if ( ((int) $err_num[0]) < 4) { return false; } diff --git a/class/mime/Message.class.php b/class/mime/Message.class.php index ff8325a0..bc2545c4 100644 --- a/class/mime/Message.class.php +++ b/class/mime/Message.class.php @@ -352,7 +352,7 @@ class Message { } for ($cnt = strlen($read); $i < $cnt; ++$i) { - $char = strtoupper($read{$i}); + $char = strtoupper($read[$i]); switch ($char) { case '(': switch($arg_no) { @@ -367,7 +367,7 @@ class Message { } else { $msg->header->type0 = 'multipart'; $msg->type0 = 'multipart'; - while ($read{$i} == '(') { + while ($read[$i] == '(') { $msg->addEntity($msg->parseBodyStructure($read, $i, $msg)); } } @@ -400,7 +400,7 @@ class Message { $msg->type1 = $arg_a[1]; $rfc822_hdr = new Rfc822Header(); $msg->rfc822_header = $msg->parseEnvelope($read, $i, $rfc822_hdr); - while (($i < $cnt) && ($read{$i} != '(')) { + while (($i < $cnt) && ($read[$i] != '(')) { ++$i; } $msg->addEntity($msg->parseBodyStructure($read, $i,$msg)); @@ -463,9 +463,9 @@ class Message { ++$arg_no; break; case '0': - case is_numeric($read{$i}): + case is_numeric($read[$i]): /* process integers */ - if ($read{$i} == ' ') { break; } + if ($read[$i] == ' ') { break; } ++$arg_no; if (preg_match('/^([0-9]+).*/',substr($read,$i), $regs)) { $i += strlen($regs[1])-1; @@ -527,11 +527,11 @@ class Message { $properties = array(); $prop_name = ''; - for (; $read{$i} != ')'; ++$i) { + for (; $read[$i] != ')'; ++$i) { $arg_s = ''; - if ($read{$i} == '"') { + if ($read[$i] == '"') { $arg_s = $this->parseQuote($read, $i); - } else if ($read{$i} == '{') { + } else if ($read[$i] == '{') { $arg_s = $this->parseLiteral($read, $i); } @@ -622,8 +622,8 @@ class Message { $arg_no = 0; $arg_a = array(); ++$i; - for ($cnt = strlen($read); ($i < $cnt) && ($read{$i} != ')'); ++$i) { - $char = strtoupper($read{$i}); + for ($cnt = strlen($read); ($i < $cnt) && ($read[$i] != ')'); ++$i) { + $char = strtoupper($read[$i]); switch ($char) { case '"': $arg_a[] = $this->parseQuote($read, $i); @@ -652,8 +652,8 @@ class Message { $addr_a = array(); $group = ''; $a=0; - for (; $i < $cnt && $read{$i} != ')'; ++$i) { - if ($read{$i} == '(') { + for (; $i < $cnt && $read[$i] != ')'; ++$i) { + if ($read[$i] == '(') { $addr = $this->parseAddress($read, $i); if (($addr->host == '') && ($addr->mailbox != '')) { /* start of group */ @@ -751,11 +751,11 @@ class Message { while (true) { $iPos = strpos($read,'"',$iPos); if (!$iPos) break; - if ($iPos && $read{$iPos -1} != '\\') { + if ($iPos && $read[$iPos -1] != '\\') { $s = substr($read,$i,($iPos-$i)); $i = $iPos; break; - } else if ($iPos > 1 && $read{$iPos -1} == '\\' && $read{$iPos-2} == '\\') { + } else if ($iPos > 1 && $read[$iPos -1] == '\\' && $read[$iPos-2] == '\\') { // This is an unique situation where the fast detection of the string // fails. If the quote string ends with \\ then we need to iterate // through the entire string to make sure we detect the unexcaped @@ -764,7 +764,7 @@ class Message { $bEscaped = false; $k = 0; for ($j=$iPosStart,$iCnt=strlen($read);$j<$iCnt;++$j) { - $cChar = $read{$j}; + $cChar = $read[$j]; switch ($cChar) { case '\\': $bEscaped = !$bEscaped; @@ -803,8 +803,8 @@ class Message { */ function parseAddress($read, &$i) { $arg_a = array(); - for (; $read{$i} != ')'; ++$i) { - $char = strtoupper($read{$i}); + for (; $read[$i] != ')'; ++$i) { + $char = strtoupper($read[$i]); switch ($char) { case '"': $arg_a[] = $this->parseQuote($read, $i); break; case '{': $arg_a[] = $this->parseLiteral($read, $i); break; @@ -838,8 +838,8 @@ class Message { */ function parseDisposition($read, &$i) { $arg_a = array(); - for (; $read{$i} != ')'; ++$i) { - switch ($read{$i}) { + for (; $read[$i] != ')'; ++$i) { + switch ($read[$i]) { case '"': $arg_a[] = $this->parseQuote($read, $i); break; case '{': $arg_a[] = $this->parseLiteral($read, $i); break; case '(': $arg_a[] = $this->parseProperties($read, $i); break; @@ -865,8 +865,8 @@ class Message { /* no idea how to process this one without examples */ $arg_a = array(); - for (; $read{$i} != ')'; ++$i) { - switch ($read{$i}) { + for (; $read[$i] != ')'; ++$i) { + switch ($read[$i]) { case '"': $arg_a[] = $this->parseQuote($read, $i); break; case '{': $arg_a[] = $this->parseLiteral($read, $i); break; case '(': $arg_a[] = $this->parseProperties($read, $i); break; @@ -890,8 +890,8 @@ class Message { * @return integer */ function parseParenthesis($read, $i) { - for ($i++; $read{$i} != ')'; ++$i) { - switch ($read{$i}) { + for ($i++; $read[$i] != ')'; ++$i) { + switch ($read[$i]) { case '"': $this->parseQuote($read, $i); break; case '{': $this->parseLiteral($read, $i); break; case '(': $this->parseProperties($read, $i); break; @@ -944,7 +944,7 @@ class Message { } } - if ((($line{0} == '-') || $rfc822_header) && isset($boundaries[0])) { + if ((($line[0] == '-') || $rfc822_header) && isset($boundaries[0])) { $cnt = count($boundaries)-1; $bnd = $boundaries[$cnt]['bnd']; $bndreg = $boundaries[$cnt]['bndreg']; @@ -954,7 +954,7 @@ class Message { $bndlen = strlen($reg[1]); $bndend = false; if (strlen($line) > ($bndlen + 3)) { - if (($line{$bndlen+2} == '-') && ($line{$bndlen+3} == '-')) { + if (($line[$bndlen+2] == '-') && ($line[$bndlen+3] == '-')) { $bndend = true; } } diff --git a/class/mime/Rfc822Header.class.php b/class/mime/Rfc822Header.class.php index 8cf7f40b..2cbabeee 100644 --- a/class/mime/Rfc822Header.class.php +++ b/class/mime/Rfc822Header.class.php @@ -192,24 +192,24 @@ class Rfc822Header { $result = ''; $cnt = strlen($value); for ($i = 0; $i < $cnt; ++$i) { - switch ($value{$i}) { + switch ($value[$i]) { case '"': $result .= '"'; - while ((++$i < $cnt) && ($value{$i} != '"')) { - if ($value{$i} == '\\') { + while ((++$i < $cnt) && ($value[$i] != '"')) { + if ($value[$i] == '\\') { $result .= '\\'; ++$i; } - $result .= $value{$i}; + $result .= $value[$i]; } if($i < $cnt) { - $result .= $value{$i}; + $result .= $value[$i]; } break; case '(': $depth = 1; while (($depth > 0) && (++$i < $cnt)) { - switch($value{$i}) { + switch($value[$i]) { case '\\': ++$i; break; @@ -225,7 +225,7 @@ class Rfc822Header { } break; default: - $result .= $value{$i}; + $result .= $value[$i]; break; } } @@ -379,7 +379,7 @@ class Rfc822Header { $iCnt = strlen($address); $i = 0; while ($i < $iCnt) { - $cChar = $address{$i}; + $cChar = $address[$i]; switch($cChar) { case '<': @@ -398,11 +398,11 @@ class Rfc822Header { $iEnd = strpos($address,$cChar,$i+1); if ($iEnd) { // skip escaped quotes - $prev_char = $address{$iEnd-1}; + $prev_char = $address[$iEnd-1]; while ($prev_char === '\\' && substr($address,$iEnd-2,2) !== '\\\\') { $iEnd = strpos($address,$cChar,$iEnd+1); if ($iEnd) { - $prev_char = $address{$iEnd-1}; + $prev_char = $address[$iEnd-1]; } else { $prev_char = false; } @@ -429,7 +429,7 @@ class Rfc822Header { $iDepth = 1; $iComment = $i; while (($iDepth > 0) && (++$iComment < $iCnt)) { - $cCharComment = $address{$iComment}; + $cCharComment = $address[$iComment]; switch($cCharComment) { case '\\': ++$iComment; @@ -455,7 +455,7 @@ class Rfc822Header { // check the next token in case comments appear in the middle of email addresses $prevToken = end($aTokens); if (!in_array($prevToken,$aSpecials,true)) { - if ($i+1 0 && $val[0] == '"') { $val = substr($val, 1, -1); } $propResultArray[$key] = $val; @@ -806,7 +806,7 @@ class Rfc822Header { $value_a = explode(',', $value); foreach ($value_a as $val) { $val = trim($val); - if ($val{0} == '<') { + if ($val[0] == '<') { $val = substr($val, 1, -1); } if (substr($val, 0, 7) == 'mailto:') { diff --git a/class/template/Template.class.php b/class/template/Template.class.php index 27c02030..785b4aa1 100644 --- a/class/template/Template.class.php +++ b/class/template/Template.class.php @@ -1018,7 +1018,7 @@ class Template // return list of all files in a directory (and that // of any ancestors) // - if ($filename{strlen($filename) - 1} == '/') { + if ($filename[strlen($filename) - 1] == '/') { $return_array = array(); foreach ($this->template_file_cache as $file => $file_info) { diff --git a/functions/strings.php b/functions/strings.php index cd1e3160..c2a33e07 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -136,7 +136,7 @@ function &sqBodyWrap (&$body, $wrap) { // (i.e. try to preserve original paragraph breaks) // unless they occur at the very beginning of the text if ((sq_substr($body,$pos,1) == "\n" ) && (sq_strlen($outString) != 0)) { - $outStringLast = $outString{sq_strlen($outString) - 1}; + $outStringLast = $outString[sq_strlen($outString) - 1]; if ($outStringLast != "\n") { $outString .= "\n"; } @@ -227,7 +227,7 @@ function &sqBodyWrap (&$body, $wrap) { /* $ldnspacecnt = 0; if ($mypos == $nextNewline+1) { - while (($mypos < $length) && ($body{$mypos} == ' ')) { + while (($mypos < $length) && ($body[$mypos] == ' ')) { $ldnspacecnt++; } } @@ -236,9 +236,9 @@ function &sqBodyWrap (&$body, $wrap) { $firstword = sq_substr($body,$mypos,sq_strpos($body,' ',$mypos) - $mypos); //if ($dowrap || $ldnspacecnt > 1 || ($firstword && ( if (!$smartwrap || $firstword && ( - $firstword{0} == '-' || - $firstword{0} == '+' || - $firstword{0} == '*' || + $firstword[0] == '-' || + $firstword[0] == '+' || + $firstword[0] == '*' || sq_substr($firstword,0,1) == sq_strtoupper(sq_substr($firstword,0,1)) || strpos($firstword,':'))) { $outString .= sq_substr($body,$pos,($lastRealChar - $pos+1)); @@ -713,7 +713,7 @@ function GenerateRandomString($size, $chars, $flags = 0) { $String = ''; $j = strlen( $chars ) - 1; while (strlen($String) < $size) { - $String .= $chars{mt_rand(0, $j)}; + $String .= $chars[mt_rand(0, $j)]; } return $String; diff --git a/plugins/mail_fetch/class.mail_fetch.php b/plugins/mail_fetch/class.mail_fetch.php index 8996760c..ac915ea2 100644 --- a/plugins/mail_fetch/class.mail_fetch.php +++ b/plugins/mail_fetch/class.mail_fetch.php @@ -367,7 +367,7 @@ class mail_fetch { while($line = fgets($this->conn)) { if ($line == ".\r\n") { break; - } elseif ( $line{0} == '.' ) { + } elseif ( $line[0] == '.' ) { $ret .= substr($line,1); } else { $ret.= $line; diff --git a/src/configtest.php b/src/configtest.php index 036c485b..7f1ce94b 100644 --- a/src/configtest.php +++ b/src/configtest.php @@ -644,7 +644,7 @@ if($useSendmail) { // check for SMTP code; should be 2xx to allow us access $smtpline = fgets($stream, 1024); - if(((int) $smtpline{0}) > 3) { + if(((int) $smtpline[0]) > 3) { do_err("Error connecting to SMTP server. Server error: ". sm_encode_html_special_chars($smtpline)); } -- 2.25.1