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

List:       squirrelmail-cvs
Subject:    [SM-CVS] SF.net SVN: squirrelmail:[14761] branches/SM-1_4-STABLE/squirrelmail/ functions/identity.ph
From:       pdontthink--- via squirrelmail-cvs <squirrelmail-cvs () lists ! sourceforge ! net>
Date:       2018-04-19 10:43:52
Message-ID: 1524134632.831202.11904 () sfp-scm-8 ! v30 ! lw ! sourceforge ! com
[Download RAW message or body]

Revision: 14761
          http://sourceforge.net/p/squirrelmail/code/14761
Author:   pdontthink
Date:     2018-04-19 10:43:52 +0000 (Thu, 19 Apr 2018)
Log Message:
-----------
Better handling for empty identities

Modified Paths:
--------------
    branches/SM-1_4-STABLE/squirrelmail/functions/identity.php

Modified: branches/SM-1_4-STABLE/squirrelmail/functions/identity.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/functions/identity.php	2018-04-19 09:14:10 \
                UTC (rev 14760)
+++ branches/SM-1_4-STABLE/squirrelmail/functions/identity.php	2018-04-19 10:43:52 \
UTC (rev 14761) @@ -142,8 +142,12 @@
     if (!$edit_identity_local && $num_cur !== count($identities)) {
         exit;
     }
+    // only allow growing the identities list if action is "save" and the last ident \
is populated +    if ($edit_identity_local && ($action !== 'save' || \
empty_identity(end($identities)))) { +        array_pop($identities);
+    }
     // make sure someone not trying to mess with index numbers
-    for ($x = 0; $x < $num_cur ; $x++) {
+    for ($x = 0; $x < $num_cur ; $x++) { // there could be one more when adding but \
that's ok  if (!isset($identities[$x]))
             exit;
     }
@@ -150,11 +154,9 @@
 
     foreach( $identities as $key=>$ident ) {
 
-        // we already have a delete action; legit empty array
-        // can happen if email address is not ediable
-        // if (empty_identity($ident)) {
-        //     continue;
-        // }
+        if ($edit_identity_local && empty_identity($ident)) {
+            continue;
+        }
 
         // when user isn't allowed to edit some fields, make sure they are unchanged
         $pref_index = ($key ? $key : '');
@@ -247,7 +249,7 @@
 /**
  * Function to test if identity is empty
  *
- * @param   array   $identity   Identitiy Array
+ * @param   array   $identity   Identity Array
  * @return  boolean
  */
 function empty_identity($ident) {

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
-----
squirrelmail-cvs mailing list
List address: squirrelmail-cvs@lists.sourceforge.net
List info (subscribe/unsubscribe/change options): \
                https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
Repository: http://squirrelmail.org/svn


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

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