mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2026-02-10 16:01:33 +00:00
implement dumb article downloader
This commit is contained in:
@@ -516,6 +516,10 @@
|
||||
|
||||
if ($subop == "download") {
|
||||
$stage = (int) $_REQUEST["stage"];
|
||||
$amount = (int) $_REQUEST["amount"];
|
||||
$unread_only = db_escape_string($_REQUEST["unread_only"]);
|
||||
|
||||
if (!$amount) $amount = 50;
|
||||
|
||||
print "<rpc-reply>";
|
||||
|
||||
@@ -537,6 +541,43 @@
|
||||
|
||||
}
|
||||
|
||||
if ($stage > 0) {
|
||||
|
||||
print "<articles>";
|
||||
|
||||
$limit = 50;
|
||||
$skip = $limit*($stage-1);
|
||||
|
||||
if ($amount > 0) $amount -= $skip;
|
||||
|
||||
if ($amount > 0) {
|
||||
|
||||
$limit = min($limit, $amount);
|
||||
|
||||
if ($unread_only) {
|
||||
$unread_qpart = "unread = true AND ";
|
||||
}
|
||||
|
||||
$result = db_query($link,
|
||||
"SELECT DISTINCT id,title,guid,link,
|
||||
feed_id,content,updated,unread,marked FROM
|
||||
ttrss_user_entries,ttrss_entries
|
||||
WHERE $unread_qpart
|
||||
ref_id = id AND owner_uid = ".$_SESSION["uid"]."
|
||||
ORDER BY updated DESC LIMIT $limit OFFSET $skip");
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
print "<article><![CDATA[";
|
||||
print json_encode($line);
|
||||
print "]]></article>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print "</articles>";
|
||||
|
||||
}
|
||||
|
||||
print "</rpc-reply>";
|
||||
|
||||
return;
|
||||
|
||||
@@ -474,20 +474,22 @@
|
||||
$amount = array(
|
||||
50 => 50,
|
||||
100 => 100,
|
||||
0 => "All unread");
|
||||
250 => 250);
|
||||
|
||||
print_select_hash("amount", 50, $amount);
|
||||
|
||||
print " " . __("newest articles for offline reading.");
|
||||
|
||||
print "<br/>";
|
||||
|
||||
print "<input checked='yes' type='checkbox' name='unread_only' id='unread_only'>";
|
||||
print "<label for='unread_only'>".__('Only include unread articles')."</label>";
|
||||
|
||||
print "</div>";
|
||||
|
||||
print "</form>";
|
||||
|
||||
print "<div class=\"dlgButtons\">
|
||||
<div id=\"d_progress_o\" style=\"display : none\">
|
||||
<div id=\"d_progress_i\"></div>
|
||||
</div>
|
||||
<input class=\"button\"
|
||||
type=\"submit\" onclick=\"return initiate_offline_download()\" value=\"".__('Download')."\">
|
||||
<input class=\"button\"
|
||||
|
||||
Reference in New Issue
Block a user