summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2009-12-04 22:40:07 +0000
committerZach Copley <zach@status.net>2009-12-04 22:42:09 +0000
commit4881be47c798688c3ae20f621d06e15adbc9c17e (patch)
tree6916c9d6964f2200dc6c8096990146a30538b991
parenteb0a5977ff7e325022d460ae3cf540f3415bd33d (diff)
Don't depend on a User being available when looking up Design and timezone
for a profile (because some profiles are remote, etc.)
-rw-r--r--lib/api.php10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/api.php b/lib/api.php
index 5a3bb5ee4..eacb80dbe 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -134,19 +134,17 @@ class ApiAction extends Action
$twitter_user['protected'] = false; # not supported by StatusNet yet
$twitter_user['followers_count'] = $profile->subscriberCount();
- $design = null;
$user = $profile->getUser();
+ $design = null;
// Note: some profiles don't have an associated user
+ $defaultDesign = Design::siteDesign();
+
if (!empty($user)) {
$design = $user->getDesign();
}
- if (empty($design)) {
- $design = Design::siteDesign();
- }
-
$color = Design::toWebColor(empty($design->backgroundcolor) ? $defaultDesign->backgroundcolor : $design->backgroundcolor);
$twitter_user['profile_background_color'] = ($color == null) ? '' : '#'.$color->hexValue();
$color = Design::toWebColor(empty($design->textcolor) ? $defaultDesign->textcolor : $design->textcolor);
@@ -165,7 +163,7 @@ class ApiAction extends Action
$timezone = 'UTC';
- if ($user->timezone) {
+ if (!empty($user) && !empty($user->timezone)) {
$timezone = $user->timezone;
}