mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-15 18:35:57 +00:00
allow adding cats from feed editor
This commit is contained in:
@@ -3018,7 +3018,7 @@
|
||||
function print_feed_cat_select($link, $id, $default_id = "",
|
||||
$attributes = "", $include_all_cats = true) {
|
||||
|
||||
print "<select id=\"$id\" name=\"$id\" $attributes>";
|
||||
print "<select id=\"$id\" name=\"$id\" default=\"$default_id\" onchange=\"catSelectOnChange(this)\" $attributes>";
|
||||
|
||||
if ($include_all_cats) {
|
||||
print "<option value=\"0\">".__('Uncategorized')."</option>";
|
||||
@@ -3041,6 +3041,8 @@
|
||||
$line["id"], htmlspecialchars($line["title"]));
|
||||
}
|
||||
|
||||
print "<option value=\"ADD_CAT\">" .__("Add category...") . "</option>";
|
||||
|
||||
print "</select>";
|
||||
}
|
||||
|
||||
@@ -6577,6 +6579,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
function add_feed_category($link, $feed_cat) {
|
||||
db_query($link, "BEGIN");
|
||||
|
||||
$result = db_query($link,
|
||||
"SELECT id FROM ttrss_feed_categories
|
||||
WHERE title = '$feed_cat' AND owner_uid = ".$_SESSION["uid"]);
|
||||
|
||||
if (db_num_rows($result) == 0) {
|
||||
|
||||
$result = db_query($link,
|
||||
"INSERT INTO ttrss_feed_categories (owner_uid,title)
|
||||
VALUES ('".$_SESSION["uid"]."', '$feed_cat')");
|
||||
|
||||
db_query($link, "COMMIT");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function remove_feed_category($link, $id, $owner_uid) {
|
||||
|
||||
db_query($link, "DELETE FROM ttrss_feed_categories
|
||||
|
||||
Reference in New Issue
Block a user