]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apitimelineuser.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / actions / apitimelineuser.php
index 246daddfb3a7515d47ac8cf20b01b7f0c2d3427a..1ec6b74de6ea74bf495f1369820134beefb2c43c 100644 (file)
@@ -79,6 +79,10 @@ class ApiTimelineUserAction extends ApiBareAuthAction
             $this->clientError(_('No such user.'), 404);
         }
 
+        if (!$this->target->isLocal()) {
+            $this->serverError(_('Remote user timelines are not available here yet.'), 501);
+        }
+
         $this->notices = $this->getNotices();
 
         return true;
@@ -134,12 +138,17 @@ class ApiTimelineUserAction extends ApiBareAuthAction
                                           'id' => $this->target->id),
                                     array('max_id' => $this->next_id))
                     : null;
-        $lastNotice = $this->notices[0];
-        $lastId     = $lastNotice->id;
+
+        $prevExtra = array();
+        if (!empty($this->notices)) {
+            assert($this->notices[0] instanceof Notice);
+            $prevExtra['since_id'] = $this->notices[0]->id;
+        }
+
         $prevUrl = common_local_url('ApiTimelineUser',
                                     array('format' => $this->format,
                                           'id' => $this->target->id),
-                                    array('since_id' => $lastId));
+                                    $prevExtra);
         $firstUrl = common_local_url('ApiTimelineUser',
                                     array('format' => $this->format,
                                           'id' => $this->target->id));
@@ -224,7 +233,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
             break;
         default:
             // TRANS: Client error displayed when coming across a non-supported API method.
-            $this->clientError(_('API method not found.'), $code = 404);
+            $this->clientError(_('API method not found.'), 404);
         }
     }
 
@@ -400,7 +409,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
 
         // Get (safe!) HTML and text versions of the content
 
-        $rendered = $this->purify($sourceContent);
+        $rendered = common_purify($sourceContent);
         $content = common_strip_html($rendered);
 
         $shortened = $this->auth_user->shortenLinks($content);
@@ -499,13 +508,4 @@ class ApiTimelineUserAction extends ApiBareAuthAction
 
         return $saved;
     }
-
-    function purify($content)
-    {
-        require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
-
-        $config = array('safe' => 1,
-                        'deny_attribute' => 'id,style,on*');
-        return htmLawed($content, $config);
-    }
 }