]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apitimelinepublic.php
Undefined Variable in foafgroup.php
[quix0rs-gnu-social.git] / actions / apitimelinepublic.php
index 58e26773483bf0d2ebedbd111f1112d0fa72d403..9034614253d438b5566a1993c6b1da0182094b18 100644 (file)
@@ -37,7 +37,7 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require_once INSTALLDIR . '/lib/api.php';
+require_once INSTALLDIR . '/lib/apiprivateauth.php';
 
 /**
  * Returns the most recent notices (default 20) posted by everybody
@@ -55,7 +55,7 @@ require_once INSTALLDIR . '/lib/api.php';
  * @link     http://status.net/
  */
 
-class ApiTimelinePublicAction extends ApiAction
+class ApiTimelinePublicAction extends ApiPrivateAuthAction
 {
 
     var $notices = null;
@@ -103,10 +103,12 @@ class ApiTimelinePublicAction extends ApiAction
     function showTimeline()
     {
         $sitename   = common_config('site', 'name');
+        $sitelogo   = (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png');
         $title      = sprintf(_("%s public timeline"), $sitename);
-        $taguribase = common_config('integration', 'taguri');
+        $taguribase = TagURI::base();
         $id         = "tag:$taguribase:PublicTimeline";
-        $link       = common_root_url();
+        $link       = common_local_url('public');
+        $self       = $this->getSelfUri();
         $subtitle   = sprintf(_("%s updates from everyone!"), $sitename);
 
         switch($this->format) {
@@ -114,20 +116,39 @@ class ApiTimelinePublicAction extends ApiAction
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
-            $this->showRssTimeline($this->notices, $title, $link, $subtitle);
+            $this->showRssTimeline(
+                $this->notices,
+                $title,
+                $link,
+                $subtitle,
+                null,
+                $sitelogo,
+                $self
+            );
             break;
         case 'atom':
-            $selfuri = common_root_url() . 'api/statuses/public_timeline.atom';
-            $this->showAtomTimeline(
-                $this->notices, $title, $id, $link,
-                $subtitle, null, $selfuri
-            );
+
+            header('Content-Type: application/atom+xml; charset=utf-8');
+
+            $atom = new AtomNoticeFeed();
+
+            $atom->setId($id);
+            $atom->setTitle($title);
+            $atom->setSubtitle($subtitle);
+            $atom->setLogo($sitelogo);
+            $atom->setUpdated('now');
+            $atom->addLink(common_local_url('public'));
+            $atom->setSelfLink($self);
+            $atom->addEntryFromNotices($this->notices);
+
+            $this->raw($atom->getString());
+
             break;
         case 'json':
             $this->showJsonTimeline($this->notices);
             break;
         default:
-            $this->clientError(_('API method not found!'), $code = 404);
+            $this->clientError(_('API method not found.'), $code = 404);
             break;
         }
     }
@@ -144,7 +165,7 @@ class ApiTimelinePublicAction extends ApiAction
 
         $notice = Notice::publicStream(
             ($this->page - 1) * $this->count, $this->count, $this->since_id,
-            $this->max_id, $this->since
+            $this->max_id
         );
 
         while ($notice->fetch()) {