summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rwxr-xr-xclasses/api.php25
-rw-r--r--classes/config.php4
-rwxr-xr-xclasses/feeds.php1
-rwxr-xr-xclasses/handler/public.php1
-rwxr-xr-xclasses/rssutils.php22
5 files changed, 41 insertions, 12 deletions
diff --git a/classes/api.php b/classes/api.php
index 262d5c5bc..b282a39ce 100755
--- a/classes/api.php
+++ b/classes/api.php
@@ -1,7 +1,7 @@
<?php
class API extends Handler {
- const API_LEVEL = 18;
+ const API_LEVEL = 20;
const STATUS_OK = 0;
const STATUS_ERR = 1;
@@ -12,6 +12,7 @@ class API extends Handler {
const E_INCORRECT_USAGE = "INCORRECT_USAGE";
const E_UNKNOWN_METHOD = "UNKNOWN_METHOD";
const E_OPERATION_FAILED = "E_OPERATION_FAILED";
+ const E_NOT_FOUND = "E_NOT_FOUND";
/** @var int|null */
private $seq;
@@ -503,9 +504,14 @@ class API extends Handler {
}
function shareToPublished(): bool {
- $title = strip_tags(clean($_REQUEST["title"]));
- $url = strip_tags(clean($_REQUEST["url"]));
- $content = strip_tags(clean($_REQUEST["content"]));
+ $title = clean($_REQUEST["title"]);
+ $url = clean($_REQUEST["url"]);
+ $sanitize_content = self::_param_to_bool($_REQUEST["sanitize"] ?? true);
+
+ if ($sanitize_content)
+ $content = clean($_REQUEST["content"]);
+ else
+ $content = $_REQUEST["content"];
if (Article::_create_published_article($title, $url, $content, "", $_SESSION["uid"])) {
return $this->_wrap(self::STATUS_OK, array("status" => 'OK'));
@@ -912,6 +918,17 @@ class API extends Handler {
array("categories" => $pf->_makefeedtree()));
}
+ function getFeedIcon(): bool {
+ $id = (int)$_REQUEST['id'];
+ $cache = DiskCache::instance('feed-icons');
+
+ if ($cache->exists((string)$id)) {
+ return $cache->send((string)$id) > 0;
+ } else {
+ return $this->_wrap(self::STATUS_ERR, array("error" => self::E_NOT_FOUND));
+ }
+ }
+
// only works for labels or uncategorized for the time being
private function _is_cat_empty(int $id): bool {
if ($id == -2) {
diff --git a/classes/config.php b/classes/config.php
index 9a8b466ab..a865266ca 100644
--- a/classes/config.php
+++ b/classes/config.php
@@ -541,6 +541,10 @@ class Config {
array_push($errors, "PHP support for JSON is required, but was not found.");
}
+ if (!function_exists("flock")) {
+ array_push($errors, "PHP support for flock() function is required.");
+ }
+
if (!class_exists("PDO")) {
array_push($errors, "PHP support for PDO is required but was not found.");
}
diff --git a/classes/feeds.php b/classes/feeds.php
index de2f750cd..b4b20d2fc 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -706,6 +706,7 @@ class Feeds extends Handler_Protected {
<?= javascript_tag("js/common.js") ?>
<?= javascript_tag("lib/dojo/dojo.js") ?>
<?= javascript_tag("lib/dojo/tt-rss-layer.js") ?>
+ <?= Config::get_override_links() ?>
</head>
<body class="flat ttrss_utility feed_debugger css_loading">
<script type="text/javascript">
diff --git a/classes/handler/public.php b/classes/handler/public.php
index c6ec39f36..f89be14bb 100755
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -451,6 +451,7 @@ class Handler_Public extends Handler {
echo javascript_tag("lib/dojo/dojo.js");
echo javascript_tag("lib/dojo/tt-rss-layer.js");
?>
+ <?= Config::get_override_links() ?>
</head>
<body class='flat ttrss_utility'>
<div class='container'>
diff --git a/classes/rssutils.php b/classes/rssutils.php
index df7727eb1..385ab31e6 100755
--- a/classes/rssutils.php
+++ b/classes/rssutils.php
@@ -316,14 +316,20 @@ class RSSUtils {
$feed_data = trim($feed_data);
- $rss = new FeedParser($feed_data);
- $rss->init();
-
- if (!$rss->error()) {
- $basic_info = [
- 'title' => mb_substr(clean($rss->get_title()), 0, 199),
- 'site_url' => mb_substr(UrlHelper::rewrite_relative($feed->feed_url, clean($rss->get_link())), 0, 245),
- ];
+ if ($feed_data) {
+ $rss = new FeedParser($feed_data);
+ $rss->init();
+
+ if (!$rss->error()) {
+ $basic_info = [
+ 'title' => mb_substr(clean($rss->get_title()), 0, 199),
+ 'site_url' => mb_substr(UrlHelper::rewrite_relative($feed->feed_url, clean($rss->get_link())), 0, 245),
+ ];
+ } else {
+ Debug::log(sprintf("unable to parse feed for basic info: %s", $rss->error()), Debug::LOG_VERBOSE);
+ }
+ } else {
+ Debug::log(sprintf("unable to fetch feed for basic info: %s [%s]", UrlHelper::$fetch_last_error, UrlHelper::$fetch_last_error_code), Debug::LOG_VERBOSE);
}
}