* $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
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;
}
}
-/**
- * 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;
+/* returns a link to the compose-page, taking in consideration
+ * the compose_in_new and javascript settings. */
+function makeComposeLink($url, $text = null)
+{
+ global $compose_new_win,$javascript_on;
+
+ if(!$text) {
+ $text = _("Compose");
+ }
+
+ if($compose_new_win != '1') {
+ return makeInternalLink($url, $text, 'right');
+ }
+
+ /* if we can use JS, use the fancy window, else just open a new one HTML-style */
+ if($javascript_on) {
+ sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
+ return '<a href="javascript:void(0)" onclick="comp_in_new(\''.$base_uri.$url.'\')">'. $text.'</a>';
}
+
+ return makeInternalLink($url, $text, '_blank');
+}
+
+/**
+* sm_print_r($some_variable);
+* Debugging function - does the same as print_r, but makes sure special
+* characters are converted to htmlentities first. This will allow
+* values like <some@email.address> to be displayed.
+* The output is wrapped in <pre> and </pre> tags.
+*/
+function sm_print_r($var) {
+ ob_start(); // Buffer output
+ print_r($var);
+ $buffer = ob_get_contents(); // Grab the print_r output
+ ob_end_clean(); // Silently discard the output & stop buffering
+ print "<pre>";
+ print htmlentities($buffer);
+ print "</pre>";
}
$PHP_SELF = php_self();