1
0
Fork 0

Support for posting multiple pictures via API

This commit is contained in:
Michael 2019-08-06 05:34:04 +00:00
parent cbee91a61b
commit ae3c9eceed

View file

@ -1157,11 +1157,12 @@ function api_statuses_update($type)
}
}
// To-Do: Multiple IDs
if (requestdata('media_ids')) {
$ids = explode(',', requestdata('media_ids'));
foreach ($ids as $id) {
$r = q(
"SELECT `resource-id`, `scale`, `nickname`, `type`, `desc` FROM `photo` INNER JOIN `user` ON `user`.`uid` = `photo`.`uid` WHERE `resource-id` IN (SELECT `resource-id` FROM `photo` WHERE `id` = %d) AND `scale` > 0 AND `photo`.`uid` = %d ORDER BY `photo`.`width` DESC LIMIT 1",
intval(requestdata('media_ids')),
intval($id),
api_user()
);
if (DBA::isResult($r)) {
@ -1172,6 +1173,7 @@ function api_statuses_update($type)
$_REQUEST['body'] .= '[img=' . System::baseUrl() . '/photo/' . $r[0]['resource-id'] . '-' . $r[0]['scale'] . '.' . $ext . ']' . $description . '[/img][/url]';
}
}
}
// set this so that the item_post() function is quiet and doesn't redirect or emit json