From 107d0cf39e3801547a9a86b32762b772b25f6953 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 11 Dec 2011 23:59:25 +0400 Subject: overall directory tree cleanup --- mobile/mobile-functions.php | 548 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 548 insertions(+) create mode 100644 mobile/mobile-functions.php (limited to 'mobile/mobile-functions.php') diff --git a/mobile/mobile-functions.php b/mobile/mobile-functions.php new file mode 100644 index 000000000..1765a65eb --- /dev/null +++ b/mobile/mobile-functions.php @@ -0,0 +1,548 @@ + 0; + } + + function render_flat_feed_list($link, $offset) { + $owner_uid = $_SESSION["uid"]; + $limit = 0; + + if (!$offset) $offset = 0; + + if (mobile_get_pref($link, "SORT_FEEDS_UNREAD")) { + $order_by = "unread DESC, title"; + } else { + $order_by = "title"; + } + + if ($limit > 0) { + $limit_qpart = "LIMIT $limit OFFSET $offset"; + } else { + $limit_qpart = ""; + } + + $result = db_query($link, "SELECT id, + title, + (SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries + WHERE feed_id = ttrss_feeds.id AND unread = true + AND ttrss_user_entries.ref_id = ttrss_entries.id + AND owner_uid = '$owner_uid') AS unread + FROM ttrss_feeds + WHERE + ttrss_feeds.owner_uid = '$owner_uid' + ORDER BY $order_by $limit_qpart"); + + if (!$offset) print '"; + + } + + function render_category($link, $cat_id, $offset) { + $owner_uid = $_SESSION["uid"]; + + if ($cat_id >= 0) { + + if ($cat_id != 0) { + $cat_query = "cat_id = '$cat_id'"; + } else { + $cat_query = "cat_id IS NULL"; + } + + if (mobile_get_pref($link, "SORT_FEEDS_UNREAD")) { + $order_by = "unread DESC, title"; + } else { + $order_by = "title"; + } + + $result = db_query($link, "SELECT id, + title, + (SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries + WHERE feed_id = ttrss_feeds.id AND unread = true + AND ttrss_user_entries.ref_id = ttrss_entries.id + AND owner_uid = '$owner_uid') as unread + FROM ttrss_feeds + WHERE + ttrss_feeds.owner_uid = '$owner_uid' AND + $cat_query + ORDER BY $order_by"); + + $title = getCategoryTitle($link, $cat_id); + + print ""; + } else if ($cat_id == -1) { + + $title = __('Special'); + + print ""; + } else if ($cat_id == -2) { + + $title = __('Labels'); + + print ""; + } + } + + function render_categories_list($link) { + $owner_uid = $_SESSION["uid"]; + + $cat_browse = mobile_get_pref($link, "BROWSE_CATS"); + + print '"; + } + + function render_headlines_list($link, $feed_id, $cat_id, $offset, $search, + $is_cat = false) { + + $feed_id = $feed_id; + $limit = 15; + $filter = ''; + + if (!mobile_get_pref($link, "HIDE_READ")) + $view_mode = "all_articles"; + else + $view_mode = 'adaptive'; + + if ($search) { + $search_mode = 'this_feed'; + $match_on = 'both'; + } else { + $search_mode = ''; + $match_on = ''; + } + + $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, + $view_mode, $is_cat, $search, $search_mode, $match_on, + "score DESC, date_entered DESC", $offset); + + $result = $qfh_ret[0]; + $feed_title = $qfh_ret[1]; + + if (!$offset) { + + print "
+ + + + +
+

Search

+ Cancel + Search + + + +
+
"; + + if ($cat_id) { + $cat_title = getCategoryTitle($link, $cat_id); + + print "