Commit 7f4a4045 authored by Andrew Dolgov's avatar Andrew Dolgov

include: convert some spaces to tabs

parent 2aec1b03
......@@ -18,8 +18,8 @@ class RSSUtils {
// Strips utf8mb4 characters (i.e. emoji) for mysql
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() {
......@@ -422,15 +422,15 @@ class RSSUtils {
_debug("not using CURL due to open_basedir restrictions");
}
if (time() - strtotime($last_unconditional) > MAX_CONDITIONAL_INTERVAL) {
_debug("maximum allowed interval for conditional requests exceeded, forcing refetch");
if (time() - strtotime($last_unconditional) > MAX_CONDITIONAL_INTERVAL) {
_debug("maximum allowed interval for conditional requests exceeded, forcing refetch");
$force_refetch = true;
} else {
_debug("stored last modified for conditional request: $stored_last_modified", $debug_enabled);
}
$force_refetch = true;
} else {
_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([
"url" => $fetch_url,
......@@ -572,8 +572,8 @@ class RSSUtils {
$filters = load_filters($feed, $owner_uid);
if ($debug_enabled) {
print_r($filters);
}
print_r($filters);
}
_debug("" . count($filters) . " filters loaded.", $debug_enabled);
......@@ -1050,14 +1050,14 @@ class RSSUtils {
// Yet another episode of "mysql utf8_general_ci is gimped"
if (DB_TYPE == "mysql") {
for ($i = 0; $i < count($e_item); $i++) {
if (is_string($e_item[$i])) {
$e_item[$i] = RSSUtils::strip_utf8mb4($e_item[$i]);
}
}
for ($i = 0; $i < count($e_item); $i++) {
if (is_string($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 = [],
$attributes = "", $include_all_feeds = true,
$root_id = null, $nest_level = 0) {
$attributes = "", $include_all_feeds = true,
$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) {
print "<select multiple=\true\" id=\"$id\" name=\"$id\" $attributes>";
if ($include_all_feeds) {
$is_selected = (in_array("0", $default_ids)) ? "selected=\"1\"" : "";
print "<option $is_selected value=\"0\">".__('All feeds')."</option>";
}
}
if (!$root_id) {
print "<select multiple=\true\" id=\"$id\" name=\"$id\" $attributes>";
if ($include_all_feeds) {
$is_selected = (in_array("0", $default_ids)) ? "selected=\"1\"" : "";
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
c2.parent_cat = ttrss_feed_categories.id) AS num_children
FROM ttrss_feed_categories
WHERE owner_uid = :uid AND
(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++)
$line["title"] = " - " . $line["title"];
for ($i = 0; $i < $nest_level; $i++)
$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>",
$line["id"], htmlspecialchars($line["title"]));
printf("<option $is_selected value='CAT:%d'>%s</option>",
$line["id"], htmlspecialchars($line["title"]));
if ($line["num_children"] > 0)
print_feed_multi_select($id, $default_ids, $attributes,
$include_all_feeds, $line["id"], $nest_level+1);
if ($line["num_children"] > 0)
print_feed_multi_select($id, $default_ids, $attributes,
$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");
$f_sth->execute([$line['id'], $_SESSION['uid']]);
$f_sth->execute([$line['id'], $_SESSION['uid']]);
while ($fline = $f_sth->fetch()) {
$is_selected = (in_array($fline["id"], $default_ids)) ? "selected=\"1\"" : "";
while ($fline = $f_sth->fetch()) {
$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++)
$fline["title"] = " - " . $fline["title"];
for ($i = 0; $i < $nest_level; $i++)
$fline["title"] = " - " . $fline["title"];
printf("<option $is_selected value='%d'>%s</option>",
$fline["id"], htmlspecialchars($fline["title"]));
}
}
printf("<option $is_selected value='%d'>%s</option>",
$fline["id"], htmlspecialchars($fline["title"]));
}
}
if (!$root_id) {
$is_selected = in_array("CAT:0", $default_ids) ? "selected=\"1\"" : "";
if (!$root_id) {
$is_selected = in_array("CAT:0", $default_ids) ? "selected=\"1\"" : "";
printf("<option $is_selected value='CAT:0'>%s</option>",
__("Uncategorized"));
printf("<option $is_selected value='CAT:0'>%s</option>",
__("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");
$f_sth->execute([$_SESSION['uid']]);
$f_sth->execute([$_SESSION['uid']]);
while ($fline = $f_sth->fetch()) {
$is_selected = in_array($fline["id"], $default_ids) ? "selected=\"1\"" : "";
while ($fline = $f_sth->fetch()) {
$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++)
$fline["title"] = " - " . $fline["title"];
for ($i = 0; $i < $nest_level; $i++)
$fline["title"] = " - " . $fline["title"];
printf("<option $is_selected value='%d'>%s</option>",
$fline["id"], htmlspecialchars($fline["title"]));
}
}
printf("<option $is_selected value='%d'>%s</option>",
$fline["id"], htmlspecialchars($fline["title"]));
}
}
} else {
$sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
} else {
$sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds
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>",
$line["id"], htmlspecialchars($line["title"]));
}
}
printf("<option $is_selected value='%d'>%s</option>",
$line["id"], htmlspecialchars($line["title"]));
}
}
if (!$root_id) {
print "</select>";
}
if (!$root_id) {
print "</select>";
}
}
function print_feed_cat_select($id, $default_id,
......@@ -195,7 +195,7 @@ function print_feed_cat_select($id, $default_id,
$found = 0;
while ($line = $sth->fetch()) {
++$found;
++$found;
if ($line["id"] == $default_id) {
$is_selected = "selected=\"1\"";
......@@ -315,7 +315,7 @@ function format_inline_player($url, $ctype) {
function print_label_select($name, $value, $attributes = "") {
$pdo = Db::pdo();
$pdo = Db::pdo();
$sth = $pdo->prepare("SELECT caption FROM ttrss_labels2
WHERE owner_uid = ? ORDER BY caption");
......@@ -338,4 +338,4 @@ function print_label_select($name, $value, $attributes = "") {
print "</select>";
}
\ No newline at end of file
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment