- Returned sqimap_get_delimiter() to the old code, but left the new code
[squirrelmail.git] / functions / strings.php
index bee3eaa0a1cdb5c695ca97fa749631ed4402e78e..06057912cb8bb5fbdd2628dedc98c1bb00f7bed7 100644 (file)
@@ -15,8 +15,9 @@
    //    of the $haystack is reached.  $needle is a single character
    //*************************************************************************
    function readShortMailboxName($haystack, $needle) {
-      ereg("^$needle?([^$needle]+)$needle*",strrev($haystack),$regs);
-        return strrev($regs[1]);
+      if ($needle == ".") $needle = "\.";
+      ereg("([^$needle]+)$needle?$", $haystack, $regs);
+      return $regs[1];
    }
 
    // Searches for the next position in a string minus white space
 
    /** Returns an array of email addresses **/
    function parseAddrs($text) {
-      if (trim($text) == "") {
+      if (trim($text) == "")
          return;
-      }
-      $text=ereg_replace("[;,][^<]*<* *([^>]*) *>*",";\\1",",$text");
-      return split("[;]", substr($text,1));
+      $text = str_replace(" ", "", $text);
+      $text = ereg_replace('"[^"]*"', "", $text);
+      $text = ereg_replace("\([^\)]*\)", "", $text);
+      $text = str_replace(",", ";", $text);
+      $array = explode(";", $text);
+      for ($i = 0; $i < count ($array); $i++) {
+                           $array[$i] = eregi_replace ("^.*[<]", "", $array[$i]);
+                           $array[$i] = eregi_replace ("[>].*$", "", $array[$i]);
+                 }
+      return $array;
    }
 
    /** Returns a line of comma separated email addresses from an array **/