X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fstrings.php;h=9383d83d09120c06c0b0f8bb67d59eb2171ea6f8;hb=5b277d00da5cbda7c9b4fb206c703af998438615;hp=2bc4d55c77d77cd461dc57e734da317c7066f017;hpb=f7b996c37914340010adedd03f5c014dd756d3f1;p=squirrelmail.git diff --git a/functions/strings.php b/functions/strings.php index 2bc4d55c..9383d83d 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -6,7 +6,7 @@ * This code provides various string manipulation functions that are * used by the rest of the SquirrelMail code. * - * @copyright © 1999-2006 The SquirrelMail Project Team + * @copyright © 1999-2007 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -496,11 +496,15 @@ function get_location () { /* * If you have 'SSLOptions +StdEnvVars' in your apache config * OR if you have HTTPS=on in your HTTP_SERVER_VARS + * OR if you have HTTP_X_FORWARDED_PROTO=https in your HTTP_SERVER_VARS * OR if you are on port 443 */ $getEnvVar = getenv('HTTPS'); + if (!sqgetGlobalVar('HTTP_X_FORWARDED_PROTO', $forwarded_proto, SQ_SERVER)) + $forwarded_proto = ''; if ((isset($getEnvVar) && strcasecmp($getEnvVar, 'on') === 0) || (sqgetGlobalVar('HTTPS', $https_on, SQ_SERVER) && strcasecmp($https_on, 'on') === 0) || + (strcasecmp($forwarded_proto, 'https') === 0) || (sqgetGlobalVar('SERVER_PORT', $server_port, SQ_SERVER) && $server_port == 443)) { $proto = 'https://'; } @@ -518,7 +522,8 @@ function get_location () { if (! strstr($host, ':')) { if (sqgetGlobalVar('SERVER_PORT', $server_port, SQ_SERVER)) { if (($server_port != 80 && $proto == 'http://') || - ($server_port != 443 && $proto == 'https://')) { + ($server_port != 443 && $proto == 'https://' && + strcasecmp($forwarded_proto, 'https') !== 0)) { $port = sprintf(':%d', $server_port); } } @@ -540,6 +545,32 @@ function get_location () { } +/** + * Get Message List URI + * + * @param string $mailbox Current mailbox name (unencoded/raw) + * @param string $startMessage The mailbox page offset + * @param string $what Any current search parameters (OPTIONAL; + * default empty string) + * + * @return string The message list URI + * + * @since 1.5.2 + * + */ +function get_message_list_uri($mailbox, $startMessage, $what='') { + + global $base_uri; + + $urlMailbox = urlencode($mailbox); + + $list_xtra = "?where=read_body.php&what=$what&mailbox=" . $urlMailbox. + "&startMessage=$startMessage"; + + return $base_uri .'src/right_main.php'. $list_xtra; +} + + /** * Encrypts password * @@ -712,11 +743,11 @@ function OneTimePadCreate ($length=100) { */ function show_readable_size($bytes) { $bytes /= 1024; - $type = 'KiB'; + $type = _("KiB"); if ($bytes / 1024 > 1) { $bytes /= 1024; - $type = 'MiB'; + $type = _("MiB"); } if ($bytes < 10) { @@ -792,7 +823,7 @@ function quoteimap($str) { * @since 1.4.2 */ function makeComposeLink($url, $text = null, $target='') { - global $compose_new_win, $javascript_on, $compose_width, + global $compose_new_win, $compose_width, $compose_height, $oTemplate; if(!$text) { @@ -809,13 +840,11 @@ function makeComposeLink($url, $text = null, $target='') { // if javascript is on, use onclick event to handle it - if($javascript_on) { + if(checkForJavascript()) { sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION); $compuri = SM_BASE_URI.$url; - $oTemplate->assign('uri', 'javascript:void(0)'); - $oTemplate->assign('text', $text); - $oTemplate->assign('onclick', "comp_in_new('$compuri','$compose_width','$compose_height')"); - return $oTemplate->fetch('hyperlink.tpl'); + + return create_hyperlink('javascript:void(0)', $text, '', "comp_in_new('$compuri','$compose_width','$compose_height')"); } // otherwise, just open new window using regular HTML