]> git.wh0rd.org Git - tt-rss.git/commitdiff
Merge branch 'master' of git.fakecake.org:tt-rss
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Mon, 13 Jul 2015 09:46:05 +0000 (12:46 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Mon, 13 Jul 2015 09:46:05 +0000 (12:46 +0300)
Conflicts:
classes/pref/filters.php

1  2 
classes/pref/filters.php

index 6e8f4630c39e4e0ad3e906f69f299a886cb6487e,5e3c35b7d509702202b8d1209d30d374cde548ad..0e887c426ab49f58d01b424f184a362692a219f5
@@@ -106,82 -108,47 +106,83 @@@ class Pref_Filters extends Handler_Prot
                print "<div class=\"filterTestHolder\">";
                print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
  
 -              while ($line = $this->dbh->fetch_assoc($result)) {
 -                      $line["content_preview"] = truncate_string(strip_tags($line["content"]), 100, '...');
 +              $glue = $filter['match_any_rule'] ? " AND " :  "OR ";
 +              $scope_qpart = join($glue, $scope_qparts);
  
 -                      foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
 -                                      $line = $p->hook_query_headlines($line, 100);
 -                              }
 +              while ($found < $limit && $offset < $limit * 10 && time() - $started < ini_get("max_execution_time") * 0.7) {
  
 -                      $content_preview = $line["content_preview"];
 +                      $result = db_query("SELECT ttrss_entries.id,
 +                                      ttrss_entries.title,
 +                                      ttrss_feeds.id AS feed_id,
++                                      ttrss_feeds.title AS feed_title,
 +                                      ttrss_feed_categories.id AS cat_id,
 +                                      content,
 +                                      link,
 +                                      author,
 +                                      tag_cache
 +                              FROM
 +                                      ttrss_entries, ttrss_user_entries
 +                                              LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)
 +                                              LEFT JOIN ttrss_feed_categories ON (ttrss_feeds.cat_id = ttrss_feed_categories.id)
 +                              WHERE
 +                                      ref_id = ttrss_entries.id AND
 +                                      ($scope_qpart) AND
 +                                      ttrss_user_entries.owner_uid = " . $_SESSION["uid"] . "
 +                              ORDER BY date_entered DESC LIMIT $limit OFFSET $offset");
  
 -                      if ($line["feed_title"])
 -                              $feed_title = $line["feed_title"];
 +                      while ($line = db_fetch_assoc($result)) {
  
 -                      print "<tr>";
 +                              $rc = get_article_filters(array($filter), $line['title'], $line['content'], $line['link'],
 +                                      false, $line['author'], explode(",", $line['tag_cache']));
  
 -                      print "<td width='5%' align='center'><input
 -                              dojoType=\"dijit.form.CheckBox\" checked=\"1\"
 -                              disabled=\"1\" type=\"checkbox\"></td>";
 -                      print "<td>";
 +                              if (count($rc) > 0) {
  
 -                      print $line["title"];
 -                      print "&nbsp;(";
 -                      print "<b>" . $feed_title . "</b>";
 -                      print "):&nbsp;";
 -                      print "<span class=\"insensitive\">" . $content_preview . "</span>";
 -                      print " " . mb_substr($line["date_entered"], 0, 16);
 +                                      $line["content_preview"] = truncate_string(strip_tags($line["content"]), 100, '...');
  
 -                      print "</td></tr>";
 +                                      foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
 +                                              $line = $p->hook_query_headlines($line, 100);
 +                                      }
  
 -                      $found++;
 -              }
 +                                      $content_preview = $line["content_preview"];
  
 -              if ($found == 0) {
 -                      print "<tr><td align='center'>" .
 -                              __("No recent articles matching this filter have been found.");
 +                                      if ($line["feed_title"]) $feed_title = $line["feed_title"];
 +
 +                                      print "<tr>";
 +
 +                                      print "<td width='5%' align='center'><input dojoType=\"dijit.form.CheckBox\"
 +                                              checked=\"1\" disabled=\"1\" type=\"checkbox\"></td>";
 +                                      print "<td>";
 +
-                                       foreach ($filter['rules'] as $rule) {
++                                      /*foreach ($filter['rules'] as $rule) {
 +                                              $reg_exp = $rule['reg_exp'];
 +                                              $reg_exp = str_replace('/', '\/', $rule["reg_exp"]);
 +
 +                                              $line["title"] = preg_replace("/($reg_exp)/i",
 +                                                      "<span class=\"highlight\">$1</span>", $line["title"]);
 +
 +                                              $content_preview = preg_replace("/($reg_exp)/i",
 +                                                      "<span class=\"highlight\">$1</span>", $content_preview);
-                                       }
++                                      }*/
  
 -                      print "</td></tr><tr><td class='insensitive' align='center'>";
 +                                      print $line["title"];
 +                                      print "&nbsp;(";
 +                                      print "<b>" . $feed_title . "</b>";
 +                                      print "):&nbsp;";
 +                                      print "<span class=\"insensitive\">" . $content_preview . "</span>";
 +                                      print " " . mb_substr($line["date_entered"], 0, 16);
  
 -                      print __("Complex expressions might not give results while testing due to issues with database server regexp implementation.");
 +                                      print "</td></tr>";
  
 -                      print "</td></tr>";
 +                                      $found++;
 +                              }
 +                      }
 +
 +                      $offset += $limit;
 +              }
  
 +              if ($found == 0) {
 +                      print "<tr><td align='center'>" .
 +                              __("No recent articles matching this filter have been found.");
                }
  
                print "</table></div>";