diff options
Diffstat (limited to 'include/functions.php')
-rw-r--r-- | include/functions.php | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/include/functions.php b/include/functions.php index 537139d18..3e37d1d28 100644 --- a/include/functions.php +++ b/include/functions.php @@ -66,11 +66,12 @@ define_default('MAX_CONDITIONAL_INTERVAL', 3600*12); // max interval between forced unconditional updates for servers // not complying with http if-modified-since (seconds) - define_default('MAX_FETCH_REQUESTS_PER_HOST', 25); + // define_default('MAX_FETCH_REQUESTS_PER_HOST', 25); // a maximum amount of allowed HTTP requests per destination host // during a single update (i.e. within PHP process lifetime) // this is used to not cause excessive load on the origin server on // e.g. feed subscription when all articles are being processes + // (not implemented) /* tunables end here */ @@ -243,10 +244,10 @@ $url_host = parse_url($url, PHP_URL_HOST); $fetch_domain_hits[$url_host] += 1; - if ($fetch_domain_hits[$url_host] > MAX_FETCH_REQUESTS_PER_HOST) { + /*if ($fetch_domain_hits[$url_host] > MAX_FETCH_REQUESTS_PER_HOST) { user_error("Exceeded fetch request quota for $url_host: " . $fetch_domain_hits[$url_host], E_USER_WARNING); #return false; - } + }*/ if (!defined('NO_CURL') && function_exists('curl_init') && !ini_get("open_basedir")) { @@ -730,24 +731,7 @@ if ($_SESSION["uid"]) { startup_gettext(); load_user_plugins($_SESSION["uid"]); - - /* cleanup ccache */ - - $sth = $pdo->prepare("DELETE FROM ttrss_counters_cache WHERE owner_uid = ? - AND - (SELECT COUNT(id) FROM ttrss_feeds WHERE - ttrss_feeds.id = feed_id) = 0"); - - $sth->execute([$_SESSION['uid']]); - - $sth = $pdo->prepare("DELETE FROM ttrss_cat_counters_cache WHERE owner_uid = ? - AND - (SELECT COUNT(id) FROM ttrss_feed_categories WHERE - ttrss_feed_categories.id = feed_id) = 0"); - - $sth->execute([$_SESSION['uid']]); } - } } @@ -1069,7 +1053,7 @@ "close_article" => __("Close/collapse article"), "toggle_expand" => __("Toggle article expansion (combined mode)"), "toggle_widescreen" => __("Toggle widescreen mode"), - "toggle_embed_original" => __("Toggle embed original")), + "toggle_full_text" => __("Toggle full article text via Readability")), __("Article selection") => array( "select_all" => __("Select all articles"), "select_unread" => __("Select unread"), @@ -1140,7 +1124,7 @@ "N" => "article_scroll_down", "P" => "article_scroll_up", "a W" => "toggle_widescreen", - "a e" => "toggle_embed_original", + "a e" => "toggle_full_text", "e" => "email_article", "a q" => "close_article", "a a" => "select_all", @@ -1298,6 +1282,7 @@ if ($entry->nodeName == 'img') { $entry->setAttribute('referrerpolicy', 'no-referrer'); + $entry->setAttribute('loading', 'lazy'); $entry->removeAttribute('width'); $entry->removeAttribute('height'); @@ -1768,9 +1753,6 @@ } function get_theme_path($theme) { - if ($theme == "default.php") - return "css/default.css"; - $check = "themes/$theme"; if (file_exists($check)) return $check; @@ -1889,12 +1871,13 @@ directory, its contents are displayed instead of git commit-based version, this could be generated based on source git tree commit used when creating the package */ - function get_version(&$git_commit = false, &$git_timestamp = false) { + function get_version(&$git_commit = false, &$git_timestamp = false, &$last_error = false) { global $ttrss_version; if (is_array($ttrss_version) && isset($ttrss_version['version'])) { $git_commit = $ttrss_version['commit']; $git_timestamp = $ttrss_version['timestamp']; + $last_error = $ttrss_version['last_error']; return $ttrss_version['version']; } else { @@ -1919,13 +1902,13 @@ $cwd = getcwd(); chdir($root_dir); - exec('git log --pretty='.escapeshellarg('%ct %h').' -n1 HEAD 2>&1', $output, $rc); + exec('git --no-pager log --pretty='.escapeshellarg('version: %ct %h').' -n1 HEAD 2>&1', $output, $rc); chdir($cwd); - if ($rc == 0) { - if (is_array($output) && count($output) > 0) { - list ($timestamp, $commit) = explode(" ", $output[0], 2); + if (is_array($output) && count($output) > 0) { + list ($test, $timestamp, $commit) = explode(" ", $output[0], 3); + if ($test == "version:") { $git_commit = $commit; $git_timestamp = $timestamp; @@ -1933,8 +1916,14 @@ $ttrss_version['commit'] = $commit; $ttrss_version['timestamp'] = $timestamp; } - } else { - user_error("Unable to determine version (using $root_dir): " . implode("\n", $output), E_USER_WARNING); + } + + if (!isset($ttrss_version['commit'])) { + $last_error = "Unable to determine version (using $root_dir): RC=$rc; OUTPUT=" . implode("\n", $output); + + $ttrss_version["last_error"] = $last_error; + + user_error($last_error, E_USER_WARNING); } } |