]> git.wh0rd.org Git - tt-rss.git/commitdiff
move some label stuff to labels.php
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Thu, 4 May 2017 12:36:36 +0000 (15:36 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Thu, 4 May 2017 12:36:36 +0000 (15:36 +0300)
move getfeedcategory() to Feeds

classes/feeds.php
include/functions.php
include/labels.php

index a96e53fcf1feb50b705600de9d58714cf03bc638..740c7df43ec96b6cea44e9443d24fb0d93f79a0d 100755 (executable)
@@ -2184,5 +2184,18 @@ class Feeds extends Handler_Protected {
                return $rv;
        }
 
+       static function getFeedCategory($feed) {
+               $result = db_query("SELECT cat_id FROM ttrss_feeds
+                               WHERE id = '$feed'");
+
+               if (db_num_rows($result) > 0) {
+                       return db_fetch_result($result, 0, "cat_id");
+               } else {
+                       return false;
+               }
+
+       }
+
+
 }
 
index 2f9a55654c1a28b5e584f620bea5abbfe1a2ca09..1d52bc62ebd3303312bc6936c92d0f7c7affb8b8 100644 (file)
        function load_filters($feed_id, $owner_uid) {
                $filters = array();
 
-               $cat_id = (int)getFeedCategory($feed_id);
+               $cat_id = (int)Feeds::getFeedCategory($feed_id);
 
                if ($cat_id == 0)
                        $null_cat_qpart = "cat_id IS NULL OR";
                return null;
        }
 
-       function getFeedCategory($feed) {
-               $result = db_query("SELECT cat_id FROM ttrss_feeds
-                               WHERE id = '$feed'");
-
-               if (db_num_rows($result) > 0) {
-                       return db_fetch_result($result, 0, "cat_id");
-               } else {
-                       return false;
-               }
-
-       }
-
        function implements_interface($class, $interface) {
                return in_array($interface, class_implements($class));
        }
                }
        }
 
-       function label_to_feed_id($label) {
-               return LABEL_BASE_INDEX - 1 - abs($label);
-       }
-
-       function feed_to_label_id($feed) {
-               return LABEL_BASE_INDEX - 1 + abs($feed);
-       }
-
        function get_theme_path($theme) {
                $check = "themes/$theme";
                if (file_exists($check)) return $check;
index fd0d40af65eb3821a74e18aabdc89b4f4331b083..f39f092db52a920b96111c3fbcb2da2898666697 100644 (file)
@@ -1,4 +1,12 @@
 <?php
+       function label_to_feed_id($label) {
+               return LABEL_BASE_INDEX - 1 - abs($label);
+       }
+
+       function feed_to_label_id($feed) {
+               return LABEL_BASE_INDEX - 1 + abs($feed);
+       }
+
        function label_find_id($label, $owner_uid) {
                $result = db_query(
                        "SELECT id FROM ttrss_labels2 WHERE caption = '$label'