X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FAvatar.php;h=6edc81768551e00780ae2cb3b2803bb94ab0bd82;hb=e0e7cb7c5376a7adfdcf8e0724aedfae3de471ef;hp=5e8b315fe6b419998b3617710d8f01baa8584651;hpb=97373d845cd68d6145f3751c9f602b13f04b37df;p=quix0rs-gnu-social.git diff --git a/classes/Avatar.php b/classes/Avatar.php index 5e8b315fe6..6edc817685 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -37,13 +37,14 @@ class Avatar extends Memcached_DataObject } } - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Avatar', $kv); } - // where should the avatar go for this user? - + /** + * Where should the avatar go for this user? + */ static function filename($id, $extension, $size=null, $extra=null) { if ($size) { @@ -82,9 +83,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() @@ -102,6 +114,6 @@ class Avatar extends Memcached_DataObject static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile', AVATAR_STREAM_SIZE => 'stream', AVATAR_MINI_SIZE => 'mini'); - return theme_path('default-avatar-'.$sizenames[$size].'.png'); + return Theme::path('default-avatar-'.$sizenames[$size].'.png'); } }