diff options
author | Andrew Dolgov <[email protected]> | 2007-11-17 10:23:44 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2007-11-17 10:23:44 +0100 |
commit | c03cf250e8cef7f6d49e1b1980c40de7eebf9b89 (patch) | |
tree | c3eb5ffb17c6ec2ec4cf8b1fc85fba484f55c618 /modules | |
parent | 5a68dec1df36446de39829838e914bad23c34949 (diff) |
place imported feeds in a separate category unless otherwise specified (closes #162)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/opml_domdoc.php | 15 | ||||
-rw-r--r-- | modules/opml_domxml.php | 15 |
2 files changed, 26 insertions, 4 deletions
diff --git a/modules/opml_domdoc.php b/modules/opml_domdoc.php index 98eba69fa..1c0404c34 100644 --- a/modules/opml_domdoc.php +++ b/modules/opml_domdoc.php @@ -4,6 +4,16 @@ if (is_file($_FILES['opml_file']['tmp_name'])) { $doc = DOMDocument::load($_FILES['opml_file']['tmp_name']); + $result = db_query($link, "SELECT id FROM + ttrss_feed_categories WHERE title = 'Imported feeds' AND + owner_uid = '$owner_uid' LIMIT 1"); + + if (db_num_rows($result) == 1) { + $default_cat_id = db_fetch_result($result, 0, "id"); + } else { + $default_cat_id = 0; + } + if ($doc) { $body = $doc->getElementsByTagName('body'); @@ -101,8 +111,9 @@ } else { $add_query = "INSERT INTO ttrss_feeds - (title, feed_url, owner_uid, site_url) VALUES - ('$feed_title', '$feed_url', '$owner_uid', '$site_url')"; + (title, feed_url, owner_uid, cat_id, site_url) VALUES + ('$feed_title', '$feed_url', '$owner_uid', '$default_cat_id', + '$site_url')"; } diff --git a/modules/opml_domxml.php b/modules/opml_domxml.php index 54ec76b90..5b1e4067d 100644 --- a/modules/opml_domxml.php +++ b/modules/opml_domxml.php @@ -4,6 +4,16 @@ if (is_file($_FILES['opml_file']['tmp_name'])) { $dom = domxml_open_file($_FILES['opml_file']['tmp_name']); + $result = db_query($link, "SELECT id FROM + ttrss_feed_categories WHERE title = 'Imported feeds' AND + owner_uid = '$owner_uid' LIMIT 1"); + + if (db_num_rows($result) == 1) { + $default_cat_id = db_fetch_result($result, 0, "id"); + } else { + $default_cat_id = 0; + } + if ($dom) { $root = $dom->document_element(); @@ -104,8 +114,9 @@ } else { $add_query = "INSERT INTO ttrss_feeds - (title, feed_url, owner_uid, site_url) VALUES - ('$feed_title', '$feed_url', '$owner_uid', '$site_url')"; + (title, feed_url, owner_uid, cat_id, site_url) VALUES + ('$feed_title', '$feed_url', '$owner_uid', '$default_cat_id', + '$site_url')"; } |