[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-cvs
Subject:    [SM-CVS] CVS: squirrelmail/functions imap_mailbox.php,1.232,1.233 imap_messages.php,1.168,1.169 mail
From:       Thijs Kinkhorst <kink () users ! sourceforge ! net>
Date:       2004-05-24 19:55:40
Message-ID: E1BSLXw-00019k-OF () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/squirrelmail/squirrelmail/functions
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4281/functions

Modified Files:
	imap_mailbox.php imap_messages.php mailbox_display.php 
Log Message:
Replace array_search that only uses a boolean to check whether the value
exists with in_array (which returns just that boolean), and fix the
left over call to array_search to also check for NULL return.
This should fix the problems that Fredrik, me and other PHP 4.1 users
had with Marc's recent changes.

From PHP docs:
"Note:  Prior to PHP 4.2.0, array_search() returns NULL on failure instead of FALSE."


Index: imap_mailbox.php
===================================================================
RCS file: /cvsroot/squirrelmail/squirrelmail/functions/imap_mailbox.php,v
retrieving revision 1.232
retrieving revision 1.233
diff -u -w -r1.232 -r1.233
--- imap_mailbox.php	23 May 2004 08:52:39 -0000	1.232
+++ imap_mailbox.php	24 May 2004 19:55:20 -0000	1.233
@@ -269,7 +269,7 @@
     $message_id = (int) $message_id; // we use strickt array_search
     if (is_array($aMailbox['UIDSET'])) {
         $key = array_search($message_id,$aMailbox['UIDSET'],true);
-        if ($key !== false) {
+        if ($key !== false && !is_null($key)) {
             unset($aMailbox['UIDSET'][$key]);
             $aMailbox['UIDSET'] = array_values($aMailbox['UIDSET']);
             // adapt the exists count to avoid triggering of a new sort

Index: imap_messages.php
===================================================================
RCS file: /cvsroot/squirrelmail/squirrelmail/functions/imap_messages.php,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -w -r1.168 -r1.169
--- imap_messages.php	24 May 2004 18:01:59 -0000	1.168
+++ imap_messages.php	24 May 2004 19:55:20 -0000	1.169
@@ -534,11 +534,7 @@
     $messages = array();
     $read_list = array();
 
-    if (array_search('UID',$aFetchItems,true) !== false) {
-        $bUidFetch = false;
-    } else {
-        $bUidFetch = true;
-    }
+    $bUidFetch = ! in_array('UID', $aFetchItems, true);
 
     /* Get the small headers for each message in $msg_list */
     if ($show_num != '999999' && $show_num != '*' ) {

Index: mailbox_display.php
===================================================================
RCS file: /cvsroot/squirrelmail/squirrelmail/functions/mailbox_display.php,v
retrieving revision 1.398
retrieving revision 1.399
diff -u -w -r1.398 -r1.399
--- mailbox_display.php	24 May 2004 19:46:14 -0000	1.398
+++ mailbox_display.php	24 May 2004 19:55:20 -0000	1.399
@@ -856,12 +856,12 @@
 
                     // display flag buttons only if supported
                     if ($show_flag_buttons  &&
-                    array_search('\\flagged',$aMailbox['PERMANENTFLAGS'], true) !== FALSE) {
+                    in_array('\\flagged',$aMailbox['PERMANENTFLAGS'], true) ) {
                         echo getButton('SUBMIT', 'markUnflagged',_("Unflag"));
                         echo getButton('SUBMIT', 'markFlagged',_("Flag"));
                         echo '&nbsp;';
                     }
-                    if (array_search('\\seen',$aMailbox['PERMANENTFLAGS'], true) !== FALSE) {
+                    if (in_array('\\seen',$aMailbox['PERMANENTFLAGS'], true)) {
                         echo getButton('SUBMIT', 'markUnread',_("Unread"));
                         echo getButton('SUBMIT', 'markRead',_("Read"));
                         echo '&nbsp;';
@@ -869,7 +869,7 @@
 
                     echo getButton('SUBMIT', 'attache',_("Forward"));
                     echo '&nbsp;';
-                    if (array_search('\\deleted',$aMailbox['PERMANENTFLAGS'], true) !== FALSE) {
+                    if (in_array('\\deleted',$aMailbox['PERMANENTFLAGS'], true)) {
                         echo getButton('SUBMIT', 'delete',_("Delete"));
                         echo '<input type="checkbox" name="bypass_trash" />' . _("Bypass Trash");
                         echo '&nbsp;';
@@ -882,7 +882,7 @@
                 ?></small>
                 </td>
                 <?php
-                if (array_search('\\deleted',$aMailbox['PERMANENTFLAGS'], true) !== FALSE) {
+                if (in_array('\\deleted',$aMailbox['PERMANENTFLAGS'], true)) {
                     echo '<td align="right">
                 <small>';
                     //echo $thread_link_str;	//previous behaviour



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
--
squirrelmail-cvs mailing list
List Address: squirrelmail-cvs@lists.sourceforge.net
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
http://squirrelmail.org/cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic