X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fapi.php;h=9fc853340af520d22f9a56b945906a7bd54e9fd2;hb=e4917503dae5b3b97a6414f55b716a1fd7d24bc1;hp=64a896b55498e2579e475225c08e5d385bfcd8f2;hpb=0c310db23d253e489c27b80f99aeaaa06275fea6;p=friendica.git diff --git a/include/api.php b/include/api.php index 64a896b554..9fc853340a 100644 --- a/include/api.php +++ b/include/api.php @@ -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'); @@ -349,6 +352,7 @@ } } } + logger('API call not implemented: '.$a->query_string); throw new NotImplementedException(); } catch (HTTPException $e) { header("HTTP/1.1 {$e->httpcode} {$e->httpdesc}"); @@ -623,7 +627,7 @@ // 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) @@ -632,7 +636,7 @@ $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) @@ -1683,20 +1687,16 @@ ); 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; @@ -2696,11 +2696,11 @@ $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( @@ -2721,6 +2721,7 @@ return api_format_data('config', $type, array('config' => $config)); } + api_register_func('api/gnusocial/config','api_statusnet_config',false); api_register_func('api/statusnet/config','api_statusnet_config',false); function api_statusnet_version($type) { @@ -2729,6 +2730,7 @@ 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); /** @@ -3964,7 +3966,7 @@ $multi_profiles = feature_enabled(api_user(),'multi_profiles'); $directory = get_config('system', 'directory'); -// get data of the specified profile id or all profiles of the user if not specified + // get data of the specified profile id or all profiles of the user if not specified if ($profileid != 0) { $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d", intval(api_user()), @@ -3972,11 +3974,10 @@ // error message if specified gid is not in database if (!dbm::is_result($r)) throw new BadRequestException("profile_id not available"); - } - else + } else { $r = q("SELECT * FROM `profile` WHERE `uid` = %d", intval(api_user())); - + } // loop through all returned profiles and retrieve data and users $k = 0; foreach ($r as $rr) { @@ -4003,9 +4004,11 @@ } // return settings, authenticated user and profiles data + $self = q("SELECT `nurl` FROM `contact` WHERE `uid`= %d AND `self` LIMIT 1", intval(api_user())); + $result = array('multi_profiles' => $multi_profiles ? true : false, 'global_dir' => $directory, - 'friendica_owner' => api_get_user($a, intval(api_user())), + 'friendica_owner' => api_get_user($a, $self[0]['nurl']), 'profiles' => $profiles); return api_format_data("friendica_profiles", $type, array('$result' => $result)); }