diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/digest.php | 4 | ||||
-rw-r--r-- | classes/mailer.php | 2 | ||||
-rwxr-xr-x | classes/pref/filters.php | 59 | ||||
-rwxr-xr-x | classes/rpc.php | 28 | ||||
-rwxr-xr-x | classes/rssutils.php | 22 |
5 files changed, 61 insertions, 54 deletions
diff --git a/classes/digest.php b/classes/digest.php index a61b6dfca..0d2cac77e 100644 --- a/classes/digest.php +++ b/classes/digest.php @@ -141,8 +141,8 @@ class Digest AND score >= 0 ORDER BY ttrss_feed_categories.title, ttrss_feeds.title, score DESC, date_updated DESC LIMIT :limit"); - $sth->bindParam(':user_id', intval($user_id, 10), \PDO::PARAM_INT); - $sth->bindParam(':limit', intval($limit, 10), \PDO::PARAM_INT); + $sth->bindParam(':user_id', intval($user_id, 10), PDO::PARAM_INT); + $sth->bindParam(':limit', intval($limit, 10), PDO::PARAM_INT); $sth->execute(); $headlines_count = 0; diff --git a/classes/mailer.php b/classes/mailer.php index 93a9279e5..b40930442 100644 --- a/classes/mailer.php +++ b/classes/mailer.php @@ -37,7 +37,7 @@ class Mailer { return 0; } - $headers[] = "From: $from_combined"; + $headers = [ "From: $from_combined", "Content-Type: text/plain; charset=UTF-8" ]; return mail($to_combined, $subject, $message, implode("\r\n", array_merge($headers, $additional_headers))); } diff --git a/classes/pref/filters.php b/classes/pref/filters.php index ec980d5f9..9c2a7bf54 100755 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -146,48 +146,16 @@ class Pref_Filters extends Handler_Protected { $content_preview = $line["content_preview"]; - $tmp = "<tr style='margin-top : 5px'>"; - - #$tmp .= "<td width='5%' align='center'><input dojoType=\"dijit.form.CheckBox\" - # checked=\"1\" disabled=\"1\" type=\"checkbox\"></td>"; - - $id = $line['id']; - $tmp .= "<td width='5%' align='center'><img style='cursor : pointer' title='".__("Preview article")."' - src='images/information.png' onclick='popupOpenArticle($id)'></td><td>"; - - /*foreach ($filter['rules'] as $rule) { - $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); - }*/ - - $tmp .= "<strong>" . $line["title"] . "</strong><br/>"; - $tmp .= $line['feed_title'] . ", " . mb_substr($line["date_entered"], 0, 16); - $tmp .= "<div class='insensitive'>" . $content_preview . "</div>"; - $tmp .= "</td></tr>"; + $tmp = "<li><span class='title'>" . $line["title"] . "</span><br/>" . + "<span class='feed'>" . $line['feed_title'] . "</span>, <span class='date'>" . mb_substr($line["date_entered"], 0, 16) . "</span>" . + "<div class='preview insensitive'>" . $content_preview . "</div>" . + "</li>"; array_push($rv, $tmp); - /*array_push($rv, array("title" => $line["title"], - "content" => $content_preview, - "date" => $line["date_entered"], - "feed" => $line["feed_title"])); */ - } } - //$offset += $limit; - //} - - /*if ($found == 0) { - print "<tr><td align='center'>" . - __("No recent articles matching this filter have been found."); - }*/ - print json_encode($rv); } @@ -199,9 +167,8 @@ class Pref_Filters extends Handler_Protected { print "<div><img id='prefFilterLoadingIndicator' src='images/indicator_tiny.gif'> <span id='prefFilterProgressMsg'>Looking for articles...</span></div>"; - print "<br/><div class='panel panel-scrollable'>"; - print "<table width='100%' id='prefFilterTestResultList'>"; - print "</table></div>"; + print "<ul class='panel panel-scrollable list list-unstyled' id='prefFilterTestResultList'>"; + print "</ul>"; print "<div style='text-align : center'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('filterTestDlg').hide()\">". @@ -210,7 +177,7 @@ class Pref_Filters extends Handler_Protected { } - private function getfilterrules_concise($filter_id) { + private function getfilterrules_list($filter_id) { $sth = $this->pdo->prepare("SELECT reg_exp, inverse, match_on, @@ -260,11 +227,11 @@ class Pref_Filters extends Handler_Protected { $inverse = $line["inverse"] ? "inverse" : ""; - $rv .= "<span class='$inverse'>" . T_sprintf("%s on %s in %s %s", + $rv .= "<li class='$inverse'>" . T_sprintf("%s on %s in %s %s", htmlspecialchars($line["reg_exp"]), $line["field"], $where, - $line["inverse"] ? __("(inverse)") : "") . "</span>"; + $line["inverse"] ? __("(inverse)") : "") . "</li>"; } return $rv; @@ -301,6 +268,10 @@ class Pref_Filters extends Handler_Protected { $match_ok = false; if ($filter_search) { + if (mb_strpos($line['title'], $filter_search) !== false) { + $match_ok = true; + } + $rules_sth = $this->pdo->prepare("SELECT reg_exp FROM ttrss_filters2_rules WHERE filter_id = ?"); $rules_sth->execute([$line['id']]); @@ -335,7 +306,7 @@ class Pref_Filters extends Handler_Protected { $filter['checkbox'] = false; $filter['last_triggered'] = $line["last_triggered"] ? make_local_datetime($line["last_triggered"], false) : null; $filter['enabled'] = $line["enabled"]; - $filter['rules'] = $this->getfilterrules_concise($line['id']); + $filter['rules'] = $this->getfilterrules_list($line['id']); if (!$filter_search || $match_ok) { array_push($folder['items'], $filter); @@ -785,7 +756,7 @@ class Pref_Filters extends Handler_Protected { print "<div style='float : right; padding-right : 4px;'> <input dojoType=\"dijit.form.TextBox\" id=\"filter_search\" size=\"20\" type=\"search\" value=\"$filter_search\"> - <button dojoType=\"dijit.form.Button\" onclick=\"updateFilterList()\">". + <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('filterTree').reload()\">". __('Search')."</button> </div>"; diff --git a/classes/rpc.php b/classes/rpc.php index d40d5ab6a..b2184d8ec 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -274,7 +274,8 @@ class RPC extends Handler_Protected { @$seq = (int) $_REQUEST['seq']; $reply = [ - 'counters' => Counters::getAllCounters() + 'counters' => Counters::getAllCounters(), + 'seq' => $seq ]; if ($seq % 2 == 0) @@ -323,7 +324,7 @@ class RPC extends Handler_Protected { if ($reply['error']['code'] == 0) { $reply['init-params'] = make_init_params(); - $reply['runtime-info'] = make_runtime_info(true); + $reply['runtime-info'] = make_runtime_info(); } print json_encode($reply); @@ -596,4 +597,27 @@ class RPC extends Handler_Protected { } } + + function checkforupdates() { + $rv = []; + + if (CHECK_FOR_UPDATES && $_SESSION["access_level"] >= 10 && defined("GIT_VERSION_TIMESTAMP")) { + $content = @fetch_file_contents(["url" => "https://tt-rss.org/version.json"]); + + if ($content) { + $content = json_decode($content, true); + + if ($content && isset($content["changeset"])) { + if ((int)GIT_VERSION_TIMESTAMP < (int)$content["changeset"]["timestamp"] && + GIT_VERSION_HEAD != $content["changeset"]["id"]) { + + $rv = $content["changeset"]; + } + } + } + } + + print json_encode($rv); + } + }
\ No newline at end of file diff --git a/classes/rssutils.php b/classes/rssutils.php index 750222c80..ea57e6466 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -259,9 +259,13 @@ class RSSUtils { global $fetch_curl_used; if (!$fetch_curl_used) { - $tmp = @gzdecode($feed_data); + $is_gzipped = RSSUtils::is_gzipped($feed_data); - if ($tmp) $feed_data = $tmp; + if ($is_gzipped) { + $tmp = @gzdecode($feed_data); + + if ($tmp) $feed_data = $tmp; + } } $feed_data = trim($feed_data); @@ -433,9 +437,15 @@ class RSSUtils { global $fetch_curl_used; if (!$fetch_curl_used) { - $tmp = @gzdecode($feed_data); + $is_gzipped = RSSUtils::is_gzipped($feed_data); + + Debug::log("is_gzipped: $is_gzipped", Debug::$LOG_VERBOSE); - if ($tmp) $feed_data = $tmp; + if ($is_gzipped) { + $tmp = @gzdecode($feed_data); + + if ($tmp) $feed_data = $tmp; + } } $feed_data = trim($feed_data); @@ -1602,6 +1612,8 @@ class RSSUtils { } } - + private static function is_gzipped($feed_data) { + return mb_strpos($feed_data, "\x1f" . "\x8b" . "\x08", 0, "US-ASCII") === 0; + } } |