diff options
-rwxr-xr-x | classes/api.php | 25 | ||||
-rw-r--r-- | classes/config.php | 4 | ||||
-rwxr-xr-x | classes/feeds.php | 1 | ||||
-rwxr-xr-x | classes/handler/public.php | 1 | ||||
-rwxr-xr-x | classes/rssutils.php | 22 | ||||
-rw-r--r-- | include/colors.php | 3 | ||||
-rw-r--r-- | include/functions.php | 19 | ||||
-rw-r--r-- | js/Article.js | 4 | ||||
-rw-r--r-- | plugins/auth_internal/init.php | 1 | ||||
-rw-r--r-- | plugins/bookmarklets/init.php | 2 | ||||
-rw-r--r-- | plugins/share/init.php | 1 | ||||
-rw-r--r-- | themes/compact.css | 12 | ||||
-rw-r--r-- | themes/compact_night.css | 12 | ||||
-rw-r--r-- | themes/light-high-contrast.css | 12 | ||||
-rw-r--r-- | themes/light.css | 12 | ||||
-rw-r--r-- | themes/light/cdm.less | 7 | ||||
-rw-r--r-- | themes/light/tt-rss.less | 7 | ||||
-rw-r--r-- | themes/night.css | 12 | ||||
-rw-r--r-- | themes/night_blue.css | 12 |
19 files changed, 142 insertions, 27 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); } } diff --git a/include/colors.php b/include/colors.php index 5682b55a1..64e24f8f1 100644 --- a/include/colors.php +++ b/include/colors.php @@ -355,8 +355,9 @@ function colorPalette(string $imageFile, int $numColors, int $granularity = 5): } else { $img = @$ico->images[count($ico->images)-1]->getImageResource(); } + } else { + return null; } - return null; } else if ($size[0] > 0 && $size[1] > 0) { $img = @imagecreatefromstring(file_get_contents($imageFile)); } diff --git a/include/functions.php b/include/functions.php index 0d7f8c756..5096e9c65 100644 --- a/include/functions.php +++ b/include/functions.php @@ -366,21 +366,18 @@ function file_is_locked(string $filename): bool { if (file_exists(Config::get(Config::LOCK_DIRECTORY) . "/$filename")) { - if (function_exists('flock')) { - $fp = @fopen(Config::get(Config::LOCK_DIRECTORY) . "/$filename", "r"); - if ($fp) { - if (flock($fp, LOCK_EX | LOCK_NB)) { - flock($fp, LOCK_UN); - fclose($fp); - return false; - } + $fp = @fopen(Config::get(Config::LOCK_DIRECTORY) . "/$filename", "r"); + if ($fp) { + if (flock($fp, LOCK_EX | LOCK_NB)) { + flock($fp, LOCK_UN); fclose($fp); - return true; - } else { return false; } + fclose($fp); + return true; + } else { + return false; } - return true; // consider the file always locked and skip the test } else { return false; } diff --git a/js/Article.js b/js/Article.js index a3a75ba21..703b634d5 100644 --- a/js/Article.js +++ b/js/Article.js @@ -146,10 +146,8 @@ const Article = { </div>`; }, renderTags: function (id, tags) { - const tags_short = tags.length > 5 ? tags.slice(0, 5) : tags; - return `<span class="tags" title="${tags.join(", ")}" data-tags-for="${id}"> - ${tags_short.length > 0 ? tags_short.map((tag) => ` + ${tags.length > 0 ? tags.map((tag) => ` <a href="#" onclick="Feeds.open({feed: '${tag.trim()}'})" class="tag">${tag}</a>` ).join(", ") : `${__("no tags")}`}</span>`; }, diff --git a/plugins/auth_internal/init.php b/plugins/auth_internal/init.php index 135e4d3ed..f113cd31e 100644 --- a/plugins/auth_internal/init.php +++ b/plugins/auth_internal/init.php @@ -76,6 +76,7 @@ class Auth_Internal extends Auth_Base { }, }; </script> + <?= Config::get_override_links() ?> </head> <body class="flat ttrss_utility otp css_loading"> <h1><?= __("Authentication") ?></h1> diff --git a/plugins/bookmarklets/init.php b/plugins/bookmarklets/init.php index 4a7a35608..f5b3ab1ca 100644 --- a/plugins/bookmarklets/init.php +++ b/plugins/bookmarklets/init.php @@ -56,6 +56,7 @@ class Bookmarklets extends Plugin { display : none; } </style> + <?= Config::get_override_links() ?> </head> <body class='flat ttrss_utility css_loading'> <script type="text/javascript"> @@ -202,6 +203,7 @@ class Bookmarklets extends Plugin { display : none; } </style> + <?= Config::get_override_links() ?> </head> <body class='flat ttrss_utility share_popup css_loading'> <script type="text/javascript"> diff --git a/plugins/share/init.php b/plugins/share/init.php index 62869bfb1..8e25dc677 100644 --- a/plugins/share/init.php +++ b/plugins/share/init.php @@ -195,6 +195,7 @@ class Share extends Plugin { ) ), 500, "...")) ?>"> <meta property='og:image' content="<?= htmlspecialchars($og_image) ?>"> + <?= Config::get_override_links() ?> </head> <body class='flat ttrss_utility ttrss_zoom css_loading'> diff --git a/themes/compact.css b/themes/compact.css index 952187e63..16cf6b5aa 100644 --- a/themes/compact.css +++ b/themes/compact.css @@ -73,6 +73,12 @@ body.ttrss_main .post .header .title { font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif; word-break: break-all; } +body.ttrss_main .post .header .tags { + max-width: 25%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} body.ttrss_main .post div.content { padding: 10px; font-size: 16px; @@ -1293,6 +1299,12 @@ body.ttrss_utility hr { font-size: 11px; font-weight: normal; } +.cdm .header .tags { + max-width: 50%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} .cdm .footer { height: 30px; padding-left: 5px; diff --git a/themes/compact_night.css b/themes/compact_night.css index 7342b5710..8da1cd32a 100644 --- a/themes/compact_night.css +++ b/themes/compact_night.css @@ -73,6 +73,12 @@ body.ttrss_main .post .header .title { font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif; word-break: break-all; } +body.ttrss_main .post .header .tags { + max-width: 25%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} body.ttrss_main .post div.content { padding: 10px; font-size: 16px; @@ -1293,6 +1299,12 @@ body.ttrss_utility hr { font-size: 11px; font-weight: normal; } +.cdm .header .tags { + max-width: 50%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} .cdm .footer { height: 30px; padding-left: 5px; diff --git a/themes/light-high-contrast.css b/themes/light-high-contrast.css index 0d7fcbaa0..ffd952f9f 100644 --- a/themes/light-high-contrast.css +++ b/themes/light-high-contrast.css @@ -73,6 +73,12 @@ body.ttrss_main .post .header .title { font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif; word-break: break-all; } +body.ttrss_main .post .header .tags { + max-width: 25%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} body.ttrss_main .post div.content { padding: 10px; font-size: 16px; @@ -1293,6 +1299,12 @@ body.ttrss_utility hr { font-size: 11px; font-weight: normal; } +.cdm .header .tags { + max-width: 50%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} .cdm .footer { height: 30px; padding-left: 5px; diff --git a/themes/light.css b/themes/light.css index f0218f659..cf2358c50 100644 --- a/themes/light.css +++ b/themes/light.css @@ -73,6 +73,12 @@ body.ttrss_main .post .header .title { font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif; word-break: break-all; } +body.ttrss_main .post .header .tags { + max-width: 25%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} body.ttrss_main .post div.content { padding: 10px; font-size: 16px; @@ -1293,6 +1299,12 @@ body.ttrss_utility hr { font-size: 11px; font-weight: normal; } +.cdm .header .tags { + max-width: 50%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} .cdm .footer { height: 30px; padding-left: 5px; diff --git a/themes/light/cdm.less b/themes/light/cdm.less index 05ba3c99a..bf677decf 100644 --- a/themes/light/cdm.less +++ b/themes/light/cdm.less @@ -79,6 +79,13 @@ font-size : @font-size-small; font-weight : normal; } + + .tags { + max-width : 50%; + overflow : hidden; + white-space : nowrap; + text-overflow : ellipsis; + } } .footer { diff --git a/themes/light/tt-rss.less b/themes/light/tt-rss.less index 1f1242f6b..3896665c8 100644 --- a/themes/light/tt-rss.less +++ b/themes/light/tt-rss.less @@ -56,6 +56,13 @@ body.ttrss_main { font-family : @fonts-ui; word-break : break-all; } + + .tags { + max-width : 25%; + overflow : hidden; + white-space : nowrap; + text-overflow : ellipsis; + } } div.content { diff --git a/themes/night.css b/themes/night.css index 4c6788c2e..b1d0f61ce 100644 --- a/themes/night.css +++ b/themes/night.css @@ -74,6 +74,12 @@ body.ttrss_main .post .header .title { font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif; word-break: break-all; } +body.ttrss_main .post .header .tags { + max-width: 25%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} body.ttrss_main .post div.content { padding: 10px; font-size: 16px; @@ -1294,6 +1300,12 @@ body.ttrss_utility hr { font-size: 11px; font-weight: normal; } +.cdm .header .tags { + max-width: 50%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} .cdm .footer { height: 30px; padding-left: 5px; diff --git a/themes/night_blue.css b/themes/night_blue.css index 90b365473..f77f04efb 100644 --- a/themes/night_blue.css +++ b/themes/night_blue.css @@ -74,6 +74,12 @@ body.ttrss_main .post .header .title { font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif; word-break: break-all; } +body.ttrss_main .post .header .tags { + max-width: 25%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} body.ttrss_main .post div.content { padding: 10px; font-size: 16px; @@ -1294,6 +1300,12 @@ body.ttrss_utility hr { font-size: 11px; font-weight: normal; } +.cdm .header .tags { + max-width: 50%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} .cdm .footer { height: 30px; padding-left: 5px; |