]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Avatar.php
let avatars be served over SSL
[quix0rs-gnu-social.git] / classes / Avatar.php
index 91bde0f0401b6dc144b48a6ba434c312c80c967c..dbe2cd813847eb585f94999b595e2f495ab0d03b 100644 (file)
@@ -82,9 +82,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()