]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/api.php
Delete design when user chooses to restore default design, instead
[quix0rs-gnu-social.git] / lib / api.php
index 539aac4af252adfafa14fa9b325d441c866f0caf..5a3bb5ee451011aaec324399da0e6755929e70fc 100644 (file)
@@ -134,7 +134,6 @@ class ApiAction extends Action
         $twitter_user['protected'] = false; # not supported by StatusNet yet
         $twitter_user['followers_count'] = $profile->subscriberCount();
 
-        $defaultDesign = Design::siteDesign();
         $design        = null;
         $user          = $profile->getUser();
 
@@ -145,7 +144,7 @@ class ApiAction extends Action
         }
 
         if (empty($design)) {
-            $design = $defaultDesign;
+            $design = Design::siteDesign();
         }
 
         $color = Design::toWebColor(empty($design->backgroundcolor) ? $defaultDesign->backgroundcolor : $design->backgroundcolor);
@@ -1142,10 +1141,15 @@ class ApiAction extends Action
 
     function getTargetUser($id)
     {
-        if (!preg_match('/^[a-zA-Z0-9]+$/', $id)) {
+        if (empty($id)) {
 
             // Twitter supports these other ways of passing the user ID
-            if ($this->arg('user_id')) {
+            if (is_numeric($this->arg('id'))) {
+                return User::staticGet($this->arg('id'));
+            } else if ($this->arg('id')) {
+                $nickname = common_canonical_nickname($this->arg('id'));
+                return User::staticGet('nickname', $nickname);
+            } else if ($this->arg('user_id')) {
                 // This is to ensure that a non-numeric user_id still
                 // overrides screen_name even if it doesn't get used
                 if (is_numeric($this->arg('user_id'))) {
@@ -1154,12 +1158,6 @@ class ApiAction extends Action
             } else if ($this->arg('screen_name')) {
                 $nickname = common_canonical_nickname($this->arg('screen_name'));
                 return User::staticGet('nickname', $nickname);
-
-            } else if (is_numeric($this->arg('id'))) {
-                return User::staticGet($this->arg('id'));
-            } else if ($this->arg('id')) {
-                $nickname = common_canonical_nickname($this->arg('id'));
-                return User::staticGet('nickname', $nickname);
             } else {
                 // Fall back to trying the currently authenticated user
                 return $this->auth_user;