summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-07-03 13:03:47 -0400
committerEvan Prodromou <evan@prodromou.name>2008-07-03 13:03:47 -0400
commit7816e4122a1e9edb241c009b800714e31db5c356 (patch)
treeffb4cd019ed79bdd62ac23b60356c1acc0b722b3 /lib
parent121b7e60b491ecc01634d275f6b234f2cb628f01 (diff)
add a display url function to display URLs
darcs-hash:20080703170347-84dde-1ba2e178dd4051aa63e4073e472c73240e3d9fe8.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/gallery.php2
-rw-r--r--lib/stream.php2
-rw-r--r--lib/util.php14
3 files changed, 11 insertions, 7 deletions
diff --git a/lib/gallery.php b/lib/gallery.php
index 4bc7baf5d..f227c93d2 100644
--- a/lib/gallery.php
+++ b/lib/gallery.php
@@ -100,7 +100,7 @@ class GalleryAction extends Action {
$avatar = $other->getAvatar(AVATAR_STREAM_SIZE);
common_element('img',
array('src' =>
- (($avatar) ? $avatar->url :
+ (($avatar) ? common_avatar_display_url($avatar) :
common_default_avatar(AVATAR_STREAM_SIZE)),
'width' => AVATAR_STREAM_SIZE,
'height' => AVATAR_STREAM_SIZE,
diff --git a/lib/stream.php b/lib/stream.php
index b2f57fab3..a37e4dfa3 100644
--- a/lib/stream.php
+++ b/lib/stream.php
@@ -60,7 +60,7 @@ class StreamAction extends Action {
'id' => 'notice-' . $notice->id));
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
common_element_start('a', array('href' => $profile->profileurl));
- common_element('img', array('src' => ($avatar) ? $avatar->url : common_default_avatar(AVATAR_STREAM_SIZE),
+ common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
'class' => 'avatar stream',
'width' => AVATAR_STREAM_SIZE,
'height' => AVATAR_STREAM_SIZE,
diff --git a/lib/util.php b/lib/util.php
index 7b821e635..4d1abe51a 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -625,12 +625,16 @@ function common_avatar_path($filename) {
}
function common_avatar_url($filename) {
- $server = common_config('avatar', 'server');
- if ($server) {
- return 'http://'.$server.'/'.$filename;
- } else {
return common_path('avatar/'.$filename);
- }
+}
+
+function common_avatar_display_url($avatar) {
+ $server = common_config('avatar', 'server');
+ if ($server) {
+ return 'http://'.$server.'/'.$avatar->filename;
+ } else {
+ return $avatar->url;
+ }
}
function common_default_avatar($size) {