]> git.wh0rd.org - tt-rss.git/commitdiff
get_article_filters: silence preg_match() warnings on incorrect user input
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 11 Nov 2010 11:06:08 +0000 (14:06 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 11 Nov 2010 11:06:08 +0000 (14:06 +0300)
functions.php

index 0ae97af4f1942288901c94e6056cf286d9ed986b..126ad27c611e4a87330d6cf8333240da219adf19 100644 (file)
                        foreach ($filters["title"] as $filter) {
                                $reg_exp = $filter["reg_exp"];          
                                $inverse = $filter["inverse"];  
-                               if ((!$inverse && preg_match("/$reg_exp/i", $title)) || 
-                                               ($inverse && !preg_match("/$reg_exp/i", $title))) {
+                               if ((!$inverse && @preg_match("/$reg_exp/i", $title)) || 
+                                               ($inverse && !@preg_match("/$reg_exp/i", $title))) {
 
                                        array_push($matches, array($filter["action"], $filter["action_param"]));
                                }
                                $reg_exp = $filter["reg_exp"];
                                $inverse = $filter["inverse"];
 
-                               if ((!$inverse && preg_match("/$reg_exp/i", $content)) || 
-                                               ($inverse && !preg_match("/$reg_exp/i", $content))) {
+                               if ((!$inverse && @preg_match("/$reg_exp/i", $content)) || 
+                                               ($inverse && !@preg_match("/$reg_exp/i", $content))) {
 
                                        array_push($matches, array($filter["action"], $filter["action_param"]));
                                }               
                                $inverse = $filter["inverse"];
 
                                if ($inverse) {
-                                       if (!preg_match("/$reg_exp/i", $title) && !preg_match("/$reg_exp/i", $content)) {
+                                       if (!@preg_match("/$reg_exp/i", $title) && !preg_match("/$reg_exp/i", $content)) {
                                                array_push($matches, array($filter["action"], $filter["action_param"]));
                                        }
                                } else {
-                                       if (preg_match("/$reg_exp/i", $title) || preg_match("/$reg_exp/i", $content)) {
+                                       if (@preg_match("/$reg_exp/i", $title) || preg_match("/$reg_exp/i", $content)) {
                                                array_push($matches, array($filter["action"], $filter["action_param"]));
                                        }
                                }
                                $reg_exp = $filter["reg_exp"];
                                $inverse = $filter["inverse"];
 
-                               if ((!$inverse && preg_match("/$reg_exp/i", $link)) || 
-                                               ($inverse && !preg_match("/$reg_exp/i", $link))) {
+                               if ((!$inverse && @preg_match("/$reg_exp/i", $link)) || 
+                                               ($inverse && !@preg_match("/$reg_exp/i", $link))) {
                                                
                                        array_push($matches, array($filter["action"], $filter["action_param"]));
                                }
                        foreach ($filters["author"] as $filter) {
                                $reg_exp = $filter["reg_exp"];          
                                $inverse = $filter["inverse"];  
-                               if ((!$inverse && preg_match("/$reg_exp/i", $author)) || 
-                                               ($inverse && !preg_match("/$reg_exp/i", $author))) {
+                               if ((!$inverse && @preg_match("/$reg_exp/i", $author)) || 
+                                               ($inverse && !@preg_match("/$reg_exp/i", $author))) {
 
                                        array_push($matches, array($filter["action"], $filter["action_param"]));
                                }
                                $reg_exp = $filter["reg_exp"];
                                $inverse = $filter["inverse"];
 
-                               if ((!$inverse && preg_match("/$reg_exp/i", $tag_string)) || 
-                                               ($inverse && !preg_match("/$reg_exp/i", $tag_string))) {
+                               if ((!$inverse && @preg_match("/$reg_exp/i", $tag_string)) || 
+                                               ($inverse && !@preg_match("/$reg_exp/i", $tag_string))) {
 
                                        array_push($matches, array($filter["action"], $filter["action_param"]));
                                }