X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fitem.php;h=f164fb0ae2c6f4347225dd08ab112cdcd66ee1b4;hb=82d55f120fd2163afaa57cd64c6a10a626abd2e5;hp=ccf98667c8793ee99cfc7208905cda10e32b57a0;hpb=5e7285b9ba3236e3c5b6163df323eefebbc8b20e;p=friendica.git diff --git a/mod/item.php b/mod/item.php index ccf98667c8..f164fb0ae2 100644 --- a/mod/item.php +++ b/mod/item.php @@ -24,7 +24,6 @@ use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBM; use Friendica\Model\Contact; -use Friendica\Model\GContact; use Friendica\Model\Item; use Friendica\Protocol\Diaspora; use Friendica\Protocol\Email; @@ -32,8 +31,6 @@ use Friendica\Util\DateTimeFormat; use Friendica\Util\Emailer; require_once 'include/enotify.php'; -require_once 'include/tags.php'; -require_once 'include/threads.php'; require_once 'include/text.php'; require_once 'include/items.php'; @@ -232,7 +229,7 @@ function item_post(App $a) { $verb = notags(trim($_REQUEST['verb'])); $emailcc = notags(trim($_REQUEST['emailcc'])); $body = escape_tags(trim($_REQUEST['body'])); - $network = notags(trim($_REQUEST['network'])); + $network = notags(trim(defaults($_REQUEST, 'network', NETWORK_DFRN))); $guid = get_guid(32); $postopts = defaults($_REQUEST, 'postopts', ''); @@ -579,7 +576,7 @@ function item_post(App $a) { $notify_type = ($parent ? 'comment-new' : 'wall-new'); - $uri = ($message_id ? $message_id : item_new_uri($a->get_hostname(), $profile_uid, $guid)); + $uri = ($message_id ? $message_id : Item::newURI($profile_uid, $guid)); // Fallback so that we alway have a parent uri if (!$thr_parent_uri || !$parent) { @@ -596,11 +593,11 @@ function item_post(App $a) { $datarray['owner-name'] = $contact_record['name']; $datarray['owner-link'] = $contact_record['url']; $datarray['owner-avatar'] = $contact_record['thumb']; - $datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link'], 0); + $datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']); $datarray['author-name'] = $author['name']; $datarray['author-link'] = $author['url']; $datarray['author-avatar'] = $author['thumb']; - $datarray['author-id'] = Contact::getIdForURL($datarray['author-link'], 0); + $datarray['author-id'] = Contact::getIdForURL($datarray['author-link']); $datarray['created'] = DateTimeFormat::utcNow(); $datarray['edited'] = DateTimeFormat::utcNow(); $datarray['commented'] = DateTimeFormat::utcNow(); @@ -634,8 +631,6 @@ function item_post(App $a) { $datarray['postopts'] = $postopts; $datarray['origin'] = $origin; $datarray['moderated'] = false; - $datarray['gcontact-id'] = GContact::getId(["url" => $datarray['author-link'], "network" => $datarray['network'], - "photo" => $datarray['author-avatar'], "name" => $datarray['author-name']]); $datarray['object'] = $object; /* @@ -666,6 +661,11 @@ function item_post(App $a) { $datarray['edit'] = true; } + // Check for hashtags in the body and repair or add hashtag links + if ($preview || $orig_post) { + Item::setHashtags($datarray); + } + // preview mode - prepare the body for display and send it via json if ($preview) { require_once 'include/conversation.php'; @@ -813,7 +813,6 @@ function item_post(App $a) { $link = '' . $a->user['username'] . '

'; $html = prepare_body($datarray); $message = '' . $link . $html . $disclaimer . ''; - include_once 'include/html2plain.php'; $params = [ 'fromName' => $a->user['username'], 'fromEmail' => $a->user['email'], @@ -821,7 +820,7 @@ function item_post(App $a) { 'replyTo' => $a->user['email'], 'messageSubject' => $subject, 'htmlVersion' => $message, - 'textVersion' => html2plain($html.$disclaimer) + 'textVersion' => Friendica\Content\Text\HTML::toPlaintext($html.$disclaimer) ]; Emailer::send($params); } @@ -878,7 +877,7 @@ function item_content(App $a) { $o = ''; if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) { if (is_ajax()) { - $o = Item::delete($a->argv[2]); + $o = Item::deleteForUser(['id' => $a->argv[2]], local_user()); } else { $o = drop_item($a->argv[2]); }