]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
fixup default avatar urls by using common function
authorEvan Prodromou <evan@prodromou.name>
Wed, 21 May 2008 15:54:48 +0000 (11:54 -0400)
committerEvan Prodromou <evan@prodromou.name>
Wed, 21 May 2008 15:54:48 +0000 (11:54 -0400)
darcs-hash:20080521155448-84dde-0e71fe5dccea49162911f80c65cd1e2a46043b14.gz

actions/showstream.php
actions/subscribed.php
actions/subscriptions.php
lib/common.php
lib/stream.php
lib/util.php

index 25baf2fc9da04dc379782a1529764dda5a76ad62..69d9ecef9d727b8970bef2e871852bb1952b2eda 100644 (file)
@@ -174,7 +174,7 @@ class ShowstreamAction extends StreamAction {
                                                                                                'href' => $subs->profileurl,
                                                                                                'class' => 'subscription'));
                                $avatar = $subs->getAvatar(AVATAR_MINI_SIZE);
-                               common_element('img', array('src' => (($avatar) ? $avatar->url : $config['avatar']['default']['mini']),
+                               common_element('img', array('src' => (($avatar) ? $avatar->url :  common_default_avatar(AVATAR_MINI_SIZE),
                                                                                        'width' => AVATAR_MINI_SIZE,
                                                                                        'height' => AVATAR_MINI_SIZE,
                                                                                        'class' => 'avatar mini',
index 659118fb978ffd6530b0e491f90ae93a60f5a0c4..3218e07b868c71eb21f8685151692e1108086b66 100644 (file)
@@ -69,7 +69,7 @@ class SubscribedAction extends Action {
                                                                                        'href' => $subs->profileurl,
                                                                                        'class' => 'subscription'));
                        $avatar = $subs->getAvatar(AVATAR_STREAM_SIZE);
-                       common_element('img', array('src' => (($avatar) ? $avatar->url : $config['avatar']['default']['stream']),
+                       common_element('img', array('src' => (($avatar) ? $avatar->url : common_default_avatar(AVATAR_STREAM_SIZE)),
                                                                                'width' => AVATAR_STREAM_SIZE,
                                                                                'height' => AVATAR_STREAM_SIZE,
                                                                                'class' => 'avatar stream',
index c15bd53109bd386b377a6ee20728fd6234898899..f111d0be2e5a7180c0be884028fa4ab4bfcf64de 100644 (file)
@@ -68,7 +68,7 @@ class SubscriptionsAction extends Action {
                        common_element('img', 
                                                   array('src' => 
                                                                 (($avatar) ? $avatar->url : 
-                                                                 $config['avatar']['default']['stream']),
+                                                                 common_default_avatar(AVATAR_STREAM_SIZE)),
                                                                 'width' => AVATAR_STREAM_SIZE,
                                                                 'height' => AVATAR_STREAM_SIZE,
                                                                 'class' => 'avatar stream',
index c6bc97d829b828c43110dfe3137c3466573a2e6b..50d0110e287b67892b7457fe071f990cd3332fac 100644 (file)
@@ -45,13 +45,11 @@ $config =
                          'image' => 'http://i.creativecommons.org/l/by/3.0/88x31.png'),
                'avatar' =>
                array('directory' => INSTALLDIR . '/avatar',
-                         'path' => '/avatar'));
-
-# these depend on defaults above
-$config['avatar']['default'] =
-  array('profile' =>  "http://".$config['site']['server'].$config['site']['path'].'/'.'theme/default/image/default-avatar-profile.png',
-               'stream' => "http://".$config['site']['server'].$config['site']['path'].'/'.'theme/default/image/default-avatar-stream.png',
-               'mini' => "http://".$config['site']['server'].$config['site']['path'].'/'.'theme/default/image/default-avatar-mini.png');
+                         'path' => '/avatar',
+                         'default' => 
+                         array('profile' => 'theme/default/image/default-avatar-profile.png',
+                                       'stream' => 'theme/default/image/default-avatar-stream.png',
+                                       'mini' => 'theme/default/image/default-avatar-mini.png')));
 
 $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
 
index a9c01095ec4ae4c503b280d1680522c941876114..4b7d6ed24ec72ddd22582541e3566e4d7b8d36eb 100644 (file)
@@ -35,7 +35,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 : $config['avatar']['default']['stream'],
+               common_element('img', array('src' => ($avatar) ? $avatar->url : common_default_avatar(AVATAR_STREAM_SIZE),
                                                                        'class' => 'avatar stream',
                                                                        'width' => AVATAR_STREAM_SIZE,
                                                                        'height' => AVATAR_STREAM_SIZE,
index 9635c1abbd4dd30ee77a91c41dfc90d0cae40c66..09c4705a725305de55e4b155f6a5d808eb3776ad 100644 (file)
@@ -368,6 +368,14 @@ function common_avatar_url($filename) {
        return "http://".$config['site']['server'].$config['avatar']['path'].'/'.$filename;
 }
 
+function common_default_avatar($size) {
+       static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile',
+                                                         AVATAR_STREAM_SIZE => 'stream',
+                                                         AVATAR_MINI_SIZE => 'mini');
+       global $config;
+       return "http://".$config['site']['server'].$config['avatar']['path'].'/'.$config['avatar']['default'][$sizenames[$size]];
+}
+
 function common_local_url($action, $args=NULL) {
        global $config;
        /* XXX: pretty URLs */