Correct references trimming: array_walk can't in all PHP versions use
[squirrelmail.git] / functions / strings.php
index 613f342c57c28d0ed30b1ece292ba229fc9b0ea3..5f99b3858ae5c01653d317c51e4d3ffe0c8de2ad 100644 (file)
  * @package squirrelmail
  */
 
  * @package squirrelmail
  */
 
-/** @ignore */
-if (!defined('SM_PATH')) define('SM_PATH','../');
-
-/**
- * SquirrelMail version number -- DO NOT CHANGE
- */
-global $version;
-$version = '1.5.2 [CVS]';
-
-/**
- * SquirrelMail internal version number -- DO NOT CHANGE
- * $sm_internal_version = array (release, major, minor)
- */
-global $SQM_INTERNAL_VERSION;
-$SQM_INTERNAL_VERSION = array(1,5,2);
-
-/**
- * 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.
- */
-include_once(SM_PATH . 'functions/global.php');
-
-/**
- * Include Compatibility plugin if available.
- */
-if (file_exists(SM_PATH . 'plugins/compatibility/functions.php'))
-    include_once(SM_PATH . 'plugins/compatibility/functions.php');
-
 /**
  * Appends citation markers to the string.
  * Also appends a trailing space.
 /**
  * Appends citation markers to the string.
  * Also appends a trailing space.
@@ -483,28 +454,6 @@ function readShortMailboxName($haystack, $needle) {
     return( $elem );
 }
 
     return( $elem );
 }
 
-/**
- * Find out where SquirrelMail lives and try to be smart about it.
- * The only problem would be when SquirrelMail lives in directories
- * called "src", "functions", or "plugins", but people who do that need
- * to be beaten with a steel pipe anyway.
- *
- * @return string the base uri of SquirrelMail installation.
- * @since 1.2.6
- */
-function sqm_baseuri(){
-    global $base_uri, $PHP_SELF;
-    /**
-     * If it is in the session, just return it.
-     */
-    if (sqgetGlobalVar('base_uri',$base_uri,SQ_SESSION)){
-        return $base_uri;
-    }
-    $dirs = array('|src/.*|', '|plugins/.*|', '|functions/.*|');
-    $repl = array('', '', '');
-    $base_uri = preg_replace($dirs, $repl, $PHP_SELF);
-    return $base_uri;
-}
 
 /**
  * get_location
 
 /**
  * get_location
@@ -876,7 +825,7 @@ function makeComposeLink($url, $text = null, $target='') {
     // if javascript is on, use onclick event to handle it
     if($javascript_on) {
         sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
     // if javascript is on, use onclick event to handle it
     if($javascript_on) {
         sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
-        $compuri = $base_uri.$url;
+        $compuri = SM_BASE_URI.$url;
         return "<a href=\"javascript:void(0)\" onclick=\"comp_in_new('$compuri','$compose_width','$compose_height')\">$text</a>";
     }
 
         return "<a href=\"javascript:void(0)\" onclick=\"comp_in_new('$compuri','$compose_width','$compose_height')\">$text</a>";
     }
 
@@ -1331,4 +1280,13 @@ function sq_count8bit($string) {
     return $count;
 }
 
     return $count;
 }
 
+/**
+ * Callback function to trim whitespace from a value, to be used in array_walk
+ * @param string $value value to trim
+ * @since 1.5.2 and 1.4.7
+ */
+function sq_trim_value ( &$value ) {
+    $value = trim($value);
+}
+
 ?>
 ?>