diff --git a/mobile/backend.php b/mobile/backend.php
index c6b75c51b..85018c580 100644
--- a/mobile/backend.php
+++ b/mobile/backend.php
@@ -35,6 +35,12 @@
publishArticlesById($link, array($id), $cmode);
break;
+ case "setPref":
+ $id = db_escape_string($_REQUEST["id"]);
+ $value = db_escape_string($_REQUEST["to"]);
+ mobile_set_pref($link, $id, $value);
+ print_r($_SESSION);
+ break;
default:
print json_encode(array("error", "UNKNOWN_METHOD"));
break;
diff --git a/mobile/functions.php b/mobile/functions.php
index 1806e0eda..ff0510dcd 100644
--- a/mobile/functions.php
+++ b/mobile/functions.php
@@ -1,6 +1,21 @@
';
+ print '
";
@@ -67,7 +91,13 @@
} 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
@@ -80,7 +110,7 @@
ttrss_feeds.owner_uid = '$owner_uid' AND
parent_feed IS NULL AND
$cat_query
- ORDER BY unread DESC,title");
+ ORDER BY $order_by");
$title = getCategoryTitle($link, $cat_id);
@@ -107,10 +137,12 @@
} else {
$icon_url = "../images/blank_icon.gif";
}
-
- print "" .
- "
".
- $line["title"] . "";
+
+ if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
+ print "" .
+ "
".
+ $line["title"] . "";
+ }
}
print "";
@@ -132,8 +164,10 @@
$class = 'oldItem';
}
- print "
- $title";
+ if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
+ print "
+ $title";
+ }
}
print "";
@@ -163,9 +197,10 @@
$class = 'oldItem';
}
- print "
- $title";
-
+ if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
+ print "
+ $title";
+ }
}
print "";
}
@@ -175,7 +210,8 @@
$owner_uid = $_SESSION["uid"];
- print '';
+ print '';
foreach (array(-1, -2) as $id) {
$title = getCategoryTitle($link, $id);
@@ -202,8 +238,6 @@
ttrss_feed_categories.title
ORDER BY ttrss_feed_categories.title");
- $cat_ids = array();
-
while ($line = db_fetch_assoc($result)) {
if ($line["num_feeds"] > 0) {
@@ -217,13 +251,11 @@
} else {
$class = 'oldItem';
}
-
-
- print "- " .
- $line["title"] . "
";
-
- array_push($cat_ids, $id);
+ if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
+ print "- " .
+ $line["title"] . "
";
+ }
}
}
@@ -244,9 +276,9 @@
$class = 'oldItem';
}
- array_push($cat_ids, 0);
-
- print "- $title
";
+ if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
+ print "- $title
";
+ }
}
print "
";
@@ -367,6 +399,10 @@
$content = sanitize_rss($link, $line["content"]);
$content = preg_replace("/href=/i", "target=\"_blank\" href=", $content);
+ if (!mobile_get_pref($link, "SHOW_IMAGES")) {
+ $content = preg_replace('/
]+>/is', '', $content);
+ }
+
print "$content
";
print "