/* do not rely on params below */
$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,
$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);
$this->wrap(self::STATUS_OK, $headlines);
static function api_get_headlines($feed_id, $limit, $offset,
$filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order,
$include_attachments, $since_id,
- $search = "", $search_mode = "",
- $include_nested = false, $sanitize_content = true, $force_update = false, $excerpt_length = 100) {
+ $search = "", $include_nested = false, $sanitize_content = true, $force_update = false, $excerpt_length = 100) {
if ($force_update && $feed_id > 0 && is_numeric($feed_id)) {
// Update the feed if required with some basic flood control
}
$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);
$result = $qfh_ret[0];
}
- 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() {
$this->params = explode(":", $this->param, 3);
private function format_headline_subtoolbar($feed_site_url, $feed_title,
$feed_id, $is_cat, $search,
- $search_mode, $view_mode, $error, $feed_last_updated) {
+ $view_mode, $error, $feed_last_updated) {
$catchup_sel_link = "catchupSelection()";
if ($is_cat) $cat_q = "&is_cat=$is_cat";
if ($search) {
- $search_q = "&q=$search&smode=$search_mode";
+ $search_q = "&q=$search";
} else {
$search_q = "";
}
$disable_cache = true;
}
- @$search_mode = $this->dbh->escape_string($_REQUEST["search_mode"]);
-
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) {
$handler = PluginHost::getInstance()->get_feed_handler(
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) {
$options = array(
"limit" => $limit,
"view_mode" => $view_mode,
"cat_view" => $cat_view,
"search" => $search,
- "search_mode" => $search_mode,
"override_order" => $override_order,
"offset" => $offset,
"owner_uid" => $_SESSION["uid"],
} else {
$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);
}
$reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url,
$feed_title,
- $feed, $cat_view, $search, $search_mode, $view_mode,
+ $feed, $cat_view, $search, $view_mode,
$last_error, $last_updated);
$headlines_count = $this->dbh->num_rows($result);
style=\"font-size : 16px; width : 20em;\"
required=\"1\" name=\"query\" type=\"search\" value=''>";
- print "<hr/>".__('Limit search to:')." ";
-
- 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 "<hr/><span style='float : right'>".T_sprintf('in %s', getFeedTitle($active_feed_id, $is_cat))."</span>";
print "</div>";
class Handler_Public extends Handler {
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) {
require_once "lib/MiniTemplator.class.php";
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,
- 1, $view_mode, $is_cat, $search, $search_mode,
+ 1, $view_mode, $is_cat, $search, false,
$date_sort_field, $offset, $owner_uid,
false, 0, true, true, false, false, $start_ts);
}
$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,
false, 0, true, true, false, false, $start_ts);
$offset = (int)$this->dbh->escape_string($_REQUEST["offset"]);
$search = $this->dbh->escape_string($_REQUEST["q"]);
- $search_mode = $this->dbh->escape_string($_REQUEST["smode"]);
$view_mode = $this->dbh->escape_string($_REQUEST["view-mode"]);
$order = $this->dbh->escape_string($_REQUEST["order"]);
$start_ts = $this->dbh->escape_string($_REQUEST["ts"]);
if ($owner_id) {
$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 {
header('HTTP/1.1 403 Forbidden');
}
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) {
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
$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 */
- } else if (!is_numeric($feed)) {
+ if (!is_numeric($feed)) {
$query_strategy_part = "true";
$vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
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) {
if ($cat_view) {
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
$query_strategy_part = "unread = true AND score >= 0";
$content_query_part = "content, ";
+ if ($limit_query_part) {
+ $offset_query_part = "OFFSET $offset";
+ } else {
+ $offset_query_part = "";
+ }
if (is_numeric($feed)) {
-
- if ($feed >= 0) {
- $feed_kind = "Feeds";
- } else {
- $feed_kind = "Labels";
- }
-
- if ($limit_query_part) {
- $offset_query_part = "OFFSET $offset";
- }
-
// proper override_order applied above
if ($vfeed_query_part && !$ignore_vfeed_group && get_pref('VFEED_GROUP_BY_FEED', $owner_uid)) {
if (!$override_order) {
LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)";
}
- if ($vfeed_query_part)
- $vfeed_query_part .= "favicon_avg_color,";
+ if ($vfeed_query_part) $vfeed_query_part .= "favicon_avg_color,";
if ($start_ts) {
$start_ts_formatted = date("Y/m/d H:i:s", strtotime($start_ts));
} else {
// browsing by tag
- $select_qpart = "SELECT DISTINCT " .
- "date_entered," .
- "guid," .
- "note," .
- "ttrss_entries.id as id," .
- "title," .
- "updated," .
- "unread," .
- "feed_id," .
- "orig_feed_id," .
- "marked," .
- "num_comments, " .
- "comments, " .
- "tag_cache," .
- "label_cache," .
- "link," .
- "lang," .
- "uuid," .
- "last_read," .
- "(SELECT hide_images FROM ttrss_feeds WHERE id = feed_id) AS hide_images," .
- "last_marked, last_published, " .
- $since_id_part .
- $vfeed_query_part .
- $content_query_part .
- "score ";
-
- $feed_kind = "Tags";
- $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;
+ $query = "SELECT DISTINCT
+ date_entered,
+ guid,
+ note,
+ ttrss_entries.id as id,
+ title,
+ updated,
+ unread,
+ feed_id,
+ orig_feed_id,
+ marked,
+ num_comments,
+ comments,
+ tag_cache,
+ label_cache,
+ link,
+ lang,
+ uuid,
+ last_read,
+ (SELECT hide_images FROM ttrss_feeds WHERE id = feed_id) AS hide_images,
+ last_marked, last_published,
+ $since_id_part
+ $vfeed_query_part
+ $content_query_part
+ 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";
- } else {
- $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
+ if ($_REQUEST["debug"]) print $query;
- // error_log("[". $select_qpart . "][" . $from_qpart . "][" .$where_qpart . "]");
- $result = db_query($select_qpart . $from_qpart . $where_qpart);
+ $result = db_query($query);
}
return array($result, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words);
<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" 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('qmcAddFilter')"><?php echo __('Create filter...') ?></div> -->
<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
case "qmcTagCloud":
displayDlg(__("Tag cloud"), "printTagCloud");
break;
- case "qmcTagSelect":
- displayDlg(__("Select item(s) by tags"), "printTagSelect");
- break;
case "qmcSearch":
search();
break;