diff options
author | Evan Prodromou <evan@status.net> | 2010-02-13 12:39:15 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-02-13 12:39:15 -0500 |
commit | 269b4711eb1600597af314f2fdca00102ff5566a (patch) | |
tree | fd33f01c7ab842c9fce737291e0923fc60a140bc /lib | |
parent | f3a82e787c70e8cf749c79f22fe37ce6c9c9d4d3 (diff) | |
parent | 31461e120f23416c8c4979805900e3018fb2a6fd (diff) |
Merge branch 'ssleverything' into testing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/default.php | 13 | ||||
-rw-r--r-- | lib/htmloutputter.php | 15 | ||||
-rw-r--r-- | lib/theme.php | 15 |
3 files changed, 35 insertions, 8 deletions
diff --git a/lib/default.php b/lib/default.php index bf4b83718..8b1fe2769 100644 --- a/lib/default.php +++ b/lib/default.php @@ -111,11 +111,13 @@ $default = 'avatar' => array('server' => null, 'dir' => INSTALLDIR . '/avatar/', - 'path' => $_path . '/avatar/'), + 'path' => $_path . '/avatar/', + 'ssl' => null), 'background' => array('server' => null, 'dir' => INSTALLDIR . '/background/', - 'path' => $_path . '/background/'), + 'path' => $_path . '/background/', + 'ssl' => null), 'public' => array('localonly' => true, 'blacklist' => array(), @@ -123,10 +125,12 @@ $default = 'theme' => array('server' => null, 'dir' => null, - 'path'=> null), + 'path'=> null, + 'ssl' => null), 'javascript' => array('server' => null, - 'path'=> null), + 'path'=> null, + 'ssl' => null), 'throttle' => array('enabled' => false, // whether to throttle edits; false by default 'count' => 20, // number of allowed messages in timespan @@ -184,6 +188,7 @@ $default = array('server' => null, 'dir' => INSTALLDIR . '/file/', 'path' => $_path . '/file/', + 'ssl' => null, 'supported' => array('image/png', 'image/jpeg', 'image/gif', diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 317f5ea61..47e56fc8f 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -376,9 +376,20 @@ class HTMLOutputter extends XMLOutputter $server = common_config('site', 'server'); } - // XXX: protocol + $ssl = common_config('javascript', 'ssl'); + + if (is_null($ssl)) { // null -> guess + if (common_config('site', 'ssl') == 'always' && + !common_config('javascript', 'server')) { + $ssl = true; + } else { + $ssl = false; + } + } + + $protocol = ($ssl) ? 'https' : 'http'; - $src = 'http://'.$server.$path.$src . '?version=' . STATUSNET_VERSION; + $src = $protocol.'://'.$server.$path.$src . '?version=' . STATUSNET_VERSION; } $this->element('script', array('type' => $type, diff --git a/lib/theme.php b/lib/theme.php index 020ce1ac4..0be8c3b9d 100644 --- a/lib/theme.php +++ b/lib/theme.php @@ -110,9 +110,20 @@ class Theme $server = common_config('site', 'server'); } - // XXX: protocol + $ssl = common_config('theme', 'ssl'); + + if (is_null($ssl)) { // null -> guess + if (common_config('site', 'ssl') == 'always' && + !common_config('theme', 'server')) { + $ssl = true; + } else { + $ssl = false; + } + } + + $protocol = ($ssl) ? 'https' : 'http'; - $this->path = 'http://'.$server.$path.$name; + $this->path = $protocol . '://'.$server.$path.$name; } } |