From 0691d83bbc2d6d28ee2f4e9dd4e8fc11ff644939 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 23 Dec 2017 01:23:20 +0100 Subject: [PATCH 1/8] Typo --- include/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/api.php b/include/api.php index 07c83f8625..e561f397c0 100644 --- a/include/api.php +++ b/include/api.php @@ -399,7 +399,7 @@ function api_call(App $a) * * @param string $type Return type (xml, json, rss, as) * @param object $e HTTPException Error object - * @return strin error message formatted as $type + * @return string error message formatted as $type */ function api_error($type, $e) { From 37aef324406498445770f41f7d5b921ad6599b77 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 23 Dec 2017 01:23:28 +0100 Subject: [PATCH 2/8] Remove unused variable --- include/api.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/api.php b/include/api.php index e561f397c0..724568279a 100644 --- a/include/api.php +++ b/include/api.php @@ -950,8 +950,6 @@ function api_create_xml($data, $root_element) */ function api_format_data($root_element, $type, $data) { - $a = get_app(); - switch ($type) { case "atom": case "rss": From b4cf27e76731556c2b4d2941f51b74e1935e0ba7 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 23 Dec 2017 01:25:43 +0100 Subject: [PATCH 3/8] api_format_data can also return an array --- include/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/api.php b/include/api.php index 724568279a..b6181ea1a4 100644 --- a/include/api.php +++ b/include/api.php @@ -946,7 +946,7 @@ function api_create_xml($data, $root_element) * @param string $type Return type (atom, rss, xml, json) * @param array $data JSON style array * - * @return (string|object) XML data or JSON data + * @return (string|object|array) XML data or JSON data */ function api_format_data($root_element, $type, $data) { From 521d4b09b6b1ef6f3d35529f562a3e0cd2ee1c99 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 23 Dec 2017 01:27:17 +0100 Subject: [PATCH 4/8] Unused argument --- include/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/api.php b/include/api.php index b6181ea1a4..c9c227daaa 100644 --- a/include/api.php +++ b/include/api.php @@ -1494,7 +1494,7 @@ function api_users_search($type) if (DBM::is_result($r)) { $k = 0; foreach ($r as $user) { - $user_info = api_get_user($a, $user["id"], "json"); + $user_info = api_get_user($a, $user["id"]); if ($type == "xml") { $userlist[$k++.":user"] = $user_info; From 70ab9dc9bea07a90fa19937a0f4ae8606ced21fa Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 23 Dec 2017 01:30:50 +0100 Subject: [PATCH 5/8] Undefined variable --- include/api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/api.php b/include/api.php index c9c227daaa..d7e383d53c 100644 --- a/include/api.php +++ b/include/api.php @@ -3163,10 +3163,10 @@ function api_statuses_f($qtype) return false; } + $sql_extra = ''; if ($qtype == 'friends') { $sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND)); - } - if ($qtype == 'followers') { + } elseif ($qtype == 'followers') { $sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_FOLLOWER), intval(CONTACT_IS_FRIEND)); } From da6a7b1fced470f2ac47118862d51d6674b718cb Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 23 Dec 2017 01:32:47 +0100 Subject: [PATCH 6/8] Typo --- include/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/api.php b/include/api.php index d7e383d53c..deb6a76da4 100644 --- a/include/api.php +++ b/include/api.php @@ -3311,7 +3311,7 @@ function api_statusnet_config($type) $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']); + $textlimit = (string) $a->config['api_import_size']; } $ssl = ((Config::get('system', 'have_ssl')) ? 'true' : 'false'); $sslserver = (($ssl === 'true') ? str_replace('http:', 'https:', System::baseUrl()) : ''); From f2758d00fb133ad5524ecd84e40437db457a6253 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 23 Dec 2017 01:34:12 +0100 Subject: [PATCH 7/8] Unused variable --- include/api.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/include/api.php b/include/api.php index deb6a76da4..f44afd3a41 100644 --- a/include/api.php +++ b/include/api.php @@ -3363,17 +3363,6 @@ function api_ff_ids($type,$qtype) $user_info = api_get_user($a); - if ($qtype == 'friends') { - $sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND)); - } - if ($qtype == 'followers') { - $sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_FOLLOWER), intval(CONTACT_IS_FRIEND)); - } - - if (!$user_info["self"]) { - $sql_extra = " AND false "; - } - $stringify_ids = (x($_REQUEST, 'stringify_ids') ? $_REQUEST['stringify_ids'] : false); $r = q( From ca73ec5cbbd286cf902c128322d7d6a0e0fabc3e Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 23 Dec 2017 01:36:55 +0100 Subject: [PATCH 8/8] Incorrect return type --- include/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/api.php b/include/api.php index f44afd3a41..42937b3aac 100644 --- a/include/api.php +++ b/include/api.php @@ -4594,7 +4594,7 @@ api_register_func('api/friendica/remoteauth', 'api_friendica_remoteauth', true); * @brief Return the item shared, if the item contains only the [share] tag * * @param array $item Sharer item - * @return array Shared item or false if not a reshare + * @return array|false Shared item or false if not a reshare */ function api_share_as_retweet(&$item) {