]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/apiaction.php
Ticket #2291: fix typo in SMS doc
[quix0rs-gnu-social.git] / lib / apiaction.php
index 73777f4e8891182133277ff2e0a2296e9306e2e4..59dc47c23beee0daa678b1a2fec3d89fe5ed1339 100644 (file)
@@ -318,7 +318,6 @@ class ApiAction extends Action
         $twitter_group['url']=$group->permalink();
         $twitter_group['nickname']=$group->nickname;
         $twitter_group['fullname']=$group->fullname;
-        $twitter_group['homepage_url']=$group->homepage_url;
         $twitter_group['original_logo']=$group->original_logo;
         $twitter_group['homepage_logo']=$group->homepage_logo;
         $twitter_group['stream_logo']=$group->stream_logo;
@@ -491,7 +490,7 @@ class ApiAction extends Action
                 $this->showXmlAttachments($twitter_status['attachments']);
                 break;
             case 'geo':
-                $this->showGeoRSS($value);
+                $this->showGeoXML($value);
                 break;
             case 'retweeted_status':
                 $this->showTwitterXmlStatus($value, 'retweeted_status');
@@ -539,6 +538,18 @@ class ApiAction extends Action
         }
     }
 
+    function showGeoXML($geo)
+    {
+        if (empty($geo)) {
+            // empty geo element
+            $this->element('geo');
+        } else {
+            $this->elementStart('geo', array('xmlns:georss' => 'http://www.georss.org/georss'));
+            $this->element('georss:point', null, $geo['coordinates'][0] . ' ' . $geo['coordinates'][1]);
+            $this->elementEnd('geo');
+        }
+    }
+
     function showGeoRSS($geo)
     {
         if (!empty($geo)) {
@@ -743,8 +754,12 @@ class ApiAction extends Action
     function showTwitterAtomEntry($entry)
     {
         $this->elementStart('entry');
-        $this->element('title', null, $entry['title']);
-        $this->element('content', array('type' => 'html'), $entry['content']);
+        $this->element('title', null, common_xml_safe_str($entry['title']));
+        $this->element(
+            'content',
+            array('type' => 'html'),
+            common_xml_safe_str($entry['content'])
+        );
         $this->element('id', null, $entry['id']);
         $this->element('published', null, $entry['published']);
         $this->element('updated', null, $entry['updated']);
@@ -859,7 +874,7 @@ class ApiAction extends Action
 
         $this->initDocument('atom');
 
-        $this->element('title', null, $title);
+        $this->element('title', null, common_xml_safe_str($title));
         $this->element('id', null, $id);
         $this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
 
@@ -869,7 +884,7 @@ class ApiAction extends Action
         }
 
         $this->element('updated', null, common_date_iso8601('now'));
-        $this->element('subtitle', null, $subtitle);
+        $this->element('subtitle', null, common_xml_safe_str($subtitle));
 
         if (is_array($group)) {
             foreach ($group as $g) {
@@ -1257,7 +1272,7 @@ class ApiAction extends Action
                 if (empty($local)) {
                     return null;
                 } else {
-                    return User_group::staticGet('id', $local->id);
+                    return User_group::staticGet('id', $local->group_id);
                 }
             }
 
@@ -1354,8 +1369,27 @@ class ApiAction extends Action
         }
     }
 
-    function getSelfUri($action, $aargs)
+    /**
+     * Calculate the complete URI that called up this action.  Used for
+     * Atom rel="self" links.  Warning: this is funky.
+     *
+     * @return string URL    a URL suitable for rel="self" Atom links
+     */
+    function getSelfUri()
     {
+        $action = mb_substr(get_class($this), 0, -6); // remove 'Action'
+
+        $id = $this->arg('id');
+        $aargs = array('format' => $this->format);
+        if (!empty($id)) {
+            $aargs['id'] = $id;
+        }
+
+        $tag = $this->arg('tag');
+        if (!empty($tag)) {
+            $aargs['tag'] = $tag;
+        }
+
         parse_str($_SERVER['QUERY_STRING'], $params);
         $pstring = '';
         if (!empty($params)) {