aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-01-29 22:35:11 -0800
committerFriendika <info@friendika.com>2011-01-29 22:35:11 -0800
commitf970d9ab4d608d36aca405c11746082156e1e661 (patch)
treea5361f9b592299499c3755ef8d8be4f88561d9f8
parent45bbf1cd3fc25ecbcfe68bea74d704c355406d40 (diff)
downloadvolse-hubzilla-f970d9ab4d608d36aca405c11746082156e1e661.tar.gz
volse-hubzilla-f970d9ab4d608d36aca405c11746082156e1e661.tar.bz2
volse-hubzilla-f970d9ab4d608d36aca405c11746082156e1e661.zip
implement SSL redirection policy (none, full, selfsign)
-rw-r--r--boot.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/boot.php b/boot.php
index 223c9416d..83ceaac28 100644
--- a/boot.php
+++ b/boot.php
@@ -10,6 +10,16 @@ define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
define ( 'DOWN_ARROW', '&#x21e9;' );
+
+/**
+ * SSL redirection policies
+ */
+
+define ( 'SSL_POLICY_NONE', 0 );
+define ( 'SSL_POLICY_FULL', 1 );
+define ( 'SSL_POLICY_SELFSIGN' 2 );
+
+
/**
* log levels
*/
@@ -273,7 +283,14 @@ class App {
if(strlen($this->baseurl))
return $this->baseurl;
- $this->baseurl = (($ssl) ? 'https' : $this->scheme) . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
+ $scheme = $this->scheme;
+
+ if(($ssl) || ($a->config['ssl_policy'] == SSL_POLICY_FULL))
+ $scheme = 'https';
+ if(($a->config['ssl_policy'] == SSL_POLICY_SELFSIGN) && (local_user() || x($_POST,'auth-params')))
+ $scheme = 'https';
+
+ $this->baseurl = ( $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
return $this->baseurl;
}