* This implements functions that manipulate messages
* NOTE: Quite a few functions in this file are obsolete
*
- * @copyright © 1999-2007 The SquirrelMail Project Team
+ * @copyright 1999-2021 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
if ($sThreadResponse) {
for ($i=0,$iCnt = strlen($sThreadResponse);$i<$iCnt;++$i) {
- $cChar = $sThreadResponse{$i};
+ $cChar = $sThreadResponse[$i];
switch ($cChar) {
case '(': // new sub thread
// correction for a subthread of a thread with no parents in thread
* @return string $s parsed string without the double quotes or literal count
*/
function parseString($read,&$i) {
- $char = $read{$i};
+ $char = $read[$i];
$s = '';
if ($char == '"') {
$iPos = ++$i;
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;
$aMsg['ID'] = $id;
$fetch = substr($read,$i_space+1,5);
if (!is_numeric($id) && $fetch !== 'FETCH') {
- $aMsg['ERROR'] = $read; // htmlspecialchars should be done just before display. this is backend code
+ $aMsg['ERROR'] = $read; // sm_encode_html_special_chars should be done just before display. this is backend code
break;
}
$i = strpos($read,'(',$i_space+5);
case 'date':
$aMsg['date'] = trim(str_replace(' ', ' ', $value));
break;
- case 'x-priority': $aMsg['x-priority'] = ($value) ? (int) $value{0} : 3; break;
+ case 'x-priority': $aMsg['x-priority'] = ($value) ? (int) $value[0] : 3; break;
case 'priority':
case 'importance':
// duplicate code with Rfc822Header.cls:parsePriority()
$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 '{':
case '"':
$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 = sqimap_parse_address($read, $i);
if (($addr[3] == '') && ($addr[2] != '')) {
/* start of group */
*/
function sqimap_parse_address($read, &$i) {
$arg_a = array();
- for (; $read{$i} != ')'; ++$i) {
- $char = strtoupper($read{$i});
+ for (; $read[$i] != ')'; ++$i) {
+ $char = strtoupper($read[$i]);
switch ($char) {
case '{':
case '"': $arg_a[] = parseString($read,$i); break;
*/
function sqimap_get_message($imap_stream, $id, $mailbox, $hide=0) {
// typecast to int to prohibit 1:* msgs sets
- $id = (int) $id;
+ // Update: $id should always be sanitized into a BIGINT so this
+ // is being removed; leaving this code here in case something goes
+ // wrong, however
+ //$id = (int) $id;
$flags = array();
$read = sqimap_run_command($imap_stream, "FETCH $id (FLAGS BODYSTRUCTURE)", true, $response, $message, TRUE);
if ($read) {