Merge branch 'feature/php8' of wn/tt-rss into master

master
fox 4 years ago committed by Gogs
commit ef7e679363

@ -126,6 +126,7 @@ class Pref_Feeds extends Handler_Protected {
$root['id'] = 'root';
$root['name'] = __('Feeds');
$root['items'] = array();
$root['param'] = 0;
$root['type'] = 'category';
$enable_cats = get_pref('ENABLE_FEED_CATS');
@ -229,7 +230,7 @@ class Pref_Feeds extends Handler_Protected {
$cat['items'] = $this->get_category_items($line['id']);
$num_children = $this->calculate_children_count($cat);
$cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
$cat['param'] = sprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
if ($num_children > 0 || $show_empty_cats)
array_push($root['items'], $cat);
@ -277,13 +278,13 @@ class Pref_Feeds extends Handler_Protected {
array_push($cat['items'], $feed);
}
$cat['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
$cat['param'] = sprintf(_ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
if (count($cat['items']) > 0 || $show_empty_cats)
array_push($root['items'], $cat);
$num_children = $this->calculate_children_count($root);
$root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
$root['param'] = sprintf(_ngettext('(%d feed)', '(%d feeds)', (int) $num_children), $num_children);
} else {
$fsth = $this->pdo->prepare("SELECT id, title, last_error,
@ -312,7 +313,7 @@ class Pref_Feeds extends Handler_Protected {
array_push($root['items'], $feed);
}
$root['param'] = vsprintf(_ngettext('(%d feed)', '(%d feeds)', count($root['items'])), count($root['items']));
$root['param'] = sprintf(_ngettext('(%d feed)', '(%d feeds)', count($root['items'])), count($root['items']));
}
$fl = array();
@ -1208,10 +1209,11 @@ class Pref_Feeds extends Handler_Protected {
}
if ($num_errors > 0) {
$error_button = "<button dojoType=\"dijit.form.Button\"
onclick=\"CommonDialogs.showFeedsWithErrors()\" id=\"errorButton\">" .
__("Feeds with errors") . "</button>";
} else {
$error_button = "";
}
$inactive_button = "<button dojoType=\"dijit.form.Button\"

@ -736,10 +736,8 @@ class Pref_Filters extends Handler_Protected {
}
function index() {
$filter_search = clean($_REQUEST["search"]);
if (array_key_exists("search", $_REQUEST)) {
$filter_search = clean($_REQUEST["search"]);
$_SESSION["prefs_filter_search"] = $filter_search;
} else {
$filter_search = $_SESSION["prefs_filter_search"];
@ -749,12 +747,6 @@ class Pref_Filters extends Handler_Protected {
print "<div style='padding : 0px' dojoType='dijit.layout.ContentPane' region='top'>";
print "<div dojoType='fox.Toolbar'>";
if (array_key_exists("search", $_REQUEST)) {
$_SESSION["prefs_filter_search"] = $filter_search;
} else {
$filter_search = $_SESSION["prefs_filter_search"];
}
print "<div style='float : right; padding-right : 4px;'>
<input dojoType=\"dijit.form.TextBox\" id=\"filter_search\" size=\"20\" type=\"search\"
value=\"$filter_search\">

@ -1271,14 +1271,14 @@ class Pref_Prefs extends Handler_Protected {
}
private function getShortDesc($pref_name) {
if (isset($this->pref_help[$pref_name])) {
if (isset($this->pref_help[$pref_name][0])) {
return $this->pref_help[$pref_name][0];
}
return "";
}
private function getHelpText($pref_name) {
if (isset($this->pref_help[$pref_name])) {
if (isset($this->pref_help[$pref_name][1])) {
return $this->pref_help[$pref_name][1];
}
return "";

@ -1,8 +1,9 @@
<?php
class UrlHelper {
static function build_url($parts) {
$tmp = $parts['scheme'] . "://" . $parts['host'] . $parts['path'];
$tmp = $parts['scheme'] . "://" . $parts['host'];
if (isset($parts['path'])) $tmp .= $parts['path'];
if (isset($parts['query'])) $tmp .= '?' . $parts['query'];
if (isset($parts['fragment'])) $tmp .= '#' . $parts['fragment'];
@ -35,11 +36,13 @@ class UrlHelper {
$rel_parts['host'] = $parts['host'];
$rel_parts['scheme'] = $parts['scheme'];
if (isset($rel_parts['path'])) {
if (strpos($rel_parts['path'], '/') !== 0)
$rel_parts['path'] = '/' . $rel_parts['path'];
$rel_parts['path'] = str_replace("/./", "/", $rel_parts['path']);
$rel_parts['path'] = str_replace("//", "/", $rel_parts['path']);
}
return self::validate(self::build_url($rel_parts));
}

@ -4,6 +4,7 @@
require_once "functions.php";
function get_error_types() {
$ERRORS[0] = "";
$ERRORS[1] = __("This program requires XmlHttpRequest " .
@ -39,13 +40,14 @@
$ERRORS[14] = __("Plugin not found");
$ERRORS[15] = __("Encoding data as JSON failed");
}
if ($_REQUEST['mode'] == 'js') {
header("Content-Type: text/javascript; charset=UTF-8");
print "var ERRORS = [];\n";
foreach ($ERRORS as $id => $error) {
foreach (get_error_types() as $id => $error) {
$error = preg_replace("/\n/", "", $error);
$error = preg_replace("/\"/", "\\\"", $error);

@ -31,7 +31,13 @@ function format_backtrace($trace) {
return $rv;
}
function ttrss_error_handler($errno, $errstr, $file, $line, $context) {
function ttrss_error_handler($errno, $errstr, $file, $line) {
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
if (error_reporting() == 0 || !$errno) return false;
} else {
if (!(error_reporting() & $errno)) return false;
}
if (error_reporting() == 0 || !$errno) return false;
$file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1);

@ -18,7 +18,10 @@
$fetch_effective_url = false;
$fetch_curl_used = false;
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
libxml_disable_entity_loader(true);
}
libxml_use_internal_errors(true);
// separate test because this is included before sanity checks
@ -327,7 +330,7 @@
function sanity_check() {
require_once 'errors.php';
global $ERRORS;
$ERRORS = get_error_types();
$error_code = 0;
$schema_version = get_schema_version(true);
@ -540,7 +543,7 @@
*/
function error_json($code) {
require_once "errors.php";
global $ERRORS;
$ERRORS = get_error_types();
@$message = $ERRORS[$code];

@ -21,6 +21,8 @@
}
function make_self_url_path() {
if (!isset($_SERVER["HTTP_HOST"])) return false;
$proto = is_server_https() ? 'https' : 'http';
$url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
@ -115,14 +117,18 @@
}
$ref_self_url_path = make_self_url_path();
if ($ref_self_url_path) {
$ref_self_url_path = preg_replace("/\w+\.php$/", "", $ref_self_url_path);
}
if (SELF_URL_PATH == "http://example.org/tt-rss/") {
$hint = $ref_self_url_path ? "(possible value: <b>$ref_self_url_path</b>)" : "";
array_push($errors,
"Please set SELF_URL_PATH to the correct value for your server (possible value: <b>$ref_self_url_path</b>)");
"Please set SELF_URL_PATH to the correct value for your server $hint");
}
if (isset($_SERVER["HTTP_HOST"]) &&
if ($ref_self_url_path &&
(!defined('_SKIP_SELF_URL_PATH_CHECKS') || !_SKIP_SELF_URL_PATH_CHECKS) &&
SELF_URL_PATH != $ref_self_url_path && SELF_URL_PATH != mb_substr($ref_self_url_path, 0, mb_strlen($ref_self_url_path)-1)) {
array_push($errors,

@ -167,7 +167,7 @@ function _check_locale_and_function($function=false) {
function _get_codeset($domain=null) {
global $text_domains, $default_domain, $LC_CATEGORIES;
if (!isset($domain)) $domain = $default_domain;
return (isset($text_domains[$domain]->codeset))? $text_domains[$domain]->codeset : ini_get('mbstring.internal_encoding');
return (isset($text_domains[$domain]->codeset))? $text_domains[$domain]->codeset : ini_get('default_charset');
}
/**

@ -506,7 +506,7 @@ class Af_RedditImgur extends Plugin {
}
}
private function get_header($url, $useragent = SELF_USER_AGENT, $header) {
private function get_header($url, $header, $useragent = SELF_USER_AGENT) {
$ret = false;
if (function_exists("curl_init") && !defined("NO_CURL")) {
@ -526,11 +526,11 @@ class Af_RedditImgur extends Plugin {
}
private function get_content_type($url, $useragent = SELF_USER_AGENT) {
return $this->get_header($url, $useragent, CURLINFO_CONTENT_TYPE);
return $this->get_header($url, CURLINFO_CONTENT_TYPE, $useragent);
}
private function get_location($url, $useragent = SELF_USER_AGENT) {
return $this->get_header($url, $useragent, CURLINFO_EFFECTIVE_URL);
return $this->get_header($url, CURLINFO_EFFECTIVE_URL, $useragent);
}
/**

@ -239,7 +239,7 @@
RSSUtils::update_daemon_common(DAEMON_FEED_LIMIT, $options);
RSSUtils::housekeeping_common();
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op);
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $options);
}
if (isset($options["daemon"])) {

Loading…
Cancel
Save