Optimization:
authorphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 23 Mar 2002 16:23:57 +0000 (16:23 +0000)
committerphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 23 Mar 2002 16:23:57 +0000 (16:23 +0000)
readMailboxParent was only been used in imap_mailbox. Removed from
strings.php as this is a frequent loaded module.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2624 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_mailbox.php
functions/page_header.php
functions/strings.php

index f98b0131198ee5fa43bc08a4612d6b37f9b5faf9..f6c8d42ac6daf858ed1656115e0cc547d49088e4 100755 (executable)
 
 global $boxesnew;
 
 
 global $boxesnew;
 
+/**
+ * If $haystack is a full mailbox name, and $needle is the mailbox
+ * separator character, returns the second last part of the full
+ * mailbox name (i.e. the mailbox's parent mailbox)
+ */
+function readMailboxParent($haystack, $needle) {
+
+    if ($needle == '') {
+        $ret = '';
+    } else {
+        $parts = explode($needle, $haystack);
+        $elem = array_pop($parts);
+        while ($elem == '' && count($parts)) {
+            $elem = array_pop($parts);
+        }
+        $ret = join($needle, $parts);
+    }
+    return( $ret );
+}
+
+
 function isBoxBelow( $box2, $box1 ) {
     global $delimiter, $folder_prefix, $imap_server_type;
 
 function isBoxBelow( $box2, $box1 ) {
     global $delimiter, $folder_prefix, $imap_server_type;
 
index 4e134c14cebe63a020c189788420eaa991ec3d91..7910dd84d56b57de86ef94c86f7b6984951881ec 100644 (file)
@@ -107,7 +107,6 @@ function displayPageHeader($color, $mailbox, $xtra='') {
 
     }
 
 
     }
 
-
     echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";
     /** Here is the header and wrapping table **/
     $shortBoxName = readShortMailboxName($mailbox, $delimiter);
     echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";
     /** Here is the header and wrapping table **/
     $shortBoxName = readShortMailboxName($mailbox, $delimiter);
index 7d17332d9f98ff0150d9498bbbfc19a177b45a3b..0b146f008beabfe8488225fa5909c1dcb7950ecd 100644 (file)
@@ -23,31 +23,20 @@ $version = '1.2.6 [cvs]';
  * separator character, returns the last part of the mailbox name.
  */
 function readShortMailboxName($haystack, $needle) {
  * separator character, returns the last part of the mailbox name.
  */
 function readShortMailboxName($haystack, $needle) {
+
     if ($needle == '') {
     if ($needle == '') {
-        return $haystack;
-    }
-    $parts = explode($needle, $haystack);
-    $elem = array_pop($parts);
-    while ($elem == '' && count($parts)) {
-        $elem = array_pop($parts);
+        $elem = $haystack;
+    } else {
+           $parts = explode($needle, $haystack);
+           $elem = array_pop($parts);
+           while ($elem == '' && count($parts)) {
+               $elem = array_pop($parts);
+           }
     }
     }
-    return $elem;
+    return( $elem );
 }
 
 }
 
-/**
- * If $haystack is a full mailbox name, and $needle is the mailbox
- * separator character, returns the second last part of the full
- * mailbox name (i.e. the mailbox's parent mailbox)
- */
-function readMailboxParent($haystack, $needle) {
-    if ($needle == '') return '';
-    $parts = explode($needle, $haystack);
-    $elem = array_pop($parts);
-    while ($elem == '' && count($parts)) {
-        $elem = array_pop($parts);
-    }
-    return join($needle, $parts);
-}
+
 
 /**
  * Returns the index of the first chunk of string $haystack that
 
 /**
  * Returns the index of the first chunk of string $haystack that
@@ -596,4 +585,4 @@ function RemoveSlashes(&$array) {
 
 $PHP_SELF = php_self();
 
 
 $PHP_SELF = php_self();
 
-?>
+?>
\ No newline at end of file