1
0
Fork 0

Merge pull request #4802 from Rudloff/feature/api_get_user

api_get_user() should not return false right away if the number in the URL is not a valid user
This commit is contained in:
Hypolite Petovan 2018-04-10 05:28:56 -04:00 committed by GitHub
commit d6893a45fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -577,15 +577,13 @@ function api_get_user(App $a, $contact_id = null)
if (is_numeric($user)) { if (is_numeric($user)) {
$user = dbesc(api_unique_id_to_nurl(intval($user))); $user = dbesc(api_unique_id_to_nurl(intval($user)));
if ($user == "") { if ($user != "") {
return false;
}
$url = $user; $url = $user;
$extra_query = "AND `contact`.`nurl` = '%s' "; $extra_query = "AND `contact`.`nurl` = '%s' ";
if (api_user() !== false) { if (api_user() !== false) {
$extra_query .= "AND `contact`.`uid`=" . intval(api_user()); $extra_query .= "AND `contact`.`uid`=" . intval(api_user());
} }
}
} else { } else {
$user = dbesc($user); $user = dbesc($user);
$extra_query = "AND `contact`.`nick` = '%s' "; $extra_query = "AND `contact`.`nick` = '%s' ";