let avatars be served over SSL

This commit is contained in:
Evan Prodromou 2010-02-11 16:51:15 -05:00
parent 5175b5062e
commit d6869cde7b
3 changed files with 17 additions and 3 deletions

2
README
View File

@ -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
------

View File

@ -82,9 +82,20 @@ class Avatar extends Memcached_DataObject
$server = common_config('site', 'server');
}
// XXX: protocol
$ssl = common_config('avatar', 'ssl');
return 'http://'.$server.$path.$filename;
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 $protocol.'://'.$server.$path.$filename;
}
function displayUrl()

View File

@ -111,7 +111,8 @@ $default =
'avatar' =>
array('server' => null,
'dir' => INSTALLDIR . '/avatar/',
'path' => $_path . '/avatar/'),
'path' => $_path . '/avatar/',
'ssl' => null),
'background' =>
array('server' => null,
'dir' => INSTALLDIR . '/background/',