]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/api.php
whitespace in deletenotice.php
[quix0rs-gnu-social.git] / actions / api.php
index 47c1196052e25bd5a3ccf3dfe0a84b1ddcd55765..21fe4eea32004868e9a795422fcddb77ceaeaf73 100644 (file)
@@ -72,10 +72,14 @@ class ApiAction extends Action
             }
         } else {
 
-            # Look for the user in the session
-            if (common_logged_in()) {
-                 $this->user = common_current_user();
-            }
+                       # Caller might give us a username even if not required
+                       if (isset($_SERVER['PHP_AUTH_USER'])) {
+                               $user = User::staticGet('nickname', $_SERVER['PHP_AUTH_USER']);
+                               if ($user) {
+                                       $this->user = $user;
+                               }
+                               # Twitter doesn't throw an error if the user isn't found
+                       }
 
             $this->process_command();
         }
@@ -158,12 +162,12 @@ class ApiAction extends Action
 
         if ($this->content_type == 'xml') {
             header('Content-Type: application/xml; charset=utf-8');
-            common_start_xml();
+            $this->startXML();
             $this->elementStart('hash');
             $this->element('error', null, $msg);
             $this->element('request', null, $_SERVER['REQUEST_URI']);
             $this->elementEnd('hash');
-            common_end_xml();
+            $this->endXML();
         } else if ($this->content_type == 'json')  {
             header('Content-Type: application/json; charset=utf-8');
             $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);