function item_insert(int $uid, array $request, bool $preview, string $return_path)
{
- $emailcc = trim($request['emailcc'] ?? '');
- $parent_id = intval($request['parent'] ?? 0);
-
$post = ['uid' => $uid];
$post = DI::contentItem()->initializePost($post);
$post['postopts'] = '';
$post['file'] = '';
- if ($parent_id) {
- $parent_item = Post::selectFirst(Item::ITEM_FIELDLIST, ['id' => $parent_id]);
+ if (!empty($request['parent'])) {
+ $parent_item = Post::selectFirst(Item::ITEM_FIELDLIST, ['id' => $request['parent']]);
if (DBA::isResult($parent_item)) {
// if this isn't the top-level parent of the conversation, find it
if ($parent_item['gravity'] != Item::GRAVITY_PARENT) {
throw new HTTPException\InternalServerErrorException(DI::l10n()->t('Item couldn\'t be fetched.'));
}
- $recipients = explode(',', $emailcc);
+ $recipients = explode(',', $request['emailcc'] ?? '');
DI::contentItem()->postProcessPost($post, $recipients);