Merge pull request #5234 from fabrixxm/fix/api

API: fix sender/recipient of PMs
This commit is contained in:
Michael Vogel 2018-06-18 12:03:53 +02:00 committed by GitHub
commit f828350ba2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3700,12 +3700,9 @@ api_register_func('api/direct_messages/destroy', 'api_direct_messages_destroy',
function api_direct_messages_box($type, $box, $verbose) function api_direct_messages_box($type, $box, $verbose)
{ {
$a = get_app(); $a = get_app();
$user_info = api_get_user($a); if (api_user() === false) {
if (api_user() === false || $user_info === false) {
throw new ForbiddenException(); throw new ForbiddenException();
} }
// params // params
$count = (x($_GET, 'count') ? $_GET['count'] : 20); $count = (x($_GET, 'count') ? $_GET['count'] : 20);
$page = (x($_REQUEST, 'page') ? $_REQUEST['page'] -1 : 0); $page = (x($_REQUEST, 'page') ? $_REQUEST['page'] -1 : 0);
@ -3726,6 +3723,10 @@ function api_direct_messages_box($type, $box, $verbose)
unset($_REQUEST["screen_name"]); unset($_REQUEST["screen_name"]);
unset($_GET["screen_name"]); unset($_GET["screen_name"]);
$user_info = api_get_user($a);
if ($user_info === false) {
throw new ForbiddenException();
}
$profile_url = $user_info["url"]; $profile_url = $user_info["url"];
// pagination // pagination