summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README19
-rw-r--r--classes/Avatar.php15
-rw-r--r--classes/Design.php15
-rw-r--r--classes/File.php15
-rw-r--r--lib/default.php13
-rw-r--r--lib/htmloutputter.php15
-rw-r--r--lib/theme.php15
7 files changed, 93 insertions, 14 deletions
diff --git a/README b/README
index 9b4147645..75336eb83 100644
--- a/README
+++ b/README
@@ -1192,6 +1192,8 @@ server: If set, defines another server where avatars are stored in the
typically only make 2 connections to a single server at a
time <http://ur1.ca/6ih>, so this can parallelize the job.
Defaults to null.
+ssl: Whether to access avatars using HTTPS. Defaults to null, meaning
+ to guess based on site-wide SSL settings.
public
------
@@ -1221,6 +1223,19 @@ path: Path part of theme URLs, before the theme name. Relative to the
(using version numbers as the path) to make sure that all files are
reloaded by caching clients or proxies. Defaults to null,
which means to use the site path + '/theme'.
+ssl: Whether to use SSL for theme elements. Default is null, which means
+ guess based on site SSL settings.
+
+javascript
+----------
+
+server: You can speed up page loading by pointing the
+ theme file lookup to another server (virtual or real).
+ Defaults to NULL, meaning to use the site server.
+path: Path part of Javascript URLs. Defaults to null,
+ which means to use the site path + '/js/'.
+ssl: Whether to use SSL for JavaScript files. Default is null, which means
+ guess based on site SSL settings.
xmpp
----
@@ -1447,6 +1462,8 @@ server: server name to use when creating URLs for uploaded files.
a virtual server here can speed up Web performance.
path: URL path, relative to the server, to find files. Defaults to
main path + '/file/'.
+ssl: whether to use HTTPS for file URLs. Defaults to null, meaning to
+ guess based on other SSL settings.
filecommand: command to use for determining the type of a file. May be
skipped if fileinfo extension is installed. Defaults to
'/usr/bin/file'.
@@ -1506,6 +1523,8 @@ dir: directory to write backgrounds too. Default is '/background/'
subdir of install dir.
path: path to backgrounds. Default is sub-path of install path; note
that you may need to change this if you change site-path too.
+ssl: Whether or not to use HTTPS for background files. Defaults to
+ null, meaning to guess from site-wide SSL settings.
ping
----
diff --git a/classes/Avatar.php b/classes/Avatar.php
index 91bde0f04..dbe2cd813 100644
--- a/classes/Avatar.php
+++ b/classes/Avatar.php
@@ -82,9 +82,20 @@ class Avatar extends Memcached_DataObject
$server = common_config('site', 'server');
}
- // XXX: protocol
+ $ssl = common_config('avatar', 'ssl');
+
+ if (is_null($ssl)) { // null -> guess
+ if (common_config('site', 'ssl') == 'always' &&
+ !common_config('avatar', 'server')) {
+ $ssl = true;
+ } else {
+ $ssl = false;
+ }
+ }
+
+ $protocol = ($ssl) ? 'https' : 'http';
- return 'http://'.$server.$path.$filename;
+ return $protocol.'://'.$server.$path.$filename;
}
function displayUrl()
diff --git a/classes/Design.php b/classes/Design.php
index 4e7d7dfb2..ff44e0109 100644
--- a/classes/Design.php
+++ b/classes/Design.php
@@ -155,9 +155,20 @@ class Design extends Memcached_DataObject
$server = common_config('site', 'server');
}
- // XXX: protocol
+ $ssl = common_config('background', 'ssl');
+
+ if (is_null($ssl)) { // null -> guess
+ if (common_config('site', 'ssl') == 'always' &&
+ !common_config('background', 'server')) {
+ $ssl = true;
+ } else {
+ $ssl = false;
+ }
+ }
+
+ $protocol = ($ssl) ? 'https' : 'http';
- return 'http://'.$server.$path.$filename;
+ return $protocol.'://'.$server.$path.$filename;
}
function setDisposition($on, $off, $tile)
diff --git a/classes/File.php b/classes/File.php
index ee418a802..91b12d2e2 100644
--- a/classes/File.php
+++ b/classes/File.php
@@ -228,9 +228,20 @@ class File extends Memcached_DataObject
$server = common_config('site', 'server');
}
- // XXX: protocol
+ $ssl = common_config('attachments', 'ssl');
- return 'http://'.$server.$path.$filename;
+ if (is_null($ssl)) { // null -> guess
+ if (common_config('site', 'ssl') == 'always' &&
+ !common_config('attachments', 'server')) {
+ $ssl = true;
+ } else {
+ $ssl = false;
+ }
+ }
+
+ $protocol = ($ssl) ? 'https' : 'http';
+
+ return $protocol.'://'.$server.$path.$filename;
}
}
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;
}
}