summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-02-11 17:03:31 -0500
committerEvan Prodromou <evan@status.net>2010-02-11 17:03:31 -0500
commit3018683718bd73bf00472622f9e81914703d50a7 (patch)
treefb4fd8e96fed48555459a16f33b76e55617ecf88
parentb96af33d978bddfa66aa893ff1d59f2d83903afa (diff)
let backgrounds be put under SSL
-rw-r--r--README2
-rw-r--r--classes/Design.php15
-rw-r--r--lib/default.php3
3 files changed, 17 insertions, 3 deletions
diff --git a/README b/README
index 7531df997..3b2baaeeb 100644
--- a/README
+++ b/README
@@ -1521,6 +1521,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/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/lib/default.php b/lib/default.php
index 8a21271b8..0822654f6 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -116,7 +116,8 @@ $default =
'background' =>
array('server' => null,
'dir' => INSTALLDIR . '/background/',
- 'path' => $_path . '/background/'),
+ 'path' => $_path . '/background/',
+ 'ssl' => null),
'public' =>
array('localonly' => true,
'blacklist' => array(),