]> git.wh0rd.org Git - tt-rss.git/commitdiff
replace several preg_match() feed id tests with is_numeric()
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 2 Sep 2012 10:11:28 +0000 (14:11 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 2 Sep 2012 10:11:28 +0000 (14:11 +0400)
classes/feeds.php
include/functions.php

index c3b20df97e728a029b55cd52d1c382f3d2d2761b..a40fbf1d91316405491173c9b75d872d369db9a8 100644 (file)
@@ -154,7 +154,7 @@ class Feeds extends Handler_Protected {
                        }\r
                }\r
 \r
-               if (preg_match("/^-?[0-9][0-9]*$/", $feed) != false) {\r
+               if (is_numeric($feed) && $feed > 0) {\r
 \r
                        $result = db_query($this->link, "SELECT rtl_content FROM ttrss_feeds\r
                                WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]);\r
@@ -806,7 +806,7 @@ class Feeds extends Handler_Protected {
                set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);\r
                set_pref($this->link, "_DEFAULT_INCLUDE_CHILDREN", $include_children);\r
 \r
-               if (!$cat_view && preg_match("/^[0-9][0-9]*$/", $feed)) {\r
+               if (!$cat_view && is_numeric($feed) && $feed > 0) {\r
                        db_query($this->link, "UPDATE ttrss_feeds SET last_viewed = NOW()\r
                                                        WHERE id = '$feed' AND owner_uid = ".$_SESSION["uid"]);\r
                }\r
index 1ee334fa9d0b140af98187c73007d90b5bc21895..140d534fd253373b0fabe48a12033d8a254ce0ed 100644 (file)
                                $query_strategy_part = "ttrss_entries.id > 0";
                                $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                        /* tags */
-                       } else if (preg_match("/^-?[0-9][0-9]*$/", $feed) == false) {
+                       } else if (!is_numeric($feed)) {
                                $query_strategy_part = "ttrss_entries.id > 0";
                                $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
                                        id = feed_id) as feed_title,";
 
                        $content_query_part = "content as content_preview,";
 
-                       if (preg_match("/^-?[0-9][0-9]*$/", $feed) != false) {
+                       if (is_numeric($feed)) {
 
                                if ($feed >= 0) {
                                        $feed_kind = "Feeds";