viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

adds media:image-tracking for tiny images likely used for tracking, stop lang: injection on image, a=chris

Chris Pollett [2019-06-26 21:Jun:th]
adds media:image-tracking for tiny images likely used for tracking, stop lang: injection on image, a=chris
Filename
src/controllers/MachineController.php
src/library/PhraseParser.php
src/models/PhraseModel.php
diff --git a/src/controllers/MachineController.php b/src/controllers/MachineController.php
index 2911da6f9..6eb696f57 100644
--- a/src/controllers/MachineController.php
+++ b/src/controllers/MachineController.php
@@ -155,7 +155,7 @@ class MachineController extends Controller implements CrawlConstants
                 $msg = "Restarting $channel-Fetcher $id";
                 $time_string = date("r", time());
                 $out_msg = "[$time_string] $msg\n";
-                $lines = L\tail(C\LOG_DIR."/$id-$channel-Fetcher.log", 10);
+                $lines = L\tail(C\LOG_DIR . "/$id-$channel-Fetcher.log", 10);
                 foreach ($lines as $line) {
                     $out_msg .= "!!!!$line\n";
                 }
diff --git a/src/library/PhraseParser.php b/src/library/PhraseParser.php
index 16e279e2d..dea65a263 100755
--- a/src/library/PhraseParser.php
+++ b/src/library/PhraseParser.php
@@ -1104,18 +1104,24 @@ class PhraseParser
             $meta_ids[] = "media:video";
         } else if (stripos($site[CrawlConstants::TYPE],
             "image") !== false) {
-            $meta_ids[] = 'media:image';
             if (!empty($site[CrawlConstants::WIDTH]) &&
                 !empty($site[CrawlConstants::HEIGHT])) {
                 $size = $site[CrawlConstants::WIDTH] *
                     $site[CrawlConstants::HEIGHT];
-                if ($size < 100000) {
-                    $meta_ids[] = 'media:image-small';
-                } else if ($size < 400000) {
-                    $meta_ids[] = 'media:image-medium';
+                if($size < 50) {
+                    $meta_ids[] = 'media:image-tracking';
                 } else {
-                    $meta_ids[] = 'media:image-large';
+                    if ($size < 100000) {
+                        $meta_ids[] = 'media:image-small';
+                    } else if ($size < 400000) {
+                        $meta_ids[] = 'media:image-medium';
+                    } else {
+                        $meta_ids[] = 'media:image-large';
+                    }
+                    $meta_ids[] = 'media:image';
                 }
+            } else {
+                $meta_ids[] = 'media:image';
             }
         } else {
             $meta_ids[] = 'media:text';
diff --git a/src/models/PhraseModel.php b/src/models/PhraseModel.php
index fde4697e0..358c7a98b 100755
--- a/src/models/PhraseModel.php
+++ b/src/models/PhraseModel.php
@@ -883,7 +883,8 @@ class PhraseModel extends ParallelModel
                     $_SESSION['SAFE_SEARCH'] == "true") ? "safe:true" :
                     "safe:all") . " ";
             }
-            if (!preg_match("/media\:image|lang\:/", $phrase)) {
+            if (!preg_match("/media\:image|lang\:/", $phrase) ||
+                $_REQUEST['s'] == 'images') {
                 $phrase .= " " . "lang:" . $main_tag . " ";
             }
         }
ViewGit