]> git.mxchange.org Git - friendica.git/blobdiff - include/items.php
Merge pull request #5813 from MrPetovan/task/update-composer
[friendica.git] / include / items.php
index 9922c447f009daf7002c20d23dcadbd6e7d505ba..9fd557a77885838ee1cd7b415eacac99b67a75d0 100644 (file)
@@ -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)
@@ -371,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'])) {
                        // <form> can't take arguments in its "action" parameter
                        // so add any arguments as hidden inputs
                        $query = explode_querystring($a->query_string);
@@ -395,7 +400,7 @@ function drop_item($id)
                        ]);
                }
                // Now check how the user responded to the confirmation query
-               if ($_REQUEST['canceled']) {
+               if (!empty($_REQUEST['canceled'])) {
                        goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
                }