Pref file now isn't created if the login failed
[squirrelmail.git] / functions / strings.php
index 348b62d75516995bd926ddd91e125d847046b725..38c8e7b0c4959d8e5a9f49a06682096b840d3a77 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
@@ -60,6 +59,9 @@
 
    /** Returns an array of email addresses **/
    function parseAddrs($text) {
+      if (trim($text) == "") {
+         return;
+      }
       $text = str_replace(" ", "", $text);
       $text = str_replace(",", ";", $text);
       $array = explode(";", $text);
       }
       return $to_line;
    }
+
+   function translateText($body) {
+      $body = ereg_replace(" ", "&nbsp;", $body);
+      return $body;
+   }
+
+   /* SquirrelMail version number -- DO NOT CHANGE */
+   $version = "0.3pre1";
 ?>