Browse Source

move getArticleFeed to Article
move print_label_select to controls

Andrew Dolgov 7 năm trước cách đây
mục cha
commit
4122da0290
4 tập tin đã thay đổi với 38 bổ sung36 xóa
  1. 11 1
      classes/article.php
  2. 2 0
      classes/feeds.php
  3. 25 0
      include/controls.php
  4. 0 35
      include/functions2.php

+ 11 - 1
classes/article.php

@@ -80,7 +80,7 @@ class Article extends Handler_Protected {
 			WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
 		}
 
-		$feed_id = getArticleFeed($id);
+		$feed_id = $this->getArticleFeed($id);
 		ccache_update($feed_id, $_SESSION["uid"]);
 	}
 
@@ -371,6 +371,16 @@ class Article extends Handler_Protected {
 		print json_encode($reply);
 	}
 
+	function getArticleFeed($id) {
+		$result = db_query("SELECT feed_id FROM ttrss_user_entries
+			WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+
+		if (db_num_rows($result) != 0) {
+			return db_fetch_result($result, 0, "feed_id");
+		} else {
+			return 0;
+		}
+	}
 
 
 }

+ 2 - 0
classes/feeds.php

@@ -1241,5 +1241,7 @@ class Feeds extends Handler_Protected {
 		<?php
 
 	}
+
+
 }
 ?>

+ 25 - 0
include/controls.php

@@ -300,3 +300,28 @@ function format_inline_player($url, $ctype) {
 
 	return "";
 }
+
+function print_label_select($name, $value, $attributes = "") {
+
+	$result = db_query("SELECT caption FROM ttrss_labels2
+			WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY caption");
+
+	print "<select default=\"$value\" name=\"" . htmlspecialchars($name) .
+		"\" $attributes>";
+
+	while ($line = db_fetch_assoc($result)) {
+
+		$issel = ($line["caption"] == $value) ? "selected=\"1\"" : "";
+
+		print "<option value=\"".htmlspecialchars($line["caption"])."\"
+				$issel>" . htmlspecialchars($line["caption"]) . "</option>";
+
+	}
+
+#		print "<option value=\"ADD_LABEL\">" .__("Add label...") . "</option>";
+
+	print "</select>";
+
+
+}
+

+ 0 - 35
include/functions2.php

@@ -1669,17 +1669,6 @@
 		return false;
 	}
 
-	function getArticleFeed($id) {
-		$result = db_query("SELECT feed_id FROM ttrss_user_entries
-			WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
-
-		if (db_num_rows($result) != 0) {
-			return db_fetch_result($result, 0, "feed_id");
-		} else {
-			return 0;
-		}
-	}
-
 	/**
 	 * Fixes incomplete URLs by prepending "http://".
 	 * Also replaces feed:// with http://, and
@@ -1825,30 +1814,6 @@
 		return is_html(fetch_file_contents($url, false, $login, $pass));
 	}
 
-	function print_label_select($name, $value, $attributes = "") {
-
-		$result = db_query("SELECT caption FROM ttrss_labels2
-			WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY caption");
-
-		print "<select default=\"$value\" name=\"" . htmlspecialchars($name) .
-			"\" $attributes>";
-
-		while ($line = db_fetch_assoc($result)) {
-
-			$issel = ($line["caption"] == $value) ? "selected=\"1\"" : "";
-
-			print "<option value=\"".htmlspecialchars($line["caption"])."\"
-				$issel>" . htmlspecialchars($line["caption"]) . "</option>";
-
-		}
-
-#		print "<option value=\"ADD_LABEL\">" .__("Add label...") . "</option>";
-
-		print "</select>";
-
-
-	}
-
 	function format_article_enclosures($id, $always_display_enclosures,
 					$article_content, $hide_images = false) {