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 9f05a71..eb9e3d3 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 9239680..47bbff6 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 1e48594..46a7909 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 f729624..1710aad 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 {