From ba17b6c726c3c0be811bf4f41fe0b23b16d80a78 Mon Sep 17 00:00:00 2001 From: tokul Date: Thu, 14 Jul 2005 17:44:41 +0000 Subject: [PATCH] php 5.1b2 - can't use function call inside array_shift() function. src/configtest.php - add extra checks in use_php_recode and use_php_iconv. - fix typo. $dbtype should be used instead $db git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9778 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- class/mime/Rfc822Header.class.php | 9 ++++++--- functions/imap_messages.php | 27 +++++++++++++++------------ plugins/listcommands/functions.php | 5 +++-- src/configtest.php | 9 +++++---- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/class/mime/Rfc822Header.class.php b/class/mime/Rfc822Header.class.php index 9f05a715..eb9e3d3f 100644 --- a/class/mime/Rfc822Header.class.php +++ b/class/mime/Rfc822Header.class.php @@ -626,11 +626,14 @@ class Rfc822Header { * NOTE: this is actually a duplicate from the function in * functions/imap_messages. I'm not sure if it's ok here to call * that function? - * @param string $value literal priority name + * @param string $sValue literal priority name * @return integer */ - function parsePriority($value) { - $value = strtolower(array_shift(split('/\w/',trim($value)))); + function parsePriority($sValue) { + // don't use function call inside array_shift. + $aValue = split('/\w/',trim($sValue)); + $value = strtolower(array_shift($aValue)); + if ( is_numeric($value) ) { return $value; } diff --git a/functions/imap_messages.php b/functions/imap_messages.php index 92396803..47bbff65 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -489,12 +489,14 @@ function elapsedTime($start) { * X-MS-Mail-Priority is not parsed because it always coincides * with one of the other headers. * - * DUPLICATE CODE ALERT: + * FIXME: DUPLICATE CODE ALERT: * NOTE: this is actually a duplicate from the function in * class/mime/Rfc822Header.php. + * @todo obsolate function or use it instead of code block in parseFetch() */ -function parsePriority($value) { - $value = strtolower(array_shift(split('/\w/',trim($value)))); +function parsePriority($sValue) { + $aValue = split('/\w/',trim($sValue)); + $value = strtolower(array_shift($aValue)); if ( is_numeric($value) ) { return $value; } @@ -755,18 +757,19 @@ function parseFetch($aResponse,$aMessageList = array()) { case 'priority': case 'importance': if (!isset($aMsg['x-priority'])) { - $value = strtolower(array_shift(split('/\w/',trim($value)))); - if (is_numeric($value)) { - $value = (int) $value; - } elseif ( $value == 'non-urgent' || $value == 'low' ) { - $value = 3; - } elseif ( $value == 'urgent' || $value == 'high' ) { - $value = 1; + $aPrio = split('/\w/',trim($value)); + $sPrio = strtolower(array_shift($aPrio)); + if (is_numeric($sPrio)) { + $iPrio = (int) $sPrio; + } elseif ( $sPrio == 'non-urgent' || $sPrio == 'low' ) { + $iPrio = 3; + } elseif ( $sPrio == 'urgent' || $sPrio == 'high' ) { + $iPrio = 1; } else { // default is normal priority - $value = 3; + $iPrio = 3; } - $aMsg['x-priority'] = $value; + $aMsg['x-priority'] = $iPrio; } break; case 'content-type': diff --git a/plugins/listcommands/functions.php b/plugins/listcommands/functions.php index 1e48594d..46a79095 100644 --- a/plugins/listcommands/functions.php +++ b/plugins/listcommands/functions.php @@ -37,8 +37,9 @@ function plugin_listcommands_menu_do() { } /* proto = {mailto,href} */ - $proto = array_shift(array_keys($actions)); - $act = array_shift($actions); + $aActions = array_keys($actions); + $proto = array_shift($aActions); + $act = array_shift($aActions); if ($proto == 'mailto') { diff --git a/src/configtest.php b/src/configtest.php index f729624c..1710aade 100644 --- a/src/configtest.php +++ b/src/configtest.php @@ -351,7 +351,7 @@ if (function_exists('mb_detect_encoding')) { echo "$IND recode - "; if (function_exists('recode')) { echo "Recode functions are available.
\n"; -} elseif ($use_php_recode) { +} elseif (isset($use_php_recode) && $use_php_recode) { echo "Recode functions are unavailable.
\n"; do_err('Your configuration requires recode support, but recode support is missing.'); } else { @@ -360,7 +360,7 @@ if (function_exists('recode')) { echo "$IND iconv - "; if (function_exists('iconv')) { echo "Iconv functions are available.
\n"; -} elseif ($use_php_iconv) { +} elseif (isset($use_php_iconv) && $use_php_iconv) { echo "Iconv functions are unavailable.
\n"; do_err('Your configuration requires iconv support, but iconv support is missing.'); } else { @@ -411,7 +411,8 @@ if($addrbook_dsn || $prefs_dsn || $addrbook_global_dsn) { } foreach($dsns as $type => $dsn) { - $dbtype = array_shift(explode(':', $dsn)); + $aDsn = explode(':', $dsn); + $dbtype = array_shift($aDsn); if(isset($db_functions[$dbtype]) && function_exists($db_functions[$dbtype])) { echo "$IND$dbtype database support present.
\n"; @@ -426,7 +427,7 @@ if($addrbook_dsn || $prefs_dsn || $addrbook_global_dsn) { echo "$IND$type database connect successful.
\n"; } else { - do_err($db.' database support not present!'); + do_err($dbtype.' database support not present!'); } } } else { -- 2.25.1