Updated the themes, and general SquirrelMail stuff
[squirrelmail.git] / functions / strings.php
index 348b62d75516995bd926ddd91e125d847046b725..66cd5de8d562f45f1d26d527163af7cb19056b61 100644 (file)
@@ -1,4 +1,5 @@
 <?
+
    //*************************************************************************
    // Count the number of occurances of $needle are in $haystack.
    //*************************************************************************
    //    of the $haystack is reached.
    //*************************************************************************
    function readShortMailboxName($haystack, $needle) {
-      $len = strlen($haystack);
-      for ($i = $len - 1; ($i >= 0) && (!$found);$i--) {
-         $char = $haystack[$i];
-         if ($char == $needle)
-            $found = 1;
-         else
-            $data .= $char;
+      if (strpos($haystack, $needle)) {
+         $pos = strrpos($haystack, $needle) + 1;
+         $data = substr($haystack, $pos, strlen($haystack));
+      } else {
+         $data = $haystack;
       }
-      return strrev($data);
+      return $data;
    }
 
    // Wraps text at $wrap characters
@@ -77,4 +76,7 @@
       }
       return $to_line;
    }
+
+   /* SquirrelMail version number -- DO NOT CHANGE */
+   $version = "0.2";
 ?>