X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fitems.php;h=27a7db767b4d16c6ee8a8a8a57abc02507524a27;hb=ac1ff6c8ce9f23eebf5e53ce799c3b8b84d6de93;hp=610729bbbe094db6b7d4afa9eb512ff5519c5089;hpb=7f3fb34c24e30b79d8c25f63dbb2c3c3da79e599;p=friendica.git diff --git a/include/items.php b/include/items.php index 610729bbbe..27a7db767b 100644 --- a/include/items.php +++ b/include/items.php @@ -29,6 +29,10 @@ function add_page_info_data(array $data, $no_photos = false) { Addon::callHooks('page_info_data', $data); + if (empty($data['type'])) { + return ''; + } + // It maybe is a rich content, but if it does have everything that a link has, // then treat it that way if (($data["type"] == "rich") && is_string($data["title"]) && @@ -68,7 +72,8 @@ function add_page_info_data(array $data, $no_photos = false) $text .= " title='".$data["title"]."'"; } - if (!empty($data["images"])) { + // Only embedd a picture link when it seems to be a valid picture ("width" is set) + if (!empty($data["images"]) && !empty($data["images"][0]["width"])) { $preview = str_replace(["[", "]"], ["[", "]"], htmlentities($data["images"][0]["src"], ENT_QUOTES, 'UTF-8', false)); // if the preview picture is larger than 500 pixels then show it in a larger mode // But only, if the picture isn't higher than large (To prevent huge posts) @@ -264,23 +269,10 @@ function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0 if ($contact['network'] === Protocol::DFRN) { logger("Consume DFRN messages", LOGGER_DEBUG); - - $r = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`, - `contact`.`pubkey` AS `cpubkey`, - `contact`.`prvkey` AS `cprvkey`, - `contact`.`thumb` AS `thumb`, - `contact`.`url` as `url`, - `contact`.`name` as `senderName`, - `user`.* - FROM `contact` - LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` - WHERE `contact`.`id` = %d AND `user`.`uid` = %d", - DBA::escape($contact["id"]), DBA::escape($importer["uid"]) - ); - - if (DBA::isResult($r)) { + $dfrn_importer = DFRN::getImporter($contact["id"], $importer["uid"]); + if (!empty($dfrn_importer)) { logger("Now import the DFRN feed"); - DFRN::import($xml, $r[0], true); + DFRN::import($xml, $dfrn_importer, true); return; } } @@ -324,9 +316,9 @@ function subscribe_to_hub($url, array $importer, array $contact, $hubmode = 'sub DBA::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]); } - Network::post($url, $params); + $postResult = Network::post($url, $params); - logger('subscribe_to_hub: returns: ' . $a->get_curl_code(), LOGGER_DEBUG); + logger('subscribe_to_hub: returns: ' . $postResult->getReturnCode(), LOGGER_DEBUG); return; @@ -357,12 +349,12 @@ function drop_item($id) // locate item to be deleted - $fields = ['id', 'uid', 'contact-id', 'deleted']; + $fields = ['id', 'uid', 'guid', 'contact-id', 'deleted']; $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]); if (!DBA::isResult($item)) { notice(L10n::t('Item not found.') . EOL); - goaway(System::baseUrl() . '/' . $_SESSION['return_url']); + goaway('/network'); } if ($item['deleted']) { @@ -384,7 +376,7 @@ function drop_item($id) if ((local_user() == $item['uid']) || $contact_id) { // Check if we should do HTML-based delete confirmation - if ($_REQUEST['confirm']) { + if (!empty($_REQUEST['confirm'])) { //
can't take arguments in its "action" parameter // so add any arguments as hidden inputs $query = explode_querystring($a->query_string); @@ -408,18 +400,18 @@ function drop_item($id) ]); } // Now check how the user responded to the confirmation query - if ($_REQUEST['canceled']) { - goaway(System::baseUrl() . '/' . $_SESSION['return_url']); + if (!empty($_REQUEST['canceled'])) { + goaway('/display/' . $item['guid']); } // delete the item Item::deleteForUser(['id' => $item['id']], local_user()); - goaway(System::baseUrl() . '/' . $_SESSION['return_url']); + goaway('/network'); //NOTREACHED } else { notice(L10n::t('Permission denied.') . EOL); - goaway(System::baseUrl() . '/' . $_SESSION['return_url']); + goaway('/display/' . $item['guid']); //NOTREACHED } }