From 5ef071e00ba62c5b66a594b55185ef87012dc40a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 15 Aug 2012 09:38:57 +0400 Subject: remove old category editor allow creating/removing categories in main feed editor --- classes/pref_feeds.php | 162 +------------------------------------------------ 1 file changed, 2 insertions(+), 160 deletions(-) (limited to 'classes/pref_feeds.php') diff --git a/classes/pref_feeds.php b/classes/pref_feeds.php index 381330da0..bddf32185 100644 --- a/classes/pref_feeds.php +++ b/classes/pref_feeds.php @@ -1290,164 +1290,6 @@ class Pref_Feeds extends Protected_Handler { db_query($this->link, "COMMIT"); } - function editCats() { - - $action = $_REQUEST["action"]; - - if ($action == "save") { - - $cat_title = db_escape_string(trim($_REQUEST["value"])); - $cat_id = db_escape_string($_REQUEST["cid"]); - - db_query($this->link, "BEGIN"); - - $result = db_query($this->link, "SELECT title FROM ttrss_feed_categories - WHERE id = '$cat_id' AND owner_uid = ".$_SESSION["uid"]); - - if (db_num_rows($result) == 1) { - - $old_title = db_fetch_result($result, 0, "title"); - - if ($cat_title != "") { - $result = db_query($this->link, "UPDATE ttrss_feed_categories SET - title = '$cat_title' WHERE id = '$cat_id' AND - owner_uid = ".$_SESSION["uid"]); - - print $cat_title; - } else { - print $old_title; - } - } else { - print $_REQUEST["value"]; - } - - db_query($this->link, "COMMIT"); - - return; - - } - - if ($action == "add") { - - $feed_cat = db_escape_string(trim($_REQUEST["cat"])); - - if (!add_feed_category($this->link, $feed_cat)) - print_warning(T_sprintf("Category $%s already exists in the database.", $feed_cat)); - - } - - if ($action == "remove") { - - $ids = split(",", db_escape_string($_REQUEST["ids"])); - - foreach ($ids as $id) { - remove_feed_category($this->link, $id, $_SESSION["uid"]); - } - } - - print "
"; - - print "
". - "" . __('Select').""; - print "
"; - print "
".__('All')."
"; - print "
".__('None')."
"; - print "
"; - - print "
"; - - print " -
"; - - print "
"; - - $result = db_query($this->link, "SELECT c.title, c.id,COUNT(f.id) AS count - FROM ttrss_feed_categories AS c LEFT JOIN ttrss_feeds AS f ON - (f.cat_id = c.id) - WHERE c.owner_uid = ".$_SESSION["uid"]." - GROUP BY c.title, c.id ORDER BY title"); - - if (db_num_rows($result) != 0) { - - print "
"; - - print ""; - - $lnum = 0; - - while ($line = db_fetch_assoc($result)) { - - $class = ($lnum % 2) ? "even" : "odd"; - - $cat_id = $line["id"]; - $this_row_id = "id=\"FCATR-$cat_id\""; - - print ""; - - $edit_title = htmlspecialchars($line["title"]); - - print ""; - - print ""; - - print ""; - - ++$lnum; - } - - print "
"; - - if ($line['count'] == 0) print ''; - - print "" . $edit_title . - " - "; - - if ($line['count'] == 0) print ''; - - print ""; - echo T_sprintf("%d feeds", $line['count']); - print "
"; - print "
"; - - } else { - print "

".__('No feed categories defined.')."

"; - } - - print "
-
- -
"; - - print "
"; - - return; - - } - function index() { print "
"; @@ -1530,8 +1372,8 @@ class Pref_Feeds extends Protected_Handler { print "
". "" . __('Categories').""; print "
"; - print "
".__('Edit categories')."
"; + print "
".__('Add category')."
"; print "
".__('(Un)hide empty categories')."
"; print "