Remove some obsoleted parsing functions.
[squirrelmail.git] / functions / strings.php
index 58d135eea8159b8642029e305ec90d622fcb0068..db5ff7c2e61b480d0f9d4e81e6de945d887d1b7d 100644 (file)
  * $Id$
  */
 
-require_once(SM_PATH . 'functions/global.php');
 
 /**
  * SquirrelMail version number -- DO NOT CHANGE
  */
 global $version;
-$version = '1.4.1 [CVS]';
+$version = '1.5.0 [CVS]';
 
 /** 
  * SquirrelMail internal version number -- DO NOT CHANGE
  * $sm_internal_version = array (release, major, minor)
  */
 global $SQM_INTERNAL_VERSION;
-$SQM_INTERNAL_VERSION = array(1,4,1);
+$SQM_INTERNAL_VERSION = array(1,5,0);
+
 
+/**
+ * There can be a circular issue with includes, where the $version string is
+ * referenced by the include of global.php, etc. before it's defined.
+ * For that reason, bring in global.php AFTER we define the version strings.
+ */
+require_once(SM_PATH . 'functions/global.php');
 
 /**
  * Wraps text at $wrap characters
@@ -145,42 +151,6 @@ function readShortMailboxName($haystack, $needle) {
     return( $elem );
 }
 
-/**
- * Returns an array of email addresses.
- * Be cautious of "user@host.com"
- */
-function parseAddrs($text) {
-    if (trim($text) == '')
-        return array();
-    $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.
- */
-function getLineOfAddrs($array) {
-    if (is_array($array)) {
-        $to_line = implode(', ', $array);
-        $to_line = ereg_replace(', (, )+', ', ', $to_line);
-        $to_line = trim(ereg_replace('^, ', '', $to_line));
-        if( substr( $to_line, -1 ) == ',' )
-            $to_line = substr( $to_line, 0, -1 );
-    } else {
-        $to_line = '';
-    }
-    
-    return( $to_line );
-}
-
 function php_self () {
     if ( sqgetGlobalVar('REQUEST_URI', $req_uri, SQ_SERVER) && !empty($req_uri) ) {
       return $req_uri;
@@ -445,26 +415,6 @@ function TrimArray(&$array) {
     }
 }   
 
-/**
- * Removes slashes from every element in the array
- */
-function RemoveSlashes(&$array) {
-    foreach ($array as $k => $v) {
-        global $$k;
-        if (is_array($$k)) {
-            foreach ($$k as $k2 => $v2) {
-                $newArray[stripslashes($k2)] = stripslashes($v2);
-            }
-            $$k = $newArray;
-        } else {
-            $$k = stripslashes($v);
-        }
-        
-        /* Re-assign back to the array. */
-        $array[$k] = $$k;
-    }
-}
-
 $PHP_SELF = php_self();
 
 ?>