include: convert some spaces to tabs

master
Andrew Dolgov 7 years ago
parent 2aec1b030c
commit 7f4a404566

@ -18,8 +18,8 @@ class RSSUtils {
// Strips utf8mb4 characters (i.e. emoji) for mysql // Strips utf8mb4 characters (i.e. emoji) for mysql
static function strip_utf8mb4($str) { static function strip_utf8mb4($str) {
return preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $str); return preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $str);
} }
static function update_feedbrowser_cache() { static function update_feedbrowser_cache() {
@ -422,15 +422,15 @@ class RSSUtils {
_debug("not using CURL due to open_basedir restrictions"); _debug("not using CURL due to open_basedir restrictions");
} }
if (time() - strtotime($last_unconditional) > MAX_CONDITIONAL_INTERVAL) { if (time() - strtotime($last_unconditional) > MAX_CONDITIONAL_INTERVAL) {
_debug("maximum allowed interval for conditional requests exceeded, forcing refetch"); _debug("maximum allowed interval for conditional requests exceeded, forcing refetch");
$force_refetch = true; $force_refetch = true;
} else { } else {
_debug("stored last modified for conditional request: $stored_last_modified", $debug_enabled); _debug("stored last modified for conditional request: $stored_last_modified", $debug_enabled);
} }
_debug("fetching [$fetch_url] (force_refetch: $force_refetch)...", $debug_enabled); _debug("fetching [$fetch_url] (force_refetch: $force_refetch)...", $debug_enabled);
$feed_data = fetch_file_contents([ $feed_data = fetch_file_contents([
"url" => $fetch_url, "url" => $fetch_url,
@ -572,8 +572,8 @@ class RSSUtils {
$filters = load_filters($feed, $owner_uid); $filters = load_filters($feed, $owner_uid);
if ($debug_enabled) { if ($debug_enabled) {
print_r($filters); print_r($filters);
} }
_debug("" . count($filters) . " filters loaded.", $debug_enabled); _debug("" . count($filters) . " filters loaded.", $debug_enabled);
@ -1050,14 +1050,14 @@ class RSSUtils {
// Yet another episode of "mysql utf8_general_ci is gimped" // Yet another episode of "mysql utf8_general_ci is gimped"
if (DB_TYPE == "mysql") { if (DB_TYPE == "mysql") {
for ($i = 0; $i < count($e_item); $i++) { for ($i = 0; $i < count($e_item); $i++) {
if (is_string($e_item[$i])) { if (is_string($e_item[$i])) {
$e_item[$i] = RSSUtils::strip_utf8mb4($e_item[$i]); $e_item[$i] = RSSUtils::strip_utf8mb4($e_item[$i]);
} }
} }
} }
array_push($enclosures, $e_item); array_push($enclosures, $e_item);
} }
} }

@ -71,106 +71,106 @@ function print_radio($id, $default, $true_is, $values, $attributes = "") {
} }
function print_feed_multi_select($id, $default_ids = [], function print_feed_multi_select($id, $default_ids = [],
$attributes = "", $include_all_feeds = true, $attributes = "", $include_all_feeds = true,
$root_id = null, $nest_level = 0) { $root_id = null, $nest_level = 0) {
$pdo = DB::pdo(); $pdo = DB::pdo();
print_r(in_array("CAT:6",$default_ids)); print_r(in_array("CAT:6",$default_ids));
if (!$root_id) { if (!$root_id) {
print "<select multiple=\true\" id=\"$id\" name=\"$id\" $attributes>"; print "<select multiple=\true\" id=\"$id\" name=\"$id\" $attributes>";
if ($include_all_feeds) { if ($include_all_feeds) {
$is_selected = (in_array("0", $default_ids)) ? "selected=\"1\"" : ""; $is_selected = (in_array("0", $default_ids)) ? "selected=\"1\"" : "";
print "<option $is_selected value=\"0\">".__('All feeds')."</option>"; print "<option $is_selected value=\"0\">".__('All feeds')."</option>";
} }
} }
if (get_pref('ENABLE_FEED_CATS')) { if (get_pref('ENABLE_FEED_CATS')) {
if (!$root_id) $root_id = null; if (!$root_id) $root_id = null;
$sth = $pdo->prepare("SELECT id,title, $sth = $pdo->prepare("SELECT id,title,
(SELECT COUNT(id) FROM ttrss_feed_categories AS c2 WHERE (SELECT COUNT(id) FROM ttrss_feed_categories AS c2 WHERE
c2.parent_cat = ttrss_feed_categories.id) AS num_children c2.parent_cat = ttrss_feed_categories.id) AS num_children
FROM ttrss_feed_categories FROM ttrss_feed_categories
WHERE owner_uid = :uid AND WHERE owner_uid = :uid AND
(parent_cat = :root_id OR (:root_id IS NULL AND parent_cat IS NULL)) ORDER BY title"); (parent_cat = :root_id OR (:root_id IS NULL AND parent_cat IS NULL)) ORDER BY title");
$sth->execute([":uid" => $_SESSION['uid'], ":root_id" => $root_id]); $sth->execute([":uid" => $_SESSION['uid'], ":root_id" => $root_id]);
while ($line = $sth->fetch()) { while ($line = $sth->fetch()) {
for ($i = 0; $i < $nest_level; $i++) for ($i = 0; $i < $nest_level; $i++)
$line["title"] = " - " . $line["title"]; $line["title"] = " - " . $line["title"];
$is_selected = in_array("CAT:".$line["id"], $default_ids) ? "selected=\"1\"" : ""; $is_selected = in_array("CAT:".$line["id"], $default_ids) ? "selected=\"1\"" : "";
printf("<option $is_selected value='CAT:%d'>%s</option>", printf("<option $is_selected value='CAT:%d'>%s</option>",
$line["id"], htmlspecialchars($line["title"])); $line["id"], htmlspecialchars($line["title"]));
if ($line["num_children"] > 0) if ($line["num_children"] > 0)
print_feed_multi_select($id, $default_ids, $attributes, print_feed_multi_select($id, $default_ids, $attributes,
$include_all_feeds, $line["id"], $nest_level+1); $include_all_feeds, $line["id"], $nest_level+1);
$f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds $f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
WHERE cat_id = ? AND owner_uid = ? ORDER BY title"); WHERE cat_id = ? AND owner_uid = ? ORDER BY title");
$f_sth->execute([$line['id'], $_SESSION['uid']]); $f_sth->execute([$line['id'], $_SESSION['uid']]);
while ($fline = $f_sth->fetch()) { while ($fline = $f_sth->fetch()) {
$is_selected = (in_array($fline["id"], $default_ids)) ? "selected=\"1\"" : ""; $is_selected = (in_array($fline["id"], $default_ids)) ? "selected=\"1\"" : "";
$fline["title"] = " + " . $fline["title"]; $fline["title"] = " + " . $fline["title"];
for ($i = 0; $i < $nest_level; $i++) for ($i = 0; $i < $nest_level; $i++)
$fline["title"] = " - " . $fline["title"]; $fline["title"] = " - " . $fline["title"];
printf("<option $is_selected value='%d'>%s</option>", printf("<option $is_selected value='%d'>%s</option>",
$fline["id"], htmlspecialchars($fline["title"])); $fline["id"], htmlspecialchars($fline["title"]));
} }
} }
if (!$root_id) { if (!$root_id) {
$is_selected = in_array("CAT:0", $default_ids) ? "selected=\"1\"" : ""; $is_selected = in_array("CAT:0", $default_ids) ? "selected=\"1\"" : "";
printf("<option $is_selected value='CAT:0'>%s</option>", printf("<option $is_selected value='CAT:0'>%s</option>",
__("Uncategorized")); __("Uncategorized"));
$f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds $f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
WHERE cat_id IS NULL AND owner_uid = ? ORDER BY title"); WHERE cat_id IS NULL AND owner_uid = ? ORDER BY title");
$f_sth->execute([$_SESSION['uid']]); $f_sth->execute([$_SESSION['uid']]);
while ($fline = $f_sth->fetch()) { while ($fline = $f_sth->fetch()) {
$is_selected = in_array($fline["id"], $default_ids) ? "selected=\"1\"" : ""; $is_selected = in_array($fline["id"], $default_ids) ? "selected=\"1\"" : "";
$fline["title"] = " + " . $fline["title"]; $fline["title"] = " + " . $fline["title"];
for ($i = 0; $i < $nest_level; $i++) for ($i = 0; $i < $nest_level; $i++)
$fline["title"] = " - " . $fline["title"]; $fline["title"] = " - " . $fline["title"];
printf("<option $is_selected value='%d'>%s</option>", printf("<option $is_selected value='%d'>%s</option>",
$fline["id"], htmlspecialchars($fline["title"])); $fline["id"], htmlspecialchars($fline["title"]));
} }
} }
} else { } else {
$sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds $sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
WHERE owner_uid = ? ORDER BY title"); WHERE owner_uid = ? ORDER BY title");
$sth->execute([$_SESSION['uid']]); $sth->execute([$_SESSION['uid']]);
while ($line = $sth->fetch()) { while ($line = $sth->fetch()) {
$is_selected = (in_array($line["id"], $default_ids)) ? "selected=\"1\"" : ""; $is_selected = (in_array($line["id"], $default_ids)) ? "selected=\"1\"" : "";
printf("<option $is_selected value='%d'>%s</option>", printf("<option $is_selected value='%d'>%s</option>",
$line["id"], htmlspecialchars($line["title"])); $line["id"], htmlspecialchars($line["title"]));
} }
} }
if (!$root_id) { if (!$root_id) {
print "</select>"; print "</select>";
} }
} }
function print_feed_cat_select($id, $default_id, function print_feed_cat_select($id, $default_id,
@ -195,7 +195,7 @@ function print_feed_cat_select($id, $default_id,
$found = 0; $found = 0;
while ($line = $sth->fetch()) { while ($line = $sth->fetch()) {
++$found; ++$found;
if ($line["id"] == $default_id) { if ($line["id"] == $default_id) {
$is_selected = "selected=\"1\""; $is_selected = "selected=\"1\"";
@ -315,7 +315,7 @@ function format_inline_player($url, $ctype) {
function print_label_select($name, $value, $attributes = "") { function print_label_select($name, $value, $attributes = "") {
$pdo = Db::pdo(); $pdo = Db::pdo();
$sth = $pdo->prepare("SELECT caption FROM ttrss_labels2 $sth = $pdo->prepare("SELECT caption FROM ttrss_labels2
WHERE owner_uid = ? ORDER BY caption"); WHERE owner_uid = ? ORDER BY caption");
@ -338,4 +338,4 @@ function print_label_select($name, $value, $attributes = "") {
print "</select>"; print "</select>";
} }

@ -57,9 +57,9 @@
// do not cache files smaller than that (bytes) // do not cache files smaller than that (bytes)
define_default('CACHE_MAX_DAYS', 7); define_default('CACHE_MAX_DAYS', 7);
// max age in days for various automatically cached (temporary) files // max age in days for various automatically cached (temporary) files
define_default('MAX_CONDITIONAL_INTERVAL', 3600*12); define_default('MAX_CONDITIONAL_INTERVAL', 3600*12);
// max interval between forced unconditional updates for servers // max interval between forced unconditional updates for servers
// not complying with http if-modified-since (seconds) // not complying with http if-modified-since (seconds)
/* tunables end here */ /* tunables end here */
@ -255,9 +255,9 @@
} }
if (!$purge_unread) if (!$purge_unread)
$query_limit = " unread = false AND "; $query_limit = " unread = false AND ";
else else
$query_limit = ""; $query_limit = "";
$purge_interval = (int) $purge_interval; $purge_interval = (int) $purge_interval;
@ -272,14 +272,14 @@
$sth->execute([$feed_id]); $sth->execute([$feed_id]);
} else { } else {
$sth = $pdo->prepare("DELETE FROM ttrss_user_entries $sth = $pdo->prepare("DELETE FROM ttrss_user_entries
USING ttrss_user_entries, ttrss_entries USING ttrss_user_entries, ttrss_entries
WHERE ttrss_entries.id = ref_id AND WHERE ttrss_entries.id = ref_id AND
marked = false AND marked = false AND
feed_id = ? AND feed_id = ? AND
$query_limit $query_limit
ttrss_entries.date_updated < DATE_SUB(NOW(), INTERVAL $purge_interval DAY)"); ttrss_entries.date_updated < DATE_SUB(NOW(), INTERVAL $purge_interval DAY)");
$sth->execute([$feed_id]); $sth->execute([$feed_id]);
} }
@ -296,7 +296,7 @@
function feed_purge_interval($feed_id) { function feed_purge_interval($feed_id) {
$pdo = DB::pdo(); $pdo = DB::pdo();
$sth = $pdo->prepare("SELECT purge_interval, owner_uid FROM ttrss_feeds $sth = $pdo->prepare("SELECT purge_interval, owner_uid FROM ttrss_feeds
WHERE id = ?"); WHERE id = ?");
@ -318,7 +318,7 @@
// TODO: multiple-argument way is deprecated, first parameter is a hash now // TODO: multiple-argument way is deprecated, first parameter is a hash now
function fetch_file_contents($options /* previously: 0: $url , 1: $type = false, 2: $login = false, 3: $pass = false, function fetch_file_contents($options /* previously: 0: $url , 1: $type = false, 2: $login = false, 3: $pass = false,
4: $post_query = false, 5: $timeout = false, 6: $timestamp = 0, 7: $useragent = false*/) { 4: $post_query = false, 5: $timeout = false, 6: $timestamp = 0, 7: $useragent = false*/) {
global $fetch_last_error; global $fetch_last_error;
global $fetch_last_error_code; global $fetch_last_error_code;
@ -421,18 +421,18 @@
$contents = substr($ret, $headers_length); $contents = substr($ret, $headers_length);
foreach ($headers as $header) { foreach ($headers as $header) {
if (strstr($header, ": ") !== FALSE) { if (strstr($header, ": ") !== FALSE) {
list ($key, $value) = explode(": ", $header); list ($key, $value) = explode(": ", $header);
if (strtolower($key) == "last-modified") { if (strtolower($key) == "last-modified") {
$fetch_last_modified = $value; $fetch_last_modified = $value;
} }
} }
if (substr(strtolower($header), 0, 7) == 'http/1.') { if (substr(strtolower($header), 0, 7) == 'http/1.') {
$fetch_last_error_code = (int) substr($header, 9, 3); $fetch_last_error_code = (int) substr($header, 9, 3);
$fetch_last_error = $header; $fetch_last_error = $header;
} }
} }
if (curl_errno($ch) === 23 || curl_errno($ch) === 61) { if (curl_errno($ch) === 23 || curl_errno($ch) === 61) {
@ -486,13 +486,13 @@
$context_options = array( $context_options = array(
'http' => array( 'http' => array(
'method' => 'GET', 'method' => 'GET',
'ignore_errors' => true, 'ignore_errors' => true,
'timeout' => $timeout ? $timeout : FILE_FETCH_TIMEOUT, 'timeout' => $timeout ? $timeout : FILE_FETCH_TIMEOUT,
'protocol_version'=> 1.1) 'protocol_version'=> 1.1)
); );
if (!$post_query && $last_modified) { if (!$post_query && $last_modified) {
$context_options['http']['header'] = "If-Modified-Since: $last_modified\r\n"; $context_options['http']['header'] = "If-Modified-Since: $last_modified\r\n";
} }
if (defined('_HTTP_PROXY')) { if (defined('_HTTP_PROXY')) {
@ -500,7 +500,7 @@
$context_options['http']['proxy'] = _HTTP_PROXY; $context_options['http']['proxy'] = _HTTP_PROXY;
} }
$context = stream_context_create($context_options); $context = stream_context_create($context_options);
$old_error = error_get_last(); $old_error = error_get_last();
@ -508,19 +508,19 @@
if (isset($http_response_header) && is_array($http_response_header)) { if (isset($http_response_header) && is_array($http_response_header)) {
foreach ($http_response_header as $header) { foreach ($http_response_header as $header) {
if (strstr($header, ": ") !== FALSE) { if (strstr($header, ": ") !== FALSE) {
list ($key, $value) = explode(": ", $header); list ($key, $value) = explode(": ", $header);
$key = strtolower($key); $key = strtolower($key);
if ($key == 'content-type') { if ($key == 'content-type') {
$fetch_last_content_type = $value; $fetch_last_content_type = $value;
// don't abort here b/c there might be more than one // don't abort here b/c there might be more than one
// e.g. if we were being redirected -- last one is the right one // e.g. if we were being redirected -- last one is the right one
} else if ($key == 'last-modified') { } else if ($key == 'last-modified') {
$fetch_last_modified = $value; $fetch_last_modified = $value;
} }
} }
if (substr(strtolower($header), 0, 7) == 'http/1.') { if (substr(strtolower($header), 0, 7) == 'http/1.') {
$fetch_last_error_code = (int) substr($header, 9, 3); $fetch_last_error_code = (int) substr($header, 9, 3);
@ -591,18 +591,18 @@
if (get_schema_version() < 63) $profile_qpart = ""; if (get_schema_version() < 63) $profile_qpart = "";
$pdo = DB::pdo(); $pdo = DB::pdo();
$in_nested_tr = false; $in_nested_tr = false;
try { try {
$pdo->beginTransaction(); $pdo->beginTransaction();
} catch (Exception $e) { } catch (Exception $e) {
$in_nested_tr = true; $in_nested_tr = true;
} }
$sth = $pdo->query("SELECT pref_name,def_value FROM ttrss_prefs"); $sth = $pdo->query("SELECT pref_name,def_value FROM ttrss_prefs");
$profile = $profile ? $profile : null; $profile = $profile ? $profile : null;
$u_sth = $pdo->prepare("SELECT pref_name $u_sth = $pdo->prepare("SELECT pref_name
FROM ttrss_user_prefs WHERE owner_uid = :uid AND FROM ttrss_user_prefs WHERE owner_uid = :uid AND
@ -629,7 +629,7 @@
$i_sth = $pdo->prepare("INSERT INTO ttrss_user_prefs $i_sth = $pdo->prepare("INSERT INTO ttrss_user_prefs
(owner_uid,pref_name,value, profile) VALUES (owner_uid,pref_name,value, profile) VALUES
(?, ?, ?, ?)"); (?, ?, ?, ?)");
$i_sth->execute([$uid, $line["pref_name"], $line["def_value"], $profile]); $i_sth->execute([$uid, $line["pref_name"], $line["def_value"], $profile]);
} }
} }
@ -741,7 +741,7 @@
$password = ""; $password = "";
$possible = "0123456789abcdfghjkmnpqrstvwxyzABCDFGHJKMNPQRSTVWXYZ"; $possible = "0123456789abcdfghjkmnpqrstvwxyzABCDFGHJKMNPQRSTVWXYZ";
$i = 0; $i = 0;
while ($i < $length) { while ($i < $length) {
$char = substr($possible, mt_rand(0, strlen($possible)-1), 1); $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
@ -761,7 +761,7 @@
function initialize_user($uid) { function initialize_user($uid) {
$pdo = DB::pdo(); $pdo = DB::pdo();
$sth = $pdo->prepare("insert into ttrss_feeds (owner_uid,title,feed_url) $sth = $pdo->prepare("insert into ttrss_feeds (owner_uid,title,feed_url)
values (?, 'Tiny Tiny RSS: Forum', values (?, 'Tiny Tiny RSS: Forum',
@ -796,7 +796,7 @@
} }
function login_sequence() { function login_sequence() {
$pdo = Db::pdo(); $pdo = Db::pdo();
if (SINGLE_USER_MODE) { if (SINGLE_USER_MODE) {
@session_start(); @session_start();
@ -809,7 +809,7 @@
if (!$_SESSION["uid"]) { if (!$_SESSION["uid"]) {
if (AUTH_AUTO_LOGIN && authenticate_user(null, null)) { if (AUTH_AUTO_LOGIN && authenticate_user(null, null)) {
$_SESSION["ref_schema_version"] = get_schema_version(true); $_SESSION["ref_schema_version"] = get_schema_version(true);
} else { } else {
authenticate_user(null, null, true); authenticate_user(null, null, true);
} }
@ -837,18 +837,18 @@
/* cleanup ccache */ /* cleanup ccache */
$sth = $pdo->prepare("DELETE FROM ttrss_counters_cache WHERE owner_uid = ? $sth = $pdo->prepare("DELETE FROM ttrss_counters_cache WHERE owner_uid = ?
AND AND
(SELECT COUNT(id) FROM ttrss_feeds WHERE (SELECT COUNT(id) FROM ttrss_feeds WHERE
ttrss_feeds.id = feed_id) = 0"); ttrss_feeds.id = feed_id) = 0");
$sth->execute([$_SESSION['uid']]); $sth->execute([$_SESSION['uid']]);
$sth = $pdo->prepare("DELETE FROM ttrss_cat_counters_cache WHERE owner_uid = ? $sth = $pdo->prepare("DELETE FROM ttrss_cat_counters_cache WHERE owner_uid = ?
AND AND
(SELECT COUNT(id) FROM ttrss_feed_categories WHERE (SELECT COUNT(id) FROM ttrss_feed_categories WHERE
ttrss_feed_categories.id = feed_id) = 0"); ttrss_feed_categories.id = feed_id) = 0");
$sth->execute([$_SESSION['uid']]); $sth->execute([$_SESSION['uid']]);
} }
} }
@ -1848,14 +1848,14 @@
while ($line = $sth->fetch()) { while ($line = $sth->fetch()) {
$filter_id = $line["id"]; $filter_id = $line["id"];
$match_any_rule = sql_bool_to_bool($line["match_any_rule"]); $match_any_rule = sql_bool_to_bool($line["match_any_rule"]);
$sth2 = $pdo->prepare("SELECT $sth2 = $pdo->prepare("SELECT
r.reg_exp, r.inverse, r.feed_id, r.cat_id, r.cat_filter, r.match_on, t.name AS type_name r.reg_exp, r.inverse, r.feed_id, r.cat_id, r.cat_filter, r.match_on, t.name AS type_name
FROM ttrss_filters2_rules AS r, FROM ttrss_filters2_rules AS r,
ttrss_filter_types AS t ttrss_filter_types AS t
WHERE WHERE
(match_on IS NOT NULL OR (match_on IS NOT NULL OR
(($null_cat_qpart (cat_id IS NULL AND cat_filter = false) OR cat_id IN ($check_cats_str)) AND (($null_cat_qpart (cat_id IS NULL AND cat_filter = false) OR cat_id IN ($check_cats_str)) AND
(feed_id IS NULL OR feed_id = ?))) AND (feed_id IS NULL OR feed_id = ?))) AND
filter_type = t.id AND filter_id = ?"); filter_type = t.id AND filter_id = ?");
@ -1867,54 +1867,54 @@
while ($rule_line = $sth2->fetch()) { while ($rule_line = $sth2->fetch()) {
# print_r($rule_line); # print_r($rule_line);
if ($rule_line["match_on"]) { if ($rule_line["match_on"]) {
$match_on = json_decode($rule_line["match_on"], true); $match_on = json_decode($rule_line["match_on"], true);
if (in_array("0", $match_on) || in_array($feed_id, $match_on) || count(array_intersect($check_cats_fullids, $match_on)) > 0) { if (in_array("0", $match_on) || in_array($feed_id, $match_on) || count(array_intersect($check_cats_fullids, $match_on)) > 0) {
$rule = array(); $rule = array();
$rule["reg_exp"] = $rule_line["reg_exp"]; $rule["reg_exp"] = $rule_line["reg_exp"];
$rule["type"] = $rule_line["type_name"]; $rule["type"] = $rule_line["type_name"];
$rule["inverse"] = sql_bool_to_bool($rule_line["inverse"]); $rule["inverse"] = sql_bool_to_bool($rule_line["inverse"]);
array_push($rules, $rule); array_push($rules, $rule);
} else if (!$match_any_rule) { } else if (!$match_any_rule) {
// this filter contains a rule that doesn't match to this feed/category combination // this filter contains a rule that doesn't match to this feed/category combination
// thus filter has to be rejected // thus filter has to be rejected
$rules = []; $rules = [];
break; break;
} }
} else { } else {
$rule = array(); $rule = array();
$rule["reg_exp"] = $rule_line["reg_exp"]; $rule["reg_exp"] = $rule_line["reg_exp"];
$rule["type"] = $rule_line["type_name"]; $rule["type"] = $rule_line["type_name"];
$rule["inverse"] = sql_bool_to_bool($rule_line["inverse"]); $rule["inverse"] = sql_bool_to_bool($rule_line["inverse"]);
array_push($rules, $rule); array_push($rules, $rule);
} }
} }
if (count($rules) > 0) { if (count($rules) > 0) {
$sth2 = $pdo->prepare("SELECT a.action_param,t.name AS type_name $sth2 = $pdo->prepare("SELECT a.action_param,t.name AS type_name
FROM ttrss_filters2_actions AS a, FROM ttrss_filters2_actions AS a,
ttrss_filter_actions AS t ttrss_filter_actions AS t
WHERE WHERE
action_id = t.id AND filter_id = ?"); action_id = t.id AND filter_id = ?");
$sth2->execute([$filter_id]); $sth2->execute([$filter_id]);
while ($action_line = $sth2->fetch()) { while ($action_line = $sth2->fetch()) {
# print_r($action_line); # print_r($action_line);
$action = array(); $action = array();
$action["type"] = $action_line["type_name"]; $action["type"] = $action_line["type_name"];
$action["param"] = $action_line["action_param"]; $action["param"] = $action_line["action_param"];
array_push($actions, $action); array_push($actions, $action);
} }
} }
$filter = array(); $filter = array();
$filter["match_any_rule"] = sql_bool_to_bool($line["match_any_rule"]); $filter["match_any_rule"] = sql_bool_to_bool($line["match_any_rule"]);
@ -1982,7 +1982,7 @@
return true; return true;
} }
$pdo->commit(); $pdo->commit();
return false; return false;
} }
@ -2167,7 +2167,7 @@
function cleanup_tags($days = 14, $limit = 1000) { function cleanup_tags($days = 14, $limit = 1000) {
$days = (int) $days; $days = (int) $days;
if (DB_TYPE == "pgsql") { if (DB_TYPE == "pgsql") {
$interval_query = "date_updated < NOW() - INTERVAL '$days days'"; $interval_query = "date_updated < NOW() - INTERVAL '$days days'";
@ -2177,9 +2177,9 @@
$tags_deleted = 0; $tags_deleted = 0;
$pdo = Db::pdo(); $pdo = Db::pdo();
while ($limit > 0) { while ($limit > 0) {
$limit_part = 500; $limit_part = 500;
$sth = $pdo->prepare("SELECT ttrss_tags.id AS id $sth = $pdo->prepare("SELECT ttrss_tags.id AS id
@ -2568,6 +2568,6 @@
return $default; return $default;
} }
function arr_qmarks($arr) { function arr_qmarks($arr) {
return str_repeat('?,', count($arr) - 1) . '?'; return str_repeat('?,', count($arr) - 1) . '?';
} }

Loading…
Cancel
Save