php 5.1b2 - can't use function call inside array_shift() function.
authortokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 14 Jul 2005 17:44:41 +0000 (17:44 +0000)
committertokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 14 Jul 2005 17:44:41 +0000 (17:44 +0000)
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
functions/imap_messages.php
plugins/listcommands/functions.php
src/configtest.php

index 9f05a715cd8a4fb68bae27a380cca00b2e93c49f..eb9e3d3fb28f3069f072f6199d5294895078c10e 100644 (file)
@@ -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;
         }
index 92396803590af442ce2dd393bc9b598ba190c627..47bbff657e01396287d7c93c65cda3954e9fa5a6 100755 (executable)
@@ -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':
index 1e48594d0b55c6cf5542b5f89107052de55d0e03..46a79095ccf48633c75b8637ea7c9488259aff03 100644 (file)
@@ -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') {
 
index f729624cf49fa4a12cbcdf9c253fbb8297cf6a25..1710aade294f05b0d9eb803589af42a4f0dca0b8 100644 (file)
@@ -351,7 +351,7 @@ if (function_exists('mb_detect_encoding')) {
 echo "$IND recode - ";
 if (function_exists('recode')) {
     echo "Recode functions are available.<br />\n";
-} elseif ($use_php_recode) {
+} elseif (isset($use_php_recode) && $use_php_recode) {
     echo "Recode functions are unavailable.<br />\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.<br />\n";
-} elseif ($use_php_iconv) {
+} elseif (isset($use_php_iconv) && $use_php_iconv) {
     echo "Iconv functions are unavailable.<br />\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.<br />\n";
 
@@ -426,7 +427,7 @@ if($addrbook_dsn || $prefs_dsn || $addrbook_global_dsn) {
                 echo "$IND$type database connect successful.<br />\n";
 
             } else {
-                do_err($db.' database support not present!');
+                do_err($dbtype.' database support not present!');
             }
         }
     } else {