Selaa lähdekoodia

move some label stuff to labels.php
move getfeedcategory() to Feeds

Andrew Dolgov 7 vuotta sitten
vanhempi
commit
0086a89740
3 muutettua tiedostoa jossa 22 lisäystä ja 21 poistoa
  1. 13 0
      classes/feeds.php
  2. 1 21
      include/functions.php
  3. 8 0
      include/labels.php

+ 13 - 0
classes/feeds.php

@@ -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;
+		}
+
+	}
+
+
 }
 

+ 1 - 21
include/functions.php

@@ -2010,7 +2010,7 @@
 	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";
@@ -2482,18 +2482,6 @@
 		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));
 	}
@@ -2588,14 +2576,6 @@
 		}
 	}
 
-	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;

+ 8 - 0
include/labels.php

@@ -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'