}
/**
- * php_self
+ * 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.
*
- * Creates an URL for the page calling this function, using either the PHP global
- * REQUEST_URI, or the PHP global PHP_SELF with QUERY_STRING added.
- *
- * @return string the complete url for this page
- * @since 1.2.3
+ * @return string the base uri of SquirrelMail installation.
+ * @since 1.2.6
*/
-function php_self () {
- if ( sqgetGlobalVar('REQUEST_URI', $req_uri, SQ_SERVER) && !empty($req_uri) ) {
- return $req_uri;
- }
-
- if ( sqgetGlobalVar('PHP_SELF', $php_self, SQ_SERVER) && !empty($php_self) ) {
-
- // need to add query string to end of PHP_SELF to match REQUEST_URI
- //
- if ( sqgetGlobalVar('QUERY_STRING', $query_string, SQ_SERVER) && !empty($query_string) ) {
- $php_self .= '?' . $query_string;
- }
-
- return $php_self;
+function sqm_baseuri(){
+ global $base_uri, $PHP_SELF;
+ /**
+ * If it is in the session, just return it.
+ */
+ if (isset($base_uri)){
+ return $base_uri;
}
-
- return '';
+ $dirs = array('|src/.*|', '|plugins/.*|', '|functions/.*|');
+ $repl = array('', '', '');
+ $base_uri = preg_replace($dirs, $repl, $PHP_SELF);
+ return $base_uri;
}
-
/**
* get_location
*
* If you want to test all mbstring encodings - fill $list_of_encodings
* array.
* @return array list of encodings supported by php mbstring extension
- * @since 1.5.1
+ * @since 1.5.1 and 1.4.6
*/
function sq_mb_list_encodings() {
if (! function_exists('mb_internal_encoding'))
'windows-1256',
'tis-620',
'iso-2022-jp',
+ 'euc-cn',
'euc-kr',
+ 'euc-tw',
+ 'uhc',
'utf7-imap');
$supported_encodings=array();
* Callback function used to lowercase array values.
* @param string $val array value
* @param mixed $key array key
- * @since 1.5.1
+ * @since 1.5.1 and 1.4.6
*/
function sq_lowercase_array_vals(&$val,$key) {
$val = strtolower($val);
* vanilla string length function is used.
* @param string $str string
* @param string $charset charset
- * @since 1.5.1
+ * @since 1.5.1 and 1.4.6
* @return integer number of characters in string
*/
function sq_strlen($str, $charset=null){
}
return $count;
}
-$PHP_SELF = php_self();
-?>
\ No newline at end of file
+
+?>