if ($stage == 0) {
print "<feeds>";
- $reply = array();
-
- $result = db_query($link, "SELECT id, title FROM
+ $result = db_query($link, "SELECT id, title, cat_id FROM
ttrss_feeds WHERE owner_uid = ".$_SESSION["uid"]);
while ($line = db_fetch_assoc($result)) {
$has_icon = (int) feed_has_icon($line["id"]);
- print "<feed has_icon=\"$has_icon\" id=\"".$line["id"]."\"><![CDATA[";
+ print "<feed has_icon=\"$has_icon\"
+ cat_id=\"".(int)$line["cat_id"]."\" id=\"".$line["id"]."\"><![CDATA[";
print $line["title"];
print "]]></feed>";
}
print "</feeds>";
+ print "<feed-categories>";
+
+ $result = db_query($link, "SELECT id, title FROM
+ ttrss_feed_categories WHERE owner_uid = ".$_SESSION["uid"]);
+
+ print "<category id=\"0\"><![CDATA[";
+ print __("Uncategorized");
+ print "]]></category>";
+
+ while ($line = db_fetch_assoc($result)) {
+ print "<category id=\"".$line["id"]."\"><![CDATA[";
+ print $line["title"];
+ print "]]></category>";
+ }
+
+ print "</feed-categories>";
+
+
}
if ($stage > 0) {
-var SCHEMA_VERSION = 3;
+var SCHEMA_VERSION = 4;
var offline_mode = false;
var store = false;
var id = feeds[i].getAttribute("id");
var has_icon = feeds[i].getAttribute("has_icon");
var title = feeds[i].firstChild.nodeValue;
-
- db.execute("INSERT INTO feeds (id,title,has_icon)"+
- "VALUES (?,?,?)",
- [id, title, has_icon]);
+ var cat_id = feeds[i].getAttribute("cat_id");
+
+ db.execute("INSERT INTO feeds (id,title,has_icon,cat_id)"+
+ "VALUES (?,?,?, ?)",
+ [id, title, has_icon, cat_id]);
}
window.setTimeout("update_offline_data("+(stage+1)+")", 10*1000);
db.execute("DROP TABLE IF EXISTS init_params");
db.execute("DROP TABLE IF EXISTS cache");
db.execute("DROP TABLE IF EXISTS feeds");
+ db.execute("DROP TABLE IF EXISTS categories");
db.execute("DROP TABLE IF EXISTS articles");
db.execute("DROP TABLE IF EXISTS version");
db.execute("CREATE TABLE IF NOT EXISTS version (schema_version text)");
db.execute("CREATE TABLE IF NOT EXISTS init_params (key text, value text)");
db.execute("CREATE TABLE IF NOT EXISTS cache (id text, article text, param text, added text)");
- db.execute("CREATE TABLE IF NOT EXISTS feeds (id integer, title text, has_icon integer)");
+ db.execute("CREATE TABLE IF NOT EXISTS feeds (id integer, title text, has_icon integer, cat_id integer)");
+ db.execute("CREATE TABLE IF NOT EXISTS categories (id integer, title text)");
db.execute("CREATE TABLE IF NOT EXISTS articles (id integer, feed_id integer, title text, link text, guid text, updated text, content text, tags text, unread text, marked text, added text, comments text)");
db.execute("DELETE FROM cache WHERE id LIKE 'F:%' OR id LIKE 'C:%'");