]> git.mxchange.org Git - friendica.git/commitdiff
API: missing template and small fix for hotot
authorfabrixxm <fabrix.xm@gmail.com>
Fri, 19 Aug 2011 13:09:10 +0000 (15:09 +0200)
committerfabrixxm <fabrix.xm@gmail.com>
Fri, 19 Aug 2011 13:09:10 +0000 (15:09 +0200)
include/api.php
view/api_friends_xml.tpl [new file with mode: 0644]

index f2dc8aff18f39f4ef7f00a26447361c3d4e6c214..dd169f8336cedc76a1dfc975637ac4b05bfdc191 100644 (file)
 
        /**
         *  https://dev.twitter.com/docs/api/1/get/statuses/friends 
-        *  This function is deprecated by Twitter 
+        *  This function is deprecated by Twitter
+        *  returns: json, xml 
         **/
        function api_statuses_f(&$a, $type, $qtype) {
                if (local_user()===false) return false;
                $user_info = api_get_user($a);
                
+               if (x($_GET,'cursor') && $_GET['cursor']=='undefined'){
+                       /* this is to stop Hotot to load friends multiple times
+                       *  I'm not sure if I'm missing return something or
+                       *  is a bug in hotot. Workaround, meantime
+                       */
+                       
+                       $ret=Array();
+                       $data = array('$users' => $ret);
+                       return  api_apply_template("friends", $type, $data);
+               }
+               
                if($qtype == 'friends')
                        $sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
                if($qtype == 'followers')
                        $ret[] = api_get_user($a, $cid['id']);
                }
 
+               
                $data = array('$users' => $ret);
-               switch($type){
-                       case "atom":
-                       case "rss":
-                               $data = api_rss_extra($a, $data, $user_info);
-               }
-                               
                return  api_apply_template("friends", $type, $data);
 
        }
diff --git a/view/api_friends_xml.tpl b/view/api_friends_xml.tpl
new file mode 100644 (file)
index 0000000..0ea7eb1
--- /dev/null
@@ -0,0 +1,5 @@
+<users type="array">
+       {{for $users as $user }}
+       {{inc api_user_xml.tpl }}{{endinc}}
+       {{endfor}}
+</users>