Skip to content

Commit

Permalink
Use constants to make these values clearer.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Mar 10, 2015
1 parent f8f955e commit cd03511
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions framework/Core/lib/Horde.php
Expand Up @@ -15,6 +15,10 @@
*/
class Horde
{
const SSL_NEVER = 0;
const SSL_ALWAYS = 1;
const SSL_AUTO = 2;
const SSL_ONLY_LOGIN = 3;
/**
* The current buffer level.
*
Expand Down Expand Up @@ -428,17 +432,17 @@ public static function url($uri, $full = false, $opts = array())

$protocol = 'http';
switch ($GLOBALS['conf']['use_ssl']) {
case 1:
case self::SSL_ALWAYS:
$protocol = 'https';
break;

case 2:
case self::SSL_AUTO:
if ($GLOBALS['browser']->usingSSLConnection()) {
$protocol = 'https';
}
break;

case 3:
case self::SSL_ONLY_LOGIN:
$server_port = '';
if (!empty($opts['force_ssl'])) {
$protocol = 'https';
Expand Down Expand Up @@ -1005,7 +1009,7 @@ public static function label($for, $label, $ak = null)
public static function redirect($url)
{
if ($GLOBALS['browser']->isBrowser('msie') &&
($GLOBALS['conf']['use_ssl'] == 3) &&
($GLOBALS['conf']['use_ssl'] == self::SSL_ONLY_LOGIN) &&
(strlen($url) < 160)) {
header('Refresh: 0; URL=' . $url);
} else {
Expand Down

0 comments on commit cd03511

Please sign in to comment.