diff options
author | Brion Vibber <brion@pobox.com> | 2010-02-16 09:25:09 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-02-16 09:25:09 -0800 |
commit | d5cbfe8071d56438cfa168dc3db56a959317eae0 (patch) | |
tree | c00ca6c3e0d1bd2fb9b05a515c337b6afce3a070 /classes/File.php | |
parent | d4f6235d7b8a40bd1b51370e7eb405cdb14e61fb (diff) | |
parent | 81b6b58e33f55054b7e5dd546f06dbdb5696ed92 (diff) |
Merge branch 'testing' into 0.9.x
Conflicts:
lib/iomaster.php
Diffstat (limited to 'classes/File.php')
-rw-r--r-- | classes/File.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/classes/File.php b/classes/File.php index 307fdb686..189e04ce0 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; } } |