X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FAvatar.php;h=0b5141ba53965420a4de1c9070118888c717fbd5;hb=8b0f45d0a715fd25beb0aef9d42de3b91c5cd1ca;hp=64f105179c85c24358c9e83f19dcdce6e9676a00;hpb=0fd8e758ade32204b452cc9fd40e071f0ec8c0f6;p=quix0rs-gnu-social.git diff --git a/classes/Avatar.php b/classes/Avatar.php index 64f105179c..0b5141ba53 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -27,7 +27,7 @@ class Avatar extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - # We clean up the file, too + // We clean up the file, too function delete() { @@ -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) { @@ -81,16 +82,27 @@ class Avatar extends Memcached_DataObject if (empty($server)) { $server = common_config('site', 'server'); } - common_debug('path = ' . $path); - // XXX: protocol - return 'http://'.$server.$path.$filename; + $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 $protocol.'://'.$server.$path.$filename; } function displayUrl() { $server = common_config('avatar', 'server'); - if ($server) { + if ($server && !empty($this->filename)) { return Avatar::url($this->filename); } else { return $this->url; @@ -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'); } }