]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Avatar.php
Notice_bookmark::saveNew() takes options arg
[quix0rs-gnu-social.git] / classes / Avatar.php
index 8d6424e8b2d1f53c5ccec912404ccde6ee7b26d9..6edc81768551e00780ae2cb3b2803bb94ab0bd82 100644 (file)
@@ -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()