sanitizing address book listing. extra field row is added for plugins
[squirrelmail.git] / functions / imap_messages.php
index 32cef7ee12642cf40df4baa5fc1d9237c7e5f1a4..6d847aaf0ae7a64ddc2bc20994f13473d5fb148b 100755 (executable)
@@ -3,12 +3,11 @@
 /**
  * imap_messages.php
  *
- * Copyright (c) 1999-2005 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
  * This implements functions that manipulate messages
  * NOTE: Quite a few functions in this file are obsolete
  *
+ * @copyright © 1999-2005 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
  * @subpackage imap
@@ -489,12 +488,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 +756,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':
@@ -798,7 +800,7 @@ function parseFetch($aResponse,$aMessageList = array()) {
             }
         }
         $msgi ="$unique_id";
-        $msg['UID'] = $unique_id;
+        $aMsg['UID'] = $unique_id;
         $aMessageList[$msgi] = $aMsg;
     }
     return $aMessageList;