]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Avatar.php
Yammer import API keys can now be overridden by the admin.
[quix0rs-gnu-social.git] / classes / Avatar.php
index 64f105179c85c24358c9e83f19dcdce6e9676a00..dbe2cd813847eb585f94999b595e2f495ab0d03b 100644 (file)
@@ -37,7 +37,7 @@ class Avatar extends Memcached_DataObject
         }
     }
 
-    function &pkeyGet($kv)
+    function pkeyGet($kv)
     {
         return Memcached_DataObject::pkeyGet('Avatar', $kv);
     }
@@ -81,10 +81,21 @@ 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()
@@ -102,6 +113,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');
     }
 }