]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Avatar.php
Merge remote-tracking branch 'gitorious/1.0.x' into 1.0.x
[quix0rs-gnu-social.git] / classes / Avatar.php
index 8d6424e8b2d1f53c5ccec912404ccde6ee7b26d9..bdf3739bbf86b6541853f7e2594cc4b330c7a9e5 100644 (file)
@@ -27,7 +27,12 @@ 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
+       static function pivotGet($keyCol, $keyVals, $otherCols)
+       {
+           return Memcached_DataObject::pivotGet('Avatar', $keyCol, $keyVals, $otherCols);
+       }
+       
+    // We clean up the file, too
 
     function delete()
     {
@@ -37,13 +42,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,15 +88,26 @@ 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()
     {
         $server = common_config('avatar', 'server');
-        if ($server) {
+        if ($server && !empty($this->filename)) {
             return Avatar::url($this->filename);
         } else {
             return $this->url;