]> git.mxchange.org Git - friendica.git/blobdiff - include/api.php
Merge remote-tracking branch 'upstream/develop' into 1601-api-statuses-lookup
[friendica.git] / include / api.php
index 91a3a34d110f20a926b780bd3db3a7d0cd25fa14..08bd835f3bf9bc5fa7f47d5c2534da135e3119bd 100644 (file)
@@ -5,6 +5,9 @@
  *
  * @todo Automatically detect if incoming data is HTML or BBCode
  */
+
+use \Friendica\Core\Config;
+
        require_once('include/HTTPExceptions.php');
 
        require_once('include/bbcode.php');
                                        }
                                }
                        }
+                       logger('API call not implemented: '.$a->query_string);
                        throw new NotImplementedException();
                } catch (HTTPException $e) {
                        header("HTTP/1.1 {$e->httpcode} {$e->httpdesc}");
                // count friends
                $r = q("SELECT count(*) as `count` FROM `contact`
                                WHERE  `uid` = %d AND `rel` IN ( %d, %d )
-                               AND `self`=0 AND NOT `blocked` AND `hidden`=0",
+                               AND `self`=0 AND NOT `blocked` AND NOT `pending` AND `hidden`=0",
                                intval($uinfo[0]['uid']),
                                intval(CONTACT_IS_SHARING),
                                intval(CONTACT_IS_FRIEND)
 
                $r = q("SELECT count(*) as `count` FROM `contact`
                                WHERE  `uid` = %d AND `rel` IN ( %d, %d )
-                               AND `self`=0 AND NOT `blocked` AND `hidden`=0",
+                               AND `self`=0 AND NOT `blocked` AND NOT `pending` AND `hidden`=0",
                                intval($uinfo[0]['uid']),
                                intval(CONTACT_IS_FOLLOWER),
                                intval(CONTACT_IS_FRIEND)
                );
 
                if ($r[0]['body'] != "") {
-                       if (!intval(get_config('system','old_share'))) {
-                               if (strpos($r[0]['body'], "[/share]") !== false) {
-                                       $pos = strpos($r[0]['body'], "[share");
-                                       $post = substr($r[0]['body'], $pos);
-                               } else {
-                                       $post = share_header($r[0]['author-name'], $r[0]['author-link'], $r[0]['author-avatar'], $r[0]['guid'], $r[0]['created'], $r[0]['plink']);
-
-                                       $post .= $r[0]['body'];
-                                       $post .= "[/share]";
-                               }
-                               $_REQUEST['body'] = $post;
-                       } else
-                               $_REQUEST['body'] = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8')."[url=".$r[0]['reply_url']."]".$r[0]['reply_author']."[/url] \n".$r[0]['body'];
+                       if (strpos($r[0]['body'], "[/share]") !== false) {
+                               $pos = strpos($r[0]['body'], "[share");
+                               $post = substr($r[0]['body'], $pos);
+                       } else {
+                               $post = share_header($r[0]['author-name'], $r[0]['author-link'], $r[0]['author-avatar'], $r[0]['guid'], $r[0]['created'], $r[0]['plink']);
 
+                               $post .= $r[0]['body'];
+                               $post .= "[/share]";
+                       }
+                       $_REQUEST['body'] = $post;
                        $_REQUEST['profile_uid'] = api_user();
                        $_REQUEST['type'] = 'wall';
                        $_REQUEST['api_source'] = true;
         *                      dislikes => int count
         */
        function api_format_items_activities(&$item, $type = "json") {
+
+               $a = get_app();
+
                $activities = array(
                        'like' => array(),
                        'dislike' => array(),
 
                        // Retweets are only valid for top postings
                        // It doesn't work reliable with the link if its a feed
-                       #$IsRetweet = ($item['owner-link'] != $item['author-link']);
-                       #if ($IsRetweet)
-                             $IsRetweet = (($item['owner-name'] != $item['author-name']) OR ($item['owner-avatar'] != $item['author-avatar']));
+                       //$IsRetweet = ($item['owner-link'] != $item['author-link']);
+                       //if ($IsRetweet)
+                       //      $IsRetweet = (($item['owner-name'] != $item['author-name']) OR ($item['owner-avatar'] != $item['author-avatar']));
 
 
                        if ($item["id"] == $item["parent"]) {
                $logo = App::get_baseurl() . '/images/friendica-64.png';
                $email = $a->config['admin_email'];
                $closed = (($a->config['register_policy'] == REGISTER_CLOSED) ? 'true' : 'false');
-               $private = (($a->config['system']['block_public']) ? 'true' : 'false');
+               $private = ((Config::get('system', 'block_public')) ? 'true' : 'false');
                $textlimit = (string) (($a->config['max_import_size']) ? $a->config['max_import_size'] : 200000);
                if($a->config['api_import_size'])
                        $texlimit = string($a->config['api_import_size']);
-               $ssl = (($a->config['system']['have_ssl']) ? 'true' : 'false');
+               $ssl = ((Config::get('system', 'have_ssl')) ? 'true' : 'false');
                $sslserver = (($ssl === 'true') ? str_replace('http:','https:',App::get_baseurl()) : '');
 
                $config = array(
 
                return api_format_data('version', $type, array('version' => $fake_statusnet_version));
        }
+       api_register_func('api/gnusocial/version','api_statusnet_version',false);
        api_register_func('api/statusnet/version','api_statusnet_version',false);
 
        /**