}
$parent_id = intval($item['parent']);
- $condition = ['id' => [$item_id, $parent_id], 'visible' => true, 'moderated' => false];
+ $condition = ['id' => [$item_id, $parent_id], 'moderated' => false];
$params = ['order' => ['id']];
$itemdata = Item::select([], $condition, $params);
}
DBA::close($itemdata);
+ if (empty($target_item)) {
+ logger('Item ' . $item_id . "wasn't found. Quitting here.");
+ return;
+ }
+
+ if (empty($parent)) {
+ logger('Parent ' . $parent_id . ' for item ' . $item_id . "wasn't found. Quitting here.");
+ return;
+ }
+
$uid = $target_item['contact-uid'];
// avoid race condition with deleting entries
$user = DBA::selectFirst('user', [], ['uid' => $target_uid]);
+ // This should also never fail
+ if (!DBA::isResult($user)) {
+ logger('No user found for uid ' . $target_uid);
+ return;
+ }
+
$target_importer = array_merge($target_importer, $user);
// Set the user id. This is important if this is a public contact
// Se we transmit with the new method and via Diaspora as a fallback
if (!empty($items) && (($items[0]['uid'] == 0) || ($contact['uid'] == 0))) {
// Transmit in public if it's a relay post
- $public_dfrn = ($contact['contact-type'] == ACCOUNT_TYPE_RELAY);
+ $public_dfrn = ($contact['contact-type'] == Contact::ACCOUNT_TYPE_RELAY);
$deliver_status = DFRN::transmit($owner, $contact, $atom, $public_dfrn);
private static function deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup)
{
// We don't treat Forum posts as "wall-to-wall" to be able to post them via Diaspora
- $walltowall = $top_level && ($owner['id'] != $items[0]['contact-id']) & ($owner['account-type'] != ACCOUNT_TYPE_COMMUNITY);
+ $walltowall = $top_level && ($owner['id'] != $items[0]['contact-id']) & ($owner['account-type'] != Contact::ACCOUNT_TYPE_COMMUNITY);
if ($public_message) {
$loc = 'public batch ' . $contact['batch'];
// only expose our real email address to true friends
- if (($contact['rel'] == CONTACT_IS_FRIEND) && !$contact['blocked']) {
+ if (($contact['rel'] == Contact::FRIEND) && !$contact['blocked']) {
if ($reply_to) {
$headers = 'From: ' . Email::encodeHeader($local_user['username'],'UTF-8') . ' <' . $reply_to.'>' . "\n";
$headers .= 'Sender: ' . $local_user['email'] . "\n";