use anonymous image
authorChristian Weiske <cweiske@cweiske.de>
Tue, 17 Apr 2012 08:19:46 +0000 (10:19 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 17 Apr 2012 08:19:46 +0000 (10:19 +0200)
src/phorkie/Repository/Commit.php
src/phorkie/Tools.php
www/phorkie/anonymous.png [new file with mode: 0644]

index ec4a04a7aed1bc3f83409277b862fc74a4a6c552..ce00235590c4fd22d0e6cf0b0060fbdc777fd6ab 100644 (file)
@@ -20,7 +20,13 @@ class Repository_Commit
         require_once 'PEAR/Services/Libravatar.php';
 
         $s = new \Services_Libravatar();
-        return $s->url('cweiske@cweiske.de'/*$this->committerEmail*/, array('s' => 32));
+        return $s->url(
+            $this->committerEmail,
+            array(
+                'size'    => 32,
+                'default' => Tools::fullUrl('/phorkie/anonymous.png')
+            )
+        );
     }
 
     /**
index c6e4db5093007ed0c17292a6d53efc9dc058696d..d9b7637f7120b3f3fdd09e20ae2d2085579bd688 100644 (file)
@@ -21,6 +21,22 @@ class Tools
         return rmdir($path);
     }
 
+    /**
+     * Create a full URL with protocol and host name
+     *
+     * @param string $path Path to the file, with leading /
+     *
+     * @return string Full URL
+     */
+    public static function fullUrl($path)
+    {
+        if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) {
+            $prot = 'https';
+        } else {
+            $prot = 'http';
+        }
+        return $prot . '://' . $_SERVER['HTTP_HOST'] . $path;
+    }
 }
 
 ?>
\ No newline at end of file
diff --git a/www/phorkie/anonymous.png b/www/phorkie/anonymous.png
new file mode 100644 (file)
index 0000000..b218029
Binary files /dev/null and b/www/phorkie/anonymous.png differ