Merge branch 'master' of git.fakecake.org:tt-rss
This commit is contained in:
commit
25c747f576
|
@ -1,3 +1,4 @@
|
||||||
|
Thumbs.db
|
||||||
/deploy.exclude
|
/deploy.exclude
|
||||||
/deploy.sh
|
/deploy.sh
|
||||||
/messages.mo
|
/messages.mo
|
||||||
|
|
|
@ -222,11 +222,10 @@ class API extends Handler {
|
||||||
/* do not rely on params below */
|
/* do not rely on params below */
|
||||||
|
|
||||||
$search = $this->dbh->escape_string($_REQUEST["search"]);
|
$search = $this->dbh->escape_string($_REQUEST["search"]);
|
||||||
$search_mode = $this->dbh->escape_string($_REQUEST["search_mode"]);
|
|
||||||
|
|
||||||
$headlines = $this->api_get_headlines($feed_id, $limit, $offset,
|
$headlines = $this->api_get_headlines($feed_id, $limit, $offset,
|
||||||
$filter, $is_cat, $show_excerpt, $show_content, $view_mode, $override_order,
|
$filter, $is_cat, $show_excerpt, $show_content, $view_mode, $override_order,
|
||||||
$include_attachments, $since_id, $search, $search_mode,
|
$include_attachments, $since_id, $search,
|
||||||
$include_nested, $sanitize_content, $force_update, $excerpt_length);
|
$include_nested, $sanitize_content, $force_update, $excerpt_length);
|
||||||
|
|
||||||
$this->wrap(self::STATUS_OK, $headlines);
|
$this->wrap(self::STATUS_OK, $headlines);
|
||||||
|
@ -636,8 +635,7 @@ class API extends Handler {
|
||||||
static function api_get_headlines($feed_id, $limit, $offset,
|
static function api_get_headlines($feed_id, $limit, $offset,
|
||||||
$filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order,
|
$filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order,
|
||||||
$include_attachments, $since_id,
|
$include_attachments, $since_id,
|
||||||
$search = "", $search_mode = "",
|
$search = "", $include_nested = false, $sanitize_content = true, $force_update = false, $excerpt_length = 100) {
|
||||||
$include_nested = false, $sanitize_content = true, $force_update = false, $excerpt_length = 100) {
|
|
||||||
|
|
||||||
if ($force_update && $feed_id > 0 && is_numeric($feed_id)) {
|
if ($force_update && $feed_id > 0 && is_numeric($feed_id)) {
|
||||||
// Update the feed if required with some basic flood control
|
// Update the feed if required with some basic flood control
|
||||||
|
@ -661,7 +659,7 @@ class API extends Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
$qfh_ret = queryFeedHeadlines($feed_id, $limit,
|
$qfh_ret = queryFeedHeadlines($feed_id, $limit,
|
||||||
$view_mode, $is_cat, $search, $search_mode,
|
$view_mode, $is_cat, $search, false,
|
||||||
$order, $offset, 0, false, $since_id, $include_nested);
|
$order, $offset, 0, false, $since_id, $include_nested);
|
||||||
|
|
||||||
$result = $qfh_ret[0];
|
$result = $qfh_ret[0];
|
||||||
|
|
|
@ -161,37 +161,6 @@ class Dlg extends Handler_Protected {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function printTagSelect() {
|
|
||||||
|
|
||||||
print __("Match:"). " " .
|
|
||||||
"<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\" id=\"tag_mode_any\">";
|
|
||||||
print "<label for=\"tag_mode_any\">".__("Any")."</label>";
|
|
||||||
print " ";
|
|
||||||
print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\" id=\"tag_mode_all\">";
|
|
||||||
print "<label for=\"tag_mode_all\">".__("All tags.")."</input>";
|
|
||||||
|
|
||||||
print "<select id=\"all_tags\" name=\"all_tags\" title=\"" . __('Which Tags?') . "\" multiple=\"multiple\" size=\"10\" style=\"width : 100%\">";
|
|
||||||
$result = $this->dbh->query("SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = ".$_SESSION['uid']."
|
|
||||||
AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC");
|
|
||||||
|
|
||||||
while ($row = $this->dbh->fetch_assoc($result)) {
|
|
||||||
$tmp = htmlspecialchars($row["tag_name"]);
|
|
||||||
print "<option value=\"$tmp\">$tmp</option>";
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</select>";
|
|
||||||
|
|
||||||
print "<div align='right'>";
|
|
||||||
print "<button dojoType=\"dijit.form.Button\" onclick=\"viewfeed(get_all_tags($('all_tags')),
|
|
||||||
get_radio_checked($('tag_mode')));\">" . __('Display entries') . "</button>";
|
|
||||||
print " ";
|
|
||||||
print "<button dojoType=\"dijit.form.Button\"
|
|
||||||
onclick=\"return closeInfoBox()\">" .
|
|
||||||
__('Close this window') . "</button>";
|
|
||||||
print "</div>";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function generatedFeed() {
|
function generatedFeed() {
|
||||||
|
|
||||||
$this->params = explode(":", $this->param, 3);
|
$this->params = explode(":", $this->param, 3);
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Feeds extends Handler_Protected {
|
||||||
|
|
||||||
private function format_headline_subtoolbar($feed_site_url, $feed_title,
|
private function format_headline_subtoolbar($feed_site_url, $feed_title,
|
||||||
$feed_id, $is_cat, $search,
|
$feed_id, $is_cat, $search,
|
||||||
$search_mode, $view_mode, $error, $feed_last_updated) {
|
$view_mode, $error, $feed_last_updated) {
|
||||||
|
|
||||||
$catchup_sel_link = "catchupSelection()";
|
$catchup_sel_link = "catchupSelection()";
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class Feeds extends Handler_Protected {
|
||||||
if ($is_cat) $cat_q = "&is_cat=$is_cat";
|
if ($is_cat) $cat_q = "&is_cat=$is_cat";
|
||||||
|
|
||||||
if ($search) {
|
if ($search) {
|
||||||
$search_q = "&q=$search&smode=$search_mode";
|
$search_q = "&q=$search";
|
||||||
} else {
|
} else {
|
||||||
$search_q = "";
|
$search_q = "";
|
||||||
}
|
}
|
||||||
|
@ -207,29 +207,19 @@ class Feeds extends Handler_Protected {
|
||||||
$disable_cache = true;
|
$disable_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@$search_mode = $this->dbh->escape_string($_REQUEST["search_mode"]);
|
|
||||||
|
|
||||||
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H0", $timing_info);
|
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H0", $timing_info);
|
||||||
|
|
||||||
// error_log("format_headlines_list: [" . $feed . "] method [" . $method . "]");
|
|
||||||
if($search_mode == '' && $method != '' ){
|
|
||||||
$search_mode = $method;
|
|
||||||
}
|
|
||||||
// error_log("search_mode: " . $search_mode);
|
|
||||||
|
|
||||||
if (!$cat_view && is_numeric($feed) && $feed < PLUGIN_FEED_BASE_INDEX && $feed > LABEL_BASE_INDEX) {
|
if (!$cat_view && is_numeric($feed) && $feed < PLUGIN_FEED_BASE_INDEX && $feed > LABEL_BASE_INDEX) {
|
||||||
$handler = PluginHost::getInstance()->get_feed_handler(
|
$handler = PluginHost::getInstance()->get_feed_handler(
|
||||||
PluginHost::feed_to_pfeed_id($feed));
|
PluginHost::feed_to_pfeed_id($feed));
|
||||||
|
|
||||||
// function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false) {
|
|
||||||
|
|
||||||
if ($handler) {
|
if ($handler) {
|
||||||
$options = array(
|
$options = array(
|
||||||
"limit" => $limit,
|
"limit" => $limit,
|
||||||
"view_mode" => $view_mode,
|
"view_mode" => $view_mode,
|
||||||
"cat_view" => $cat_view,
|
"cat_view" => $cat_view,
|
||||||
"search" => $search,
|
"search" => $search,
|
||||||
"search_mode" => $search_mode,
|
|
||||||
"override_order" => $override_order,
|
"override_order" => $override_order,
|
||||||
"offset" => $offset,
|
"offset" => $offset,
|
||||||
"owner_uid" => $_SESSION["uid"],
|
"owner_uid" => $_SESSION["uid"],
|
||||||
|
@ -243,7 +233,7 @@ class Feeds extends Handler_Protected {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $cat_view,
|
$qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $cat_view,
|
||||||
$search, $search_mode, $override_order, $offset, 0,
|
$search, false, $override_order, $offset, 0,
|
||||||
false, 0, $include_children);
|
false, 0, $include_children);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +253,7 @@ class Feeds extends Handler_Protected {
|
||||||
|
|
||||||
$reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url,
|
$reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url,
|
||||||
$feed_title,
|
$feed_title,
|
||||||
$feed, $cat_view, $search, $search_mode, $view_mode,
|
$feed, $cat_view, $search, $view_mode,
|
||||||
$last_error, $last_updated);
|
$last_error, $last_updated);
|
||||||
|
|
||||||
$headlines_count = $this->dbh->num_rows($result);
|
$headlines_count = $this->dbh->num_rows($result);
|
||||||
|
@ -1118,36 +1108,7 @@ class Feeds extends Handler_Protected {
|
||||||
style=\"font-size : 16px; width : 20em;\"
|
style=\"font-size : 16px; width : 20em;\"
|
||||||
required=\"1\" name=\"query\" type=\"search\" value=''>";
|
required=\"1\" name=\"query\" type=\"search\" value=''>";
|
||||||
|
|
||||||
print "<hr/>".__('Limit search to:')." ";
|
print "<hr/><span style='float : right'>".T_sprintf('in %s', getFeedTitle($active_feed_id, $is_cat))."</span>";
|
||||||
|
|
||||||
print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\">
|
|
||||||
<option value=\"all_feeds\">".__('All feeds')."</option>";
|
|
||||||
|
|
||||||
$feed_title = getFeedTitle($active_feed_id);
|
|
||||||
|
|
||||||
if (!$is_cat) {
|
|
||||||
$feed_cat_title = getFeedCatTitle($active_feed_id);
|
|
||||||
} else {
|
|
||||||
$feed_cat_title = getCategoryTitle($active_feed_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($active_feed_id && !$is_cat) {
|
|
||||||
print "<option selected=\"1\" value=\"this_feed\">$feed_title</option>";
|
|
||||||
} else {
|
|
||||||
print "<option disabled=\"1\" value=\"false\">".__('This feed')."</option>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($is_cat) {
|
|
||||||
$cat_preselected = "selected=\"1\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (get_pref('ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) {
|
|
||||||
print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
|
|
||||||
} else {
|
|
||||||
//print "<option disabled>".__('This category')."</option>";
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</select>";
|
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
class Handler_Public extends Handler {
|
class Handler_Public extends Handler {
|
||||||
|
|
||||||
private function generate_syndicated_feed($owner_uid, $feed, $is_cat,
|
private function generate_syndicated_feed($owner_uid, $feed, $is_cat,
|
||||||
$limit, $offset, $search, $search_mode,
|
$limit, $offset, $search,
|
||||||
$view_mode = false, $format = 'atom', $order = false, $orig_guid = false, $start_ts = false) {
|
$view_mode = false, $format = 'atom', $order = false, $orig_guid = false, $start_ts = false) {
|
||||||
|
|
||||||
require_once "lib/MiniTemplator.class.php";
|
require_once "lib/MiniTemplator.class.php";
|
||||||
|
@ -37,10 +37,8 @@ class Handler_Public extends Handler {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false) {
|
|
||||||
|
|
||||||
$qfh_ret = queryFeedHeadlines($feed,
|
$qfh_ret = queryFeedHeadlines($feed,
|
||||||
1, $view_mode, $is_cat, $search, $search_mode,
|
1, $view_mode, $is_cat, $search, false,
|
||||||
$date_sort_field, $offset, $owner_uid,
|
$date_sort_field, $offset, $owner_uid,
|
||||||
false, 0, true, true, false, false, $start_ts);
|
false, 0, true, true, false, false, $start_ts);
|
||||||
|
|
||||||
|
@ -61,7 +59,7 @@ class Handler_Public extends Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
$qfh_ret = queryFeedHeadlines($feed,
|
$qfh_ret = queryFeedHeadlines($feed,
|
||||||
$limit, $view_mode, $is_cat, $search, $search_mode,
|
$limit, $view_mode, $is_cat, $search, false,
|
||||||
$date_sort_field, $offset, $owner_uid,
|
$date_sort_field, $offset, $owner_uid,
|
||||||
false, 0, true, true, false, false, $start_ts);
|
false, 0, true, true, false, false, $start_ts);
|
||||||
|
|
||||||
|
@ -374,7 +372,6 @@ class Handler_Public extends Handler {
|
||||||
$offset = (int)$this->dbh->escape_string($_REQUEST["offset"]);
|
$offset = (int)$this->dbh->escape_string($_REQUEST["offset"]);
|
||||||
|
|
||||||
$search = $this->dbh->escape_string($_REQUEST["q"]);
|
$search = $this->dbh->escape_string($_REQUEST["q"]);
|
||||||
$search_mode = $this->dbh->escape_string($_REQUEST["smode"]);
|
|
||||||
$view_mode = $this->dbh->escape_string($_REQUEST["view-mode"]);
|
$view_mode = $this->dbh->escape_string($_REQUEST["view-mode"]);
|
||||||
$order = $this->dbh->escape_string($_REQUEST["order"]);
|
$order = $this->dbh->escape_string($_REQUEST["order"]);
|
||||||
$start_ts = $this->dbh->escape_string($_REQUEST["ts"]);
|
$start_ts = $this->dbh->escape_string($_REQUEST["ts"]);
|
||||||
|
@ -400,7 +397,7 @@ class Handler_Public extends Handler {
|
||||||
|
|
||||||
if ($owner_id) {
|
if ($owner_id) {
|
||||||
$this->generate_syndicated_feed($owner_id, $feed, $is_cat, $limit,
|
$this->generate_syndicated_feed($owner_id, $feed, $is_cat, $limit,
|
||||||
$offset, $search, $search_mode, $view_mode, $format, $order, $orig_guid, $start_ts);
|
$offset, $search, $view_mode, $format, $order, $orig_guid, $start_ts);
|
||||||
} else {
|
} else {
|
||||||
header('HTTP/1.1 403 Forbidden');
|
header('HTTP/1.1 403 Forbidden');
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,6 +425,7 @@
|
||||||
return $rv;
|
return $rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $search_mode is obsolete/unused
|
||||||
function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false) {
|
function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false) {
|
||||||
|
|
||||||
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
|
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
|
||||||
|
@ -532,33 +533,11 @@
|
||||||
|
|
||||||
$vfeed_query_part = "";
|
$vfeed_query_part = "";
|
||||||
|
|
||||||
// override query strategy and enable feed display when searching globally
|
|
||||||
if ($search && $search_mode == "all_feeds") {
|
|
||||||
$query_strategy_part = "true";
|
|
||||||
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
|
||||||
/* tags */
|
/* tags */
|
||||||
} else if (!is_numeric($feed)) {
|
if (!is_numeric($feed)) {
|
||||||
$query_strategy_part = "true";
|
$query_strategy_part = "true";
|
||||||
$vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
|
$vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
|
||||||
id = feed_id) as feed_title,";
|
id = feed_id) as feed_title,";
|
||||||
} else if ($search && $search_mode == "this_cat") {
|
|
||||||
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
|
||||||
|
|
||||||
if ($feed > 0) {
|
|
||||||
if ($include_children) {
|
|
||||||
$subcats = getChildCategories($feed, $owner_uid);
|
|
||||||
array_push($subcats, $feed);
|
|
||||||
$cats_qpart = join(",", $subcats);
|
|
||||||
} else {
|
|
||||||
$cats_qpart = $feed;
|
|
||||||
}
|
|
||||||
|
|
||||||
$query_strategy_part = "ttrss_feeds.cat_id IN ($cats_qpart)";
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$query_strategy_part = "ttrss_feeds.cat_id IS NULL";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if ($feed > 0) {
|
} else if ($feed > 0) {
|
||||||
|
|
||||||
if ($cat_view) {
|
if ($cat_view) {
|
||||||
|
@ -628,10 +607,6 @@
|
||||||
|
|
||||||
if (!$override_order) $override_order = "last_read DESC";
|
if (!$override_order) $override_order = "last_read DESC";
|
||||||
|
|
||||||
/* } else if ($feed == -7) { // shared
|
|
||||||
$query_strategy_part = "uuid != ''";
|
|
||||||
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
|
||||||
$allow_archived = true; */
|
|
||||||
} else if ($feed == -3) { // fresh virtual feed
|
} else if ($feed == -3) { // fresh virtual feed
|
||||||
$query_strategy_part = "unread = true AND score >= 0";
|
$query_strategy_part = "unread = true AND score >= 0";
|
||||||
|
|
||||||
|
@ -702,19 +677,13 @@
|
||||||
|
|
||||||
$content_query_part = "content, ";
|
$content_query_part = "content, ";
|
||||||
|
|
||||||
|
|
||||||
if (is_numeric($feed)) {
|
|
||||||
|
|
||||||
if ($feed >= 0) {
|
|
||||||
$feed_kind = "Feeds";
|
|
||||||
} else {
|
|
||||||
$feed_kind = "Labels";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($limit_query_part) {
|
if ($limit_query_part) {
|
||||||
$offset_query_part = "OFFSET $offset";
|
$offset_query_part = "OFFSET $offset";
|
||||||
|
} else {
|
||||||
|
$offset_query_part = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_numeric($feed)) {
|
||||||
// proper override_order applied above
|
// proper override_order applied above
|
||||||
if ($vfeed_query_part && !$ignore_vfeed_group && get_pref('VFEED_GROUP_BY_FEED', $owner_uid)) {
|
if ($vfeed_query_part && !$ignore_vfeed_group && get_pref('VFEED_GROUP_BY_FEED', $owner_uid)) {
|
||||||
if (!$override_order) {
|
if (!$override_order) {
|
||||||
|
@ -733,8 +702,7 @@
|
||||||
LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)";
|
LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($vfeed_query_part)
|
if ($vfeed_query_part) $vfeed_query_part .= "favicon_avg_color,";
|
||||||
$vfeed_query_part .= "favicon_avg_color,";
|
|
||||||
|
|
||||||
if ($start_ts) {
|
if ($start_ts) {
|
||||||
$start_ts_formatted = date("Y/m/d H:i:s", strtotime($start_ts));
|
$start_ts_formatted = date("Y/m/d H:i:s", strtotime($start_ts));
|
||||||
|
@ -785,73 +753,45 @@
|
||||||
} else {
|
} else {
|
||||||
// browsing by tag
|
// browsing by tag
|
||||||
|
|
||||||
$select_qpart = "SELECT DISTINCT " .
|
$query = "SELECT DISTINCT
|
||||||
"date_entered," .
|
date_entered,
|
||||||
"guid," .
|
guid,
|
||||||
"note," .
|
note,
|
||||||
"ttrss_entries.id as id," .
|
ttrss_entries.id as id,
|
||||||
"title," .
|
title,
|
||||||
"updated," .
|
updated,
|
||||||
"unread," .
|
unread,
|
||||||
"feed_id," .
|
feed_id,
|
||||||
"orig_feed_id," .
|
orig_feed_id,
|
||||||
"marked," .
|
marked,
|
||||||
"num_comments, " .
|
num_comments,
|
||||||
"comments, " .
|
comments,
|
||||||
"tag_cache," .
|
tag_cache,
|
||||||
"label_cache," .
|
label_cache,
|
||||||
"link," .
|
link,
|
||||||
"lang," .
|
lang,
|
||||||
"uuid," .
|
uuid,
|
||||||
"last_read," .
|
last_read,
|
||||||
"(SELECT hide_images FROM ttrss_feeds WHERE id = feed_id) AS hide_images," .
|
(SELECT hide_images FROM ttrss_feeds WHERE id = feed_id) AS hide_images,
|
||||||
"last_marked, last_published, " .
|
last_marked, last_published,
|
||||||
$since_id_part .
|
$since_id_part
|
||||||
$vfeed_query_part .
|
$vfeed_query_part
|
||||||
$content_query_part .
|
$content_query_part
|
||||||
"score ";
|
author, score
|
||||||
|
FROM ttrss_entries, ttrss_user_entries, ttrss_tags
|
||||||
|
WHERE
|
||||||
|
ref_id = ttrss_entries.id AND
|
||||||
|
ttrss_user_entries.owner_uid = $owner_uid AND
|
||||||
|
post_int_id = int_id AND
|
||||||
|
tag_name = '$feed' AND
|
||||||
|
$view_query_part
|
||||||
|
$search_query_part
|
||||||
|
$query_strategy_part ORDER BY $order_by
|
||||||
|
$limit_query_part $offset_query_part";
|
||||||
|
|
||||||
$feed_kind = "Tags";
|
if ($_REQUEST["debug"]) print $query;
|
||||||
$all_tags = explode(",", $feed);
|
|
||||||
if ($search_mode == 'any') {
|
|
||||||
$tag_sql = "tag_name in (" . implode(", ", array_map("db_quote", $all_tags)) . ")";
|
|
||||||
$from_qpart = " FROM ttrss_entries,ttrss_user_entries,ttrss_tags ";
|
|
||||||
$where_qpart = " WHERE " .
|
|
||||||
"ref_id = ttrss_entries.id AND " .
|
|
||||||
"ttrss_user_entries.owner_uid = $owner_uid AND " .
|
|
||||||
"post_int_id = int_id AND $tag_sql AND " .
|
|
||||||
$view_query_part .
|
|
||||||
$search_query_part .
|
|
||||||
$query_strategy_part . " ORDER BY $order_by " .
|
|
||||||
$limit_query_part;
|
|
||||||
|
|
||||||
} else {
|
$result = db_query($query);
|
||||||
$i = 1;
|
|
||||||
$sub_selects = array();
|
|
||||||
$sub_ands = array();
|
|
||||||
foreach ($all_tags as $term) {
|
|
||||||
array_push($sub_selects, "(SELECT post_int_id from ttrss_tags WHERE tag_name = " . db_quote($term) . " AND owner_uid = $owner_uid) as A$i");
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
if ($i > 2) {
|
|
||||||
$x = 1;
|
|
||||||
$y = 2;
|
|
||||||
do {
|
|
||||||
array_push($sub_ands, "A$x.post_int_id = A$y.post_int_id");
|
|
||||||
$x++;
|
|
||||||
$y++;
|
|
||||||
} while ($y < $i);
|
|
||||||
}
|
|
||||||
array_push($sub_ands, "A1.post_int_id = ttrss_user_entries.int_id and ttrss_user_entries.owner_uid = $owner_uid");
|
|
||||||
array_push($sub_ands, "ttrss_user_entries.ref_id = ttrss_entries.id");
|
|
||||||
$from_qpart = " FROM " . implode(", ", $sub_selects) . ", ttrss_user_entries, ttrss_entries";
|
|
||||||
$where_qpart = " WHERE " . implode(" AND ", $sub_ands);
|
|
||||||
}
|
|
||||||
// error_log("TAG SQL: " . $tag_sql);
|
|
||||||
// $tag_sql = "tag_name = '$feed'"; DEFAULT way
|
|
||||||
|
|
||||||
// error_log("[". $select_qpart . "][" . $from_qpart . "][" .$where_qpart . "]");
|
|
||||||
$result = db_query($select_qpart . $from_qpart . $where_qpart);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($result, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words);
|
return array($result, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words);
|
||||||
|
|
|
@ -235,7 +235,6 @@
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
|
<div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcTagSelect')"><?php echo __('Select by tags...') ?></div>
|
|
||||||
<!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddLabel')"><?php echo __('Create label...') ?></div>
|
<!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddLabel')"><?php echo __('Create label...') ?></div>
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFilter')"><?php echo __('Create filter...') ?></div> -->
|
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFilter')"><?php echo __('Create filter...') ?></div> -->
|
||||||
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
|
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
|
||||||
|
|
|
@ -652,9 +652,6 @@ function quickMenuGo(opid) {
|
||||||
case "qmcTagCloud":
|
case "qmcTagCloud":
|
||||||
displayDlg(__("Tag cloud"), "printTagCloud");
|
displayDlg(__("Tag cloud"), "printTagCloud");
|
||||||
break;
|
break;
|
||||||
case "qmcTagSelect":
|
|
||||||
displayDlg(__("Select item(s) by tags"), "printTagSelect");
|
|
||||||
break;
|
|
||||||
case "qmcSearch":
|
case "qmcSearch":
|
||||||
search();
|
search();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -114,8 +114,8 @@ class Af_RedditImgur extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches = array();
|
$matches = array();
|
||||||
if (preg_match("/\/\/www\.youtube\.com\/v\/([\w-]+)/", $entry->getAttribute("href"), $matches) ||
|
if (preg_match("/\.youtube\.com\/v\/([\w-]+)/", $entry->getAttribute("href"), $matches) ||
|
||||||
preg_match("/\/\/www\.youtube\.com\/watch\?v=([\w-]+)/", $entry->getAttribute("href"), $matches) ||
|
preg_match("/\.youtube\.com\/watch\?v=([\w-]+)/", $entry->getAttribute("href"), $matches) ||
|
||||||
preg_match("/\/\/youtu.be\/([\w-]+)/", $entry->getAttribute("href"), $matches)) {
|
preg_match("/\/\/youtu.be\/([\w-]+)/", $entry->getAttribute("href"), $matches)) {
|
||||||
|
|
||||||
$vid_id = $matches[1];
|
$vid_id = $matches[1];
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Cache_Starred_Images extends Plugin implements IHandler {
|
||||||
|
|
||||||
function about() {
|
function about() {
|
||||||
return array(1.0,
|
return array(1.0,
|
||||||
"Automatically cache images in Starred articles",
|
"Automatically cache Starred articles' images and HTML5 video files",
|
||||||
"fox",
|
"fox",
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,8 @@ class Cache_Starred_Images extends Plugin implements IHandler {
|
||||||
|
|
||||||
if ($hash) {
|
if ($hash) {
|
||||||
|
|
||||||
$filename = $this->cache_dir . "/" . $hash . '.png';
|
$filename = $this->cache_dir . "/" . $hash;
|
||||||
|
$is_video = strpos($filename, ".mp4") !== FALSE;
|
||||||
|
|
||||||
if (file_exists($filename)) {
|
if (file_exists($filename)) {
|
||||||
/* See if we can use X-Sendfile */
|
/* See if we can use X-Sendfile */
|
||||||
|
@ -73,7 +74,7 @@ class Cache_Starred_Images extends Plugin implements IHandler {
|
||||||
header("Content-type: application/octet-stream");
|
header("Content-type: application/octet-stream");
|
||||||
header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
|
header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
|
||||||
} else {
|
} else {
|
||||||
header("Content-type: image/png");
|
header("Content-type: " . ($is_video ? "video/mp4" : "image/png"));
|
||||||
$stamp = gmdate("D, d M Y H:i:s", filemtime($filename)). " GMT";
|
$stamp = gmdate("D, d M Y H:i:s", filemtime($filename)). " GMT";
|
||||||
header("Last-Modified: $stamp", true);
|
header("Last-Modified: $stamp", true);
|
||||||
readfile($filename);
|
readfile($filename);
|
||||||
|
@ -86,7 +87,7 @@ class Cache_Starred_Images extends Plugin implements IHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_house_keeping() {
|
function hook_house_keeping() {
|
||||||
$files = glob($this->cache_dir . "/*.png");
|
$files = glob($this->cache_dir . "/*.{png,mp4}", GLOB_BRACE);
|
||||||
|
|
||||||
$last_article_id = 0;
|
$last_article_id = 0;
|
||||||
$article_exists = 1;
|
$article_exists = 1;
|
||||||
|
@ -113,18 +114,19 @@ class Cache_Starred_Images extends Plugin implements IHandler {
|
||||||
$xpath = new DOMXpath($doc);
|
$xpath = new DOMXpath($doc);
|
||||||
|
|
||||||
if ($article_id) {
|
if ($article_id) {
|
||||||
$entries = $xpath->query('(//img[@src])');
|
$entries = $xpath->query('(//img[@src])|(//video/source[@src])');
|
||||||
|
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
if ($entry->hasAttribute('src')) {
|
if ($entry->hasAttribute('src')) {
|
||||||
$src = rewrite_relative_url($site_url, $entry->getAttribute('src'));
|
$src = rewrite_relative_url($site_url, $entry->getAttribute('src'));
|
||||||
|
|
||||||
$local_filename = $this->cache_dir . $article_id . "-" . sha1($src) . ".png";
|
$extension = $entry->tagName == 'source' ? '.mp4' : '.png';
|
||||||
|
$local_filename = $this->cache_dir . $article_id . "-" . sha1($src) . $extension;
|
||||||
|
|
||||||
if (file_exists($local_filename)) {
|
if (file_exists($local_filename)) {
|
||||||
$entry->setAttribute("src", get_self_url_prefix() .
|
$entry->setAttribute("src", get_self_url_prefix() .
|
||||||
"/public.php?op=cache_starred_images_getimage&method=image&hash=" .
|
"/public.php?op=cache_starred_images_getimage&method=image&hash=" .
|
||||||
$article_id . "-" . sha1($src));
|
$article_id . "-" . sha1($src) . $extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -140,12 +142,11 @@ class Cache_Starred_Images extends Plugin implements IHandler {
|
||||||
(ttrss_user_entries.feed_id = ttrss_feeds.id)
|
(ttrss_user_entries.feed_id = ttrss_feeds.id)
|
||||||
WHERE ref_id = ttrss_entries.id AND
|
WHERE ref_id = ttrss_entries.id AND
|
||||||
marked = true AND
|
marked = true AND
|
||||||
UPPER(content) LIKE '%<IMG%' AND
|
(UPPER(content) LIKE '%<IMG%' OR UPPER(content) LIKE '%<VIDEO%') AND
|
||||||
site_url != '' AND
|
site_url != '' AND
|
||||||
plugin_data NOT LIKE '%starred_cache_images%'
|
plugin_data NOT LIKE '%starred_cache_images%'
|
||||||
ORDER BY ".sql_random_function()." LIMIT 100");
|
ORDER BY ".sql_random_function()." LIMIT 100");
|
||||||
|
|
||||||
|
|
||||||
while ($line = db_fetch_assoc($result)) {
|
while ($line = db_fetch_assoc($result)) {
|
||||||
if ($line["site_url"]) {
|
if ($line["site_url"]) {
|
||||||
$success = $this->cache_article_images($line["content"], $line["site_url"], $line["owner_uid"], $line["id"]);
|
$success = $this->cache_article_images($line["content"], $line["site_url"], $line["owner_uid"], $line["id"]);
|
||||||
|
@ -170,17 +171,20 @@ class Cache_Starred_Images extends Plugin implements IHandler {
|
||||||
$doc->loadHTML($charset_hack . $content);
|
$doc->loadHTML($charset_hack . $content);
|
||||||
$xpath = new DOMXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
|
|
||||||
$entries = $xpath->query('(//img[@src])');
|
$entries = $xpath->query('(//img[@src])|(//video/source[@src])');
|
||||||
|
|
||||||
$success = false;
|
$success = false;
|
||||||
$has_images = false;
|
$has_images = false;
|
||||||
|
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
|
|
||||||
if ($entry->hasAttribute('src')) {
|
if ($entry->hasAttribute('src')) {
|
||||||
$has_images = true;
|
$has_images = true;
|
||||||
$src = rewrite_relative_url($site_url, $entry->getAttribute('src'));
|
$src = rewrite_relative_url($site_url, $entry->getAttribute('src'));
|
||||||
|
|
||||||
$local_filename = $this->cache_dir . $article_id . "-" . sha1($src) . ".png";
|
$extension = $entry->tagName == 'source' ? '.mp4' : '.png';
|
||||||
|
|
||||||
|
$local_filename = $this->cache_dir . $article_id . "-" . sha1($src) . $extension;
|
||||||
|
|
||||||
//_debug("cache_images: downloading: $src to $local_filename");
|
//_debug("cache_images: downloading: $src to $local_filename");
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
div.contentSizeWrapper {
|
div.contentSizeWrapper {
|
||||||
overflow : hidden;
|
overflow : hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
height : 700px;
|
height : 800px;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.expandPrompt {
|
button.expandPrompt {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var _shorten_expanded_threshold = 900; //px, longer than css height so that we would only clip articles significantly longer than limit
|
var _shorten_expanded_threshold = 1.5; //window heights
|
||||||
|
|
||||||
function expandSizeWrapper(id) {
|
function expandSizeWrapper(id) {
|
||||||
try {
|
try {
|
||||||
|
@ -28,7 +28,7 @@ dojo.addOnLoad(function() {
|
||||||
|
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
if (row) {
|
if (row) {
|
||||||
if (row.offsetHeight >= _shorten_expanded_threshold) {
|
if (row.offsetHeight >= _shorten_expanded_threshold * window.innerHeight) {
|
||||||
var content = row.select(".cdmContentInner")[0];
|
var content = row.select(".cdmContentInner")[0];
|
||||||
|
|
||||||
if (content) {
|
if (content) {
|
||||||
|
|
Loading…
Reference in New Issue