diff options
128 files changed, 10647 insertions, 7894 deletions
diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..6d76f6082 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,300 @@ +module.exports = { + "env": { + "browser": true, + "es6": true, + "jquery": true, + "webextensions": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": 2017 + }, + "rules": { + "accessor-pairs": "error", + "array-bracket-newline": "off", + "array-bracket-spacing": "off", + "array-callback-return": "error", + "array-element-newline": "off", + "arrow-body-style": "error", + "arrow-parens": "error", + "arrow-spacing": "error", + "block-scoped-var": "off", + "block-spacing": [ + "error", + "always" + ], + "brace-style": "off", + "callback-return": "off", + "camelcase": "off", + "capitalized-comments": "off", + "class-methods-use-this": "error", + "comma-dangle": "off", + "comma-spacing": "off", + "comma-style": [ + "error", + "last" + ], + "complexity": "off", + "computed-property-spacing": [ + "error", + "never" + ], + "consistent-return": "off", + "consistent-this": "off", + "curly": "off", + "default-case": "off", + "dot-location": "off", + "dot-notation": "off", + "eol-last": "error", + "eqeqeq": "off", + "func-call-spacing": "error", + "func-name-matching": "error", + "func-names": "off", + "func-style": "off", + "function-paren-newline": "off", + "generator-star-spacing": "error", + "global-require": "error", + "guard-for-in": "off", + "handle-callback-err": "off", + "id-blacklist": "error", + "id-length": "off", + "id-match": "error", + "implicit-arrow-linebreak": "off", + "indent": "off", + "indent-legacy": "off", + "init-declarations": "off", + "jsx-quotes": "error", + "key-spacing": "off", + "keyword-spacing": [ + "error", + { + "after": true, + "before": true + } + ], + "line-comment-position": "off", + "linebreak-style": [ + "error", + "unix" + ], + "lines-around-comment": "off", + "lines-around-directive": "error", + "lines-between-class-members": "error", + "max-classes-per-file": "off", + "max-depth": "off", + "max-len": "off", + "max-lines": "off", + "max-lines-per-function": "off", + "max-nested-callbacks": "error", + "max-params": "off", + "max-statements": "off", + "max-statements-per-line": [ "warn", { "max" : 2 } ], + "multiline-comment-style": "off", + "multiline-ternary": "off", + "new-cap": "warn", + "new-parens": "error", + "newline-after-var": "off", + "newline-before-return": "off", + "newline-per-chained-call": "off", + "no-alert": "off", + "no-array-constructor": "error", + "no-async-promise-executor": "off", + "no-await-in-loop": "warn", + "no-bitwise": "off", + "no-buffer-constructor": "error", + "no-caller": "error", + "no-catch-shadow": "off", + "no-confusing-arrow": "error", + "no-continue": "off", + "no-console": "off", + "no-div-regex": "error", + "no-duplicate-imports": "error", + "no-else-return": "off", + "no-empty": [ + "error", + { + "allowEmptyCatch": true + } + ], + "no-empty-function": "error", + "no-eq-null": "off", + "no-eval": "error", + "no-extend-native": "off", + "no-extra-bind": "error", + "no-extra-label": "error", + "no-extra-parens": "off", + "no-floating-decimal": "error", + "no-implicit-globals": "off", + "no-implied-eval": "off", + "no-inline-comments": "off", + "no-inner-declarations": [ + "error", + "functions" + ], + "no-invalid-this": "error", + "no-iterator": "error", + "no-label-var": "error", + "no-labels": "error", + "no-lone-blocks": "error", + "no-lonely-if": "error", + "no-loop-func": "off", + "no-magic-numbers": "off", + "no-misleading-character-class": "off", + "no-mixed-operators": "off", + "no-mixed-requires": "error", + "no-multi-assign": "error", + "no-multi-spaces": "off", + "no-multi-str": "error", + "no-multiple-empty-lines": "error", + "no-native-reassign": "error", + "no-negated-condition": "off", + "no-negated-in-lhs": "error", + "no-nested-ternary": "error", + "no-new": "warn", + "no-new-func": "error", + "no-new-object": "off", + "no-new-require": "error", + "no-new-wrappers": "error", + "no-octal-escape": "error", + "no-param-reassign": "off", + "no-path-concat": "error", + "no-plusplus": "off", + "no-process-env": "error", + "no-process-exit": "error", + "no-proto": "error", + "no-prototype-builtins": "warn", + "no-restricted-globals": "error", + "no-restricted-imports": "error", + "no-restricted-modules": "error", + "no-restricted-properties": "error", + "no-restricted-syntax": "error", + "no-return-assign": [ + "error", + "except-parens" + ], + "no-return-await": "error", + "no-script-url": "error", + "no-self-compare": "error", + "no-sequences": "error", + "no-shadow": "off", + "no-shadow-restricted-names": "error", + "no-spaced-func": "error", + "no-sync": "error", + "no-tabs": "off", + "no-template-curly-in-string": "error", + "no-ternary": "off", + "no-throw-literal": "error", + "no-trailing-spaces": "error", + "no-undef-init": "error", + "no-undefined": "off", + "no-undef": "warn", + "no-underscore-dangle": "off", + "no-unmodified-loop-condition": "error", + "no-unneeded-ternary": [ + "error", + { + "defaultAssignment": true + } + ], + "no-unused-expressions": "off", + "no-unused-vars": "warn", + "no-use-before-define": "off", + "no-useless-call": "error", + "no-useless-computed-key": "error", + "no-useless-concat": "error", + "no-useless-constructor": "error", + "no-useless-rename": "error", + "no-useless-return": "off", + "no-var": "warn", + "no-void": "error", + "no-warning-comments": "off", + "no-whitespace-before-property": "error", + "no-with": "error", + "nonblock-statement-body-position": [ + "error", + "any" + ], + "object-curly-newline": "off", + "object-curly-spacing": "off", + "object-property-newline": "off", + "object-shorthand": "off", + "one-var": "off", + "one-var-declaration-per-line": "error", + "operator-assignment": "off", + "operator-linebreak": [ + "error", + "after" + ], + "padded-blocks": "off", + "padding-line-between-statements": "error", + "prefer-arrow-callback": "off", + "prefer-const": "error", + "prefer-destructuring": "off", + "prefer-numeric-literals": "error", + "prefer-object-spread": "off", + "prefer-promise-reject-errors": "error", + "prefer-reflect": "off", + "prefer-rest-params": "error", + "prefer-spread": "error", + "prefer-template": "off", + "quote-props": "off", + "quotes": "off", + "radix": [ + "error", + "as-needed" + ], + "require-atomic-updates": "off", + "require-await": "warn", + "require-jsdoc": "off", + "require-unicode-regexp": "off", + "rest-spread-spacing": "error", + "semi": "off", + "semi-spacing": [ + "error", + { + "after": true, + "before": false + } + ], + "semi-style": [ + "error", + "last" + ], + "sort-imports": "error", + "sort-keys": "off", + "sort-vars": "off", + "space-before-blocks": "off", + "space-before-function-paren": "off", + "space-in-parens": "off", + "space-infix-ops": "off", + "space-unary-ops": [ + "error", + { + "nonwords": false, + "words": false + } + ], + "spaced-comment": "off", + "strict": [ + "off", + "never" + ], + "switch-colon-spacing": "error", + "symbol-description": "error", + "template-curly-spacing": "error", + "template-tag-spacing": "error", + "unicode-bom": [ + "error", + "never" + ], + "valid-jsdoc": "error", + "vars-on-top": "off", + "wrap-iife": "error", + "wrap-regex": "error", + "yield-star-spacing": "error", + "yoda": [ + "error", + "never" + ] + } +}; diff --git a/.gitignore b/.gitignore index 3f98b7a42..3796eeb8c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ Thumbs.db /deploy.exclude /deploy.sh /messages.mo +/node_modules +/package-lock.json *~ *.DS_Store #* diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..006e87850 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,11 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "gulp", + "task": "default", + "problemMatcher": [], + "label": "gulp: default" + } + ] +}
\ No newline at end of file diff --git a/api/index.php b/api/index.php index 363f2ae13..8e85919c6 100644 --- a/api/index.php +++ b/api/index.php @@ -67,7 +67,7 @@ return; } - load_user_plugins( $_SESSION["uid"]); + UserHelper::load_user_plugins( $_SESSION["uid"]); } $method = strtolower($_REQUEST["op"]); diff --git a/atom-to-html.xsl b/atom-to-html.xsl deleted file mode 100644 index 79ce42891..000000000 --- a/atom-to-html.xsl +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet - xmlns:atom="http://www.w3.org/2005/Atom" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> - -<xsl:output method="html"/> - -<xsl:template match="/atom:feed"> -<html> - <head> - <title><xsl:value-of select="atom:title"/></title> - <link rel="stylesheet" type="text/css" href="themes/light.css"/> - <script language="javascript" src="lib/xsl_mop-up.js"></script> - </head> - - <body onload="go_decoding()" class="ttrss_utility"> - - <div id="cometestme" style="display:none;"> - <xsl:text disable-output-escaping="yes">&amp;</xsl:text> - </div> - - <div class="rss"> - - <h1><xsl:value-of select="atom:title"/></h1> - - <p class="description">This feed has been exported from - <a target="_new" class="extlink" href="http://tt-rss.org">Tiny Tiny RSS</a>. - It contains the following items:</p> - - <xsl:for-each select="atom:entry"> - <h2><a target="_new" href="{atom:link/@href}"><xsl:value-of select="atom:title"/></a></h2> - - <div name="decodeme" class="content"> - <xsl:value-of select="atom:content" disable-output-escaping="yes"/> - </div> - - <xsl:if test="enclosure"> - <p><a href="{enclosure/@url}">Extra...</a></p> - </xsl:if> - - - </xsl:for-each> - - </div> - - </body> - </html> -</xsl:template> - -</xsl:stylesheet> - diff --git a/backend.php b/backend.php index e65ce1b94..4c93f9b6d 100644 --- a/backend.php +++ b/backend.php @@ -12,15 +12,14 @@ /* Public calls compatibility shim */ - $public_calls = array("globalUpdateFeeds", "rss", "getUnread", "getProfiles", "share", - "fbexport", "logout", "pubsub"); + $public_calls = array("globalUpdateFeeds", "rss", "getUnread", "getProfiles", "share"); if (array_search($op, $public_calls) !== false) { header("Location: public.php?" . $_SERVER['QUERY_STRING']); return; } - @$csrf_token = $_REQUEST['csrf_token']; + @$csrf_token = $_POST['csrf_token']; require_once "autoload.php"; require_once "sessions.php"; @@ -42,7 +41,7 @@ } if (SINGLE_USER_MODE) { - authenticate_user( "admin", null); + UserHelper::authenticate( "admin", null); } if ($_SESSION["uid"]) { @@ -51,7 +50,7 @@ print error_json(6); return; } - load_user_plugins( $_SESSION["uid"]); + UserHelper::load_user_plugins($_SESSION["uid"]); } $purge_intervals = array( @@ -108,7 +107,14 @@ if (validate_csrf($csrf_token) || $handler->csrf_ignore($method)) { if ($handler->before($method)) { if ($method && method_exists($handler, $method)) { - $handler->$method(); + $reflection = new ReflectionMethod($handler, $method); + + if ($reflection->getNumberOfRequiredParameters() == 0) { + $handler->$method(); + } else { + header("Content-Type: text/json"); + print error_json(6); + } } else { if (method_exists($handler, "catchall")) { $handler->catchall($method); diff --git a/classes/api.php b/classes/api.php index 339e9eef1..ce046e66a 100755 --- a/classes/api.php +++ b/classes/api.php @@ -74,10 +74,10 @@ class API extends Handler { } if (get_pref("ENABLE_API_ACCESS", $uid)) { - if (authenticate_user($login, $password, false, Auth_Base::AUTH_SERVICE_API)) { // try login with normal password + if (UserHelper::authenticate($login, $password, false, Auth_Base::AUTH_SERVICE_API)) { // try login with normal password $this->wrap(self::STATUS_OK, array("session_id" => session_id(), "api_level" => self::API_LEVEL)); - } else if (authenticate_user($login, $password_base64, false, Auth_Base::AUTH_SERVICE_API)) { // else try with base64_decoded password + } else if (UserHelper::authenticate($login, $password_base64, false, Auth_Base::AUTH_SERVICE_API)) { // else try with base64_decoded password $this->wrap(self::STATUS_OK, array("session_id" => session_id(), "api_level" => self::API_LEVEL)); } else { // else we are not logged in @@ -91,7 +91,7 @@ class API extends Handler { } function logout() { - logout_user(); + Pref_Users::logout_user(); $this->wrap(self::STATUS_OK, array("status" => "OK")); } @@ -160,9 +160,9 @@ class API extends Handler { $unread += Feeds::getCategoryChildrenUnread($line["id"]); if ($unread || !$unread_only) { - array_push($cats, array("id" => $line["id"], + array_push($cats, array("id" => (int) $line["id"], "title" => $line["title"], - "unread" => $unread, + "unread" => (int) $unread, "order_id" => (int) $line["order_id"], )); } @@ -174,9 +174,9 @@ class API extends Handler { $unread = getFeedUnread($cat_id, true); if ($unread || !$unread_only) { - array_push($cats, array("id" => $cat_id, + array_push($cats, array("id" => (int) $cat_id, "title" => Feeds::getCategoryTitle($cat_id), - "unread" => $unread)); + "unread" => (int) $unread)); } } } @@ -214,21 +214,7 @@ class API extends Handler { $_SESSION['hasSandbox'] = $has_sandbox; - $skip_first_id_check = false; - - $override_order = false; - switch (clean($_REQUEST["order_by"])) { - case "title": - $override_order = "ttrss_entries.title, date_entered, updated"; - break; - case "date_reverse": - $override_order = "score DESC, date_entered, updated"; - $skip_first_id_check = true; - break; - case "feed_dates": - $override_order = "updated DESC"; - break; - } + list($override_order, $skip_first_id_check) = Feeds::order_to_override_query(clean($_REQUEST["order_by"])); /* do not rely on params below */ @@ -357,7 +343,7 @@ class API extends Handler { ); if ($sanitize_content) { - $article["content"] = sanitize( + $article["content"] = Sanitizer::sanitize( $line["content"], API::param_to_bool($line['hide_images']), false, $line["site_url"], false, $line["id"]); @@ -762,7 +748,7 @@ class API extends Handler { if ($show_content) { if ($sanitize_content) { - $headline_row["content"] = sanitize( + $headline_row["content"] = Sanitizer::sanitize( $line["content"], API::param_to_bool($line['hide_images']), false, $line["site_url"], false, $line["id"]); diff --git a/classes/article.php b/classes/article.php index 74dbdae53..c94b69615 100755 --- a/classes/article.php +++ b/classes/article.php @@ -1,12 +1,6 @@ <?php class Article extends Handler_Protected { - function csrf_ignore($method) { - $csrf_ignored = array("redirect", "editarticletags"); - - return array_search($method, $csrf_ignored) !== false; - } - function redirect() { $id = clean($_REQUEST['id']); @@ -60,7 +54,7 @@ class Article extends Handler_Protected { if (!$title) $title = $url; if (!$title && !$url) return false; - if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) return false; + if (filter_var($url, FILTER_VALIDATE_URL) === false) return false; $pdo = Db::pdo(); @@ -94,7 +88,7 @@ class Article extends Handler_Protected { ":id" => $ref_id]; $sth->execute($params); } - + $sth = $pdo->prepare("UPDATE ttrss_user_entries SET published = true, last_published = NOW() WHERE int_id = ? AND owner_uid = ?"); @@ -393,7 +387,7 @@ class Article extends Handler_Protected { # $entry .= " <a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\" rel=\"noopener noreferrer\">" . # $filename . " (" . $ctype . ")" . "</a>"; - $entry = "<div onclick=\"popupOpenUrl('".htmlspecialchars($url)."')\" + $entry = "<div onclick=\"Article.popupOpenUrl('".htmlspecialchars($url)."')\" dojoType=\"dijit.MenuItem\">$filename ($ctype)</div>"; array_push($entries_html, $entry); @@ -473,7 +467,7 @@ class Article extends Handler_Protected { else $filename = ""; - $rv .= "<div onclick='popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")' + $rv .= "<div onclick='Article.popupOpenUrl(\"".htmlspecialchars($entry["url"])."\")' dojoType=\"dijit.MenuItem\">".$filename . $title."</div>"; }; @@ -583,7 +577,7 @@ class Article extends Handler_Protected { return "<div class='article-note $note_class'> <i class='material-icons'>note</i> - <div $onclick class='body'>$note</div> + <div $onclick class='body'>$note</div> </div>"; return $str; @@ -658,7 +652,7 @@ class Article extends Handler_Protected { } static function getLastArticleId() { - $pdo = DB::pdo(); + $pdo = Db::pdo(); $sth = $pdo->prepare("SELECT ref_id AS id FROM ttrss_user_entries WHERE owner_uid = ? ORDER BY ref_id DESC LIMIT 1"); @@ -763,7 +757,7 @@ class Article extends Handler_Protected { if (!$article_image) foreach ($enclosures as $enc) { - if (strpos($enc["content_type"], "image/") !== FALSE) { + if (strpos($enc["content_type"], "image/") !== false) { $article_image = $enc["content_url"]; break; } diff --git a/classes/backend.php b/classes/backend.php index 122e28c65..16c20660a 100644 --- a/classes/backend.php +++ b/classes/backend.php @@ -1,12 +1,6 @@ <?php -class Backend extends Handler { - function loading() { - header("Content-type: text/html"); - print __("Loading, please wait...") . " " . - "<img src='images/indicator_tiny.gif'>"; - } - - function digestTest() { +class Backend extends Handler_Protected { + /* function digestTest() { if (isset($_SESSION['uid'])) { header("Content-type: text/html"); @@ -19,80 +13,14 @@ class Backend extends Handler { } else { print error_json(6); } - } - - private function display_main_help() { - $info = get_hotkeys_info(); - $imap = get_hotkeys_map(); - $omap = array(); - - foreach ($imap[1] as $sequence => $action) { - if (!isset($omap[$action])) $omap[$action] = array(); - - array_push($omap[$action], $sequence); - } - - print "<ul class='panel panel-scrollable hotkeys-help' style='height : 300px'>"; - - print "<h2>" . __("Keyboard Shortcuts") . "</h2>"; - - foreach ($info as $section => $hotkeys) { - - print "<li><hr></li>"; - print "<li><h3>" . $section . "</h3></li>"; - - foreach ($hotkeys as $action => $description) { - - if (is_array($omap[$action])) { - foreach ($omap[$action] as $sequence) { - if (strpos($sequence, "|") !== FALSE) { - $sequence = substr($sequence, - strpos($sequence, "|")+1, - strlen($sequence)); - } else { - $keys = explode(" ", $sequence); - - for ($i = 0; $i < count($keys); $i++) { - if (strlen($keys[$i]) > 1) { - $tmp = ''; - foreach (str_split($keys[$i]) as $c) { - switch ($c) { - case '*': - $tmp .= __('Shift') . '+'; - break; - case '^': - $tmp .= __('Ctrl') . '+'; - break; - default: - $tmp .= $c; - } - } - $keys[$i] = $tmp; - } - } - $sequence = join(" ", $keys); - } - - print "<li>"; - print "<div class='hk'><code>$sequence</code></div>"; - print "<div class='desc'>$description</div>"; - print "</li>"; - } - } - } - } - - print "</ul>"; - - - } + } */ function help() { - $topic = clean_filename($_REQUEST["topic"]); // only one for now + $topic = basename(clean($_REQUEST["topic"])); // only one for now if ($topic == "main") { - $info = get_hotkeys_info(); - $imap = get_hotkeys_map(); + $info = RPC::get_hotkeys_info(); + $imap = RPC::get_hotkeys_map(); $omap = array(); foreach ($imap[1] as $sequence => $action) { @@ -114,7 +42,7 @@ class Backend extends Handler { if (is_array($omap[$action])) { foreach ($omap[$action] as $sequence) { - if (strpos($sequence, "|") !== FALSE) { + if (strpos($sequence, "|") !== false) { $sequence = substr($sequence, strpos($sequence, "|")+1, strlen($sequence)); diff --git a/classes/counters.php b/classes/counters.php index d8ed27621..4518fa9d2 100644 --- a/classes/counters.php +++ b/classes/counters.php @@ -42,7 +42,7 @@ class Counters { array_push($ret, $cv); - $pdo = DB::pdo(); + $pdo = Db::pdo(); $sth = $pdo->prepare("SELECT fc.id, SUM(CASE WHEN unread THEN 1 ELSE 0 END) AS count, @@ -234,8 +234,8 @@ class Counters { COUNT(u1.unread) AS total FROM ttrss_labels2 LEFT JOIN ttrss_user_labels2 ON (ttrss_labels2.id = label_id) - LEFT JOIN ttrss_user_entries AS u1 ON u1.ref_id = article_id - WHERE ttrss_labels2.owner_uid = :uid AND u1.owner_uid = :uid + LEFT JOIN ttrss_user_entries AS u1 ON u1.ref_id = article_id AND u1.owner_uid = :uid + WHERE ttrss_labels2.owner_uid = :uid GROUP BY ttrss_labels2.id, ttrss_labels2.caption"); $sth->execute([":uid" => $_SESSION['uid']]); diff --git a/classes/db.php b/classes/db.php index ac493f6d6..70b97d0ee 100755 --- a/classes/db.php +++ b/classes/db.php @@ -113,4 +113,13 @@ class Db return self::$instance->pdo; } + + public static function sql_random_function() { + if (DB_TYPE == "mysql") { + return "RAND()"; + } else { + return "RANDOM()"; + } + } + } diff --git a/classes/digest.php b/classes/digest.php index c9e9f24e7..9101b52f4 100644 --- a/classes/digest.php +++ b/classes/digest.php @@ -90,13 +90,11 @@ class Digest static function prepare_headlines_digest($user_id, $days = 1, $limit = 1000) { - require_once "lib/MiniTemplator.class.php"; + $tpl = new Templator(); + $tpl_t = new Templator(); - $tpl = new MiniTemplator; - $tpl_t = new MiniTemplator; - - $tpl->readTemplateFromFile("templates/digest_template_html.txt"); - $tpl_t->readTemplateFromFile("templates/digest_template.txt"); + $tpl->readTemplateFromFile("digest_template_html.txt"); + $tpl_t->readTemplateFromFile("digest_template.txt"); $user_tz_string = get_pref('USER_TIMEZONE', $user_id); $local_ts = convert_timestamp(time(), 'UTC', $user_tz_string); diff --git a/classes/diskcache.php b/classes/diskcache.php index 7e4a8335d..24e45ea8b 100644 --- a/classes/diskcache.php +++ b/classes/diskcache.php @@ -2,8 +2,196 @@ class DiskCache { private $dir; + // https://stackoverflow.com/a/53662733 + private $mimeMap = [ + 'video/3gpp2' => '3g2', + 'video/3gp' => '3gp', + 'video/3gpp' => '3gp', + 'application/x-compressed' => '7zip', + 'audio/x-acc' => 'aac', + 'audio/ac3' => 'ac3', + 'application/postscript' => 'ai', + 'audio/x-aiff' => 'aif', + 'audio/aiff' => 'aif', + 'audio/x-au' => 'au', + 'video/x-msvideo' => 'avi', + 'video/msvideo' => 'avi', + 'video/avi' => 'avi', + 'application/x-troff-msvideo' => 'avi', + 'application/macbinary' => 'bin', + 'application/mac-binary' => 'bin', + 'application/x-binary' => 'bin', + 'application/x-macbinary' => 'bin', + 'image/bmp' => 'bmp', + 'image/x-bmp' => 'bmp', + 'image/x-bitmap' => 'bmp', + 'image/x-xbitmap' => 'bmp', + 'image/x-win-bitmap' => 'bmp', + 'image/x-windows-bmp' => 'bmp', + 'image/ms-bmp' => 'bmp', + 'image/x-ms-bmp' => 'bmp', + 'application/bmp' => 'bmp', + 'application/x-bmp' => 'bmp', + 'application/x-win-bitmap' => 'bmp', + 'application/cdr' => 'cdr', + 'application/coreldraw' => 'cdr', + 'application/x-cdr' => 'cdr', + 'application/x-coreldraw' => 'cdr', + 'image/cdr' => 'cdr', + 'image/x-cdr' => 'cdr', + 'zz-application/zz-winassoc-cdr' => 'cdr', + 'application/mac-compactpro' => 'cpt', + 'application/pkix-crl' => 'crl', + 'application/pkcs-crl' => 'crl', + 'application/x-x509-ca-cert' => 'crt', + 'application/pkix-cert' => 'crt', + 'text/css' => 'css', + 'text/x-comma-separated-values' => 'csv', + 'text/comma-separated-values' => 'csv', + 'application/vnd.msexcel' => 'csv', + 'application/x-director' => 'dcr', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', + 'application/x-dvi' => 'dvi', + 'message/rfc822' => 'eml', + 'application/x-msdownload' => 'exe', + 'video/x-f4v' => 'f4v', + 'audio/x-flac' => 'flac', + 'video/x-flv' => 'flv', + 'image/gif' => 'gif', + 'application/gpg-keys' => 'gpg', + 'application/x-gtar' => 'gtar', + 'application/x-gzip' => 'gzip', + 'application/mac-binhex40' => 'hqx', + 'application/mac-binhex' => 'hqx', + 'application/x-binhex40' => 'hqx', + 'application/x-mac-binhex40' => 'hqx', + 'text/html' => 'html', + 'image/x-icon' => 'ico', + 'image/x-ico' => 'ico', + 'image/vnd.microsoft.icon' => 'ico', + 'text/calendar' => 'ics', + 'application/java-archive' => 'jar', + 'application/x-java-application' => 'jar', + 'application/x-jar' => 'jar', + 'image/jp2' => 'jp2', + 'video/mj2' => 'jp2', + 'image/jpx' => 'jp2', + 'image/jpm' => 'jp2', + 'image/jpeg' => 'jpg', + 'image/pjpeg' => 'jpg', + 'application/x-javascript' => 'js', + 'application/json' => 'json', + 'text/json' => 'json', + 'application/vnd.google-earth.kml+xml' => 'kml', + 'application/vnd.google-earth.kmz' => 'kmz', + 'text/x-log' => 'log', + 'audio/x-m4a' => 'm4a', + 'audio/mp4' => 'm4a', + 'application/vnd.mpegurl' => 'm4u', + 'audio/midi' => 'mid', + 'application/vnd.mif' => 'mif', + 'video/quicktime' => 'mov', + 'video/x-sgi-movie' => 'movie', + 'audio/mpeg' => 'mp3', + 'audio/mpg' => 'mp3', + 'audio/mpeg3' => 'mp3', + 'audio/mp3' => 'mp3', + 'video/mp4' => 'mp4', + 'video/mpeg' => 'mpeg', + 'application/oda' => 'oda', + 'audio/ogg' => 'ogg', + 'video/ogg' => 'ogg', + 'application/ogg' => 'ogg', + 'font/otf' => 'otf', + 'application/x-pkcs10' => 'p10', + 'application/pkcs10' => 'p10', + 'application/x-pkcs12' => 'p12', + 'application/x-pkcs7-signature' => 'p7a', + 'application/pkcs7-mime' => 'p7c', + 'application/x-pkcs7-mime' => 'p7c', + 'application/x-pkcs7-certreqresp' => 'p7r', + 'application/pkcs7-signature' => 'p7s', + 'application/pdf' => 'pdf', + 'application/octet-stream' => 'pdf', + 'application/x-x509-user-cert' => 'pem', + 'application/x-pem-file' => 'pem', + 'application/pgp' => 'pgp', + 'application/x-httpd-php' => 'php', + 'application/php' => 'php', + 'application/x-php' => 'php', + 'text/php' => 'php', + 'text/x-php' => 'php', + 'application/x-httpd-php-source' => 'php', + 'image/png' => 'png', + 'image/x-png' => 'png', + 'application/powerpoint' => 'ppt', + 'application/vnd.ms-powerpoint' => 'ppt', + 'application/vnd.ms-office' => 'ppt', + 'application/msword' => 'ppt', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx', + 'application/x-photoshop' => 'psd', + 'image/vnd.adobe.photoshop' => 'psd', + 'audio/x-realaudio' => 'ra', + 'audio/x-pn-realaudio' => 'ram', + 'application/x-rar' => 'rar', + 'application/rar' => 'rar', + 'application/x-rar-compressed' => 'rar', + 'audio/x-pn-realaudio-plugin' => 'rpm', + 'application/x-pkcs7' => 'rsa', + 'text/rtf' => 'rtf', + 'text/richtext' => 'rtx', + 'video/vnd.rn-realvideo' => 'rv', + 'application/x-stuffit' => 'sit', + 'application/smil' => 'smil', + 'text/srt' => 'srt', + 'image/svg+xml' => 'svg', + 'application/x-shockwave-flash' => 'swf', + 'application/x-tar' => 'tar', + 'application/x-gzip-compressed' => 'tgz', + 'image/tiff' => 'tiff', + 'font/ttf' => 'ttf', + 'text/plain' => 'txt', + 'text/x-vcard' => 'vcf', + 'application/videolan' => 'vlc', + 'text/vtt' => 'vtt', + 'audio/x-wav' => 'wav', + 'audio/wave' => 'wav', + 'audio/wav' => 'wav', + 'application/wbxml' => 'wbxml', + 'video/webm' => 'webm', + 'image/webp' => 'webp', + 'audio/x-ms-wma' => 'wma', + 'application/wmlc' => 'wmlc', + 'video/x-ms-wmv' => 'wmv', + 'video/x-ms-asf' => 'wmv', + 'font/woff' => 'woff', + 'font/woff2' => 'woff2', + 'application/xhtml+xml' => 'xhtml', + 'application/excel' => 'xl', + 'application/msexcel' => 'xls', + 'application/x-msexcel' => 'xls', + 'application/x-ms-excel' => 'xls', + 'application/x-excel' => 'xls', + 'application/x-dos_ms_excel' => 'xls', + 'application/xls' => 'xls', + 'application/x-xls' => 'xls', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', + 'application/vnd.ms-excel' => 'xlsx', + 'application/xml' => 'xml', + 'text/xml' => 'xml', + 'text/xsl' => 'xsl', + 'application/xspf+xml' => 'xspf', + 'application/x-compress' => 'z', + 'application/x-zip' => 'zip', + 'application/zip' => 'zip', + 'application/x-zip-compressed' => 'zip', + 'application/s-compressed' => 'zip', + 'multipart/x-zip' => 'zip', + 'text/x-scriptzsh' => 'zsh' + ]; + public function __construct($dir) { - $this->dir = CACHE_DIR . "/" . clean_filename($dir); + $this->dir = CACHE_DIR . "/" . basename(clean($dir)); } public function getDir() { @@ -39,9 +227,7 @@ class DiskCache { } public function getFullPath($filename) { - $filename = clean_filename($filename); - - return $this->dir . "/" . $filename; + return $this->dir . "/" . basename(clean($filename)); } public function put($filename, $data) { @@ -66,19 +252,34 @@ class DiskCache { return null; } + public function getFakeExtension($filename) { + $mimetype = $this->getMimeType($filename); + + if ($mimetype) + return isset($this->mimeMap[$mimetype]) ? $this->mimeMap[$mimetype] : ""; + else + return ""; + } + public function send($filename) { - header("Content-Disposition: inline; filename=\"$filename\""); + $fake_extension = $this->getFakeExtension($filename); + + if ($fake_extension) + $fake_extension = ".$fake_extension"; + + header("Content-Disposition: inline; filename=\"${filename}${fake_extension}\""); - return send_local_file($this->getFullPath($filename)); + return $this->send_local_file($this->getFullPath($filename)); } public function getUrl($filename) { - return get_self_url_prefix() . "/public.php?op=cached_url&file=" . basename($this->dir) . "/" . $filename; + return get_self_url_prefix() . "/public.php?op=cached_url&file=" . basename($this->dir) . "/" . basename($filename); } // check for locally cached (media) URLs and rewrite to local versions // this is called separately after sanitize() and plugin render article hooks to allow // plugins work on original source URLs used before caching + // NOTE: URLs should be already absolutized because this is called after sanitize() static public function rewriteUrls($str) { $res = trim($str); @@ -89,31 +290,41 @@ class DiskCache { $xpath = new DOMXPath($doc); $cache = new DiskCache("images"); - $entries = $xpath->query('(//img[@src]|//picture/source[@src]|//video[@poster]|//video/source[@src]|//audio/source[@src])'); + $entries = $xpath->query('(//img[@src]|//source[@src|@srcset]|//video[@poster|@src])'); $need_saving = false; foreach ($entries as $entry) { + foreach (array('src', 'poster') as $attr) { + if ($entry->hasAttribute($attr)) { + $url = $entry->getAttribute($attr); + $cached_filename = sha1($url); - if ($entry->hasAttribute('src') || $entry->hasAttribute('poster')) { + if ($cache->exists($cached_filename)) { + $url = $cache->getUrl($cached_filename); - // should be already absolutized because this is called after sanitize() - $src = $entry->hasAttribute('poster') ? $entry->getAttribute('poster') : $entry->getAttribute('src'); - $cached_filename = sha1($src); + $entry->setAttribute($attr, $url); + $entry->removeAttribute("srcset"); - if ($cache->exists($cached_filename)) { + $need_saving = true; + } + } + } - $src = $cache->getUrl(sha1($src)); + if ($entry->hasAttribute("srcset")) { + $matches = RSSUtils::decode_srcset($entry->getAttribute('srcset')); - if ($entry->hasAttribute('poster')) - $entry->setAttribute('poster', $src); - else { - $entry->setAttribute('src', $src); - $entry->removeAttribute("srcset"); - } + for ($i = 0; $i < count($matches); $i++) { + $cached_filename = sha1($matches[$i]["url"]); + + if ($cache->exists($cached_filename)) { + $matches[$i]["url"] = $cache->getUrl($cached_filename); - $need_saving = true; + $need_saving = true; + } } + + $entry->setAttribute("srcset", RSSUtils::encode_srcset($matches)); } } @@ -148,4 +359,56 @@ class DiskCache { } } } + + /* this is essentially a wrapper for readfile() which allows plugins to hook + output with httpd-specific "fast" implementation i.e. X-Sendfile or whatever else + + hook function should return true if request was handled (or at least attempted to) + + note that this can be called without user context so the plugin to handle this + should be loaded systemwide in config.php */ + function send_local_file($filename) { + if (file_exists($filename)) { + + if (is_writable($filename)) touch($filename); + + $mimetype = mime_content_type($filename); + + // this is hardly ideal but 1) only media is cached in images/ and 2) seemingly only mp4 + // video files are detected as octet-stream by mime_content_type() + + if ($mimetype == "application/octet-stream") + $mimetype = "video/mp4"; + + # block SVG because of possible embedded javascript (.....) + $mimetype_blacklist = [ "image/svg+xml" ]; + + /* only serve video and images */ + if (!preg_match("/(image|video)\//", $mimetype) || in_array($mimetype, $mimetype_blacklist)) { + http_response_code(400); + header("Content-type: text/plain"); + + print "Stored file has disallowed content type ($mimetype)"; + return false; + } + + $tmppluginhost = new PluginHost(); + + $tmppluginhost->load(PLUGINS, PluginHost::KIND_SYSTEM); + $tmppluginhost->load_data(); + + foreach ($tmppluginhost->get_hooks(PluginHost::HOOK_SEND_LOCAL_FILE) as $plugin) { + if ($plugin->hook_send_local_file($filename)) return true; + } + + header("Content-type: $mimetype"); + + $stamp = gmdate("D, d M Y H:i:s", filemtime($filename)) . " GMT"; + header("Last-Modified: $stamp", true); + + return readfile($filename); + } else { + return false; + } + } } diff --git a/classes/feeds.php b/classes/feeds.php index 77add790e..b428252d8 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -8,7 +8,7 @@ class Feeds extends Handler_Protected { private $params; function csrf_ignore($method) { - $csrf_ignored = array("index", "quickaddfeed", "search"); + $csrf_ignored = array("index"); return array_search($method, $csrf_ignored) !== false; } @@ -210,7 +210,7 @@ class Feeds extends Handler_Protected { $feed_title = $qfh_ret[1]; $feed_site_url = $qfh_ret[2]; $last_error = $qfh_ret[3]; - $last_updated = strpos($qfh_ret[4], '1970-') === FALSE ? + $last_updated = strpos($qfh_ret[4], '1970-') === false ? make_local_datetime($qfh_ret[4], false) : __("Never"); $highlight_words = $qfh_ret[5]; $reply['first_id'] = $qfh_ret[6]; @@ -305,7 +305,7 @@ class Feeds extends Handler_Protected { $line["buttons"] .= $p->hook_article_button($line); } - $line["content"] = sanitize($line["content"], + $line["content"] = Sanitizer::sanitize($line["content"], $line['hide_images'], false, $line["site_url"], $highlight_words, $line["id"]); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) { @@ -529,21 +529,7 @@ class Feeds extends Handler_Protected { $reply['headlines'] = []; - $override_order = false; - $skip_first_id_check = false; - - switch ($order_by) { - case "title": - $override_order = "ttrss_entries.title, date_entered, updated"; - break; - case "date_reverse": - $override_order = "score DESC, date_entered, updated"; - $skip_first_id_check = true; - break; - case "feed_dates": - $override_order = "updated DESC"; - break; - } + list($override_order, $skip_first_id_check) = Feeds::order_to_override_query($order_by); $ret = $this->format_headlines_list($feed, $method, $view_mode, $limit, $cat_view, $offset, @@ -564,7 +550,7 @@ class Feeds extends Handler_Protected { "disable_cache" => (bool) $disable_cache]; // this is parsed by handleRpcJson() on first viewfeed() to set cdm expanded, etc - $reply['runtime-info'] = make_runtime_info(); + $reply['runtime-info'] = RPC::make_runtime_info(); $reply_json = json_encode($reply); @@ -701,12 +687,12 @@ class Feeds extends Handler_Protected { print "<section>"; print "<label> <label class='checkbox'><input type='checkbox' name='need_auth' dojoType='dijit.form.CheckBox' id='feedDlg_loginCheck' - onclick='displayIfChecked(this, \"feedDlg_loginContainer\")'> + onclick='App.displayIfChecked(this, \"feedDlg_loginContainer\")'> ".__('This feed requires authentication.')."</label>"; print "</section>"; print "<footer>"; - print "<button dojoType='dijit.form.Button' class='alt-primary' type='submit' + print "<button dojoType='dijit.form.Button' class='alt-primary' type='submit' onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button>"; print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('feedAddDlg').hide()\">".__('Cancel')."</button>"; @@ -765,7 +751,7 @@ class Feeds extends Handler_Protected { $feed_id = (int)$_REQUEST["feed_id"]; @$do_update = $_REQUEST["action"] == "do_update"; - $csrf_token = $_REQUEST["csrf_token"]; + $csrf_token = $_POST["csrf_token"]; $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE id = ? AND owner_uid = ?"); $sth->execute([$feed_id, $_SESSION['uid']]); @@ -813,7 +799,7 @@ class Feeds extends Handler_Protected { <div class="container"> <h1>Feed Debugger: <?php echo "$feed_id: " . $this->getFeedTitle($feed_id) ?></h1> <div class="content"> - <form method="GET" action=""> + <form method="post" action=""> <input type="hidden" name="op" value="feeds"> <input type="hidden" name="method" value="update_debugger"> <input type="hidden" name="xdebug" value="1"> @@ -1138,11 +1124,11 @@ class Feeds extends Handler_Protected { $pdo = Db::pdo(); - $url = Feeds::fix_url($url); + $url = UrlHelper::validate($url); - if (!$url || !Feeds::validate_feed_url($url)) return array("code" => 2); + if (!$url) return array("code" => 2); - $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass); + $contents = @UrlHelper::fetch($url, false, $auth_login, $auth_pass); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SUBSCRIBE_FEED) as $plugin) { $contents = $plugin->hook_subscribe_feed($contents, $url, $auth_login, $auth_pass); @@ -1156,7 +1142,7 @@ class Feeds extends Handler_Protected { return array("code" => 5, "message" => $fetch_last_error); } - if (mb_strpos($fetch_last_content_type, "html") !== FALSE && Feeds::is_html($contents)) { + if (mb_strpos($fetch_last_content_type, "html") !== false && Feeds::is_html($contents)) { $feedUrls = Feeds::get_feeds_from_html($url, $contents); if (count($feedUrls) == 0) { @@ -1337,7 +1323,7 @@ class Feeds extends Handler_Protected { return 0; } else if ($cat == -2) { - $sth = $pdo->prepare("SELECT COUNT(DISTINCT article_id) AS unread + $sth = $pdo->prepare("SELECT COUNT(DISTINCT article_id) AS unread FROM ttrss_user_entries ue, ttrss_user_labels2 l WHERE article_id = ref_id AND unread IS true AND ue.owner_uid = :uid"); $sth->execute(["uid" => $owner_uid]); @@ -1373,8 +1359,8 @@ class Feeds extends Handler_Protected { $pdo = Db::pdo(); - $sth = $pdo->prepare("SELECT SUM(CASE WHEN unread THEN 1 ELSE 0 END) AS count - FROM ttrss_user_entries ue + $sth = $pdo->prepare("SELECT SUM(CASE WHEN unread THEN 1 ELSE 0 END) AS count + FROM ttrss_user_entries ue WHERE ue.owner_uid = ?"); $sth->execute([$user_id]); @@ -1468,7 +1454,7 @@ class Feeds extends Handler_Protected { } if (DB_TYPE == "pgsql") { - $test_sth = $pdo->prepare("select $search_query_part + $test_sth = $pdo->prepare("select $search_query_part FROM ttrss_entries, ttrss_user_entries WHERE id = ref_id limit 1"); try { @@ -1938,7 +1924,7 @@ class Feeds extends Handler_Protected { } static function get_feeds_from_html($url, $content) { - $url = Feeds::fix_url($url); + $url = UrlHelper::validate($url); $baseUrl = substr($url, 0, strrpos($url, '/') + 1); $feedUrls = []; @@ -1969,56 +1955,6 @@ class Feeds extends Handler_Protected { return preg_match("/<html|DOCTYPE html/i", substr($content, 0, 8192)) !== 0; } - static function validate_feed_url($url) { - $parts = parse_url($url); - - return ($parts['scheme'] == 'http' || $parts['scheme'] == 'feed' || $parts['scheme'] == 'https'); - } - - /** - * Fixes incomplete URLs by prepending "http://". - * Also replaces feed:// with http://, and - * prepends a trailing slash if the url is a domain name only. - * - * @param string $url Possibly incomplete URL - * - * @return string Fixed URL. - */ - static function fix_url($url) { - - // support schema-less urls - if (strpos($url, '//') === 0) { - $url = 'https:' . $url; - } - - if (strpos($url, '://') === false) { - $url = 'http://' . $url; - } else if (substr($url, 0, 5) == 'feed:') { - $url = 'http:' . substr($url, 5); - } - - //prepend slash if the URL has no slash in it - // "http://www.example" -> "http://www.example/" - if (strpos($url, '/', strpos($url, ':') + 3) === false) { - $url .= '/'; - } - - //convert IDNA hostname to punycode if possible - if (function_exists("idn_to_ascii")) { - $parts = parse_url($url); - if (mb_detect_encoding($parts['host']) != 'ASCII') - { - $parts['host'] = idn_to_ascii($parts['host']); - $url = build_url($parts); - } - } - - if ($url != "http:///") - return $url; - else - return ''; - } - static function add_feed_category($feed_cat, $parent_cat_id = false, $order_id = 0) { if (!$feed_cat) return false; @@ -2161,7 +2097,7 @@ class Feeds extends Handler_Protected { static function feed_purge_interval($feed_id) { - $pdo = DB::pdo(); + $pdo = Db::pdo(); $sth = $pdo->prepare("SELECT purge_interval, owner_uid FROM ttrss_feeds WHERE id = ?"); @@ -2267,6 +2203,24 @@ class Feeds extends Handler_Protected { if (!$not) array_push($search_words, $k); } break; + case "label": + if ($commandpair[1]) { + $label_id = Labels::find_id($commandpair[1], $_SESSION["uid"]); + + if ($label_id) { + array_push($query_keywords, "($not + (ttrss_entries.id IN ( + SELECT article_id FROM ttrss_user_labels2 WHERE + label_id = ".$pdo->quote($label_id).")))"); + } else { + array_push($query_keywords, "(false)"); + } + } else { + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") + OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); + if (!$not) array_push($search_words, $k); + } + break; case "unread": if ($commandpair[1]) { if ($commandpair[1] == "true") @@ -2323,9 +2277,38 @@ class Feeds extends Handler_Protected { } - $search_query_part = implode("AND", $query_keywords); + if (count($query_keywords) > 0) + $search_query_part = implode("AND", $query_keywords); + else + $search_query_part = "false"; return array($search_query_part, $search_words); } + + static function order_to_override_query($order) { + $query = ""; + $skip_first_id = false; + + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HEADLINES_CUSTOM_SORT_OVERRIDE) as $p) { + list ($query, $skip_first_id) = $p->hook_headlines_custom_sort_override($order); + + if ($query) return [$query, $skip_first_id]; + } + + switch ($order) { + case "title": + $query = "ttrss_entries.title, date_entered, updated"; + break; + case "date_reverse": + $query = "updated"; + $skip_first_id = true; + break; + case "feed_dates": + $query = "updated DESC"; + break; + } + + return [$query, $skip_first_id]; + } } diff --git a/classes/handler.php b/classes/handler.php index 5b1109492..09557c284 100644 --- a/classes/handler.php +++ b/classes/handler.php @@ -9,7 +9,7 @@ class Handler implements IHandler { } function csrf_ignore($method) { - return true; + return false; } function before($method) { @@ -20,4 +20,4 @@ class Handler implements IHandler { return true; } -}
\ No newline at end of file +} diff --git a/classes/handler/public.php b/classes/handler/public.php index 8c2700012..9671b18b2 100755 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -5,8 +5,6 @@ class Handler_Public extends Handler { $limit, $offset, $search, $view_mode = false, $format = 'atom', $order = false, $orig_guid = false, $start_ts = false) { - require_once "lib/MiniTemplator.class.php"; - $note_style = "background-color : #fff7d5; border-width : 1px; ". "padding : 5px; border-style : dashed; border-color : #e7d796;". @@ -14,24 +12,16 @@ class Handler_Public extends Handler { if (!$limit) $limit = 60; - $date_sort_field = "date_entered DESC, updated DESC"; + list($override_order, $skip_first_id_check) = Feeds::order_to_override_query($order); - if ($feed == -2 && !$is_cat) { - $date_sort_field = "last_published DESC"; - } else if ($feed == -1 && !$is_cat) { - $date_sort_field = "last_marked DESC"; - } + if (!$override_order) { + $override_order = "date_entered DESC, updated DESC"; - switch ($order) { - case "title": - $date_sort_field = "ttrss_entries.title, date_entered, updated"; - break; - case "date_reverse": - $date_sort_field = "date_entered, updated"; - break; - case "feed_dates": - $date_sort_field = "updated DESC"; - break; + if ($feed == -2 && !$is_cat) { + $override_order = "last_published DESC"; + } else if ($feed == -1 && !$is_cat) { + $override_order = "last_marked DESC"; + } } $params = array( @@ -41,7 +31,7 @@ class Handler_Public extends Handler { "view_mode" => $view_mode, "cat_view" => $is_cat, "search" => $search, - "override_order" => $date_sort_field, + "override_order" => $override_order, "include_children" => true, "ignore_vfeed_group" => true, "offset" => $offset, @@ -80,9 +70,9 @@ class Handler_Public extends Handler { if (!$feed_site_url) $feed_site_url = get_self_url_prefix(); if ($format == 'atom') { - $tpl = new MiniTemplator; + $tpl = new Templator(); - $tpl->readTemplateFromFile("templates/generated_feed.txt"); + $tpl->readTemplateFromFile("generated_feed.txt"); $tpl->setVariable('FEED_TITLE', $feed_title, true); $tpl->setVariable('VERSION', get_version(), true); @@ -91,7 +81,7 @@ class Handler_Public extends Handler { $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true); while ($line = $result->fetch()) { - $line["content_preview"] = sanitize(truncate_string(strip_tags($line["content"]), 100, '...')); + $line["content_preview"] = Sanitizer::sanitize(truncate_string(strip_tags($line["content"]), 100, '...')); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { $line = $p->hook_query_headlines($line); @@ -108,7 +98,7 @@ class Handler_Public extends Handler { $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true); $tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true); - $content = sanitize($line["content"], false, $owner_uid, + $content = Sanitizer::sanitize($line["content"], false, $owner_uid, $feed_site_url, false, $line["id"]); $content = DiskCache::rewriteUrls($content); @@ -190,7 +180,7 @@ class Handler_Public extends Handler { while ($line = $result->fetch()) { - $line["content_preview"] = sanitize(truncate_string(strip_tags($line["content_preview"]), 100, '...')); + $line["content_preview"] = Sanitizer::sanitize(truncate_string(strip_tags($line["content_preview"]), 100, '...')); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { $line = $p->hook_query_headlines($line, 100); @@ -206,7 +196,7 @@ class Handler_Public extends Handler { $article['link'] = $line['link']; $article['title'] = $line['title']; $article['excerpt'] = $line["content_preview"]; - $article['content'] = sanitize($line["content"], false, $owner_uid, $feed_site_url, false, $line["id"]); + $article['content'] = Sanitizer::sanitize($line["content"], false, $owner_uid, $feed_site_url, false, $line["id"]); $article['updated'] = date('c', strtotime($line["updated"])); if ($line['note']) $article['note'] = $line['note']; @@ -293,15 +283,20 @@ class Handler_Public extends Handler { } function logout() { - logout_user(); - header("Location: index.php"); + if (validate_csrf($_POST["csrf_token"])) { + Pref_Users::logout_user(); + header("Location: index.php"); + } else { + header("Content-Type: text/json"); + print error_json(6); + } } function share() { $uuid = clean($_REQUEST["key"]); if ($uuid) { - $sth = $this->pdo->prepare("SELECT ref_id, owner_uid + $sth = $this->pdo->prepare("SELECT ref_id, owner_uid FROM ttrss_user_entries WHERE uuid = ?"); $sth->execute([$uuid]); @@ -348,7 +343,7 @@ class Handler_Public extends Handler { $line["tags"] = Article::get_article_tags($id, $owner_uid, $line["tag_cache"]); unset($line["tag_cache"]); - $line["content"] = sanitize($line["content"], + $line["content"] = Sanitizer::sanitize($line["content"], $line['hide_images'], $owner_uid, $line["site_url"], false, $line["id"]); @@ -376,7 +371,7 @@ class Handler_Public extends Handler { } body.css_loading * { display : none; - } + } </style> <link rel='shortcut icon' type='image/png' href='images/favicon.png'> <link rel='icon' type='image/png' sizes='72x72' href='images/favicon-72px.png'>"; @@ -475,7 +470,7 @@ class Handler_Public extends Handler { if (!$format) $format = 'atom'; if (SINGLE_USER_MODE) { - authenticate_user("admin", null); + UserHelper::authenticate("admin", null); } $owner_id = false; @@ -513,7 +508,7 @@ class Handler_Public extends Handler { function sharepopup() { if (SINGLE_USER_MODE) { - login_sequence(); + UserHelper::login_sequence(); } header('Content-Type: text/html; charset=utf-8'); @@ -678,14 +673,15 @@ class Handler_Public extends Handler { $login = clean($_POST["login"]); $password = clean($_POST["password"]); $remember_me = clean($_POST["remember_me"]); + $safe_mode = checkbox_to_sql_bool(clean($_POST["safe_mode"])); if ($remember_me) { - session_set_cookie_params(SESSION_COOKIE_LIFETIME); + @session_set_cookie_params(SESSION_COOKIE_LIFETIME); } else { - session_set_cookie_params(0); + @session_set_cookie_params(0); } - if (authenticate_user($login, $password)) { + if (UserHelper::authenticate($login, $password)) { $_POST["password"] = ""; if (get_schema_version() >= 120) { @@ -694,6 +690,7 @@ class Handler_Public extends Handler { $_SESSION["ref_schema_version"] = get_schema_version(true); $_SESSION["bw_limit"] = !!clean($_POST["bw_limit"]); + $_SESSION["safe_mode"] = $safe_mode; if (clean($_POST["profile"])) { @@ -732,12 +729,13 @@ class Handler_Public extends Handler { function subscribe() { if (SINGLE_USER_MODE) { - login_sequence(); + UserHelper::login_sequence(); } if ($_SESSION["uid"]) { $feed_url = trim(clean($_REQUEST["feed_url"])); + $csrf_token = clean($_POST["csrf_token"]); header('Content-Type: text/html; charset=utf-8'); ?> @@ -784,13 +782,14 @@ class Handler_Public extends Handler { <div class='content'> <?php - if (!$feed_url) { + if (!$feed_url || !validate_csrf($csrf_token)) { ?> <form method="post"> <input type="hidden" name="op" value="subscribe"> + <?php print_hidden("csrf_token", $_SESSION["csrf_token"]) ?> <fieldset> <label>Feed or site URL:</label> - <input style="width: 300px" dojoType="dijit.form.ValidationTextBox" required="1" name="feed_url"> + <input style="width: 300px" dojoType="dijit.form.ValidationTextBox" required="1" name="feed_url" value="<?php echo htmlspecialchars($feed_url) ?>"> </fieldset> <button class="alt-primary" dojoType="dijit.form.Button" type="submit"> @@ -830,6 +829,7 @@ class Handler_Public extends Handler { print "<form action='public.php'>"; print "<input type='hidden' name='op' value='subscribe'>"; + print_hidden("csrf_token", $_SESSION["csrf_token"]); print "<fieldset>"; print "<label style='display : inline'>" . __("Multiple feed URLs found:") . "</label>"; @@ -878,7 +878,7 @@ class Handler_Public extends Handler { print "</div></div></body></html>"; } else { - render_login_form(); + $this->render_login_form(); } } @@ -942,7 +942,7 @@ class Handler_Public extends Handler { if ($timestamp && $resetpass_token && $timestamp >= time() - 15*60*60 && - $resetpass_token == $hash) { + $resetpass_token === $hash) { $sth = $this->pdo->prepare("UPDATE ttrss_users SET resetpass_token = NULL WHERE id = ?"); @@ -1030,11 +1030,9 @@ class Handler_Public extends Handler { $resetpass_link = get_self_url_prefix() . "/public.php?op=forgotpass&hash=" . $resetpass_token . "&login=" . urlencode($login); - require_once "lib/MiniTemplator.class.php"; - - $tpl = new MiniTemplator; + $tpl = new Templator(); - $tpl->readTemplateFromFile("templates/resetpass_link_template.txt"); + $tpl->readTemplateFromFile("resetpass_link_template.txt"); $tpl->setVariable('LOGIN', $login); $tpl->setVariable('RESETPASS_LINK', $resetpass_link); @@ -1094,7 +1092,7 @@ class Handler_Public extends Handler { if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) { $_SESSION["login_error_msg"] = __("Your access level is insufficient to run this script."); - render_login_form(); + $this->render_login_form(); exit; } @@ -1246,7 +1244,7 @@ class Handler_Public extends Handler { public function pluginhandler() { $host = new PluginHost(); - $plugin_name = clean_filename($_REQUEST["plugin"]); + $plugin_name = basename(clean($_REQUEST["plugin"])); $method = clean($_REQUEST["pmethod"]); $host->load($plugin_name, PluginHost::KIND_USER, 0); @@ -1274,5 +1272,13 @@ class Handler_Public extends Handler { print error_json(14); } } + + static function render_login_form() { + header('Cache-Control: public'); + + require_once "login_form.php"; + exit; + } + } ?> diff --git a/classes/labels.php b/classes/labels.php index 19d060617..7a69a5191 100644 --- a/classes/labels.php +++ b/classes/labels.php @@ -12,7 +12,7 @@ class Labels static function find_id($label, $owner_uid) { $pdo = Db::pdo(); - $sth = $pdo->prepare("SELECT id FROM ttrss_labels2 WHERE caption = ? + $sth = $pdo->prepare("SELECT id FROM ttrss_labels2 WHERE LOWER(caption) = LOWER(?) AND owner_uid = ? LIMIT 1"); $sth->execute([$label, $owner_uid]); @@ -186,7 +186,7 @@ class Labels } $sth = $pdo->prepare("SELECT id FROM ttrss_labels2 - WHERE caption = ? AND owner_uid = ?"); + WHERE LOWER(caption) = LOWER(?) AND owner_uid = ?"); $sth->execute([$caption, $owner_uid]); if (!$sth->fetch()) { @@ -202,4 +202,4 @@ class Labels return $result; } -}
\ No newline at end of file +} diff --git a/classes/opml.php b/classes/opml.php index 48db9a8a3..37e653a39 100644 --- a/classes/opml.php +++ b/classes/opml.php @@ -8,7 +8,7 @@ class Opml extends Handler_Protected { } function export() { - $output_name = "tt-rss_".date("Y-m-d").".opml"; + $output_name = sprintf("tt-rss_%s_%s.opml", $_SESSION["name"], date("Y-m-d")); $include_settings = $_REQUEST["include_settings"] == "1"; $owner_uid = $_SESSION["uid"]; @@ -62,7 +62,7 @@ class Opml extends Handler_Protected { $ttrss_specific_qpart = ""; if ($cat_id) { - $sth = $this->pdo->prepare("SELECT title,order_id + $sth = $this->pdo->prepare("SELECT title,order_id FROM ttrss_feed_categories WHERE id = ? AND owner_uid = ?"); $sth->execute([$cat_id, $owner_uid]); @@ -90,7 +90,7 @@ class Opml extends Handler_Protected { $out .= $this->opml_export_category($owner_uid, $line["id"], $hide_private_feeds, $include_settings); } - $fsth = $this->pdo->prepare("select title, feed_url, site_url, update_interval, order_id + $fsth = $this->pdo->prepare("select title, feed_url, site_url, update_interval, order_id, purge_interval FROM ttrss_feeds WHERE (cat_id = :cat OR (:cat = 0 AND cat_id IS NULL)) AND owner_uid = :uid AND $hide_qpart ORDER BY order_id, title"); @@ -105,8 +105,9 @@ class Opml extends Handler_Protected { if ($include_settings) { $update_interval = (int)$fline["update_interval"]; $order_id = (int)$fline["order_id"]; + $purge_interval = (int)$fline["purge_interval"]; - $ttrss_specific_qpart = "ttrssSortOrder=\"$order_id\" ttrssUpdateInterval=\"$update_interval\""; + $ttrss_specific_qpart = "ttrssSortOrder=\"$order_id\" ttrssPurgeInterval=\"$purge_interval\" ttrssUpdateInterval=\"$update_interval\""; } else { $ttrss_specific_qpart = ""; } @@ -125,15 +126,16 @@ class Opml extends Handler_Protected { return $out; } - function opml_export($name, $owner_uid, $hide_private_feeds = false, $include_settings = true) { + function opml_export($filename, $owner_uid, $hide_private_feeds = false, $include_settings = true, $file_output = false) { if (!$owner_uid) return; - if (!isset($_REQUEST["debug"])) { - header("Content-type: application/xml+opml"); - header("Content-Disposition: attachment; filename=" . $name ); - } else { - header("Content-type: text/xml"); - } + if (!$file_output) + if (!isset($_REQUEST["debug"])) { + header("Content-type: application/xml+opml"); + header("Content-Disposition: attachment; filename=$filename"); + } else { + header("Content-type: text/xml"); + } $out = "<?xml version=\"1.0\" encoding=\"utf-8\"?".">"; @@ -288,7 +290,10 @@ class Opml extends Handler_Protected { 'return str_repeat("\t", intval(strlen($matches[0])/2));'), $res); */ - print $res; + if ($file_output) + return file_put_contents($filename, $res) > 0; + else + print $res; } // Import @@ -323,11 +328,14 @@ class Opml extends Handler_Protected { $order_id = (int) $attrs->getNamedItem('ttrssSortOrder')->nodeValue; if (!$order_id) $order_id = 0; + $purge_interval = (int) $attrs->getNamedItem('ttrssPurgeInterval')->nodeValue; + if (!$purge_interval) $purge_interval = 0; + $sth = $this->pdo->prepare("INSERT INTO ttrss_feeds - (title, feed_url, owner_uid, cat_id, site_url, order_id, update_interval) VALUES - (?, ?, ?, ?, ?, ?, ?)"); + (title, feed_url, owner_uid, cat_id, site_url, order_id, update_interval, purge_interval) VALUES + (?, ?, ?, ?, ?, ?, ?, ?)"); - $sth->execute([$feed_title, $feed_url, $owner_uid, $cat_id, $site_url, $order_id, $update_interval]); + $sth->execute([$feed_title, $feed_url, $owner_uid, $cat_id, $site_url, $order_id, $update_interval, $purge_interval]); } else { $this->opml_notice(T_sprintf("Duplicate feed: %s", $feed_title == '[Unknown]' ? $feed_url : $feed_title)); @@ -602,7 +610,7 @@ class Opml extends Handler_Protected { if (is_file($tmp_file)) { $doc = new DOMDocument(); libxml_disable_entity_loader(false); - $doc->load($tmp_file); + $loaded = $doc->load($tmp_file); libxml_disable_entity_loader(true); unlink($tmp_file); } else if (!$doc) { @@ -610,7 +618,7 @@ class Opml extends Handler_Protected { return; } - if ($doc) { + if ($loaded) { $this->pdo->beginTransaction(); $this->opml_import_category($doc, false, $owner_uid, false); $this->pdo->commit(); diff --git a/classes/pluginhost.php b/classes/pluginhost.php index 6158880f2..acccea5db 100755 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -1,6 +1,9 @@ <?php class PluginHost { private $pdo; + /* separate handle for plugin data so transaction while saving wouldn't clash with possible main + tt-rss code transactions; only initialized when first needed */ + private $pdo_data; private $hooks = array(); private $plugins = array(); private $handlers = array(); @@ -62,6 +65,9 @@ class PluginHost { const HOOK_ARTICLE_IMAGE = 42; const HOOK_FEED_TREE = 43; const HOOK_IFRAME_WHITELISTED = 44; + const HOOK_ENCLOSURE_IMPORTED = 45; + const HOOK_HEADLINES_CUSTOM_SORT_MAP = 46; + const HOOK_HEADLINES_CUSTOM_SORT_OVERRIDE = 47; const KIND_ALL = 1; const KIND_SYSTEM = 2; @@ -73,7 +79,6 @@ class PluginHost { function __construct() { $this->pdo = Db::pdo(); - $this->storage = array(); } @@ -150,7 +155,7 @@ class PluginHost { foreach (array_keys($this->hooks[$type]) as $prio) { $key = array_search($sender, $this->hooks[$type][$prio]); - if ($key !== FALSE) { + if ($key !== false) { unset($this->hooks[$type][$prio][$key]); } } @@ -188,7 +193,7 @@ class PluginHost { foreach ($plugins as $class) { $class = trim($class); - $class_file = strtolower(clean_filename($class)); + $class_file = strtolower(basename(clean($class))); if (!is_dir(__DIR__."/../plugins/$class_file") && !is_dir(__DIR__."/../plugins.local/$class_file")) continue; @@ -213,7 +218,7 @@ class PluginHost { if (file_exists($vendor_dir)) { spl_autoload_register(function($class) use ($vendor_dir) { - if (strpos($class, '\\') !== FALSE) { + if (strpos($class, '\\') !== false) { list ($namespace, $class_name) = explode('\\', $class, 2); if ($namespace && $class_name) { @@ -361,9 +366,13 @@ class PluginHost { private function save_data($plugin) { if ($this->owner_uid) { - $this->pdo->beginTransaction(); - $sth = $this->pdo->prepare("SELECT id FROM ttrss_plugin_storage WHERE + if (!$this->pdo_data) + $this->pdo_data = Db::instance()->pdo_connect(); + + $this->pdo_data->beginTransaction(); + + $sth = $this->pdo_data->prepare("SELECT id FROM ttrss_plugin_storage WHERE owner_uid= ? AND name = ?"); $sth->execute([$this->owner_uid, $plugin]); @@ -373,18 +382,18 @@ class PluginHost { $content = serialize($this->storage[$plugin]); if ($sth->fetch()) { - $sth = $this->pdo->prepare("UPDATE ttrss_plugin_storage SET content = ? + $sth = $this->pdo_data->prepare("UPDATE ttrss_plugin_storage SET content = ? WHERE owner_uid= ? AND name = ?"); $sth->execute([(string)$content, $this->owner_uid, $plugin]); } else { - $sth = $this->pdo->prepare("INSERT INTO ttrss_plugin_storage + $sth = $this->pdo_data->prepare("INSERT INTO ttrss_plugin_storage (name,owner_uid,content) VALUES (?, ?, ?)"); $sth->execute([$plugin, $this->owner_uid, (string)$content]); } - $this->pdo->commit(); + $this->pdo_data->commit(); } } diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 6d7295beb..4ff6ac9c2 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -449,7 +449,7 @@ class Pref_Feeds extends Handler_Protected { if ($row = $sth->fetch()) { @unlink(ICONS_DIR . "/$feed_id.ico"); - $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET favicon_avg_color = NULL + $sth = $this->pdo->prepare("UPDATE ttrss_feeds SET favicon_avg_color = NULL, favicon_last_checked = '1970-01-01' where id = ?"); $sth->execute([$feed_id]); } @@ -554,7 +554,7 @@ class Pref_Feeds extends Handler_Protected { $last_error = $row["last_error"]; if ($last_error) { - print " <i class=\"material-icons\" + print " <i class=\"material-icons\" title=\"".htmlspecialchars($last_error)."\">error</i>"; } @@ -676,7 +676,7 @@ class Pref_Feeds extends Handler_Protected { $auth_checked = $auth_enabled ? 'checked' : ''; print "<label class='checkbox'> <input type='checkbox' $auth_checked name='need_auth' dojoType='dijit.form.CheckBox' id='feedEditDlg_loginCheck' - onclick='displayIfChecked(this, \"feedEditDlg_loginContainer\")'> + onclick='App.displayIfChecked(this, \"feedEditDlg_loginContainer\")'> ".__('This feed requires authentication.')."</label>"; print '</div><div dojoType="dijit.layout.ContentPane" title="'.__('Options').'">'; @@ -772,6 +772,7 @@ class Pref_Feeds extends Handler_Protected { <input style='display: none' id='icon_file' size='10' name='icon_file' type='file'> </label> <input type='hidden' name='op' value='pref-feeds'> + <input type='hidden' name='csrf_token' value='".$_SESSION['csrf_token']."'> <input type='hidden' name='feed_id' value='$feed_id'> <input type='hidden' name='method' value='uploadicon'> <button dojoType='dijit.form.Button' onclick=\"return CommonDialogs.uploadFeedIcon();\" @@ -1172,7 +1173,7 @@ class Pref_Feeds extends Handler_Protected { function index() { print "<div dojoType='dijit.layout.AccordionContainer' region='center'>"; - print "<div style='padding : 0px' dojoType='dijit.layout.AccordionPane' + print "<div style='padding : 0px' dojoType='dijit.layout.AccordionPane' title=\"<i class='material-icons'>rss_feed</i> ".__('Feeds')."\">"; $sth = $this->pdo->prepare("SELECT COUNT(id) AS num_errors @@ -1307,7 +1308,7 @@ class Pref_Feeds extends Handler_Protected { print "</div>"; # feeds pane - print "<div dojoType='dijit.layout.AccordionPane' + print "<div dojoType='dijit.layout.AccordionPane' title='<i class=\"material-icons\">import_export</i> ".__('OPML')."'>"; print "<h3>" . __("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") . "</h3>"; @@ -1325,6 +1326,7 @@ class Pref_Feeds extends Handler_Protected { <input style='display : none' id='opml_file' name='opml_file' type='file'> </label> <input type='hidden' name='op' value='dlg'> + <input type='hidden' name='csrf_token' value='".$_SESSION['csrf_token']."'> <input type='hidden' name='method' value='importOpml'> <button dojoType='dijit.form.Button' class='alt-primary' onclick=\"return Helpers.OPML.import();\" type=\"submit\">" . __('Import OPML') . "</button>"; @@ -1360,7 +1362,7 @@ class Pref_Feeds extends Handler_Protected { print "</div>"; # pane - print "<div dojoType=\"dijit.layout.AccordionPane\" + print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"<i class='material-icons'>share</i> ".__('Published & shared articles / Generated feeds')."\">"; print "<h3>" . __('Published articles can be subscribed by anyone who knows the following URL:') . "</h3>"; @@ -1637,6 +1639,8 @@ class Pref_Feeds extends Handler_Protected { } function batchSubscribe() { + print "<form onsubmit='return false'>"; + print_hidden("op", "pref-feeds"); print_hidden("method", "batchaddfeeds"); @@ -1645,7 +1649,7 @@ class Pref_Feeds extends Handler_Protected { print "<textarea style='font-size : 12px; width : 98%; height: 200px;' - dojoType='dijit.form.SimpleTextarea' name='feeds'></textarea>"; + dojoType='fox.form.ValidationTextArea' required='1' name='feeds'></textarea>"; if (get_pref('ENABLE_FEED_CATS')) { print "<fieldset>"; @@ -1670,14 +1674,17 @@ class Pref_Feeds extends Handler_Protected { print "<fieldset class='narrow'> <label class='checkbox'><input type='checkbox' name='need_auth' dojoType='dijit.form.CheckBox' - onclick='displayIfChecked(this, \"feedDlg_loginContainer\")'> ". + onclick='App.displayIfChecked(this, \"feedDlg_loginContainer\")'> ". __('Feeds require authentication.')."</label></div>"; print "</fieldset>"; print "<footer> - <button dojoType='dijit.form.Button' type='submit' class='alt-primary'>".__('Subscribe')."</button> + <button dojoType='dijit.form.Button' onclick=\"return dijit.byId('batchSubDlg').execute()\" type='submit' class='alt-primary'>". + __('Subscribe')."</button> <button dojoType='dijit.form.Button' onclick=\"return dijit.byId('batchSubDlg').hide()\">".__('Cancel')."</button> </footer>"; + + print "</form>"; } function batchAddFeeds() { @@ -1696,7 +1703,7 @@ class Pref_Feeds extends Handler_Protected { foreach ($feeds as $feed) { $feed = trim($feed); - if (Feeds::validate_feed_url($feed)) { + if (UrlHelper::validate($feed)) { $this->pdo->beginTransaction(); diff --git a/classes/pref/filters.php b/classes/pref/filters.php index a3a0ce77f..6121e4c14 100755 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -3,7 +3,7 @@ class Pref_Filters extends Handler_Protected { function csrf_ignore($method) { $csrf_ignored = array("index", "getfiltertree", "edit", "newfilter", "newrule", - "newaction", "savefilterorder"); + "newaction", "savefilterorder", "testfilterdlg"); return array_search($method, $csrf_ignored) !== false; } @@ -159,22 +159,19 @@ class Pref_Filters extends Handler_Protected { print json_encode($rv); } - function testFilter() { + function testFilterDlg() { + ?> + <div> + <img id='prefFilterLoadingIndicator' src='images/indicator_tiny.gif'> + <span id='prefFilterProgressMsg'>Looking for articles...</span> + </div> - if (isset($_REQUEST["offset"])) return $this->testFilterDo(); - - //print __("Articles matching this filter:"); - - print "<div><img id='prefFilterLoadingIndicator' src='images/indicator_tiny.gif'> <span id='prefFilterProgressMsg'>Looking for articles...</span></div>"; - - print "<ul class='panel panel-scrollable list list-unstyled' id='prefFilterTestResultList'>"; - print "</ul>"; - - print "<footer class='text-center'>"; - print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('filterTestDlg').hide()\">". - __('Close this window')."</button>"; - print "</footer>"; + <ul class='panel panel-scrollable list list-unstyled' id='prefFilterTestResultList'></ul> + <footer class='text-center'> + <button dojoType='dijit.form.Button' onclick="dijit.byId('filterTestDlg').hide()"><?php echo __('Close this window') ?></button> + </footer> + <?php } private function getfilterrules_list($filter_id) { @@ -241,6 +238,7 @@ class Pref_Filters extends Handler_Protected { $root = array(); $root['id'] = 'root'; $root['name'] = __('Filters'); + $root['enabled'] = true; $root['items'] = array(); $filter_search = $_SESSION["prefs_filter_search"]; @@ -305,7 +303,7 @@ class Pref_Filters extends Handler_Protected { $filter['param'] = $name[1]; $filter['checkbox'] = false; $filter['last_triggered'] = $line["last_triggered"] ? make_local_datetime($line["last_triggered"], false) : null; - $filter['enabled'] = $line["enabled"]; + $filter['enabled'] = sql_bool_to_bool($line["enabled"]); $filter['rules'] = $this->getfilterrules_list($line['id']); if (!$filter_search || $match_ok) { @@ -600,10 +598,6 @@ class Pref_Filters extends Handler_Protected { } function editSave() { - if (clean($_REQUEST["savemode"] && $_REQUEST["savemode"]) == "test") { - return $this->testFilter(); - } - $filter_id = clean($_REQUEST["id"]); $enabled = checkbox_to_sql_bool(clean($_REQUEST["enabled"])); $match_any_rule = checkbox_to_sql_bool(clean($_REQUEST["match_any_rule"])); @@ -714,10 +708,6 @@ class Pref_Filters extends Handler_Protected { } function add() { - if (clean($_REQUEST["savemode"] && $_REQUEST["savemode"]) == "test") { - return $this->testFilter(); - } - $enabled = checkbox_to_sql_bool(clean($_REQUEST["enabled"])); $match_any_rule = checkbox_to_sql_bool(clean($_REQUEST["match_any_rule"])); $title = clean($_REQUEST["title"]); @@ -975,19 +965,18 @@ class Pref_Filters extends Handler_Protected { print "<section>"; - print "<input dojoType=\"dijit.form.ValidationTextBox\" - required=\"true\" id=\"filterDlg_regExp\" - onchange='Filters.filterDlgCheckRegExp(this)' - onblur='Filters.filterDlgCheckRegExp(this)' - onfocus='Filters.filterDlgCheckRegExp(this)' - style=\"font-size : 16px; width : 500px\" - name=\"reg_exp\" value=\"$reg_exp\"/>"; + print "<textarea dojoType='fox.form.ValidationTextArea' + required='true' id='filterDlg_regExp' + ValidRegExp='true' + rows='4' + style='font-size : 14px; width : 490px; word-break: break-all' + name='reg_exp'>$reg_exp</textarea>"; print "<div dojoType='dijit.Tooltip' id='filterDlg_regExp_tip' connectId='filterDlg_regExp' position='below'></div>"; print "<fieldset>"; - print "<label class='checkbox'><input id=\"filterDlg_inverse\" dojoType=\"dijit.form.CheckBox\" - name=\"inverse\" $inverse_checked/> ". + print "<label class='checkbox'><input id='filterDlg_inverse' dojoType='dijit.form.CheckBox' + name='inverse' $inverse_checked/> ". __("Inverse regular expression matching")."</label>"; print "</fieldset>"; diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index ac16b5971..f825454dd 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -8,7 +8,7 @@ class Pref_Prefs extends Handler_Protected { private $profile_blacklist = []; function csrf_ignore($method) { - $csrf_ignored = array("index", "updateself", "customizecss", "editprefprofiles"); + $csrf_ignored = array("index", "updateself", "customizecss", "editprefprofiles", "otpqrcode"); return array_search($method, $csrf_ignored) !== false; } @@ -125,8 +125,14 @@ class Pref_Prefs extends Handler_Protected { $old_pw = clean($_POST["old_password"]); $new_pw = clean($_POST["new_password"]); + $new_unclean_pw = $_POST["new_password"]; $con_pw = clean($_POST["confirm_password"]); + if ($new_unclean_pw != $new_pw) { + print "ERROR: ".format_error("New password contains disallowed characters."); + return; + } + if ($old_pw == $new_pw) { print "ERROR: ".format_error("New password must be different from the old one."); return; @@ -213,11 +219,9 @@ class Pref_Prefs extends Handler_Protected { if ($old_email != $email) { $mailer = new Mailer(); - require_once "lib/MiniTemplator.class.php"; + $tpl = new Templator(); - $tpl = new MiniTemplator; - - $tpl->readTemplateFromFile("templates/mail_change_template.txt"); + $tpl->readTemplateFromFile("mail_change_template.txt"); $tpl->setVariable('LOGIN', $row["login"]); $tpl->setVariable('NEWMAIL', $email); @@ -253,7 +257,7 @@ class Pref_Prefs extends Handler_Protected { AND owner_uid = :uid"); $sth->execute([":profile" => $_SESSION['profile'], ":uid" => $_SESSION['uid']]); - initialize_user_prefs($_SESSION["uid"], $_SESSION["profile"]); + $this->initialize_user_prefs($_SESSION["uid"], $_SESSION["profile"]); echo __("Your preferences are now set to default values."); } @@ -382,12 +386,12 @@ class Pref_Prefs extends Handler_Protected { print "<fieldset>"; print "<label>" . __("New password:") . "</label>"; - print "<input dojoType='dijit.form.ValidationTextBox' type='password' required='1' name='new_password'>"; + print "<input dojoType='dijit.form.ValidationTextBox' type='password' regexp='^[^<>]+' required='1' name='new_password'>"; print "</fieldset>"; print "<fieldset>"; print "<label>" . __("Confirm password:") . "</label>"; - print "<input dojoType='dijit.form.ValidationTextBox' type='password' required='1' name='confirm_password'>"; + print "<input dojoType='dijit.form.ValidationTextBox' type='password' regexp='^[^<>]+' required='1' name='confirm_password'>"; print "</fieldset>"; print_hidden("op", "pref-prefs"); @@ -479,8 +483,8 @@ class Pref_Prefs extends Handler_Protected { if (function_exists("imagecreatefromstring")) { print "<h3>" . __("Scan the following code by the Authenticator application or copy the key manually") . "</h3>"; - $csrf_token = $_SESSION["csrf_token"]; - print "<img alt='otp qr-code' src='backend.php?op=pref-prefs&method=otpqrcode&csrf_token=$csrf_token'>"; + $csrf_token_hash = sha1($_SESSION["csrf_token"]); + print "<img alt='otp qr-code' src='backend.php?op=pref-prefs&method=otpqrcode&csrf_token_hash=$csrf_token_hash'>"; } else { print_error("PHP GD functions are required to generate QR codes."); print "<h3>" . __("Use the following OTP key with a compatible Authenticator application") . "</h3>"; @@ -586,9 +590,9 @@ class Pref_Prefs extends Handler_Protected { if ($profile) { print_notice(__("Some preferences are only available in default profile.")); - initialize_user_prefs($_SESSION["uid"], $profile); + $this->initialize_user_prefs($_SESSION["uid"], $profile); } else { - initialize_user_prefs($_SESSION["uid"]); + $this->initialize_user_prefs($_SESSION["uid"]); } $prefs_available = []; @@ -854,6 +858,10 @@ class Pref_Prefs extends Handler_Protected { print_warning("Your PHP configuration has open_basedir restrictions enabled. Some plugins relying on CURL for functionality may not work correctly."); } + if ($_SESSION["safe_mode"]) { + print_error("You have logged in using safe mode, no user plugins will be actually enabled until you login again."); + } + $feed_handler_whitelist = [ "Af_Comics" ]; $feed_handlers = array_merge( @@ -862,7 +870,7 @@ class Pref_Prefs extends Handler_Protected { PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FETCH_FEED)); $feed_handlers = array_filter($feed_handlers, function($plugin) use ($feed_handler_whitelist) { - return in_array(get_class($plugin), $feed_handler_whitelist) === FALSE; }); + return in_array(get_class($plugin), $feed_handler_whitelist) === false; }); if (count($feed_handlers) > 0) { print_error( @@ -1006,21 +1014,28 @@ class Pref_Prefs extends Handler_Protected { } function otpqrcode() { - require_once "lib/phpqrcode/phpqrcode.php"; + $csrf_token_hash = clean($_REQUEST["csrf_token_hash"]); - $sth = $this->pdo->prepare("SELECT login - FROM ttrss_users - WHERE id = ?"); - $sth->execute([$_SESSION['uid']]); + if (sha1($_SESSION["csrf_token"]) === $csrf_token_hash) { + require_once "lib/phpqrcode/phpqrcode.php"; - if ($row = $sth->fetch()) { - $secret = $this->otpsecret(); - $login = $row['login']; + $sth = $this->pdo->prepare("SELECT login + FROM ttrss_users + WHERE id = ?"); + $sth->execute([$_SESSION['uid']]); - if ($secret) { - QRcode::png("otpauth://totp/".urlencode($login). - "?secret=$secret&issuer=".urlencode("Tiny Tiny RSS")); + if ($row = $sth->fetch()) { + $secret = $this->otpsecret(); + $login = $row['login']; + + if ($secret) { + QRcode::png("otpauth://totp/".urlencode($login). + "?secret=$secret&issuer=".urlencode("Tiny Tiny RSS")); + } } + } else { + header("Content-Type: text/json"); + print error_json(6); } } @@ -1087,11 +1102,9 @@ class Pref_Prefs extends Handler_Protected { if ($row = $sth->fetch()) { $mailer = new Mailer(); - require_once "lib/MiniTemplator.class.php"; - - $tpl = new MiniTemplator; + $tpl = new Templator(); - $tpl->readTemplateFromFile("templates/otp_disabled_template.txt"); + $tpl->readTemplateFromFile("otp_disabled_template.txt"); $tpl->setVariable('LOGIN', $row["login"]); $tpl->setVariable('TTRSS_HOST', SELF_URL_PATH); @@ -1353,4 +1366,57 @@ class Pref_Prefs extends Handler_Protected { $this->appPasswordList(); } + + static function initialize_user_prefs($uid, $profile = false) { + + if (get_schema_version() < 63) $profile_qpart = ""; + + $pdo = Db::pdo(); + $in_nested_tr = false; + + try { + $pdo->beginTransaction(); + } catch (Exception $e) { + $in_nested_tr = true; + } + + $sth = $pdo->query("SELECT pref_name,def_value FROM ttrss_prefs"); + + if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null; + + $u_sth = $pdo->prepare("SELECT pref_name + FROM ttrss_user_prefs WHERE owner_uid = :uid AND + (profile = :profile OR (:profile IS NULL AND profile IS NULL))"); + $u_sth->execute([':uid' => $uid, ':profile' => $profile]); + + $active_prefs = array(); + + while ($line = $u_sth->fetch()) { + array_push($active_prefs, $line["pref_name"]); + } + + while ($line = $sth->fetch()) { + if (array_search($line["pref_name"], $active_prefs) === false) { +// print "adding " . $line["pref_name"] . "<br>"; + + if (get_schema_version() < 63) { + $i_sth = $pdo->prepare("INSERT INTO ttrss_user_prefs + (owner_uid,pref_name,value) VALUES + (?, ?, ?)"); + $i_sth->execute([$uid, $line["pref_name"], $line["def_value"]]); + + } else { + $i_sth = $pdo->prepare("INSERT INTO ttrss_user_prefs + (owner_uid,pref_name,value, profile) VALUES + (?, ?, ?, ?)"); + $i_sth->execute([$uid, $line["pref_name"], $line["def_value"], $profile]); + } + + } + } + + if (!$in_nested_tr) $pdo->commit(); + + } + } diff --git a/classes/pref/users.php b/classes/pref/users.php index 851d4fa9e..aeabc4502 100644 --- a/classes/pref/users.php +++ b/classes/pref/users.php @@ -259,7 +259,7 @@ class Pref_Users extends Handler_Protected { print T_sprintf("Added user %s with password %s", $login, $tmp_user_pwd); - initialize_user($new_uid); + $this->initialize_user($new_uid); } else { @@ -443,4 +443,25 @@ class Pref_Users extends Handler_Protected { return $default; } + // this is called after user is created to initialize default feeds, labels + // or whatever else + // user preferences are checked on every login, not here + static function initialize_user($uid) { + + $pdo = Db::pdo(); + + $sth = $pdo->prepare("insert into ttrss_feeds (owner_uid,title,feed_url) + values (?, 'Tiny Tiny RSS: Forum', + 'https://tt-rss.org/forum/rss.php')"); + $sth->execute([$uid]); + } + + static function logout_user() { + @session_destroy(); + if (isset($_COOKIE[session_name()])) { + setcookie(session_name(), '', time()-42000, '/'); + } + session_commit(); + } + } diff --git a/classes/rpc.php b/classes/rpc.php index 208551075..a7123566c 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -2,7 +2,7 @@ class RPC extends Handler_Protected { function csrf_ignore($method) { - $csrf_ignored = array("sanitycheck", "completelabels", "saveprofile"); + $csrf_ignored = array("completelabels", "saveprofile"); return array_search($method, $csrf_ignored) !== false; } @@ -52,7 +52,7 @@ class RPC extends Handler_Protected { $profile_id = $row['id']; if ($profile_id) { - initialize_user_prefs($_SESSION["uid"], $profile_id); + Pref_Prefs::initialize_user_prefs($_SESSION["uid"], $profile_id); } } } @@ -279,7 +279,7 @@ class RPC extends Handler_Protected { ]; if ($seq % 2 == 0) - $reply['runtime-info'] = make_runtime_info(); + $reply['runtime-info'] = $this->make_runtime_info(); print json_encode($reply); } @@ -323,8 +323,8 @@ class RPC extends Handler_Protected { $reply['error'] = sanity_check(); if ($reply['error']['code'] == 0) { - $reply['init-params'] = make_init_params(); - $reply['runtime-info'] = make_runtime_info(); + $reply['init-params'] = $this->make_init_params(); + $reply['runtime-info'] = $this->make_runtime_info(); } print json_encode($reply); @@ -436,7 +436,10 @@ class RPC extends Handler_Protected { ttrss_feeds.update_interval > 0 AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL) ) OR ttrss_feeds.last_updated IS NULL - OR last_updated = '1970-01-01 00:00:00')"; + OR ( + ttrss_feeds.update_interval > 0 + AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL) + ))"; } else { $update_limit_qpart = "AND (( ttrss_feeds.update_interval = 0 @@ -445,7 +448,10 @@ class RPC extends Handler_Protected { ttrss_feeds.update_interval > 0 AND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL ttrss_feeds.update_interval MINUTE) ) OR ttrss_feeds.last_updated IS NULL - OR last_updated = '1970-01-01 00:00:00')"; + OR ( + ttrss_feeds.update_interval > 0 + AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL) + ))"; } // Test if feed is currently being updated by another process. @@ -455,7 +461,7 @@ class RPC extends Handler_Protected { $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < DATE_SUB(NOW(), INTERVAL 5 MINUTE))"; } - $random_qpart = sql_random_function(); + $random_qpart = Db::sql_random_function(); $pdo = Db::pdo(); @@ -572,7 +578,7 @@ class RPC extends Handler_Protected { function log() { $msg = clean($_REQUEST['msg']); - $file = clean_filename($_REQUEST['file']); + $file = basename(clean($_REQUEST['file'])); $line = (int) clean($_REQUEST['line']); $context = clean($_REQUEST['context']); @@ -596,7 +602,7 @@ class RPC extends Handler_Protected { get_version($git_commit, $git_timestamp); if (defined('CHECK_FOR_UPDATES') && CHECK_FOR_UPDATES && $_SESSION["access_level"] >= 10 && $git_timestamp) { - $content = @fetch_file_contents(["url" => "https://srv.tt-rss.org/version.json"]); + $content = @UrlHelper::fetch(["url" => "https://tt-rss.org/version.json"]); if ($content) { $content = json_decode($content, true); @@ -614,4 +620,292 @@ class RPC extends Handler_Protected { print json_encode($rv); } + private function make_init_params() { + $params = array(); + + foreach (array("ON_CATCHUP_SHOW_NEXT_FEED", "HIDE_READ_FEEDS", + "ENABLE_FEED_CATS", "FEEDS_SORT_BY_UNREAD", "CONFIRM_FEED_CATCHUP", + "CDM_AUTO_CATCHUP", "FRESH_ARTICLE_MAX_AGE", + "HIDE_READ_SHOWS_SPECIAL", "COMBINED_DISPLAY_MODE") as $param) { + + $params[strtolower($param)] = (int) get_pref($param); + } + + $params["check_for_updates"] = CHECK_FOR_UPDATES; + $params["icons_url"] = ICONS_URL; + $params["cookie_lifetime"] = SESSION_COOKIE_LIFETIME; + $params["default_view_mode"] = get_pref("_DEFAULT_VIEW_MODE"); + $params["default_view_limit"] = (int) get_pref("_DEFAULT_VIEW_LIMIT"); + $params["default_view_order_by"] = get_pref("_DEFAULT_VIEW_ORDER_BY"); + $params["bw_limit"] = (int) $_SESSION["bw_limit"]; + $params["is_default_pw"] = Pref_Prefs::isdefaultpassword(); + $params["label_base_index"] = (int) LABEL_BASE_INDEX; + + $theme = get_pref( "USER_CSS_THEME", false, false); + $params["theme"] = theme_exists($theme) ? $theme : ""; + + $params["plugins"] = implode(", ", PluginHost::getInstance()->get_plugin_names()); + + $params["php_platform"] = PHP_OS; + $params["php_version"] = PHP_VERSION; + + $params["sanity_checksum"] = sha1(file_get_contents("include/sanity_check.php")); + + $pdo = Db::pdo(); + + $sth = $pdo->prepare("SELECT MAX(id) AS mid, COUNT(*) AS nf FROM + ttrss_feeds WHERE owner_uid = ?"); + $sth->execute([$_SESSION['uid']]); + $row = $sth->fetch(); + + $max_feed_id = $row["mid"]; + $num_feeds = $row["nf"]; + + $params["self_url_prefix"] = get_self_url_prefix(); + $params["max_feed_id"] = (int) $max_feed_id; + $params["num_feeds"] = (int) $num_feeds; + + $params["hotkeys"] = $this->get_hotkeys_map(); + + $params["widescreen"] = (int) $_COOKIE["ttrss_widescreen"]; + + $params['simple_update'] = defined('SIMPLE_UPDATE_MODE') && SIMPLE_UPDATE_MODE; + + $params["icon_indicator_white"] = $this->image_to_base64("images/indicator_white.gif"); + + $params["labels"] = Labels::get_all_labels($_SESSION["uid"]); + + return $params; + } + + private function image_to_base64($filename) { + if (file_exists($filename)) { + $ext = pathinfo($filename, PATHINFO_EXTENSION); + + return "data:image/$ext;base64," . base64_encode(file_get_contents($filename)); + } else { + return ""; + } + } + + static function make_runtime_info() { + $data = array(); + + $pdo = Db::pdo(); + + $sth = $pdo->prepare("SELECT MAX(id) AS mid, COUNT(*) AS nf FROM + ttrss_feeds WHERE owner_uid = ?"); + $sth->execute([$_SESSION['uid']]); + $row = $sth->fetch(); + + $max_feed_id = $row['mid']; + $num_feeds = $row['nf']; + + $data["max_feed_id"] = (int) $max_feed_id; + $data["num_feeds"] = (int) $num_feeds; + $data['cdm_expanded'] = get_pref('CDM_EXPANDED'); + $data["labels"] = Labels::get_all_labels($_SESSION["uid"]); + + if (LOG_DESTINATION == 'sql' && $_SESSION['access_level'] >= 10) { + if (DB_TYPE == 'pgsql') { + $log_interval = "created_at > NOW() - interval '1 hour'"; + } else { + $log_interval = "created_at > DATE_SUB(NOW(), INTERVAL 1 HOUR)"; + } + + $sth = $pdo->prepare("SELECT COUNT(id) AS cid FROM ttrss_error_log WHERE $log_interval"); + $sth->execute(); + + if ($row = $sth->fetch()) { + $data['recent_log_events'] = $row['cid']; + } + } + + if (file_exists(LOCK_DIRECTORY . "/update_daemon.lock")) { + + $data['daemon_is_running'] = (int) file_is_locked("update_daemon.lock"); + + if (time() - $_SESSION["daemon_stamp_check"] > 30) { + + $stamp = (int) @file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); + + if ($stamp) { + $stamp_delta = time() - $stamp; + + if ($stamp_delta > 1800) { + $stamp_check = 0; + } else { + $stamp_check = 1; + $_SESSION["daemon_stamp_check"] = time(); + } + + $data['daemon_stamp_ok'] = $stamp_check; + + $stamp_fmt = date("Y.m.d, G:i", $stamp); + + $data['daemon_stamp'] = $stamp_fmt; + } + } + } + + return $data; + } + + static function get_hotkeys_info() { + $hotkeys = array( + __("Navigation") => array( + "next_feed" => __("Open next feed"), + "prev_feed" => __("Open previous feed"), + "next_article_or_scroll" => __("Open next article (in combined mode, scroll down)"), + "prev_article_or_scroll" => __("Open previous article (in combined mode, scroll up)"), + "next_headlines_page" => __("Scroll headlines by one page down"), + "prev_headlines_page" => __("Scroll headlines by one page up"), + "next_article_noscroll" => __("Open next article"), + "prev_article_noscroll" => __("Open previous article"), + "next_article_noexpand" => __("Move to next article (don't expand)"), + "prev_article_noexpand" => __("Move to previous article (don't expand)"), + "search_dialog" => __("Show search dialog"), + "cancel_search" => __("Cancel active search")), + __("Article") => array( + "toggle_mark" => __("Toggle starred"), + "toggle_publ" => __("Toggle published"), + "toggle_unread" => __("Toggle unread"), + "edit_tags" => __("Edit tags"), + "open_in_new_window" => __("Open in new window"), + "catchup_below" => __("Mark below as read"), + "catchup_above" => __("Mark above as read"), + "article_scroll_down" => __("Scroll down"), + "article_scroll_up" => __("Scroll up"), + "article_page_down" => __("Scroll down page"), + "article_page_up" => __("Scroll up page"), + "select_article_cursor" => __("Select article under cursor"), + "email_article" => __("Email article"), + "close_article" => __("Close/collapse article"), + "toggle_expand" => __("Toggle article expansion (combined mode)"), + "toggle_widescreen" => __("Toggle widescreen mode"), + "toggle_full_text" => __("Toggle full article text via Readability")), + __("Article selection") => array( + "select_all" => __("Select all articles"), + "select_unread" => __("Select unread"), + "select_marked" => __("Select starred"), + "select_published" => __("Select published"), + "select_invert" => __("Invert selection"), + "select_none" => __("Deselect everything")), + __("Feed") => array( + "feed_refresh" => __("Refresh current feed"), + "feed_unhide_read" => __("Un/hide read feeds"), + "feed_subscribe" => __("Subscribe to feed"), + "feed_edit" => __("Edit feed"), + "feed_catchup" => __("Mark as read"), + "feed_reverse" => __("Reverse headlines"), + "feed_toggle_vgroup" => __("Toggle headline grouping"), + "feed_debug_update" => __("Debug feed update"), + "feed_debug_viewfeed" => __("Debug viewfeed()"), + "catchup_all" => __("Mark all feeds as read"), + "cat_toggle_collapse" => __("Un/collapse current category"), + "toggle_cdm_expanded" => __("Toggle auto expand in combined mode"), + "toggle_combined_mode" => __("Toggle combined mode")), + __("Go to") => array( + "goto_all" => __("All articles"), + "goto_fresh" => __("Fresh"), + "goto_marked" => __("Starred"), + "goto_published" => __("Published"), + "goto_read" => __("Recently read"), + "goto_tagcloud" => __("Tag cloud"), + "goto_prefs" => __("Preferences")), + __("Other") => array( + "create_label" => __("Create label"), + "create_filter" => __("Create filter"), + "collapse_sidebar" => __("Un/collapse sidebar"), + "help_dialog" => __("Show help dialog")) + ); + + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HOTKEY_INFO) as $plugin) { + $hotkeys = $plugin->hook_hotkey_info($hotkeys); + } + + return $hotkeys; + } + + // {3} - 3 panel mode only + // {C} - combined mode only + static function get_hotkeys_map() { + $hotkeys = array( + "k" => "next_feed", + "j" => "prev_feed", + "n" => "next_article_noscroll", + "p" => "prev_article_noscroll", + "N" => "article_page_down", + "P" => "article_page_up", + "*(33)|Shift+PgUp" => "article_page_up", + "*(34)|Shift+PgDn" => "article_page_down", + "{3}(38)|Up" => "prev_article_or_scroll", + "{3}(40)|Down" => "next_article_or_scroll", + "*(38)|Shift+Up" => "article_scroll_up", + "*(40)|Shift+Down" => "article_scroll_down", + "^(38)|Ctrl+Up" => "prev_article_noscroll", + "^(40)|Ctrl+Down" => "next_article_noscroll", + "/" => "search_dialog", + "\\" => "cancel_search", + "s" => "toggle_mark", + "S" => "toggle_publ", + "u" => "toggle_unread", + "T" => "edit_tags", + "o" => "open_in_new_window", + "c p" => "catchup_below", + "c n" => "catchup_above", + "a W" => "toggle_widescreen", + "a e" => "toggle_full_text", + "e" => "email_article", + "a q" => "close_article", + "a a" => "select_all", + "a u" => "select_unread", + "a U" => "select_marked", + "a p" => "select_published", + "a i" => "select_invert", + "a n" => "select_none", + "f r" => "feed_refresh", + "f a" => "feed_unhide_read", + "f s" => "feed_subscribe", + "f e" => "feed_edit", + "f q" => "feed_catchup", + "f x" => "feed_reverse", + "f g" => "feed_toggle_vgroup", + "f D" => "feed_debug_update", + "f G" => "feed_debug_viewfeed", + "f C" => "toggle_combined_mode", + "f c" => "toggle_cdm_expanded", + "Q" => "catchup_all", + "x" => "cat_toggle_collapse", + "g a" => "goto_all", + "g f" => "goto_fresh", + "g s" => "goto_marked", + "g p" => "goto_published", + "g r" => "goto_read", + "g t" => "goto_tagcloud", + "g P" => "goto_prefs", + "r" => "select_article_cursor", + "c l" => "create_label", + "c f" => "create_filter", + "c s" => "collapse_sidebar", + "?" => "help_dialog", + ); + + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HOTKEY_MAP) as $plugin) { + $hotkeys = $plugin->hook_hotkey_map($hotkeys); + } + + $prefixes = array(); + + foreach (array_keys($hotkeys) as $hotkey) { + $pair = explode(" ", $hotkey, 2); + + if (count($pair) > 1 && !in_array($pair[0], $prefixes)) { + array_push($prefixes, $pair[0]); + } + } + + return array($prefixes, $hotkeys); + } + } diff --git a/classes/rssutils.php b/classes/rssutils.php index 831ac1baf..14a0a18a7 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -3,7 +3,12 @@ class RSSUtils { static function calculate_article_hash($article, $pluginhost) { $tmp = ""; + $ignored_fields = [ "feed", "guid", "guid_hashed", "owner_uid", "force_catchup" ]; + foreach ($article as $k => $v) { + if (in_array($k, $ignored_fields)) + continue; + if ($k != "feed" && isset($v)) { $x = strip_tags(is_array($v) ? implode(",", $v) : $v); @@ -52,8 +57,10 @@ class RSSUtils { ttrss_feeds.update_interval > 0 AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL) ) OR (ttrss_feeds.last_updated IS NULL + AND ttrss_feeds.update_interval > 0 AND ttrss_user_prefs.value != '-1') OR (last_updated = '1970-01-01 00:00:00' + AND ttrss_feeds.update_interval > 0 AND ttrss_user_prefs.value != '-1'))"; } else { $update_limit_qpart = "AND (( @@ -64,8 +71,10 @@ class RSSUtils { ttrss_feeds.update_interval > 0 AND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL ttrss_feeds.update_interval MINUTE) ) OR (ttrss_feeds.last_updated IS NULL + AND ttrss_feeds.update_interval > 0 AND ttrss_user_prefs.value != '-1') OR (last_updated = '1970-01-01 00:00:00' + AND ttrss_feeds.update_interval > 0 AND ttrss_user_prefs.value != '-1'))"; } @@ -139,7 +148,7 @@ class RSSUtils { if ($tline = $usth->fetch()) { Debug::log(" => " . $tline["last_updated"] . ", " . $tline["id"] . " " . $tline["owner_uid"]); - if (array_search($tline["owner_uid"], $batch_owners) === FALSE) + if (array_search($tline["owner_uid"], $batch_owners) === false) array_push($batch_owners, $tline["owner_uid"]); $fstarted = microtime(true); @@ -209,7 +218,7 @@ class RSSUtils { } if (!$basic_info) { - $feed_data = fetch_file_contents($fetch_url, false, + $feed_data = UrlHelper::fetch($fetch_url, false, $auth_login, $auth_pass, false, FEED_FETCH_TIMEOUT, 0); @@ -259,8 +268,6 @@ class RSSUtils { */ static function update_rss_feed($feed, $no_cache = false) { - reset_fetch_domain_quota(); - Debug::log("start", Debug::$LOG_VERBOSE); $pdo = Db::pdo(); @@ -391,7 +398,7 @@ class RSSUtils { Debug::log("fetching [$fetch_url] (force_refetch: $force_refetch)...", Debug::$LOG_VERBOSE); - $feed_data = fetch_file_contents([ + $feed_data = UrlHelper::fetch([ "url" => $fetch_url, "login" => $auth_login, "pass" => $auth_pass, @@ -401,7 +408,11 @@ class RSSUtils { $feed_data = trim($feed_data); + global $fetch_effective_url; + global $fetch_effective_ip_addr; + Debug::log("fetch done.", Debug::$LOG_VERBOSE); + Debug::log("effective URL (after redirects): " . clean($fetch_effective_url) . " (IP: $fetch_effective_ip_addr)", Debug::$LOG_VERBOSE); Debug::log("source last modified: " . $fetch_last_modified, Debug::$LOG_VERBOSE); if ($feed_data && $fetch_last_modified != $stored_last_modified) { @@ -469,7 +480,7 @@ class RSSUtils { foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_PARSED) as $plugin) { Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); $start = microtime(true); - $plugin->hook_feed_parsed($rss); + $plugin->hook_feed_parsed($rss, $feed); Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); } @@ -586,11 +597,11 @@ class RSSUtils { continue; } + $entry_guid_hashed_compat = 'SHA1:' . sha1("$owner_uid,$entry_guid"); + $entry_guid_hashed = json_encode(["ver" => 2, "uid" => $owner_uid, "hash" => 'SHA1:' . sha1($entry_guid)]); $entry_guid = "$owner_uid,$entry_guid"; - $entry_guid_hashed = 'SHA1:' . sha1($entry_guid); - - Debug::log("guid $entry_guid / $entry_guid_hashed", Debug::$LOG_VERBOSE); + Debug::log("guid $entry_guid (hash: $entry_guid_hashed compat: $entry_guid_hashed_compat)", Debug::$LOG_VERBOSE); $entry_timestamp = (int)$item->get_date(); @@ -632,8 +643,8 @@ class RSSUtils { Debug::log("done collecting data.", Debug::$LOG_VERBOSE); $sth = $pdo->prepare("SELECT id, content_hash, lang FROM ttrss_entries - WHERE guid = ? OR guid = ?"); - $sth->execute([$entry_guid, $entry_guid_hashed]); + WHERE guid IN (?, ?, ?)"); + $sth->execute([$entry_guid, $entry_guid_hashed, $entry_guid_hashed_compat]); if ($row = $sth->fetch()) { $base_entry_id = $row["id"]; @@ -648,6 +659,38 @@ class RSSUtils { $article_labels = array(); } + Debug::log("looking for enclosures...", Debug::$LOG_VERBOSE); + + // enclosures + + $enclosures = array(); + + $encs = $item->get_enclosures(); + + if (is_array($encs)) { + foreach ($encs as $e) { + + foreach ($pluginhost->get_hooks(PluginHost::HOOK_ENCLOSURE_IMPORTED) as $plugin) { + $e = $plugin->hook_enclosure_imported($e, $feed); + } + + $e_item = array( + rewrite_relative_url($site_url, $e->link), + $e->type, $e->length, $e->title, $e->width, $e->height); + + // Yet another episode of "mysql utf8_general_ci is gimped" + if (DB_TYPE == "mysql" && MYSQL_CHARSET != "UTF8MB4") { + 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); + } + } + $article = array("owner_uid" => $owner_uid, // read only "guid" => $entry_guid, // read only "guid_hashed" => $entry_guid_hashed, // read only @@ -662,6 +705,7 @@ class RSSUtils { "language" => $entry_language, "timestamp" => $entry_timestamp, "num_comments" => $num_comments, + "enclosures" => $enclosures, "feed" => array("id" => $feed, "fetch_url" => $fetch_url, "site_url" => $site_url, @@ -804,6 +848,7 @@ class RSSUtils { $entry_language = $article["language"]; $entry_timestamp = $article["timestamp"]; $num_comments = $article["num_comments"]; + $enclosures = $article["enclosures"]; if ($entry_timestamp == -1 || !$entry_timestamp || $entry_timestamp > time()) { $entry_timestamp = time(); @@ -828,8 +873,8 @@ class RSSUtils { RSSUtils::cache_media($entry_content, $site_url); $csth = $pdo->prepare("SELECT id FROM ttrss_entries - WHERE guid = ? OR guid = ?"); - $csth->execute([$entry_guid, $entry_guid_hashed]); + WHERE guid IN (?, ?, ?)"); + $csth->execute([$entry_guid, $entry_guid_hashed, $entry_guid_hashed_compat]); if (!$row = $csth->fetch()) { @@ -874,7 +919,7 @@ class RSSUtils { } - $csth->execute([$entry_guid, $entry_guid_hashed]); + $csth->execute([$entry_guid, $entry_guid_hashed, $entry_guid_hashed_compat]); $entry_ref_id = 0; $entry_int_id = 0; @@ -1022,33 +1067,6 @@ class RSSUtils { RSSUtils::assign_article_to_label_filters($entry_ref_id, $article_filters, $owner_uid, $article_labels); - Debug::log("looking for enclosures...", Debug::$LOG_VERBOSE); - - // enclosures - - $enclosures = array(); - - $encs = $item->get_enclosures(); - - if (is_array($encs)) { - foreach ($encs as $e) { - $e_item = array( - rewrite_relative_url($site_url, $e->link), - $e->type, $e->length, $e->title, $e->width, $e->height); - - // Yet another episode of "mysql utf8_general_ci is gimped" - if (DB_TYPE == "mysql" && MYSQL_CHARSET != "UTF8MB4") { - 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); - } - } - if ($cache_images) RSSUtils::cache_enclosures($enclosures, $site_url); @@ -1186,6 +1204,7 @@ class RSSUtils { return true; } + /* TODO: move to DiskCache? */ static function cache_enclosures($enclosures, $site_url) { $cache = new DiskCache("images"); @@ -1204,7 +1223,7 @@ class RSSUtils { global $fetch_last_error_code; global $fetch_last_error; - $file_content = fetch_file_contents(array("url" => $src, + $file_content = UrlHelper::fetch(array("url" => $src, "http_referrer" => $src, "max_size" => MAX_CACHE_FILE_SIZE)); @@ -1221,6 +1240,34 @@ class RSSUtils { } } + /* TODO: move to DiskCache? */ + static function cache_media_url($cache, $url, $site_url) { + $url = rewrite_relative_url($site_url, $url); + $local_filename = sha1($url); + + Debug::log("cache_media: checking $url", Debug::$LOG_VERBOSE); + + if (!$cache->exists($local_filename)) { + Debug::log("cache_media: downloading: $url to $local_filename", Debug::$LOG_VERBOSE); + + global $fetch_last_error_code; + global $fetch_last_error; + + $file_content = UrlHelper::fetch(array("url" => $url, + "http_referrer" => $url, + "max_size" => MAX_CACHE_FILE_SIZE)); + + if ($file_content) { + $cache->put($local_filename, $file_content); + } else { + Debug::log("cache_media: failed with $fetch_last_error_code: $fetch_last_error"); + } + } else if ($cache->isWritable($local_filename)) { + $cache->touch($local_filename); + } + } + + /* TODO: move to DiskCache? */ static function cache_media($html, $site_url) { $cache = new DiskCache("images"); @@ -1229,33 +1276,20 @@ class RSSUtils { if ($doc->loadHTML($html)) { $xpath = new DOMXPath($doc); - $entries = $xpath->query('(//img[@src])|(//video/source[@src])|(//audio/source[@src])'); + $entries = $xpath->query('(//img[@src]|//source[@src|@srcset]|//video[@poster|@src])'); foreach ($entries as $entry) { - if ($entry->hasAttribute('src') && strpos($entry->getAttribute('src'), "data:") !== 0) { - $src = rewrite_relative_url($site_url, $entry->getAttribute('src')); - - $local_filename = sha1($src); - - Debug::log("cache_media: checking $src", Debug::$LOG_VERBOSE); - - if (!$cache->exists($local_filename)) { - Debug::log("cache_media: downloading: $src to $local_filename", Debug::$LOG_VERBOSE); - - global $fetch_last_error_code; - global $fetch_last_error; + foreach (array('src', 'poster') as $attr) { + if ($entry->hasAttribute($attr) && strpos($entry->getAttribute($attr), "data:") !== 0) { + RSSUtils::cache_media_url($cache, $entry->getAttribute($attr), $site_url); + } + } - $file_content = fetch_file_contents(array("url" => $src, - "http_referrer" => $src, - "max_size" => MAX_CACHE_FILE_SIZE)); + if ($entry->hasAttribute("srcset")) { + $matches = RSSUtils::decode_srcset($entry->getAttribute('srcset')); - if ($file_content) { - $cache->put($local_filename, $file_content); - } else { - Debug::log("cache_media: failed with $fetch_last_error_code: $fetch_last_error"); - } - } else if ($cache->isWritable($local_filename)) { - $cache->touch($local_filename); + for ($i = 0; $i < count($matches); $i++) { + RSSUtils::cache_media_url($cache, $matches[$i]["url"], $site_url); } } } @@ -1343,6 +1377,7 @@ class RSSUtils { foreach ($filter["rules"] as $rule) { $match = false; $reg_exp = str_replace('/', '\/', $rule["reg_exp"]); + $reg_exp = str_replace("\n", "", $reg_exp); // reg_exp may be formatted with CRs now because of textarea, we need to strip those $rule_inverse = $rule["inverse"]; if (!$reg_exp) @@ -1480,7 +1515,7 @@ class RSSUtils { static function housekeeping_user($owner_uid) { $tmph = new PluginHost(); - load_user_plugins($owner_uid, $tmph); + UserHelper::load_user_plugins($owner_uid, $tmph); $tmph->run_hooks(PluginHost::HOOK_HOUSE_KEEPING, "hook_house_keeping", ""); } @@ -1509,7 +1544,7 @@ class RSSUtils { if ($favicon_url) { // Limiting to "image" type misses those served with text/plain - $contents = fetch_file_contents($favicon_url); // , "image"); + $contents = UrlHelper::fetch($favicon_url); // , "image"); if ($contents) { // Crude image type matching. @@ -1682,7 +1717,7 @@ class RSSUtils { $favicon_url = false; - if ($html = @fetch_file_contents($url)) { + if ($html = @UrlHelper::fetch($url)) { $doc = new DOMDocument(); if ($doc->loadHTML($html)) { @@ -1710,4 +1745,32 @@ class RSSUtils { return $favicon_url; } + // https://community.tt-rss.org/t/problem-with-img-srcset/3519 + static function decode_srcset($srcset) { + $matches = []; + + preg_match_all( + '/(?:\A|,)\s*(?P<url>(?!,)\S+(?<!,))\s*(?P<size>\s\d+w|\s\d+(?:\.\d+)?(?:[eE][+-]?\d+)?x|)\s*(?=,|\Z)/', + $srcset, $matches, PREG_SET_ORDER + ); + + foreach ($matches as $m) { + array_push($matches, [ + "url" => trim($m["url"]), + "size" => trim($m["size"]) + ]); + } + + return $matches; + } + + static function encode_srcset($matches) { + $tokens = []; + + foreach ($matches as $m) { + array_push($tokens, trim($m["url"]) . " " . trim($m["size"])); + } + + return implode(",", $tokens); + } } diff --git a/classes/sanitizer.php b/classes/sanitizer.php new file mode 100644 index 000000000..8e008ef85 --- /dev/null +++ b/classes/sanitizer.php @@ -0,0 +1,217 @@ +<?php +class Sanitizer { + private static function strip_harmful_tags($doc, $allowed_elements, $disallowed_attributes) { + $xpath = new DOMXPath($doc); + $entries = $xpath->query('//*'); + + foreach ($entries as $entry) { + if (!in_array($entry->nodeName, $allowed_elements)) { + $entry->parentNode->removeChild($entry); + } + + if ($entry->hasAttributes()) { + $attrs_to_remove = array(); + + foreach ($entry->attributes as $attr) { + + if (strpos($attr->nodeName, 'on') === 0) { + array_push($attrs_to_remove, $attr); + } + + if (strpos($attr->nodeName, "data-") === 0) { + array_push($attrs_to_remove, $attr); + } + + if ($attr->nodeName == 'href' && stripos($attr->value, 'javascript:') === 0) { + array_push($attrs_to_remove, $attr); + } + + if (in_array($attr->nodeName, $disallowed_attributes)) { + array_push($attrs_to_remove, $attr); + } + } + + foreach ($attrs_to_remove as $attr) { + $entry->removeAttributeNode($attr); + } + } + } + + return $doc; + } + + public static function iframe_whitelisted($entry) { + @$src = parse_url($entry->getAttribute("src"), PHP_URL_HOST); + + if ($src) { + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_IFRAME_WHITELISTED) as $plugin) { + if ($plugin->hook_iframe_whitelisted($src)) + return true; + } + } + + return false; + } + + public static function sanitize($str, $force_remove_images = false, $owner = false, $site_url = false, $highlight_words = false, $article_id = false) { + if (!$owner) $owner = $_SESSION["uid"]; + + $res = trim($str); if (!$res) return ''; + + $doc = new DOMDocument(); + $doc->loadHTML('<?xml encoding="UTF-8">' . $res); + $xpath = new DOMXPath($doc); + + $rewrite_base_url = $site_url ? $site_url : get_self_url_prefix(); + + $entries = $xpath->query('(//a[@href]|//img[@src]|//source[@srcset|@src])'); + + foreach ($entries as $entry) { + + if ($entry->hasAttribute('href')) { + $entry->setAttribute('href', + rewrite_relative_url($rewrite_base_url, $entry->getAttribute('href'))); + + $entry->setAttribute('rel', 'noopener noreferrer'); + $entry->setAttribute("target", "_blank"); + } + + if ($entry->hasAttribute('src')) { + $entry->setAttribute('src', + rewrite_relative_url($rewrite_base_url, $entry->getAttribute('src'))); + } + + if ($entry->nodeName == 'img') { + $entry->setAttribute('referrerpolicy', 'no-referrer'); + $entry->setAttribute('loading', 'lazy'); + } + + if ($entry->hasAttribute('srcset')) { + $matches = RSSUtils::decode_srcset($entry->getAttribute('srcset')); + + for ($i = 0; $i < count($matches); $i++) { + $matches[$i]["url"] = rewrite_relative_url($rewrite_base_url, $matches[$i]["url"]); + } + + $entry->setAttribute("srcset", RSSUtils::encode_srcset($matches)); + } + + if ($entry->hasAttribute('src') && + ($owner && get_pref("STRIP_IMAGES", $owner)) || $force_remove_images || $_SESSION["bw_limit"]) { + + $p = $doc->createElement('p'); + + $a = $doc->createElement('a'); + $a->setAttribute('href', $entry->getAttribute('src')); + + $a->appendChild(new DOMText($entry->getAttribute('src'))); + $a->setAttribute('target', '_blank'); + $a->setAttribute('rel', 'noopener noreferrer'); + + $p->appendChild($a); + + if ($entry->nodeName == 'source') { + + if ($entry->parentNode && $entry->parentNode->parentNode) + $entry->parentNode->parentNode->replaceChild($p, $entry->parentNode); + + } else if ($entry->nodeName == 'img') { + if ($entry->parentNode) + $entry->parentNode->replaceChild($p, $entry); + } + } + } + + $entries = $xpath->query('//iframe'); + foreach ($entries as $entry) { + if (!Sanitizer::iframe_whitelisted($entry)) { + $entry->setAttribute('sandbox', 'allow-scripts'); + } else { + if (is_prefix_https()) { + $entry->setAttribute("src", + str_replace("http://", "https://", + $entry->getAttribute("src"))); + } + } + } + + $allowed_elements = array('a', 'abbr', 'address', 'acronym', 'audio', 'article', 'aside', + 'b', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', + 'caption', 'cite', 'center', 'code', 'col', 'colgroup', + 'data', 'dd', 'del', 'details', 'description', 'dfn', 'div', 'dl', 'font', + 'dt', 'em', 'footer', 'figure', 'figcaption', + 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'html', 'i', + 'img', 'ins', 'kbd', 'li', 'main', 'mark', 'nav', 'noscript', + 'ol', 'p', 'picture', 'pre', 'q', 'ruby', 'rp', 'rt', 's', 'samp', 'section', + 'small', 'source', 'span', 'strike', 'strong', 'sub', 'summary', + 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'time', + 'tr', 'track', 'tt', 'u', 'ul', 'var', 'wbr', 'video', 'xml:namespace' ); + + if ($_SESSION['hasSandbox']) $allowed_elements[] = 'iframe'; + + $disallowed_attributes = array('id', 'style', 'class', 'width', 'height', 'allow'); + + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SANITIZE) as $plugin) { + $retval = $plugin->hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes, $article_id); + if (is_array($retval)) { + $doc = $retval[0]; + $allowed_elements = $retval[1]; + $disallowed_attributes = $retval[2]; + } else { + $doc = $retval; + } + } + + $doc->removeChild($doc->firstChild); //remove doctype + $doc = Sanitizer::strip_harmful_tags($doc, $allowed_elements, $disallowed_attributes); + + $entries = $xpath->query('//iframe'); + foreach ($entries as $entry) { + $div = $doc->createElement('div'); + $div->setAttribute('class', 'embed-responsive'); + $entry->parentNode->replaceChild($div, $entry); + $div->appendChild($entry); + } + + if ($highlight_words && is_array($highlight_words)) { + foreach ($highlight_words as $word) { + + // http://stackoverflow.com/questions/4081372/highlight-keywords-in-a-paragraph + + $elements = $xpath->query("//*/text()"); + + foreach ($elements as $child) { + + $fragment = $doc->createDocumentFragment(); + $text = $child->textContent; + + while (($pos = mb_stripos($text, $word)) !== false) { + $fragment->appendChild(new DomText(mb_substr($text, 0, $pos))); + $word = mb_substr($text, $pos, mb_strlen($word)); + $highlight = $doc->createElement('span'); + $highlight->appendChild(new DomText($word)); + $highlight->setAttribute('class', 'highlight'); + $fragment->appendChild($highlight); + $text = mb_substr($text, $pos + mb_strlen($word)); + } + + if (!empty($text)) $fragment->appendChild(new DomText($text)); + + $child->parentNode->replaceChild($fragment, $child); + } + } + } + + $res = $doc->saveHTML(); + + /* strip everything outside of <body>...</body> */ + + $res_frag = array(); + if (preg_match('/<body>(.*)<\/body>/is', $res, $res_frag)) { + return $res_frag[1]; + } else { + return $res; + } + } + +} diff --git a/classes/templator.php b/classes/templator.php new file mode 100644 index 000000000..b682f8b82 --- /dev/null +++ b/classes/templator.php @@ -0,0 +1,21 @@ +<?php +require_once "lib/MiniTemplator.class.php"; + +class Templator extends MiniTemplator { + + /* this reads tt-rss template from templates.local/ or templates/ if only base filename is given */ + function readTemplateFromFile ($fileName) { + if (strpos($fileName, "/") === false) { + + $fileName = basename($fileName); + + if (file_exists("templates.local/$fileName")) + return parent::readTemplateFromFile("templates.local/$fileName"); + else + return parent::readTemplateFromFile("templates/$fileName"); + + } else { + return parent::readTemplateFromFile($fileName); + } + } +} diff --git a/classes/urlhelper.php b/classes/urlhelper.php new file mode 100644 index 000000000..a83d10a5b --- /dev/null +++ b/classes/urlhelper.php @@ -0,0 +1,474 @@ +<?php +class UrlHelper { + static function build_url($parts) { + $tmp = $parts['scheme'] . "://" . $parts['host'] . $parts['path']; + + if (isset($parts['query'])) $tmp .= '?' . $parts['query']; + if (isset($parts['fragment'])) $tmp .= '#' . $parts['fragment']; + + return $tmp; + } + + /** + * Converts a (possibly) relative URL to a absolute one. + * + * @param string $url Base URL (i.e. from where the document is) + * @param string $rel_url Possibly relative URL in the document + * + * @return string Absolute URL + */ + public static function rewrite_relative($url, $rel_url) { + + $rel_parts = parse_url($rel_url); + + if ($rel_parts['host'] && $rel_parts['scheme']) { + return UrlHelper::validate($rel_url); + } else if (strpos($rel_url, "//") === 0) { + # protocol-relative URL (rare but they exist) + return UrlHelper::validate("https:" . $rel_url); + } else if (strpos($rel_url, "magnet:") === 0) { + # allow magnet links + return $rel_url; + } else { + $parts = parse_url($url); + + $rel_parts['host'] = $parts['host']; + $rel_parts['scheme'] = $parts['scheme']; + + 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 UrlHelper::validate(UrlHelper::build_url($rel_parts)); + } + } + + // extended filtering involves validation for safe ports and loopback + static function validate($url, $extended_filtering = false) { + + $url = clean($url); + + # fix protocol-relative URLs + if (strpos($url, "//") === 0) + $url = "https:" . $url; + + if (filter_var($url, FILTER_VALIDATE_URL) === false) + return false; + + $tokens = parse_url($url); + + if (!$tokens['host']) + return false; + + if (!in_array(strtolower($tokens['scheme']), ['http', 'https'])) + return false; + + if ($extended_filtering) { + if (!in_array($tokens['port'], [80, 443, ''])) + return false; + + if (strtolower($tokens['host']) == 'localhost' || $tokens['host'] == '::1' || strpos($tokens['host'], '127.') === 0) + return false; + } + + //convert IDNA hostname to punycode if possible + if (function_exists("idn_to_ascii")) { + if (mb_detect_encoding($tokens['host']) != 'ASCII') { + $parts['host'] = idn_to_ascii($tokens['host']); + $url = UrlHelper::build_url($tokens); + } + } + + return $url; + } + + static function resolve_redirects($url, $timeout, $nest = 0) { + + // too many redirects + if ($nest > 10) + return false; + + if (version_compare(PHP_VERSION, '7.1.0', '>=')) { + $context_options = array( + 'http' => array( + 'header' => array( + 'Connection: close' + ), + 'method' => 'HEAD', + 'timeout' => $timeout, + 'protocol_version'=> 1.1) + ); + + if (defined('_HTTP_PROXY')) { + $context_options['http']['request_fulluri'] = true; + $context_options['http']['proxy'] = _HTTP_PROXY; + } + + $context = stream_context_create($context_options); + + $headers = get_headers($url, 0, $context); + } else { + $headers = get_headers($url, 0); + } + + if (is_array($headers)) { + $headers = array_reverse($headers); // last one is the correct one + + foreach($headers as $header) { + if (stripos($header, 'Location:') === 0) { + $url = UrlHelper::rewrite_relative($url, trim(substr($header, strlen('Location:')))); + + return UrlHelper::resolve_redirects($url, $timeout, $nest + 1); + } + } + + return $url; + } + + // request failed? + return false; + } + + // TODO: max_size currently only works for CURL transfers + // TODO: multiple-argument way is deprecated, first parameter is a hash now + public static function fetch($options /* previously: 0: $url , 1: $type = false, 2: $login = false, 3: $pass = false, + 4: $post_query = false, 5: $timeout = false, 6: $timestamp = 0, 7: $useragent = false*/) { + + global $fetch_last_error; + global $fetch_last_error_code; + global $fetch_last_error_content; + global $fetch_last_content_type; + global $fetch_last_modified; + global $fetch_effective_url; + global $fetch_effective_ip_addr; + global $fetch_curl_used; + global $fetch_domain_hits; + + $fetch_last_error = false; + $fetch_last_error_code = -1; + $fetch_last_error_content = ""; + $fetch_last_content_type = ""; + $fetch_curl_used = false; + $fetch_last_modified = ""; + $fetch_effective_url = ""; + $fetch_effective_ip_addr = ""; + + if (!is_array($fetch_domain_hits)) + $fetch_domain_hits = []; + + if (!is_array($options)) { + + // falling back on compatibility shim + $option_names = [ "url", "type", "login", "pass", "post_query", "timeout", "last_modified", "useragent" ]; + $tmp = []; + + for ($i = 0; $i < func_num_args(); $i++) { + $tmp[$option_names[$i]] = func_get_arg($i); + } + + $options = $tmp; + + /*$options = array( + "url" => func_get_arg(0), + "type" => @func_get_arg(1), + "login" => @func_get_arg(2), + "pass" => @func_get_arg(3), + "post_query" => @func_get_arg(4), + "timeout" => @func_get_arg(5), + "timestamp" => @func_get_arg(6), + "useragent" => @func_get_arg(7) + ); */ + } + + $url = $options["url"]; + $type = isset($options["type"]) ? $options["type"] : false; + $login = isset($options["login"]) ? $options["login"] : false; + $pass = isset($options["pass"]) ? $options["pass"] : false; + $post_query = isset($options["post_query"]) ? $options["post_query"] : false; + $timeout = isset($options["timeout"]) ? $options["timeout"] : false; + $last_modified = isset($options["last_modified"]) ? $options["last_modified"] : ""; + $useragent = isset($options["useragent"]) ? $options["useragent"] : false; + $followlocation = isset($options["followlocation"]) ? $options["followlocation"] : true; + $max_size = isset($options["max_size"]) ? $options["max_size"] : MAX_DOWNLOAD_FILE_SIZE; // in bytes + $http_accept = isset($options["http_accept"]) ? $options["http_accept"] : false; + $http_referrer = isset($options["http_referrer"]) ? $options["http_referrer"] : false; + + $url = ltrim($url, ' '); + $url = str_replace(' ', '%20', $url); + + $url = UrlHelper::validate($url, true); + + if (!$url) { + $fetch_last_error = "Requested URL failed extended validation."; + return false; + } + + $url_host = parse_url($url, PHP_URL_HOST); + $ip_addr = gethostbyname($url_host); + + if (!$ip_addr || strpos($ip_addr, "127.") === 0) { + $fetch_last_error = "URL hostname failed to resolve or resolved to a loopback address ($ip_addr)"; + return false; + } + + $fetch_domain_hits[$url_host] += 1; + + /*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")) { + + $fetch_curl_used = true; + + $ch = curl_init($url); + + $curl_http_headers = []; + + if ($last_modified && !$post_query) + array_push($curl_http_headers, "If-Modified-Since: $last_modified"); + + if ($http_accept) + array_push($curl_http_headers, "Accept: " . $http_accept); + + if (count($curl_http_headers) > 0) + curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_http_headers); + + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout ? $timeout : FILE_FETCH_CONNECT_TIMEOUT); + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout ? $timeout : FILE_FETCH_TIMEOUT); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("open_basedir") && $followlocation); + curl_setopt($ch, CURLOPT_MAXREDIRS, 20); + curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HEADER, true); + curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); + curl_setopt($ch, CURLOPT_USERAGENT, $useragent ? $useragent : + SELF_USER_AGENT); + curl_setopt($ch, CURLOPT_ENCODING, ""); + + if ($http_referrer) + curl_setopt($ch, CURLOPT_REFERER, $http_referrer); + + if ($max_size) { + curl_setopt($ch, CURLOPT_NOPROGRESS, false); + curl_setopt($ch, CURLOPT_BUFFERSIZE, 16384); // needed to get 5 arguments in progress function? + + // holy shit closures in php + // download & upload are *expected* sizes respectively, could be zero + curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curl_handle, $download_size, $downloaded, $upload_size, $uploaded) use( &$max_size) { + Debug::log("[curl progressfunction] $downloaded $max_size", Debug::$LOG_EXTENDED); + + return ($downloaded > $max_size) ? 1 : 0; // if max size is set, abort when exceeding it + }); + + } + + if (!ini_get("open_basedir")) { + curl_setopt($ch, CURLOPT_COOKIEJAR, "/dev/null"); + } + + if (defined('_HTTP_PROXY')) { + curl_setopt($ch, CURLOPT_PROXY, _HTTP_PROXY); + } + + if ($post_query) { + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_query); + } + + if ($login && $pass) + curl_setopt($ch, CURLOPT_USERPWD, "$login:$pass"); + + $ret = @curl_exec($ch); + + $headers_length = curl_getinfo($ch, CURLINFO_HEADER_SIZE); + $headers = explode("\r\n", substr($ret, 0, $headers_length)); + $contents = substr($ret, $headers_length); + + foreach ($headers as $header) { + if (strstr($header, ": ") !== false) { + list ($key, $value) = explode(": ", $header); + + if (strtolower($key) == "last-modified") { + $fetch_last_modified = $value; + } + } + + if (substr(strtolower($header), 0, 7) == 'http/1.') { + $fetch_last_error_code = (int) substr($header, 9, 3); + $fetch_last_error = $header; + } + } + + if (curl_errno($ch) === 23 || curl_errno($ch) === 61) { + curl_setopt($ch, CURLOPT_ENCODING, 'none'); + $contents = @curl_exec($ch); + } + + $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); + $fetch_last_content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); + + $fetch_effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); + + if (!UrlHelper::validate($fetch_effective_url, true)) { + $fetch_last_error = "URL received after redirection failed extended validation."; + + return false; + } + + $fetch_effective_ip_addr = gethostbyname(parse_url($fetch_effective_url, PHP_URL_HOST)); + + if (!$fetch_effective_ip_addr || strpos($fetch_effective_ip_addr, "127.") === 0) { + $fetch_last_error = "URL hostname received after redirection failed to resolve or resolved to a loopback address ($fetch_effective_ip_addr)"; + + return false; + } + + $fetch_last_error_code = $http_code; + + if ($http_code != 200 || $type && strpos($fetch_last_content_type, "$type") === false) { + + if (curl_errno($ch) != 0) { + $fetch_last_error .= "; " . curl_errno($ch) . " " . curl_error($ch); + } + + $fetch_last_error_content = $contents; + curl_close($ch); + return false; + } + + if (!$contents) { + $fetch_last_error = curl_errno($ch) . " " . curl_error($ch); + curl_close($ch); + return false; + } + + curl_close($ch); + + $is_gzipped = RSSUtils::is_gzipped($contents); + + if ($is_gzipped) { + $tmp = @gzdecode($contents); + + if ($tmp) $contents = $tmp; + } + + return $contents; + } else { + + $fetch_curl_used = false; + + if ($login && $pass){ + $url_parts = array(); + + preg_match("/(^[^:]*):\/\/(.*)/", $url, $url_parts); + + $pass = urlencode($pass); + + if ($url_parts[1] && $url_parts[2]) { + $url = $url_parts[1] . "://$login:$pass@" . $url_parts[2]; + } + } + + // TODO: should this support POST requests or not? idk + + $context_options = array( + 'http' => array( + 'header' => array( + 'Connection: close' + ), + 'method' => 'GET', + 'ignore_errors' => true, + 'timeout' => $timeout ? $timeout : FILE_FETCH_TIMEOUT, + 'protocol_version'=> 1.1) + ); + + if (!$post_query && $last_modified) + array_push($context_options['http']['header'], "If-Modified-Since: $last_modified"); + + if ($http_accept) + array_push($context_options['http']['header'], "Accept: $http_accept"); + + if ($http_referrer) + array_push($context_options['http']['header'], "Referer: $http_referrer"); + + if (defined('_HTTP_PROXY')) { + $context_options['http']['request_fulluri'] = true; + $context_options['http']['proxy'] = _HTTP_PROXY; + } + + $context = stream_context_create($context_options); + + $old_error = error_get_last(); + + $fetch_effective_url = UrlHelper::resolve_redirects($url, $timeout ? $timeout : FILE_FETCH_CONNECT_TIMEOUT); + + if (!UrlHelper::validate($fetch_effective_url, true)) { + $fetch_last_error = "URL received after redirection failed extended validation."; + + return false; + } + + $fetch_effective_ip_addr = gethostbyname(parse_url($fetch_effective_url, PHP_URL_HOST)); + + if (!$fetch_effective_ip_addr || strpos($fetch_effective_ip_addr, "127.") === 0) { + $fetch_last_error = "URL hostname received after redirection failed to resolve or resolved to a loopback address ($fetch_effective_ip_addr)"; + + return false; + } + + $data = @file_get_contents($url, false, $context); + + if (isset($http_response_header) && is_array($http_response_header)) { + foreach ($http_response_header as $header) { + if (strstr($header, ": ") !== false) { + list ($key, $value) = explode(": ", $header); + + $key = strtolower($key); + + if ($key == 'content-type') { + $fetch_last_content_type = $value; + // don't abort here b/c there might be more than one + // e.g. if we were being redirected -- last one is the right one + } else if ($key == 'last-modified') { + $fetch_last_modified = $value; + } else if ($key == 'location') { + $fetch_effective_url = $value; + } + } + + if (substr(strtolower($header), 0, 7) == 'http/1.') { + $fetch_last_error_code = (int) substr($header, 9, 3); + $fetch_last_error = $header; + } + } + } + + if ($fetch_last_error_code != 200) { + $error = error_get_last(); + + if ($error['message'] != $old_error['message']) { + $fetch_last_error .= "; " . $error["message"]; + } + + $fetch_last_error_content = $data; + + return false; + } + + $is_gzipped = RSSUtils::is_gzipped($data); + + if ($is_gzipped) { + $tmp = @gzdecode($data); + + if ($tmp) $data = $tmp; + } + + return $data; + } + } + +} diff --git a/classes/userhelper.php b/classes/userhelper.php new file mode 100644 index 000000000..2ae1f7b83 --- /dev/null +++ b/classes/userhelper.php @@ -0,0 +1,141 @@ +<?php +class UserHelper { + + static function authenticate($login, $password, $check_only = false, $service = false) { + + if (!SINGLE_USER_MODE) { + $user_id = false; + $auth_module = false; + + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_AUTH_USER) as $plugin) { + + $user_id = (int) $plugin->authenticate($login, $password, $service); + + if ($user_id) { + $auth_module = strtolower(get_class($plugin)); + break; + } + } + + if ($user_id && !$check_only) { + + session_start(); + session_regenerate_id(true); + + $_SESSION["uid"] = $user_id; + $_SESSION["auth_module"] = $auth_module; + + $pdo = Db::pdo(); + $sth = $pdo->prepare("SELECT login,access_level,pwd_hash FROM ttrss_users + WHERE id = ?"); + $sth->execute([$user_id]); + $row = $sth->fetch(); + + $_SESSION["name"] = $row["login"]; + $_SESSION["access_level"] = $row["access_level"]; + $_SESSION["csrf_token"] = bin2hex(get_random_bytes(16)); + + $usth = $pdo->prepare("UPDATE ttrss_users SET last_login = NOW() WHERE id = ?"); + $usth->execute([$user_id]); + + $_SESSION["ip_address"] = $_SERVER["REMOTE_ADDR"]; + $_SESSION["user_agent"] = sha1($_SERVER['HTTP_USER_AGENT']); + $_SESSION["pwd_hash"] = $row["pwd_hash"]; + + Pref_Prefs::initialize_user_prefs($_SESSION["uid"]); + + return true; + } + + return false; + + } else { + + $_SESSION["uid"] = 1; + $_SESSION["name"] = "admin"; + $_SESSION["access_level"] = 10; + + $_SESSION["hide_hello"] = true; + $_SESSION["hide_logout"] = true; + + $_SESSION["auth_module"] = false; + + if (!$_SESSION["csrf_token"]) + $_SESSION["csrf_token"] = bin2hex(get_random_bytes(16)); + + $_SESSION["ip_address"] = $_SERVER["REMOTE_ADDR"]; + + Pref_Prefs::initialize_user_prefs($_SESSION["uid"]); + + return true; + } + } + + static function load_user_plugins($owner_uid, $pluginhost = false) { + + if (!$pluginhost) $pluginhost = PluginHost::getInstance(); + + if ($owner_uid && SCHEMA_VERSION >= 100 && !$_SESSION["safe_mode"]) { + $plugins = get_pref("_ENABLED_PLUGINS", $owner_uid); + + $pluginhost->load($plugins, PluginHost::KIND_USER, $owner_uid); + + if (get_schema_version() > 100) { + $pluginhost->load_data(); + } + } + } + + static function login_sequence() { + $pdo = Db::pdo(); + + if (SINGLE_USER_MODE) { + @session_start(); + UserHelper::authenticate("admin", null); + startup_gettext(); + UserHelper::load_user_plugins($_SESSION["uid"]); + } else { + if (!validate_session()) $_SESSION["uid"] = false; + + if (!$_SESSION["uid"]) { + + if (AUTH_AUTO_LOGIN && UserHelper::authenticate(null, null)) { + $_SESSION["ref_schema_version"] = get_schema_version(true); + } else { + UserHelper::authenticate(null, null, true); + } + + if (!$_SESSION["uid"]) { + Pref_Users::logout_user(); + + Handler_Public::render_login_form(); + exit; + } + + } else { + /* bump login timestamp */ + $sth = $pdo->prepare("UPDATE ttrss_users SET last_login = NOW() WHERE id = ?"); + $sth->execute([$_SESSION['uid']]); + + $_SESSION["last_login_update"] = time(); + } + + if ($_SESSION["uid"]) { + startup_gettext(); + UserHelper::load_user_plugins($_SESSION["uid"]); + } + } + } + + static function print_user_stylesheet() { + $value = get_pref('USER_STYLESHEET'); + + if ($value) { + print "<style type='text/css' id='user_css_style'>"; + print str_replace("<br/>", "\n", $value); + print "</style>"; + } + + } + +} diff --git a/config.php-dist b/config.php-dist index 244390b98..ae34b4f15 100755..100644 --- a/config.php-dist +++ b/config.php-dist @@ -3,12 +3,12 @@ // *** Database configuration (important!) *** // ******************************************* - define('DB_TYPE', "pgsql"); // or mysql - define('DB_HOST', "localhost"); - define('DB_USER', "fox"); - define('DB_NAME', "fox"); - define('DB_PASS', "XXXXXX"); - define('DB_PORT', ''); // usually 5432 for PostgreSQL, 3306 for MySQL + define('DB_TYPE', '%DB_TYPE'); // pgsql or mysql + define('DB_HOST', '%DB_HOST'); + define('DB_USER', '%DB_USER'); + define('DB_NAME', '%DB_NAME'); + define('DB_PASS', '%DB_PASS'); + define('DB_PORT', '%DB_PORT'); // usually 5432 for PostgreSQL, 3306 for MySQL define('MYSQL_CHARSET', 'UTF8'); // Connection charset for MySQL. If you have a legacy database and/or experience @@ -18,9 +18,9 @@ // *** Basic settings (important!) *** // *********************************** - define('SELF_URL_PATH', 'https://example.org/tt-rss/'); + define('SELF_URL_PATH', '%SELF_URL_PATH'); // This should be set to a fully qualified URL used to access - // your tt-rss instance over the net. + // your tt-rss instance over the net, such as: https://example.org/tt-rss/ // The value should be a constant string literal. Please don't use // PHP server variables here - you might introduce security // issues on your install and cause hard to debug problems. @@ -38,7 +38,7 @@ // background processes while not running tt-rss, this method is generally // viable to keep your feeds up to date. // Still, there are more robust (and recommended) updating methods - // available, you can read about them here: http://tt-rss.org/wiki/UpdatingFeeds + // available, you can read about them here: https://tt-rss.org/wiki/UpdatingFeeds // ***************************** // *** Files and directories *** diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 000000000..e04cc85d0 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,31 @@ +// Less configuration +const gulp = require('gulp'); +const less = require('gulp-less'); + +function swallowError(error) { + console.log(error.toString()) + + this.emit('end') +} + +gulp.task('less', function(cb) { + gulp + .src(['themes/compact.less', 'themes/compact_night.less', + 'themes/light.less', 'themes/night_blue.less', 'themes/night.less']) + .pipe(less()) + .on('error', swallowError) + .pipe( + gulp.dest(function(f) { + return f.base; + }) + ); + cb(); +}); + +gulp.task( + 'default', + gulp.series('less', function(cb) { + gulp.watch(['themes/*.less', 'themes/*/*.less'], gulp.series('less')); + cb(); + }) +); diff --git a/include/autoload.php b/include/autoload.php index 1f1dbe5e9..c02923dba 100644 --- a/include/autoload.php +++ b/include/autoload.php @@ -5,7 +5,7 @@ $namespace = ''; $class_name = $class; - if (strpos($class, '\\') !== FALSE) + if (strpos($class, '\\') !== false) list ($namespace, $class_name) = explode('\\', $class, 2); $root_dir = dirname(__DIR__); // we're in tt-rss/include diff --git a/include/controls.php b/include/controls.php index 8646ec15d..fdcaad287 100755 --- a/include/controls.php +++ b/include/controls.php @@ -74,7 +74,7 @@ function print_feed_multi_select($id, $default_ids = [], $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)); @@ -180,7 +180,7 @@ function print_feed_cat_select($id, $default_id, print "<select id=\"$id\" name=\"$id\" default=\"$default_id\" $attributes>"; } - $pdo = DB::pdo(); + $pdo = Db::pdo(); if (!$root_id) $root_id = null; @@ -244,7 +244,7 @@ function stylesheet_tag($filename, $id = false) { function javascript_tag($filename) { $query = ""; - if (!(strpos($filename, "?") === FALSE)) { + if (!(strpos($filename, "?") === false)) { $query = substr($filename, strpos($filename, "?")+1); $filename = substr($filename, 0, strpos($filename, "?")); } diff --git a/include/functions.php b/include/functions.php index 3e37d1d28..506d426b1 100644 --- a/include/functions.php +++ b/include/functions.php @@ -122,7 +122,7 @@ } require_once "lib/accept-to-gettext.php"; - require_once "lib/gettext/gettext.inc"; + require_once "lib/gettext/gettext.inc.php"; function startup_gettext() { @@ -162,369 +162,34 @@ $schema_version = false; - // TODO: compat wrapper, remove at some point + /* compat shims */ + function _debug($msg) { Debug::log($msg); } - function reset_fetch_domain_quota() { - global $fetch_domain_hits; - - $fetch_domain_hits = []; + function sanitize($str, $force_remove_images = false, $owner = false, $site_url = false, $highlight_words = false, $article_id = false) { + return Sanitizer::sanitize($str, $force_remove_images, $owner, $site_url, $highlight_words, $article_id); } - // TODO: max_size currently only works for CURL transfers - // TODO: multiple-argument way is deprecated, first parameter is a hash now - function fetch_file_contents($options /* previously: 0: $url , 1: $type = false, 2: $login = false, 3: $pass = false, - 4: $post_query = false, 5: $timeout = false, 6: $timestamp = 0, 7: $useragent = false*/) { - - global $fetch_last_error; - global $fetch_last_error_code; - global $fetch_last_error_content; - global $fetch_last_content_type; - global $fetch_last_modified; - global $fetch_effective_url; - global $fetch_curl_used; - global $fetch_domain_hits; - - $fetch_last_error = false; - $fetch_last_error_code = -1; - $fetch_last_error_content = ""; - $fetch_last_content_type = ""; - $fetch_curl_used = false; - $fetch_last_modified = ""; - $fetch_effective_url = ""; - - if (!is_array($fetch_domain_hits)) - $fetch_domain_hits = []; - - if (!is_array($options)) { - - // falling back on compatibility shim - $option_names = [ "url", "type", "login", "pass", "post_query", "timeout", "last_modified", "useragent" ]; - $tmp = []; - - for ($i = 0; $i < func_num_args(); $i++) { - $tmp[$option_names[$i]] = func_get_arg($i); - } - - $options = $tmp; - - /*$options = array( - "url" => func_get_arg(0), - "type" => @func_get_arg(1), - "login" => @func_get_arg(2), - "pass" => @func_get_arg(3), - "post_query" => @func_get_arg(4), - "timeout" => @func_get_arg(5), - "timestamp" => @func_get_arg(6), - "useragent" => @func_get_arg(7) - ); */ - } - - $url = $options["url"]; - $type = isset($options["type"]) ? $options["type"] : false; - $login = isset($options["login"]) ? $options["login"] : false; - $pass = isset($options["pass"]) ? $options["pass"] : false; - $post_query = isset($options["post_query"]) ? $options["post_query"] : false; - $timeout = isset($options["timeout"]) ? $options["timeout"] : false; - $last_modified = isset($options["last_modified"]) ? $options["last_modified"] : ""; - $useragent = isset($options["useragent"]) ? $options["useragent"] : false; - $followlocation = isset($options["followlocation"]) ? $options["followlocation"] : true; - $max_size = isset($options["max_size"]) ? $options["max_size"] : MAX_DOWNLOAD_FILE_SIZE; // in bytes - $http_accept = isset($options["http_accept"]) ? $options["http_accept"] : false; - $http_referrer = isset($options["http_referrer"]) ? $options["http_referrer"] : false; - - $url = ltrim($url, ' '); - $url = str_replace(' ', '%20', $url); - - if (strpos($url, "//") === 0) - $url = 'http:' . $url; - - $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) { - 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")) { - - $fetch_curl_used = true; - - $ch = curl_init($url); - - $curl_http_headers = []; - - if ($last_modified && !$post_query) - array_push($curl_http_headers, "If-Modified-Since: $last_modified"); - - if ($http_accept) - array_push($curl_http_headers, "Accept: " . $http_accept); - - if (count($curl_http_headers) > 0) - curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_http_headers); - - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout ? $timeout : FILE_FETCH_CONNECT_TIMEOUT); - curl_setopt($ch, CURLOPT_TIMEOUT, $timeout ? $timeout : FILE_FETCH_TIMEOUT); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("open_basedir") && $followlocation); - curl_setopt($ch, CURLOPT_MAXREDIRS, 20); - curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_HEADER, true); - curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); - curl_setopt($ch, CURLOPT_USERAGENT, $useragent ? $useragent : - SELF_USER_AGENT); - curl_setopt($ch, CURLOPT_ENCODING, ""); - - if ($http_referrer) - curl_setopt($ch, CURLOPT_REFERER, $http_referrer); - - if ($max_size) { - curl_setopt($ch, CURLOPT_NOPROGRESS, false); - curl_setopt($ch, CURLOPT_BUFFERSIZE, 16384); // needed to get 5 arguments in progress function? - - // holy shit closures in php - // download & upload are *expected* sizes respectively, could be zero - curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curl_handle, $download_size, $downloaded, $upload_size, $uploaded) use( &$max_size) { - Debug::log("[curl progressfunction] $downloaded $max_size", Debug::$LOG_EXTENDED); - - return ($downloaded > $max_size) ? 1 : 0; // if max size is set, abort when exceeding it - }); - - } - - if (!ini_get("open_basedir")) { - curl_setopt($ch, CURLOPT_COOKIEJAR, "/dev/null"); - } - - if (defined('_HTTP_PROXY')) { - curl_setopt($ch, CURLOPT_PROXY, _HTTP_PROXY); - } - - if ($post_query) { - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_query); - } - - if ($login && $pass) - curl_setopt($ch, CURLOPT_USERPWD, "$login:$pass"); - - $ret = @curl_exec($ch); - - $headers_length = curl_getinfo($ch, CURLINFO_HEADER_SIZE); - $headers = explode("\r\n", substr($ret, 0, $headers_length)); - $contents = substr($ret, $headers_length); - - foreach ($headers as $header) { - if (strstr($header, ": ") !== FALSE) { - list ($key, $value) = explode(": ", $header); - - if (strtolower($key) == "last-modified") { - $fetch_last_modified = $value; - } - } - - if (substr(strtolower($header), 0, 7) == 'http/1.') { - $fetch_last_error_code = (int) substr($header, 9, 3); - $fetch_last_error = $header; - } - } - - if (curl_errno($ch) === 23 || curl_errno($ch) === 61) { - curl_setopt($ch, CURLOPT_ENCODING, 'none'); - $contents = @curl_exec($ch); - } - - $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - $fetch_last_content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); - - $fetch_effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); - - $fetch_last_error_code = $http_code; - - if ($http_code != 200 || $type && strpos($fetch_last_content_type, "$type") === false) { - - if (curl_errno($ch) != 0) { - $fetch_last_error .= "; " . curl_errno($ch) . " " . curl_error($ch); - } - - $fetch_last_error_content = $contents; - curl_close($ch); - return false; - } - - if (!$contents) { - $fetch_last_error = curl_errno($ch) . " " . curl_error($ch); - curl_close($ch); - return false; - } - - curl_close($ch); - - $is_gzipped = RSSUtils::is_gzipped($contents); - - if ($is_gzipped) { - $tmp = @gzdecode($contents); - - if ($tmp) $contents = $tmp; - } - - return $contents; - } else { - - $fetch_curl_used = false; - - if ($login && $pass){ - $url_parts = array(); - - preg_match("/(^[^:]*):\/\/(.*)/", $url, $url_parts); - - $pass = urlencode($pass); - - if ($url_parts[1] && $url_parts[2]) { - $url = $url_parts[1] . "://$login:$pass@" . $url_parts[2]; - } - } - - // TODO: should this support POST requests or not? idk - - $context_options = array( - 'http' => array( - 'header' => array( - 'Connection: close' - ), - 'method' => 'GET', - 'ignore_errors' => true, - 'timeout' => $timeout ? $timeout : FILE_FETCH_TIMEOUT, - 'protocol_version'=> 1.1) - ); - - if (!$post_query && $last_modified) - array_push($context_options['http']['header'], "If-Modified-Since: $last_modified"); - - if ($http_accept) - array_push($context_options['http']['header'], "Accept: $http_accept"); - - if ($http_referrer) - array_push($context_options['http']['header'], "Referer: $http_referrer"); - - if (defined('_HTTP_PROXY')) { - $context_options['http']['request_fulluri'] = true; - $context_options['http']['proxy'] = _HTTP_PROXY; - } - - $context = stream_context_create($context_options); - - $old_error = error_get_last(); - - $fetch_effective_url = $url; - - $data = @file_get_contents($url, false, $context); - - if (isset($http_response_header) && is_array($http_response_header)) { - foreach ($http_response_header as $header) { - if (strstr($header, ": ") !== FALSE) { - list ($key, $value) = explode(": ", $header); - - $key = strtolower($key); - - if ($key == 'content-type') { - $fetch_last_content_type = $value; - // don't abort here b/c there might be more than one - // e.g. if we were being redirected -- last one is the right one - } else if ($key == 'last-modified') { - $fetch_last_modified = $value; - } else if ($key == 'location') { - $fetch_effective_url = $value; - } - } - - if (substr(strtolower($header), 0, 7) == 'http/1.') { - $fetch_last_error_code = (int) substr($header, 9, 3); - $fetch_last_error = $header; - } - } - } - - if ($fetch_last_error_code != 200) { - $error = error_get_last(); - - if ($error['message'] != $old_error['message']) { - $fetch_last_error .= "; " . $error["message"]; - } - - $fetch_last_error_content = $data; - - return false; - } - - $is_gzipped = RSSUtils::is_gzipped($data); - - if ($is_gzipped) { - $tmp = @gzdecode($data); - - if ($tmp) $data = $tmp; - } - - return $data; - } - + function fetch_file_contents($params) { + return UrlHelper::fetch($params); } - function initialize_user_prefs($uid, $profile = false) { - - if (get_schema_version() < 63) $profile_qpart = ""; - - $pdo = DB::pdo(); - $in_nested_tr = false; - - try { - $pdo->beginTransaction(); - } catch (Exception $e) { - $in_nested_tr = true; - } - - $sth = $pdo->query("SELECT pref_name,def_value FROM ttrss_prefs"); - - if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null; - - $u_sth = $pdo->prepare("SELECT pref_name - FROM ttrss_user_prefs WHERE owner_uid = :uid AND - (profile = :profile OR (:profile IS NULL AND profile IS NULL))"); - $u_sth->execute([':uid' => $uid, ':profile' => $profile]); - - $active_prefs = array(); - - while ($line = $u_sth->fetch()) { - array_push($active_prefs, $line["pref_name"]); - } - - while ($line = $sth->fetch()) { - if (array_search($line["pref_name"], $active_prefs) === FALSE) { -// print "adding " . $line["pref_name"] . "<br>"; - - if (get_schema_version() < 63) { - $i_sth = $pdo->prepare("INSERT INTO ttrss_user_prefs - (owner_uid,pref_name,value) VALUES - (?, ?, ?)"); - $i_sth->execute([$uid, $line["pref_name"], $line["def_value"]]); - - } else { - $i_sth = $pdo->prepare("INSERT INTO ttrss_user_prefs - (owner_uid,pref_name,value, profile) VALUES - (?, ?, ?, ?)"); - $i_sth->execute([$uid, $line["pref_name"], $line["def_value"], $profile]); - } - - } - } + function rewrite_relative_url($url, $rel_url) { + return UrlHelper::rewrite_relative($url, $rel_url); + } - if (!$in_nested_tr) $pdo->commit(); + function validate_url($url) { + return UrlHelper::validate($url); + } + function authenticate_user($login, $password, $check_only = false, $service = false) { + return UserHelper::authenticate($login, $password, $check_only, $service); } + /* end compat shims */ + function get_ssl_certificate_id() { if ($_SERVER["REDIRECT_SSL_CLIENT_M_SERIAL"]) { return sha1($_SERVER["REDIRECT_SSL_CLIENT_M_SERIAL"] . @@ -541,77 +206,6 @@ return ""; } - function authenticate_user($login, $password, $check_only = false, $service = false) { - - if (!SINGLE_USER_MODE) { - $user_id = false; - $auth_module = false; - - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_AUTH_USER) as $plugin) { - - $user_id = (int) $plugin->authenticate($login, $password, $service); - - if ($user_id) { - $auth_module = strtolower(get_class($plugin)); - break; - } - } - - if ($user_id && !$check_only) { - - session_start(); - session_regenerate_id(true); - - $_SESSION["uid"] = $user_id; - $_SESSION["auth_module"] = $auth_module; - - $pdo = DB::pdo(); - $sth = $pdo->prepare("SELECT login,access_level,pwd_hash FROM ttrss_users - WHERE id = ?"); - $sth->execute([$user_id]); - $row = $sth->fetch(); - - $_SESSION["name"] = $row["login"]; - $_SESSION["access_level"] = $row["access_level"]; - $_SESSION["csrf_token"] = uniqid_short(); - - $usth = $pdo->prepare("UPDATE ttrss_users SET last_login = NOW() WHERE id = ?"); - $usth->execute([$user_id]); - - $_SESSION["ip_address"] = $_SERVER["REMOTE_ADDR"]; - $_SESSION["user_agent"] = sha1($_SERVER['HTTP_USER_AGENT']); - $_SESSION["pwd_hash"] = $row["pwd_hash"]; - - initialize_user_prefs($_SESSION["uid"]); - - return true; - } - - return false; - - } else { - - $_SESSION["uid"] = 1; - $_SESSION["name"] = "admin"; - $_SESSION["access_level"] = 10; - - $_SESSION["hide_hello"] = true; - $_SESSION["hide_logout"] = true; - - $_SESSION["auth_module"] = false; - - if (!$_SESSION["csrf_token"]) { - $_SESSION["csrf_token"] = uniqid_short(); - } - - $_SESSION["ip_address"] = $_SERVER["REMOTE_ADDR"]; - - initialize_user_prefs($_SESSION["uid"]); - - return true; - } - } - // this is used for user http parameters unless HTML code is actually needed function clean($param) { if (is_array($param)) { @@ -623,10 +217,6 @@ } } - function clean_filename($filename) { - return basename(preg_replace("/\.\.|[\/\\\]/", "", clean($filename))); - } - function make_password($length = 12) { $password = ""; $possible = "0123456789abcdfghjkmnpqrstvwxyzABCDFGHJKMNPQRSTVWXYZ*%+^"; @@ -652,87 +242,8 @@ return $password; } - // this is called after user is created to initialize default feeds, labels - // or whatever else - - // user preferences are checked on every login, not here - - function initialize_user($uid) { - - $pdo = DB::pdo(); - - $sth = $pdo->prepare("insert into ttrss_feeds (owner_uid,title,feed_url) - values (?, 'Tiny Tiny RSS: Forum', - 'http://tt-rss.org/forum/rss.php')"); - $sth->execute([$uid]); - } - - function logout_user() { - @session_destroy(); - if (isset($_COOKIE[session_name()])) { - setcookie(session_name(), '', time()-42000, '/'); - } - session_commit(); - } - function validate_csrf($csrf_token) { - return $csrf_token == $_SESSION['csrf_token']; - } - - function load_user_plugins($owner_uid, $pluginhost = false) { - - if (!$pluginhost) $pluginhost = PluginHost::getInstance(); - - if ($owner_uid && SCHEMA_VERSION >= 100) { - $plugins = get_pref("_ENABLED_PLUGINS", $owner_uid); - - $pluginhost->load($plugins, PluginHost::KIND_USER, $owner_uid); - - if (get_schema_version() > 100) { - $pluginhost->load_data(); - } - } - } - - function login_sequence() { - $pdo = Db::pdo(); - - if (SINGLE_USER_MODE) { - @session_start(); - authenticate_user("admin", null); - startup_gettext(); - load_user_plugins($_SESSION["uid"]); - } else { - if (!validate_session()) $_SESSION["uid"] = false; - - if (!$_SESSION["uid"]) { - - if (AUTH_AUTO_LOGIN && authenticate_user(null, null)) { - $_SESSION["ref_schema_version"] = get_schema_version(true); - } else { - authenticate_user(null, null, true); - } - - if (!$_SESSION["uid"]) { - logout_user(); - - render_login_form(); - exit; - } - - } else { - /* bump login timestamp */ - $sth = $pdo->prepare("UPDATE ttrss_users SET last_login = NOW() WHERE id = ?"); - $sth->execute([$_SESSION['uid']]); - - $_SESSION["last_login_update"] = time(); - } - - if ($_SESSION["uid"]) { - startup_gettext(); - load_user_plugins($_SESSION["uid"]); - } - } + return isset($csrf_token) && hash_equals($_SESSION['csrf_token'], $csrf_token); } function truncate_string($str, $max_len, $suffix = '…') { @@ -858,7 +369,7 @@ function get_schema_version($nocache = false) { global $schema_version; - $pdo = DB::pdo(); + $pdo = Db::pdo(); if (!$schema_version && !$nocache) { $row = $pdo->query("SELECT schema_version FROM ttrss_version")->fetch(); @@ -906,7 +417,6 @@ } } - function make_lockfile($filename) { $fp = fopen(LOCK_DIRECTORY . "/$filename", "w"); @@ -931,27 +441,6 @@ } } - function make_stampfile($filename) { - $fp = fopen(LOCK_DIRECTORY . "/$filename", "w"); - - if (flock($fp, LOCK_EX | LOCK_NB)) { - fwrite($fp, time() . "\n"); - flock($fp, LOCK_UN); - fclose($fp); - return true; - } else { - return false; - } - } - - function sql_random_function() { - if (DB_TYPE == "mysql") { - return "RAND()"; - } else { - return "RANDOM()"; - } - } - function getFeedUnread($feed, $is_cat = false) { return Feeds::getFeedArticles($feed, $is_cat, true, $_SESSION["uid"]); } @@ -964,526 +453,17 @@ return uniqid(base_convert(rand(), 10, 36)); } - function make_init_params() { - $params = array(); - - foreach (array("ON_CATCHUP_SHOW_NEXT_FEED", "HIDE_READ_FEEDS", - "ENABLE_FEED_CATS", "FEEDS_SORT_BY_UNREAD", "CONFIRM_FEED_CATCHUP", - "CDM_AUTO_CATCHUP", "FRESH_ARTICLE_MAX_AGE", - "HIDE_READ_SHOWS_SPECIAL", "COMBINED_DISPLAY_MODE") as $param) { - - $params[strtolower($param)] = (int) get_pref($param); - } - - $params["check_for_updates"] = CHECK_FOR_UPDATES; - $params["icons_url"] = ICONS_URL; - $params["cookie_lifetime"] = SESSION_COOKIE_LIFETIME; - $params["default_view_mode"] = get_pref("_DEFAULT_VIEW_MODE"); - $params["default_view_limit"] = (int) get_pref("_DEFAULT_VIEW_LIMIT"); - $params["default_view_order_by"] = get_pref("_DEFAULT_VIEW_ORDER_BY"); - $params["bw_limit"] = (int) $_SESSION["bw_limit"]; - $params["is_default_pw"] = Pref_Prefs::isdefaultpassword(); - $params["label_base_index"] = (int) LABEL_BASE_INDEX; - - $theme = get_pref( "USER_CSS_THEME", false, false); - $params["theme"] = theme_exists($theme) ? $theme : ""; - - $params["plugins"] = implode(", ", PluginHost::getInstance()->get_plugin_names()); - - $params["php_platform"] = PHP_OS; - $params["php_version"] = PHP_VERSION; - - $params["sanity_checksum"] = sha1(file_get_contents("include/sanity_check.php")); - - $pdo = Db::pdo(); - - $sth = $pdo->prepare("SELECT MAX(id) AS mid, COUNT(*) AS nf FROM - ttrss_feeds WHERE owner_uid = ?"); - $sth->execute([$_SESSION['uid']]); - $row = $sth->fetch(); - - $max_feed_id = $row["mid"]; - $num_feeds = $row["nf"]; - - $params["max_feed_id"] = (int) $max_feed_id; - $params["num_feeds"] = (int) $num_feeds; - - $params["hotkeys"] = get_hotkeys_map(); - - $params["csrf_token"] = $_SESSION["csrf_token"]; - $params["widescreen"] = (int) $_COOKIE["ttrss_widescreen"]; - - $params['simple_update'] = defined('SIMPLE_UPDATE_MODE') && SIMPLE_UPDATE_MODE; - - $params["icon_indicator_white"] = base64_img("images/indicator_white.gif"); - - $params["labels"] = Labels::get_all_labels($_SESSION["uid"]); - - return $params; - } - - function get_hotkeys_info() { - $hotkeys = array( - __("Navigation") => array( - "next_feed" => __("Open next feed"), - "prev_feed" => __("Open previous feed"), - "next_article_or_scroll" => __("Open next article (in combined mode, scroll down)"), - "prev_article_or_scroll" => __("Open previous article (in combined mode, scroll up)"), - "next_article_page" => __("Scroll article by one page down"), - "prev_article_page" => __("Scroll article by one page up"), - "next_article_noscroll" => __("Open next article"), - "prev_article_noscroll" => __("Open previous article"), - "next_article_noexpand" => __("Move to next article (don't expand or mark read)"), - "prev_article_noexpand" => __("Move to previous article (don't expand or mark read)"), - "search_dialog" => __("Show search dialog")), - __("Article") => array( - "toggle_mark" => __("Toggle starred"), - "toggle_publ" => __("Toggle published"), - "toggle_unread" => __("Toggle unread"), - "edit_tags" => __("Edit tags"), - "open_in_new_window" => __("Open in new window"), - "catchup_below" => __("Mark below as read"), - "catchup_above" => __("Mark above as read"), - "article_scroll_down" => __("Scroll down"), - "article_scroll_up" => __("Scroll up"), - "article_page_down" => __("Scroll down page"), - "article_page_up" => __("Scroll up page"), - "select_article_cursor" => __("Select article under cursor"), - "email_article" => __("Email article"), - "close_article" => __("Close/collapse article"), - "toggle_expand" => __("Toggle article expansion (combined mode)"), - "toggle_widescreen" => __("Toggle widescreen mode"), - "toggle_full_text" => __("Toggle full article text via Readability")), - __("Article selection") => array( - "select_all" => __("Select all articles"), - "select_unread" => __("Select unread"), - "select_marked" => __("Select starred"), - "select_published" => __("Select published"), - "select_invert" => __("Invert selection"), - "select_none" => __("Deselect everything")), - __("Feed") => array( - "feed_refresh" => __("Refresh current feed"), - "feed_unhide_read" => __("Un/hide read feeds"), - "feed_subscribe" => __("Subscribe to feed"), - "feed_edit" => __("Edit feed"), - "feed_catchup" => __("Mark as read"), - "feed_reverse" => __("Reverse headlines"), - "feed_toggle_vgroup" => __("Toggle headline grouping"), - "feed_debug_update" => __("Debug feed update"), - "feed_debug_viewfeed" => __("Debug viewfeed()"), - "catchup_all" => __("Mark all feeds as read"), - "cat_toggle_collapse" => __("Un/collapse current category"), - "toggle_cdm_expanded" => __("Toggle auto expand in combined mode"), - "toggle_combined_mode" => __("Toggle combined mode")), - __("Go to") => array( - "goto_all" => __("All articles"), - "goto_fresh" => __("Fresh"), - "goto_marked" => __("Starred"), - "goto_published" => __("Published"), - "goto_read" => __("Recently read"), - "goto_tagcloud" => __("Tag cloud"), - "goto_prefs" => __("Preferences")), - __("Other") => array( - "create_label" => __("Create label"), - "create_filter" => __("Create filter"), - "collapse_sidebar" => __("Un/collapse sidebar"), - "help_dialog" => __("Show help dialog")) - ); - - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HOTKEY_INFO) as $plugin) { - $hotkeys = $plugin->hook_hotkey_info($hotkeys); - } - - return $hotkeys; - } - - function get_hotkeys_map() { - $hotkeys = array( - "k" => "next_feed", - "j" => "prev_feed", - "n" => "next_article_noscroll", - "p" => "prev_article_noscroll", - //"(33)|PageUp" => "prev_article_page", - //"(34)|PageDown" => "next_article_page", - "*(33)|Shift+PgUp" => "article_page_up", - "*(34)|Shift+PgDn" => "article_page_down", - "(38)|Up" => "prev_article_or_scroll", - "(40)|Down" => "next_article_or_scroll", - "*(38)|Shift+Up" => "article_scroll_up", - "*(40)|Shift+Down" => "article_scroll_down", - "^(38)|Ctrl+Up" => "prev_article_noscroll", - "^(40)|Ctrl+Down" => "next_article_noscroll", - "/" => "search_dialog", - "s" => "toggle_mark", - "S" => "toggle_publ", - "u" => "toggle_unread", - "T" => "edit_tags", - "o" => "open_in_new_window", - "c p" => "catchup_below", - "c n" => "catchup_above", - "N" => "article_scroll_down", - "P" => "article_scroll_up", - "a W" => "toggle_widescreen", - "a e" => "toggle_full_text", - "e" => "email_article", - "a q" => "close_article", - "a a" => "select_all", - "a u" => "select_unread", - "a U" => "select_marked", - "a p" => "select_published", - "a i" => "select_invert", - "a n" => "select_none", - "f r" => "feed_refresh", - "f a" => "feed_unhide_read", - "f s" => "feed_subscribe", - "f e" => "feed_edit", - "f q" => "feed_catchup", - "f x" => "feed_reverse", - "f g" => "feed_toggle_vgroup", - "f D" => "feed_debug_update", - "f G" => "feed_debug_viewfeed", - "f C" => "toggle_combined_mode", - "f c" => "toggle_cdm_expanded", - "Q" => "catchup_all", - "x" => "cat_toggle_collapse", - "g a" => "goto_all", - "g f" => "goto_fresh", - "g s" => "goto_marked", - "g p" => "goto_published", - "g r" => "goto_read", - "g t" => "goto_tagcloud", - "g P" => "goto_prefs", - "r" => "select_article_cursor", - "c l" => "create_label", - "c f" => "create_filter", - "c s" => "collapse_sidebar", - "?" => "help_dialog", - ); - - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HOTKEY_MAP) as $plugin) { - $hotkeys = $plugin->hook_hotkey_map($hotkeys); - } - - $prefixes = array(); - - foreach (array_keys($hotkeys) as $hotkey) { - $pair = explode(" ", $hotkey, 2); - - if (count($pair) > 1 && !in_array($pair[0], $prefixes)) { - array_push($prefixes, $pair[0]); - } - } - - return array($prefixes, $hotkeys); - } - - function make_runtime_info() { - $data = array(); - - $pdo = Db::pdo(); - - $sth = $pdo->prepare("SELECT MAX(id) AS mid, COUNT(*) AS nf FROM - ttrss_feeds WHERE owner_uid = ?"); - $sth->execute([$_SESSION['uid']]); - $row = $sth->fetch(); - - $max_feed_id = $row['mid']; - $num_feeds = $row['nf']; - - $data["max_feed_id"] = (int) $max_feed_id; - $data["num_feeds"] = (int) $num_feeds; - $data['cdm_expanded'] = get_pref('CDM_EXPANDED'); - $data["labels"] = Labels::get_all_labels($_SESSION["uid"]); - - if (LOG_DESTINATION == 'sql' && $_SESSION['access_level'] >= 10) { - if (DB_TYPE == 'pgsql') { - $log_interval = "created_at > NOW() - interval '1 hour'"; - } else { - $log_interval = "created_at > DATE_SUB(NOW(), INTERVAL 1 HOUR)"; - } - - $sth = $pdo->prepare("SELECT COUNT(id) AS cid FROM ttrss_error_log WHERE $log_interval"); - $sth->execute(); - - if ($row = $sth->fetch()) { - $data['recent_log_events'] = $row['cid']; - } - } - - if (file_exists(LOCK_DIRECTORY . "/update_daemon.lock")) { - - $data['daemon_is_running'] = (int) file_is_locked("update_daemon.lock"); - - if (time() - $_SESSION["daemon_stamp_check"] > 30) { - - $stamp = (int) @file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); - - if ($stamp) { - $stamp_delta = time() - $stamp; - - if ($stamp_delta > 1800) { - $stamp_check = 0; - } else { - $stamp_check = 1; - $_SESSION["daemon_stamp_check"] = time(); - } - - $data['daemon_stamp_ok'] = $stamp_check; - - $stamp_fmt = date("Y.m.d, G:i", $stamp); - - $data['daemon_stamp'] = $stamp_fmt; - } - } - } - - return $data; - } - - function iframe_whitelisted($entry) { - @$src = parse_url($entry->getAttribute("src"), PHP_URL_HOST); - - if ($src) { - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_IFRAME_WHITELISTED) as $plugin) { - if ($plugin->hook_iframe_whitelisted($src)) - return true; - } - } - - return false; - } - - function sanitize($str, $force_remove_images = false, $owner = false, $site_url = false, $highlight_words = false, $article_id = false) { - if (!$owner) $owner = $_SESSION["uid"]; - - $res = trim($str); if (!$res) return ''; - - $doc = new DOMDocument(); - $doc->loadHTML('<?xml encoding="UTF-8">' . $res); - $xpath = new DOMXPath($doc); - - $rewrite_base_url = $site_url ? $site_url : get_self_url_prefix(); - - $entries = $xpath->query('(//a[@href]|//img[@src]|//video/source[@src]|//audio/source[@src]|//picture/source[@src])'); - - foreach ($entries as $entry) { - - if ($entry->hasAttribute('href')) { - $entry->setAttribute('href', - rewrite_relative_url($rewrite_base_url, $entry->getAttribute('href'))); - - $entry->setAttribute('rel', 'noopener noreferrer'); - } - - if ($entry->hasAttribute('src')) { - $src = rewrite_relative_url($rewrite_base_url, $entry->getAttribute('src')); - $entry->setAttribute('src', $src); - } - - if ($entry->nodeName == 'img') { - $entry->setAttribute('referrerpolicy', 'no-referrer'); - $entry->setAttribute('loading', 'lazy'); - - $entry->removeAttribute('width'); - $entry->removeAttribute('height'); - - if ($entry->hasAttribute('src')) { - $is_https_url = parse_url($entry->getAttribute('src'), PHP_URL_SCHEME) === 'https'; - - if (is_prefix_https() && !$is_https_url) { - - if ($entry->hasAttribute('srcset')) { - $entry->removeAttribute('srcset'); - } - - if ($entry->hasAttribute('sizes')) { - $entry->removeAttribute('sizes'); - } - } - } - } - - if ($entry->hasAttribute('src') && - ($owner && get_pref("STRIP_IMAGES", $owner)) || $force_remove_images || $_SESSION["bw_limit"]) { - - $p = $doc->createElement('p'); - - $a = $doc->createElement('a'); - $a->setAttribute('href', $entry->getAttribute('src')); - - $a->appendChild(new DOMText($entry->getAttribute('src'))); - $a->setAttribute('target', '_blank'); - $a->setAttribute('rel', 'noopener noreferrer'); - - $p->appendChild($a); - - if ($entry->nodeName == 'source') { - - if ($entry->parentNode && $entry->parentNode->parentNode) - $entry->parentNode->parentNode->replaceChild($p, $entry->parentNode); - - } else if ($entry->nodeName == 'img') { - - if ($entry->parentNode) - $entry->parentNode->replaceChild($p, $entry); - - } - } - - if (strtolower($entry->nodeName) == "a") { - $entry->setAttribute("target", "_blank"); - $entry->setAttribute("rel", "noopener noreferrer"); - } - } - - $entries = $xpath->query('//iframe'); - foreach ($entries as $entry) { - if (!iframe_whitelisted($entry)) { - $entry->setAttribute('sandbox', 'allow-scripts'); - } else { - if (is_prefix_https()) { - $entry->setAttribute("src", - str_replace("http://", "https://", - $entry->getAttribute("src"))); - } - } - } - - $allowed_elements = array('a', 'abbr', 'address', 'acronym', 'audio', 'article', 'aside', - 'b', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', - 'caption', 'cite', 'center', 'code', 'col', 'colgroup', - 'data', 'dd', 'del', 'details', 'description', 'dfn', 'div', 'dl', 'font', - 'dt', 'em', 'footer', 'figure', 'figcaption', - 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'html', 'i', - 'img', 'ins', 'kbd', 'li', 'main', 'mark', 'nav', 'noscript', - 'ol', 'p', 'picture', 'pre', 'q', 'ruby', 'rp', 'rt', 's', 'samp', 'section', - 'small', 'source', 'span', 'strike', 'strong', 'sub', 'summary', - 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'time', - 'tr', 'track', 'tt', 'u', 'ul', 'var', 'wbr', 'video', 'xml:namespace' ); - - if ($_SESSION['hasSandbox']) $allowed_elements[] = 'iframe'; - - $disallowed_attributes = array('id', 'style', 'class'); - - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SANITIZE) as $plugin) { - $retval = $plugin->hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes, $article_id); - if (is_array($retval)) { - $doc = $retval[0]; - $allowed_elements = $retval[1]; - $disallowed_attributes = $retval[2]; - } else { - $doc = $retval; - } - } - - $doc->removeChild($doc->firstChild); //remove doctype - $doc = strip_harmful_tags($doc, $allowed_elements, $disallowed_attributes); - - if ($highlight_words) { - foreach ($highlight_words as $word) { - - // http://stackoverflow.com/questions/4081372/highlight-keywords-in-a-paragraph - - $elements = $xpath->query("//*/text()"); - - foreach ($elements as $child) { - - $fragment = $doc->createDocumentFragment(); - $text = $child->textContent; - - while (($pos = mb_stripos($text, $word)) !== false) { - $fragment->appendChild(new DomText(mb_substr($text, 0, $pos))); - $word = mb_substr($text, $pos, mb_strlen($word)); - $highlight = $doc->createElement('span'); - $highlight->appendChild(new DomText($word)); - $highlight->setAttribute('class', 'highlight'); - $fragment->appendChild($highlight); - $text = mb_substr($text, $pos + mb_strlen($word)); - } - - if (!empty($text)) $fragment->appendChild(new DomText($text)); - - $child->parentNode->replaceChild($fragment, $child); - } - } - } - - $res = $doc->saveHTML(); - - /* strip everything outside of <body>...</body> */ - - $res_frag = array(); - if (preg_match('/<body>(.*)<\/body>/is', $res, $res_frag)) { - return $res_frag[1]; - } else { - return $res; - } - } - - function strip_harmful_tags($doc, $allowed_elements, $disallowed_attributes) { - $xpath = new DOMXPath($doc); - $entries = $xpath->query('//*'); - - foreach ($entries as $entry) { - if (!in_array($entry->nodeName, $allowed_elements)) { - $entry->parentNode->removeChild($entry); - } - - if ($entry->hasAttributes()) { - $attrs_to_remove = array(); - - foreach ($entry->attributes as $attr) { - - if (strpos($attr->nodeName, 'on') === 0) { - array_push($attrs_to_remove, $attr); - } - - if (strpos($attr->nodeName, "data-") === 0) { - array_push($attrs_to_remove, $attr); - } - - if ($attr->nodeName == 'href' && stripos($attr->value, 'javascript:') === 0) { - array_push($attrs_to_remove, $attr); - } - - if (in_array($attr->nodeName, $disallowed_attributes)) { - array_push($attrs_to_remove, $attr); - } - } - - foreach ($attrs_to_remove as $attr) { - $entry->removeAttributeNode($attr); - } - } - } - - return $doc; - } - function trim_array($array) { $tmp = $array; array_walk($tmp, 'trim'); return $tmp; } - function render_login_form() { - header('Cache-Control: public'); - - require_once "login_form.php"; - exit; - } - function T_sprintf() { $args = func_get_args(); return vsprintf(__(array_shift($args)), $args); } - function print_checkpoint($n, $s) { - $ts = microtime(true); - echo sprintf("<!-- CP[$n] %.4f seconds -->\n", $ts - $s); - return $ts; - } - function is_server_https() { return (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] != 'off')) || $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'; } @@ -1517,157 +497,6 @@ return true; } - function build_url($parts) { - return $parts['scheme'] . "://" . $parts['host'] . $parts['path']; - } - - function cleanup_url_path($path) { - $path = str_replace("/./", "/", $path); - $path = str_replace("//", "/", $path); - - return $path; - } - - /** - * Converts a (possibly) relative URL to a absolute one. - * - * @param string $url Base URL (i.e. from where the document is) - * @param string $rel_url Possibly relative URL in the document - * - * @return string Absolute URL - */ - function rewrite_relative_url($url, $rel_url) { - if (strpos($rel_url, "://") !== false) { - return $rel_url; - } else if (strpos($rel_url, "//") === 0) { - # protocol-relative URL (rare but they exist) - return $rel_url; - } else if (preg_match("/^[a-z]+:/i", $rel_url)) { - # magnet:, feed:, etc - return $rel_url; - } else if (strpos($rel_url, "/") === 0) { - $parts = parse_url($url); - $parts['path'] = $rel_url; - $parts['path'] = cleanup_url_path($parts['path']); - - return build_url($parts); - - } else { - $parts = parse_url($url); - if (!isset($parts['path'])) { - $parts['path'] = '/'; - } - $dir = $parts['path']; - if (substr($dir, -1) !== '/') { - $dir = dirname($parts['path']); - $dir !== '/' && $dir .= '/'; - } - $parts['path'] = $dir . $rel_url; - $parts['path'] = cleanup_url_path($parts['path']); - - return build_url($parts); - } - } - - function print_user_stylesheet() { - $value = get_pref('USER_STYLESHEET'); - - if ($value) { - print "<style type='text/css' id='user_css_style'>"; - print str_replace("<br/>", "\n", $value); - print "</style>"; - } - - } - - /* function filter_to_sql($filter, $owner_uid) { - $query = array(); - - $pdo = Db::pdo(); - - if (DB_TYPE == "pgsql") - $reg_qpart = "~"; - else - $reg_qpart = "REGEXP"; - - foreach ($filter["rules"] AS $rule) { - $rule['reg_exp'] = str_replace('/', '\/', $rule["reg_exp"]); - $regexp_valid = preg_match('/' . $rule['reg_exp'] . '/', - $rule['reg_exp']) !== FALSE; - - if ($regexp_valid) { - - $rule['reg_exp'] = $pdo->quote($rule['reg_exp']); - - switch ($rule["type"]) { - case "title": - $qpart = "LOWER(ttrss_entries.title) $reg_qpart LOWER('". - $rule['reg_exp'] . "')"; - break; - case "content": - $qpart = "LOWER(ttrss_entries.content) $reg_qpart LOWER('". - $rule['reg_exp'] . "')"; - break; - case "both": - $qpart = "LOWER(ttrss_entries.title) $reg_qpart LOWER('". - $rule['reg_exp'] . "') OR LOWER(" . - "ttrss_entries.content) $reg_qpart LOWER('" . $rule['reg_exp'] . "')"; - break; - case "tag": - $qpart = "LOWER(ttrss_user_entries.tag_cache) $reg_qpart LOWER('". - $rule['reg_exp'] . "')"; - break; - case "link": - $qpart = "LOWER(ttrss_entries.link) $reg_qpart LOWER('". - $rule['reg_exp'] . "')"; - break; - case "author": - $qpart = "LOWER(ttrss_entries.author) $reg_qpart LOWER('". - $rule['reg_exp'] . "')"; - break; - } - - if (isset($rule['inverse'])) $qpart = "NOT ($qpart)"; - - if (isset($rule["feed_id"]) && $rule["feed_id"] > 0) { - $qpart .= " AND feed_id = " . $pdo->quote($rule["feed_id"]); - } - - if (isset($rule["cat_id"])) { - - if ($rule["cat_id"] > 0) { - $children = Feeds::getChildCategories($rule["cat_id"], $owner_uid); - array_push($children, $rule["cat_id"]); - $children = array_map("intval", $children); - - $children = join(",", $children); - - $cat_qpart = "cat_id IN ($children)"; - } else { - $cat_qpart = "cat_id IS NULL"; - } - - $qpart .= " AND $cat_qpart"; - } - - $qpart .= " AND feed_id IS NOT NULL"; - - array_push($query, "($qpart)"); - - } - } - - if (count($query) > 0) { - $fullquery = "(" . join($filter["match_any_rule"] ? "OR" : "AND", $query) . ")"; - } else { - $fullquery = "(false)"; - } - - if ($filter['inverse']) $fullquery = "(NOT $fullquery)"; - - return $fullquery; - } */ - if (!function_exists('gzdecode')) { function gzdecode($string) { // no support for 2nd argument return file_get_contents('compress.zlib://data:who/cares;base64,'. @@ -1676,7 +505,9 @@ } function get_random_bytes($length) { - if (function_exists('openssl_random_pseudo_bytes')) { + if (function_exists('random_bytes')) { + return random_bytes($length); + } else if (function_exists('openssl_random_pseudo_bytes')) { return openssl_random_pseudo_bytes($length); } else { $output = ""; @@ -1739,7 +570,7 @@ for ($i = 0; $i < $l10n->total; $i++) { $orig = $l10n->get_original_string($i); - if(strpos($orig, "\000") !== FALSE) { // Plural forms + if(strpos($orig, "\000") !== false) { // Plural forms $key = explode(chr(0), $orig); print T_js_decl($key[0], _ngettext($key[0], $key[1], 1)); // Singular print T_js_decl($key[1], _ngettext($key[0], $key[1], 2)); // Plural @@ -1769,6 +600,7 @@ */ function error_json($code) { require_once "errors.php"; + global $ERRORS; @$message = $ERRORS[$code]; @@ -1777,80 +609,6 @@ } - /*function abs_to_rel_path($dir) { - $tmp = str_replace(dirname(__DIR__), "", $dir); - - if (strlen($tmp) > 0 && substr($tmp, 0, 1) == "/") $tmp = substr($tmp, 1); - - return $tmp; - }*/ - - function get_upload_error_message($code) { - - $errors = array( - 0 => __('There is no error, the file uploaded with success'), - 1 => __('The uploaded file exceeds the upload_max_filesize directive in php.ini'), - 2 => __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'), - 3 => __('The uploaded file was only partially uploaded'), - 4 => __('No file was uploaded'), - 6 => __('Missing a temporary folder'), - 7 => __('Failed to write file to disk.'), - 8 => __('A PHP extension stopped the file upload.'), - ); - - return $errors[$code]; - } - - function base64_img($filename) { - if (file_exists($filename)) { - $ext = pathinfo($filename, PATHINFO_EXTENSION); - - return "data:image/$ext;base64," . base64_encode(file_get_contents($filename)); - } else { - return ""; - } - } - - /* this is essentially a wrapper for readfile() which allows plugins to hook - output with httpd-specific "fast" implementation i.e. X-Sendfile or whatever else - - hook function should return true if request was handled (or at least attempted to) - - note that this can be called without user context so the plugin to handle this - should be loaded systemwide in config.php */ - function send_local_file($filename) { - if (file_exists($filename)) { - - if (is_writable($filename)) touch($filename); - - $tmppluginhost = new PluginHost(); - - $tmppluginhost->load(PLUGINS, PluginHost::KIND_SYSTEM); - $tmppluginhost->load_data(); - - foreach ($tmppluginhost->get_hooks(PluginHost::HOOK_SEND_LOCAL_FILE) as $plugin) { - if ($plugin->hook_send_local_file($filename)) return true; - } - - $mimetype = mime_content_type($filename); - - // this is hardly ideal but 1) only media is cached in images/ and 2) seemingly only mp4 - // video files are detected as octet-stream by mime_content_type() - - if ($mimetype == "application/octet-stream") - $mimetype = "video/mp4"; - - header("Content-type: $mimetype"); - - $stamp = gmdate("D, d M Y H:i:s", filemtime($filename)) . " GMT"; - header("Last-Modified: $stamp", true); - - return readfile($filename); - } else { - return false; - } - } - function arr_qmarks($arr) { return str_repeat('?,', count($arr) - 1) . '?'; } @@ -1889,9 +647,7 @@ date_default_timezone_set('UTC'); $root_dir = dirname(dirname(__FILE__)); - if ('\\' === DIRECTORY_SEPARATOR) { - $ttrss_version['version'] = "UNKNOWN (Unsupported, Windows)"; - } else if (PHP_OS === "Darwin") { + if (PHP_OS === "Darwin") { $ttrss_version['version'] = "UNKNOWN (Unsupported, Darwin)"; } else if (file_exists("$root_dir/version_static.txt")) { $ttrss_version['version'] = trim(file_get_contents("$root_dir/version_static.txt")) . " (Unsupported)"; @@ -1902,7 +658,7 @@ $cwd = getcwd(); chdir($root_dir); - exec('git --no-pager log --pretty='.escapeshellarg('version: %ct %h').' -n1 HEAD 2>&1', $output, $rc); + exec('git --no-pager log --pretty="version: %ct %h" -n1 HEAD 2>&1', $output, $rc); chdir($cwd); if (is_array($output) && count($output) > 0) { diff --git a/include/login_form.php b/include/login_form.php index 74f85f314..d2688d0ec 100755 --- a/include/login_form.php +++ b/include/login_form.php @@ -120,7 +120,7 @@ onblur="UtilityApp.fetchProfiles()" value="<?php echo $_SESSION["fake_password"] ?>"/> </fieldset> - <?php if (strpos(PLUGINS, "auth_internal") !== FALSE) { ?> + <?php if (strpos(PLUGINS, "auth_internal") !== false) { ?> <fieldset class="align-right"> <a href="public.php?op=forgotpass"><?php echo __("I forgot my password") ?></a> </fieldset> @@ -146,6 +146,14 @@ <?php echo __("Does not display images in articles, reduces automatic refreshes."); ?> </div> + <fieldset class="narrow"> + <label> </label> + + <label ><input dojoType="dijit.form.CheckBox" name="safe_mode" id="safe_mode" + type="checkbox"> + <?php echo __("Safe mode (no plugins)") ?></label> + </fieldset> + <?php if (SESSION_COOKIE_LIFETIME > 0) { ?> <fieldset class="narrow"> diff --git a/include/sanity_check.php b/include/sanity_check.php index 3998416f5..86dc7a5f0 100755 --- a/include/sanity_check.php +++ b/include/sanity_check.php @@ -60,7 +60,7 @@ array_push($errors, "Please copy config.php-dist to config.php or run the installer in install/"); } - if (strpos(PLUGINS, "auth_") === FALSE) { + if (strpos(PLUGINS, "auth_") === false) { array_push($errors, "Please enable at least one authentication module via PLUGINS constant in config.php"); } @@ -105,7 +105,7 @@ } if (SINGLE_USER_MODE && class_exists("PDO")) { - $pdo = DB::pdo(); + $pdo = Db::pdo(); $res = $pdo->query("SELECT id FROM ttrss_users WHERE id = 1"); @@ -219,8 +219,8 @@ <?php foreach ($errors as $error) { echo format_error($error); } ?> - <p>You might want to check tt-rss <a href="http://tt-rss.org/wiki">wiki</a> or the - <a href="http://tt-rss.org/forum">forums</a> for more information. Please search the forums before creating new topic + <p>You might want to check tt-rss <a href="https://tt-rss.org/wiki.php">wiki</a> or the + <a href="https://community.tt-rss.org/">forums</a> for more information. Please search the forums before creating new topic for your question.</p> </div> diff --git a/include/sessions.php b/include/sessions.php index 73be1e403..e4b9751e7 100644 --- a/include/sessions.php +++ b/include/sessions.php @@ -6,7 +6,7 @@ require_once "autoload.php"; require_once "errorhandler.php"; require_once "lib/accept-to-gettext.php"; - require_once "lib/gettext/gettext.inc"; + require_once "lib/gettext/gettext.inc.php"; $session_expire = min(2147483647 - time() - 1, max(SESSION_COOKIE_LIFETIME, 86400)); $session_name = (!defined('TTRSS_SESSION_NAME')) ? "ttrss_sid" : TTRSS_SESSION_NAME; @@ -28,7 +28,7 @@ if (!init_plugins()) return; - login_sequence(); + UserHelper::login_sequence(); header('Content-Type: text/html; charset=utf-8'); @@ -39,7 +39,7 @@ <title>Tiny Tiny RSS</title> <meta name="viewport" content="initial-scale=1,width=device-width" /> - <?php if ($_SESSION["uid"]) { + <?php if ($_SESSION["uid"] && !isset($_REQUEST["ignore-theme"])) { $theme = get_pref("USER_CSS_THEME", false, false); if ($theme && theme_exists("$theme")) { echo stylesheet_tag(get_theme_path($theme), 'theme_css'); @@ -47,7 +47,11 @@ } ?> - <?php print_user_stylesheet() ?> + <script type="text/javascript"> + const __csrf_token = "<?php echo $_SESSION["csrf_token"]; ?>"; + </script> + + <?php UserHelper::print_user_stylesheet() ?> <style type="text/css"> <?php @@ -198,6 +202,14 @@ <option value="feed_dates"><?php echo __('Newest first') ?></option> <option value="date_reverse"><?php echo __('Oldest first') ?></option> <option value="title"><?php echo __('Title') ?></option> + + <?php foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HEADLINES_CUSTOM_SORT_MAP) as $p) { + $sort_map = $p->hook_headlines_custom_sort_map(); + + foreach ($sort_map as $sort_value => $sort_title) { + print "<option value=\"" . htmlspecialchars($sort_value) . "\">$sort_title</option>"; + } + } ?> </select> <div dojoType="fox.form.ComboButton" onclick="Feeds.catchupCurrent()"> @@ -256,7 +268,6 @@ </div> <!-- toolbar --> </div> <!-- toolbar pane --> <div id="headlines-wrap-inner" dojoType="dijit.layout.BorderContainer" region="center"> - <div id="floatingTitle" style="display : none"></div> <div id="headlines-frame" dojoType="dijit.layout.ContentPane" tabindex="0" region="center"> <div id="headlinesInnerContainer"> diff --git a/install/index.php b/install/index.php index e4728fa73..6ff8acfbc 100755..100644 --- a/install/index.php +++ b/install/index.php @@ -10,7 +10,7 @@ function javascript_tag($filename) { $query = ""; - if (!(strpos($filename, "?") === FALSE)) { + if (!(strpos($filename, "?") === false)) { $query = substr($filename, strpos($filename, "?")+1); $filename = substr($filename, 0, strpos($filename, "?")); } @@ -151,35 +151,21 @@ function make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS, $DB_PORT, $SELF_URL_PATH) { - $data = explode("\n", file_get_contents("../config.php-dist")); - - $rv = ""; - - $finished = false; - - foreach ($data as $line) { - if (preg_match("/define\('DB_TYPE'/", $line)) { - $rv .= "\tdefine('DB_TYPE', '$DB_TYPE');\n"; - } else if (preg_match("/define\('DB_HOST'/", $line)) { - $rv .= "\tdefine('DB_HOST', '$DB_HOST');\n"; - } else if (preg_match("/define\('DB_USER'/", $line)) { - $rv .= "\tdefine('DB_USER', '$DB_USER');\n"; - } else if (preg_match("/define\('DB_NAME'/", $line)) { - $rv .= "\tdefine('DB_NAME', '$DB_NAME');\n"; - } else if (preg_match("/define\('DB_PASS'/", $line)) { - $rv .= "\tdefine('DB_PASS', '$DB_PASS');\n"; - } else if (preg_match("/define\('DB_PORT'/", $line)) { - $rv .= "\tdefine('DB_PORT', '$DB_PORT');\n"; - } else if (preg_match("/define\('SELF_URL_PATH'/", $line)) { - $rv .= "\tdefine('SELF_URL_PATH', '$SELF_URL_PATH');\n"; - } else if (!$finished) { - $rv .= "$line\n"; - } + $rv = file_get_contents("../config.php-dist"); - if (preg_match("/\?\>/", $line)) { - $finished = true; - } - } + $escape_chars = "\\'"; + + $settings = [ + "%DB_TYPE" => $DB_TYPE == 'pgsql' ? 'pgsql' : 'mysql', + "%DB_HOST" => addcslashes($DB_HOST, $escape_chars), + "%DB_USER" => addcslashes($DB_USER, $escape_chars), + "%DB_NAME" => addcslashes($DB_NAME, $escape_chars), + "%DB_PASS" => addcslashes($DB_PASS, $escape_chars), + "%DB_PORT" => $DB_PORT ? intval($DB_PORT) : '', + "%SELF_URL_PATH" => addcslashes($SELF_URL_PATH, $escape_chars) + ]; + + $rv = str_replace(array_keys($settings), array_values($settings), $rv); return $rv; } @@ -250,28 +236,28 @@ <fieldset> <label>Username:</label> - <input dojoType="dijit.form.TextBox" required name="DB_USER" size="20" value="<?php echo $DB_USER ?>"/> + <input dojoType="dijit.form.TextBox" required name="DB_USER" size="20" value="<?php echo htmlspecialchars($DB_USER) ?>"/> </fieldset> <fieldset> <label>Password:</label> - <input dojoType="dijit.form.TextBox" name="DB_PASS" size="20" type="password" value="<?php echo $DB_PASS ?>"/> + <input dojoType="dijit.form.TextBox" name="DB_PASS" size="20" type="password" value="<?php echo htmlspecialchars($DB_PASS) ?>"/> </fieldset> <fieldset> <label>Database name:</label> - <input dojoType="dijit.form.TextBox" required name="DB_NAME" size="20" value="<?php echo $DB_NAME ?>"/> + <input dojoType="dijit.form.TextBox" required name="DB_NAME" size="20" value="<?php echo htmlspecialchars($DB_NAME) ?>"/> </fieldset> <fieldset> <label>Host name:</label> - <input dojoType="dijit.form.TextBox" name="DB_HOST" size="20" value="<?php echo $DB_HOST ?>"/> + <input dojoType="dijit.form.TextBox" name="DB_HOST" size="20" value="<?php echo htmlspecialchars($DB_HOST) ?>"/> <span class="hint">If needed</span> </fieldset> <fieldset> <label>Port:</label> - <input dojoType="dijit.form.TextBox" name="DB_PORT" type="number" size="20" value="<?php echo $DB_PORT ?>"/> + <input dojoType="dijit.form.TextBox" name="DB_PORT" type="number" size="20" value="<?php echo htmlspecialchars($DB_PORT) ?>"/> <span class="hint">Usually 3306 for MySQL or 5432 for PostgreSQL</span> </fieldset> @@ -281,7 +267,7 @@ <fieldset> <label>Tiny Tiny RSS URL:</label> - <input dojoType="dijit.form.TextBox" type="url" name="SELF_URL_PATH" placeholder="<?php echo $SELF_URL_PATH; ?>" value="<?php echo $SELF_URL_PATH ?>"/> + <input dojoType="dijit.form.TextBox" type="url" name="SELF_URL_PATH" placeholder="<?php echo htmlspecialchars($SELF_URL_PATH); ?>" value="<?php echo htmlspecialchars($SELF_URL_PATH) ?>"/> </fieldset> <p><button type="submit" dojoType="dijit.form.Button" class="alt-primary">Test configuration</button></p> @@ -352,7 +338,7 @@ $pdo = pdo_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME, $DB_TYPE, $DB_PORT); if (!$pdo) { - print_error("Unable to connect to database using specified parameters (driver: $DB_TYPE)."); + print_error("Unable to connect to database using specified parameters (driver: " . htmlspecialchars($DB_TYPE) . ")."); exit; } @@ -378,13 +364,13 @@ <form method="post"> <input type="hidden" name="op" value="installschema"> - <input type="hidden" name="DB_USER" value="<?php echo $DB_USER ?>"/> - <input type="hidden" name="DB_PASS" value="<?php echo $DB_PASS ?>"/> - <input type="hidden" name="DB_NAME" value="<?php echo $DB_NAME ?>"/> - <input type="hidden" name="DB_HOST" value="<?php echo $DB_HOST ?>"/> - <input type="hidden" name="DB_PORT" value="<?php echo $DB_PORT ?>"/> - <input type="hidden" name="DB_TYPE" value="<?php echo $DB_TYPE ?>"/> - <input type="hidden" name="SELF_URL_PATH" value="<?php echo $SELF_URL_PATH ?>"/> + <input type="hidden" name="DB_USER" value="<?php echo htmlspecialchars($DB_USER) ?>"/> + <input type="hidden" name="DB_PASS" value="<?php echo htmlspecialchars($DB_PASS) ?>"/> + <input type="hidden" name="DB_NAME" value="<?php echo htmlspecialchars($DB_NAME) ?>"/> + <input type="hidden" name="DB_HOST" value="<?php echo htmlspecialchars($DB_HOST) ?>"/> + <input type="hidden" name="DB_PORT" value="<?php echo htmlspecialchars($DB_PORT) ?>"/> + <input type="hidden" name="DB_TYPE" value="<?php echo htmlspecialchars($DB_TYPE) ?>"/> + <input type="hidden" name="SELF_URL_PATH" value="<?php echo htmlspecialchars($SELF_URL_PATH) ?>"/> <p> <?php if ($need_confirm) { ?> @@ -398,13 +384,13 @@ </td><td> <form method="post"> - <input type="hidden" name="DB_USER" value="<?php echo $DB_USER ?>"/> - <input type="hidden" name="DB_PASS" value="<?php echo $DB_PASS ?>"/> - <input type="hidden" name="DB_NAME" value="<?php echo $DB_NAME ?>"/> - <input type="hidden" name="DB_HOST" value="<?php echo $DB_HOST ?>"/> - <input type="hidden" name="DB_PORT" value="<?php echo $DB_PORT ?>"/> - <input type="hidden" name="DB_TYPE" value="<?php echo $DB_TYPE ?>"/> - <input type="hidden" name="SELF_URL_PATH" value="<?php echo $SELF_URL_PATH ?>"/> + <input type="hidden" name="DB_USER" value="<?php echo htmlspecialchars($DB_USER) ?>"/> + <input type="hidden" name="DB_PASS" value="<?php echo htmlspecialchars($DB_PASS) ?>"/> + <input type="hidden" name="DB_NAME" value="<?php echo htmlspecialchars($DB_NAME) ?>"/> + <input type="hidden" name="DB_HOST" value="<?php echo htmlspecialchars($DB_HOST) ?>"/> + <input type="hidden" name="DB_PORT" value="<?php echo htmlspecialchars($DB_PORT) ?>"/> + <input type="hidden" name="DB_TYPE" value="<?php echo htmlspecialchars($DB_TYPE) ?>"/> + <input type="hidden" name="SELF_URL_PATH" value="<?php echo htmlspecialchars($SELF_URL_PATH) ?>"/> <input type="hidden" name="op" value="skipschema"> @@ -456,16 +442,16 @@ <form action="" method="post"> <input type="hidden" name="op" value="saveconfig"> - <input type="hidden" name="DB_USER" value="<?php echo $DB_USER ?>"/> - <input type="hidden" name="DB_PASS" value="<?php echo $DB_PASS ?>"/> - <input type="hidden" name="DB_NAME" value="<?php echo $DB_NAME ?>"/> - <input type="hidden" name="DB_HOST" value="<?php echo $DB_HOST ?>"/> - <input type="hidden" name="DB_PORT" value="<?php echo $DB_PORT ?>"/> - <input type="hidden" name="DB_TYPE" value="<?php echo $DB_TYPE ?>"/> - <input type="hidden" name="SELF_URL_PATH" value="<?php echo $SELF_URL_PATH ?>"/> + <input type="hidden" name="DB_USER" value="<?php echo htmlspecialchars($DB_USER) ?>"/> + <input type="hidden" name="DB_PASS" value="<?php echo htmlspecialchars($DB_PASS) ?>"/> + <input type="hidden" name="DB_NAME" value="<?php echo htmlspecialchars($DB_NAME) ?>"/> + <input type="hidden" name="DB_HOST" value="<?php echo htmlspecialchars($DB_HOST) ?>"/> + <input type="hidden" name="DB_PORT" value="<?php echo htmlspecialchars($DB_PORT) ?>"/> + <input type="hidden" name="DB_TYPE" value="<?php echo htmlspecialchars($DB_TYPE) ?>"/> + <input type="hidden" name="SELF_URL_PATH" value="<?php echo htmlspecialchars($SELF_URL_PATH) ?>"/> <?php print "<textarea rows='20' style='width : 100%'>"; - echo make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS, - $DB_PORT, $SELF_URL_PATH); + echo htmlspecialchars(make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS, + $DB_PORT, $SELF_URL_PATH)); print "</textarea>"; ?> <hr/> diff --git a/js/App.js b/js/App.js new file mode 100644 index 000000000..03103845e --- /dev/null +++ b/js/App.js @@ -0,0 +1,1236 @@ +'use strict'; + +/* global __, Article, Ajax, Headlines, Filters */ +/* global xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Feeds, Cookie */ +/* global CommonDialogs, Plugins, Effect */ + +const App = { + _initParams: [], + _rpc_seq: 0, + hotkey_prefix: 0, + hotkey_prefix_pressed: false, + hotkey_prefix_timeout: 0, + global_unread: -1, + _widescreen_mode: false, + _loading_progress: 0, + hotkey_actions: {}, + is_prefs: false, + LABEL_BASE_INDEX: -1024, + Scrollable: { + scrollByPages: function (elem, page_offset) { + if (!elem) return; + + /* keep a line or so from the previous page */ + const offset = (elem.offsetHeight - (page_offset > 0 ? 50 : -50)) * page_offset; + + this.scroll(elem, offset); + }, + scroll: function(elem, offset) { + if (!elem) return; + + elem.scrollTop += offset; + }, + isChildVisible: function(elem, ctr) { + if (!elem) return; + + const ctop = ctr.scrollTop; + const cbottom = ctop + ctr.offsetHeight; + + const etop = elem.offsetTop; + const ebottom = etop + elem.offsetHeight; + + return etop >= ctop && ebottom <= cbottom || + etop < ctop && ebottom > ctop || ebottom > cbottom && etop < cbottom; + }, + fitsInContainer: function (elem, ctr) { + if (!elem) return; + + return elem.offsetTop + elem.offsetHeight <= ctr.scrollTop + ctr.offsetHeight && + elem.offsetTop >= ctr.scrollTop; + } + }, + label_to_feed_id: function(label) { + return this.LABEL_BASE_INDEX - 1 - Math.abs(label); + }, + feed_to_label_id: function(feed) { + return this.LABEL_BASE_INDEX - 1 + Math.abs(feed); + }, + getInitParam: function(k) { + return this._initParams[k]; + }, + setInitParam: function(k, v) { + this._initParams[k] = v; + }, + nightModeChanged: function(is_night, link) { + console.log("night mode changed to", is_night); + + if (link) { + const css_override = is_night ? "themes/night.css" : "themes/light.css"; + link.setAttribute("href", css_override + "?" + Date.now()); + } + }, + setupNightModeDetection: function(callback) { + if (!$("theme_css")) { + const mql = window.matchMedia('(prefers-color-scheme: dark)'); + + try { + mql.addEventListener("change", () => { + this.nightModeChanged(mql.matches, $("theme_auto_css")); + }); + } catch (e) { + console.warn("exception while trying to set MQL event listener"); + } + + const link = new Element("link", { + rel: "stylesheet", + id: "theme_auto_css" + }); + + if (callback) { + link.onload = function () { + document.querySelector("body").removeClassName("css_loading"); + callback(); + }; + + link.onerror = function(event) { + alert("Fatal error while loading application stylesheet: " + link.getAttribute("href")); + } + } + + this.nightModeChanged(mql.matches, link); + + document.querySelector("head").appendChild(link); + } else { + document.querySelector("body").removeClassName("css_loading"); + + if (callback) callback(); + } + }, + enableCsrfSupport: function() { + const _this = this; + + Ajax.Base.prototype.initialize = Ajax.Base.prototype.initialize.wrap( + function (callOriginal, options) { + + if (_this.getInitParam("csrf_token") != undefined) { + Object.extend(options, options || { }); + + if (Object.isString(options.parameters)) + options.parameters = options.parameters.toQueryParams(); + else if (Object.isHash(options.parameters)) + options.parameters = options.parameters.toObject(); + + options.parameters["csrf_token"] = _this.getInitParam("csrf_token"); + } + + return callOriginal(options); + } + ); + }, + postCurrentWindow: function(target, params) { + const form = document.createElement("form"); + + form.setAttribute("method", "post"); + form.setAttribute("action", App.getInitParam("self_url_prefix") + "/" + target); + + for (const [k,v] of Object.entries(params)) { + const field = document.createElement("input"); + + field.setAttribute("name", k); + field.setAttribute("value", v); + field.setAttribute("type", "hidden"); + + form.appendChild(field); + } + + document.body.appendChild(form); + + form.submit(); + + form.parentNode.removeChild(form); + }, + postOpenWindow: function(target, params) { + const w = window.open(""); + + if (w) { + w.opener = null; + + const form = document.createElement("form"); + + form.setAttribute("method", "post"); + form.setAttribute("action", App.getInitParam("self_url_prefix") + "/" + target); + + for (const [k,v] of Object.entries(params)) { + const field = document.createElement("input"); + + field.setAttribute("name", k); + field.setAttribute("value", v); + field.setAttribute("type", "hidden"); + + form.appendChild(field); + } + + w.document.body.appendChild(form); + form.submit(); + } + + }, + urlParam: function(param) { + return String(window.location.href).parseQuery()[param]; + }, + next_seq: function() { + this._rpc_seq += 1; + return this._rpc_seq; + }, + get_seq: function() { + return this._rpc_seq; + }, + setLoadingProgress: function(p) { + this._loading_progress += p; + + if (dijit.byId("loading_bar")) + dijit.byId("loading_bar").update({progress: this._loading_progress}); + + if (this._loading_progress >= 90) { + $("overlay").hide(); + } + + }, + isCombinedMode: function() { + return this.getInitParam("combined_display_mode"); + }, + getActionByHotkeySequence: function(sequence) { + const hotkeys_map = this.getInitParam("hotkeys"); + + for (const seq in hotkeys_map[1]) { + if (hotkeys_map[1].hasOwnProperty(seq)) { + if (seq == sequence) { + return hotkeys_map[1][seq]; + } + } + } + }, + keyeventToAction: function(event) { + + const hotkeys_map = this.getInitParam("hotkeys"); + const keycode = event.which; + const keychar = String.fromCharCode(keycode); + + if (keycode == 27) { // escape and drop prefix + this.hotkey_prefix = false; + } + + if (!this.hotkey_prefix && hotkeys_map[0].indexOf(keychar) != -1) { + + this.hotkey_prefix = keychar; + $("cmdline").innerHTML = keychar; + Element.show("cmdline"); + + window.clearTimeout(this.hotkey_prefix_timeout); + this.hotkey_prefix_timeout = window.setTimeout(() => { + this.hotkey_prefix = false; + Element.hide("cmdline"); + }, 3 * 1000); + + event.stopPropagation(); + + return false; + } + + Element.hide("cmdline"); + + let hotkey_name = ""; + + if (event.type == "keydown") { + hotkey_name = "(" + keycode + ")"; + + // ensure ^*char notation + if (event.shiftKey) hotkey_name = "*" + hotkey_name; + if (event.ctrlKey) hotkey_name = "^" + hotkey_name; + if (event.altKey) hotkey_name = "+" + hotkey_name; + if (event.metaKey) hotkey_name = "%" + hotkey_name; + } else { + hotkey_name = keychar ? keychar : "(" + keycode + ")"; + } + + let hotkey_full = this.hotkey_prefix ? this.hotkey_prefix + " " + hotkey_name : hotkey_name; + this.hotkey_prefix = false; + + let action_name = this.getActionByHotkeySequence(hotkey_full); + + // check for mode-specific hotkey + if (!action_name) { + hotkey_full = (this.isCombinedMode() ? "{C}" : "{3}") + hotkey_full; + + action_name = this.getActionByHotkeySequence(hotkey_full); + } + + console.log('keyeventToAction', hotkey_full, '=>', action_name); + + return action_name; + }, + cleanupMemory: function(root) { + const dijits = dojo.query("[widgetid]", dijit.byId(root).domNode).map(dijit.byNode); + + dijits.each(function (d) { + dojo.destroy(d.domNode); + }); + + $$("#" + root + " *").each(function (i) { + i.parentNode ? i.parentNode.removeChild(i) : true; + }); + }, + // htmlspecialchars()-alike for headlines data-content attribute + escapeHtml: function(text) { + const map = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + return text.replace(/[&<>"']/g, function(m) { return map[m]; }); + }, + displayIfChecked: function(checkbox, elemId) { + if (checkbox.checked) { + Effect.Appear(elemId, {duration : 0.5}); + } else { + Effect.Fade(elemId, {duration : 0.5}); + } + }, + helpDialog: function(topic) { + if (dijit.byId("helpDlg")) + dijit.byId("helpDlg").destroyRecursive(); + + xhrPost("backend.php", {op: "backend", method: "help", topic: topic}, (transport) => { + const dialog = new dijit.Dialog({ + id: "helpDlg", + title: __("Help"), + style: "width: 600px", + content: transport.responseText, + }); + + dialog.show(); + }); + }, + displayDlg: function(title, id, param, callback) { + Notify.progress("Loading, please wait...", true); + + const query = {op: "dlg", method: id, param: param}; + + xhrPost("backend.php", query, (transport) => { + try { + const content = transport.responseText; + + let dialog = dijit.byId("infoBox"); + + if (!dialog) { + dialog = new dijit.Dialog({ + title: title, + id: 'infoBox', + style: "width: 600px", + onCancel: function () { + return true; + }, + onExecute: function () { + return true; + }, + onClose: function () { + return true; + }, + content: content + }); + } else { + dialog.attr('title', title); + dialog.attr('content', content); + } + + dialog.show(); + + Notify.close(); + + if (callback) callback(transport); + } catch (e) { + this.Error.report(e); + } + }); + + return false; + }, + handleRpcJson: function(transport) { + + const netalert = $$("#toolbar .net-alert")[0]; + + try { + const reply = JSON.parse(transport.responseText); + + if (reply) { + const error = reply['error']; + + if (error) { + const code = error['code']; + const msg = error['message']; + + console.warn("[handleRpcJson] received fatal error ", code, msg); + + if (code != 0) { + /* global ERRORS */ + this.Error.fatal(ERRORS[code], {info: msg, code: code}); + return false; + } + } + + const seq = reply['seq']; + + if (seq && this.get_seq() != seq) { + console.log("[handleRpcJson] sequence mismatch: ", seq, '!=', this.get_seq()); + return true; + } + + const message = reply['message']; + + if (message == "UPDATE_COUNTERS") { + console.log("need to refresh counters..."); + Feeds.requestCounters(true); + } + + const counters = reply['counters']; + + if (counters) + Feeds.parseCounters(counters); + + const runtime_info = reply['runtime-info']; + + if (runtime_info) + this.parseRuntimeInfo(runtime_info); + + if (netalert) netalert.hide(); + + return reply; + + } else { + if (netalert) netalert.show(); + + Notify.error("Communication problem with server."); + } + + } catch (e) { + if (netalert) netalert.show(); + + Notify.error("Communication problem with server."); + + console.error(e); + } + + return false; + }, + parseRuntimeInfo: function(data) { + for (const k in data) { + if (data.hasOwnProperty(k)) { + const v = data[k]; + + console.log("RI:", k, "=>", v); + + if (k == "daemon_is_running" && v != 1) { + Notify.error("<span onclick=\"App.explainError(1)\">Update daemon is not running.</span>", true); + return; + } + + if (k == "recent_log_events") { + const alert = $$(".log-alert")[0]; + + if (alert) { + v > 0 ? alert.show() : alert.hide(); + } + } + + if (k == "daemon_stamp_ok" && v != 1) { + Notify.error("<span onclick=\"App.explainError(3)\">Update daemon is not updating feeds.</span>", true); + return; + } + + if (k == "max_feed_id" || k == "num_feeds") { + if (this.getInitParam(k) != v) { + console.log("feed count changed, need to reload feedlist."); + Feeds.reload(); + } + } + + this.setInitParam(k, v); + } + } + + PluginHost.run(PluginHost.HOOK_RUNTIME_INFO_LOADED, data); + }, + backendSanityCallback: function(transport) { + const reply = JSON.parse(transport.responseText); + + /* global ERRORS */ + + if (!reply) { + this.Error.fatal(ERRORS[3], {info: transport.responseText}); + return; + } + + if (reply['error']) { + const code = reply['error']['code']; + + if (code && code != 0) { + return this.Error.fatal(ERRORS[code], + {code: code, info: reply['error']['message']}); + } + } + + console.log("sanity check ok"); + + const params = reply['init-params']; + + if (params) { + console.log('reading init-params...'); + + for (const k in params) { + if (params.hasOwnProperty(k)) { + switch (k) { + case "label_base_index": + this.LABEL_BASE_INDEX = parseInt(params[k]); + break; + case "cdm_auto_catchup": + if (params[k] == 1) { + const hl = $("headlines-frame"); + if (hl) hl.addClassName("auto_catchup"); + } + break; + case "hotkeys": + // filter mnemonic definitions (used for help panel) from hotkeys map + // i.e. *(191)|Ctrl-/ -> *(191) + { + const tmp = []; + for (const sequence in params[k][1]) { + if (params[k][1].hasOwnProperty(sequence)) { + const filtered = sequence.replace(/\|.*$/, ""); + tmp[filtered] = params[k][1][sequence]; + } + } + + params[k][1] = tmp; + } + break; + } + + console.log("IP:", k, "=>", params[k]); + this.setInitParam(k, params[k]); + } + } + + // PluginHost might not be available on non-index pages + if (typeof PluginHost !== 'undefined') + PluginHost.run(PluginHost.HOOK_PARAMS_LOADED, this._initParams); + } + + this.initSecondStage(); + }, + explainError: function(code) { + return this.displayDlg(__("Error explained"), "explainError", code); + }, + Error: { + fatal: function (error, params) { + params = params || {}; + + if (params.code) { + if (params.code == 6) { + window.location.href = "index.php"; + return; + } else if (params.code == 5) { + window.location.href = "public.php?op=dbupdate"; + return; + } + } + + return this.report(error, + Object.extend({title: __("Fatal error")}, params)); + }, + report: function(error, params) { + params = params || {}; + + if (!error) return; + + console.error("[Error.report]", error, params); + + const message = params.message ? params.message : error.toString(); + + try { + xhrPost("backend.php", + {op: "rpc", method: "log", + file: params.filename ? params.filename : error.fileName, + line: params.lineno ? params.lineno : error.lineNumber, + msg: message, + context: error.stack}, + (transport) => { + console.warn("[Error.report] log response", transport.responseText); + }); + } catch (re) { + console.error("[Error.report] exception while saving logging error on server", re); + } + + try { + if (dijit.byId("exceptionDlg")) + dijit.byId("exceptionDlg").destroyRecursive(); + + let stack_msg = ""; + + if (error.stack) + stack_msg += `<div><b>Stack trace:</b></div> + <textarea name="stack" readonly="1">${error.stack}</textarea>`; + + if (params.info) + stack_msg += `<div><b>Additional information:</b></div> + <textarea name="stack" readonly="1">${params.info}</textarea>`; + + const content = `<div class="error-contents"> + <p class="message">${message}</p> + ${stack_msg} + <div class="dlgButtons"> + <button dojoType="dijit.form.Button" + onclick="dijit.byId('exceptionDlg').hide()">${__('Close this window')}</button> + </div> + </div>`; + + const dialog = new dijit.Dialog({ + id: "exceptionDlg", + title: params.title || __("Unhandled exception"), + style: "width: 600px", + content: content + }); + + dialog.show(); + } catch (de) { + console.error("[Error.report] exception while showing error dialog", de); + + alert(error.stack ? error.stack : message); + } + + }, + onWindowError: function (message, filename, lineno, colno, error) { + // called without context (this) from window.onerror + App.Error.report(error, + {message: message, filename: filename, lineno: lineno, colno: colno}); + }, + }, + isPrefs() { + return this.is_prefs; + }, + init: function(parser, is_prefs) { + this.is_prefs = is_prefs; + window.onerror = this.Error.onWindowError; + + this.setInitParam("csrf_token", __csrf_token); + + this.setupNightModeDetection(() => { + parser.parse(); + + console.log('is_prefs', this.is_prefs); + + if (!this.checkBrowserFeatures()) + return; + + this.setLoadingProgress(30); + this.initHotkeyActions(); + this.enableCsrfSupport(); + + const a = document.createElement('audio'); + const hasAudio = !!a.canPlayType; + const hasSandbox = "sandbox" in document.createElement("iframe"); + const hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, '')); + const clientTzOffset = new Date().getTimezoneOffset() * 60; + + const params = { + op: "rpc", method: "sanityCheck", hasAudio: hasAudio, + hasMp3: hasMp3, + clientTzOffset: clientTzOffset, + hasSandbox: hasSandbox + }; + + xhrPost("backend.php", params, (transport) => { + try { + this.backendSanityCallback(transport); + } catch (e) { + this.Error.report(e); + } + }); + }); + }, + checkBrowserFeatures: function() { + let errorMsg = ""; + + ['MutationObserver'].each(function(wf) { + if (!(wf in window)) { + errorMsg = `Browser feature check failed: <code>window.${wf}</code> not found.`; + throw new Error(errorMsg); + } + }); + + if (errorMsg) { + this.Error.fatal(errorMsg, {info: navigator.userAgent}); + } + + return errorMsg == ""; + }, + initSecondStage: function() { + + document.onkeydown = (event) => { return this.hotkeyHandler(event) }; + document.onkeypress = (event) => { return this.hotkeyHandler(event) }; + + if (this.is_prefs) { + + this.setLoadingProgress(70); + Notify.close(); + + let tab = this.urlParam('tab'); + + if (tab) { + tab = dijit.byId(tab + "Tab"); + if (tab) { + dijit.byId("pref-tabs").selectChild(tab); + + switch (this.urlParam('method')) { + case "editfeed": + window.setTimeout(() => { + CommonDialogs.editFeed(this.urlParam('methodparam')) + }, 100); + break; + default: + console.warn("initSecondStage, unknown method:", this.urlParam("method")); + } + } + } else { + let tab = localStorage.getItem("ttrss:prefs-tab"); + + if (tab) { + tab = dijit.byId(tab); + if (tab) { + dijit.byId("pref-tabs").selectChild(tab); + } + } + } + + dojo.connect(dijit.byId("pref-tabs"), "selectChild", function (elem) { + localStorage.setItem("ttrss:prefs-tab", elem.id); + }); + + } else { + + Feeds.reload(); + Article.close(); + + if (parseInt(Cookie.get("ttrss_fh_width")) > 0) { + dijit.byId("feeds-holder").domNode.setStyle( + {width: Cookie.get("ttrss_fh_width") + "px"}); + } + + dijit.byId("main").resize(); + + dojo.connect(dijit.byId('feeds-holder'), 'resize', + (args) => { + if (args && args.w >= 0) { + Cookie.set("ttrss_fh_width", args.w, this.getInitParam("cookie_lifetime")); + } + }); + + dojo.connect(dijit.byId('content-insert'), 'resize', + (args) => { + if (args && args.w >= 0 && args.h >= 0) { + Cookie.set("ttrss_ci_width", args.w, this.getInitParam("cookie_lifetime")); + Cookie.set("ttrss_ci_height", args.h, this.getInitParam("cookie_lifetime")); + } + }); + + const toolbar = document.forms["toolbar-main"]; + + dijit.getEnclosingWidget(toolbar.view_mode).attr('value', + this.getInitParam("default_view_mode")); + + dijit.getEnclosingWidget(toolbar.order_by).attr('value', + this.getInitParam("default_view_order_by")); + + this.setLoadingProgress(50); + + this._widescreen_mode = this.getInitParam("widescreen"); + this.switchPanelMode(this._widescreen_mode); + + Headlines.initScrollHandler(); + + if (this.getInitParam("simple_update")) { + console.log("scheduling simple feed updater..."); + window.setInterval(() => { Feeds.updateRandom() }, 30 * 1000); + } + + if (this.getInitParam('check_for_updates')) { + window.setInterval(() => { + this.checkForUpdates(); + }, 3600 * 1000); + } + + console.log("second stage ok"); + + PluginHost.run(PluginHost.HOOK_INIT_COMPLETE, null); + + } + + }, + checkForUpdates: function() { + console.log('checking for updates...'); + + xhrJson("backend.php", {op: 'rpc', method: 'checkforupdates'}) + .then((reply) => { + console.log('update reply', reply); + + if (reply.id) { + $("updates-available").show(); + } else { + $("updates-available").hide(); + } + }); + }, + updateTitle: function() { + let tmp = "Tiny Tiny RSS"; + + if (this.global_unread > 0) { + tmp = "(" + this.global_unread + ") " + tmp; + } + + document.title = tmp; + }, + onViewModeChanged: function() { + const view_mode = document.forms["toolbar-main"].view_mode.value; + + $$("body")[0].setAttribute("view-mode", view_mode); + + return Feeds.reloadCurrent(''); + }, + hotkeyHandler: function(event) { + if (event.target.nodeName == "INPUT" || event.target.nodeName == "TEXTAREA") return; + + // Arrow buttons and escape are not reported via keypress, handle them via keydown. + // escape = 27, left = 37, up = 38, right = 39, down = 40, pgup = 33, pgdn = 34, insert = 45, delete = 46 + if (event.type == "keydown" && event.which != 27 && (event.which < 33 || event.which > 46)) return; + + const action_name = this.keyeventToAction(event); + + if (action_name) { + const action_func = this.hotkey_actions[action_name]; + + if (action_func != null) { + action_func(event); + event.stopPropagation(); + return false; + } + } + }, + switchPanelMode: function(wide) { + const article_id = Article.getActive(); + + if (wide) { + dijit.byId("headlines-wrap-inner").attr("design", 'sidebar'); + dijit.byId("content-insert").attr("region", "trailing"); + + dijit.byId("content-insert").domNode.setStyle({width: '50%', + height: 'auto', + borderTopWidth: '0px' }); + + if (parseInt(Cookie.get("ttrss_ci_width")) > 0) { + dijit.byId("content-insert").domNode.setStyle( + {width: Cookie.get("ttrss_ci_width") + "px" }); + } + + $("headlines-frame").setStyle({ borderBottomWidth: '0px' }); + $("headlines-frame").addClassName("wide"); + + } else { + + dijit.byId("content-insert").attr("region", "bottom"); + + dijit.byId("content-insert").domNode.setStyle({width: 'auto', + height: '50%', + borderTopWidth: '0px'}); + + if (parseInt(Cookie.get("ttrss_ci_height")) > 0) { + dijit.byId("content-insert").domNode.setStyle( + {height: Cookie.get("ttrss_ci_height") + "px" }); + } + + $("headlines-frame").setStyle({ borderBottomWidth: '1px' }); + $("headlines-frame").removeClassName("wide"); + + } + + Article.close(); + + if (article_id) Article.view(article_id); + + xhrPost("backend.php", {op: "rpc", method: "setpanelmode", wide: wide ? 1 : 0}); + }, + initHotkeyActions: function() { + if (this.is_prefs) { + + this.hotkey_actions["feed_subscribe"] = () => { + CommonDialogs.quickAddFeed(); + }; + + this.hotkey_actions["create_label"] = () => { + CommonDialogs.addLabel(); + }; + + this.hotkey_actions["create_filter"] = () => { + Filters.quickAddFilter(); + }; + + this.hotkey_actions["help_dialog"] = () => { + this.helpDialog("main"); + }; + + } else { + + this.hotkey_actions["next_feed"] = () => { + const rv = dijit.byId("feedTree").getNextFeed( + Feeds.getActive(), Feeds.activeIsCat()); + + if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true}) + }; + this.hotkey_actions["prev_feed"] = () => { + const rv = dijit.byId("feedTree").getPreviousFeed( + Feeds.getActive(), Feeds.activeIsCat()); + + if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true}) + }; + this.hotkey_actions["next_article_or_scroll"] = (event) => { + if (this.isCombinedMode()) + Headlines.scroll(Headlines.line_scroll_offset, event); + else + Headlines.move('next'); + }; + this.hotkey_actions["prev_article_or_scroll"] = (event) => { + if (this.isCombinedMode()) + Headlines.scroll(-Headlines.line_scroll_offset, event); + else + Headlines.move('prev'); + }; + this.hotkey_actions["next_article_noscroll"] = () => { + Headlines.move('next'); + }; + this.hotkey_actions["prev_article_noscroll"] = () => { + Headlines.move('prev'); + }; + this.hotkey_actions["next_article_noexpand"] = () => { + Headlines.move('next', {no_expand: true}); + }; + this.hotkey_actions["prev_article_noexpand"] = () => { + Headlines.move('prev', {no_expand: true}); + }; + this.hotkey_actions["search_dialog"] = () => { + Feeds.search(); + }; + this.hotkey_actions["cancel_search"] = () => { + Feeds.cancelSearch(); + }; + this.hotkey_actions["toggle_mark"] = () => { + Headlines.selectionToggleMarked(); + }; + this.hotkey_actions["toggle_publ"] = () => { + Headlines.selectionTogglePublished(); + }; + this.hotkey_actions["toggle_unread"] = () => { + Headlines.selectionToggleUnread({no_error: 1}); + }; + this.hotkey_actions["edit_tags"] = () => { + const id = Article.getActive(); + if (id) { + Article.editTags(id); + } + }; + this.hotkey_actions["open_in_new_window"] = () => { + if (Article.getActive()) { + Article.openInNewWindow(Article.getActive()); + } + }; + this.hotkey_actions["catchup_below"] = () => { + Headlines.catchupRelativeTo(1); + }; + this.hotkey_actions["catchup_above"] = () => { + Headlines.catchupRelativeTo(0); + }; + this.hotkey_actions["article_scroll_down"] = (event) => { + if (this.isCombinedMode()) + Headlines.scroll(Headlines.line_scroll_offset, event); + else + Article.scroll(Headlines.line_scroll_offset, event); + }; + this.hotkey_actions["article_scroll_up"] = (event) => { + if (this.isCombinedMode()) + Headlines.scroll(-Headlines.line_scroll_offset, event); + else + Article.scroll(-Headlines.line_scroll_offset, event); + }; + this.hotkey_actions["next_headlines_page"] = (event) => { + Headlines.scrollByPages(1, event); + }; + this.hotkey_actions["prev_headlines_page"] = (event) => { + Headlines.scrollByPages(-1, event); + }; + this.hotkey_actions["article_page_down"] = (event) => { + if (this.isCombinedMode()) + Headlines.scrollByPages(1, event); + else + Article.scrollByPages(1, event); + }; + this.hotkey_actions["article_page_up"] = (event) => { + if (this.isCombinedMode()) + Headlines.scrollByPages(-1, event); + else + Article.scrollByPages(-1, event); + }; + this.hotkey_actions["close_article"] = () => { + if (this.isCombinedMode()) { + Article.cdmUnsetActive(); + } else { + Article.close(); + } + }; + this.hotkey_actions["email_article"] = () => { + if (typeof Plugins.Mail != "undefined") { + Plugins.Mail.onHotkey(Headlines.getSelected()); + } else { + alert(__("Please enable mail or mailto plugin first.")); + } + }; + this.hotkey_actions["select_all"] = () => { + Headlines.select('all'); + }; + this.hotkey_actions["select_unread"] = () => { + Headlines.select('unread'); + }; + this.hotkey_actions["select_marked"] = () => { + Headlines.select('marked'); + }; + this.hotkey_actions["select_published"] = () => { + Headlines.select('published'); + }; + this.hotkey_actions["select_invert"] = () => { + Headlines.select('invert'); + }; + this.hotkey_actions["select_none"] = () => { + Headlines.select('none'); + }; + this.hotkey_actions["feed_refresh"] = () => { + if (typeof Feeds.getActive() != "undefined") { + Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat()}); + } + }; + this.hotkey_actions["feed_unhide_read"] = () => { + Feeds.toggleUnread(); + }; + this.hotkey_actions["feed_subscribe"] = () => { + CommonDialogs.quickAddFeed(); + }; + this.hotkey_actions["feed_debug_update"] = () => { + if (!Feeds.activeIsCat() && parseInt(Feeds.getActive()) > 0) { + //window.open("backend.php?op=feeds&method=update_debugger&feed_id=" + Feeds.getActive()); + + /* global __csrf_token */ + App.postOpenWindow("backend.php", {op: "feeds", method: "update_debugger", feed_id: Feeds.getActive(), csrf_token: __csrf_token}); + + } else { + alert("You can't debug this kind of feed."); + } + }; + + this.hotkey_actions["feed_debug_viewfeed"] = () => { + Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), viewfeed_debug: true}); + }; + + this.hotkey_actions["feed_edit"] = () => { + if (Feeds.activeIsCat()) + alert(__("You can't edit this kind of feed.")); + else + CommonDialogs.editFeed(Feeds.getActive()); + }; + this.hotkey_actions["feed_catchup"] = () => { + if (typeof Feeds.getActive() != "undefined") { + Feeds.catchupCurrent(); + } + }; + this.hotkey_actions["feed_reverse"] = () => { + Headlines.reverse(); + }; + this.hotkey_actions["feed_toggle_vgroup"] = () => { + xhrPost("backend.php", {op: "rpc", method: "togglepref", key: "VFEED_GROUP_BY_FEED"}, () => { + Feeds.reloadCurrent(); + }) + }; + this.hotkey_actions["catchup_all"] = () => { + Feeds.catchupAll(); + }; + this.hotkey_actions["cat_toggle_collapse"] = () => { + if (Feeds.activeIsCat()) { + dijit.byId("feedTree").collapseCat(Feeds.getActive()); + } + }; + this.hotkey_actions["goto_read"] = () => { + Feeds.open({feed: -6}); + }; + this.hotkey_actions["goto_all"] = () => { + Feeds.open({feed: -4}); + }; + this.hotkey_actions["goto_fresh"] = () => { + Feeds.open({feed: -3}); + }; + this.hotkey_actions["goto_marked"] = () => { + Feeds.open({feed: -1}); + }; + this.hotkey_actions["goto_published"] = () => { + Feeds.open({feed: -2}); + }; + this.hotkey_actions["goto_tagcloud"] = () => { + this.displayDlg(__("Tag cloud"), "printTagCloud"); + }; + this.hotkey_actions["goto_prefs"] = () => { + document.location.href = "prefs.php"; + }; + this.hotkey_actions["select_article_cursor"] = () => { + const id = Article.getUnderPointer(); + if (id) { + const row = $("RROW-" + id); + + if (row) + row.toggleClassName("Selected"); + } + }; + this.hotkey_actions["create_label"] = () => { + CommonDialogs.addLabel(); + }; + this.hotkey_actions["create_filter"] = () => { + Filters.quickAddFilter(); + }; + this.hotkey_actions["collapse_sidebar"] = () => { + Feeds.toggle(); + }; + this.hotkey_actions["toggle_full_text"] = () => { + if (typeof Plugins.Af_Readability != "undefined") { + if (Article.getActive()) + Plugins.Af_Readability.embed(Article.getActive()); + } else { + alert(__("Please enable af_readability first.")); + } + }; + this.hotkey_actions["toggle_widescreen"] = () => { + if (!this.isCombinedMode()) { + this._widescreen_mode = !this._widescreen_mode; + + // reset stored sizes because geometry changed + Cookie.set("ttrss_ci_width", 0); + Cookie.set("ttrss_ci_height", 0); + + this.switchPanelMode(this._widescreen_mode); + } else { + alert(__("Widescreen is not available in combined mode.")); + } + }; + this.hotkey_actions["help_dialog"] = () => { + this.helpDialog("main"); + }; + this.hotkey_actions["toggle_combined_mode"] = () => { + const value = this.isCombinedMode() ? "false" : "true"; + + xhrPost("backend.php", {op: "rpc", method: "setpref", key: "COMBINED_DISPLAY_MODE", value: value}, () => { + this.setInitParam("combined_display_mode", + !this.getInitParam("combined_display_mode")); + + Article.close(); + Headlines.renderAgain(); + }) + }; + this.hotkey_actions["toggle_cdm_expanded"] = () => { + const value = this.getInitParam("cdm_expanded") ? "false" : "true"; + + xhrPost("backend.php", {op: "rpc", method: "setpref", key: "CDM_EXPANDED", value: value}, () => { + this.setInitParam("cdm_expanded", !this.getInitParam("cdm_expanded")); + Headlines.renderAgain(); + }); + }; + } + }, + onActionSelected: function(opid) { + switch (opid) { + case "qmcPrefs": + document.location.href = "prefs.php"; + break; + case "qmcLogout": + App.postCurrentWindow("public.php", {op: "logout", csrf_token: __csrf_token}); + break; + case "qmcTagCloud": + this.displayDlg(__("Tag cloud"), "printTagCloud"); + break; + case "qmcSearch": + Feeds.search(); + break; + case "qmcAddFeed": + CommonDialogs.quickAddFeed(); + break; + case "qmcDigest": + window.location.href = "backend.php?op=digest"; + break; + case "qmcEditFeed": + if (Feeds.activeIsCat()) + alert(__("You can't edit this kind of feed.")); + else + CommonDialogs.editFeed(Feeds.getActive()); + break; + case "qmcRemoveFeed": + { + const actid = Feeds.getActive(); + + if (!actid) { + alert(__("Please select some feed first.")); + return; + } + + if (Feeds.activeIsCat()) { + alert(__("You can't unsubscribe from the category.")); + return; + } + + const fn = Feeds.getName(actid); + + if (confirm(__("Unsubscribe from %s?").replace("%s", fn))) { + CommonDialogs.unsubscribeFeed(actid); + } + } + break; + case "qmcCatchupAll": + Feeds.catchupAll(); + break; + case "qmcShowOnlyUnread": + Feeds.toggleUnread(); + break; + case "qmcToggleWidescreen": + if (!this.isCombinedMode()) { + this._widescreen_mode = !this._widescreen_mode; + + // reset stored sizes because geometry changed + Cookie.set("ttrss_ci_width", 0); + Cookie.set("ttrss_ci_height", 0); + + this.switchPanelMode(this._widescreen_mode); + } else { + alert(__("Widescreen is not available in combined mode.")); + } + break; + case "qmcHKhelp": + this.helpDialog("main"); + break; + default: + console.log("quickMenuGo: unknown action: " + opid); + } + } +} + diff --git a/js/AppBase.js b/js/AppBase.js deleted file mode 100644 index 86cc44e8a..000000000 --- a/js/AppBase.js +++ /dev/null @@ -1,494 +0,0 @@ -'use strict' -/* global __, ngettext */ -define(["dojo/_base/declare"], function (declare) { - return declare("fox.AppBase", null, { - _initParams: [], - _rpc_seq: 0, - hotkey_prefix: 0, - hotkey_prefix_pressed: false, - hotkey_prefix_timeout: 0, - constructor: function() { - window.onerror = this.Error.onWindowError; - }, - getInitParam: function(k) { - return this._initParams[k]; - }, - setInitParam: function(k, v) { - this._initParams[k] = v; - }, - nightModeChanged: function(is_night, link) { - console.log("night mode changed to", is_night); - - if (link) { - const css_override = is_night ? "themes/night.css" : "themes/light.css"; - link.setAttribute("href", css_override + "?" + Date.now()); - } - }, - setupNightModeDetection: function(callback) { - if (!$("theme_css")) { - const mql = window.matchMedia('(prefers-color-scheme: dark)'); - - try { - mql.addEventListener("change", () => { - this.nightModeChanged(mql.matches, $("theme_auto_css")); - }); - } catch (e) { - console.warn("exception while trying to set MQL event listener"); - } - - const link = new Element("link", { - rel: "stylesheet", - id: "theme_auto_css" - }); - - if (callback) { - link.onload = function () { - document.querySelector("body").removeClassName("css_loading"); - callback(); - }; - - link.onerror = function(event) { - alert("Fatal error while loading application stylesheet: " + link.getAttribute("href")); - } - } - - this.nightModeChanged(mql.matches, link); - - document.querySelector("head").appendChild(link); - } else { - document.querySelector("body").removeClassName("css_loading"); - - if (callback) callback(); - } - }, - enableCsrfSupport: function() { - Ajax.Base.prototype.initialize = Ajax.Base.prototype.initialize.wrap( - function (callOriginal, options) { - - if (App.getInitParam("csrf_token") != undefined) { - Object.extend(options, options || { }); - - if (Object.isString(options.parameters)) - options.parameters = options.parameters.toQueryParams(); - else if (Object.isHash(options.parameters)) - options.parameters = options.parameters.toObject(); - - options.parameters["csrf_token"] = App.getInitParam("csrf_token"); - } - - return callOriginal(options); - } - ); - }, - urlParam: function(param) { - return String(window.location.href).parseQuery()[param]; - }, - next_seq: function() { - this._rpc_seq += 1; - return this._rpc_seq; - }, - get_seq: function() { - return this._rpc_seq; - }, - setLoadingProgress: function(p) { - loading_progress += p; - - if (dijit.byId("loading_bar")) - dijit.byId("loading_bar").update({progress: loading_progress}); - - if (loading_progress >= 90) { - $("overlay").hide(); - } - - }, - keyeventToAction: function(event) { - - const hotkeys_map = App.getInitParam("hotkeys"); - const keycode = event.which; - const keychar = String.fromCharCode(keycode); - - if (keycode == 27) { // escape and drop prefix - this.hotkey_prefix = false; - } - - if (!this.hotkey_prefix && hotkeys_map[0].indexOf(keychar) != -1) { - - this.hotkey_prefix = keychar; - $("cmdline").innerHTML = keychar; - Element.show("cmdline"); - - window.clearTimeout(this.hotkey_prefix_timeout); - this.hotkey_prefix_timeout = window.setTimeout(() => { - this.hotkey_prefix = false; - Element.hide("cmdline"); - }, 3 * 1000); - - event.stopPropagation(); - - return false; - } - - Element.hide("cmdline"); - - let hotkey_name = ""; - - if (event.type == "keydown") { - hotkey_name = "(" + keycode + ")"; - - // ensure ^*char notation - if (event.shiftKey) hotkey_name = "*" + hotkey_name; - if (event.ctrlKey) hotkey_name = "^" + hotkey_name; - if (event.altKey) hotkey_name = "+" + hotkey_name; - if (event.metaKey) hotkey_name = "%" + hotkey_name; - } else { - hotkey_name = keychar ? keychar : "(" + keycode + ")"; - } - - const hotkey_full = this.hotkey_prefix ? this.hotkey_prefix + " " + hotkey_name : hotkey_name; - this.hotkey_prefix = false; - - let action_name = false; - - for (const sequence in hotkeys_map[1]) { - if (hotkeys_map[1].hasOwnProperty(sequence)) { - if (sequence == hotkey_full) { - action_name = hotkeys_map[1][sequence]; - break; - } - } - } - - console.log('keyeventToAction', hotkey_full, '=>', action_name); - - return action_name; - }, - cleanupMemory: function(root) { - const dijits = dojo.query("[widgetid]", dijit.byId(root).domNode).map(dijit.byNode); - - dijits.each(function (d) { - dojo.destroy(d.domNode); - }); - - $$("#" + root + " *").each(function (i) { - i.parentNode ? i.parentNode.removeChild(i) : true; - }); - }, - helpDialog: function(topic) { - const query = "backend.php?op=backend&method=help&topic=" + encodeURIComponent(topic); - - if (dijit.byId("helpDlg")) - dijit.byId("helpDlg").destroyRecursive(); - - const dialog = new dijit.Dialog({ - id: "helpDlg", - title: __("Help"), - style: "width: 600px", - href: query, - }); - - dialog.show(); - }, - displayDlg: function(title, id, param, callback) { - Notify.progress("Loading, please wait...", true); - - const query = {op: "dlg", method: id, param: param}; - - xhrPost("backend.php", query, (transport) => { - try { - const content = transport.responseText; - - let dialog = dijit.byId("infoBox"); - - if (!dialog) { - dialog = new dijit.Dialog({ - title: title, - id: 'infoBox', - style: "width: 600px", - onCancel: function () { - return true; - }, - onExecute: function () { - return true; - }, - onClose: function () { - return true; - }, - content: content - }); - } else { - dialog.attr('title', title); - dialog.attr('content', content); - } - - dialog.show(); - - Notify.close(); - - if (callback) callback(transport); - } catch (e) { - this.Error.report(e); - } - }); - - return false; - }, - handleRpcJson: function(transport) { - - const netalert = $$("#toolbar .net-alert")[0]; - - try { - const reply = JSON.parse(transport.responseText); - - if (reply) { - const error = reply['error']; - - if (error) { - const code = error['code']; - const msg = error['message']; - - console.warn("[handleRpcJson] received fatal error ", code, msg); - - if (code != 0) { - /* global ERRORS */ - this.Error.fatal(ERRORS[code], {info: msg, code: code}); - return false; - } - } - - const seq = reply['seq']; - - if (seq && this.get_seq() != seq) { - console.log("[handleRpcJson] sequence mismatch: ", seq, '!=', this.get_seq()); - return true; - } - - const message = reply['message']; - - if (message == "UPDATE_COUNTERS") { - console.log("need to refresh counters..."); - Feeds.requestCounters(true); - } - - const counters = reply['counters']; - - if (counters) - Feeds.parseCounters(counters); - - const runtime_info = reply['runtime-info']; - - if (runtime_info) - App.parseRuntimeInfo(runtime_info); - - if (netalert) netalert.hide(); - - return reply; - - } else { - if (netalert) netalert.show(); - - Notify.error("Communication problem with server."); - } - - } catch (e) { - if (netalert) netalert.show(); - - Notify.error("Communication problem with server."); - - console.error(e); - } - - return false; - }, - parseRuntimeInfo: function(data) { - for (const k in data) { - if (data.hasOwnProperty(k)) { - const v = data[k]; - - console.log("RI:", k, "=>", v); - - if (k == "daemon_is_running" && v != 1) { - Notify.error("<span onclick=\"App.explainError(1)\">Update daemon is not running.</span>", true); - return; - } - - if (k == "recent_log_events") { - const alert = $$(".log-alert")[0]; - - if (alert) { - v > 0 ? alert.show() : alert.hide(); - } - } - - if (k == "daemon_stamp_ok" && v != 1) { - Notify.error("<span onclick=\"App.explainError(3)\">Update daemon is not updating feeds.</span>", true); - return; - } - - if (k == "max_feed_id" || k == "num_feeds") { - if (App.getInitParam(k) != v) { - console.log("feed count changed, need to reload feedlist."); - Feeds.reload(); - } - } - - this.setInitParam(k, v); - } - } - - PluginHost.run(PluginHost.HOOK_RUNTIME_INFO_LOADED, data); - }, - backendSanityCallback: function (transport) { - const reply = JSON.parse(transport.responseText); - - /* global ERRORS */ - - if (!reply) { - this.Error.fatal(ERRORS[3], {info: transport.responseText}); - return; - } - - if (reply['error']) { - const code = reply['error']['code']; - - if (code && code != 0) { - return this.Error.fatal(ERRORS[code], - {code: code, info: reply['error']['message']}); - } - } - - console.log("sanity check ok"); - - const params = reply['init-params']; - - if (params) { - console.log('reading init-params...'); - - for (const k in params) { - if (params.hasOwnProperty(k)) { - switch (k) { - case "label_base_index": - LABEL_BASE_INDEX = parseInt(params[k]); - break; - case "cdm_auto_catchup": - if (params[k] == 1) { - const hl = $("headlines-frame"); - if (hl) hl.addClassName("auto_catchup"); - } - break; - case "hotkeys": - // filter mnemonic definitions (used for help panel) from hotkeys map - // i.e. *(191)|Ctrl-/ -> *(191) - - const tmp = []; - for (const sequence in params[k][1]) { - if (params[k][1].hasOwnProperty(sequence)) { - const filtered = sequence.replace(/\|.*$/, ""); - tmp[filtered] = params[k][1][sequence]; - } - } - - params[k][1] = tmp; - break; - } - - console.log("IP:", k, "=>", params[k]); - this.setInitParam(k, params[k]); - } - } - - // PluginHost might not be available on non-index pages - if (typeof PluginHost !== 'undefined') - PluginHost.run(PluginHost.HOOK_PARAMS_LOADED, App._initParams); - } - - this.initSecondStage(); - }, - explainError: function(code) { - return this.displayDlg(__("Error explained"), "explainError", code); - }, - Error: { - fatal: function (error, params) { - params = params || {}; - - if (params.code) { - if (params.code == 6) { - window.location.href = "index.php"; - return; - } else if (params.code == 5) { - window.location.href = "public.php?op=dbupdate"; - return; - } - } - - return this.report(error, - Object.extend({title: __("Fatal error")}, params)); - }, - report: function(error, params) { - params = params || {}; - - if (!error) return; - - console.error("[Error.report]", error, params); - - const message = params.message ? params.message : error.toString(); - - try { - xhrPost("backend.php", - {op: "rpc", method: "log", - file: params.filename ? params.filename : error.fileName, - line: params.lineno ? params.lineno : error.lineNumber, - msg: message, - context: error.stack}, - (transport) => { - console.warn("[Error.report] log response", transport.responseText); - }); - } catch (re) { - console.error("[Error.report] exception while saving logging error on server", re); - } - - try { - if (dijit.byId("exceptionDlg")) - dijit.byId("exceptionDlg").destroyRecursive(); - - let stack_msg = ""; - - if (error.stack) - stack_msg += `<div><b>Stack trace:</b></div> - <textarea name="stack" readonly="1">${error.stack}</textarea>`; - - if (params.info) - stack_msg += `<div><b>Additional information:</b></div> - <textarea name="stack" readonly="1">${params.info}</textarea>`; - - let content = `<div class="error-contents"> - <p class="message">${message}</p> - ${stack_msg} - <div class="dlgButtons"> - <button dojoType="dijit.form.Button" - onclick=\"dijit.byId('exceptionDlg').hide()">${__('Close this window')}</button> - </div> - </div>`; - - const dialog = new dijit.Dialog({ - id: "exceptionDlg", - title: params.title || __("Unhandled exception"), - style: "width: 600px", - content: content - }); - - dialog.show(); - } catch (de) { - console.error("[Error.report] exception while showing error dialog", de); - - alert(error.stack ? error.stack : message); - } - - }, - onWindowError: function (message, filename, lineno, colno, error) { - // called without context (this) from window.onerror - App.Error.report(error, - {message: message, filename: filename, lineno: lineno, colno: colno}); - }, - } - }); -}); diff --git a/js/Article.js b/js/Article.js index 50447c2a1..76637cd69 100644 --- a/js/Article.js +++ b/js/Article.js @@ -1,243 +1,272 @@ 'use strict' -/* global __, ngettext */ -define(["dojo/_base/declare"], function (declare) { - Article = { - _scroll_reset_timeout: false, - getScoreClass: function (score) { - if (score > 500) { - return "score-high"; - } else if (score > 0) { - return "score-half-high"; - } else if (score < -100) { - return "score-low"; - } else if (score < 0) { - return "score-half-low"; - } else { - return "score-neutral"; - } - }, - getScorePic: function (score) { - if (score > 500) { - return "trending_up"; - } else if (score > 0) { - return "trending_up"; - } else if (score < 0) { - return "trending_down"; - } else { - return "trending_neutral"; - } - }, - selectionSetScore: function () { - const ids = Headlines.getSelected(); - if (ids.length > 0) { - const score = prompt(__("Please enter new score for selected articles:")); +/* global __, ngettext, App, Headlines, xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Ajax */ + +const Article = { + _scroll_reset_timeout: false, + getScoreClass: function (score) { + if (score > 500) { + return "score-high"; + } else if (score > 0) { + return "score-half-high"; + } else if (score < -100) { + return "score-low"; + } else if (score < 0) { + return "score-half-low"; + } else { + return "score-neutral"; + } + }, + getScorePic: function (score) { + if (score > 500) { + return "trending_up"; + } else if (score > 0) { + return "trending_up"; + } else if (score < 0) { + return "trending_down"; + } else { + return "trending_neutral"; + } + }, + selectionSetScore: function () { + const ids = Headlines.getSelected(); - if (!isNaN(parseInt(score))) { - ids.each((id) => { - const row = $("RROW-" + id); + if (ids.length > 0) { + const score = prompt(__("Please enter new score for selected articles:")); - if (row) { - row.setAttribute("data-score", score); + if (!isNaN(parseInt(score))) { + ids.each((id) => { + const row = $("RROW-" + id); - const pic = row.select(".icon-score")[0]; + if (row) { + row.setAttribute("data-score", score); - pic.innerHTML = Article.getScorePic(score); - pic.setAttribute("title", score); + const pic = row.select(".icon-score")[0]; - ["score-low", "score-high", "score-half-low", "score-half-high", "score-neutral"] - .each(function(scl) { - if (row.hasClassName(scl)) - row.removeClassName(scl); - }); + pic.innerHTML = Article.getScorePic(score); + pic.setAttribute("title", score); - row.addClassName(Article.getScoreClass(score)); - } - }); - } + ["score-low", "score-high", "score-half-low", "score-half-high", "score-neutral"] + .each(function(scl) { + if (row.hasClassName(scl)) + row.removeClassName(scl); + }); - } else { - alert(__("No articles selected.")); + row.addClassName(Article.getScoreClass(score)); + } + }); } - }, - setScore: function (id, pic) { - const row = pic.up("div[id*=RROW]"); - if (row) { - const score_old = row.getAttribute("data-score"); - const score = prompt(__("Please enter new score for this article:"), score_old); - - if (!isNaN(parseInt(score))) { - row.setAttribute("data-score", score); + } else { + alert(__("No articles selected.")); + } + }, + setScore: function (id, pic) { + const row = pic.up("div[id*=RROW]"); - const pic = row.select(".icon-score")[0]; + if (row) { + const score_old = row.getAttribute("data-score"); + const score = prompt(__("Please enter new score for this article:"), score_old); - pic.innerHTML = Article.getScorePic(score); - pic.setAttribute("title", score); + if (!isNaN(parseInt(score))) { + row.setAttribute("data-score", score); - ["score-low", "score-high", "score-half-low", "score-half-high", "score-neutral"] - .each(function(scl) { - if (row.hasClassName(scl)) - row.removeClassName(scl); - }); + const pic = row.select(".icon-score")[0]; - row.addClassName(Article.getScoreClass(score)); - } - } - }, - cdmUnsetActive: function (event) { - const row = $("RROW-" + Article.getActive()); + pic.innerHTML = Article.getScorePic(score); + pic.setAttribute("title", score); - if (row) { - row.removeClassName("active"); - - if (event) - event.stopPropagation(); + ["score-low", "score-high", "score-half-low", "score-half-high", "score-neutral"] + .each(function(scl) { + if (row.hasClassName(scl)) + row.removeClassName(scl); + }); - return false; + row.addClassName(Article.getScoreClass(score)); } - }, - close: function () { - if (dijit.byId("content-insert")) - dijit.byId("headlines-wrap-inner").removeChild( - dijit.byId("content-insert")); - - Article.setActive(0); - }, - displayUrl: function (id) { - const query = {op: "rpc", method: "getlinktitlebyid", id: id}; - - xhrJson("backend.php", query, (reply) => { - if (reply && reply.link) { - prompt(__("Article URL:"), reply.link); - } - }); - }, - openInNewWindow: function (id) { - const w = window.open(""); + } + }, + popupOpenUrl: function(url) { + const w = window.open(""); + + w.opener = null; + w.location = url; + }, + /* popupOpenArticle: function(id) { + const w = window.open("", + "ttrss_article_popup", + "height=900,width=900,resizable=yes,status=no,location=no,menubar=no,directories=no,scrollbars=yes,toolbar=no"); + + if (w) { + w.opener = null; + w.location = "backend.php?op=article&method=view&mode=raw&html=1&zoom=1&id=" + id + "&csrf_token=" + App.getInitParam("csrf_token"); + } + }, */ + cdmUnsetActive: function (event) { + const row = $("RROW-" + Article.getActive()); - if (w) { - w.opener = null; - w.location = "backend.php?op=article&method=redirect&id=" + id; + if (row) { + row.removeClassName("active"); - Headlines.toggleUnread(id, 0); - } - }, - render: function (article) { - App.cleanupMemory("content-insert"); + if (event) + event.stopPropagation(); - dijit.byId("headlines-wrap-inner").addChild( + return false; + } + }, + close: function () { + if (dijit.byId("content-insert")) + dijit.byId("headlines-wrap-inner").removeChild( dijit.byId("content-insert")); - const c = dijit.byId("content-insert"); + Article.setActive(0); + }, + displayUrl: function (id) { + const query = {op: "rpc", method: "getlinktitlebyid", id: id}; - try { - c.domNode.scrollTop = 0; - } catch (e) { + xhrJson("backend.php", query, (reply) => { + if (reply && reply.link) { + prompt(__("Article URL:"), reply.link); } + }); + }, + openInNewWindow: function (id) { + /* global __csrf_token */ + App.postOpenWindow("backend.php", + { "op": "article", "method": "redirect", "id": id, "csrf_token": __csrf_token }); + + Headlines.toggleUnread(id, 0); + }, + render: function (article) { + App.cleanupMemory("content-insert"); + + dijit.byId("headlines-wrap-inner").addChild( + dijit.byId("content-insert")); + + const c = dijit.byId("content-insert"); + + try { + c.domNode.scrollTop = 0; + } catch (e) { + } - c.attr('content', article); - PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, c.domNode); - - Headlines.correctHeadlinesOffset(Article.getActive()); + c.attr('content', article); + PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, c.domNode); - try { - c.focus(); - } catch (e) { - } - }, - formatComments: function(hl) { - let comments = ""; + //Headlines.correctHeadlinesOffset(Article.getActive()); - if (hl.comments) { - let comments_msg = __("comments"); + try { + c.focus(); + } catch (e) { + } + }, + formatComments: function(hl) { + let comments = ""; - if (hl.num_comments > 0) { - comments_msg = hl.num_comments + " " + ngettext("comment", "comments", hl.num_comments) - } + if (hl.comments || hl.num_comments > 0) { + let comments_msg = __("comments"); - comments = `<a href="${escapeHtml(hl.comments)}">(${comments_msg})</a>`; + if (hl.num_comments > 0) { + comments_msg = hl.num_comments + " " + ngettext("comment", "comments", hl.num_comments) } - return comments; - }, - formatOriginallyFrom: function(hl) { - return hl.orig_feed ? `<span> - ${__('Originally from:')} <a target="_blank" rel="noopener noreferrer" href="${escapeHtml(hl.orig_feed[1])}">${hl.orig_feed[0]}</a> - </span>` : ""; - }, - unpack: function(row) { - if (row.hasAttribute("data-content")) { - console.log("unpacking: " + row.id); + comments = `<a target="_blank" rel="noopener noreferrer" href="${App.escapeHtml(hl.comments ? hl.comments : hl.link)}">(${comments_msg})</a>`; + } - const container = row.querySelector(".content-inner"); + return comments; + }, + formatOriginallyFrom: function(hl) { + return hl.orig_feed ? `<span> + ${__('Originally from:')} <a target="_blank" rel="noopener noreferrer" href="${App.escapeHtml(hl.orig_feed[1])}">${hl.orig_feed[0]}</a> + </span>` : ""; + }, + unpack: function(row) { + if (row.hasAttribute("data-content")) { + console.log("unpacking: " + row.id); - container.innerHTML = row.getAttribute("data-content").trim(); + const container = row.querySelector(".content-inner"); - // blank content element might screw up onclick selection and keyboard moving - if (container.textContent.length == 0) - container.innerHTML += " "; + container.innerHTML = row.getAttribute("data-content").trim(); - row.removeAttribute("data-content"); + // blank content element might screw up onclick selection and keyboard moving + if (container.textContent.length == 0) + container.innerHTML += " "; - PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row); - } - }, - view: function (id, noexpand) { - this.setActive(id); - - if (!noexpand) { - const hl = Headlines.objectById(id); - - if (hl) { - - const comments = this.formatComments(hl); - const originally_from = this.formatOriginallyFrom(hl); - - const article = `<div class="post post-${hl.id}" data-article-id="${hl.id}"> - <div class="header"> - <div class="row"> - <div class="title"><a target="_blank" rel="noopener noreferrer" - title="${escapeHtml(hl.title)}" - href="${escapeHtml(hl.link)}">${hl.title}</a></div> - <div class="date">${hl.updated_long}</div> - </div> - <div class="row"> - <div class="buttons left">${hl.buttons_left}</div> - <div class="comments">${comments}</div> - <div class="author">${hl.author}</div> - <i class="material-icons">label_outline</i> - <span id="ATSTR-${hl.id}">${hl.tags_str}</span> - <a title="${__("Edit tags for this article")}" href="#" - onclick="Article.editTags(${hl.id})">(+)</a> - <div class="buttons right">${hl.buttons}</div> - </div> + // in expandable mode, save content for later, so that we can pack unfocused rows back + if (App.isCombinedMode() && $("main").hasClassName("expandable")) + row.setAttribute("data-content-original", row.getAttribute("data-content")); + + row.removeAttribute("data-content"); + + PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row); + } + }, + pack: function(row) { + if (row.hasAttribute("data-content-original")) { + console.log("packing", row.id); + row.setAttribute("data-content", row.getAttribute("data-content-original")); + row.removeAttribute("data-content-original"); + + row.querySelector(".content-inner").innerHTML = " "; + } + }, + view: function (id, no_expand) { + this.setActive(id); + Headlines.scrollToArticleId(id); + + if (!no_expand) { + const hl = Headlines.objectById(id); + + if (hl) { + + const comments = this.formatComments(hl); + const originally_from = this.formatOriginallyFrom(hl); + + const article = `<div class="post post-${hl.id}" data-article-id="${hl.id}"> + <div class="header"> + <div class="row"> + <div class="title"><a target="_blank" rel="noopener noreferrer" + title="${App.escapeHtml(hl.title)}" + href="${App.escapeHtml(hl.link)}">${hl.title}</a></div> + <div class="date">${hl.updated_long}</div> </div> - <div id="POSTNOTE-${hl.id}">${hl.note}</div> - <div class="content" lang="${hl.lang ? hl.lang : 'en'}"> - ${originally_from} - ${hl.content} - ${hl.enclosures} + <div class="row"> + <div class="buttons left">${hl.buttons_left}</div> + <div class="comments">${comments}</div> + <div class="author">${hl.author}</div> + <i class="material-icons">label_outline</i> + <span id="ATSTR-${hl.id}">${hl.tags_str}</span> + <a title="${__("Edit tags for this article")}" href="#" + onclick="Article.editTags(${hl.id})">(+)</a> + <div class="buttons right">${hl.buttons}</div> </div> - </div>`; + </div> + <div id="POSTNOTE-${hl.id}">${hl.note}</div> + <div class="content" lang="${hl.lang ? hl.lang : 'en'}"> + ${originally_from} + ${hl.content} + ${hl.enclosures} + </div> + </div>`; - Headlines.toggleUnread(id, 0); - this.render(article); - } + Headlines.toggleUnread(id, 0); + this.render(article); } + } - return false; - }, - editTags: function (id) { - const query = "backend.php?op=article&method=editArticleTags¶m=" + encodeURIComponent(id); + return false; + }, + editTags: function (id) { + if (dijit.byId("editTagsDlg")) + dijit.byId("editTagsDlg").destroyRecursive(); - if (dijit.byId("editTagsDlg")) - dijit.byId("editTagsDlg").destroyRecursive(); + xhrPost("backend.php", {op: "article", method: "editarticletags", param: id}, (transport) => { const dialog = new dijit.Dialog({ id: "editTagsDlg", title: __("Edit article Tags"), style: "width: 600px", + content: transport.responseText, execute: function () { if (this.validate()) { Notify.progress("Saving article tags...", true); @@ -264,7 +293,6 @@ define(["dojo/_base/declare"], function (declare) { }); } }, - href: query }); const tmph = dojo.connect(dialog, 'onLoad', function () { @@ -276,39 +304,31 @@ define(["dojo/_base/declare"], function (declare) { }); dialog.show(); - }, - cdmScrollToId: function (id, force, event) { - const ctr = $("headlines-frame"); - const e = $("RROW-" + id); - const is_expanded = App.getInitParam("cdm_expanded"); - - if (!e || !ctr) return; - if (force || is_expanded || e.offsetTop + e.offsetHeight > (ctr.scrollTop + ctr.offsetHeight) || - e.offsetTop < ctr.scrollTop) { + }); - if (event && event.repeat || !is_expanded) { - ctr.addClassName("forbid-smooth-scroll"); - window.clearTimeout(this._scroll_reset_timeout); + }, + cdmMoveToId: function (id, params) { + params = params || {}; - this._scroll_reset_timeout = window.setTimeout(() => { - if (ctr) ctr.removeClassName("forbid-smooth-scroll"); - }, 250) + const force_to_top = params.force_to_top || false; - } else { - ctr.removeClassName("forbid-smooth-scroll"); - } + const ctr = $("headlines-frame"); + const row = $("RROW-" + id); - ctr.scrollTop = e.offsetTop; + if (!row || !ctr) return; - Element.hide("floatingTitle"); - } - }, - setActive: function (id) { - console.log("setActive", id); + if (force_to_top || !App.Scrollable.fitsInContainer(row, ctr)) { + ctr.scrollTop = row.offsetTop; + } + }, + setActive: function (id) { + if (id != Article.getActive()) { + console.log("setActive", id, "was", Article.getActive()); - $$("div[id*=RROW][class*=active]").each((e) => { - e.removeClassName("active"); + $$("div[id*=RROW][class*=active]").each((row) => { + row.removeClassName("active"); + Article.pack(row); }); const row = $("RROW-" + id); @@ -321,50 +341,29 @@ define(["dojo/_base/declare"], function (declare) { PluginHost.run(PluginHost.HOOK_ARTICLE_SET_ACTIVE, row.getAttribute("data-article-id")); } - }, - getActive: function () { - const row = document.querySelector("#headlines-frame > div[id*=RROW][class*=active]"); - - if (row) - return row.getAttribute("data-article-id"); - else - return 0; - }, - scrollByPages: function (page_offset, event) { - const elem = App.isCombinedMode() ? $("headlines-frame") : $("content-insert"); - - const offset = elem.offsetHeight * page_offset * 0.99; - - this.scroll(offset, event); - }, - scroll: function (offset, event) { - - const elem = App.isCombinedMode() ? $("headlines-frame") : $("content-insert"); - - if (event && event.repeat) { - elem.addClassName("forbid-smooth-scroll"); - window.clearTimeout(this._scroll_reset_timeout); - - this._scroll_reset_timeout = window.setTimeout(() => { - if (elem) elem.removeClassName("forbid-smooth-scroll"); - }, 250) - - } else { - elem.removeClassName("forbid-smooth-scroll"); - } - - elem.scrollTop += offset; - }, - mouseIn: function (id) { - this.post_under_pointer = id; - }, - mouseOut: function (id) { - this.post_under_pointer = false; - }, - getUnderPointer: function () { - return this.post_under_pointer; } + }, + getActive: function () { + const row = document.querySelector("#headlines-frame > div[id*=RROW][class*=active]"); + + if (row) + return row.getAttribute("data-article-id"); + else + return 0; + }, + scrollByPages: function (page_offset) { + App.Scrollable.scrollByPages($("content-insert"), page_offset); + }, + scroll: function (offset) { + App.Scrollable.scroll($("content-insert"), offset); + }, + mouseIn: function (id) { + this.post_under_pointer = id; + }, + mouseOut: function (/* id */) { + this.post_under_pointer = false; + }, + getUnderPointer: function () { + return this.post_under_pointer; } - - return Article; -}); +} diff --git a/js/CommonDialogs.js b/js/CommonDialogs.js index c6d476de0..c59ef9b25 100644 --- a/js/CommonDialogs.js +++ b/js/CommonDialogs.js @@ -1,8 +1,9 @@ 'use strict' -/* global __, ngettext */ -define(["dojo/_base/declare"], function (declare) { - // noinspection JSUnusedGlobalSymbols - CommonDialogs = { + +/* global __, ngettext, dojo, dijit, Notify, App, Feeds, $$, xhrPost, xhrJson, Tables, Effect */ + +/* exported CommonDialogs */ +const CommonDialogs = { closeInfoBox: function() { const dialog = dijit.byId("infoBox"); if (dialog) dialog.hide(); @@ -45,18 +46,20 @@ define(["dojo/_base/declare"], function (declare) { xhr.onload = function () { switch (parseInt(this.responseText)) { case 0: - Notify.info("Upload complete."); + { + Notify.info("Upload complete."); - if (App.isPrefs()) - dijit.byId("feedTree").reload(); - else - Feeds.reload(); + if (App.isPrefs()) + dijit.byId("feedTree").reload(); + else + Feeds.reload(); - const icon = $$(".feed-editor-icon")[0]; + const icon = $$(".feed-editor-icon")[0]; - if (icon) - icon.src = icon.src.replace(/\?[0-9]+$/, "?" + new Date().getTime()); + if (icon) + icon.src = icon.src.replace(/\?[0-9]+$/, "?" + new Date().getTime()); + } break; case 1: Notify.error("Upload failed: icon is too big."); @@ -72,115 +75,120 @@ define(["dojo/_base/declare"], function (declare) { return false; }, quickAddFeed: function() { - const query = "backend.php?op=feeds&method=quickAddFeed"; // overlapping widgets if (dijit.byId("batchSubDlg")) dijit.byId("batchSubDlg").destroyRecursive(); if (dijit.byId("feedAddDlg")) dijit.byId("feedAddDlg").destroyRecursive(); - const dialog = new dijit.Dialog({ - id: "feedAddDlg", - title: __("Subscribe to Feed"), - style: "width: 600px", - show_error: function (msg) { - const elem = $("fadd_error_message"); - - elem.innerHTML = msg; - - if (!Element.visible(elem)) - new Effect.Appear(elem); - - }, - execute: function () { - if (this.validate()) { - console.log(dojo.objectToQuery(this.attr('value'))); - - const feed_url = this.attr('value').feed; - - Element.show("feed_add_spinner"); - Element.hide("fadd_error_message"); - - xhrPost("backend.php", this.attr('value'), (transport) => { - try { - - try { - var reply = JSON.parse(transport.responseText); - } catch (e) { - Element.hide("feed_add_spinner"); - alert(__("Failed to parse output. This can indicate server timeout and/or network issues. Backend output was logged to browser console.")); - console.log('quickAddFeed, backend returned:' + transport.responseText); - return; - } - - const rc = reply['result']; + xhrPost("backend.php", + {op: "feeds", method: "quickAddFeed"}, + (transport) => { - Notify.close(); - Element.hide("feed_add_spinner"); + const dialog = new dijit.Dialog({ + id: "feedAddDlg", + title: __("Subscribe to Feed"), + style: "width: 600px", + content: transport.responseText, + show_error: function (msg) { + const elem = $("fadd_error_message"); - console.log(rc); + elem.innerHTML = msg; - switch (parseInt(rc['code'])) { - case 1: - dialog.hide(); - Notify.info(__("Subscribed to %s").replace("%s", feed_url)); + if (!Element.visible(elem)) + new Effect.Appear(elem); - if (App.isPrefs()) - dijit.byId("feedTree").reload(); - else - Feeds.reload(); + }, + execute: function () { + if (this.validate()) { + console.log(dojo.objectToQuery(this.attr('value'))); - break; - case 2: - dialog.show_error(__("Specified URL seems to be invalid.")); - break; - case 3: - dialog.show_error(__("Specified URL doesn't seem to contain any feeds.")); - break; - case 4: - const feeds = rc['feeds']; + const feed_url = this.attr('value').feed; - Element.show("fadd_multiple_notify"); + Element.show("feed_add_spinner"); + Element.hide("fadd_error_message"); - const select = dijit.byId("feedDlg_feedContainerSelect"); + xhrPost("backend.php", this.attr('value'), (transport) => { + try { - while (select.getOptions().length > 0) - select.removeOption(0); + let reply; - select.addOption({value: '', label: __("Expand to select feed")}); + try { + reply = JSON.parse(transport.responseText); + } catch (e) { + Element.hide("feed_add_spinner"); + alert(__("Failed to parse output. This can indicate server timeout and/or network issues. Backend output was logged to browser console.")); + console.log('quickAddFeed, backend returned:' + transport.responseText); + return; + } - let count = 0; - for (const feedUrl in feeds) { - if (feeds.hasOwnProperty(feedUrl)) { - select.addOption({value: feedUrl, label: feeds[feedUrl]}); - count++; + const rc = reply['result']; + + Notify.close(); + Element.hide("feed_add_spinner"); + + console.log(rc); + + switch (parseInt(rc['code'])) { + case 1: + dialog.hide(); + Notify.info(__("Subscribed to %s").replace("%s", feed_url)); + + if (App.isPrefs()) + dijit.byId("feedTree").reload(); + else + Feeds.reload(); + + break; + case 2: + dialog.show_error(__("Specified URL seems to be invalid.")); + break; + case 3: + dialog.show_error(__("Specified URL doesn't seem to contain any feeds.")); + break; + case 4: + { + const feeds = rc['feeds']; + + Element.show("fadd_multiple_notify"); + + const select = dijit.byId("feedDlg_feedContainerSelect"); + + while (select.getOptions().length > 0) + select.removeOption(0); + + select.addOption({value: '', label: __("Expand to select feed")}); + + for (const feedUrl in feeds) { + if (feeds.hasOwnProperty(feedUrl)) { + select.addOption({value: feedUrl, label: feeds[feedUrl]}); + } + } + + Effect.Appear('feedDlg_feedsContainer', {duration: 0.5}); + } + break; + case 5: + dialog.show_error(__("Couldn't download the specified URL: %s").replace("%s", rc['message'])); + break; + case 6: + dialog.show_error(__("XML validation failed: %s").replace("%s", rc['message'])); + break; + case 0: + dialog.show_error(__("You are already subscribed to this feed.")); + break; } - } - Effect.Appear('feedDlg_feedsContainer', {duration: 0.5}); - - break; - case 5: - dialog.show_error(__("Couldn't download the specified URL: %s").replace("%s", rc['message'])); - break; - case 6: - dialog.show_error(__("XML validation failed: %s").replace("%s", rc['message'])); - break; - case 0: - dialog.show_error(__("You are already subscribed to this feed.")); - break; + } catch (e) { + console.error(transport.responseText); + App.Error.report(e); + } + }); } - - } catch (e) { - console.error(transport.responseText); - App.Error.report(e); - } + }, }); - } - }, - href: query - }); - dialog.show(); + dialog.show(); + }); }, showFeedsWithErrors: function() { const query = {op: "pref-feeds", method: "feedsWithErrors"}; @@ -436,7 +444,7 @@ define(["dojo/_base/declare"], function (declare) { Notify.close(); if (App.isPrefs()) - dijit.byId("feedTree").reload(); + dijit.byId("feedTree") && dijit.byId("feedTree").reload(); else Feeds.reload(); @@ -478,6 +486,3 @@ define(["dojo/_base/declare"], function (declare) { return false; } }; - - return CommonDialogs; -}); diff --git a/js/CommonFilters.js b/js/CommonFilters.js index 1538a3fb3..9676abe9e 100644 --- a/js/CommonFilters.js +++ b/js/CommonFilters.js @@ -1,398 +1,383 @@ 'use strict' -/* global __, ngettext */ -define(["dojo/_base/declare"], function (declare) { - Filters = { - filterDlgCheckRegExp: function(sender) { - const tooltip = dijit.byId("filterDlg_regExp_tip").domNode; - try { - sender.domNode.removeClassName("invalid"); - sender.domNode.removeClassName("valid"); +/* global __, App, Article, Lists, Effect */ +/* global xhrPost, dojo, dijit, Notify, $$, Feeds */ - new RegExp("/" + sender.value + "/"); +const Filters = { + filterDlgCheckAction: function(sender) { + const action = sender.value; - sender.domNode.addClassName("valid"); - tooltip.innerText = __("Regular expression, without outer delimiters (i.e. slashes)"); + const action_param = $("filterDlg_paramBox"); - } catch (e) { - sender.domNode.addClassName("invalid"); + if (!action_param) { + console.log("filterDlgCheckAction: can't find action param box!"); + return; + } - tooltip.innerText = e.message; - } - }, - filterDlgCheckAction: function(sender) { - const action = sender.value; + // if selected action supports parameters, enable params field + if (action == 4 || action == 6 || action == 7 || action == 9) { + new Effect.Appear(action_param, {duration: 0.5}); - const action_param = $("filterDlg_paramBox"); + Element.hide(dijit.byId("filterDlg_actionParam").domNode); + Element.hide(dijit.byId("filterDlg_actionParamLabel").domNode); + Element.hide(dijit.byId("filterDlg_actionParamPlugin").domNode); - if (!action_param) { - console.log("filterDlgCheckAction: can't find action param box!"); - return; + if (action == 7) { + Element.show(dijit.byId("filterDlg_actionParamLabel").domNode); + } else if (action == 9) { + Element.show(dijit.byId("filterDlg_actionParamPlugin").domNode); + } else { + Element.show(dijit.byId("filterDlg_actionParam").domNode); } - // if selected action supports parameters, enable params field - if (action == 4 || action == 6 || action == 7 || action == 9) { - new Effect.Appear(action_param, {duration: 0.5}); - - Element.hide(dijit.byId("filterDlg_actionParam").domNode); - Element.hide(dijit.byId("filterDlg_actionParamLabel").domNode); - Element.hide(dijit.byId("filterDlg_actionParamPlugin").domNode); + } else { + Element.hide(action_param); + } + }, + createNewRuleElement: function(parentNode, replaceNode) { + const form = document.forms["filter_new_rule_form"]; + const query = {op: "pref-filters", method: "printrulename", rule: dojo.formToJson(form)}; - if (action == 7) { - Element.show(dijit.byId("filterDlg_actionParamLabel").domNode); - } else if (action == 9) { - Element.show(dijit.byId("filterDlg_actionParamPlugin").domNode); + xhrPost("backend.php", query, (transport) => { + try { + const li = dojo.create("li"); + + const cb = dojo.create("input", {type: "checkbox"}, li); + + new dijit.form.CheckBox({ + onChange: function () { + Lists.onRowChecked(this); + }, + }, cb); + + dojo.create("input", { + type: "hidden", + name: "rule[]", + value: dojo.formToJson(form) + }, li); + + dojo.create("span", { + onclick: function () { + dijit.byId('filterEditDlg').editRule(this); + }, + innerHTML: transport.responseText + }, li); + + if (replaceNode) { + parentNode.replaceChild(li, replaceNode); } else { - Element.show(dijit.byId("filterDlg_actionParam").domNode); + parentNode.appendChild(li); } - - } else { - Element.hide(action_param); + } catch (e) { + App.Error.report(e); } - }, - createNewRuleElement: function(parentNode, replaceNode) { - const form = document.forms["filter_new_rule_form"]; - const query = {op: "pref-filters", method: "printrulename", rule: dojo.formToJson(form)}; - - xhrPost("backend.php", query, (transport) => { - try { - const li = dojo.create("li"); - - const cb = dojo.create("input", {type: "checkbox"}, li); - - new dijit.form.CheckBox({ - onChange: function () { - Lists.onRowChecked(this); - }, - }, cb); - - dojo.create("input", { - type: "hidden", - name: "rule[]", - value: dojo.formToJson(form) - }, li); - - dojo.create("span", { - onclick: function () { - dijit.byId('filterEditDlg').editRule(this); - }, - innerHTML: transport.responseText - }, li); - - if (replaceNode) { - parentNode.replaceChild(li, replaceNode); - } else { - parentNode.appendChild(li); - } - } catch (e) { - App.Error.report(e); + }); + }, + createNewActionElement: function(parentNode, replaceNode) { + const form = document.forms["filter_new_action_form"]; + + if (form.action_id.value == 7) { + form.action_param.value = form.action_param_label.value; + } else if (form.action_id.value == 9) { + form.action_param.value = form.action_param_plugin.value; + } + + const query = { + op: "pref-filters", method: "printactionname", + action: dojo.formToJson(form) + }; + + xhrPost("backend.php", query, (transport) => { + try { + const li = dojo.create("li"); + + const cb = dojo.create("input", {type: "checkbox"}, li); + + new dijit.form.CheckBox({ + onChange: function () { + Lists.onRowChecked(this); + }, + }, cb); + + dojo.create("input", { + type: "hidden", + name: "action[]", + value: dojo.formToJson(form) + }, li); + + dojo.create("span", { + onclick: function () { + dijit.byId('filterEditDlg').editAction(this); + }, + innerHTML: transport.responseText + }, li); + + if (replaceNode) { + parentNode.replaceChild(li, replaceNode); + } else { + parentNode.appendChild(li); } - }); - }, - createNewActionElement: function(parentNode, replaceNode) { - const form = document.forms["filter_new_action_form"]; - - if (form.action_id.value == 7) { - form.action_param.value = form.action_param_label.value; - } else if (form.action_id.value == 9) { - form.action_param.value = form.action_param_plugin.value; - } - - const query = { - op: "pref-filters", method: "printactionname", - action: dojo.formToJson(form) - }; - - xhrPost("backend.php", query, (transport) => { - try { - const li = dojo.create("li"); - - const cb = dojo.create("input", {type: "checkbox"}, li); - - new dijit.form.CheckBox({ - onChange: function () { - Lists.onRowChecked(this); - }, - }, cb); - - dojo.create("input", { - type: "hidden", - name: "action[]", - value: dojo.formToJson(form) - }, li); - - dojo.create("span", { - onclick: function () { - dijit.byId('filterEditDlg').editAction(this); - }, - innerHTML: transport.responseText - }, li); - - if (replaceNode) { - parentNode.replaceChild(li, replaceNode); - } else { - parentNode.appendChild(li); - } - } catch (e) { - App.Error.report(e); + } catch (e) { + App.Error.report(e); + } + }); + }, + addFilterRule: function(replaceNode, ruleStr) { + if (dijit.byId("filterNewRuleDlg")) + dijit.byId("filterNewRuleDlg").destroyRecursive(); + + const rule_dlg = new dijit.Dialog({ + id: "filterNewRuleDlg", + title: ruleStr ? __("Edit rule") : __("Add rule"), + style: "width: 600px", + execute: function () { + if (this.validate()) { + Filters.createNewRuleElement($("filterDlg_Matches"), replaceNode); + this.hide(); } - }); - }, - addFilterRule: function(replaceNode, ruleStr) { - if (dijit.byId("filterNewRuleDlg")) - dijit.byId("filterNewRuleDlg").destroyRecursive(); - - const query = "backend.php?op=pref-filters&method=newrule&rule=" + - encodeURIComponent(ruleStr); - - const rule_dlg = new dijit.Dialog({ - id: "filterNewRuleDlg", - title: ruleStr ? __("Edit rule") : __("Add rule"), - style: "width: 600px", - execute: function () { - if (this.validate()) { - Filters.createNewRuleElement($("filterDlg_Matches"), replaceNode); - this.hide(); - } - }, - href: query - }); - - rule_dlg.show(); - }, - addFilterAction: function(replaceNode, actionStr) { - if (dijit.byId("filterNewActionDlg")) - dijit.byId("filterNewActionDlg").destroyRecursive(); - - const query = "backend.php?op=pref-filters&method=newaction&action=" + - encodeURIComponent(actionStr); - - const rule_dlg = new dijit.Dialog({ - id: "filterNewActionDlg", - title: actionStr ? __("Edit action") : __("Add action"), - style: "width: 600px", - execute: function () { - if (this.validate()) { - Filters.createNewActionElement($("filterDlg_Actions"), replaceNode); - this.hide(); - } - }, - href: query - }); + }, + content: __('Loading, please wait...'), + }); - rule_dlg.show(); - }, - editFilterTest: function(query) { + const tmph = dojo.connect(rule_dlg, "onShow", null, function (/* e */) { + dojo.disconnect(tmph); - if (dijit.byId("filterTestDlg")) - dijit.byId("filterTestDlg").destroyRecursive(); - - const test_dlg = new dijit.Dialog({ - id: "filterTestDlg", - title: "Test Filter", - style: "width: 600px", - results: 0, - limit: 100, - max_offset: 10000, - getTestResults: function (query, offset) { - const updquery = query + "&offset=" + offset + "&limit=" + test_dlg.limit; - - console.log("getTestResults:" + offset); + xhrPost("backend.php", {op: 'pref-filters', method: 'newrule', rule: ruleStr}, (transport) => { + rule_dlg.attr('content', transport.responseText); + }); + }); + + rule_dlg.show(); + }, + addFilterAction: function(replaceNode, actionStr) { + if (dijit.byId("filterNewActionDlg")) + dijit.byId("filterNewActionDlg").destroyRecursive(); + + const query = "backend.php?op=pref-filters&method=newaction&action=" + + encodeURIComponent(actionStr); + + const rule_dlg = new dijit.Dialog({ + id: "filterNewActionDlg", + title: actionStr ? __("Edit action") : __("Add action"), + style: "width: 600px", + execute: function () { + if (this.validate()) { + Filters.createNewActionElement($("filterDlg_Actions"), replaceNode); + this.hide(); + } + }, + href: query + }); - xhrPost("backend.php", updquery, (transport) => { - try { - const result = JSON.parse(transport.responseText); + rule_dlg.show(); + }, + editFilterTest: function(params) { - if (result && dijit.byId("filterTestDlg") && dijit.byId("filterTestDlg").open) { - test_dlg.results += result.length; + if (dijit.byId("filterTestDlg")) + dijit.byId("filterTestDlg").destroyRecursive(); - console.log("got results:" + result.length); + const test_dlg = new dijit.Dialog({ + id: "filterTestDlg", + title: "Test Filter", + style: "width: 600px", + results: 0, + limit: 100, + max_offset: 10000, + getTestResults: function (params, offset) { + params.method = 'testFilterDo'; + params.offset = offset; + params.limit = test_dlg.limit; - $("prefFilterProgressMsg").innerHTML = __("Looking for articles (%d processed, %f found)...") - .replace("%f", test_dlg.results) - .replace("%d", offset); + console.log("getTestResults:" + offset); - console.log(offset + " " + test_dlg.max_offset); + xhrPost("backend.php", params, (transport) => { + try { + const result = JSON.parse(transport.responseText); - for (let i = 0; i < result.length; i++) { - const tmp = new Element("table"); - tmp.innerHTML = result[i]; - dojo.parser.parse(tmp); + if (result && dijit.byId("filterTestDlg") && dijit.byId("filterTestDlg").open) { + test_dlg.results += result.length; - $("prefFilterTestResultList").innerHTML += tmp.innerHTML; - } + console.log("got results:" + result.length); - if (test_dlg.results < 30 && offset < test_dlg.max_offset) { + $("prefFilterProgressMsg").innerHTML = __("Looking for articles (%d processed, %f found)...") + .replace("%f", test_dlg.results) + .replace("%d", offset); - // get the next batch - window.setTimeout(function () { - test_dlg.getTestResults(query, offset + test_dlg.limit); - }, 0); + console.log(offset + " " + test_dlg.max_offset); - } else { - // all done + for (let i = 0; i < result.length; i++) { + const tmp = dojo.create("table", { innerHTML: result[i]}); - Element.hide("prefFilterLoadingIndicator"); + $("prefFilterTestResultList").innerHTML += tmp.innerHTML; + } - if (test_dlg.results == 0) { - $("prefFilterTestResultList").innerHTML = `<tr><td align='center'> - ${__('No recent articles matching this filter have been found.')}</td></tr>`; - $("prefFilterProgressMsg").innerHTML = "Articles matching this filter:"; - } else { - $("prefFilterProgressMsg").innerHTML = __("Found %d articles matching this filter:") - .replace("%d", test_dlg.results); - } + if (test_dlg.results < 30 && offset < test_dlg.max_offset) { - } + // get the next batch + window.setTimeout(function () { + test_dlg.getTestResults(params, offset + test_dlg.limit); + }, 0); - } else if (!result) { - console.log("getTestResults: can't parse results object"); + } else { + // all done Element.hide("prefFilterLoadingIndicator"); - Notify.error("Error while trying to get filter test results."); + if (test_dlg.results == 0) { + $("prefFilterTestResultList").innerHTML = `<tr><td align='center'> + ${__('No recent articles matching this filter have been found.')}</td></tr>`; + $("prefFilterProgressMsg").innerHTML = "Articles matching this filter:"; + } else { + $("prefFilterProgressMsg").innerHTML = __("Found %d articles matching this filter:") + .replace("%d", test_dlg.results); + } - } else { - console.log("getTestResults: dialog closed, bailing out."); } - } catch (e) { - App.Error.report(e); - } - }); - }, - href: query - }); + } else if (!result) { + console.log("getTestResults: can't parse results object"); - dojo.connect(test_dlg, "onLoad", null, function (e) { - test_dlg.getTestResults(query, 0); - }); + Element.hide("prefFilterLoadingIndicator"); - test_dlg.show(); - }, - quickAddFilter: function() { - let query; + Notify.error("Error while trying to get filter test results."); - if (!App.isPrefs()) { - query = { - op: "pref-filters", method: "newfilter", - feed: Feeds.getActive(), is_cat: Feeds.activeIsCat() - }; - } else { - query = {op: "pref-filters", method: "newfilter"}; - } - - console.log('quickAddFilter', query); - - if (dijit.byId("feedEditDlg")) - dijit.byId("feedEditDlg").destroyRecursive(); - - if (dijit.byId("filterEditDlg")) - dijit.byId("filterEditDlg").destroyRecursive(); - - const dialog = new dijit.Dialog({ - id: "filterEditDlg", - title: __("Create Filter"), - style: "width: 600px", - test: function () { - const query = "backend.php?" + dojo.formToQuery("filter_new_form") + "&savemode=test"; - - Filters.editFilterTest(query); - }, - selectRules: function (select) { - Lists.select("filterDlg_Matches", select); - }, - selectActions: function (select) { - Lists.select("filterDlg_Actions", select); - }, - editRule: function (e) { - const li = e.parentNode; - const rule = li.getElementsByTagName("INPUT")[1].value; - Filters.addFilterRule(li, rule); - }, - editAction: function (e) { - const li = e.parentNode; - const action = li.getElementsByTagName("INPUT")[1].value; - Filters.addFilterAction(li, action); - }, - addAction: function () { - Filters.addFilterAction(); - }, - addRule: function () { - Filters.addFilterRule(); - }, - deleteAction: function () { - $$("#filterDlg_Actions li[class*=Selected]").each(function (e) { - e.parentNode.removeChild(e) - }); - }, - deleteRule: function () { - $$("#filterDlg_Matches li[class*=Selected]").each(function (e) { - e.parentNode.removeChild(e) - }); - }, - execute: function () { - if (this.validate()) { + } else { + console.log("getTestResults: dialog closed, bailing out."); + } + } catch (e) { + App.Error.report(e); + } - const query = dojo.formToQuery("filter_new_form"); + }); + }, + href: "backend.php?op=pref-filters&method=testFilterDlg" + }); + + dojo.connect(test_dlg, "onLoad", null, function (/* e */) { + test_dlg.getTestResults(params, 0); + }); + + test_dlg.show(); + }, + quickAddFilter: function() { + let query; + + if (!App.isPrefs()) { + query = { + op: "pref-filters", method: "newfilter", + feed: Feeds.getActive(), is_cat: Feeds.activeIsCat() + }; + } else { + query = {op: "pref-filters", method: "newfilter"}; + } + + console.log('quickAddFilter', query); + + if (dijit.byId("feedEditDlg")) + dijit.byId("feedEditDlg").destroyRecursive(); + + if (dijit.byId("filterEditDlg")) + dijit.byId("filterEditDlg").destroyRecursive(); + + const dialog = new dijit.Dialog({ + id: "filterEditDlg", + title: __("Create Filter"), + style: "width: 600px", + test: function () { + Filters.editFilterTest(dojo.formToObject("filter_new_form")); + }, + selectRules: function (select) { + Lists.select("filterDlg_Matches", select); + }, + selectActions: function (select) { + Lists.select("filterDlg_Actions", select); + }, + editRule: function (e) { + const li = e.parentNode; + const rule = li.getElementsByTagName("INPUT")[1].value; + Filters.addFilterRule(li, rule); + }, + editAction: function (e) { + const li = e.parentNode; + const action = li.getElementsByTagName("INPUT")[1].value; + Filters.addFilterAction(li, action); + }, + addAction: function () { + Filters.addFilterAction(); + }, + addRule: function () { + Filters.addFilterRule(); + }, + deleteAction: function () { + $$("#filterDlg_Actions li[class*=Selected]").each(function (e) { + e.parentNode.removeChild(e) + }); + }, + deleteRule: function () { + $$("#filterDlg_Matches li[class*=Selected]").each(function (e) { + e.parentNode.removeChild(e) + }); + }, + execute: function () { + if (this.validate()) { - xhrPost("backend.php", query, () => { - if (App.isPrefs()) { - dijit.byId("filterTree").reload(); - } + const query = dojo.formToQuery("filter_new_form"); - dialog.hide(); - }); - } - }, - href: "backend.php?" + dojo.objectToQuery(query) - }); + xhrPost("backend.php", query, () => { + if (App.isPrefs()) { + dijit.byId("filterTree").reload(); + } - if (!App.isPrefs()) { - const selectedText = getSelectionText(); + dialog.hide(); + }); + } + }, + href: "backend.php?" + dojo.objectToQuery(query) + }); - const lh = dojo.connect(dialog, "onLoad", function () { - dojo.disconnect(lh); + if (!App.isPrefs()) { + /* global getSelectionText */ + const selectedText = getSelectionText(); - if (selectedText != "") { + const lh = dojo.connect(dialog, "onLoad", function () { + dojo.disconnect(lh); - const feed_id = Feeds.activeIsCat() ? 'CAT:' + parseInt(Feeds.getActive()) : - Feeds.getActive(); + if (selectedText != "") { - const rule = {reg_exp: selectedText, feed_id: [feed_id], filter_type: 1}; + const feed_id = Feeds.activeIsCat() ? 'CAT:' + parseInt(Feeds.getActive()) : + Feeds.getActive(); - Filters.addFilterRule(null, dojo.toJson(rule)); + const rule = {reg_exp: selectedText, feed_id: [feed_id], filter_type: 1}; - } else { + Filters.addFilterRule(null, dojo.toJson(rule)); - const query = {op: "rpc", method: "getlinktitlebyid", id: Article.getActive()}; + } else { - xhrPost("backend.php", query, (transport) => { - const reply = JSON.parse(transport.responseText); + const query = {op: "rpc", method: "getlinktitlebyid", id: Article.getActive()}; - let title = false; + xhrPost("backend.php", query, (transport) => { + const reply = JSON.parse(transport.responseText); - if (reply && reply.title) title = reply.title; + let title = false; - if (title || Feeds.getActive() || Feeds.activeIsCat()) { + if (reply && reply.title) title = reply.title; - console.log(title + " " + Feeds.getActive()); + if (title || Feeds.getActive() || Feeds.activeIsCat()) { - const feed_id = Feeds.activeIsCat() ? 'CAT:' + parseInt(Feeds.getActive()) : - Feeds.getActive(); + console.log(title + " " + Feeds.getActive()); - const rule = {reg_exp: title, feed_id: [feed_id], filter_type: 1}; + const feed_id = Feeds.activeIsCat() ? 'CAT:' + parseInt(Feeds.getActive()) : + Feeds.getActive(); - Filters.addFilterRule(null, dojo.toJson(rule)); - } - }); - } - }); - } - dialog.show(); - }, - }; + const rule = {reg_exp: title, feed_id: [feed_id], filter_type: 1}; - return Filters; -}); + Filters.addFilterRule(null, dojo.toJson(rule)); + } + }); + } + }); + } + dialog.show(); + }, +}; diff --git a/js/FeedStoreModel.js b/js/FeedStoreModel.js index 7d8020871..736bfbed6 100644 --- a/js/FeedStoreModel.js +++ b/js/FeedStoreModel.js @@ -1,10 +1,12 @@ +/* global define, dijit */ + define(["dojo/_base/declare", "dijit/tree/ForestStoreModel"], function (declare) { return declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, { getItemsInCategory: function (id) { if (!this.store._itemsByIdentity) return undefined; - let cat = this.store._itemsByIdentity['CAT:' + id]; + const cat = this.store._itemsByIdentity['CAT:' + id]; if (cat && cat.items) return cat.items; @@ -18,6 +20,8 @@ define(["dojo/_base/declare", "dijit/tree/ForestStoreModel"], function (declare) getFeedValue: function (feed, is_cat, key) { if (!this.store._itemsByIdentity) return undefined; + let treeItem; + if (is_cat) treeItem = this.store._itemsByIdentity['CAT:' + feed]; else @@ -40,6 +44,8 @@ define(["dojo/_base/declare", "dijit/tree/ForestStoreModel"], function (declare) if (!value) value = ''; if (!this.store._itemsByIdentity) return undefined; + let treeItem; + if (is_cat) treeItem = this.store._itemsByIdentity['CAT:' + feed]; else @@ -52,29 +58,31 @@ define(["dojo/_base/declare", "dijit/tree/ForestStoreModel"], function (declare) if (!this.store._itemsByIdentity) return null; + let treeItem; + if (is_cat) { treeItem = this.store._itemsByIdentity['CAT:' + feed]; } else { treeItem = this.store._itemsByIdentity['FEED:' + feed]; } - let items = this.store._arrayOfAllItems; + const items = this.store._arrayOfAllItems; for (let i = 0; i < items.length; i++) { if (items[i] == treeItem) { - for (var j = i + 1; j < items.length; j++) { - let unread = this.store.getValue(items[j], 'unread'); - let id = this.store.getValue(items[j], 'id'); + for (let j = i + 1; j < items.length; j++) { + const unread = this.store.getValue(items[j], 'unread'); + const id = this.store.getValue(items[j], 'id'); if (unread > 0 && ((is_cat && id.match("CAT:")) || (!is_cat && id.match("FEED:")))) { if (!is_cat || !(this.store.hasAttribute(items[j], 'parent_id') && this.store.getValue(items[j], 'parent_id') == feed)) return items[j]; } } - for (var j = 0; j < i; j++) { - let unread = this.store.getValue(items[j], 'unread'); - let id = this.store.getValue(items[j], 'id'); + for (let j = 0; j < i; j++) { + const unread = this.store.getValue(items[j], 'unread'); + const id = this.store.getValue(items[j], 'id'); if (unread > 0 && ((is_cat && id.match("CAT:")) || (!is_cat && id.match("FEED:")))) { if (!is_cat || !(this.store.hasAttribute(items[j], 'parent_id') && this.store.getValue(items[j], 'parent_id') == feed)) return items[j]; diff --git a/js/FeedTree.js b/js/FeedTree.js index 85892b3d9..c61d8a50f 100755 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -1,11 +1,46 @@ -/* global dijit */ -define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], function (declare, domConstruct) { +/* eslint-disable prefer-rest-params */ +/* global __, dojo, dijit, define, App, Feeds, CommonDialogs */ + +define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/cookie", "dijit/Tree", "dijit/Menu"], function (declare, domConstruct, array, cookie) { return declare("fox.FeedTree", dijit.Tree, { - _onContainerKeydown: function(/* Event */ e) { + // save state in localStorage instead of cookies + // reference: https://stackoverflow.com/a/27968996 + _saveExpandedNodes: function(){ + if(this.persist && this.cookieName){ + var ary = []; + for(var id in this._openedNodes){ + ary.push(id); + } + // Was: + // cookie(this.cookieName, ary.join(","), {expires: 365}); + localStorage.setItem(this.cookieName, ary.join(",")); + } + }, + _initState: function(){ + // summary: + // Load in which nodes should be opened automatically + this._openedNodes = {}; + if(this.persist && this.cookieName){ + // Was: + // var oreo = cookie(this.cookieName); + var oreo = localStorage.getItem(this.cookieName); + // migrate old data if nothing in localStorage + if(oreo == null || oreo === '') { + oreo = cookie(this.cookieName); + cookie(this.cookieName, null, { expires: -1 }); + } + if(oreo){ + array.forEach(oreo.split(','), function(item){ + this._openedNodes[item] = true; + }, this); + } + } + }, + _onContainerKeydown: function(/* Event */ /* e */) { return; // Stop dijit.Tree from interpreting keystrokes }, - _onContainerKeypress: function(/* Event */ e) { + _onContainerKeypress: function(/* Event */ /* e */) { return; // Stop dijit.Tree from interpreting keystrokes }, _createTreeNode: function(args) { @@ -33,7 +68,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], const id = args.item.id[0]; const bare_id = parseInt(id.substr(id.indexOf(':')+1)); - if (bare_id < LABEL_BASE_INDEX) { + if (bare_id < App.LABEL_BASE_INDEX) { const label = dojo.create('i', { className: "material-icons icon icon-label", innerHTML: "label" }); //const fg_color = args.item.fg_color[0]; @@ -47,7 +82,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], } if (id.match("FEED:")) { - let menu = new dijit.Menu(); + const menu = new dijit.Menu(); menu.row_id = bare_id; menu.addChild(new dijit.MenuItem({ @@ -66,8 +101,9 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], menu.addChild(new dijit.MenuItem({ label: __("Debug feed"), onClick: function() { - window.open("backend.php?op=feeds&method=update_debugger&feed_id=" + this.getParent().row_id + - "&csrf_token=" + App.getInitParam("csrf_token")); + /* global __csrf_token */ + App.postOpenWindow("backend.php", {op: "feeds", method: "update_debugger", + feed_id: this.getParent().row_id, csrf_token: __csrf_token}); }})); } @@ -76,7 +112,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], } if (id.match("CAT:") && bare_id >= 0) { - let menu = new dijit.Menu(); + const menu = new dijit.Menu(); menu.row_id = bare_id; menu.addChild(new dijit.MenuItem({ @@ -101,7 +137,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], } if (id.match("CAT:") && bare_id == -1) { - let menu = new dijit.Menu(); + const menu = new dijit.Menu(); menu.row_id = bare_id; menu.addChild(new dijit.MenuItem({ @@ -145,15 +181,16 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], } }, getTooltip: function (item) { - return [item.updated, item.error].filter(x => x && x != "").join(" - "); + return [item.updated, item.error].filter((x) => x && x != "").join(" - "); }, getIconClass: function (item, opened) { + // eslint-disable-next-line no-nested-ternary return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feed-icon"; }, - getLabelClass: function (item, opened) { + getLabelClass: function (item/* , opened */) { return (item.unread <= 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread"; }, - getRowClass: function (item, opened) { + getRowClass: function (item/*, opened */) { let rc = "dijitTreeRow"; const is_cat = String(item.id).indexOf('CAT:') != -1; @@ -163,9 +200,9 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], if (item.auxcounter > 0) rc += " Has_Aux"; if (item.markedcounter > 0) rc += " Has_Marked"; if (item.updates_disabled > 0) rc += " UpdatesDisabled"; - if (item.bare_id >= LABEL_BASE_INDEX && item.bare_id < 0 && !is_cat || item.bare_id == 0 && !is_cat) rc += " Special"; + if (item.bare_id >= App.LABEL_BASE_INDEX && item.bare_id < 0 && !is_cat || item.bare_id == 0 && !is_cat) rc += " Special"; if (item.bare_id == -1 && is_cat) rc += " AlwaysVisible"; - if (item.bare_id < LABEL_BASE_INDEX) rc += " Label"; + if (item.bare_id < App.LABEL_BASE_INDEX) rc += " Label"; return rc; }, diff --git a/js/Feeds.js b/js/Feeds.js index 7fa376984..9259cd547 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -1,232 +1,235 @@ 'use strict' -/* global __, ngettext */ -define(["dojo/_base/declare"], function (declare) { - Feeds = { - counters_last_request: 0, - _active_feed_id: undefined, - _active_feed_is_cat: false, - infscroll_in_progress: 0, - infscroll_disabled: 0, - _infscroll_timeout: false, - _search_query: false, - last_search_query: [], - _viewfeed_wait_timeout: false, - _counters_prev: [], - // NOTE: this implementation is incomplete - // for general objects but good enough for counters - // http://adripofjavascript.com/blog/drips/object-equality-in-javascript.html - counterEquals: function(a, b) { - // Create arrays of property names - const aProps = Object.getOwnPropertyNames(a); - const bProps = Object.getOwnPropertyNames(b); - - // If number of properties is different, + +/* global __, App, Headlines, xhrPost, dojo, dijit, Form, fox, PluginHost, Notify, $$ */ + +const Feeds = { + counters_last_request: 0, + _active_feed_id: undefined, + _active_feed_is_cat: false, + infscroll_in_progress: 0, + infscroll_disabled: 0, + _infscroll_timeout: false, + _search_query: false, + last_search_query: [], + _viewfeed_wait_timeout: false, + _counters_prev: [], + // NOTE: this implementation is incomplete + // for general objects but good enough for counters + // http://adripofjavascript.com/blog/drips/object-equality-in-javascript.html + counterEquals: function(a, b) { + // Create arrays of property names + const aProps = Object.getOwnPropertyNames(a); + const bProps = Object.getOwnPropertyNames(b); + + // If number of properties is different, + // objects are not equivalent + if (aProps.length != bProps.length) { + return false; + } + + for (let i = 0; i < aProps.length; i++) { + const propName = aProps[i]; + + // If values of same property are not equal, // objects are not equivalent - if (aProps.length != bProps.length) { + if (a[propName] !== b[propName]) { return false; } + } + + // If we made it this far, objects + // are considered equivalent + return true; + }, + resetCounters: function () { + this._counters_prev = []; + }, + parseCounters: function (elems) { + PluginHost.run(PluginHost.HOOK_COUNTERS_RECEIVED, elems); + + for (let l = 0; l < elems.length; l++) { + + if (Feeds._counters_prev[l] && this.counterEquals(elems[l], this._counters_prev[l])) { + continue; + } - for (let i = 0; i < aProps.length; i++) { - const propName = aProps[i]; + const id = elems[l].id; + const kind = elems[l].kind; + const ctr = parseInt(elems[l].counter); + const error = elems[l].error; + const has_img = elems[l].has_img; + const updated = elems[l].updated; - // If values of same property are not equal, - // objects are not equivalent - if (a[propName] !== b[propName]) { - return false; - } + if (id == "global-unread") { + App.global_unread = ctr; + App.updateTitle(); + continue; } - // If we made it this far, objects - // are considered equivalent - return true; - }, - resetCounters: function () { - this._counters_prev = []; - }, - parseCounters: function (elems) { - PluginHost.run(PluginHost.HOOK_COUNTERS_RECEIVED, elems); + if (id == "subscribed-feeds") { + /* feeds_found = ctr; */ + continue; + } - for (let l = 0; l < elems.length; l++) { + /*if (this.getUnread(id, (kind == "cat")) != ctr || + (kind == "cat")) { + }*/ - if (Feeds._counters_prev[l] && this.counterEquals(elems[l], this._counters_prev[l])) { - continue; - } + this.setUnread(id, (kind == "cat"), ctr); + this.setValue(id, (kind == "cat"), 'auxcounter', parseInt(elems[l].auxcounter)); + this.setValue(id, (kind == "cat"), 'markedcounter', parseInt(elems[l].markedcounter)); - const id = elems[l].id; - const kind = elems[l].kind; - const ctr = parseInt(elems[l].counter); - const error = elems[l].error; - const has_img = elems[l].has_img; - const updated = elems[l].updated; - - if (id == "global-unread") { - App.global_unread = ctr; - App.updateTitle(); - continue; - } + if (kind != "cat") { + this.setValue(id, false, 'error', error); + this.setValue(id, false, 'updated', updated); - if (id == "subscribed-feeds") { - /* feeds_found = ctr; */ - continue; - } - - /*if (this.getUnread(id, (kind == "cat")) != ctr || - (kind == "cat")) { - }*/ - - this.setUnread(id, (kind == "cat"), ctr); - this.setValue(id, (kind == "cat"), 'auxcounter', parseInt(elems[l].auxcounter)); - this.setValue(id, (kind == "cat"), 'markedcounter', parseInt(elems[l].markedcounter)); - - if (kind != "cat") { - this.setValue(id, false, 'error', error); - this.setValue(id, false, 'updated', updated); - - if (id > 0) { - if (has_img) { - this.setIcon(id, false, - App.getInitParam("icons_url") + "/" + id + ".ico?" + has_img); - } else { - this.setIcon(id, false, 'images/blank_icon.gif'); - } + if (id > 0) { + if (has_img) { + this.setIcon(id, false, + App.getInitParam("icons_url") + "/" + id + ".ico?" + has_img); + } else { + this.setIcon(id, false, 'images/blank_icon.gif'); } } } - - Headlines.updateCurrentUnread(); - - this.hideOrShowFeeds(App.getInitParam("hide_read_feeds")); - this._counters_prev = elems; - - PluginHost.run(PluginHost.HOOK_COUNTERS_PROCESSED); - }, - reloadCurrent: function(method) { - if (this.getActive() != undefined) { - console.log("reloadCurrent: " + method); - - this.open({feed: this.getActive(), is_cat: this.activeIsCat(), method: method}); + } + + Headlines.updateCurrentUnread(); + + this.hideOrShowFeeds(App.getInitParam("hide_read_feeds")); + this._counters_prev = elems; + + PluginHost.run(PluginHost.HOOK_COUNTERS_PROCESSED); + }, + reloadCurrent: function(method) { + if (this.getActive() != undefined) { + console.log("reloadCurrent: " + method); + + this.open({feed: this.getActive(), is_cat: this.activeIsCat(), method: method}); + } + return false; // block unneeded form submits + }, + openNextUnread: function() { + const is_cat = this.activeIsCat(); + const nuf = this.getNextUnread(this.getActive(), is_cat); + if (nuf) this.open({feed: nuf, is_cat: is_cat}); + }, + toggle: function() { + Element.toggle("feeds-holder"); + + const splitter = $("feeds-holder_splitter"); + + Element.visible("feeds-holder") ? splitter.show() : splitter.hide(); + + dijit.byId("main").resize(); + + Headlines.updateCurrentUnread(); + }, + cancelSearch: function() { + this._search_query = ""; + this.reloadCurrent(); + }, + requestCounters: function() { + xhrPost("backend.php", {op: "rpc", method: "getAllCounters", seq: App.next_seq()}, (transport) => { + App.handleRpcJson(transport); + }); + }, + reload: function() { + try { + Element.show("feedlistLoading"); + + this.resetCounters(); + + if (dijit.byId("feedTree")) { + dijit.byId("feedTree").destroyRecursive(); } - return false; // block unneeded form submits - }, - openNextUnread: function() { - const is_cat = this.activeIsCat(); - const nuf = this.getNextUnread(this.getActive(), is_cat); - if (nuf) this.open({feed: nuf, is_cat: is_cat}); - }, - toggle: function() { - Element.toggle("feeds-holder"); - - const splitter = $("feeds-holder_splitter"); - - Element.visible("feeds-holder") ? splitter.show() : splitter.hide(); - - dijit.byId("main").resize(); - - Headlines.updateCurrentUnread(); - }, - cancelSearch: function() { - this._search_query = ""; - this.reloadCurrent(); - }, - requestCounters: function() { - xhrPost("backend.php", {op: "rpc", method: "getAllCounters", seq: App.next_seq()}, (transport) => { - App.handleRpcJson(transport); - }); - }, - reload: function() { - try { - Element.show("feedlistLoading"); - - this.resetCounters(); - if (dijit.byId("feedTree")) { - dijit.byId("feedTree").destroyRecursive(); - } - - const store = new dojo.data.ItemFileWriteStore({ - url: "backend.php?op=pref_feeds&method=getfeedtree&mode=2" - }); + const store = new dojo.data.ItemFileWriteStore({ + url: "backend.php?op=pref_feeds&method=getfeedtree&mode=2" + }); - // noinspection JSUnresolvedFunction - const treeModel = new fox.FeedStoreModel({ - store: store, - query: { - "type": App.getInitParam('enable_feed_cats') ? "category" : "feed" - }, - rootId: "root", - rootLabel: "Feeds", - childrenAttrs: ["items"] - }); + // noinspection JSUnresolvedFunction + const treeModel = new fox.FeedStoreModel({ + store: store, + query: { + "type": App.getInitParam('enable_feed_cats') ? "category" : "feed" + }, + rootId: "root", + rootLabel: "Feeds", + childrenAttrs: ["items"] + }); - // noinspection JSUnresolvedFunction - const tree = new fox.FeedTree({ - model: treeModel, - onClick: function (item/*, node*/) { - const id = String(item.id); - const is_cat = id.match("^CAT:"); - const feed = id.substr(id.indexOf(":") + 1); - Feeds.open({feed: feed, is_cat: is_cat}); - return false; - }, - openOnClick: false, - showRoot: false, - persist: true, - id: "feedTree", - }, "feedTree"); - - const tmph = dojo.connect(dijit.byId('feedMenu'), '_openMyself', function (event) { - console.log(dijit.getEnclosingWidget(event.target)); - dojo.disconnect(tmph); - }); + // noinspection JSUnresolvedFunction + const tree = new fox.FeedTree({ + model: treeModel, + onClick: function (item/*, node*/) { + const id = String(item.id); + const is_cat = id.match("^CAT:"); + const feed = id.substr(id.indexOf(":") + 1); + Feeds.open({feed: feed, is_cat: is_cat}); + return false; + }, + openOnClick: false, + showRoot: false, + persist: true, + id: "feedTree", + }, "feedTree"); + + const tmph = dojo.connect(dijit.byId('feedMenu'), '_openMyself', function (event) { + console.log(dijit.getEnclosingWidget(event.target)); + dojo.disconnect(tmph); + }); - $("feeds-holder").appendChild(tree.domNode); + $("feeds-holder").appendChild(tree.domNode); - const tmph2 = dojo.connect(tree, 'onLoad', function () { - dojo.disconnect(tmph2); - Element.hide("feedlistLoading"); + const tmph2 = dojo.connect(tree, 'onLoad', function () { + dojo.disconnect(tmph2); + Element.hide("feedlistLoading"); - try { - Feeds.init(); - App.setLoadingProgress(25); - } catch (e) { - App.Error.report(e); - } - }); + try { + Feeds.init(); + App.setLoadingProgress(25); + } catch (e) { + App.Error.report(e); + } + }); - tree.startup(); - } catch (e) { - App.Error.report(e); - } - }, - init: function() { - console.log("in feedlist init"); + tree.startup(); + } catch (e) { + App.Error.report(e); + } + }, + init: function() { + console.log("in feedlist init"); - App.setLoadingProgress(50); + App.setLoadingProgress(50); - document.onkeydown = (event) => { return App.hotkeyHandler(event) }; - document.onkeypress = (event) => { return App.hotkeyHandler(event) }; - window.onresize = () => { Headlines.scrollHandler(); } + //document.onkeydown = (event) => { return App.hotkeyHandler(event) }; + //document.onkeypress = (event) => { return App.hotkeyHandler(event) }; + window.onresize = () => { Headlines.scrollHandler(); } - const hash_feed_id = hash_get('f'); - const hash_feed_is_cat = hash_get('c') == "1"; + /* global hash_get */ + const hash_feed_id = hash_get('f'); + const hash_feed_is_cat = hash_get('c') == "1"; - if (hash_feed_id != undefined) { - this.open({feed: hash_feed_id, is_cat: hash_feed_is_cat}); - } else { - this.open({feed: -3}); - } + if (hash_feed_id != undefined) { + this.open({feed: hash_feed_id, is_cat: hash_feed_is_cat}); + } else { + this.open({feed: -3}); + } - this.hideOrShowFeeds(App.getInitParam("hide_read_feeds")); + this.hideOrShowFeeds(App.getInitParam("hide_read_feeds")); - if (App.getInitParam("is_default_pw")) { - console.warn("user password is at default value"); + if (App.getInitParam("is_default_pw")) { + console.warn("user password is at default value"); - if (dijit.byId("defaultPasswordDlg")) - dijit.byId("defaultPasswordDlg").destroyRecursive(); + if (dijit.byId("defaultPasswordDlg")) + dijit.byId("defaultPasswordDlg").destroyRecursive(); + xhrPost("backend.php", {op: 'dlg', method: 'defaultpasswordwarning'}, (transport) => { const dialog = new dijit.Dialog({ title: __("Your password is at default value"), - href: "backend.php?op=dlg&method=defaultpasswordwarning", + content: transport.responseText, id: 'defaultPasswordDlg', style: "width: 600px", onCancel: function () { @@ -241,364 +244,366 @@ define(["dojo/_base/declare"], function (declare) { }); dialog.show(); - } - - // bw_limit disables timeout() so we request initial counters separately - if (App.getInitParam("bw_limit")) { - this.requestCounters(true); - } else { - setTimeout(() => { - this.requestCounters(true); - setInterval(() => { this.requestCounters(); }, 60 * 1000) - }, 250); - } - }, - activeIsCat: function() { - return !!this._active_feed_is_cat; - }, - getActive: function() { - return this._active_feed_id; - }, - setActive: function(id, is_cat) { - console.log('setActive', id, is_cat); - - hash_set('f', id); - hash_set('c', is_cat ? 1 : 0); - - this._active_feed_id = id; - this._active_feed_is_cat = is_cat; - - $("headlines-frame").setAttribute("feed-id", id); - $("headlines-frame").setAttribute("is-cat", is_cat ? 1 : 0); - - this.select(id, is_cat); - - PluginHost.run(PluginHost.HOOK_FEED_SET_ACTIVE, [this._active_feed_id, this._active_feed_is_cat]); - }, - select: function(feed, is_cat) { - const tree = dijit.byId("feedTree"); - - if (tree) return tree.selectFeed(feed, is_cat); - }, - toggleUnread: function() { - const hide = !App.getInitParam("hide_read_feeds"); - - xhrPost("backend.php", {op: "rpc", method: "setpref", key: "HIDE_READ_FEEDS", value: hide}, () => { - this.hideOrShowFeeds(hide); - App.setInitParam("hide_read_feeds", hide); }); - }, - hideOrShowFeeds: function (hide) { - /*const tree = dijit.byId("feedTree"); - - if (tree) - return tree.hideRead(hide, App.getInitParam("hide_read_shows_special"));*/ - - $$("body")[0].setAttribute("hide-read-feeds", !!hide); - $$("body")[0].setAttribute("hide-read-shows-special", !!App.getInitParam("hide_read_shows_special")); - }, - open: function(params) { - const feed = params.feed; - const is_cat = !!params.is_cat || false; - const offset = params.offset || 0; - const viewfeed_debug = params.viewfeed_debug; - const append = params.append || false; - const method = params.method; - // this is used to quickly switch between feeds, sets active but xhr is on a timeout - const delayed = params.delayed || false; - - if (offset != 0) { - if (this.infscroll_in_progress) - return; - - this.infscroll_in_progress = 1; - - window.clearTimeout(this._infscroll_timeout); - this._infscroll_timeout = window.setTimeout(() => { - console.log('infscroll request timed out, aborting'); - this.infscroll_in_progress = 0; - - // call scroll handler to maybe repeat infscroll request - Headlines.scrollHandler(); - }, 10 * 1000); - } - - Form.enable("toolbar-main"); - - let query = Object.assign({op: "feeds", method: "view", feed: feed}, - dojo.formToObject("toolbar-main")); - - if (method) query.m = method; - - if (offset > 0) { - if (Headlines.current_first_id) { - query.fid = Headlines.current_first_id; - } - } - - if (this._search_query) { - query = Object.assign(query, this._search_query); - } - - if (offset != 0) { - query.skip = offset; - } else if (!is_cat && feed == this.getActive() && !params.method) { - query.m = "ForceUpdate"; - } + } - Form.enable("toolbar-main"); - - if (!delayed) - if (!this.setExpando(feed, is_cat, - (is_cat) ? 'images/indicator_tiny.gif' : 'images/indicator_white.gif')) - Notify.progress("Loading, please wait...", true); - - query.cat = is_cat; - - this.setActive(feed, is_cat); - - if (viewfeed_debug) { - window.open("backend.php?" + - dojo.objectToQuery( - Object.assign({csrf_token: App.getInitParam("csrf_token")}, query) - )); - } - - window.clearTimeout(this._viewfeed_wait_timeout); - this._viewfeed_wait_timeout = window.setTimeout(() => { - xhrPost("backend.php", query, (transport) => { - try { - window.clearTimeout(this._infscroll_timeout); - this.setExpando(feed, is_cat, 'images/blank_icon.gif'); - Headlines.onLoaded(transport, offset, append); - PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]); - } catch (e) { - App.Error.report(e); - } - }); - }, delayed ? 250 : 0); - }, - catchupAll: function() { - const str = __("Mark all articles as read?"); + // bw_limit disables timeout() so we request initial counters separately + if (App.getInitParam("bw_limit")) { + this.requestCounters(true); + } else { + setTimeout(() => { + this.requestCounters(true); + setInterval(() => { this.requestCounters(); }, 60 * 1000) + }, 250); + } + }, + activeIsCat: function() { + return !!this._active_feed_is_cat; + }, + getActive: function() { + return this._active_feed_id; + }, + setActive: function(id, is_cat) { + console.log('setActive', id, is_cat); + + /* global hash_set */ + hash_set('f', id); + hash_set('c', is_cat ? 1 : 0); + + this._active_feed_id = id; + this._active_feed_is_cat = is_cat; + + $("headlines-frame").setAttribute("feed-id", id); + $("headlines-frame").setAttribute("is-cat", is_cat ? 1 : 0); + + this.select(id, is_cat); + + PluginHost.run(PluginHost.HOOK_FEED_SET_ACTIVE, [this._active_feed_id, this._active_feed_is_cat]); + }, + select: function(feed, is_cat) { + const tree = dijit.byId("feedTree"); + + if (tree) return tree.selectFeed(feed, is_cat); + }, + toggleUnread: function() { + const hide = !App.getInitParam("hide_read_feeds"); + + xhrPost("backend.php", {op: "rpc", method: "setpref", key: "HIDE_READ_FEEDS", value: hide}, () => { + this.hideOrShowFeeds(hide); + App.setInitParam("hide_read_feeds", hide); + }); + }, + hideOrShowFeeds: function (hide) { + /*const tree = dijit.byId("feedTree"); + + if (tree) + return tree.hideRead(hide, App.getInitParam("hide_read_shows_special"));*/ + + $$("body")[0].setAttribute("hide-read-feeds", !!hide); + $$("body")[0].setAttribute("hide-read-shows-special", !!App.getInitParam("hide_read_shows_special")); + }, + open: function(params) { + const feed = params.feed; + const is_cat = !!params.is_cat || false; + const offset = params.offset || 0; + const viewfeed_debug = params.viewfeed_debug; + const append = params.append || false; + const method = params.method; + // this is used to quickly switch between feeds, sets active but xhr is on a timeout + const delayed = params.delayed || false; + + if (offset != 0) { + if (this.infscroll_in_progress) + return; - if (App.getInitParam("confirm_feed_catchup") != 1 || confirm(str)) { + this.infscroll_in_progress = 1; - Notify.progress("Marking all feeds as read..."); + window.clearTimeout(this._infscroll_timeout); + this._infscroll_timeout = window.setTimeout(() => { + console.log('infscroll request timed out, aborting'); + this.infscroll_in_progress = 0; - xhrPost("backend.php", {op: "feeds", method: "catchupAll"}, () => { - this.requestCounters(true); - this.reloadCurrent(); - }); + // call scroll handler to maybe repeat infscroll request + Headlines.scrollHandler(); + }, 10 * 1000); + } - App.global_unread = 0; - App.updateTitle(); - } - }, - catchupFeed: function(feed, is_cat, mode) { - is_cat = is_cat || false; - - let str = false; - - switch (mode) { - case "1day": - str = __("Mark %w in %s older than 1 day as read?"); - break; - case "1week": - str = __("Mark %w in %s older than 1 week as read?"); - break; - case "2week": - str = __("Mark %w in %s older than 2 weeks as read?"); - break; - default: - str = __("Mark %w in %s as read?"); - } + Form.enable("toolbar-main"); - const mark_what = this.last_search_query && this.last_search_query[0] ? __("search results") : __("all articles"); - const fn = this.getName(feed, is_cat); + let query = Object.assign({op: "feeds", method: "view", feed: feed}, + dojo.formToObject("toolbar-main")); - str = str.replace("%s", fn) - .replace("%w", mark_what); + if (method) query.m = method; - if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) { - return; + if (offset > 0) { + if (Headlines.current_first_id) { + query.fid = Headlines.current_first_id; } - - const catchup_query = { - op: 'rpc', method: 'catchupFeed', feed_id: feed, - is_cat: is_cat, mode: mode, search_query: this.last_search_query[0], - search_lang: this.last_search_query[1] - }; - - Notify.progress("Loading, please wait...", true); - - xhrPost("backend.php", catchup_query, (transport) => { - App.handleRpcJson(transport); - - const show_next_feed = App.getInitParam("on_catchup_show_next_feed"); - - if (show_next_feed) { - const nuf = this.getNextUnread(feed, is_cat); - - if (nuf) { - this.open({feed: nuf, is_cat: is_cat}); - } - } else if (feed == this.getActive() && is_cat == this.activeIsCat()) { - this.reloadCurrent(); + } + + if (this._search_query) { + query = Object.assign(query, this._search_query); + } + + if (offset != 0) { + query.skip = offset; + } else if (!is_cat && feed == this.getActive() && !params.method) { + query.m = "ForceUpdate"; + } + + Form.enable("toolbar-main"); + + if (!delayed) + if (!this.setExpando(feed, is_cat, + (is_cat) ? 'images/indicator_tiny.gif' : 'images/indicator_white.gif')) + Notify.progress("Loading, please wait...", true); + + query.cat = is_cat; + + this.setActive(feed, is_cat); + + if (viewfeed_debug) { + window.open("backend.php?" + + dojo.objectToQuery( + Object.assign({csrf_token: App.getInitParam("csrf_token")}, query) + )); + } + + window.clearTimeout(this._viewfeed_wait_timeout); + this._viewfeed_wait_timeout = window.setTimeout(() => { + xhrPost("backend.php", query, (transport) => { + try { + window.clearTimeout(this._infscroll_timeout); + this.setExpando(feed, is_cat, 'images/blank_icon.gif'); + Headlines.onLoaded(transport, offset, append); + PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]); + } catch (e) { + App.Error.report(e); } - - Notify.close(); }); - }, - catchupCurrent: function(mode) { - this.catchupFeed(this.getActive(), this.activeIsCat(), mode); - }, - catchupFeedInGroup: function(id) { - const title = this.getName(id); + }, delayed ? 250 : 0); + }, + catchupAll: function() { + const str = __("Mark all articles as read?"); - const str = __("Mark all articles in %s as read?").replace("%s", title); + if (App.getInitParam("confirm_feed_catchup") != 1 || confirm(str)) { - if (App.getInitParam("confirm_feed_catchup") != 1 || confirm(str)) { + Notify.progress("Marking all feeds as read..."); - const rows = $$("#headlines-frame > div[id*=RROW][class*=Unread][data-orig-feed-id='" + id + "']"); - - rows.each((row) => { - row.removeClassName("Unread"); - }) - } - }, - getUnread: function(feed, is_cat) { - try { - const tree = dijit.byId("feedTree"); - - if (tree && tree.model) - return tree.model.getFeedUnread(feed, is_cat); + xhrPost("backend.php", {op: "feeds", method: "catchupAll"}, () => { + this.requestCounters(true); + this.reloadCurrent(); + }); - } catch (e) { - // + App.global_unread = 0; + App.updateTitle(); + } + }, + catchupFeed: function(feed, is_cat, mode) { + is_cat = is_cat || false; + + let str = false; + + switch (mode) { + case "1day": + str = __("Mark %w in %s older than 1 day as read?"); + break; + case "1week": + str = __("Mark %w in %s older than 1 week as read?"); + break; + case "2week": + str = __("Mark %w in %s older than 2 weeks as read?"); + break; + default: + str = __("Mark %w in %s as read?"); + } + + const mark_what = this.last_search_query && this.last_search_query[0] ? __("search results") : __("all articles"); + const fn = this.getName(feed, is_cat); + + str = str.replace("%s", fn) + .replace("%w", mark_what); + + if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) { + return; + } + + const catchup_query = { + op: 'rpc', method: 'catchupFeed', feed_id: feed, + is_cat: is_cat, mode: mode, search_query: this.last_search_query[0], + search_lang: this.last_search_query[1] + }; + + Notify.progress("Loading, please wait...", true); + + xhrPost("backend.php", catchup_query, (transport) => { + App.handleRpcJson(transport); + + const show_next_feed = App.getInitParam("on_catchup_show_next_feed"); + + if (show_next_feed) { + const nuf = this.getNextUnread(feed, is_cat); + + if (nuf) { + this.open({feed: nuf, is_cat: is_cat}); + } + } else if (feed == this.getActive() && is_cat == this.activeIsCat()) { + this.reloadCurrent(); } - return -1; - }, - getCategory: function(feed) { - try { - const tree = dijit.byId("feedTree"); + Notify.close(); + }); + }, + catchupCurrent: function(mode) { + this.catchupFeed(this.getActive(), this.activeIsCat(), mode); + }, + catchupFeedInGroup: function(id) { + const title = this.getName(id); - if (tree && tree.model) - return tree.getFeedCategory(feed); + const str = __("Mark all articles in %s as read?").replace("%s", title); - } catch (e) { - // - } + if (App.getInitParam("confirm_feed_catchup") != 1 || confirm(str)) { - return false; - }, - getName: function(feed, is_cat) { - if (isNaN(feed)) return feed; // it's a tag + const rows = $$("#headlines-frame > div[id*=RROW][class*=Unread][data-orig-feed-id='" + id + "']"); + rows.each((row) => { + row.removeClassName("Unread"); + }) + } + }, + getUnread: function(feed, is_cat) { + try { const tree = dijit.byId("feedTree"); if (tree && tree.model) - return tree.model.getFeedValue(feed, is_cat, 'name'); - }, - setUnread: function(feed, is_cat, unread) { - const tree = dijit.byId("feedTree"); - - if (tree && tree.model) - return tree.model.setFeedUnread(feed, is_cat, unread); - }, - setValue: function(feed, is_cat, key, value) { - try { - const tree = dijit.byId("feedTree"); - - if (tree && tree.model) - return tree.model.setFeedValue(feed, is_cat, key, value); + return tree.model.getFeedUnread(feed, is_cat); - } catch (e) { - // - } - }, - getValue: function(feed, is_cat, key) { - try { - const tree = dijit.byId("feedTree"); - - if (tree && tree.model) - return tree.model.getFeedValue(feed, is_cat, key); + } catch (e) { + // + } - } catch (e) { - // - } - return ''; - }, - setIcon: function(feed, is_cat, src) { + return -1; + }, + getCategory: function(feed) { + try { const tree = dijit.byId("feedTree"); - if (tree) return tree.setFeedIcon(feed, is_cat, src); - }, - setExpando: function(feed, is_cat, src) { + if (tree && tree.model) + return tree.getFeedCategory(feed); + + } catch (e) { + // + } + + return false; + }, + getName: function(feed, is_cat) { + if (isNaN(feed)) return feed; // it's a tag + + const tree = dijit.byId("feedTree"); + + if (tree && tree.model) + return tree.model.getFeedValue(feed, is_cat, 'name'); + }, + setUnread: function(feed, is_cat, unread) { + const tree = dijit.byId("feedTree"); + + if (tree && tree.model) + return tree.model.setFeedUnread(feed, is_cat, unread); + }, + setValue: function(feed, is_cat, key, value) { + try { const tree = dijit.byId("feedTree"); - if (tree) return tree.setFeedExpandoIcon(feed, is_cat, src); - - return false; - }, - getNextUnread: function(feed, is_cat) { + if (tree && tree.model) + return tree.model.setFeedValue(feed, is_cat, key, value); + + } catch (e) { + // + } + }, + getValue: function(feed, is_cat, key) { + try { const tree = dijit.byId("feedTree"); - const nuf = tree.model.getNextUnreadFeed(feed, is_cat); - - if (nuf) - return tree.model.store.getValue(nuf, 'bare_id'); - }, - search: function() { - const query = "backend.php?op=feeds&method=search¶m=" + - encodeURIComponent(Feeds.getActive() + ":" + Feeds.activeIsCat()); - - if (dijit.byId("searchDlg")) - dijit.byId("searchDlg").destroyRecursive(); - - const dialog = new dijit.Dialog({ - id: "searchDlg", - title: __("Search"), - style: "width: 600px", - execute: function () { - if (this.validate()) { - Feeds._search_query = this.attr('value'); - - // disallow empty queries - if (!Feeds._search_query.query) - Feeds._search_query = false; - - this.hide(); - Feeds.reloadCurrent(); - } - }, - href: query - }); - - const tmph = dojo.connect(dialog, 'onLoad', function () { - dojo.disconnect(tmph); - - if (Feeds._search_query) { - if (Feeds._search_query.query) - dijit.byId('search_query') - .attr('value', Feeds._search_query.query); - - if (Feeds._search_query.search_language) - dijit.byId('search_language') - .attr('value', Feeds._search_query.search_language); - } - - }); - - dialog.show(); - }, - updateRandom: function() { - console.log("in update_random_feed"); - xhrPost("backend.php", {op: "rpc", method: "updaterandomfeed"}, (transport) => { - App.handleRpcJson(transport, true); - }); - }, - }; - - return Feeds; -}); + if (tree && tree.model) + return tree.model.getFeedValue(feed, is_cat, key); + + } catch (e) { + // + } + return ''; + }, + setIcon: function(feed, is_cat, src) { + const tree = dijit.byId("feedTree"); + + if (tree) return tree.setFeedIcon(feed, is_cat, src); + }, + setExpando: function(feed, is_cat, src) { + const tree = dijit.byId("feedTree"); + + if (tree) return tree.setFeedExpandoIcon(feed, is_cat, src); + + return false; + }, + getNextUnread: function(feed, is_cat) { + const tree = dijit.byId("feedTree"); + const nuf = tree.model.getNextUnreadFeed(feed, is_cat); + + if (nuf) + return tree.model.store.getValue(nuf, 'bare_id'); + }, + search: function() { + if (dijit.byId("searchDlg")) + dijit.byId("searchDlg").destroyRecursive(); + + xhrPost("backend.php", + {op: "feeds", method: "search", + param: Feeds.getActive() + ":" + Feeds.activeIsCat()}, + (transport) => { + const dialog = new dijit.Dialog({ + id: "searchDlg", + content: transport.responseText, + title: __("Search"), + style: "width: 600px", + execute: function () { + if (this.validate()) { + Feeds._search_query = this.attr('value'); + + // disallow empty queries + if (!Feeds._search_query.query) + Feeds._search_query = false; + + this.hide(); + Feeds.reloadCurrent(); + } + }, + }); + + const tmph = dojo.connect(dialog, 'onLoad', function () { + dojo.disconnect(tmph); + + if (Feeds._search_query) { + if (Feeds._search_query.query) + dijit.byId('search_query') + .attr('value', Feeds._search_query.query); + + if (Feeds._search_query.search_language) + dijit.byId('search_language') + .attr('value', Feeds._search_query.search_language); + } + + }); + + dialog.show(); + }); + + }, + updateRandom: function() { + console.log("in update_random_feed"); + + xhrPost("backend.php", {op: "rpc", method: "updaterandomfeed"}, (transport) => { + App.handleRpcJson(transport, true); + }); + }, +}; diff --git a/js/Headlines.js b/js/Headlines.js index 540c400d3..b98098c33 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -1,944 +1,760 @@ 'use strict'; -/* global __, ngettext */ -define(["dojo/_base/declare"], function (declare) { - Headlines = { - vgroup_last_feed: undefined, - _headlines_scroll_timeout: 0, - _observer_counters_timeout: 0, - headlines: [], - current_first_id: 0, - _scroll_reset_timeout: false, - row_observer: new MutationObserver((mutations) => { - const modified = []; - mutations.each((m) => { - if (m.type == 'attributes' && ['class', 'data-score'].indexOf(m.attributeName) != -1) { +/* global __, ngettext, Article, App */ +/* global xhrPost, dojo, dijit, PluginHost, Notify, $$, Feeds */ +/* global CommonDialogs */ + +const Headlines = { + vgroup_last_feed: undefined, + _headlines_scroll_timeout: 0, + _observer_counters_timeout: 0, + headlines: [], + current_first_id: 0, + _scroll_reset_timeout: false, + default_force_previous: false, + default_force_to_top: false, + line_scroll_offset: 120, /* px */ + sticky_header_observer: new IntersectionObserver( + (entries, observer) => { + entries.forEach((entry) => { + const header = entry.target.nextElementSibling; + + if (entry.intersectionRatio == 0) { + header.setAttribute("stuck", "1"); + + } else if (entry.intersectionRatio == 1) { + header.removeAttribute("stuck"); + } + + //console.log(entry.target, header, entry.intersectionRatio); - const row = m.target; - const id = row.getAttribute("data-article-id"); + }); + }, + {threshold: [0, 1], root: document.querySelector("#headlines-frame")} + ), + unpack_observer: new IntersectionObserver( + (entries, observer) => { + entries.forEach((entry) => { + if (entry.intersectionRatio > 0) + Article.unpack(entry.target); + }); + }, + {threshold: [0], root: document.querySelector("#headlines-frame")} + ), + row_observer: new MutationObserver((mutations) => { + const modified = []; - if (Headlines.headlines[id]) { - const hl = Headlines.headlines[id]; + mutations.each((m) => { + if (m.type == 'attributes' && ['class', 'data-score'].indexOf(m.attributeName) != -1) { - if (hl) { - const hl_old = Object.extend({}, hl); + const row = m.target; + const id = row.getAttribute("data-article-id"); - hl.unread = row.hasClassName("Unread"); - hl.marked = row.hasClassName("marked"); - hl.published = row.hasClassName("published"); + if (Headlines.headlines[id]) { + const hl = Headlines.headlines[id]; - // not sent by backend - hl.selected = row.hasClassName("Selected"); - hl.active = row.hasClassName("active"); + if (hl) { + const hl_old = Object.extend({}, hl); - hl.score = row.getAttribute("data-score"); + hl.unread = row.hasClassName("Unread"); + hl.marked = row.hasClassName("marked"); + hl.published = row.hasClassName("published"); - modified.push({id: hl.id, new: hl, old: hl_old, row: row}); - } + // not sent by backend + hl.selected = row.hasClassName("Selected"); + hl.active = row.hasClassName("active"); + + hl.score = row.getAttribute("data-score"); + + modified.push({id: hl.id, new: hl, old: hl_old, row: row}); } } - }); + } + }); - Headlines.updateSelectedPrompt(); - Headlines.updateFloatingTitle(true); + Headlines.updateSelectedPrompt(); - if ('requestIdleCallback' in window) - window.requestIdleCallback(() => { - Headlines.syncModified(modified); - }); - else + if ('requestIdleCallback' in window) + window.requestIdleCallback(() => { Headlines.syncModified(modified); - }), - syncModified: function(modified) { - const ops = { - tmark: [], - tpub: [], - read: [], - unread: [], - select: [], - deselect: [], - activate: [], - deactivate: [], - rescore: {}, - }; - - modified.each(function(m) { - if (m.old.marked != m.new.marked) - ops.tmark.push(m.id); - - if (m.old.published != m.new.published) - ops.tpub.push(m.id); - - if (m.old.unread != m.new.unread) - m.new.unread ? ops.unread.push(m.id) : ops.read.push(m.id); - - if (m.old.selected != m.new.selected) - m.new.selected ? ops.select.push(m.row) : ops.deselect.push(m.row); - - if (m.old.active != m.new.active) - m.new.active ? ops.activate.push(m.row) : ops.deactivate.push(m.row); - - if (m.old.score != m.new.score) { - const score = m.new.score; - - ops.rescore[score] = ops.rescore[score] || []; - ops.rescore[score].push(m.id); - } }); + else + Headlines.syncModified(modified); + }), + syncModified: function (modified) { + const ops = { + tmark: [], + tpub: [], + read: [], + unread: [], + select: [], + deselect: [], + activate: [], + deactivate: [], + rescore: {}, + }; + + modified.each(function (m) { + if (m.old.marked != m.new.marked) + ops.tmark.push(m.id); + + if (m.old.published != m.new.published) + ops.tpub.push(m.id); + + if (m.old.unread != m.new.unread) + m.new.unread ? ops.unread.push(m.id) : ops.read.push(m.id); + + if (m.old.selected != m.new.selected) + m.new.selected ? ops.select.push(m.row) : ops.deselect.push(m.row); + + if (m.old.active != m.new.active) + m.new.active ? ops.activate.push(m.row) : ops.deactivate.push(m.row); + + if (m.old.score != m.new.score) { + const score = m.new.score; + + ops.rescore[score] = ops.rescore[score] || []; + ops.rescore[score].push(m.id); + } + }); - ops.select.each((row) => { - const cb = dijit.getEnclosingWidget(row.select(".rchk")[0]); + ops.select.each((row) => { + const cb = dijit.getEnclosingWidget(row.select(".rchk")[0]); - if (cb) - cb.attr('checked', true); - }); + if (cb) + cb.attr('checked', true); + }); - ops.deselect.each((row) => { - const cb = dijit.getEnclosingWidget(row.select(".rchk")[0]); + ops.deselect.each((row) => { + const cb = dijit.getEnclosingWidget(row.select(".rchk")[0]); - if (cb && !row.hasClassName("active")) - cb.attr('checked', false); - }); + if (cb && !row.hasClassName("active")) + cb.attr('checked', false); + }); - ops.activate.each((row) => { - const cb = dijit.getEnclosingWidget(row.select(".rchk")[0]); + ops.activate.each((row) => { + const cb = dijit.getEnclosingWidget(row.select(".rchk")[0]); - if (cb) - cb.attr('checked', true); - }); + if (cb) + cb.attr('checked', true); + }); - ops.deactivate.each((row) => { - const cb = dijit.getEnclosingWidget(row.select(".rchk")[0]); + ops.deactivate.each((row) => { + const cb = dijit.getEnclosingWidget(row.select(".rchk")[0]); - if (cb && !row.hasClassName("Selected")) - cb.attr('checked', false); - }); + if (cb && !row.hasClassName("Selected")) + cb.attr('checked', false); + }); - const promises = []; + const promises = []; - if (ops.tmark.length != 0) - promises.push(xhrPost("backend.php", - { op: "rpc", method: "markSelected", ids: ops.tmark.toString(), cmode: 2})); + if (ops.tmark.length != 0) + promises.push(xhrPost("backend.php", + {op: "rpc", method: "markSelected", ids: ops.tmark.toString(), cmode: 2})); - if (ops.tpub.length != 0) - promises.push(xhrPost("backend.php", - { op: "rpc", method: "publishSelected", ids: ops.tpub.toString(), cmode: 2})); + if (ops.tpub.length != 0) + promises.push(xhrPost("backend.php", + {op: "rpc", method: "publishSelected", ids: ops.tpub.toString(), cmode: 2})); - if (ops.read.length != 0) - promises.push(xhrPost("backend.php", - { op: "rpc", method: "catchupSelected", ids: ops.read.toString(), cmode: 0})); + if (ops.read.length != 0) + promises.push(xhrPost("backend.php", + {op: "rpc", method: "catchupSelected", ids: ops.read.toString(), cmode: 0})); - if (ops.unread.length != 0) - promises.push(xhrPost("backend.php", - { op: "rpc", method: "catchupSelected", ids: ops.unread.toString(), cmode: 1})); + if (ops.unread.length != 0) + promises.push(xhrPost("backend.php", + {op: "rpc", method: "catchupSelected", ids: ops.unread.toString(), cmode: 1})); - const scores = Object.keys(ops.rescore); + const scores = Object.keys(ops.rescore); - if (scores.length != 0) { - scores.each((score) => { - promises.push(xhrPost("backend.php", - { op: "article", method: "setScore", id: ops.rescore[score].toString(), score: score })); - }); - } + if (scores.length != 0) { + scores.each((score) => { + promises.push(xhrPost("backend.php", + {op: "article", method: "setScore", id: ops.rescore[score].toString(), score: score})); + }); + } - if (promises.length > 0) - Promise.all([promises]).then(() => { - window.clearTimeout(this._observer_counters_timeout); + if (promises.length > 0) + Promise.all([promises]).then(() => { + window.clearTimeout(this._observer_counters_timeout); - this._observer_counters_timeout = setTimeout(() => { - Feeds.requestCounters(true); - }, 1000); - }); + this._observer_counters_timeout = setTimeout(() => { + Feeds.requestCounters(true); + }, 1000); + }); - }, - click: function (event, id, in_body) { - in_body = in_body || false; + }, + click: function (event, id, in_body) { + in_body = in_body || false; - if (event.shiftKey && Article.getActive()) { - Headlines.select('none'); + if (event.shiftKey && Article.getActive()) { + Headlines.select('none'); - const ids = Headlines.getRange(Article.getActive(), id); + const ids = Headlines.getRange(Article.getActive(), id); - console.log(Article.getActive(), id, ids); + console.log(Article.getActive(), id, ids); - for (let i = 0; i < ids.length; i++) - Headlines.select('all', ids[i]); + for (let i = 0; i < ids.length; i++) + Headlines.select('all', ids[i]); - } else if (event.ctrlKey) { - Headlines.select('invert', id); - } else { - if (App.isCombinedMode()) { + } else if (event.ctrlKey) { + Headlines.select('invert', id); + } else { + if (App.isCombinedMode()) { - if (event.altKey && !in_body) { + if (event.altKey && !in_body) { - Article.openInNewWindow(id); - Headlines.toggleUnread(id, 0); + Article.openInNewWindow(id); + Headlines.toggleUnread(id, 0); - } else if (Article.getActive() != id) { + } else if (Article.getActive() != id) { - Headlines.select('none'); - Article.setActive(id); + Headlines.select('none'); - if (App.getInitParam("cdm_expanded")) { - if (!in_body) - Article.openInNewWindow(id); + const scroll_position_A = $("RROW-" + id).offsetTop - $("headlines-frame").scrollTop; - Headlines.toggleUnread(id, 0); - } else { - Article.cdmScrollToId(id); - } + Article.setActive(id); - } else if (in_body) { - Headlines.toggleUnread(id, 0); - } else { /* !in body */ - Article.openInNewWindow(id); - } + if (App.getInitParam("cdm_expanded")) { + + if (!in_body) + Article.openInNewWindow(id); - return in_body; - } else { - if (event.altKey) { - Article.openInNewWindow(id); Headlines.toggleUnread(id, 0); } else { - Headlines.select('none'); - Article.view(id); - } - } - } - - return false; - }, - initScrollHandler: function () { - $("headlines-frame").onscroll = (event) => { - clearTimeout(this._headlines_scroll_timeout); - this._headlines_scroll_timeout = window.setTimeout(function () { - //console.log('done scrolling', event); - Headlines.scrollHandler(event); - }, 50); - } - }, - loadMore: function () { - const view_mode = document.forms["toolbar-main"].view_mode.value; - const unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length; - const num_all = $$("#headlines-frame > div[id*=RROW]").length; - const num_unread = Feeds.getUnread(Feeds.getActive(), Feeds.activeIsCat()); + const scroll_position_B = $("RROW-" + id).offsetTop - $("headlines-frame").scrollTop; - // TODO implement marked & published + // this would only work if there's enough space + $("headlines-frame").scrollTop -= scroll_position_A-scroll_position_B; - let offset = num_all; - - switch (view_mode) { - case "marked": - case "published": - console.warn("loadMore: ", view_mode, "not implemented"); - break; - case "unread": - offset = unread_in_buffer; - break; - case "adaptive": - if (!(Feeds.getActive() == -1 && !Feeds.activeIsCat())) - offset = num_unread > 0 ? unread_in_buffer : num_all; - break; - } - - console.log("loadMore, offset=", offset); - - Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), offset: offset, append: true}); - }, - isChildVisible: function (elem, ctr) { - const ctop = ctr.scrollTop; - const cbottom = ctop + ctr.offsetHeight; - - const etop = elem.offsetTop; - const ebottom = etop + elem.offsetHeight; - - return etop >= ctop && ebottom <= cbottom || - etop < ctop && ebottom > ctop || ebottom > cbottom && etop < cbottom - - }, - firstVisible: function() { - const rows = $$("#headlines-frame > div[id*=RROW]"); - const ctr = $("headlines-frame"); + Article.cdmMoveToId(id); + } - for (let i = 0; i < rows.length; i++) { - const row = rows[i]; + } else if (in_body) { + Headlines.toggleUnread(id, 0); + } else { /* !in body */ + Article.openInNewWindow(id); + } - if (this.isChildVisible(row, ctr)) { - return row.getAttribute("data-article-id"); + return in_body; + } else { + if (event.altKey) { + Article.openInNewWindow(id); + Headlines.toggleUnread(id, 0); + } else { + Headlines.select('none'); + Article.view(id); } } - }, - scrollHandler: function (/*event*/) { - try { - Headlines.unpackVisible(); + } - if (App.isCombinedMode()) - Headlines.updateFloatingTitle(); + return false; + }, + initScrollHandler: function () { + $("headlines-frame").onscroll = (event) => { + clearTimeout(this._headlines_scroll_timeout); + this._headlines_scroll_timeout = window.setTimeout(function () { + //console.log('done scrolling', event); + Headlines.scrollHandler(event); + }, 50); + } + }, + loadMore: function () { + const view_mode = document.forms["toolbar-main"].view_mode.value; + const unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length; + const num_all = $$("#headlines-frame > div[id*=RROW]").length; + const num_unread = Feeds.getUnread(Feeds.getActive(), Feeds.activeIsCat()); + + // TODO implement marked & published + + let offset = num_all; + + switch (view_mode) { + case "marked": + case "published": + console.warn("loadMore: ", view_mode, "not implemented"); + break; + case "unread": + offset = unread_in_buffer; + break; + case "adaptive": + if (!(Feeds.getActive() == -1 && !Feeds.activeIsCat())) + offset = num_unread > 0 ? unread_in_buffer : num_all; + break; + } - if (!Feeds.infscroll_disabled && !Feeds.infscroll_in_progress) { - const hsp = $("headlines-spacer"); - const container = $("headlines-frame"); + console.log("loadMore, offset=", offset); - if (hsp && hsp.previousSibling) { - const last_row = hsp.previousSibling; + Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), offset: offset, append: true}); + }, + isChildVisible: function (elem) { + return App.Scrollable.isChildVisible(elem, $("headlines-frame")); + }, + firstVisible: function () { + const rows = $$("#headlines-frame > div[id*=RROW]"); - // invoke lazy load if last article in buffer is nearly visible OR is active - if (Article.getActive() == last_row.getAttribute("data-article-id") || last_row.offsetTop - 250 <= container.scrollTop + container.offsetHeight) { - hsp.innerHTML = "<span class='loading'><img src='images/indicator_tiny.gif'> " + - __("Loading, please wait...") + "</span>"; + for (let i = 0; i < rows.length; i++) { + const row = rows[i]; - Headlines.loadMore(); - return; - } + if (this.isChildVisible(row)) { + return row.getAttribute("data-article-id"); + } + } + }, + scrollHandler: function (/*event*/) { + try { + if (!Feeds.infscroll_disabled && !Feeds.infscroll_in_progress) { + const hsp = $("headlines-spacer"); + const container = $("headlines-frame"); + + if (hsp && hsp.previousSibling) { + const last_row = hsp.previousSibling; + + // invoke lazy load if last article in buffer is nearly visible OR is active + if (Article.getActive() == last_row.getAttribute("data-article-id") || last_row.offsetTop - 250 <= container.scrollTop + container.offsetHeight) { + hsp.innerHTML = "<span class='loading'><img src='images/indicator_tiny.gif'> " + + __("Loading, please wait...") + "</span>"; + + Headlines.loadMore(); + return; } } + } - if (App.getInitParam("cdm_auto_catchup")) { + if (App.getInitParam("cdm_auto_catchup")) { - let rows = $$("#headlines-frame > div[id*=RROW][class*=Unread]"); + const rows = $$("#headlines-frame > div[id*=RROW][class*=Unread]"); - for (let i = 0; i < rows.length; i++) { - const row = rows[i]; + for (let i = 0; i < rows.length; i++) { + const row = rows[i]; - if ($("headlines-frame").scrollTop > (row.offsetTop + row.offsetHeight / 2)) { - row.removeClassName("Unread"); - } else { - break; - } + if ($("headlines-frame").scrollTop > (row.offsetTop + row.offsetHeight / 2)) { + row.removeClassName("Unread"); + } else { + break; } } - } catch (e) { - console.warn("scrollHandler", e); } - }, - updateFloatingTitle: function (status_only) { - if (!App.isCombinedMode()/* || !App.getInitParam("cdm_expanded")*/) return; - - const safety_offset = 120; /* px, needed for firefox */ - const hf = $("headlines-frame"); - const elems = $$("#headlines-frame > div[id*=RROW]"); - const ft = $("floatingTitle"); - - for (let i = 0; i < elems.length; i++) { - const row = elems[i]; - - if (row && row.offsetTop + row.offsetHeight > hf.scrollTop + safety_offset) { - - const header = row.select(".header")[0]; - const id = row.getAttribute("data-article-id"); - - if (status_only || id != ft.getAttribute("data-article-id")) { - if (id != ft.getAttribute("data-article-id")) { - - ft.setAttribute("data-article-id", id); - ft.innerHTML = header.innerHTML; - - ft.select(".dijitCheckBox")[0].outerHTML = "<i class=\"material-icons icon-anchor\" onclick=\"Article.cdmScrollToId(" + id + ", true)\">expand_more</i>"; - - this.initFloatingMenu(); - - } - - if (row.hasClassName("Unread")) - ft.addClassName("Unread"); - else - ft.removeClassName("Unread"); - - if (row.hasClassName("marked")) - ft.addClassName("marked"); - else - ft.removeClassName("marked"); - - if (row.hasClassName("published")) - ft.addClassName("published"); - else - ft.removeClassName("published"); - - PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, row); - } + } catch (e) { + console.warn("scrollHandler", e); + } + }, + objectById: function (id) { + return this.headlines[id]; + }, + setCommonClasses: function () { + $("headlines-frame").removeClassName("cdm"); + $("headlines-frame").removeClassName("normal"); + + $("headlines-frame").addClassName(App.isCombinedMode() ? "cdm" : "normal"); + + // for floating title because it's placed outside of headlines-frame + $("main").removeClassName("expandable"); + $("main").removeClassName("expanded"); + + if (App.isCombinedMode()) + $("main").addClassName(App.getInitParam("cdm_expanded") ? " expanded" : " expandable"); + }, + renderAgain: function () { + // TODO: wrap headline elements into a knockoutjs model to prevent all this stuff + Headlines.setCommonClasses(); + + $$("#headlines-frame > div[id*=RROW]").each((row) => { + const id = row.getAttribute("data-article-id"); + const hl = this.headlines[id]; + + if (hl) { + const new_row = this.render({}, hl); + + row.parentNode.replaceChild(new_row, row); + + if (hl.active) { + new_row.addClassName("active"); + Article.unpack(new_row); - if (hf.scrollTop - row.offsetTop <= header.offsetHeight + safety_offset) - ft.fade({duration: 0.2}); + if (App.isCombinedMode()) + Article.cdmMoveToId(id, {noscroll: true}); else - ft.appear({duration: 0.2}); - - return; + Article.view(id); } + + if (hl.selected) this.select("all", id); } - }, - unpackVisible: function () { - if (!App.isCombinedMode() || !App.getInitParam("cdm_expanded")) return; + }); - const rows = $$("#headlines-frame div[id*=RROW][data-content]"); - const threshold = $("headlines-frame").scrollTop + $("headlines-frame").offsetHeight + 600; + $$(".cdm .header-sticky-guard").each((e) => { + this.sticky_header_observer.observe(e) + }); - for (let i = 0; i < rows.length; i++) { - const row = rows[i]; + if (App.getInitParam("cdm_expanded")) + $$("#headlines-frame > div[id*=RROW].cdm").each((e) => { + this.unpack_observer.observe(e) + }); - if (row.offsetTop <= threshold) { - Article.unpack(row); - } else { - break; - } - } - }, - objectById: function (id){ - return this.headlines[id]; - }, - renderAgain: function() { - // TODO: wrap headline elements into a knockoutjs model to prevent all this stuff + }, + render: function (headlines, hl) { + let row = null; - $$("#headlines-frame > div[id*=RROW]").each((row) => { - const id = row.getAttribute("data-article-id"); - const hl = this.headlines[id]; + let row_class = ""; - if (hl) { - const new_row = this.render({}, hl); + if (hl.marked) row_class += " marked"; + if (hl.published) row_class += " published"; + if (hl.unread) row_class += " Unread"; + if (headlines.vfeed_group_enabled) row_class += " vgrlf"; - row.parentNode.replaceChild(new_row, row); + if (headlines.vfeed_group_enabled && hl.feed_title && this.vgroup_last_feed != hl.feed_id) { + const vgrhdr = `<div data-feed-id='${hl.feed_id}' class='feed-title'> + <div style='float : right'>${hl.feed_icon}</div> + <a class="title" href="#" onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title} + <a class="catchup" title="${__('mark feed as read')}" onclick="Feeds.catchupFeedInGroup(${hl.feed_id})" href="#"><i class="icon-done material-icons">done_all</i></a> + </div>` - if (hl.active) { - new_row.addClassName("active"); - - if (App.isCombinedMode()) - Article.cdmScrollToId(id); - else - Article.view(id); - } + const tmp = document.createElement("div"); + tmp.innerHTML = vgrhdr; - if (hl.selected) this.select("all", id); + $("headlines-frame").appendChild(tmp.firstChild); - Article.unpack(new_row); + this.vgroup_last_feed = hl.feed_id; + } - } - }); - }, - render: function (headlines, hl) { - let row = null; + if (App.isCombinedMode()) { + row_class += App.getInitParam("cdm_expanded") ? " expanded" : " expandable"; + + const comments = Article.formatComments(hl); + const originally_from = Article.formatOriginallyFrom(hl); + + row = `<div class="cdm ${row_class} ${Article.getScoreClass(hl.score)}" + id="RROW-${hl.id}" + data-article-id="${hl.id}" + data-orig-feed-id="${hl.feed_id}" + data-content="${App.escapeHtml(hl.content)}" + data-score="${hl.score}" + data-article-title="${App.escapeHtml(hl.title)}" + onmouseover="Article.mouseIn(${hl.id})" + onmouseout="Article.mouseOut(${hl.id})"> + <div class="header-sticky-guard"></div> + <div class="header"> + <div class="left"> + <input dojoType="dijit.form.CheckBox" type="checkbox" onclick="Headlines.onRowChecked(this)" class='rchk'> + <i class="marked-pic marked-${hl.id} material-icons" onclick="Headlines.toggleMark(${hl.id})">star</i> + <i class="pub-pic pub-${hl.id} material-icons" onclick="Headlines.togglePub(${hl.id})">rss_feed</i> + </div> - let row_class = ""; + <span onclick="return Headlines.click(event, ${hl.id});" data-article-id="${hl.id}" class="titleWrap hlMenuAttach"> + <a class="title" title="${App.escapeHtml(hl.title)}" target="_blank" rel="noopener noreferrer" href="${App.escapeHtml(hl.link)}"> + ${hl.title}</a> + <span class="author">${hl.author}</span> + ${hl.labels} + ${hl.cdm_excerpt ? hl.cdm_excerpt : ""} + </span> + + <div class="feed"> + <a href="#" style="background-color: ${hl.feed_bg_color}" + onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}</a> + </div> - if (hl.marked) row_class += " marked"; - if (hl.published) row_class += " published"; - if (hl.unread) row_class += " Unread"; - if (headlines.vfeed_group_enabled) row_class += " vgrlf"; + <span class="updated" title="${hl.imported}">${hl.updated}</span> - if (headlines.vfeed_group_enabled && hl.feed_title && this.vgroup_last_feed != hl.feed_id) { - let vgrhdr = `<div data-feed-id='${hl.feed_id}' class='feed-title'> - <div style='float : right'>${hl.feed_icon}</div> - <a class="title" href="#" onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title} - <a class="catchup" title="${__('mark feed as read')}" onclick="Feeds.catchupFeedInGroup(${hl.feed_id})" href="#"><i class="icon-done material-icons">done_all</i></a> - </div>` + <div class="right"> + <i class="material-icons icon-score" title="${hl.score}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i> - const tmp = document.createElement("div"); - tmp.innerHTML = vgrhdr; + <span style="cursor : pointer" title="${App.escapeHtml(hl.feed_title)}" onclick="Feeds.open({feed:${hl.feed_id}})"> + ${hl.feed_icon}</span> + </div> - $("headlines-frame").appendChild(tmp.firstChild); + </div> - this.vgroup_last_feed = hl.feed_id; - } + <div class="content" onclick="return Headlines.click(event, ${hl.id}, true);"> + <div id="POSTNOTE-${hl.id}">${hl.note}</div> + <div class="content-inner" lang="${hl.lang ? hl.lang : 'en'}"> + <img src="${App.getInitParam('icon_indicator_white')}"> + </div> + <div class="intermediate"> + ${hl.enclosures} + </div> + <div class="footer" onclick="event.stopPropagation()"> - if (App.isCombinedMode()) { - row_class += App.getInitParam("cdm_expanded") ? " expanded" : " expandable"; - - const comments = Article.formatComments(hl); - const originally_from = Article.formatOriginallyFrom(hl); - - row = `<div class="cdm ${row_class} ${Article.getScoreClass(hl.score)}" - id="RROW-${hl.id}" - data-article-id="${hl.id}" - data-orig-feed-id="${hl.feed_id}" - data-content="${escapeHtml(hl.content)}" - data-score="${hl.score}" - data-article-title="${escapeHtml(hl.title)}" - onmouseover="Article.mouseIn(${hl.id})" - onmouseout="Article.mouseOut(${hl.id})"> - - <div class="header"> <div class="left"> - <input dojoType="dijit.form.CheckBox" type="checkbox" onclick="Headlines.onRowChecked(this)" class='rchk'> - <i class="marked-pic marked-${hl.id} material-icons" onclick="Headlines.toggleMark(${hl.id})">star</i> - <i class="pub-pic pub-${hl.id} material-icons" onclick="Headlines.togglePub(${hl.id})">rss_feed</i> + ${hl.buttons_left} + <i class="material-icons">label_outline</i> + <span id="ATSTR-${hl.id}">${hl.tags_str}</span> + <a title="${__("Edit tags for this article")}" href="#" + onclick="Article.editTags(${hl.id})">(+)</a> + ${comments} </div> - - <span onclick="return Headlines.click(event, ${hl.id});" data-article-id="${hl.id}" class="titleWrap hlMenuAttach"> - <a class="title" title="${escapeHtml(hl.title)}" target="_blank" rel="noopener noreferrer" href="${escapeHtml(hl.link)}"> - ${hl.title}</a> - <span class="author">${hl.author}</span> - ${hl.labels} - ${hl.cdm_excerpt ? hl.cdm_excerpt : ""} - </span> - - <div class="feed"> - <a href="#" style="background-color: ${hl.feed_bg_color}" - onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}</a> - </div> - - <span class="updated" title="${hl.imported}">${hl.updated}</span> - - <div class="right"> - <i class="material-icons icon-score" title="${hl.score}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i> - - <span style="cursor : pointer" title="${escapeHtml(hl.feed_title)}" onclick="Feeds.open({feed:${hl.feed_id}})"> - ${hl.feed_icon}</span> - </div> - - </div> - - <div class="content" onclick="return Headlines.click(event, ${hl.id}, true);"> - <div id="POSTNOTE-${hl.id}">${hl.note}</div> - <div class="content-inner" lang="${hl.lang ? hl.lang : 'en'}"> - <img src="${App.getInitParam('icon_indicator_white')}"> - </div> - <div class="intermediate"> - ${hl.enclosures} - </div> - <div class="footer" onclick="event.stopPropagation()"> - - <div class="left"> - ${hl.buttons_left} - <i class="material-icons">label_outline</i> - <span id="ATSTR-${hl.id}">${hl.tags_str}</span> - <a title="${__("Edit tags for this article")}" href="#" - onclick="Article.editTags(${hl.id})">(+)</a> - ${comments} - </div> - - <div class="right"> - ${originally_from} - ${hl.buttons} - </div> + + <div class="right"> + ${originally_from} + ${hl.buttons} </div> </div> - </div>`; - - - } else { - row = `<div class="hl ${row_class} ${Article.getScoreClass(hl.score)}" - id="RROW-${hl.id}" - data-orig-feed-id="${hl.feed_id}" - data-article-id="${hl.id}" - data-score="${hl.score}" - data-article-title="${escapeHtml(hl.title)}" - onmouseover="Article.mouseIn(${hl.id})" - onmouseout="Article.mouseOut(${hl.id})"> - <div class="left"> - <input dojoType="dijit.form.CheckBox" type="checkbox" onclick="Headlines.onRowChecked(this)" class='rchk'> - <i class="marked-pic marked-${hl.id} material-icons" onclick="Headlines.toggleMark(${hl.id})">star</i> - <i class="pub-pic pub-${hl.id} material-icons" onclick="Headlines.togglePub(${hl.id})">rss_feed</i> - </div> - <div onclick="return Headlines.click(event, ${hl.id})" class="title"> - <span data-article-id="${hl.id}" class="hl-content hlMenuAttach"> - <a class="title" href="${escapeHtml(hl.link)}">${hl.title} <span class="preview">${hl.content_preview}</span></a> - <span class="author">${hl.author}</span> - ${hl.labels} + </div> + </div>`; + + + } else { + row = `<div class="hl ${row_class} ${Article.getScoreClass(hl.score)}" + id="RROW-${hl.id}" + data-orig-feed-id="${hl.feed_id}" + data-article-id="${hl.id}" + data-score="${hl.score}" + data-article-title="${App.escapeHtml(hl.title)}" + onmouseover="Article.mouseIn(${hl.id})" + onmouseout="Article.mouseOut(${hl.id})"> + <div class="left"> + <input dojoType="dijit.form.CheckBox" type="checkbox" onclick="Headlines.onRowChecked(this)" class='rchk'> + <i class="marked-pic marked-${hl.id} material-icons" onclick="Headlines.toggleMark(${hl.id})">star</i> + <i class="pub-pic pub-${hl.id} material-icons" onclick="Headlines.togglePub(${hl.id})">rss_feed</i> + </div> + <div onclick="return Headlines.click(event, ${hl.id})" class="title"> + <span data-article-id="${hl.id}" class="hl-content hlMenuAttach"> + <a class="title" href="${App.escapeHtml(hl.link)}">${hl.title} <span class="preview">${hl.content_preview}</span></a> + <span class="author">${hl.author}</span> + ${hl.labels} + </span> + </div> + <span class="feed"> + <a style="background : ${hl.feed_bg_color}" href="#" onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}</a> </span> - </div> - <span class="feed"> - <a style="background : ${hl.feed_bg_color}" href="#" onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}</a> - </span> - <div title="${hl.imported}"> - <span class="updated">${hl.updated}</span> - </div> - <div class="right"> - <i class="material-icons icon-score" title="${hl.score}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i> - <span onclick="Feeds.open({feed:${hl.feed_id}})" style="cursor : pointer" title="${escapeHtml(hl.feed_title)}">${hl.feed_icon}</span> - </div> - </div> - `; - } + <div title="${hl.imported}"> + <span class="updated">${hl.updated}</span> + </div> + <div class="right"> + <i class="material-icons icon-score" title="${hl.score}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i> + <span onclick="Feeds.open({feed:${hl.feed_id}})" style="cursor : pointer" title="${App.escapeHtml(hl.feed_title)}">${hl.feed_icon}</span> + </div> + </div> + `; + } - const tmp = document.createElement("div"); - tmp.innerHTML = row; - dojo.parser.parse(tmp); + const tmp = document.createElement("div"); + tmp.innerHTML = row; + dojo.parser.parse(tmp); - this.row_observer.observe(tmp.firstChild, {attributes: true}); + this.row_observer.observe(tmp.firstChild, {attributes: true}); - PluginHost.run(PluginHost.HOOK_HEADLINE_RENDERED, tmp.firstChild); + PluginHost.run(PluginHost.HOOK_HEADLINE_RENDERED, tmp.firstChild); - return tmp.firstChild; - }, - updateCurrentUnread: function() { - if ($("feed_current_unread")) { - const feed_unread = Feeds.getUnread(Feeds.getActive(), Feeds.activeIsCat()); + return tmp.firstChild; + }, + updateCurrentUnread: function () { + if ($("feed_current_unread")) { + const feed_unread = Feeds.getUnread(Feeds.getActive(), Feeds.activeIsCat()); - if (feed_unread > 0 && !Element.visible("feeds-holder")) { - $("feed_current_unread").innerText = feed_unread; - Element.show("feed_current_unread"); - } else { - Element.hide("feed_current_unread"); - } + if (feed_unread > 0 && !Element.visible("feeds-holder")) { + $("feed_current_unread").innerText = feed_unread; + Element.show("feed_current_unread"); + } else { + Element.hide("feed_current_unread"); } - }, - onLoaded: function (transport, offset, append) { - const reply = App.handleRpcJson(transport); - - console.log("Headlines.onLoaded: offset=", offset, "append=", append); - - let is_cat = false; - let feed_id = false; - - if (reply) { - - is_cat = reply['headlines']['is_cat']; - feed_id = reply['headlines']['id']; - Feeds.last_search_query = reply['headlines']['search_query']; - - if (feed_id != -7 && (feed_id != Feeds.getActive() || is_cat != Feeds.activeIsCat())) - return; - - const headlines_count = reply['headlines-info']['count']; - - //this.vgroup_last_feed = reply['headlines-info']['vgroup_last_feed']; - this.current_first_id = reply['headlines']['first_id']; - - console.log('received', headlines_count, 'headlines'); - - if (!append) { - Feeds.infscroll_disabled = parseInt(headlines_count) != 30; - console.log('infscroll_disabled=', Feeds.infscroll_disabled); - - // TODO: the below needs to be applied again when switching expanded/expandable on the fly - // via hotkeys, not just on feed load + } + }, + onLoaded: function (transport, offset, append) { + const reply = App.handleRpcJson(transport); - $("headlines-frame").removeClassName("cdm"); - $("headlines-frame").removeClassName("normal"); + console.log("Headlines.onLoaded: offset=", offset, "append=", append); - $("headlines-frame").addClassName(App.isCombinedMode() ? "cdm" : "normal"); + let is_cat = false; + let feed_id = false; - $("headlines-frame").setAttribute("is-vfeed", - reply['headlines']['is_vfeed'] ? 1 : 0); + if (reply) { - // for floating title because it's placed outside of headlines-frame - $("main").removeClassName("expandable"); - $("main").removeClassName("expanded"); + is_cat = reply['headlines']['is_cat']; + feed_id = reply['headlines']['id']; + Feeds.last_search_query = reply['headlines']['search_query']; - if (App.isCombinedMode()) - $("main").addClassName(App.getInitParam("cdm_expanded") ? " expanded" : " expandable"); + if (feed_id != -7 && (feed_id != Feeds.getActive() || is_cat != Feeds.activeIsCat())) + return; - Article.setActive(0); + const headlines_count = reply['headlines-info']['count']; - try { - $("headlines-frame").removeClassName("smooth-scroll"); - $("headlines-frame").scrollTop = 0; - $("headlines-frame").addClassName("smooth-scroll"); + //this.vgroup_last_feed = reply['headlines-info']['vgroup_last_feed']; + this.current_first_id = reply['headlines']['first_id']; - Element.hide("floatingTitle"); - $("floatingTitle").setAttribute("data-article-id", 0); - $("floatingTitle").innerHTML = ""; - } catch (e) { - console.warn(e); - } + console.log('received', headlines_count, 'headlines'); - this.headlines = []; - this.vgroup_last_feed = undefined; + if (!append) { + Feeds.infscroll_disabled = parseInt(headlines_count) != 30; + console.log('infscroll_disabled=', Feeds.infscroll_disabled); - dojo.html.set($("toolbar-headlines"), - reply['headlines']['toolbar'], - {parseContent: true}); + // also called in renderAgain() after view mode switch + Headlines.setCommonClasses(); - if (typeof reply['headlines']['content'] == 'string') { - $("headlines-frame").innerHTML = reply['headlines']['content']; - } else { - $("headlines-frame").innerHTML = ''; + $("headlines-frame").setAttribute("is-vfeed", + reply['headlines']['is_vfeed'] ? 1 : 0); - for (let i = 0; i < reply['headlines']['content'].length; i++) { - const hl = reply['headlines']['content'][i]; - - $("headlines-frame").appendChild(this.render(reply['headlines'], hl)); + Article.setActive(0); - this.headlines[parseInt(hl.id)] = hl; - } - } + try { + $("headlines-frame").removeClassName("smooth-scroll"); + $("headlines-frame").scrollTop = 0; + $("headlines-frame").addClassName("smooth-scroll"); + } catch (e) { + console.warn(e); + } - let hsp = $("headlines-spacer"); + this.headlines = []; + this.vgroup_last_feed = undefined; - if (!hsp) { - hsp = document.createElement("div"); - hsp.id = "headlines-spacer"; - } + dojo.html.set($("toolbar-headlines"), + reply['headlines']['toolbar'], + {parseContent: true}); - dijit.byId('headlines-frame').domNode.appendChild(hsp); + if (typeof reply['headlines']['content'] == 'string') { + $("headlines-frame").innerHTML = reply['headlines']['content']; + } else { + $("headlines-frame").innerHTML = ''; - this.initHeadlinesMenu(); + for (let i = 0; i < reply['headlines']['content'].length; i++) { + const hl = reply['headlines']['content'][i]; - if (Feeds.infscroll_disabled) - hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnread()'>" + - __("Click to open next unread feed.") + "</a>"; + $("headlines-frame").appendChild(this.render(reply['headlines'], hl)); - if (Feeds._search_query) { - $("feed_title").innerHTML += "<span id='cancel_search'>" + - " (<a href='#' onclick='Feeds.cancelSearch()'>" + __("Cancel search") + "</a>)" + - "</span>"; + this.headlines[parseInt(hl.id)] = hl; } + } - Headlines.updateCurrentUnread(); - - } else if (headlines_count > 0 && feed_id == Feeds.getActive() && is_cat == Feeds.activeIsCat()) { - const c = dijit.byId("headlines-frame"); - - let hsp = $("headlines-spacer"); + let hsp = $("headlines-spacer"); - if (hsp) - c.domNode.removeChild(hsp); + if (!hsp) { + hsp = document.createElement("div"); + hsp.id = "headlines-spacer"; + } - let headlines_appended = 0; + dijit.byId('headlines-frame').domNode.appendChild(hsp); - if (typeof reply['headlines']['content'] == 'string') { - $("headlines-frame").innerHTML = reply['headlines']['content']; - } else { - for (let i = 0; i < reply['headlines']['content'].length; i++) { - const hl = reply['headlines']['content'][i]; + this.initHeadlinesMenu(); - if (!this.headlines[parseInt(hl.id)]) { - $("headlines-frame").appendChild(this.render(reply['headlines'], hl)); + if (Feeds.infscroll_disabled) + hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnread()'>" + + __("Click to open next unread feed.") + "</a>"; - this.headlines[parseInt(hl.id)] = hl; - ++headlines_appended; - } - } - } - - Feeds.infscroll_disabled = headlines_appended == 0; + if (Feeds._search_query) { + $("feed_title").innerHTML += "<span id='cancel_search'>" + + " (<a href='#' onclick='Feeds.cancelSearch()'>" + __("Cancel search") + "</a>)" + + "</span>"; + } - console.log('appended', headlines_appended, 'headlines, infscroll_disabled=', Feeds.infscroll_disabled); + Headlines.updateCurrentUnread(); - if (!hsp) { - hsp = document.createElement("div"); - hsp.id = "headlines-spacer"; - } + } else if (headlines_count > 0 && feed_id == Feeds.getActive() && is_cat == Feeds.activeIsCat()) { + const c = dijit.byId("headlines-frame"); - c.domNode.appendChild(hsp); + let hsp = $("headlines-spacer"); - this.initHeadlinesMenu(); + if (hsp) + c.domNode.removeChild(hsp); - if (Feeds.infscroll_disabled) { - hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnread()'>" + - __("Click to open next unread feed.") + "</a>"; - } + let headlines_appended = 0; + if (typeof reply['headlines']['content'] == 'string') { + $("headlines-frame").innerHTML = reply['headlines']['content']; } else { - Feeds.infscroll_disabled = true; - const first_id_changed = reply['headlines']['first_id_changed']; + for (let i = 0; i < reply['headlines']['content'].length; i++) { + const hl = reply['headlines']['content'][i]; - console.log("no headlines received, infscroll_disabled=", Feeds.infscroll_disabled, 'first_id_changed=', first_id_changed); - - let hsp = $("headlines-spacer"); + if (!this.headlines[parseInt(hl.id)]) { + $("headlines-frame").appendChild(this.render(reply['headlines'], hl)); - if (hsp) { - if (first_id_changed) { - hsp.innerHTML = "<a href='#' onclick='Feeds.reloadCurrent()'>" + - __("New articles found, reload feed to continue.") + "</a>"; - } else { - hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnread()'>" + - __("Click to open next unread feed.") + "</a>"; + this.headlines[parseInt(hl.id)] = hl; + ++headlines_appended; } } } - } else { - console.error("Invalid object received: " + transport.responseText); - dijit.byId("headlines-frame").attr('content', "<div class='whiteBox'>" + - __('Could not update headlines (invalid object received - see error console for details)') + - "</div>"); - } - - Feeds.infscroll_in_progress = 0; + Feeds.infscroll_disabled = headlines_appended == 0; - // this is used to auto-catchup articles if needed after infscroll request has finished, - // unpack visible articles, fill buffer more, etc - this.scrollHandler(); + console.log('appended', headlines_appended, 'headlines, infscroll_disabled=', Feeds.infscroll_disabled); - Notify.close(); - }, - reverse: function () { - const toolbar = document.forms["toolbar-main"]; - const order_by = dijit.getEnclosingWidget(toolbar.order_by); - - let value = order_by.attr('value'); - - if (value != "date_reverse") - value = "date_reverse"; - else - value = "default"; + if (!hsp) { + hsp = document.createElement("div"); + hsp.id = "headlines-spacer"; + } - order_by.attr('value', value); + c.domNode.appendChild(hsp); - Feeds.reloadCurrent(); - }, - selectionToggleUnread: function (params) { - params = params || {}; + this.initHeadlinesMenu(); - const cmode = params.cmode != undefined ? params.cmode : 2; - const no_error = params.no_error || false; - const ids = params.ids || Headlines.getSelected(); + if (Feeds.infscroll_disabled) { + hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnread()'>" + + __("Click to open next unread feed.") + "</a>"; + } - if (ids.length == 0) { - if (!no_error) - alert(__("No articles selected.")); + } else { + Feeds.infscroll_disabled = true; + const first_id_changed = reply['headlines']['first_id_changed']; - return; - } + console.log("no headlines received, infscroll_disabled=", Feeds.infscroll_disabled, 'first_id_changed=', first_id_changed); - ids.each((id) => { - const row = $("RROW-" + id); + const hsp = $("headlines-spacer"); - if (row) { - switch (cmode) { - case 0: - row.removeClassName("Unread"); - break; - case 1: - row.addClassName("Unread"); - break; - case 2: - row.toggleClassName("Unread"); + if (hsp) { + if (first_id_changed) { + hsp.innerHTML = "<a href='#' onclick='Feeds.reloadCurrent()'>" + + __("New articles found, reload feed to continue.") + "</a>"; + } else { + hsp.innerHTML = "<a href='#' onclick='Feeds.openNextUnread()'>" + + __("Click to open next unread feed.") + "</a>"; } } - }); - }, - selectionToggleMarked: function (ids) { - ids = ids || Headlines.getSelected(); - - if (ids.length == 0) { - alert(__("No articles selected.")); - return; } - ids.each((id) => { - this.toggleMark(id); + $$(".cdm .header-sticky-guard").each((e) => { + this.sticky_header_observer.observe(e) }); - }, - selectionTogglePublished: function (ids) { - ids = ids || Headlines.getSelected(); - - if (ids.length == 0) { - alert(__("No articles selected.")); - return; - } - - ids.each((id) => { - this.togglePub(id); - }); - }, - toggleMark: function (id) { - const row = $("RROW-" + id); - - if (row) - row.toggleClassName("marked"); - - }, - togglePub: function (id) { - const row = $("RROW-" + id); - - if (row) - row.toggleClassName("published"); - }, - move: function (mode, params) { - params = params || {}; - - const noscroll = params.noscroll || false; - const noexpand = params.noexpand || false; - const event = params.event; - - const rows = Headlines.getLoaded(); - - let prev_id = false; - let next_id = false; - - const active_row = $("RROW-" + Article.getActive()); - if (!active_row) { - Article.setActive(0); - } - - if (!Article.getActive() || (active_row && !Headlines.isChildVisible(active_row, $("headlines-frame")))) { - next_id = Headlines.firstVisible(); - prev_id = next_id; - } else { - for (let i = 0; i < rows.length; i++) { - if (rows[i] == Article.getActive()) { - - // Account for adjacent identical article ids. - if (i > 0) prev_id = rows[i - 1]; + if (App.getInitParam("cdm_expanded")) + $$("#headlines-frame > div[id*=RROW].cdm").each((e) => { + this.unpack_observer.observe(e) + }); - for (let j = i + 1; j < rows.length; j++) { - if (rows[j] != Article.getActive()) { - next_id = rows[j]; - break; - } - } - break; - } - } - } + } else { + console.error("Invalid object received: " + transport.responseText); + dijit.byId("headlines-frame").attr('content', "<div class='whiteBox'>" + + __('Could not update headlines (invalid object received - see error console for details)') + + "</div>"); + } - console.log("cur: " + Article.getActive() + " next: " + next_id); + Feeds.infscroll_in_progress = 0; - if (mode === "next") { - if (next_id || Article.getActive()) { - if (App.isCombinedMode()) { + // this is used to auto-catchup articles if needed after infscroll request has finished, + // unpack visible articles, fill buffer more, etc + this.scrollHandler(); - //const row = $("RROW-" + Article.getActive()); - const ctr = $("headlines-frame"); + Notify.close(); + }, + reverse: function () { + const toolbar = document.forms["toolbar-main"]; + const order_by = dijit.getEnclosingWidget(toolbar.order_by); - if (!noscroll) { - Article.scroll(ctr.offsetHeight / 2, event); - } else if (next_id) { - Article.setActive(next_id); - Article.cdmScrollToId(next_id, true, event); - } + let value = order_by.attr('value'); - } else if (next_id) { - Headlines.correctHeadlinesOffset(next_id); - Article.view(next_id, noexpand); - } - } - } + if (value != "date_reverse") + value = "date_reverse"; + else + value = "default"; - if (mode === "prev") { - if (prev_id || Article.getActive()) { - if (App.isCombinedMode()) { + order_by.attr('value', value); - const row = $("RROW-" + Article.getActive()); - //const prev_row = $("RROW-" + prev_id); - const ctr = $("headlines-frame"); + Feeds.reloadCurrent(); + }, + selectionToggleUnread: function (params) { + params = params || {}; - if (!noscroll) { - Article.scroll(-ctr.offsetHeight / 2, event); - } else { - if (row && Math.round(row.offsetTop) < Math.round(ctr.scrollTop)) { - Article.cdmScrollToId(Article.getActive(), noscroll, event); - } else if (prev_id) { - Article.setActive(prev_id); - Article.cdmScrollToId(prev_id, noscroll, event); - } - } + const cmode = params.cmode != undefined ? params.cmode : 2; + const no_error = params.no_error || false; + const ids = params.ids || Headlines.getSelected(); - } else if (prev_id) { - Headlines.correctHeadlinesOffset(prev_id); - Article.view(prev_id, noexpand); - } - } - } - }, - updateSelectedPrompt: function () { - const count = Headlines.getSelected().length; - const elem = $("selected_prompt"); + if (ids.length == 0) { + if (!no_error) + alert(__("No articles selected.")); - if (elem) { - elem.innerHTML = ngettext("%d article selected", - "%d articles selected", count).replace("%d", count); + return; + } - count > 0 ? Element.show(elem) : Element.hide(elem); - } - }, - toggleUnread: function (id, cmode) { + ids.each((id) => { const row = $("RROW-" + id); if (row) { - if (typeof cmode == "undefined") cmode = 2; - switch (cmode) { case 0: row.removeClassName("Unread"); @@ -948,554 +764,668 @@ define(["dojo/_base/declare"], function (declare) { break; case 2: row.toggleClassName("Unread"); - break; } } - }, - selectionRemoveLabel: function (id, ids) { - if (!ids) ids = Headlines.getSelected(); + }); + }, + selectionToggleMarked: function (ids) { + ids = ids || Headlines.getSelected(); + + if (ids.length == 0) { + alert(__("No articles selected.")); + return; + } - if (ids.length == 0) { - alert(__("No articles selected.")); - return; - } + ids.each((id) => { + this.toggleMark(id); + }); + }, + selectionTogglePublished: function (ids) { + ids = ids || Headlines.getSelected(); - const query = { - op: "article", method: "removeFromLabel", - ids: ids.toString(), lid: id - }; + if (ids.length == 0) { + alert(__("No articles selected.")); + return; + } - xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); - this.onLabelsUpdated(transport); - }); - }, - selectionAssignLabel: function (id, ids) { - if (!ids) ids = Headlines.getSelected(); + ids.each((id) => { + this.togglePub(id); + }); + }, + toggleMark: function (id) { + const row = $("RROW-" + id); + + if (row) + row.toggleClassName("marked"); + + }, + togglePub: function (id) { + const row = $("RROW-" + id); + + if (row) + row.toggleClassName("published"); + }, + move: function (mode, params) { + params = params || {}; + + const no_expand = params.no_expand || false; + const force_previous = params.force_previous || this.default_force_previous; + const force_to_top = params.force_to_top || this.default_force_to_top; + + let prev_id = false; + let next_id = false; + let current_id = Article.getActive(); + + if (!Headlines.isChildVisible($("RROW-" + current_id))) { + console.log('active article is obscured, resetting to first visible...'); + current_id = Headlines.firstVisible(); + prev_id = current_id; + next_id = current_id; + } else { + const rows = Headlines.getLoaded(); - if (ids.length == 0) { - alert(__("No articles selected.")); - return; - } + for (let i = 0; i < rows.length; i++) { + if (rows[i] == current_id) { - const query = { - op: "article", method: "assignToLabel", - ids: ids.toString(), lid: id - }; + // Account for adjacent identical article ids. + if (i > 0) prev_id = rows[i - 1]; - xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); - this.onLabelsUpdated(transport); - }); - }, - deleteSelection: function () { - const rows = Headlines.getSelected(); + for (let j = i + 1; j < rows.length; j++) { + if (rows[j] != current_id) { + next_id = rows[j]; + break; + } + } + break; + } + } + } - if (rows.length == 0) { - alert(__("No articles selected.")); - return; + console.log("cur: " + current_id + " next: " + next_id + " prev:" + prev_id); + + if (mode === "next") { + if (next_id) { + if (App.isCombinedMode()) { + window.requestAnimationFrame(() => { + Article.setActive(next_id); + Article.cdmMoveToId(next_id, {force_to_top: force_to_top}); + }); + } else { + Article.view(next_id, no_expand); + } } + } else if (mode === "prev") { + if (prev_id || current_id) { + if (App.isCombinedMode()) { + window.requestAnimationFrame(() => { + const row = $("RROW-" + current_id); + const ctr = $("headlines-frame"); + const delta_px = Math.round(row.offsetTop) - Math.round(ctr.scrollTop); - const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat()); - let str; + console.log('moving back, delta_px', delta_px); - if (Feeds.getActive() != 0) { - str = ngettext("Delete %d selected article in %s?", "Delete %d selected articles in %s?", rows.length); - } else { - str = ngettext("Delete %d selected article?", "Delete %d selected articles?", rows.length); + if (!force_previous && row && delta_px < -8) { + Article.setActive(current_id); + Article.cdmMoveToId(current_id, {force_to_top: force_to_top}); + } else if (prev_id) { + Article.setActive(prev_id); + Article.cdmMoveToId(prev_id, {force_to_top: force_to_top}); + } + }); + } else if (prev_id) { + Article.view(prev_id, no_expand); + } } + } + }, + updateSelectedPrompt: function () { + const count = Headlines.getSelected().length; + const elem = $("selected_prompt"); - str = str.replace("%d", rows.length); - str = str.replace("%s", fn); + if (elem) { + elem.innerHTML = ngettext("%d article selected", + "%d articles selected", count).replace("%d", count); - if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) { - return; + count > 0 ? Element.show(elem) : Element.hide(elem); + } + }, + toggleUnread: function (id, cmode) { + const row = $("RROW-" + id); + + if (row) { + if (typeof cmode == "undefined") cmode = 2; + + switch (cmode) { + case 0: + row.removeClassName("Unread"); + break; + case 1: + row.addClassName("Unread"); + break; + case 2: + row.toggleClassName("Unread"); + break; } + } + }, + selectionRemoveLabel: function (id, ids) { + if (!ids) ids = Headlines.getSelected(); - const query = {op: "rpc", method: "delete", ids: rows.toString()}; + if (ids.length == 0) { + alert(__("No articles selected.")); + return; + } - xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); - Feeds.reloadCurrent(); - }); - }, - getSelected: function () { - const rv = []; + const query = { + op: "article", method: "removeFromLabel", + ids: ids.toString(), lid: id + }; + + xhrPost("backend.php", query, (transport) => { + App.handleRpcJson(transport); + this.onLabelsUpdated(transport); + }); + }, + selectionAssignLabel: function (id, ids) { + if (!ids) ids = Headlines.getSelected(); + + if (ids.length == 0) { + alert(__("No articles selected.")); + return; + } - $$("#headlines-frame > div[id*=RROW][class*=Selected]").each( - function (child) { - rv.push(child.getAttribute("data-article-id")); - }); + const query = { + op: "article", method: "assignToLabel", + ids: ids.toString(), lid: id + }; + + xhrPost("backend.php", query, (transport) => { + App.handleRpcJson(transport); + this.onLabelsUpdated(transport); + }); + }, + deleteSelection: function () { + const rows = Headlines.getSelected(); + + if (rows.length == 0) { + alert(__("No articles selected.")); + return; + } - // consider active article a honorary member of selected articles - if (Article.getActive()) - rv.push(Article.getActive()); + const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat()); + let str; - return rv.uniq(); - }, - getLoaded: function () { - const rv = []; + if (Feeds.getActive() != 0) { + str = ngettext("Delete %d selected article in %s?", "Delete %d selected articles in %s?", rows.length); + } else { + str = ngettext("Delete %d selected article?", "Delete %d selected articles?", rows.length); + } - const children = $$("#headlines-frame > div[id*=RROW-]"); + str = str.replace("%d", rows.length); + str = str.replace("%s", fn); - children.each(function (child) { - if (Element.visible(child)) { - rv.push(child.getAttribute("data-article-id")); - } + if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) { + return; + } + + const query = {op: "rpc", method: "delete", ids: rows.toString()}; + + xhrPost("backend.php", query, (transport) => { + App.handleRpcJson(transport); + Feeds.reloadCurrent(); + }); + }, + getSelected: function () { + const rv = []; + + $$("#headlines-frame > div[id*=RROW][class*=Selected]").each( + function (child) { + rv.push(child.getAttribute("data-article-id")); }); - return rv; - }, - onRowChecked: function (elem) { - const row = elem.domNode.up("div[id*=RROW]"); + // consider active article a honorary member of selected articles + if (Article.getActive()) + rv.push(Article.getActive()); - // do not allow unchecking active article checkbox - if (row.hasClassName("active")) { - elem.attr("checked", 1); - return; - } + return rv.uniq(); + }, + getLoaded: function () { + const rv = []; - if (elem.attr("checked")) { - row.addClassName("Selected"); - } else { - row.removeClassName("Selected"); - } - }, - getRange: function (start, stop) { - if (start == stop) - return [start]; + const children = $$("#headlines-frame > div[id*=RROW-]"); - const rows = $$("#headlines-frame > div[id*=RROW]"); - const results = []; - let collecting = false; + children.each(function (child) { + if (Element.visible(child)) { + rv.push(child.getAttribute("data-article-id")); + } + }); - for (let i = 0; i < rows.length; i++) { - const row = rows[i]; - const id = row.getAttribute('data-article-id'); + return rv; + }, + onRowChecked: function (elem) { + const row = elem.domNode.up("div[id*=RROW]"); - if (id == start || id == stop) { - if (!collecting) { - collecting = true; - } else { - results.push(id); - break; - } - } + // do not allow unchecking active article checkbox + if (row.hasClassName("active")) { + elem.attr("checked", 1); + return; + } - if (collecting) + if (elem.attr("checked")) { + row.addClassName("Selected"); + } else { + row.removeClassName("Selected"); + } + }, + getRange: function (start, stop) { + if (start == stop) + return [start]; + + const rows = $$("#headlines-frame > div[id*=RROW]"); + const results = []; + let collecting = false; + + for (let i = 0; i < rows.length; i++) { + const row = rows[i]; + const id = row.getAttribute('data-article-id'); + + if (id == start || id == stop) { + if (!collecting) { + collecting = true; + } else { results.push(id); + break; + } } - return results; - }, - select: function (mode, articleId) { - // mode = all,none,unread,invert,marked,published - let query = "#headlines-frame > div[id*=RROW]"; + if (collecting) + results.push(id); + } - if (articleId) query += "[data-article-id=" + articleId + "]"; + return results; + }, + select: function (mode, articleId) { + // mode = all,none,unread,invert,marked,published + let query = "#headlines-frame > div[id*=RROW]"; + + if (articleId) query += "[data-article-id=" + articleId + "]"; + + switch (mode) { + case "none": + case "all": + case "invert": + break; + case "marked": + query += "[class*=marked]"; + break; + case "published": + query += "[class*=published]"; + break; + case "unread": + query += "[class*=Unread]"; + break; + default: + console.warn("select: unknown mode", mode); + } + + const rows = $$(query); + + for (let i = 0; i < rows.length; i++) { + const row = rows[i]; switch (mode) { case "none": - case "all": - case "invert": + row.removeClassName("Selected"); break; - case "marked": - query += "[class*=marked]"; - break; - case "published": - query += "[class*=published]"; - break; - case "unread": - query += "[class*=Unread]"; + case "invert": + row.toggleClassName("Selected"); break; default: - console.warn("select: unknown mode", mode); - } - - const rows = $$(query); - - for (let i = 0; i < rows.length; i++) { - const row = rows[i]; - - switch (mode) { - case "none": - row.removeClassName("Selected"); - break; - case "invert": - row.toggleClassName("Selected"); - break; - default: - row.addClassName("Selected"); - } - } - }, - archiveSelection: function () { - const rows = Headlines.getSelected(); - - if (rows.length == 0) { - alert(__("No articles selected.")); - return; + row.addClassName("Selected"); } + } + }, + archiveSelection: function () { + const rows = Headlines.getSelected(); - const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat()); - let str; - let op; + if (rows.length == 0) { + alert(__("No articles selected.")); + return; + } - if (Feeds.getActive() != 0) { - str = ngettext("Archive %d selected article in %s?", "Archive %d selected articles in %s?", rows.length); - op = "archive"; - } else { - str = ngettext("Move %d archived article back?", "Move %d archived articles back?", rows.length); - str += " " + __("Please note that unstarred articles might get purged on next feed update."); + const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat()); + let str; + let op; - op = "unarchive"; - } + if (Feeds.getActive() != 0) { + str = ngettext("Archive %d selected article in %s?", "Archive %d selected articles in %s?", rows.length); + op = "archive"; + } else { + str = ngettext("Move %d archived article back?", "Move %d archived articles back?", rows.length); + str += " " + __("Please note that unstarred articles might get purged on next feed update."); - str = str.replace("%d", rows.length); - str = str.replace("%s", fn); + op = "unarchive"; + } - if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) { - return; - } + str = str.replace("%d", rows.length); + str = str.replace("%s", fn); - const query = {op: "rpc", method: op, ids: rows.toString()}; + if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) { + return; + } - xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); - Feeds.reloadCurrent(); - }); - }, - catchupSelection: function () { - const rows = Headlines.getSelected(); + const query = {op: "rpc", method: op, ids: rows.toString()}; - if (rows.length == 0) { - alert(__("No articles selected.")); - return; - } + xhrPost("backend.php", query, (transport) => { + App.handleRpcJson(transport); + Feeds.reloadCurrent(); + }); + }, + catchupSelection: function () { + const rows = Headlines.getSelected(); + + if (rows.length == 0) { + alert(__("No articles selected.")); + return; + } - const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat()); + const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat()); - let str = ngettext("Mark %d selected article in %s as read?", "Mark %d selected articles in %s as read?", rows.length); + let str = ngettext("Mark %d selected article in %s as read?", "Mark %d selected articles in %s as read?", rows.length); - str = str.replace("%d", rows.length); - str = str.replace("%s", fn); + str = str.replace("%d", rows.length); + str = str.replace("%s", fn); - if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) { - return; - } + if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) { + return; + } - Headlines.selectionToggleUnread({ids: rows, cmode: 0}); - }, - catchupRelativeTo: function (below, id) { + Headlines.selectionToggleUnread({ids: rows, cmode: 0}); + }, + catchupRelativeTo: function (below, id) { - if (!id) id = Article.getActive(); + if (!id) id = Article.getActive(); - if (!id) { - alert(__("No article is selected.")); - return; - } + if (!id) { + alert(__("No article is selected.")); + return; + } - const visible_ids = this.getLoaded(); + const visible_ids = this.getLoaded(); - const ids_to_mark = []; + const ids_to_mark = []; - if (!below) { - for (let i = 0; i < visible_ids.length; i++) { - if (visible_ids[i] != id) { - const e = $("RROW-" + visible_ids[i]); + if (!below) { + for (let i = 0; i < visible_ids.length; i++) { + if (visible_ids[i] != id) { + const e = $("RROW-" + visible_ids[i]); - if (e && e.hasClassName("Unread")) { - ids_to_mark.push(visible_ids[i]); - } - } else { - break; + if (e && e.hasClassName("Unread")) { + ids_to_mark.push(visible_ids[i]); } + } else { + break; } - } else { - for (let i = visible_ids.length - 1; i >= 0; i--) { - if (visible_ids[i] != id) { - const e = $("RROW-" + visible_ids[i]); + } + } else { + for (let i = visible_ids.length - 1; i >= 0; i--) { + if (visible_ids[i] != id) { + const e = $("RROW-" + visible_ids[i]); - if (e && e.hasClassName("Unread")) { - ids_to_mark.push(visible_ids[i]); - } - } else { - break; + if (e && e.hasClassName("Unread")) { + ids_to_mark.push(visible_ids[i]); } + } else { + break; } } + } - if (ids_to_mark.length == 0) { - alert(__("No articles found to mark")); - } else { - const msg = ngettext("Mark %d article as read?", "Mark %d articles as read?", ids_to_mark.length).replace("%d", ids_to_mark.length); + if (ids_to_mark.length == 0) { + alert(__("No articles found to mark")); + } else { + const msg = ngettext("Mark %d article as read?", "Mark %d articles as read?", ids_to_mark.length).replace("%d", ids_to_mark.length); - if (App.getInitParam("confirm_feed_catchup") != 1 || confirm(msg)) { + if (App.getInitParam("confirm_feed_catchup") != 1 || confirm(msg)) { - for (var i = 0; i < ids_to_mark.length; i++) { - var e = $("RROW-" + ids_to_mark[i]); - e.removeClassName("Unread"); - } + for (let i = 0; i < ids_to_mark.length; i++) { + const e = $("RROW-" + ids_to_mark[i]); + e.removeClassName("Unread"); } } - }, - onLabelsUpdated: function (transport) { - const data = JSON.parse(transport.responseText); - - if (data) { - data['info-for-headlines'].each(function (elem) { - $$(".HLLCTR-" + elem.id).each(function (ctr) { - ctr.innerHTML = elem.labels; - }); + } + }, + onLabelsUpdated: function (transport) { + const data = JSON.parse(transport.responseText); + + if (data) { + data['info-for-headlines'].each(function (elem) { + $$(".HLLCTR-" + elem.id).each(function (ctr) { + ctr.innerHTML = elem.labels; }); + }); + } + }, + onActionChanged: function (elem) { + // eslint-disable-next-line no-eval + eval(elem.value); + elem.attr('value', 'false'); + }, + scrollToArticleId: function (id) { + const container = $("headlines-frame"); + const row = $("RROW-" + id); + + if (!container || !row) return; + + const viewport = container.offsetHeight; + + const rel_offset_top = row.offsetTop - container.scrollTop; + const rel_offset_bottom = row.offsetTop + row.offsetHeight - container.scrollTop; + + //console.log("Rtop: " + rel_offset_top + " Rbtm: " + rel_offset_bottom); + //console.log("Vport: " + viewport); + + if (rel_offset_top <= 0 || rel_offset_top > viewport) { + container.scrollTop = row.offsetTop; + } else if (rel_offset_bottom > viewport) { + container.scrollTop = row.offsetTop + row.offsetHeight - viewport; + } + }, + headlinesMenuCommon: function (menu) { + + menu.addChild(new dijit.MenuItem({ + label: __("Open original article"), + onClick: function (/* event */) { + Article.openInNewWindow(this.getParent().currentTarget.getAttribute("data-article-id")); } - }, - onActionChanged: function (elem) { - eval(elem.value); - elem.attr('value', 'false'); - }, - correctHeadlinesOffset: function (id) { - const container = $("headlines-frame"); - const row = $("RROW-" + id); + })); - if (!container || !row) return; + menu.addChild(new dijit.MenuItem({ + label: __("Display article URL"), + onClick: function (/* event */) { + Article.displayUrl(this.getParent().currentTarget.getAttribute("data-article-id")); + } + })); - const viewport = container.offsetHeight; + menu.addChild(new dijit.MenuSeparator()); - const rel_offset_top = row.offsetTop - container.scrollTop; - const rel_offset_bottom = row.offsetTop + row.offsetHeight - container.scrollTop; + menu.addChild(new dijit.MenuItem({ + label: __("Toggle unread"), + onClick: function () { - //console.log("Rtop: " + rel_offset_top + " Rbtm: " + rel_offset_bottom); - //console.log("Vport: " + viewport); + let ids = Headlines.getSelected(); + // cast to string + const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + ""; + ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id]; - if (rel_offset_top <= 0 || rel_offset_top > viewport) { - container.scrollTop = row.offsetTop; - } else if (rel_offset_bottom > viewport) { - container.scrollTop = row.offsetTop + row.offsetHeight - viewport; + Headlines.selectionToggleUnread({ids: ids, no_error: 1}); } - }, - initFloatingMenu: function () { - if (!dijit.byId("floatingMenu")) { + })); - const menu = new dijit.Menu({ - id: "floatingMenu", - selector: ".hlMenuAttach", - targetNodeIds: ["floatingTitle"] - }); - - this.headlinesMenuCommon(menu); + menu.addChild(new dijit.MenuItem({ + label: __("Toggle starred"), + onClick: function () { + let ids = Headlines.getSelected(); + // cast to string + const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + ""; + ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id]; - menu.startup(); + Headlines.selectionToggleMarked(ids); } - }, - headlinesMenuCommon: function (menu) { + })); - menu.addChild(new dijit.MenuItem({ - label: __("Open original article"), - onClick: function (event) { - Article.openInNewWindow(this.getParent().currentTarget.getAttribute("data-article-id")); - } - })); - - menu.addChild(new dijit.MenuItem({ - label: __("Display article URL"), - onClick: function (event) { - Article.displayUrl(this.getParent().currentTarget.getAttribute("data-article-id")); - } - })); - - menu.addChild(new dijit.MenuSeparator()); + menu.addChild(new dijit.MenuItem({ + label: __("Toggle published"), + onClick: function () { + let ids = Headlines.getSelected(); + // cast to string + const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + ""; + ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id]; - menu.addChild(new dijit.MenuItem({ - label: __("Toggle unread"), - onClick: function () { + Headlines.selectionTogglePublished(ids); + } + })); - let ids = Headlines.getSelected(); - // cast to string - const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + ""; - ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id]; + menu.addChild(new dijit.MenuSeparator()); - Headlines.selectionToggleUnread({ids: ids, no_error: 1}); - } - })); + menu.addChild(new dijit.MenuItem({ + label: __("Mark above as read"), + onClick: function () { + Headlines.catchupRelativeTo(0, this.getParent().currentTarget.getAttribute("data-article-id")); + } + })); - menu.addChild(new dijit.MenuItem({ - label: __("Toggle starred"), - onClick: function () { - let ids = Headlines.getSelected(); - // cast to string - const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + ""; - ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id]; + menu.addChild(new dijit.MenuItem({ + label: __("Mark below as read"), + onClick: function () { + Headlines.catchupRelativeTo(1, this.getParent().currentTarget.getAttribute("data-article-id")); + } + })); - Headlines.selectionToggleMarked(ids); - } - })); - menu.addChild(new dijit.MenuItem({ - label: __("Toggle published"), - onClick: function () { - let ids = Headlines.getSelected(); - // cast to string - const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + ""; - ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id]; + const labels = App.getInitParam("labels"); - Headlines.selectionTogglePublished(ids); - } - })); + if (labels && labels.length) { menu.addChild(new dijit.MenuSeparator()); - menu.addChild(new dijit.MenuItem({ - label: __("Mark above as read"), - onClick: function () { - Headlines.catchupRelativeTo(0, this.getParent().currentTarget.getAttribute("data-article-id")); - } - })); + const labelAddMenu = new dijit.Menu({ownerMenu: menu}); + const labelDelMenu = new dijit.Menu({ownerMenu: menu}); - menu.addChild(new dijit.MenuItem({ - label: __("Mark below as read"), - onClick: function () { - Headlines.catchupRelativeTo(1, this.getParent().currentTarget.getAttribute("data-article-id")); - } - })); + labels.each(function (label) { + const bare_id = label.id; + const name = label.caption; + labelAddMenu.addChild(new dijit.MenuItem({ + label: name, + labelId: bare_id, + onClick: function () { - const labels = App.getInitParam("labels"); - - if (labels && labels.length) { - - menu.addChild(new dijit.MenuSeparator()); - - const labelAddMenu = new dijit.Menu({ownerMenu: menu}); - const labelDelMenu = new dijit.Menu({ownerMenu: menu}); - - labels.each(function (label) { - const bare_id = label.id; - const name = label.caption; - - labelAddMenu.addChild(new dijit.MenuItem({ - label: name, - labelId: bare_id, - onClick: function () { - - let ids = Headlines.getSelected(); - // cast to string - const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + ""; - - ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id]; - - Headlines.selectionAssignLabel(this.labelId, ids); - } - })); + let ids = Headlines.getSelected(); + // cast to string + const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + ""; - labelDelMenu.addChild(new dijit.MenuItem({ - label: name, - labelId: bare_id, - onClick: function () { - let ids = Headlines.getSelected(); - // cast to string - const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + ""; + ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id]; - ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id]; + Headlines.selectionAssignLabel(this.labelId, ids); + } + })); - Headlines.selectionRemoveLabel(this.labelId, ids); - } - })); + labelDelMenu.addChild(new dijit.MenuItem({ + label: name, + labelId: bare_id, + onClick: function () { + let ids = Headlines.getSelected(); + // cast to string + const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + ""; - }); + ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id]; - menu.addChild(new dijit.PopupMenuItem({ - label: __("Assign label"), - popup: labelAddMenu - })); - - menu.addChild(new dijit.PopupMenuItem({ - label: __("Remove label"), - popup: labelDelMenu + Headlines.selectionRemoveLabel(this.labelId, ids); + } })); - } - }, - scrollByPages: function (offset, event) { - const elem = $("headlines-frame"); - - if (event && event.repeat) { - elem.addClassName("forbid-smooth-scroll"); - window.clearTimeout(this._scroll_reset_timeout); + }); - this._scroll_reset_timeout = window.setTimeout(() => { - if (elem) elem.removeClassName("forbid-smooth-scroll"); - }, 250) - } else { - elem.removeClassName("forbid-smooth-scroll"); - } + menu.addChild(new dijit.PopupMenuItem({ + label: __("Assign label"), + popup: labelAddMenu + })); - elem.scrollTop += elem.offsetHeight * offset * 0.99; - }, - initHeadlinesMenu: function () { - if (!dijit.byId("headlinesMenu")) { + menu.addChild(new dijit.PopupMenuItem({ + label: __("Remove label"), + popup: labelDelMenu + })); - const menu = new dijit.Menu({ - id: "headlinesMenu", - targetNodeIds: ["headlines-frame"], - selector: ".hlMenuAttach" - }); + } + }, + scrollByPages: function (page_offset) { + App.Scrollable.scrollByPages($("headlines-frame"), page_offset); + }, + scroll: function (offset) { + App.Scrollable.scroll($("headlines-frame"), offset); + }, + initHeadlinesMenu: function () { + if (!dijit.byId("headlinesMenu")) { + + const menu = new dijit.Menu({ + id: "headlinesMenu", + targetNodeIds: ["headlines-frame"], + selector: ".hlMenuAttach" + }); - this.headlinesMenuCommon(menu); + this.headlinesMenuCommon(menu); - menu.startup(); - } + menu.startup(); + } - /* vgroup feed title menu */ + /* vgroup feed title menu */ - if (!dijit.byId("headlinesFeedTitleMenu")) { + if (!dijit.byId("headlinesFeedTitleMenu")) { - const menu = new dijit.Menu({ - id: "headlinesFeedTitleMenu", - targetNodeIds: ["headlines-frame"], - selector: "div.cdmFeedTitle" - }); + const menu = new dijit.Menu({ + id: "headlinesFeedTitleMenu", + targetNodeIds: ["headlines-frame"], + selector: "div.cdmFeedTitle" + }); - menu.addChild(new dijit.MenuItem({ - label: __("Select articles in group"), - onClick: function (event) { - Headlines.select("all", - "#headlines-frame > div[id*=RROW]" + - "[data-orig-feed-id='" + this.getParent().currentTarget.getAttribute("data-feed-id") + "']"); + menu.addChild(new dijit.MenuItem({ + label: __("Select articles in group"), + onClick: function (/* event */) { + Headlines.select("all", + "#headlines-frame > div[id*=RROW]" + + "[data-orig-feed-id='" + this.getParent().currentTarget.getAttribute("data-feed-id") + "']"); - } - })); + } + })); - menu.addChild(new dijit.MenuItem({ - label: __("Mark group as read"), - onClick: function () { - Headlines.select("none"); - Headlines.select("all", - "#headlines-frame > div[id*=RROW]" + - "[data-orig-feed-id='" + this.getParent().currentTarget.getAttribute("data-feed-id") + "']"); + menu.addChild(new dijit.MenuItem({ + label: __("Mark group as read"), + onClick: function () { + Headlines.select("none"); + Headlines.select("all", + "#headlines-frame > div[id*=RROW]" + + "[data-orig-feed-id='" + this.getParent().currentTarget.getAttribute("data-feed-id") + "']"); - Headlines.catchupSelection(); - } - })); + Headlines.catchupSelection(); + } + })); - menu.addChild(new dijit.MenuItem({ - label: __("Mark feed as read"), - onClick: function () { - Feeds.catchupFeedInGroup(this.getParent().currentTarget.getAttribute("data-feed-id")); - } - })); + menu.addChild(new dijit.MenuItem({ + label: __("Mark feed as read"), + onClick: function () { + Feeds.catchupFeedInGroup(this.getParent().currentTarget.getAttribute("data-feed-id")); + } + })); - menu.addChild(new dijit.MenuItem({ - label: __("Edit feed"), - onClick: function () { - CommonDialogs.editFeed(this.getParent().currentTarget.getAttribute("data-feed-id")); - } - })); + menu.addChild(new dijit.MenuItem({ + label: __("Edit feed"), + onClick: function () { + CommonDialogs.editFeed(this.getParent().currentTarget.getAttribute("data-feed-id")); + } + })); - menu.startup(); - } + menu.startup(); } } - - return Headlines; -}); +} diff --git a/js/PluginHost.js b/js/PluginHost.js index 71596ad31..caee79d58 100644 --- a/js/PluginHost.js +++ b/js/PluginHost.js @@ -1,6 +1,8 @@ // based on http://www.velvetcache.org/2010/08/19/a-simple-javascript-hooks-system -PluginHost = { + +/* exported PluginHost */ +const PluginHost = { HOOK_ARTICLE_RENDERED: 1, HOOK_ARTICLE_RENDERED_CDM: 2, HOOK_ARTICLE_SET_ACTIVE: 3, @@ -31,7 +33,7 @@ PluginHost = { } }, unregister: function (name, callback) { - for (var i = 0; i < this.hooks[name].length; i++) + for (let i = 0; i < this.hooks[name].length; i++) if (this.hooks[name][i] == callback) this.hooks[name].splice(i, 1); } diff --git a/js/PrefFeedStore.js b/js/PrefFeedStore.js index 152ebba44..ee983af54 100644 --- a/js/PrefFeedStore.js +++ b/js/PrefFeedStore.js @@ -1,9 +1,10 @@ +/* global define, dojo */ + define(["dojo/_base/declare", "dojo/data/ItemFileWriteStore"], function (declare) { return declare("fox.PrefFeedStore", dojo.data.ItemFileWriteStore, { - _saveEverything: function(saveCompleteCallback, saveFailedCallback, - newFileContentString) { + _saveEverything: function(saveCompleteCallback, saveFailedCallback, newFileContentString) { dojo.xhrPost({ url: "backend.php", diff --git a/js/PrefFeedTree.js b/js/PrefFeedTree.js index 3a5e33b2b..4ea0cdac1 100644 --- a/js/PrefFeedTree.js +++ b/js/PrefFeedTree.js @@ -1,4 +1,5 @@ -/* global lib,dijit */ +/* global __, lib, dijit, define, dojo, CommonDialogs, Notify, Tables, xhrPost */ + define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) { return declare("fox.PrefFeedTree", lib.CheckBoxTree, { diff --git a/js/PrefFilterStore.js b/js/PrefFilterStore.js index cccec6479..a41d84129 100644 --- a/js/PrefFilterStore.js +++ b/js/PrefFilterStore.js @@ -1,9 +1,10 @@ +/* global define, dojo */ + define(["dojo/_base/declare", "dojo/data/ItemFileWriteStore"], function (declare) { return declare("fox.PrefFilterStore", dojo.data.ItemFileWriteStore, { - _saveEverything: function (saveCompleteCallback, saveFailedCallback, - newFileContentString) { + _saveEverything: function (saveCompleteCallback, saveFailedCallback, newFileContentString) { dojo.xhrPost({ url: "backend.php", diff --git a/js/PrefFilterTree.js b/js/PrefFilterTree.js index a7c7464fb..0e8e52658 100644 --- a/js/PrefFilterTree.js +++ b/js/PrefFilterTree.js @@ -1,4 +1,5 @@ -/* global dijit,lib */ +/* global __, $$, define, lib, dijit, dojo, xhrPost, Notify, Filters, Lists */ + define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) { return declare("fox.PrefFilterTree", lib.CheckBoxTree, { @@ -149,9 +150,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio style: "width: 600px", test: function () { - const query = "backend.php?" + dojo.formToQuery("filter_edit_form") + "&savemode=test"; - - Filters.editFilterTest(query); + Filters.editFilterTest(dojo.formToObject("filter_edit_form")); }, selectRules: function (select) { Lists.select("filterDlg_Matches", select); @@ -238,9 +237,6 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio return false; }, - - - }); }); diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js index 4b908204c..12710bc6a 100644 --- a/js/PrefHelpers.js +++ b/js/PrefHelpers.js @@ -1,274 +1,273 @@ -define(["dojo/_base/declare"], function (declare) { - Helpers = { - AppPasswords: { - getSelected: function() { - return Tables.getSelected("app-password-list"); - }, - updateContent: function(data) { - $("app_passwords_holder").innerHTML = data; - dojo.parser.parse("app_passwords_holder"); - }, - removeSelected: function() { - const rows = this.getSelected(); +'use strict'; - if (rows.length == 0) { - alert("No passwords selected."); - } else { - if (confirm(__("Remove selected app passwords?"))) { +/* global __, dijit, dojo, Tables, xhrPost, Notify, xhrJson */ - xhrPost("backend.php", {op: "pref-prefs", method: "deleteAppPassword", ids: rows.toString()}, (transport) => { - this.updateContent(transport.responseText); - Notify.close(); - }); +const Helpers = { + AppPasswords: { + getSelected: function() { + return Tables.getSelected("app-password-list"); + }, + updateContent: function(data) { + $("app_passwords_holder").innerHTML = data; + dojo.parser.parse("app_passwords_holder"); + }, + removeSelected: function() { + const rows = this.getSelected(); - Notify.progress("Loading, please wait..."); - } - } - }, - generate: function() { - const title = prompt("Password description:") + if (rows.length == 0) { + alert("No passwords selected."); + } else if (confirm(__("Remove selected app passwords?"))) { - if (title) { - xhrPost("backend.php", {op: "pref-prefs", method: "generateAppPassword", title: title}, (transport) => { - this.updateContent(transport.responseText); - Notify.close(); - }); + xhrPost("backend.php", {op: "pref-prefs", method: "deleteAppPassword", ids: rows.toString()}, (transport) => { + this.updateContent(transport.responseText); + Notify.close(); + }); - Notify.progress("Loading, please wait..."); - } - }, + Notify.progress("Loading, please wait..."); + } }, - clearFeedAccessKeys: function() { - if (confirm(__("This will invalidate all previously generated feed URLs. Continue?"))) { - Notify.progress("Clearing URLs..."); + generate: function() { + const title = prompt("Password description:") - xhrPost("backend.php", {op: "pref-feeds", method: "clearKeys"}, () => { - Notify.info("Generated URLs cleared."); + if (title) { + xhrPost("backend.php", {op: "pref-prefs", method: "generateAppPassword", title: title}, (transport) => { + this.updateContent(transport.responseText); + Notify.close(); }); - } - - return false; - }, - updateEventLog: function() { - xhrPost("backend.php", { op: "pref-system" }, (transport) => { - dijit.byId('systemConfigTab').attr('content', transport.responseText); - Notify.close(); - }); - }, - clearEventLog: function() { - if (confirm(__("Clear event log?"))) { Notify.progress("Loading, please wait..."); - - xhrPost("backend.php", {op: "pref-system", method: "clearLog"}, () => { - this.updateEventLog(); - }); } }, - editProfiles: function() { - - if (dijit.byId("profileEditDlg")) - dijit.byId("profileEditDlg").destroyRecursive(); + }, + clearFeedAccessKeys: function() { + if (confirm(__("This will invalidate all previously generated feed URLs. Continue?"))) { + Notify.progress("Clearing URLs..."); - const query = "backend.php?op=pref-prefs&method=editPrefProfiles"; + xhrPost("backend.php", {op: "pref-feeds", method: "clearKeys"}, () => { + Notify.info("Generated URLs cleared."); + }); + } - // noinspection JSUnusedGlobalSymbols - const dialog = new dijit.Dialog({ - id: "profileEditDlg", - title: __("Settings Profiles"), - style: "width: 600px", - getSelectedProfiles: function () { - return Tables.getSelected("pref-profiles-list"); - }, - removeSelected: function () { - const sel_rows = this.getSelectedProfiles(); - - if (sel_rows.length > 0) { - if (confirm(__("Remove selected profiles? Active and default profiles will not be removed."))) { - Notify.progress("Removing selected profiles...", true); - - const query = { - op: "rpc", method: "remprofiles", - ids: sel_rows.toString() - }; - - xhrPost("backend.php", query, () => { - Notify.close(); - Helpers.editProfiles(); - }); - } + return false; + }, + updateEventLog: function() { + xhrPost("backend.php", { op: "pref-system" }, (transport) => { + dijit.byId('systemConfigTab').attr('content', transport.responseText); + Notify.close(); + }); + }, + clearEventLog: function() { + if (confirm(__("Clear event log?"))) { + + Notify.progress("Loading, please wait..."); + + xhrPost("backend.php", {op: "pref-system", method: "clearLog"}, () => { + this.updateEventLog(); + }); + } + }, + editProfiles: function() { - } else { - alert(__("No profiles selected.")); - } - }, - activateProfile: function () { - const sel_rows = this.getSelectedProfiles(); + if (dijit.byId("profileEditDlg")) + dijit.byId("profileEditDlg").destroyRecursive(); - if (sel_rows.length == 1) { - if (confirm(__("Activate selected profile?"))) { - Notify.progress("Loading, please wait..."); + const query = "backend.php?op=pref-prefs&method=editPrefProfiles"; - xhrPost("backend.php", {op: "rpc", method: "setprofile", id: sel_rows.toString()}, () => { - window.location.reload(); - }); - } + // noinspection JSUnusedGlobalSymbols + const dialog = new dijit.Dialog({ + id: "profileEditDlg", + title: __("Settings Profiles"), + style: "width: 600px", + getSelectedProfiles: function () { + return Tables.getSelected("pref-profiles-list"); + }, + removeSelected: function () { + const sel_rows = this.getSelectedProfiles(); - } else { - alert(__("Please choose a profile to activate.")); - } - }, - addProfile: function () { - if (this.validate()) { - Notify.progress("Creating profile...", true); + if (sel_rows.length > 0) { + if (confirm(__("Remove selected profiles? Active and default profiles will not be removed."))) { + Notify.progress("Removing selected profiles...", true); - const query = {op: "rpc", method: "addprofile", title: dialog.attr('value').newprofile}; + const query = { + op: "rpc", method: "remprofiles", + ids: sel_rows.toString() + }; xhrPost("backend.php", query, () => { Notify.close(); Helpers.editProfiles(); }); - - } - }, - execute: function () { - if (this.validate()) { } - }, - href: query - }); - dialog.show(); - }, - customizeCSS: function() { - const query = "backend.php?op=pref-prefs&method=customizeCSS"; + } else { + alert(__("No profiles selected.")); + } + }, + activateProfile: function () { + const sel_rows = this.getSelectedProfiles(); - if (dijit.byId("cssEditDlg")) - dijit.byId("cssEditDlg").destroyRecursive(); + if (sel_rows.length == 1) { + if (confirm(__("Activate selected profile?"))) { + Notify.progress("Loading, please wait..."); - const dialog = new dijit.Dialog({ - id: "cssEditDlg", - title: __("Customize stylesheet"), - style: "width: 600px", - apply: function() { - xhrPost("backend.php", this.attr('value'), () => { - new Effect.Appear("css_edit_apply_msg"); - $("user_css_style").innerText = this.attr('value'); - }); - }, - execute: function () { - Notify.progress('Saving data...', true); + xhrPost("backend.php", {op: "rpc", method: "setprofile", id: sel_rows.toString()}, () => { + window.location.reload(); + }); + } - xhrPost("backend.php", this.attr('value'), () => { - window.location.reload(); - }); + } else { + alert(__("Please choose a profile to activate.")); + } + }, + addProfile: function () { + if (this.validate()) { + Notify.progress("Creating profile...", true); - }, - href: query - }); + const query = {op: "rpc", method: "addprofile", title: dialog.attr('value').newprofile}; - dialog.show(); - }, - confirmReset: function() { - if (confirm(__("Reset to defaults?"))) { - xhrPost("backend.php", {op: "pref-prefs", method: "resetconfig"}, (transport) => { - Helpers.refresh(); - Notify.info(transport.responseText); + xhrPost("backend.php", query, () => { + Notify.close(); + Helpers.editProfiles(); + }); + + } + }, + execute: function () { + if (this.validate()) { + // + } + }, + href: query + }); + + dialog.show(); + }, + customizeCSS: function() { + const query = "backend.php?op=pref-prefs&method=customizeCSS"; + + if (dijit.byId("cssEditDlg")) + dijit.byId("cssEditDlg").destroyRecursive(); + + const dialog = new dijit.Dialog({ + id: "cssEditDlg", + title: __("Customize stylesheet"), + style: "width: 600px", + apply: function() { + xhrPost("backend.php", this.attr('value'), () => { + new Effect.Appear("css_edit_apply_msg"); + $("user_css_style").innerText = this.attr('value'); }); - } - }, - clearPluginData: function(name) { - if (confirm(__("Clear stored data for this plugin?"))) { - Notify.progress("Loading, please wait..."); + }, + execute: function () { + Notify.progress('Saving data...', true); - xhrPost("backend.php", {op: "pref-prefs", method: "clearplugindata", name: name}, () => { - Helpers.refresh(); + xhrPost("backend.php", this.attr('value'), () => { + window.location.reload(); }); - } - }, - refresh: function() { - xhrPost("backend.php", { op: "pref-prefs" }, (transport) => { - dijit.byId('genConfigTab').attr('content', transport.responseText); - Notify.close(); + + }, + href: query + }); + + dialog.show(); + }, + confirmReset: function() { + if (confirm(__("Reset to defaults?"))) { + xhrPost("backend.php", {op: "pref-prefs", method: "resetconfig"}, (transport) => { + Helpers.refresh(); + Notify.info(transport.responseText); }); - }, - OPML: { - import: function() { - const opml_file = $("opml_file"); + } + }, + clearPluginData: function(name) { + if (confirm(__("Clear stored data for this plugin?"))) { + Notify.progress("Loading, please wait..."); - if (opml_file.value.length == 0) { - alert(__("Please choose an OPML file first.")); - return false; - } else { - Notify.progress("Importing, please wait...", true); + xhrPost("backend.php", {op: "pref-prefs", method: "clearplugindata", name: name}, () => { + Helpers.refresh(); + }); + } + }, + refresh: function() { + xhrPost("backend.php", { op: "pref-prefs" }, (transport) => { + dijit.byId('genConfigTab').attr('content', transport.responseText); + Notify.close(); + }); + }, + OPML: { + import: function() { + const opml_file = $("opml_file"); + + if (opml_file.value.length == 0) { + alert(__("Please choose an OPML file first.")); + return false; + } else { + Notify.progress("Importing, please wait...", true); - Element.show("upload_iframe"); + Element.show("upload_iframe"); - return true; - } - }, - onImportComplete: function(iframe) { - if (!iframe.contentDocument.body.innerHTML) return false; + return true; + } + }, + onImportComplete: function(iframe) { + if (!iframe.contentDocument.body.innerHTML) return false; - Element.show(iframe); + Element.show(iframe); - Notify.close(); + Notify.close(); - if (dijit.byId('opmlImportDlg')) - dijit.byId('opmlImportDlg').destroyRecursive(); + if (dijit.byId('opmlImportDlg')) + dijit.byId('opmlImportDlg').destroyRecursive(); - const content = iframe.contentDocument.body.innerHTML; + const content = iframe.contentDocument.body.innerHTML; - const dialog = new dijit.Dialog({ - id: "opmlImportDlg", - title: __("OPML Import"), - style: "width: 600px", - onCancel: function () { - window.location.reload(); - }, - execute: function () { - window.location.reload(); - }, - content: content - }); + const dialog = new dijit.Dialog({ + id: "opmlImportDlg", + title: __("OPML Import"), + style: "width: 600px", + onCancel: function () { + window.location.reload(); + }, + execute: function () { + window.location.reload(); + }, + content: content + }); - dojo.connect(dialog, "onShow", function () { - Element.hide(iframe); - }); + dojo.connect(dialog, "onShow", function () { + Element.hide(iframe); + }); - dialog.show(); - }, - export: function() { - console.log("export"); - window.open("backend.php?op=opml&method=export&" + dojo.formToQuery("opmlExportForm")); - }, - changeKey: function() { - if (confirm(__("Replace current OPML publishing address with a new one?"))) { - Notify.progress("Trying to change address...", true); + dialog.show(); + }, + export: function() { + console.log("export"); + window.open("backend.php?op=opml&method=export&" + dojo.formToQuery("opmlExportForm")); + }, + changeKey: function() { + if (confirm(__("Replace current OPML publishing address with a new one?"))) { + Notify.progress("Trying to change address...", true); - xhrJson("backend.php", {op: "pref-feeds", method: "regenOPMLKey"}, (reply) => { - if (reply) { - const new_link = reply.link; - const e = $('pub_opml_url'); + xhrJson("backend.php", {op: "pref-feeds", method: "regenOPMLKey"}, (reply) => { + if (reply) { + const new_link = reply.link; + const e = $('pub_opml_url'); - if (new_link) { - e.href = new_link; - e.innerHTML = new_link; + if (new_link) { + e.href = new_link; + e.innerHTML = new_link; - new Effect.Highlight(e); + new Effect.Highlight(e); - Notify.close(); + Notify.close(); - } else { - Notify.error("Could not change feed URL."); - } + } else { + Notify.error("Could not change feed URL."); } - }); - } - return false; - }, - } - }; - - return Helpers; -}); + } + }); + } + return false; + }, + } +}; diff --git a/js/PrefLabelTree.js b/js/PrefLabelTree.js index 988e313b0..b14474feb 100644 --- a/js/PrefLabelTree.js +++ b/js/PrefLabelTree.js @@ -1,4 +1,5 @@ -/* global lib,dijit */ +/* global __, define, lib, dijit, dojo, xhrPost, Notify */ + define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/form/DropDownButton"], function (declare, domConstruct) { return declare("fox.PrefLabelTree", lib.CheckBoxTree, { diff --git a/js/PrefUsers.js b/js/PrefUsers.js index 55dc43dfa..8136e9c65 100644 --- a/js/PrefUsers.js +++ b/js/PrefUsers.js @@ -1,122 +1,120 @@ 'use strict' -/* global __, ngettext */ -define(["dojo/_base/declare"], function (declare) { - Users = { - reload: function(sort) { - const user_search = $("user_search"); - const search = user_search ? user_search.value : ""; - - xhrPost("backend.php", { op: "pref-users", sort: sort, search: search }, (transport) => { - dijit.byId('userConfigTab').attr('content', transport.responseText); - Notify.close(); - }); - }, - add: function() { - const login = prompt(__("Please enter username:"), ""); - if (login) { - Notify.progress("Adding user..."); +/* global __ */ +/* global xhrPost, dojo, dijit, Notify, Tables */ - xhrPost("backend.php", {op: "pref-users", method: "add", login: login}, (transport) => { - alert(transport.responseText); - Users.reload(); - }); +const Users = { + reload: function(sort) { + const user_search = $("user_search"); + const search = user_search ? user_search.value : ""; - } - }, - edit: function(id) { - const query = "backend.php?op=pref-users&method=edit&id=" + - encodeURIComponent(id); - - if (dijit.byId("userEditDlg")) - dijit.byId("userEditDlg").destroyRecursive(); - - const dialog = new dijit.Dialog({ - id: "userEditDlg", - title: __("User Editor"), - style: "width: 600px", - execute: function () { - if (this.validate()) { - Notify.progress("Saving data...", true); - - xhrPost("backend.php", dojo.formToObject("user_edit_form"), (transport) => { - dialog.hide(); - Users.reload(); - }); - } - }, - href: query - }); - - dialog.show(); - }, - resetSelected: function() { - const rows = this.getSelection(); + xhrPost("backend.php", { op: "pref-users", sort: sort, search: search }, (transport) => { + dijit.byId('userConfigTab').attr('content', transport.responseText); + Notify.close(); + }); + }, + add: function() { + const login = prompt(__("Please enter username:"), ""); - if (rows.length == 0) { - alert(__("No users selected.")); - return; - } + if (login) { + Notify.progress("Adding user..."); - if (rows.length > 1) { - alert(__("Please select one user.")); - return; - } + xhrPost("backend.php", {op: "pref-users", method: "add", login: login}, (transport) => { + alert(transport.responseText); + Users.reload(); + }); - if (confirm(__("Reset password of selected user?"))) { - Notify.progress("Resetting password for selected user..."); + } + }, + edit: function(id) { + const query = "backend.php?op=pref-users&method=edit&id=" + + encodeURIComponent(id); + + if (dijit.byId("userEditDlg")) + dijit.byId("userEditDlg").destroyRecursive(); + + const dialog = new dijit.Dialog({ + id: "userEditDlg", + title: __("User Editor"), + style: "width: 600px", + execute: function () { + if (this.validate()) { + Notify.progress("Saving data...", true); + + xhrPost("backend.php", dojo.formToObject("user_edit_form"), (/* transport */) => { + dialog.hide(); + Users.reload(); + }); + } + }, + href: query + }); + + dialog.show(); + }, + resetSelected: function() { + const rows = this.getSelection(); + + if (rows.length == 0) { + alert(__("No users selected.")); + return; + } - const id = rows[0]; + if (rows.length > 1) { + alert(__("Please select one user.")); + return; + } - xhrPost("backend.php", {op: "pref-users", method: "resetPass", id: id}, (transport) => { - Notify.close(); - Notify.info(transport.responseText, true); - }); + if (confirm(__("Reset password of selected user?"))) { + Notify.progress("Resetting password for selected user..."); - } - }, - removeSelected: function() { - const sel_rows = this.getSelection(); + const id = rows[0]; - if (sel_rows.length > 0) { - if (confirm(__("Remove selected users? Neither default admin nor your account will be removed."))) { - Notify.progress("Removing selected users..."); + xhrPost("backend.php", {op: "pref-users", method: "resetPass", id: id}, (transport) => { + Notify.close(); + Notify.info(transport.responseText, true); + }); - const query = { - op: "pref-users", method: "remove", - ids: sel_rows.toString() - }; + } + }, + removeSelected: function() { + const sel_rows = this.getSelection(); - xhrPost("backend.php", query, () => { - this.reload(); - }); - } + if (sel_rows.length > 0) { + if (confirm(__("Remove selected users? Neither default admin nor your account will be removed."))) { + Notify.progress("Removing selected users..."); - } else { - alert(__("No users selected.")); - } - }, - editSelected: function() { - const rows = this.getSelection(); + const query = { + op: "pref-users", method: "remove", + ids: sel_rows.toString() + }; - if (rows.length == 0) { - alert(__("No users selected.")); - return; + xhrPost("backend.php", query, () => { + this.reload(); + }); } - if (rows.length > 1) { - alert(__("Please select one user.")); - return; - } + } else { + alert(__("No users selected.")); + } + }, + editSelected: function() { + const rows = this.getSelection(); - this.edit(rows[0]); - }, - getSelection :function() { - return Tables.getSelected("prefUserList"); + if (rows.length == 0) { + alert(__("No users selected.")); + return; } - } - return Users; -}); + if (rows.length > 1) { + alert(__("Please select one user.")); + return; + } + this.edit(rows[0]); + }, + getSelection :function() { + return Tables.getSelected("prefUserList"); + } +} diff --git a/js/Toolbar.js b/js/Toolbar.js index 6d2c20058..d4993e713 100755 --- a/js/Toolbar.js +++ b/js/Toolbar.js @@ -1,10 +1,11 @@ -/* global dijit */ +/* global dijit, define */ + define(["dojo/_base/declare", "dijit/Toolbar"], function (declare) { return declare("fox.Toolbar", dijit.Toolbar, { - _onContainerKeydown: function(/* Event */ e) { + _onContainerKeydown: function(/* Event */ /* e */) { return; // Stop dijit.Toolbar from interpreting keystrokes }, - _onContainerKeypress: function(/* Event */ e) { + _onContainerKeypress: function(/* Event */ /* e */) { return; // Stop dijit.Toolbar from interpreting keystrokes }, focus: function() { diff --git a/js/common.js b/js/common.js index 69b528a1c..c17e8bc45 100755 --- a/js/common.js +++ b/js/common.js @@ -1,21 +1,19 @@ -'use strict' -/* global dijit, __ */ +'use strict'; -let LABEL_BASE_INDEX = -1024; /* not const because it's assigned at least once (by backend) */ -let loading_progress = 0; +/* global dijit, __, App, Ajax */ /* error reporting shim */ - // TODO: deprecated; remove -function exception_error(e, e_compat, filename, lineno, colno) { +/* function exception_error(e, e_compat, filename, lineno, colno) { if (typeof e == "string") e = e_compat; App.Error.report(e, {filename: filename, lineno: lineno, colno: colno}); -} +} */ /* xhr shorthand helpers */ +/* exported xhrPost */ function xhrPost(url, params, complete) { console.log("xhrPost:", params); @@ -31,6 +29,7 @@ function xhrPost(url, params, complete) { }); } +/* exported xhrJson */ function xhrJson(url, params, complete) { return new Promise((resolve, reject) => { return xhrPost(url, params).then((reply) => { @@ -58,6 +57,7 @@ Array.prototype.remove = function(s) { /* common helpers not worthy of separate Dojo modules */ +/* exported Lists */ const Lists = { onRowChecked: function(elem) { const checked = elem.domNode ? elem.attr("checked") : elem.checked; @@ -87,7 +87,7 @@ const Lists = { }, }; -// noinspection JSUnusedGlobalSymbols +/* exported Tables */ const Tables = { onRowChecked: function(elem) { // account for dojo checkboxes @@ -133,6 +133,7 @@ const Tables = { } }; +/* exported Cookie */ const Cookie = { set: function (name, value, lifetime) { const d = new Date(); @@ -152,12 +153,12 @@ const Cookie = { }, delete: function(name) { const expires = "expires=Thu, 01-Jan-1970 00:00:01 GMT"; - document.cookie = name + "=" + "" + "; " + expires; + document.cookie = name + "=; " + expires; } }; /* runtime notifications */ - +/* exported Notify */ const Notify = { KIND_GENERIC: 0, KIND_INFO: 1, @@ -237,30 +238,8 @@ const Notify = { } }; -// noinspection JSUnusedGlobalSymbols -function displayIfChecked(checkbox, elemId) { - if (checkbox.checked) { - Effect.Appear(elemId, {duration : 0.5}); - } else { - Effect.Fade(elemId, {duration : 0.5}); - } -} - -/* function strip_tags(s) { - return s.replace(/<\/?[^>]+(>|$)/g, ""); -} */ - -// noinspection JSUnusedGlobalSymbols -function label_to_feed_id(label) { - return LABEL_BASE_INDEX - 1 - Math.abs(label); -} - -// noinspection JSUnusedGlobalSymbols -function feed_to_label_id(feed) { - return LABEL_BASE_INDEX - 1 + Math.abs(feed); -} - // http://stackoverflow.com/questions/6251937/how-to-get-selecteduser-highlighted-text-in-contenteditable-element-and-replac +/* exported getSelectionText */ function getSelectionText() { let text = ""; @@ -281,36 +260,3 @@ function getSelectionText() { return text.stripTags(); } - -// noinspection JSUnusedGlobalSymbols -function popupOpenUrl(url) { - const w = window.open(""); - - w.opener = null; - w.location = url; -} - -// noinspection JSUnusedGlobalSymbols -function popupOpenArticle(id) { - const w = window.open("", - "ttrss_article_popup", - "height=900,width=900,resizable=yes,status=no,location=no,menubar=no,directories=no,scrollbars=yes,toolbar=no"); - - if (w) { - w.opener = null; - w.location = "backend.php?op=article&method=view&mode=raw&html=1&zoom=1&id=" + id + "&csrf_token=" + App.getInitParam("csrf_token"); - } -} - -// htmlspecialchars()-alike for headlines data-content attribute -function escapeHtml(text) { - const map = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - return text.replace(/[&<>"']/g, function(m) { return map[m]; }); -} diff --git a/js/form/ValidationTextArea.js b/js/form/ValidationTextArea.js new file mode 100644 index 000000000..a7993f716 --- /dev/null +++ b/js/form/ValidationTextArea.js @@ -0,0 +1,33 @@ +// https://stackoverflow.com/questions/19317258/how-to-use-dijit-textarea-validation-dojo-1-9 + +define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/SimpleTextarea", "dijit/form/ValidationTextBox"], + function(declare, lang, SimpleTextarea, ValidationTextBox) { + + return declare('fox.form.ValidationTextArea', [SimpleTextarea, ValidationTextBox], { + constructor: function(params){ + this.constraints = {}; + this.baseClass += ' dijitValidationTextArea'; + }, + templateString: "<textarea ${!nameAttrSetting} data-dojo-attach-point='focusNode,containerNode,textbox' autocomplete='off'></textarea>", + validator: function(value, constraints) { + //console.log(this, value, constraints); + + if (this.required && this._isEmpty(value)) + return false; + + if (this.validregexp) { + try { + new RegExp("/" + value + "/"); + } catch (e) { + return false; + } + } + + return value.match(new RegExp(this._computeRegexp(constraints))); + + /*return (new RegExp("^(?:" + this._computeRegexp(constraints) + ")"+(this.required?"":"?")+"$",["m"])).test(value) && + (!this.required || !this._isEmpty(value)) && + (this._isEmpty(value) || this.parse(value, constraints) !== undefined); // Boolean*/ + } + }) + }); diff --git a/js/prefs.js b/js/prefs.js index 944e49258..a71b4f39e 100755 --- a/js/prefs.js +++ b/js/prefs.js @@ -1,19 +1,15 @@ 'use strict' -/* global dijit, __ */ -let App; -let CommonDialogs; -let Filters; -let Users; -let Helpers; +/* global require, App */ +/* exported Plugins */ const Plugins = {}; require(["dojo/_base/kernel", "dojo/_base/declare", "dojo/ready", "dojo/parser", - "fox/AppBase", + "fox/App", "dojo/_base/loader", "dojo/_base/html", "dijit/ColorPalette", @@ -55,109 +51,16 @@ require(["dojo/_base/kernel", "fox/PrefFilterTree", "fox/PrefLabelTree", "fox/Toolbar", + "fox/form/ValidationTextArea", "fox/form/Select", "fox/form/ComboButton", - "fox/form/DropDownButton"], function (dojo, declare, ready, parser, AppBase) { + "fox/form/DropDownButton"], function (dojo, declare, ready, parser) { ready(function () { try { - const _App = declare("fox.App", AppBase, { - constructor: function() { - this.setupNightModeDetection(() => { - parser.parse(); - - this.setLoadingProgress(50); - - const clientTzOffset = new Date().getTimezoneOffset() * 60; - const params = {op: "rpc", method: "sanityCheck", clientTzOffset: clientTzOffset}; - - xhrPost("backend.php", params, (transport) => { - try { - this.backendSanityCallback(transport); - } catch (e) { - this.Error.report(e); - } - }); - }); - }, - initSecondStage: function() { - this.enableCsrfSupport(); - - document.onkeydown = (event) => { return App.hotkeyHandler(event) }; - document.onkeypress = (event) => { return App.hotkeyHandler(event) }; - App.setLoadingProgress(50); - Notify.close(); - - let tab = App.urlParam('tab'); - - if (tab) { - tab = dijit.byId(tab + "Tab"); - if (tab) { - dijit.byId("pref-tabs").selectChild(tab); - - switch (App.urlParam('method')) { - case "editfeed": - window.setTimeout(function () { - CommonDialogs.editFeed(App.urlParam('methodparam')) - }, 100); - break; - default: - console.warn("initSecondStage, unknown method:", App.urlParam("method")); - } - } - } else { - let tab = localStorage.getItem("ttrss:prefs-tab"); - - if (tab) { - tab = dijit.byId(tab); - if (tab) { - dijit.byId("pref-tabs").selectChild(tab); - } - } - } - - dojo.connect(dijit.byId("pref-tabs"), "selectChild", function (elem) { - localStorage.setItem("ttrss:prefs-tab", elem.id); - }); - - }, - hotkeyHandler: function (event) { - if (event.target.nodeName == "INPUT" || event.target.nodeName == "TEXTAREA") return; - - // Arrow buttons and escape are not reported via keypress, handle them via keydown. - // escape = 27, left = 37, up = 38, right = 39, down = 40 - if (event.type == "keydown" && event.which != 27 && (event.which < 37 || event.which > 40)) return; - - const action_name = App.keyeventToAction(event); - - if (action_name) { - switch (action_name) { - case "feed_subscribe": - CommonDialogs.quickAddFeed(); - return false; - case "create_label": - CommonDialogs.addLabel(); - return false; - case "create_filter": - Filters.quickAddFilter(); - return false; - case "help_dialog": - App.helpDialog("main"); - return false; - default: - console.log("unhandled action: " + action_name + "; keycode: " + event.which); - } - } - }, - isPrefs: function() { - return true; - } - }); - - App = new _App(); - + App.init(parser, true); } catch (e) { - if (App && App.Error) + if (typeof App != "undefined" && App.Error) App.Error.report(e); else alert(e + "\n\n" + e.stack); diff --git a/js/tt-rss.js b/js/tt-rss.js index d45dd5748..83c6681cd 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -1,21 +1,15 @@ 'use strict' -/* global dijit,__ */ -let App; -let CommonDialogs; -let Filters; -let Feeds; -let Headlines; -let Article; -let PluginHost; +/* global require, App */ +/* exported Plugins */ const Plugins = {}; require(["dojo/_base/kernel", "dojo/_base/declare", "dojo/ready", "dojo/parser", - "fox/AppBase", + "fox/App", "dojo/_base/loader", "dojo/_base/html", "dojo/query", @@ -56,549 +50,16 @@ require(["dojo/_base/kernel", "fox/FeedStoreModel", "fox/FeedTree", "fox/Toolbar", + "fox/form/ValidationTextArea", "fox/form/Select", "fox/form/ComboButton", - "fox/form/DropDownButton"], function (dojo, declare, ready, parser, AppBase) { + "fox/form/DropDownButton"], function (dojo, declare, ready, parser) { ready(function () { try { - const _App = declare("fox.App", AppBase, { - global_unread: -1, - _widescreen_mode: false, - hotkey_actions: {}, - constructor: function () { - this.setupNightModeDetection(() => { - parser.parse(); - - if (!this.checkBrowserFeatures()) - return; - - this.setLoadingProgress(30); - this.initHotkeyActions(); - - const a = document.createElement('audio'); - const hasAudio = !!a.canPlayType; - const hasSandbox = "sandbox" in document.createElement("iframe"); - const hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, '')); - const clientTzOffset = new Date().getTimezoneOffset() * 60; - - const params = { - op: "rpc", method: "sanityCheck", hasAudio: hasAudio, - hasMp3: hasMp3, - clientTzOffset: clientTzOffset, - hasSandbox: hasSandbox - }; - - xhrPost("backend.php", params, (transport) => { - try { - App.backendSanityCallback(transport); - } catch (e) { - App.Error.report(e); - } - }); - }); - }, - checkBrowserFeatures: function() { - let errorMsg = ""; - - ['MutationObserver'].each(function(wf) { - if (! (wf in window)) { - errorMsg = `Browser feature check failed: <code>window.${wf}</code> not found.`; - throw $break; - } - }); - - if (errorMsg) { - this.Error.fatal(errorMsg, {info: navigator.userAgent}); - } - - return errorMsg == ""; - }, - initSecondStage: function () { - this.enableCsrfSupport(); - - Feeds.reload(); - Article.close(); - - if (parseInt(Cookie.get("ttrss_fh_width")) > 0) { - dijit.byId("feeds-holder").domNode.setStyle( - {width: Cookie.get("ttrss_fh_width") + "px"}); - } - - dijit.byId("main").resize(); - - dojo.connect(dijit.byId('feeds-holder'), 'resize', - function (args) { - if (args && args.w >= 0) { - Cookie.set("ttrss_fh_width", args.w, App.getInitParam("cookie_lifetime")); - } - }); - - dojo.connect(dijit.byId('content-insert'), 'resize', - function (args) { - if (args && args.w >= 0 && args.h >= 0) { - Cookie.set("ttrss_ci_width", args.w, App.getInitParam("cookie_lifetime")); - Cookie.set("ttrss_ci_height", args.h, App.getInitParam("cookie_lifetime")); - } - }); - - const toolbar = document.forms["toolbar-main"]; - - dijit.getEnclosingWidget(toolbar.view_mode).attr('value', - App.getInitParam("default_view_mode")); - - dijit.getEnclosingWidget(toolbar.order_by).attr('value', - App.getInitParam("default_view_order_by")); - - App.setLoadingProgress(50); - - this._widescreen_mode = App.getInitParam("widescreen"); - this.switchPanelMode(this._widescreen_mode); - - Headlines.initScrollHandler(); - - if (App.getInitParam("simple_update")) { - console.log("scheduling simple feed updater..."); - window.setInterval(() => { Feeds.updateRandom() }, 30 * 1000); - } - - if (App.getInitParam('check_for_updates')) { - window.setInterval(() => { - App.checkForUpdates(); - }, 3600 * 1000); - } - - console.log("second stage ok"); - - PluginHost.run(PluginHost.HOOK_INIT_COMPLETE, null); - - }, - checkForUpdates: function() { - console.log('checking for updates...'); - - xhrJson("backend.php", {op: 'rpc', method: 'checkforupdates'}) - .then((reply) => { - console.log('update reply', reply); - - if (reply.id) { - $("updates-available").show(); - } else { - $("updates-available").hide(); - } - }); - }, - updateTitle: function() { - let tmp = "Tiny Tiny RSS"; - - if (this.global_unread > 0) { - tmp = "(" + this.global_unread + ") " + tmp; - } - - document.title = tmp; - }, - onViewModeChanged: function() { - const view_mode = document.forms["toolbar-main"].view_mode.value; - - $$("body")[0].setAttribute("view-mode", view_mode); - - return Feeds.reloadCurrent(''); - }, - isCombinedMode: function() { - return App.getInitParam("combined_display_mode"); - }, - hotkeyHandler: function(event) { - if (event.target.nodeName == "INPUT" || event.target.nodeName == "TEXTAREA") return; - - // Arrow buttons and escape are not reported via keypress, handle them via keydown. - // escape = 27, left = 37, up = 38, right = 39, down = 40, pgup = 33, pgdn = 34 - if (event.type == "keydown" && event.which != 27 && (event.which < 33 || event.which > 40)) return; - - const action_name = App.keyeventToAction(event); - - if (action_name) { - const action_func = this.hotkey_actions[action_name]; - - if (action_func != null) { - action_func(event); - event.stopPropagation(); - return false; - } - } - }, - switchPanelMode: function(wide) { - //if (App.isCombinedMode()) return; - - const article_id = Article.getActive(); - - if (wide) { - dijit.byId("headlines-wrap-inner").attr("design", 'sidebar'); - dijit.byId("content-insert").attr("region", "trailing"); - - dijit.byId("content-insert").domNode.setStyle({width: '50%', - height: 'auto', - borderTopWidth: '0px' }); - - if (parseInt(Cookie.get("ttrss_ci_width")) > 0) { - dijit.byId("content-insert").domNode.setStyle( - {width: Cookie.get("ttrss_ci_width") + "px" }); - } - - $("headlines-frame").setStyle({ borderBottomWidth: '0px' }); - $("headlines-frame").addClassName("wide"); - - } else { - - dijit.byId("content-insert").attr("region", "bottom"); - - dijit.byId("content-insert").domNode.setStyle({width: 'auto', - height: '50%', - borderTopWidth: '0px'}); - - if (parseInt(Cookie.get("ttrss_ci_height")) > 0) { - dijit.byId("content-insert").domNode.setStyle( - {height: Cookie.get("ttrss_ci_height") + "px" }); - } - - $("headlines-frame").setStyle({ borderBottomWidth: '1px' }); - $("headlines-frame").removeClassName("wide"); - - } - - Article.close(); - - if (article_id) Article.view(article_id); - - xhrPost("backend.php", {op: "rpc", method: "setpanelmode", wide: wide ? 1 : 0}); - }, - initHotkeyActions: function() { - this.hotkey_actions["next_feed"] = function () { - const rv = dijit.byId("feedTree").getNextFeed( - Feeds.getActive(), Feeds.activeIsCat()); - - if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true}) - }; - this.hotkey_actions["prev_feed"] = function () { - const rv = dijit.byId("feedTree").getPreviousFeed( - Feeds.getActive(), Feeds.activeIsCat()); - - if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true}) - }; - this.hotkey_actions["next_article_or_scroll"] = function (event) { - Headlines.move('next', {event: event}); - }; - this.hotkey_actions["prev_article_or_scroll"] = function (event) { - Headlines.move('prev', {event: event}); - }; - this.hotkey_actions["next_article_noscroll"] = function (event) { - Headlines.move('next', {noscroll: true, event: event}); - }; - this.hotkey_actions["prev_article_noscroll"] = function (event) { - Headlines.move('prev', {noscroll: true, event: event}); - }; - this.hotkey_actions["next_article_noexpand"] = function (event) { - Headlines.move('next', {noscroll: true, noexpand: true, event: event}); - }; - this.hotkey_actions["prev_article_noexpand"] = function (event) { - Headlines.move('prev', {noscroll: true, noexpand: true, event: event}); - }; - this.hotkey_actions["search_dialog"] = function () { - Feeds.search(); - }; - this.hotkey_actions["toggle_mark"] = function () { - Headlines.selectionToggleMarked(); - }; - this.hotkey_actions["toggle_publ"] = function () { - Headlines.selectionTogglePublished(); - }; - this.hotkey_actions["toggle_unread"] = function () { - Headlines.selectionToggleUnread({no_error: 1}); - }; - this.hotkey_actions["edit_tags"] = function () { - const id = Article.getActive(); - if (id) { - Article.editTags(id); - } - }; - this.hotkey_actions["open_in_new_window"] = function () { - if (Article.getActive()) { - Article.openInNewWindow(Article.getActive()); - } - }; - this.hotkey_actions["catchup_below"] = function () { - Headlines.catchupRelativeTo(1); - }; - this.hotkey_actions["catchup_above"] = function () { - Headlines.catchupRelativeTo(0); - }; - this.hotkey_actions["article_scroll_down"] = function (event) { - const ctr = App.isCombinedMode() ? $("headlines-frame") : $("content-insert"); - - if (ctr) - Article.scroll(ctr.offsetHeight / 2, event); - }; - this.hotkey_actions["article_scroll_up"] = function (event) { - const ctr = App.isCombinedMode() ? $("headlines-frame") : $("content-insert"); - - if (ctr) - Article.scroll(-ctr.offsetHeight / 2, event); - }; - this.hotkey_actions["next_article_page"] = function (event) { - Headlines.scrollByPages(1, event); - }; - this.hotkey_actions["prev_article_page"] = function (event) { - Headlines.scrollByPages(-1, event); - }; - this.hotkey_actions["article_page_down"] = function (event) { - Article.scrollByPages(1, event); - }; - this.hotkey_actions["article_page_up"] = function (event) { - Article.scrollByPages(-1, event); - }; - this.hotkey_actions["close_article"] = function () { - if (App.isCombinedMode()) { - Article.cdmUnsetActive(); - } else { - Article.close(); - } - }; - this.hotkey_actions["email_article"] = function () { - if (typeof Plugins.Mail != "undefined") { - Plugins.Mail.onHotkey(Headlines.getSelected()); - } else { - alert(__("Please enable mail or mailto plugin first.")); - } - }; - this.hotkey_actions["select_all"] = function () { - Headlines.select('all'); - }; - this.hotkey_actions["select_unread"] = function () { - Headlines.select('unread'); - }; - this.hotkey_actions["select_marked"] = function () { - Headlines.select('marked'); - }; - this.hotkey_actions["select_published"] = function () { - Headlines.select('published'); - }; - this.hotkey_actions["select_invert"] = function () { - Headlines.select('invert'); - }; - this.hotkey_actions["select_none"] = function () { - Headlines.select('none'); - }; - this.hotkey_actions["feed_refresh"] = function () { - if (typeof Feeds.getActive() != "undefined") { - Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat()}); - } - }; - this.hotkey_actions["feed_unhide_read"] = function () { - Feeds.toggleUnread(); - }; - this.hotkey_actions["feed_subscribe"] = function () { - CommonDialogs.quickAddFeed(); - }; - this.hotkey_actions["feed_debug_update"] = function () { - if (!Feeds.activeIsCat() && parseInt(Feeds.getActive()) > 0) { - window.open("backend.php?op=feeds&method=update_debugger&feed_id=" + Feeds.getActive() + - "&csrf_token=" + App.getInitParam("csrf_token")); - } else { - alert("You can't debug this kind of feed."); - } - }; - - this.hotkey_actions["feed_debug_viewfeed"] = function () { - Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), viewfeed_debug: true}); - }; - - this.hotkey_actions["feed_edit"] = function () { - if (Feeds.activeIsCat()) - alert(__("You can't edit this kind of feed.")); - else - CommonDialogs.editFeed(Feeds.getActive()); - }; - this.hotkey_actions["feed_catchup"] = function () { - if (typeof Feeds.getActive() != "undefined") { - Feeds.catchupCurrent(); - } - }; - this.hotkey_actions["feed_reverse"] = function () { - Headlines.reverse(); - }; - this.hotkey_actions["feed_toggle_vgroup"] = function () { - xhrPost("backend.php", {op: "rpc", method: "togglepref", key: "VFEED_GROUP_BY_FEED"}, () => { - Feeds.reloadCurrent(); - }) - }; - this.hotkey_actions["catchup_all"] = function () { - Feeds.catchupAll(); - }; - this.hotkey_actions["cat_toggle_collapse"] = function () { - if (Feeds.activeIsCat()) { - dijit.byId("feedTree").collapseCat(Feeds.getActive()); - } - }; - this.hotkey_actions["goto_read"] = function () { - Feeds.open({feed: -6}); - }; - this.hotkey_actions["goto_all"] = function () { - Feeds.open({feed: -4}); - }; - this.hotkey_actions["goto_fresh"] = function () { - Feeds.open({feed: -3}); - }; - this.hotkey_actions["goto_marked"] = function () { - Feeds.open({feed: -1}); - }; - this.hotkey_actions["goto_published"] = function () { - Feeds.open({feed: -2}); - }; - this.hotkey_actions["goto_tagcloud"] = function () { - App.displayDlg(__("Tag cloud"), "printTagCloud"); - }; - this.hotkey_actions["goto_prefs"] = function () { - document.location.href = "prefs.php"; - }; - this.hotkey_actions["select_article_cursor"] = function () { - const id = Article.getUnderPointer(); - if (id) { - const row = $("RROW-" + id); - - if (row) - row.toggleClassName("Selected"); - } - }; - this.hotkey_actions["create_label"] = function () { - CommonDialogs.addLabel(); - }; - this.hotkey_actions["create_filter"] = function () { - Filters.quickAddFilter(); - }; - this.hotkey_actions["collapse_sidebar"] = function () { - Feeds.toggle(); - }; - this.hotkey_actions["toggle_full_text"] = function () { - if (typeof Plugins.Af_Readability != "undefined") { - if (Article.getActive()) - Plugins.Af_Readability.embed(Article.getActive()); - } else { - alert(__("Please enable af_readability first.")); - } - }; - this.hotkey_actions["toggle_widescreen"] = function () { - if (!App.isCombinedMode()) { - App._widescreen_mode = !App._widescreen_mode; - - // reset stored sizes because geometry changed - Cookie.set("ttrss_ci_width", 0); - Cookie.set("ttrss_ci_height", 0); - - App.switchPanelMode(App._widescreen_mode); - } else { - alert(__("Widescreen is not available in combined mode.")); - } - }; - this.hotkey_actions["help_dialog"] = function () { - App.helpDialog("main"); - }; - this.hotkey_actions["toggle_combined_mode"] = function () { - const value = App.isCombinedMode() ? "false" : "true"; - - xhrPost("backend.php", {op: "rpc", method: "setpref", key: "COMBINED_DISPLAY_MODE", value: value}, () => { - App.setInitParam("combined_display_mode", - !App.getInitParam("combined_display_mode")); - - Article.close(); - Headlines.renderAgain(); - }) - }; - this.hotkey_actions["toggle_cdm_expanded"] = function () { - const value = App.getInitParam("cdm_expanded") ? "false" : "true"; - - xhrPost("backend.php", {op: "rpc", method: "setpref", key: "CDM_EXPANDED", value: value}, () => { - App.setInitParam("cdm_expanded", !App.getInitParam("cdm_expanded")); - Headlines.renderAgain(); - }); - }; - }, - onActionSelected: function(opid) { - switch (opid) { - case "qmcPrefs": - document.location.href = "prefs.php"; - break; - case "qmcLogout": - document.location.href = "backend.php?op=logout"; - break; - case "qmcTagCloud": - App.displayDlg(__("Tag cloud"), "printTagCloud"); - break; - case "qmcSearch": - Feeds.search(); - break; - case "qmcAddFeed": - CommonDialogs.quickAddFeed(); - break; - case "qmcDigest": - window.location.href = "backend.php?op=digest"; - break; - case "qmcEditFeed": - if (Feeds.activeIsCat()) - alert(__("You can't edit this kind of feed.")); - else - CommonDialogs.editFeed(Feeds.getActive()); - break; - case "qmcRemoveFeed": - const actid = Feeds.getActive(); - - if (!actid) { - alert(__("Please select some feed first.")); - return; - } - - if (Feeds.activeIsCat()) { - alert(__("You can't unsubscribe from the category.")); - return; - } - - const fn = Feeds.getName(actid); - - if (confirm(__("Unsubscribe from %s?").replace("%s", fn))) { - CommonDialogs.unsubscribeFeed(actid); - } - break; - case "qmcCatchupAll": - Feeds.catchupAll(); - break; - case "qmcShowOnlyUnread": - Feeds.toggleUnread(); - break; - case "qmcToggleWidescreen": - if (!App.isCombinedMode()) { - App._widescreen_mode = !App._widescreen_mode; - - // reset stored sizes because geometry changed - Cookie.set("ttrss_ci_width", 0); - Cookie.set("ttrss_ci_height", 0); - - App.switchPanelMode(App._widescreen_mode); - } else { - alert(__("Widescreen is not available in combined mode.")); - } - break; - case "qmcHKhelp": - App.helpDialog("main"); - break; - default: - console.log("quickMenuGo: unknown action: " + opid); - } - }, - isPrefs: function() { - return false; - } - }); - - App = new _App(); + App.init(parser, false); } catch (e) { - if (App && App.Error) + if (typeof App != "undefined" && App.Error) App.Error.report(e); else alert(e + "\n\n" + e.stack); @@ -606,11 +67,13 @@ require(["dojo/_base/kernel", }); }); +/* exported hash_get */ function hash_get(key) { const kv = window.location.hash.substring(1).toQueryParams(); return kv[key]; } +/* exported hash_set */ function hash_set(key, value) { const kv = window.location.hash.substring(1).toQueryParams(); kv[key] = value; diff --git a/js/utility.js b/js/utility.js index 2380f9823..eef1c6b61 100644 --- a/js/utility.js +++ b/js/utility.js @@ -1,4 +1,6 @@ -/* TODO: this should probably be something like night_mode.js since it does nothing specific to utility scripts */2 +/* global UtilityApp */ + +/* TODO: this should probably be something like night_mode.js since it does nothing specific to utility scripts */ Event.observe(window, "load", function() { const UtilityJS = { diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 000000000..da01bdd7c --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "amd" + }, + "include": [ + "js/*.js", + "plugins/**/*.js" + ] +} diff --git a/lib/MiniTemplator.class.php b/lib/MiniTemplator.class.php index e70f0a470..728cdf260 100644 --- a/lib/MiniTemplator.class.php +++ b/lib/MiniTemplator.class.php @@ -1,922 +1,921 @@ -<?php
-/**
-* File MiniTemplator.class.php
-* @package MiniTemplator
-*/
-
-/**
-* A compact template engine for HTML files.
-*
-* Requires PHP 4.0.4 or newer.
-*
-* <pre>
-* Template syntax:
-*
-* Variables:
-* ${VariableName}
-*
-* Blocks:
-* <!-- $BeginBlock BlockName -->
-* ... block content ...
-* <!-- $EndBlock BlockName -->
-*
-* Include a subtemplate:
-* <!-- $Include RelativeFileName -->
-* </pre>
-*
-* <pre>
-* General remarks:
-* - Variable names and block names are case-insensitive.
-* - The same variable may be used multiple times within a template.
-* - Blocks can be nested.
-* - Multiple blocks with the same name may occur within a template.
-* </pre>
-*
-* <pre>
-* Public methods:
-* readTemplateFromFile - Reads the template from a file.
-* setTemplateString - Assigns a new template string.
-* setVariable - Sets a template variable.
-* setVariableEsc - Sets a template variable to an escaped string value.
-* variableExists - Checks whether a template variable exists.
-* addBlock - Adds an instance of a template block.
-* blockExists - Checks whether a block exists.
-* reset - Clears all variables and blocks.
-* generateOutput - Generates the HTML page and writes it to the PHP output stream.
-* generateOutputToFile - Generates the HTML page and writes it to a file.
-* generateOutputToString - Generates the HTML page and writes it to a string.
-* </pre>
-*
-* Home page: {@link http://www.source-code.biz/MiniTemplator}<br>
-* License: This module is released under the GNU/LGPL license ({@link http://www.gnu.org/licenses/lgpl.html}).<br>
-* Copyright 2003: Christian d'Heureuse, Inventec Informatik AG, Switzerland. All rights reserved.<br>
-* This product is provided "as is" without warranty of any kind.<br>
-*
-* Version history:<br>
-* 2001-10-24 Christian d'Heureuse (chdh): VBasic version created.<br>
-* 2002-01-26 Markus Angst: ported to PHP4.<br>
-* 2003-04-07 chdh: changes to adjust to Java version.<br>
-* 2003-07-08 chdh: Method variableExists added.
-* Method setVariable changed to trigger an error when the variable does not exist.<br>
-* 2004-04-07 chdh: Parameter isOptional added to method setVariable.
-* Licensing changed from GPL to LGPL.<br>
-* 2004-04-18 chdh: Method blockExists added.<br>
-* 2004-10-28 chdh:<br>
-* Method setVariableEsc added.<br>
-* Multiple blocks with the same name may now occur within a template.<br>
-* No error ("unknown command") is generated any more, if a HTML comment starts with "${".<br>
-* 2004-11-06 chdh:<br>
-* "$Include" command implemented.<br>
-* 2004-11-20 chdh:<br>
-* "$Include" command changed so that the command text is not copied to the output file.<br>
-*/
-
-class MiniTemplator {
-
-//--- public member variables ---------------------------------------------------------------------------------------
-
-/**
-* Base path for relative file names of subtemplates (for the $Include command).
-* This path is prepended to the subtemplate file names. It must be set before
-* readTemplateFromFile or setTemplateString.
-* @access public
-*/
-var $subtemplateBasePath;
-
-//--- private member variables --------------------------------------------------------------------------------------
-
-/**#@+
-* @access private
-*/
-
-var $maxNestingLevel = 50; // maximum number of block nestings
-var $maxInclTemplateSize = 1000000; // maximum length of template string when including subtemplates
-var $template; // Template file data
-var $varTab; // variables table, array index is variable no
- // Fields:
- // varName // variable name
- // varValue // variable value
-var $varTabCnt; // no of entries used in VarTab
-var $varNameToNoMap; // maps variable names to variable numbers
-var $varRefTab; // variable references table
- // Contains an entry for each variable reference in the template. Ordered by TemplatePos.
- // Fields:
- // varNo // variable no
- // tPosBegin // template position of begin of variable reference
- // tPosEnd // template position of end of variable reference
- // blockNo // block no of the (innermost) block that contains this variable reference
- // blockVarNo // block variable no. Index into BlockInstTab.BlockVarTab
-var $varRefTabCnt; // no of entries used in VarRefTab
-var $blockTab; // Blocks table, array index is block no
- // Contains an entry for each block in the template. Ordered by TPosBegin.
- // Fields:
- // blockName // block name
- // nextWithSameName; // block no of next block with same name or -1 (blocks are backward linked in relation to template position)
- // tPosBegin // template position of begin of block
- // tPosContentsBegin // template pos of begin of block contents
- // tPosContentsEnd // template pos of end of block contents
- // tPosEnd // template position of end of block
- // nestingLevel // block nesting level
- // parentBlockNo // block no of parent block
- // definitionIsOpen // true while $BeginBlock processed but no $EndBlock
- // instances // number of instances of this block
- // firstBlockInstNo // block instance no of first instance of this block or -1
- // lastBlockInstNo // block instance no of last instance of this block or -1
- // currBlockInstNo // current block instance no, used during generation of output file
- // blockVarCnt // no of variables in block
- // blockVarNoToVarNoMap // maps block variable numbers to variable numbers
- // firstVarRefNo // variable reference no of first variable of this block or -1
-var $blockTabCnt; // no of entries used in BlockTab
-var $blockNameToNoMap; // maps block names to block numbers
-var $openBlocksTab;
- // During parsing, this table contains the block numbers of the open parent blocks (nested outer blocks).
- // Indexed by the block nesting level.
-var $blockInstTab; // block instances table
- // This table contains an entry for each block instance that has been added.
- // Indexed by BlockInstNo.
- // Fields:
- // blockNo // block number
- // instanceLevel // instance level of this block
- // InstanceLevel is an instance counter per block.
- // (In contrast to blockInstNo, which is an instance counter over the instances of all blocks)
- // parentInstLevel // instance level of parent block
- // nextBlockInstNo // pointer to next instance of this block or -1
- // Forward chain for instances of same block.
- // blockVarTab // block instance variables
-var $blockInstTabCnt; // no of entries used in BlockInstTab
-
-var $currentNestingLevel; // Current block nesting level during parsing.
-var $templateValid; // true if a valid template is prepared
-var $outputMode; // 0 = to PHP output stream, 1 = to file, 2 = to string
-var $outputFileHandle; // file handle during writing of output file
-var $outputError; // true when an output error occurred
-var $outputString; // string buffer for the generated HTML page
-
-/**#@-*/
-
-//--- constructor ---------------------------------------------------------------------------------------------------
-
-/**
-* Constructs a MiniTemplator object.
-* @access public
-*/
-function __construct() {
- $this->templateValid = false; }
-
-//--- template string handling --------------------------------------------------------------------------------------
-
-/**
-* Reads the template from a file.
-* @param string $fileName name of the file that contains the template.
-* @return boolean true on success, false on error.
-* @access public
-*/
-function readTemplateFromFile ($fileName) {
- if (!$this->readFileIntoString($fileName,$s)) {
- $this->triggerError ("Error while reading template file " . $fileName . ".");
- return false; }
- if (!$this->setTemplateString($s)) return false;
- return true; }
-
-/**
-* Assigns a new template string.
-* @param string $templateString contents of the template file.
-* @return boolean true on success, false on error.
-* @access public
-*/
-function setTemplateString ($templateString) {
- $this->templateValid = false;
- $this->template = $templateString;
- if (!$this->parseTemplate()) return false;
- $this->reset();
- $this->templateValid = true;
- return true; }
-
-/**
-* Loads the template string for a subtemplate (used for the $Include command).
-* @return boolean true on success, false on error.
-* @access private
-*/
-function loadSubtemplate ($subtemplateName, &$s) {
- $subtemplateFileName = $this->combineFileSystemPath($this->subtemplateBasePath,$subtemplateName);
- if (!$this->readFileIntoString($subtemplateFileName,$s)) {
- $this->triggerError ("Error while reading subtemplate file " . $subtemplateFileName . ".");
- return false; }
- return true; }
-
-//--- template parsing ----------------------------------------------------------------------------------------------
-
-/**
-* Parses the template.
-* @return boolean true on success, false on error.
-* @access private
-*/
-function parseTemplate() {
- $this->initParsing();
- $this->beginMainBlock();
- if (!$this->parseTemplateCommands()) return false;
- $this->endMainBlock();
- if (!$this->checkBlockDefinitionsComplete()) return false;
- if (!$this->parseTemplateVariables()) return false;
- $this->associateVariablesWithBlocks();
- return true; }
-
-/**
-* @access private
-*/
-function initParsing() {
- $this->varTab = array();
- $this->varTabCnt = 0;
- $this->varNameToNoMap = array();
- $this->varRefTab = array();
- $this->varRefTabCnt = 0;
- $this->blockTab = array();
- $this->blockTabCnt = 0;
- $this->blockNameToNoMap = array();
- $this->openBlocksTab = array(); }
-
-/**
-* Registers the main block.
-* The main block is an implicitly defined block that covers the whole template.
-* @access private
-*/
-function beginMainBlock() {
- $blockNo = 0;
- $this->registerBlock('@@InternalMainBlock@@', $blockNo);
- $bte =& $this->blockTab[$blockNo];
- $bte['tPosBegin'] = 0;
- $bte['tPosContentsBegin'] = 0;
- $bte['nestingLevel'] = 0;
- $bte['parentBlockNo'] = -1;
- $bte['definitionIsOpen'] = true;
- $this->openBlocksTab[0] = $blockNo;
- $this->currentNestingLevel = 1; }
-
-/**
-* Completes the main block registration.
-* @access private
-*/
-function endMainBlock() {
- $bte =& $this->blockTab[0];
- $bte['tPosContentsEnd'] = strlen($this->template);
- $bte['tPosEnd'] = strlen($this->template);
- $bte['definitionIsOpen'] = false;
- $this->currentNestingLevel -= 1; }
-
-/**
-* Parses commands within the template in the format "<!-- $command parameters -->".
-* @return boolean true on success, false on error.
-* @access private
-*/
-function parseTemplateCommands() {
- $p = 0;
- while (true) {
- $p0 = strpos($this->template,'<!--',$p);
- if ($p0 === false) break;
- $p = strpos($this->template,'-->',$p0);
- if ($p === false) {
- $this->triggerError ("Invalid HTML comment in template at offset $p0.");
- return false; }
- $p += 3;
- $cmdL = substr($this->template,$p0+4,$p-$p0-7);
- if (!$this->processTemplateCommand($cmdL,$p0,$p,$resumeFromStart))
- return false;
- if ($resumeFromStart) $p = $p0; }
- return true; }
-
-/**
-* @return boolean true on success, false on error.
-* @access private
-*/
-function processTemplateCommand ($cmdL, $cmdTPosBegin, $cmdTPosEnd, &$resumeFromStart) {
- $resumeFromStart = false;
- $p = 0;
- $cmd = '';
- if (!$this->parseWord($cmdL,$p,$cmd)) return true;
- $parms = substr($cmdL,$p);
- switch (strtoupper($cmd)) {
- case '$BEGINBLOCK':
- if (!$this->processBeginBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
- return false;
- break;
- case '$ENDBLOCK':
- if (!$this->processEndBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
- return false;
- break;
- case '$INCLUDE':
- if (!$this->processincludeCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
- return false;
- $resumeFromStart = true;
- break;
- default:
- if ($cmd{0} == '$' && !(strlen($cmd) >= 2 && $cmd{1} == '{')) {
- $this->triggerError ("Unknown command \"$cmd\" in template at offset $cmdTPosBegin.");
- return false; }}
- return true; }
-
-/**
-* Processes the $BeginBlock command.
-* @return boolean true on success, false on error.
-* @access private
-*/
-function processBeginBlockCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
- $p = 0;
- if (!$this->parseWord($parms,$p,$blockName)) {
- $this->triggerError ("Missing block name in \$BeginBlock command in template at offset $cmdTPosBegin.");
- return false; }
- if (trim(substr($parms,$p)) != '') {
- $this->triggerError ("Extra parameter in \$BeginBlock command in template at offset $cmdTPosBegin.");
- return false; }
- $this->registerBlock ($blockName, $blockNo);
- $btr =& $this->blockTab[$blockNo];
- $btr['tPosBegin'] = $cmdTPosBegin;
- $btr['tPosContentsBegin'] = $cmdTPosEnd;
- $btr['nestingLevel'] = $this->currentNestingLevel;
- $btr['parentBlockNo'] = $this->openBlocksTab[$this->currentNestingLevel-1];
- $this->openBlocksTab[$this->currentNestingLevel] = $blockNo;
- $this->currentNestingLevel += 1;
- if ($this->currentNestingLevel > $this->maxNestingLevel) {
- $this->triggerError ("Block nesting overflow in template at offset $cmdTPosBegin.");
- return false; }
- return true; }
-
-/**
-* Processes the $EndBlock command.
-* @return boolean true on success, false on error.
-* @access private
-*/
-function processEndBlockCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
- $p = 0;
- if (!$this->parseWord($parms,$p,$blockName)) {
- $this->triggerError ("Missing block name in \$EndBlock command in template at offset $cmdTPosBegin.");
- return false; }
- if (trim(substr($parms,$p)) != '') {
- $this->triggerError ("Extra parameter in \$EndBlock command in template at offset $cmdTPosBegin.");
- return false; }
- if (!$this->lookupBlockName($blockName,$blockNo)) {
- $this->triggerError ("Undefined block name \"$blockName\" in \$EndBlock command in template at offset $cmdTPosBegin.");
- return false; }
- $this->currentNestingLevel -= 1;
- $btr =& $this->blockTab[$blockNo];
- if (!$btr['definitionIsOpen']) {
- $this->triggerError ("Multiple \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
- return false; }
- if ($btr['nestingLevel'] != $this->currentNestingLevel) {
- $this->triggerError ("Block nesting level mismatch at \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
- return false; }
- $btr['tPosContentsEnd'] = $cmdTPosBegin;
- $btr['tPosEnd'] = $cmdTPosEnd;
- $btr['definitionIsOpen'] = false;
- return true; }
-
-/**
-* @access private
-*/
-function registerBlock($blockName, &$blockNo) {
- $blockNo = $this->blockTabCnt++;
- $btr =& $this->blockTab[$blockNo];
- $btr = array();
- $btr['blockName'] = $blockName;
- if (!$this->lookupBlockName($blockName,$btr['nextWithSameName']))
- $btr['nextWithSameName'] = -1;
- $btr['definitionIsOpen'] = true;
- $btr['instances'] = 0;
- $btr['firstBlockInstNo'] = -1;
- $btr['lastBlockInstNo'] = -1;
- $btr['blockVarCnt'] = 0;
- $btr['firstVarRefNo'] = -1;
- $btr['blockVarNoToVarNoMap'] = array();
- $this->blockNameToNoMap[strtoupper($blockName)] = $blockNo; }
-
-/**
-* Checks that all block definitions are closed.
-* @return boolean true on success, false on error.
-* @access private
-*/
-function checkBlockDefinitionsComplete() {
- for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) {
- $btr =& $this->blockTab[$blockNo];
- if ($btr['definitionIsOpen']) {
- $this->triggerError ("Missing \$EndBlock command in template for block " . $btr['blockName'] . ".");
- return false; }}
- if ($this->currentNestingLevel != 0) {
- $this->triggerError ("Block nesting level error at end of template.");
- return false; }
- return true; }
-
-/**
-* Processes the $Include command.
-* @return boolean true on success, false on error.
-* @access private
-*/
-function processIncludeCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
- $p = 0;
- if (!$this->parseWordOrQuotedString($parms,$p,$subtemplateName)) {
- $this->triggerError ("Missing or invalid subtemplate name in \$Include command in template at offset $cmdTPosBegin.");
- return false; }
- if (trim(substr($parms,$p)) != '') {
- $this->triggerError ("Extra parameter in \$include command in template at offset $cmdTPosBegin.");
- return false; }
- return $this->insertSubtemplate($subtemplateName,$cmdTPosBegin,$cmdTPosEnd); }
-
-/**
-* Processes the $Include command.
-* @return boolean true on success, false on error.
-* @access private
-*/
-function insertSubtemplate ($subtemplateName, $tPos1, $tPos2) {
- if (strlen($this->template) > $this->maxInclTemplateSize) {
- $this->triggerError ("Subtemplate include aborted because the internal template string is longer than $this->maxInclTemplateSize characters.");
- return false; }
- if (!$this->loadSubtemplate($subtemplateName,$subtemplate)) return false;
- // (Copying the template to insert a subtemplate is a bit slow. In a future implementation of MiniTemplator,
- // a table could be used that contains references to the string fragments.)
- $this->template = substr($this->template,0,$tPos1) . $subtemplate . substr($this->template,$tPos2);
- return true; }
-
-/**
-* Parses variable references within the template in the format "${VarName}".
-* @return boolean true on success, false on error.
-* @access private
-*/
-function parseTemplateVariables() {
- $p = 0;
- while (true) {
- $p = strpos($this->template, '${', $p);
- if ($p === false) break;
- $p0 = $p;
- $p = strpos($this->template, '}', $p);
- if ($p === false) {
- $this->triggerError ("Invalid variable reference in template at offset $p0.");
- return false; }
- $p += 1;
- $varName = trim(substr($this->template, $p0+2, $p-$p0-3));
- if (strlen($varName) == 0) {
- $this->triggerError ("Empty variable name in template at offset $p0.");
- return false; }
- $this->registerVariableReference ($varName, $p0, $p); }
- return true; }
-
-/**
-* @access private
-*/
-function registerVariableReference ($varName, $tPosBegin, $tPosEnd) {
- if (!$this->lookupVariableName($varName,$varNo))
- $this->registerVariable($varName,$varNo);
- $varRefNo = $this->varRefTabCnt++;
- $vrtr =& $this->varRefTab[$varRefNo];
- $vrtr = array();
- $vrtr['tPosBegin'] = $tPosBegin;
- $vrtr['tPosEnd'] = $tPosEnd;
- $vrtr['varNo'] = $varNo; }
-
-/**
-* @access private
-*/
-function registerVariable ($varName, &$varNo) {
- $varNo = $this->varTabCnt++;
- $vtr =& $this->varTab[$varNo];
- $vtr = array();
- $vtr['varName'] = $varName;
- $vtr['varValue'] = '';
- $this->varNameToNoMap[strtoupper($varName)] = $varNo; }
-
-/**
-* Associates variable references with blocks.
-* @access private
-*/
-function associateVariablesWithBlocks() {
- $varRefNo = 0;
- $activeBlockNo = 0;
- $nextBlockNo = 1;
- while ($varRefNo < $this->varRefTabCnt) {
- $vrtr =& $this->varRefTab[$varRefNo];
- $varRefTPos = $vrtr['tPosBegin'];
- $varNo = $vrtr['varNo'];
- if ($varRefTPos >= $this->blockTab[$activeBlockNo]['tPosEnd']) {
- $activeBlockNo = $this->blockTab[$activeBlockNo]['parentBlockNo'];
- continue; }
- if ($nextBlockNo < $this->blockTabCnt) {
- if ($varRefTPos >= $this->blockTab[$nextBlockNo]['tPosBegin']) {
- $activeBlockNo = $nextBlockNo;
- $nextBlockNo += 1;
- continue; }}
- $btr =& $this->blockTab[$activeBlockNo];
- if ($varRefTPos < $btr['tPosBegin'])
- $this->programLogicError(1);
- $blockVarNo = $btr['blockVarCnt']++;
- $btr['blockVarNoToVarNoMap'][$blockVarNo] = $varNo;
- if ($btr['firstVarRefNo'] == -1)
- $btr['firstVarRefNo'] = $varRefNo;
- $vrtr['blockNo'] = $activeBlockNo;
- $vrtr['blockVarNo'] = $blockVarNo;
- $varRefNo += 1; }}
-
-//--- build up (template variables and blocks) ----------------------------------------------------------------------
-
-/**
-* Clears all variables and blocks.
-* This method can be used to produce another HTML page with the same
-* template. It is faster than creating another MiniTemplator object,
-* because the template does not have to be parsed again.
-* All variable values are cleared and all added block instances are deleted.
-* @access public
-*/
-function reset() {
- for ($varNo=0; $varNo<$this->varTabCnt; $varNo++)
- $this->varTab[$varNo]['varValue'] = '';
- for ($blockNo=0; $blockNo<$this->blockTabCnt; $blockNo++) {
- $btr =& $this->blockTab[$blockNo];
- $btr['instances'] = 0;
- $btr['firstBlockInstNo'] = -1;
- $btr['lastBlockInstNo'] = -1; }
- $this->blockInstTab = array();
- $this->blockInstTabCnt = 0; }
-
-/**
-* Sets a template variable.
-* For variables that are used in blocks, the variable value
-* must be set before {@link addBlock} is called.
-* @param string $variableName the name of the variable to be set.
-* @param string $variableValue the new value of the variable.
-* @param boolean $isOptional Specifies whether an error should be
-* generated when the variable does not exist in the template. If
-* $isOptional is false and the variable does not exist, an error is
-* generated.
-* @return boolean true on success, or false on error (e.g. when no
-* variable with the specified name exists in the template and
-* $isOptional is false).
-* @access public
-*/
-function setVariable ($variableName, $variableValue, $isOptional=false) {
- if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
- if (!$this->lookupVariableName($variableName,$varNo)) {
- if ($isOptional) return true;
- $this->triggerError ("Variable \"$variableName\" not defined in template.");
- return false; }
- $this->varTab[$varNo]['varValue'] = $variableValue;
- return true; }
-
-/**
-* Sets a template variable to an escaped string.
-* This method is identical to (@link setVariable), except that
-* the characters <, >, &, ' and " of variableValue are
-* replaced by their corresponding HTML/XML character entity codes.
-* For variables that are used in blocks, the variable value
-* must be set before {@link addBlock} is called.
-* @param string $variableName the name of the variable to be set.
-* @param string $variableValue the new value of the variable. Special HTML/XML characters are escaped.
-* @param boolean $isOptional Specifies whether an error should be
-* generated when the variable does not exist in the template. If
-* $isOptional is false and the variable does not exist, an error is
-* generated.
-* @return boolean true on success, or false on error (e.g. when no
-* variable with the specified name exists in the template and
-* $isOptional is false).
-* @access public
-*/
-function setVariableEsc ($variableName, $variableValue, $isOptional=false) {
- return $this->setVariable($variableName,htmlspecialchars($variableValue,ENT_QUOTES),$isOptional); }
-
-/**
-* Checks whether a variable with the specified name exists within the template.
-* @param string $variableName the name of the variable.
-* @return boolean true if the variable exists, or false when no
-* variable with the specified name exists in the template.
-* @access public
-*/
-function variableExists ($variableName) {
- if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
- return $this->lookupVariableName($variableName,$varNo); }
-
-/**
-* Adds an instance of a template block.
-* If the block contains variables, these variables must be set
-* before the block is added.
-* If the block contains subblocks (nested blocks), the subblocks
-* must be added before this block is added.
-* If multiple blocks exist with the specified name, an instance
-* is added for each block occurence.
-* @param string blockName the name of the block to be added.
-* @return boolean true on success, false on error (e.g. when no
-* block with the specified name exists in the template).
-* @access public
-*/
-function addBlock($blockName) {
- if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
- if (!$this->lookupBlockName($blockName,$blockNo)) {
- $this->triggerError ("Block \"$blockName\" not defined in template.");
- return false; }
- while ($blockNo != -1) {
- $this->addBlockByNo($blockNo);
- $blockNo = $this->blockTab[$blockNo]['nextWithSameName']; }
- return true; }
-
-/**
-* @access private
-*/
-function addBlockByNo ($blockNo) {
- $btr =& $this->blockTab[$blockNo];
- $this->registerBlockInstance ($blockInstNo);
- $bitr =& $this->blockInstTab[$blockInstNo];
- if ($btr['firstBlockInstNo'] == -1)
- $btr['firstBlockInstNo'] = $blockInstNo;
- if ($btr['lastBlockInstNo'] != -1)
- $this->blockInstTab[$btr['lastBlockInstNo']]['nextBlockInstNo'] = $blockInstNo;
- // set forward pointer of chain
- $btr['lastBlockInstNo'] = $blockInstNo;
- $parentBlockNo = $btr['parentBlockNo'];
- $blockVarCnt = $btr['blockVarCnt'];
- $bitr['blockNo'] = $blockNo;
- $bitr['instanceLevel'] = $btr['instances']++;
- if ($parentBlockNo == -1)
- $bitr['parentInstLevel'] = -1;
- else
- $bitr['parentInstLevel'] = $this->blockTab[$parentBlockNo]['instances'];
- $bitr['nextBlockInstNo'] = -1;
- $bitr['blockVarTab'] = array();
- // copy instance variables for this block
- for ($blockVarNo=0; $blockVarNo<$blockVarCnt; $blockVarNo++) {
- $varNo = $btr['blockVarNoToVarNoMap'][$blockVarNo];
- $bitr['blockVarTab'][$blockVarNo] = $this->varTab[$varNo]['varValue']; }}
-
-/**
-* @access private
-*/
-function registerBlockInstance (&$blockInstNo) {
- $blockInstNo = $this->blockInstTabCnt++; }
-
-/**
-* Checks whether a block with the specified name exists within the template.
-* @param string $blockName the name of the block.
-* @return boolean true if the block exists, or false when no
-* block with the specified name exists in the template.
-* @access public
-*/
-function blockExists ($blockName) {
- if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
- return $this->lookupBlockName($blockName,$blockNo); }
-
-//--- output generation ---------------------------------------------------------------------------------------------
-
-/**
-* Generates the HTML page and writes it to the PHP output stream.
-* @return boolean true on success, false on error.
-* @access public
-*/
-function generateOutput () {
- $this->outputMode = 0;
- if (!$this->generateOutputPage()) return false;
- return true; }
-
-/**
-* Generates the HTML page and writes it to a file.
-* @param string $fileName name of the output file.
-* @return boolean true on success, false on error.
-* @access public
-*/
-function generateOutputToFile ($fileName) {
- $fh = fopen($fileName,"wb");
- if ($fh === false) return false;
- $this->outputMode = 1;
- $this->outputFileHandle = $fh;
- $ok = $this->generateOutputPage();
- fclose ($fh);
- return $ok; }
-
-/**
-* Generates the HTML page and writes it to a string.
-* @param string $outputString variable that receives
-* the contents of the generated HTML page.
-* @return boolean true on success, false on error.
-* @access public
-*/
-function generateOutputToString (&$outputString) {
- $outputString = "Error";
- $this->outputMode = 2;
- $this->outputString = "";
- if (!$this->generateOutputPage()) return false;
- $outputString = $this->outputString;
- return true; }
-
-/**
-* @access private
-* @return boolean true on success, false on error.
-*/
-function generateOutputPage() {
- if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
- if ($this->blockTab[0]['instances'] == 0)
- $this->addBlockByNo (0); // add main block
- for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) {
- $btr =& $this->blockTab[$blockNo];
- $btr['currBlockInstNo'] = $btr['firstBlockInstNo']; }
- $this->outputError = false;
- $this->writeBlockInstances (0, -1);
- if ($this->outputError) return false;
- return true; }
-
-/**
-* Writes all instances of a block that are contained within a specific
-* parent block instance.
-* Called recursively.
-* @access private
-*/
-function writeBlockInstances ($blockNo, $parentInstLevel) {
- $btr =& $this->blockTab[$blockNo];
- while (!$this->outputError) {
- $blockInstNo = $btr['currBlockInstNo'];
- if ($blockInstNo == -1) break;
- $bitr =& $this->blockInstTab[$blockInstNo];
- if ($bitr['parentInstLevel'] < $parentInstLevel)
- $this->programLogicError (2);
- if ($bitr['parentInstLevel'] > $parentInstLevel) break;
- $this->writeBlockInstance ($blockInstNo);
- $btr['currBlockInstNo'] = $bitr['nextBlockInstNo']; }}
-
-/**
-* @access private
-*/
-function writeBlockInstance($blockInstNo) {
- $bitr =& $this->blockInstTab[$blockInstNo];
- $blockNo = $bitr['blockNo'];
- $btr =& $this->blockTab[$blockNo];
- $tPos = $btr['tPosContentsBegin'];
- $subBlockNo = $blockNo + 1;
- $varRefNo = $btr['firstVarRefNo'];
- while (!$this->outputError) {
- $tPos2 = $btr['tPosContentsEnd'];
- $kind = 0; // assume end-of-block
- if ($varRefNo != -1 && $varRefNo < $this->varRefTabCnt) { // check for variable reference
- $vrtr =& $this->varRefTab[$varRefNo];
- if ($vrtr['tPosBegin'] < $tPos) {
- $varRefNo += 1;
- continue; }
- if ($vrtr['tPosBegin'] < $tPos2) {
- $tPos2 = $vrtr['tPosBegin'];
- $kind = 1; }}
- if ($subBlockNo < $this->blockTabCnt) { // check for subblock
- $subBtr =& $this->blockTab[$subBlockNo];
- if ($subBtr['tPosBegin'] < $tPos) {
- $subBlockNo += 1;
- continue; }
- if ($subBtr['tPosBegin'] < $tPos2) {
- $tPos2 = $subBtr['tPosBegin'];
- $kind = 2; }}
- if ($tPos2 > $tPos)
- $this->writeString (substr($this->template,$tPos,$tPos2-$tPos));
- switch ($kind) {
- case 0: // end of block
- return;
- case 1: // variable
- $vrtr =& $this->varRefTab[$varRefNo];
- if ($vrtr['blockNo'] != $blockNo)
- $this->programLogicError (4);
- $variableValue = $bitr['blockVarTab'][$vrtr['blockVarNo']];
- $this->writeString ($variableValue);
- $tPos = $vrtr['tPosEnd'];
- $varRefNo += 1;
- break;
- case 2: // sub block
- $subBtr =& $this->blockTab[$subBlockNo];
- if ($subBtr['parentBlockNo'] != $blockNo)
- $this->programLogicError (3);
- $this->writeBlockInstances ($subBlockNo, $bitr['instanceLevel']); // recursive call
- $tPos = $subBtr['tPosEnd'];
- $subBlockNo += 1;
- break; }}}
-
-/**
-* @access private
-*/
-function writeString ($s) {
- if ($this->outputError) return;
- switch ($this->outputMode) {
- case 0: // output to PHP output stream
- if (!print($s))
- $this->outputError = true;
- break;
- case 1: // output to file
- $rc = fwrite($this->outputFileHandle, $s);
- if ($rc === false) $this->outputError = true;
- break;
- case 2: // output to string
- $this->outputString .= $s;
- break; }}
-
-//--- name lookup routines ------------------------------------------------------------------------------------------
-
-/**
-* Maps variable name to variable number.
-* @return boolean true on success, false if the variable is not found.
-* @access private
-*/
-function lookupVariableName ($varName, &$varNo) {
- $x =& $this->varNameToNoMap[strtoupper($varName)];
- if (!isset($x)) return false;
- $varNo = $x;
- return true; }
-
-/**
-* Maps block name to block number.
-* If there are multiple blocks with the same name, the block number of the last
-* registered block with that name is returned.
-* @return boolean true on success, false when the block is not found.
-* @access private
-*/
-function lookupBlockName ($blockName, &$blockNo) {
- $x =& $this->blockNameToNoMap[strtoupper($blockName)];
- if (!isset($x)) return false;
- $blockNo = $x;
- return true; }
-
-//--- general utility routines -----------------------------------------------------------------------------------------
-
-/**
-* Reads a file into a string.
-* @return boolean true on success, false on error.
-* @access private
-*/
-function readFileIntoString ($fileName, &$s) {
- if (function_exists('version_compare') && version_compare(phpversion(),"4.3.0",">=")) {
- $s = file_get_contents($fileName);
- if ($s === false) return false;
- return true; }
- $fh = fopen($fileName,"rb");
- if ($fh === false) return false;
- $fileSize = filesize($fileName);
- if ($fileSize === false) {fclose ($fh); return false; }
- $s = fread($fh,$fileSize);
- fclose ($fh);
- if (strlen($s) != $fileSize) return false;
- return true; }
-
-/**
-* @access private
-* @return boolean true on success, false when the end of the string is reached.
-*/
-function parseWord ($s, &$p, &$w) {
- $sLen = strlen($s);
- while ($p < $sLen && ord($s{$p}) <= 32) $p++;
- if ($p >= $sLen) return false;
- $p0 = $p;
- while ($p < $sLen && ord($s{$p}) > 32) $p++;
- $w = substr($s, $p0, $p - $p0);
- return true; }
-
-/**
-* @access private
-* @return boolean true on success, false on error.
-*/
-function parseQuotedString ($s, &$p, &$w) {
- $sLen = strlen($s);
- while ($p < $sLen && ord($s{$p}) <= 32) $p++;
- if ($p >= $sLen) return false;
- if (substr($s,$p,1) != '"') return false;
- $p++; $p0 = $p;
- while ($p < $sLen && $s{$p} != '"') $p++;
- if ($p >= $sLen) return false;
- $w = substr($s, $p0, $p - $p0);
- $p++;
- return true; }
-
-/**
-* @access private
-* @return boolean true on success, false on error.
-*/
-function parseWordOrQuotedString ($s, &$p, &$w) {
- $sLen = strlen($s);
- while ($p < $sLen && ord($s{$p}) <= 32) $p++;
- if ($p >= $sLen) return false;
- if (substr($s,$p,1) == '"')
- return $this->parseQuotedString($s,$p,$w);
- else
- return $this->parseWord($s,$p,$w); }
-
-/**
-* Combine two file system paths.
-* @access private
-*/
-function combineFileSystemPath ($path1, $path2) {
- if ($path1 == '' || $path2 == '') return $path2;
- $s = $path1;
- if (substr($s,-1) != '\\' && substr($s,-1) != '/') $s = $s . "/";
- if (substr($path2,0,1) == '\\' || substr($path2,0,1) == '/')
- $s = $s . substr($path2,1);
- else
- $s = $s . $path2;
- return $s; }
-
-/**
-* @access private
-*/
-function triggerError ($msg) {
- trigger_error ("MiniTemplator error: $msg", E_USER_ERROR); }
-
-/**
-* @access private
-*/
-function programLogicError ($errorId) {
- die ("MiniTemplator: Program logic error $errorId.\n"); }
-
-}
-?>
+<?php +/** +* File MiniTemplator.class.php +* @package MiniTemplator +*/ + +/** +* A compact template engine for HTML files. +* +* Requires PHP 4.0.4 or newer. +* +* <pre> +* Template syntax: +* +* Variables: +* ${VariableName} +* +* Blocks: +* <!-- $BeginBlock BlockName --> +* ... block content ... +* <!-- $EndBlock BlockName --> +* +* Include a subtemplate: +* <!-- $Include RelativeFileName --> +* </pre> +* +* <pre> +* General remarks: +* - Variable names and block names are case-insensitive. +* - The same variable may be used multiple times within a template. +* - Blocks can be nested. +* - Multiple blocks with the same name may occur within a template. +* </pre> +* +* <pre> +* Public methods: +* readTemplateFromFile - Reads the template from a file. +* setTemplateString - Assigns a new template string. +* setVariable - Sets a template variable. +* setVariableEsc - Sets a template variable to an escaped string value. +* variableExists - Checks whether a template variable exists. +* addBlock - Adds an instance of a template block. +* blockExists - Checks whether a block exists. +* reset - Clears all variables and blocks. +* generateOutput - Generates the HTML page and writes it to the PHP output stream. +* generateOutputToFile - Generates the HTML page and writes it to a file. +* generateOutputToString - Generates the HTML page and writes it to a string. +* </pre> +* +* Home page: {@link http://www.source-code.biz/MiniTemplator}<br> +* License: This module is released under the GNU/LGPL license ({@link http://www.gnu.org/licenses/lgpl.html}).<br> +* Copyright 2003: Christian d'Heureuse, Inventec Informatik AG, Switzerland. All rights reserved.<br> +* This product is provided "as is" without warranty of any kind.<br> +* +* Version history:<br> +* 2001-10-24 Christian d'Heureuse (chdh): VBasic version created.<br> +* 2002-01-26 Markus Angst: ported to PHP4.<br> +* 2003-04-07 chdh: changes to adjust to Java version.<br> +* 2003-07-08 chdh: Method variableExists added. +* Method setVariable changed to trigger an error when the variable does not exist.<br> +* 2004-04-07 chdh: Parameter isOptional added to method setVariable. +* Licensing changed from GPL to LGPL.<br> +* 2004-04-18 chdh: Method blockExists added.<br> +* 2004-10-28 chdh:<br> +* Method setVariableEsc added.<br> +* Multiple blocks with the same name may now occur within a template.<br> +* No error ("unknown command") is generated any more, if a HTML comment starts with "${".<br> +* 2004-11-06 chdh:<br> +* "$Include" command implemented.<br> +* 2004-11-20 chdh:<br> +* "$Include" command changed so that the command text is not copied to the output file.<br> +*/ + +class MiniTemplator { + +//--- public member variables --------------------------------------------------------------------------------------- + +/** +* Base path for relative file names of subtemplates (for the $Include command). +* This path is prepended to the subtemplate file names. It must be set before +* readTemplateFromFile or setTemplateString. +* @access public +*/ +var $subtemplateBasePath; + +//--- private member variables -------------------------------------------------------------------------------------- + +/**#@+ +* @access private +*/ + +var $maxNestingLevel = 50; // maximum number of block nestings +var $maxInclTemplateSize = 1000000; // maximum length of template string when including subtemplates +var $template; // Template file data +var $varTab; // variables table, array index is variable no + // Fields: + // varName // variable name + // varValue // variable value +var $varTabCnt; // no of entries used in VarTab +var $varNameToNoMap; // maps variable names to variable numbers +var $varRefTab; // variable references table + // Contains an entry for each variable reference in the template. Ordered by TemplatePos. + // Fields: + // varNo // variable no + // tPosBegin // template position of begin of variable reference + // tPosEnd // template position of end of variable reference + // blockNo // block no of the (innermost) block that contains this variable reference + // blockVarNo // block variable no. Index into BlockInstTab.BlockVarTab +var $varRefTabCnt; // no of entries used in VarRefTab +var $blockTab; // Blocks table, array index is block no + // Contains an entry for each block in the template. Ordered by TPosBegin. + // Fields: + // blockName // block name + // nextWithSameName; // block no of next block with same name or -1 (blocks are backward linked in relation to template position) + // tPosBegin // template position of begin of block + // tPosContentsBegin // template pos of begin of block contents + // tPosContentsEnd // template pos of end of block contents + // tPosEnd // template position of end of block + // nestingLevel // block nesting level + // parentBlockNo // block no of parent block + // definitionIsOpen // true while $BeginBlock processed but no $EndBlock + // instances // number of instances of this block + // firstBlockInstNo // block instance no of first instance of this block or -1 + // lastBlockInstNo // block instance no of last instance of this block or -1 + // currBlockInstNo // current block instance no, used during generation of output file + // blockVarCnt // no of variables in block + // blockVarNoToVarNoMap // maps block variable numbers to variable numbers + // firstVarRefNo // variable reference no of first variable of this block or -1 +var $blockTabCnt; // no of entries used in BlockTab +var $blockNameToNoMap; // maps block names to block numbers +var $openBlocksTab; + // During parsing, this table contains the block numbers of the open parent blocks (nested outer blocks). + // Indexed by the block nesting level. +var $blockInstTab; // block instances table + // This table contains an entry for each block instance that has been added. + // Indexed by BlockInstNo. + // Fields: + // blockNo // block number + // instanceLevel // instance level of this block + // InstanceLevel is an instance counter per block. + // (In contrast to blockInstNo, which is an instance counter over the instances of all blocks) + // parentInstLevel // instance level of parent block + // nextBlockInstNo // pointer to next instance of this block or -1 + // Forward chain for instances of same block. + // blockVarTab // block instance variables +var $blockInstTabCnt; // no of entries used in BlockInstTab + +var $currentNestingLevel; // Current block nesting level during parsing. +var $templateValid; // true if a valid template is prepared +var $outputMode; // 0 = to PHP output stream, 1 = to file, 2 = to string +var $outputFileHandle; // file handle during writing of output file +var $outputError; // true when an output error occurred +var $outputString; // string buffer for the generated HTML page + +/**#@-*/ + +//--- constructor --------------------------------------------------------------------------------------------------- + +/** +* Constructs a MiniTemplator object. +* @access public +*/ +function __construct() { + $this->templateValid = false; } + +//--- template string handling -------------------------------------------------------------------------------------- + +/** +* Reads the template from a file. +* @param string $fileName name of the file that contains the template. +* @return boolean true on success, false on error. +* @access public +*/ +function readTemplateFromFile ($fileName) { + if (!$this->readFileIntoString($fileName,$s)) { + $this->triggerError ("Error while reading template file " . $fileName . "."); + return false; } + if (!$this->setTemplateString($s)) return false; + return true; } + +/** +* Assigns a new template string. +* @param string $templateString contents of the template file. +* @return boolean true on success, false on error. +* @access public +*/ +function setTemplateString ($templateString) { + $this->templateValid = false; + $this->template = $templateString; + if (!$this->parseTemplate()) return false; + $this->reset(); + $this->templateValid = true; + return true; } + +/** +* Loads the template string for a subtemplate (used for the $Include command). +* @return boolean true on success, false on error. +* @access private +*/ +function loadSubtemplate ($subtemplateName, &$s) { + $subtemplateFileName = $this->combineFileSystemPath($this->subtemplateBasePath,$subtemplateName); + if (!$this->readFileIntoString($subtemplateFileName,$s)) { + $this->triggerError ("Error while reading subtemplate file " . $subtemplateFileName . "."); + return false; } + return true; } + +//--- template parsing ---------------------------------------------------------------------------------------------- + +/** +* Parses the template. +* @return boolean true on success, false on error. +* @access private +*/ +function parseTemplate() { + $this->initParsing(); + $this->beginMainBlock(); + if (!$this->parseTemplateCommands()) return false; + $this->endMainBlock(); + if (!$this->checkBlockDefinitionsComplete()) return false; + if (!$this->parseTemplateVariables()) return false; + $this->associateVariablesWithBlocks(); + return true; } + +/** +* @access private +*/ +function initParsing() { + $this->varTab = array(); + $this->varTabCnt = 0; + $this->varNameToNoMap = array(); + $this->varRefTab = array(); + $this->varRefTabCnt = 0; + $this->blockTab = array(); + $this->blockTabCnt = 0; + $this->blockNameToNoMap = array(); + $this->openBlocksTab = array(); } + +/** +* Registers the main block. +* The main block is an implicitly defined block that covers the whole template. +* @access private +*/ +function beginMainBlock() { + $blockNo = 0; + $this->registerBlock('@@InternalMainBlock@@', $blockNo); + $bte =& $this->blockTab[$blockNo]; + $bte['tPosBegin'] = 0; + $bte['tPosContentsBegin'] = 0; + $bte['nestingLevel'] = 0; + $bte['parentBlockNo'] = -1; + $bte['definitionIsOpen'] = true; + $this->openBlocksTab[0] = $blockNo; + $this->currentNestingLevel = 1; } + +/** +* Completes the main block registration. +* @access private +*/ +function endMainBlock() { + $bte =& $this->blockTab[0]; + $bte['tPosContentsEnd'] = strlen($this->template); + $bte['tPosEnd'] = strlen($this->template); + $bte['definitionIsOpen'] = false; + $this->currentNestingLevel -= 1; } + +/** +* Parses commands within the template in the format "<!-- $command parameters -->". +* @return boolean true on success, false on error. +* @access private +*/ +function parseTemplateCommands() { + $p = 0; + while (true) { + $p0 = strpos($this->template,'<!--',$p); + if ($p0 === false) break; + $p = strpos($this->template,'-->',$p0); + if ($p === false) { + $this->triggerError ("Invalid HTML comment in template at offset $p0."); + return false; } + $p += 3; + $cmdL = substr($this->template,$p0+4,$p-$p0-7); + if (!$this->processTemplateCommand($cmdL,$p0,$p,$resumeFromStart)) + return false; + if ($resumeFromStart) $p = $p0; } + return true; } + +/** +* @return boolean true on success, false on error. +* @access private +*/ +function processTemplateCommand ($cmdL, $cmdTPosBegin, $cmdTPosEnd, &$resumeFromStart) { + $resumeFromStart = false; + $p = 0; + $cmd = ''; + if (!$this->parseWord($cmdL,$p,$cmd)) return true; + $parms = substr($cmdL,$p); + switch (strtoupper($cmd)) { + case '$BEGINBLOCK': + if (!$this->processBeginBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd)) + return false; + break; + case '$ENDBLOCK': + if (!$this->processEndBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd)) + return false; + break; + case '$INCLUDE': + if (!$this->processincludeCmd($parms,$cmdTPosBegin,$cmdTPosEnd)) + return false; + $resumeFromStart = true; + break; + default: + if ($cmd[0] == '$' && !(strlen($cmd) >= 2 && $cmd[1] == '{')) { + $this->triggerError ("Unknown command \"$cmd\" in template at offset $cmdTPosBegin."); + return false; }} + return true; } + +/** +* Processes the $BeginBlock command. +* @return boolean true on success, false on error. +* @access private +*/ +function processBeginBlockCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) { + $p = 0; + if (!$this->parseWord($parms,$p,$blockName)) { + $this->triggerError ("Missing block name in \$BeginBlock command in template at offset $cmdTPosBegin."); + return false; } + if (trim(substr($parms,$p)) != '') { + $this->triggerError ("Extra parameter in \$BeginBlock command in template at offset $cmdTPosBegin."); + return false; } + $this->registerBlock ($blockName, $blockNo); + $btr =& $this->blockTab[$blockNo]; + $btr['tPosBegin'] = $cmdTPosBegin; + $btr['tPosContentsBegin'] = $cmdTPosEnd; + $btr['nestingLevel'] = $this->currentNestingLevel; + $btr['parentBlockNo'] = $this->openBlocksTab[$this->currentNestingLevel-1]; + $this->openBlocksTab[$this->currentNestingLevel] = $blockNo; + $this->currentNestingLevel += 1; + if ($this->currentNestingLevel > $this->maxNestingLevel) { + $this->triggerError ("Block nesting overflow in template at offset $cmdTPosBegin."); + return false; } + return true; } + +/** +* Processes the $EndBlock command. +* @return boolean true on success, false on error. +* @access private +*/ +function processEndBlockCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) { + $p = 0; + if (!$this->parseWord($parms,$p,$blockName)) { + $this->triggerError ("Missing block name in \$EndBlock command in template at offset $cmdTPosBegin."); + return false; } + if (trim(substr($parms,$p)) != '') { + $this->triggerError ("Extra parameter in \$EndBlock command in template at offset $cmdTPosBegin."); + return false; } + if (!$this->lookupBlockName($blockName,$blockNo)) { + $this->triggerError ("Undefined block name \"$blockName\" in \$EndBlock command in template at offset $cmdTPosBegin."); + return false; } + $this->currentNestingLevel -= 1; + $btr =& $this->blockTab[$blockNo]; + if (!$btr['definitionIsOpen']) { + $this->triggerError ("Multiple \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin."); + return false; } + if ($btr['nestingLevel'] != $this->currentNestingLevel) { + $this->triggerError ("Block nesting level mismatch at \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin."); + return false; } + $btr['tPosContentsEnd'] = $cmdTPosBegin; + $btr['tPosEnd'] = $cmdTPosEnd; + $btr['definitionIsOpen'] = false; + return true; } + +/** +* @access private +*/ +function registerBlock($blockName, &$blockNo) { + $blockNo = $this->blockTabCnt++; + $btr =& $this->blockTab[$blockNo]; + $btr = array(); + $btr['blockName'] = $blockName; + if (!$this->lookupBlockName($blockName,$btr['nextWithSameName'])) + $btr['nextWithSameName'] = -1; + $btr['definitionIsOpen'] = true; + $btr['instances'] = 0; + $btr['firstBlockInstNo'] = -1; + $btr['lastBlockInstNo'] = -1; + $btr['blockVarCnt'] = 0; + $btr['firstVarRefNo'] = -1; + $btr['blockVarNoToVarNoMap'] = array(); + $this->blockNameToNoMap[strtoupper($blockName)] = $blockNo; } + +/** +* Checks that all block definitions are closed. +* @return boolean true on success, false on error. +* @access private +*/ +function checkBlockDefinitionsComplete() { + for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) { + $btr =& $this->blockTab[$blockNo]; + if ($btr['definitionIsOpen']) { + $this->triggerError ("Missing \$EndBlock command in template for block " . $btr['blockName'] . "."); + return false; }} + if ($this->currentNestingLevel != 0) { + $this->triggerError ("Block nesting level error at end of template."); + return false; } + return true; } + +/** +* Processes the $Include command. +* @return boolean true on success, false on error. +* @access private +*/ +function processIncludeCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) { + $p = 0; + if (!$this->parseWordOrQuotedString($parms,$p,$subtemplateName)) { + $this->triggerError ("Missing or invalid subtemplate name in \$Include command in template at offset $cmdTPosBegin."); + return false; } + if (trim(substr($parms,$p)) != '') { + $this->triggerError ("Extra parameter in \$include command in template at offset $cmdTPosBegin."); + return false; } + return $this->insertSubtemplate($subtemplateName,$cmdTPosBegin,$cmdTPosEnd); } + +/** +* Processes the $Include command. +* @return boolean true on success, false on error. +* @access private +*/ +function insertSubtemplate ($subtemplateName, $tPos1, $tPos2) { + if (strlen($this->template) > $this->maxInclTemplateSize) { + $this->triggerError ("Subtemplate include aborted because the internal template string is longer than $this->maxInclTemplateSize characters."); + return false; } + if (!$this->loadSubtemplate($subtemplateName,$subtemplate)) return false; + // (Copying the template to insert a subtemplate is a bit slow. In a future implementation of MiniTemplator, + // a table could be used that contains references to the string fragments.) + $this->template = substr($this->template,0,$tPos1) . $subtemplate . substr($this->template,$tPos2); + return true; } + +/** +* Parses variable references within the template in the format "${VarName}". +* @return boolean true on success, false on error. +* @access private +*/ +function parseTemplateVariables() { + $p = 0; + while (true) { + $p = strpos($this->template, '${', $p); + if ($p === false) break; + $p0 = $p; + $p = strpos($this->template, '}', $p); + if ($p === false) { + $this->triggerError ("Invalid variable reference in template at offset $p0."); + return false; } + $p += 1; + $varName = trim(substr($this->template, $p0+2, $p-$p0-3)); + if (strlen($varName) == 0) { + $this->triggerError ("Empty variable name in template at offset $p0."); + return false; } + $this->registerVariableReference ($varName, $p0, $p); } + return true; } + +/** +* @access private +*/ +function registerVariableReference ($varName, $tPosBegin, $tPosEnd) { + if (!$this->lookupVariableName($varName,$varNo)) + $this->registerVariable($varName,$varNo); + $varRefNo = $this->varRefTabCnt++; + $vrtr =& $this->varRefTab[$varRefNo]; + $vrtr = array(); + $vrtr['tPosBegin'] = $tPosBegin; + $vrtr['tPosEnd'] = $tPosEnd; + $vrtr['varNo'] = $varNo; } + +/** +* @access private +*/ +function registerVariable ($varName, &$varNo) { + $varNo = $this->varTabCnt++; + $vtr =& $this->varTab[$varNo]; + $vtr = array(); + $vtr['varName'] = $varName; + $vtr['varValue'] = ''; + $this->varNameToNoMap[strtoupper($varName)] = $varNo; } + +/** +* Associates variable references with blocks. +* @access private +*/ +function associateVariablesWithBlocks() { + $varRefNo = 0; + $activeBlockNo = 0; + $nextBlockNo = 1; + while ($varRefNo < $this->varRefTabCnt) { + $vrtr =& $this->varRefTab[$varRefNo]; + $varRefTPos = $vrtr['tPosBegin']; + $varNo = $vrtr['varNo']; + if ($varRefTPos >= $this->blockTab[$activeBlockNo]['tPosEnd']) { + $activeBlockNo = $this->blockTab[$activeBlockNo]['parentBlockNo']; + continue; } + if ($nextBlockNo < $this->blockTabCnt) { + if ($varRefTPos >= $this->blockTab[$nextBlockNo]['tPosBegin']) { + $activeBlockNo = $nextBlockNo; + $nextBlockNo += 1; + continue; }} + $btr =& $this->blockTab[$activeBlockNo]; + if ($varRefTPos < $btr['tPosBegin']) + $this->programLogicError(1); + $blockVarNo = $btr['blockVarCnt']++; + $btr['blockVarNoToVarNoMap'][$blockVarNo] = $varNo; + if ($btr['firstVarRefNo'] == -1) + $btr['firstVarRefNo'] = $varRefNo; + $vrtr['blockNo'] = $activeBlockNo; + $vrtr['blockVarNo'] = $blockVarNo; + $varRefNo += 1; }} + +//--- build up (template variables and blocks) ---------------------------------------------------------------------- + +/** +* Clears all variables and blocks. +* This method can be used to produce another HTML page with the same +* template. It is faster than creating another MiniTemplator object, +* because the template does not have to be parsed again. +* All variable values are cleared and all added block instances are deleted. +* @access public +*/ +function reset() { + for ($varNo=0; $varNo<$this->varTabCnt; $varNo++) + $this->varTab[$varNo]['varValue'] = ''; + for ($blockNo=0; $blockNo<$this->blockTabCnt; $blockNo++) { + $btr =& $this->blockTab[$blockNo]; + $btr['instances'] = 0; + $btr['firstBlockInstNo'] = -1; + $btr['lastBlockInstNo'] = -1; } + $this->blockInstTab = array(); + $this->blockInstTabCnt = 0; } + +/** +* Sets a template variable. +* For variables that are used in blocks, the variable value +* must be set before {@link addBlock} is called. +* @param string $variableName the name of the variable to be set. +* @param string $variableValue the new value of the variable. +* @param boolean $isOptional Specifies whether an error should be +* generated when the variable does not exist in the template. If +* $isOptional is false and the variable does not exist, an error is +* generated. +* @return boolean true on success, or false on error (e.g. when no +* variable with the specified name exists in the template and +* $isOptional is false). +* @access public +*/ +function setVariable ($variableName, $variableValue, $isOptional=false) { + if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; } + if (!$this->lookupVariableName($variableName,$varNo)) { + if ($isOptional) return true; + $this->triggerError ("Variable \"$variableName\" not defined in template."); + return false; } + $this->varTab[$varNo]['varValue'] = $variableValue; + return true; } + +/** +* Sets a template variable to an escaped string. +* This method is identical to (@link setVariable), except that +* the characters <, >, &, ' and " of variableValue are +* replaced by their corresponding HTML/XML character entity codes. +* For variables that are used in blocks, the variable value +* must be set before {@link addBlock} is called. +* @param string $variableName the name of the variable to be set. +* @param string $variableValue the new value of the variable. Special HTML/XML characters are escaped. +* @param boolean $isOptional Specifies whether an error should be +* generated when the variable does not exist in the template. If +* $isOptional is false and the variable does not exist, an error is +* generated. +* @return boolean true on success, or false on error (e.g. when no +* variable with the specified name exists in the template and +* $isOptional is false). +* @access public +*/ +function setVariableEsc ($variableName, $variableValue, $isOptional=false) { + return $this->setVariable($variableName,htmlspecialchars($variableValue,ENT_QUOTES),$isOptional); } + +/** +* Checks whether a variable with the specified name exists within the template. +* @param string $variableName the name of the variable. +* @return boolean true if the variable exists, or false when no +* variable with the specified name exists in the template. +* @access public +*/ +function variableExists ($variableName) { + if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; } + return $this->lookupVariableName($variableName,$varNo); } + +/** +* Adds an instance of a template block. +* If the block contains variables, these variables must be set +* before the block is added. +* If the block contains subblocks (nested blocks), the subblocks +* must be added before this block is added. +* If multiple blocks exist with the specified name, an instance +* is added for each block occurence. +* @param string blockName the name of the block to be added. +* @return boolean true on success, false on error (e.g. when no +* block with the specified name exists in the template). +* @access public +*/ +function addBlock($blockName) { + if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; } + if (!$this->lookupBlockName($blockName,$blockNo)) { + $this->triggerError ("Block \"$blockName\" not defined in template."); + return false; } + while ($blockNo != -1) { + $this->addBlockByNo($blockNo); + $blockNo = $this->blockTab[$blockNo]['nextWithSameName']; } + return true; } + +/** +* @access private +*/ +function addBlockByNo ($blockNo) { + $btr =& $this->blockTab[$blockNo]; + $this->registerBlockInstance ($blockInstNo); + $bitr =& $this->blockInstTab[$blockInstNo]; + if ($btr['firstBlockInstNo'] == -1) + $btr['firstBlockInstNo'] = $blockInstNo; + if ($btr['lastBlockInstNo'] != -1) + $this->blockInstTab[$btr['lastBlockInstNo']]['nextBlockInstNo'] = $blockInstNo; + // set forward pointer of chain + $btr['lastBlockInstNo'] = $blockInstNo; + $parentBlockNo = $btr['parentBlockNo']; + $blockVarCnt = $btr['blockVarCnt']; + $bitr['blockNo'] = $blockNo; + $bitr['instanceLevel'] = $btr['instances']++; + if ($parentBlockNo == -1) + $bitr['parentInstLevel'] = -1; + else + $bitr['parentInstLevel'] = $this->blockTab[$parentBlockNo]['instances']; + $bitr['nextBlockInstNo'] = -1; + $bitr['blockVarTab'] = array(); + // copy instance variables for this block + for ($blockVarNo=0; $blockVarNo<$blockVarCnt; $blockVarNo++) { + $varNo = $btr['blockVarNoToVarNoMap'][$blockVarNo]; + $bitr['blockVarTab'][$blockVarNo] = $this->varTab[$varNo]['varValue']; }} + +/** +* @access private +*/ +function registerBlockInstance (&$blockInstNo) { + $blockInstNo = $this->blockInstTabCnt++; } + +/** +* Checks whether a block with the specified name exists within the template. +* @param string $blockName the name of the block. +* @return boolean true if the block exists, or false when no +* block with the specified name exists in the template. +* @access public +*/ +function blockExists ($blockName) { + if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; } + return $this->lookupBlockName($blockName,$blockNo); } + +//--- output generation --------------------------------------------------------------------------------------------- + +/** +* Generates the HTML page and writes it to the PHP output stream. +* @return boolean true on success, false on error. +* @access public +*/ +function generateOutput () { + $this->outputMode = 0; + if (!$this->generateOutputPage()) return false; + return true; } + +/** +* Generates the HTML page and writes it to a file. +* @param string $fileName name of the output file. +* @return boolean true on success, false on error. +* @access public +*/ +function generateOutputToFile ($fileName) { + $fh = fopen($fileName,"wb"); + if ($fh === false) return false; + $this->outputMode = 1; + $this->outputFileHandle = $fh; + $ok = $this->generateOutputPage(); + fclose ($fh); + return $ok; } + +/** +* Generates the HTML page and writes it to a string. +* @param string $outputString variable that receives +* the contents of the generated HTML page. +* @return boolean true on success, false on error. +* @access public +*/ +function generateOutputToString (&$outputString) { + $outputString = "Error"; + $this->outputMode = 2; + $this->outputString = ""; + if (!$this->generateOutputPage()) return false; + $outputString = $this->outputString; + return true; } + +/** +* @access private +* @return boolean true on success, false on error. +*/ +function generateOutputPage() { + if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; } + if ($this->blockTab[0]['instances'] == 0) + $this->addBlockByNo (0); // add main block + for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) { + $btr =& $this->blockTab[$blockNo]; + $btr['currBlockInstNo'] = $btr['firstBlockInstNo']; } + $this->outputError = false; + $this->writeBlockInstances (0, -1); + if ($this->outputError) return false; + return true; } + +/** +* Writes all instances of a block that are contained within a specific +* parent block instance. +* Called recursively. +* @access private +*/ +function writeBlockInstances ($blockNo, $parentInstLevel) { + $btr =& $this->blockTab[$blockNo]; + while (!$this->outputError) { + $blockInstNo = $btr['currBlockInstNo']; + if ($blockInstNo == -1) break; + $bitr =& $this->blockInstTab[$blockInstNo]; + if ($bitr['parentInstLevel'] < $parentInstLevel) + $this->programLogicError (2); + if ($bitr['parentInstLevel'] > $parentInstLevel) break; + $this->writeBlockInstance ($blockInstNo); + $btr['currBlockInstNo'] = $bitr['nextBlockInstNo']; }} + +/** +* @access private +*/ +function writeBlockInstance($blockInstNo) { + $bitr =& $this->blockInstTab[$blockInstNo]; + $blockNo = $bitr['blockNo']; + $btr =& $this->blockTab[$blockNo]; + $tPos = $btr['tPosContentsBegin']; + $subBlockNo = $blockNo + 1; + $varRefNo = $btr['firstVarRefNo']; + while (!$this->outputError) { + $tPos2 = $btr['tPosContentsEnd']; + $kind = 0; // assume end-of-block + if ($varRefNo != -1 && $varRefNo < $this->varRefTabCnt) { // check for variable reference + $vrtr =& $this->varRefTab[$varRefNo]; + if ($vrtr['tPosBegin'] < $tPos) { + $varRefNo += 1; + continue; } + if ($vrtr['tPosBegin'] < $tPos2) { + $tPos2 = $vrtr['tPosBegin']; + $kind = 1; }} + if ($subBlockNo < $this->blockTabCnt) { // check for subblock + $subBtr =& $this->blockTab[$subBlockNo]; + if ($subBtr['tPosBegin'] < $tPos) { + $subBlockNo += 1; + continue; } + if ($subBtr['tPosBegin'] < $tPos2) { + $tPos2 = $subBtr['tPosBegin']; + $kind = 2; }} + if ($tPos2 > $tPos) + $this->writeString (substr($this->template,$tPos,$tPos2-$tPos)); + switch ($kind) { + case 0: // end of block + return; + case 1: // variable + $vrtr =& $this->varRefTab[$varRefNo]; + if ($vrtr['blockNo'] != $blockNo) + $this->programLogicError (4); + $variableValue = $bitr['blockVarTab'][$vrtr['blockVarNo']]; + $this->writeString ($variableValue); + $tPos = $vrtr['tPosEnd']; + $varRefNo += 1; + break; + case 2: // sub block + $subBtr =& $this->blockTab[$subBlockNo]; + if ($subBtr['parentBlockNo'] != $blockNo) + $this->programLogicError (3); + $this->writeBlockInstances ($subBlockNo, $bitr['instanceLevel']); // recursive call + $tPos = $subBtr['tPosEnd']; + $subBlockNo += 1; + break; }}} + +/** +* @access private +*/ +function writeString ($s) { + if ($this->outputError) return; + switch ($this->outputMode) { + case 0: // output to PHP output stream + print $s; + break; + case 1: // output to file + $rc = fwrite($this->outputFileHandle, $s); + if ($rc === false) $this->outputError = true; + break; + case 2: // output to string + $this->outputString .= $s; + break; }} + +//--- name lookup routines ------------------------------------------------------------------------------------------ + +/** +* Maps variable name to variable number. +* @return boolean true on success, false if the variable is not found. +* @access private +*/ +function lookupVariableName ($varName, &$varNo) { + $x =& $this->varNameToNoMap[strtoupper($varName)]; + if (!isset($x)) return false; + $varNo = $x; + return true; } + +/** +* Maps block name to block number. +* If there are multiple blocks with the same name, the block number of the last +* registered block with that name is returned. +* @return boolean true on success, false when the block is not found. +* @access private +*/ +function lookupBlockName ($blockName, &$blockNo) { + $x =& $this->blockNameToNoMap[strtoupper($blockName)]; + if (!isset($x)) return false; + $blockNo = $x; + return true; } + +//--- general utility routines ----------------------------------------------------------------------------------------- + +/** +* Reads a file into a string. +* @return boolean true on success, false on error. +* @access private +*/ +function readFileIntoString ($fileName, &$s) { + if (function_exists('version_compare') && version_compare(phpversion(),"4.3.0",">=")) { + $s = file_get_contents($fileName); + if ($s === false) return false; + return true; } + $fh = fopen($fileName,"rb"); + if ($fh === false) return false; + $fileSize = filesize($fileName); + if ($fileSize === false) {fclose ($fh); return false; } + $s = fread($fh,$fileSize); + fclose ($fh); + if (strlen($s) != $fileSize) return false; + return true; } + +/** +* @access private +* @return boolean true on success, false when the end of the string is reached. +*/ +function parseWord ($s, &$p, &$w) { + $sLen = strlen($s); + while ($p < $sLen && ord($s[$p]) <= 32) $p++; + if ($p >= $sLen) return false; + $p0 = $p; + while ($p < $sLen && ord($s[$p]) > 32) $p++; + $w = substr($s, $p0, $p - $p0); + return true; } + +/** +* @access private +* @return boolean true on success, false on error. +*/ +function parseQuotedString ($s, &$p, &$w) { + $sLen = strlen($s); + while ($p < $sLen && ord($s[$p]) <= 32) $p++; + if ($p >= $sLen) return false; + if (substr($s,$p,1) != '"') return false; + $p++; $p0 = $p; + while ($p < $sLen && $s[$p] != '"') $p++; + if ($p >= $sLen) return false; + $w = substr($s, $p0, $p - $p0); + $p++; + return true; } + +/** +* @access private +* @return boolean true on success, false on error. +*/ +function parseWordOrQuotedString ($s, &$p, &$w) { + $sLen = strlen($s); + while ($p < $sLen && ord($s[$p]) <= 32) $p++; + if ($p >= $sLen) return false; + if (substr($s,$p,1) == '"') + return $this->parseQuotedString($s,$p,$w); + else + return $this->parseWord($s,$p,$w); } + +/** +* Combine two file system paths. +* @access private +*/ +function combineFileSystemPath ($path1, $path2) { + if ($path1 == '' || $path2 == '') return $path2; + $s = $path1; + if (substr($s,-1) != '\\' && substr($s,-1) != '/') $s = $s . "/"; + if (substr($path2,0,1) == '\\' || substr($path2,0,1) == '/') + $s = $s . substr($path2,1); + else + $s = $s . $path2; + return $s; } + +/** +* @access private +*/ +function triggerError ($msg) { + trigger_error ("MiniTemplator error: $msg", E_USER_ERROR); } + +/** +* @access private +*/ +function programLogicError ($errorId) { + die ("MiniTemplator: Program logic error $errorId.\n"); } + +} +?> diff --git a/lib/gettext/gettext.inc b/lib/gettext/gettext.inc.php index c9f7dc016..ed5be6bbd 100644 --- a/lib/gettext/gettext.inc +++ b/lib/gettext/gettext.inc.php @@ -69,10 +69,10 @@ function get_list_of_locales($locale) { * sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr. */ $locale_names = array(); - $lang = NULL; - $country = NULL; - $charset = NULL; - $modifier = NULL; + $lang = null; + $country = null; + $charset = null; + $modifier = null; if ($locale) { if (preg_match("/^(?P<lang>[a-z]{2,3})" // language code ."(?:_(?P<country>[A-Z]{2}))?" // country code diff --git a/lib/gettext/gettext.php b/lib/gettext/gettext.php index edbd93304..173d4c448 100755 --- a/lib/gettext/gettext.php +++ b/lib/gettext/gettext.php @@ -21,6 +21,8 @@ */ +require('plurals.php'); + /** * Provides a simple gettext replacement that works independently from * the system's gettext abilities. @@ -39,16 +41,16 @@ class gettext_reader { //private: var $BYTEORDER = 0; // 0: low endian, 1: big endian - var $STREAM = NULL; + var $STREAM = null; var $short_circuit = false; var $enable_cache = false; - var $originals = NULL; // offset of original table - var $translations = NULL; // offset of translation table - var $pluralheader = NULL; // cache header field for plural forms + var $originals = null; // offset of original table + var $translations = null; // offset of translation table + var $pluralheader = null; // cache header field for plural forms var $total = 0; // total string count - var $table_originals = NULL; // table for original strings (offsets) - var $table_translations = NULL; // table for translated strings (offsets) - var $cache_translations = NULL; // original -> translation mapping + var $table_originals = null; // table for original strings (offsets) + var $table_translations = null; // table for translated strings (offsets) + var $cache_translations = null; // original -> translation mapping /* Methods */ @@ -270,41 +272,6 @@ class gettext_reader { } /** - * Sanitize plural form expression for use in PHP eval call. - * - * @access private - * @return string sanitized plural form expression - */ - function sanitize_plural_expression($expr) { - // Get rid of disallowed characters. - $expr = preg_replace('@[^a-zA-Z0-9_:;\(\)\?\|\&=!<>+*/\%-]@', '', $expr); - - // Add parenthesis for tertiary '?' operator. - $expr .= ';'; - $res = ''; - $p = 0; - for ($i = 0; $i < strlen($expr); $i++) { - $ch = $expr[$i]; - switch ($ch) { - case '?': - $res .= ' ? ('; - $p++; - break; - case ':': - $res .= ') : ('; - break; - case ';': - $res .= str_repeat( ')', $p) . ';'; - $p = 0; - break; - default: - $res .= $ch; - } - } - return $res; - } - - /** * Parse full PO header and extract only plural forms line. * * @access private @@ -327,17 +294,17 @@ class gettext_reader { function get_plural_forms() { // lets assume message number 0 is header // this is true, right? - $this->load_tables(); + $this->load_tables(); // cache header field for plural forms - if (! is_string($this->pluralheader)) { + if ($this->pluralheader === null) { if ($this->enable_cache) { $header = $this->cache_translations[""]; } else { $header = $this->get_translation_string(0); } $expr = $this->extract_plural_forms_header_from_po_header($header); - $this->pluralheader = $this->sanitize_plural_expression($expr); + $this->pluralheader = new PluralHeader($expr); } return $this->pluralheader; } @@ -353,17 +320,14 @@ class gettext_reader { if (!is_int($n)) { throw new InvalidArgumentException( "Select_string only accepts integers: " . $n); - } - $string = $this->get_plural_forms(); - $string = str_replace('nplurals',"\$total",$string); - $string = str_replace("n",$n,$string); - $string = str_replace('plural',"\$plural",$string); + } + + $plural_header = $this->get_plural_forms(); + $plural = $plural_header->expression->evaluate($n); - $total = 0; - $plural = 0; + if ($plural < 0) $plural = 0; + if ($plural >= $plural_header->total) $plural = $plural_header->total - 1; - eval("$string"); - if ($plural >= $total) $plural = $total - 1; return $plural; } @@ -387,7 +351,7 @@ class gettext_reader { // find out the appropriate form $select = $this->select_string($number); - // this should contains all strings separated by NULLs + // this should contains all strings separated by nulls $key = $single . chr(0) . $plural; diff --git a/lib/gettext/plurals.php b/lib/gettext/plurals.php new file mode 100644 index 000000000..332f5e97c --- /dev/null +++ b/lib/gettext/plurals.php @@ -0,0 +1,461 @@ +<?php +/* + Copyright (c) 2020 Sunil Mohan Adapa <sunil at medhas dot org> + + Drop in replacement for native gettext. + + This file is part of PHP-gettext. + + PHP-gettext is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + PHP-gettext is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with PHP-gettext; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + +/** + * Lexical analyzer for gettext plurals expression. Takes a string to parse + * during construction and returns a single token every time peek() or + * fetch_token() are called. The special string '__END__' is returned if there + * are no more tokens to be read. Spaces are ignored during tokenization. + */ +class PluralsLexer { + private $string; + private $position; + + /** + * Constructor + * + * @param string string Contains the value gettext plurals expression to + * analyze. + */ + public function __construct(string $string) { + $this->string = $string; + $this->position = 0; + } + + /** + * Return the next token and the length to advance the read position without + * actually advancing the read position. Tokens for operators and variables + * are simple strings containing the operator or variable. If there are no + * more token to provide, the special value ['__END__', 0] is returned. If + * there was an unexpected input an Exception is raised. + * + * @access private + * @throws Exception If there is unexpected input in the provided string. + * @return array The next token and length to advance the current position. + */ + private function _tokenize() { + $buf = $this->string; + + // Consume all spaces until the next token + $index = $this->position; + while ($index < strlen($buf) && $buf[$index] == ' ') { + $index++; + } + $this->position = $index; + + // Return special token if next of the string is reached. + if (strlen($buf) - $index == 0) { + return ['__END__', 0]; + } + + // Operators with two characters + $doubles = ['==', '!=', '>=', '<=', '&&', '||']; + $next = substr($buf, $index, 2); + if (in_array($next, $doubles)) { + return [$next, 2]; + } + + // Operators with single character or variable 'n'. + $singles = [ + 'n', '(', ')', '?', ':', '+', '-', '*', '/', '%', '!', '>', '<']; + if (in_array($buf[$index], $singles)) { + return [$buf[$index], 1]; + } + + // Whole number constants, return an integer. + $digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; + $pos = $index; + while ($pos < strlen($buf) && in_array($buf[$pos], $digits)) { + $pos++; + } + if ($pos != $index) { + $length = $pos - $index; + return [(int)substr($buf, $index, $length), $length]; + } + + // Throw and exception for all other unexpected input in the string. + throw new Exception('Lexical analysis failed'); + } + + /** + * Return the next token without actually advancing the read position. + * Tokens for operators and variables are simple strings containing the + * operator or variable. If there are no more tokens to provide, the special + * value '__END__' is returned. If there was an unexpected input an + * Exception is raised. + * + * @throws Exception If there is unexpected input in the provided string. + * @return string The next token. + */ + public function peek() { + list($token, $length) = $this->_tokenize(); + return $token; + } + + /** + * Return the next token after advancing the read position. Tokens for + * operators and variables are simple strings containing the operator or + * variable. If there are no more token to provide, the special value + * '__END__' is returned. If there was an unexpected input an Exception is + * raised. + * + * @throws Exception If there is unexpected input in the provided string. + * @return string The next token. + */ + public function fetch_token() { + list($token, $length) = $this->_tokenize(); + $this->position += $length; + return $token; + } +} + +/** + * A parsed representation of the gettext plural expression. This is a tree + * containing further expressions depending on how nested the given input is. + * Calling the evaluate() function computes the value of the expression if the + * variable 'n' is set a certain value. This is used to decide which plural + * string translation to use based on the number items at hand. + */ +class PluralsExpression { + private $operator; + private $operands; + + const BINARY_OPERATORS = [ + '==', '!=', '>=', '<=', '&&', '||', '+', '-', '*', '/', '%', '>', '<']; + const UNARY_OPERATORS = ['!']; + + /** + * Constructor + * + * @param string Operator for the expression. + * @param (int|string|PuralsExpression)[] Variable number of operands of the + * expression. One int operand is expected in case the operator is 'const'. + * One string operand with value 'n' is expected in case the operator is + * 'var'. For all other operators, the operands much be objects of type + * PluralExpression. Unary operators expect one operand, binary operators + * expect two operands and trinary operators expect three operands. + */ + public function __construct($operator, ...$operands) { + $this->operator = $operator; + $this->operands = $operands; + } + + /** + * Return a parenthesized string representation of the expression for + * debugging purposes. + * + * @return string A string representation of the expression. + */ + public function to_string() { + if ($this->operator == 'const' || $this->operator == 'var') { + return $this->operands[0]; + } elseif (in_array($this->operator, self::BINARY_OPERATORS)) { + return sprintf( + "(%s %s %s)", $this->operands[0]->to_string(), $this->operator, + $this->operands[1]->to_string()); + } elseif (in_array($this->operator, self::UNARY_OPERATORS)) { + return sprintf( + "(%s %s)", $this->operator, $this->operands[0]->to_string()); + } elseif ($this->operator == '?') { + return sprintf( + "(%s ? %s : %s)", $this->operands[0]->to_string(), + $this->operands[1]->to_string(), + $this->operands[2]->to_string()); + } + } + + /** + * Return the computed value of the expression if the variable 'n' is set to + * a certain value. + * + * @param int The value of the variable n to use when evaluating. + * @throws Exception If the expression has been constructed incorrectly. + * @return int The value of the expression after evaluation. + */ + public function evaluate($n) { + if (!in_array($this->operator, ['const', 'var'])) { + $operand1 = $this->operands[0]->evaluate($n); + } + if (in_array($this->operator, self::BINARY_OPERATORS) || + $this->operator == '?') { + $operand2 = $this->operands[1]->evaluate($n); + } + if ($this->operator == '?') { + $operand3 = $this->operands[2]->evaluate($n); + } + + switch ($this->operator) { + case 'const': + return $this->operands[0]; + case 'var': + return $n; + case '!': + return !($operand1); + case '==': + return $operand1 == $operand2; + case '!=': + return $operand1 != $operand2; + case '>=': + return $operand1 >= $operand2; + case '<=': + return $operand1 <= $operand2; + case '>': + return $operand1 > $operand2; + case '<': + return $operand1 < $operand2; + case '&&': + return $operand1 && $operand2; + case '||': + return $operand1 || $operand2; + case '+': + return $operand1 + $operand2; + case '-': + return $operand1 - $operand2; + case '*': + return $operand1 * $operand2; + case '/': + return (int)($operand1 / $operand2); + case '%': + return $operand1 % $operand2; + case '?': + return $operand1 ? $operand2 : $operand3; + default: + throw new Exception('Invalid expression'); + } + } +} + +/** + * A simple operator-precedence parser for gettext plural expressions. Takes a + * string during construction and returns a PluralsExpression tree when + * parse() is called. + */ +class PluralsParser { + private $lexer; + + /* + * Operator precedence. The parsing only happens with minimum precedence of + * 0. However, ':' and ')' exist here to make sure that parsing does not + * proceed beyond them when they are not to be parsed. + */ + const PREC = [ + ':' => -1, '?' => 0, '||' => 1, '&&' => 2, '==' => 3, '!=' => 3, + '>' => 4, '<' => 4, '>=' => 4, '<=' => 4, '+' => 5, '-' => 5, '*' => 6, + '/' => 6, '%' => 6, '!' => 7, '__END__' => -1, ')' => -1 + ]; + + // List of right associative operators + const RIGHT_ASSOC = ['?']; + + /** + * Constructor + * + * @param string string the plural expression to be parsed. + */ + public function __construct(string $string) { + $this->lexer = new PluralsLexer($string); + } + + /** + * Expect a primary next for parsing and return a PluralsExpression or throw + * and exception otherwise. A primary can be the variable 'n', an whole + * number constant, a unary operator expression string with '!', or a + * parenthesis expression. + * + * @throws Exception If the next token is not a primary or if parenthesis + * expression is not closes properly with ')'. + * @return PluralsExpression That is constructed from the parsed primary. + */ + private function _parse_primary() { + $token = $this->lexer->fetch_token(); + if ($token === 'n') { + return new PluralsExpression('var', 'n'); + } elseif (is_int($token)) { + return new PluralsExpression('const', (int)$token); + } elseif ($token === '!') { + return new PluralsExpression('!', $this->_parse_primary()); + } elseif ($token === '(') { + $result = $this->_parse($this->_parse_primary(), 0); + if ($this->lexer->fetch_token() != ')') { + throw new Exception('Mismatched parenthesis'); + } + return $result; + } + + throw new Exception('Primary expected'); + } + + /** + * Fetch an operator from the lexical analyzer and test for it. Optionally + * advance the position of the lexical analyzer to next token. Raise + * exception if the token retrieved is not an operator. + * + * @access private + * @param bool peek A flag to indicate whether the position of the lexical + * analyzer should *not* be advanced. If false, the lexical analyzer is + * advanced by one token. + * @throws Exception If the token read is not an operator. + * @return string The operator that has been fetched from the lexical + * analyzer. + */ + private function _parse_operator($peek) { + if ($peek) { + $token = $this->lexer->peek(); + } else { + $token = $this->lexer->fetch_token(); + } + + if ($token !== null && !array_key_exists($token, self::PREC)) { + throw new Exception('Operator expected'); + } + return $token; + } + + /** + * A parsing method suitable for recursion. + * + * @access private + * @param ParserExpression left_side A pre-parsed left-hand side expression + * of the file expression to be constructed. This helps with recursion. + * @param int min_precedence The minimum value of precedence for the + * operators to be considered for parsing. Parsing will stop and current + * expression is returned if an operator of a lower precedence is + * encountered. + * @throws Exception If the input string does not conform to the grammar of + * the gettext plural expression. + * @return ParserExpression A complete expression after parsing. + */ + private function _parse($left_side, $min_precedence) { + $next_token = $this->_parse_operator(true); + + while (self::PREC[$next_token] >= $min_precedence) { + $operator = $this->_parse_operator(false); + $right_side = $this->_parse_primary(); + + $next_token = $this->_parse_operator(true); + + /* + * Consume (recursively) into right hand side all expressions of higher + * precedence. + */ + while ((self::PREC[$operator] < self::PREC[$next_token]) || + ((self::PREC[$operator] == self::PREC[$next_token]) && + in_array($operator, self::RIGHT_ASSOC))) { + $right_side = $this->_parse( + $right_side, self::PREC[$next_token]); + $next_token = $this->_parse_operator(true); + } + + if ($operator != '?') { + /* + * Handling for all binary operators. Consume into left hand side all + * expressions of equal precedence. + */ + $left_side = new PluralsExpression($operator, $left_side, $right_side); + } else { + // Special handling for (a ? b : c) expression + $operator = $this->lexer->fetch_token(); + if ($operator != ':') { + throw new Exception('Invalid ? expression'); + } + + $right_side2 = $this->_parse( + $this->_parse_primary(), self::PREC[$operator] + 1); + $next_token = $this->_parse_operator(true); + $left_side = new PluralsExpression( + '?', $left_side, $right_side, $right_side2); + } + } + return $left_side; + } + + /** + * A simple implementation of an operator-precedence parser. See: + * https://en.wikipedia.org/wiki/Operator-precedence_parser for an analysis + * of the algorithm. + * + * @throws Exception If the input string does not conform to the grammar of + * the gettext plural expression. + * @return ParserExpression A complete expression after parsing. + */ + public function parse() { + $expression = $this->_parse($this->_parse_primary(), 0); + // Special handling for an extra ')' at the end. + if ($this->lexer->peek() != '__END__') { + throw new Exception('Could not parse completely'); + } + return $expression; + } +} + +/** + * Provides a class to parse the value of the 'Plural-Forms:' header in the + * gettext translation files. Holds the expression tree and the number of + * plurals after parsing. Parsing happens during construction which takes as + * its only argument the string to parse. Error during parsing are silently + * suppressed and the fallback behavior is used with the value for Germanic + * languages as follows: "nplurals=2; plural=n == 1 ? 0 : 1;". + */ +class PluralHeader { + public $total; + public $expression; + + /** + * Constructor + * + * @param string The value of the Plural-Forms: header as seen in .po files. + */ + function __construct($string) { + try { + list($total, $expression) = $this->parse($string); + } catch (Exception $e) { + $string = "nplurals=2; plural=n == 1 ? 0 : 1;"; + list($total, $expression) = $this->parse($string); + } + $this->total = $total; + $this->expression = $expression; + } + + /** + * Return the number of plural forms and the parsed expression tree. + * + * @access private + * @param string string The value of the Plural-Forms: header. + * @throws Exception If the string could not be parsed. + * @return array The number of plural forms and parsed expression tree. + */ + private function parse($string) { + $regex = "/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural\s*=([^;]+);/i"; + if (preg_match($regex, $string, $matches)) { + $total = (int)$matches[1]; + $expression_string = $matches[2]; + } else { + throw new Exception('Invalid header value'); + } + + $parser = new PluralsParser($expression_string); + $expression = $parser->parse(); + return [$total, $expression]; + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..d20c66112 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "tt-rss", + "version": "1.0.0", + "description": "", + "devDependencies": { + "eslint": "^7.9.0", + "gulp": "^4.0.2", + "gulp-less": "^4.0.1", + "less": "^3.12.2" + } +} diff --git a/plugins/af_comics/filters/af_comics_cad.php b/plugins/af_comics/filters/af_comics_cad.php index d2eb38caf..5da82ae3f 100644 --- a/plugins/af_comics/filters/af_comics_cad.php +++ b/plugins/af_comics/filters/af_comics_cad.php @@ -6,14 +6,14 @@ class Af_Comics_Cad extends Af_ComicFilter { } function process(&$article) { - if (strpos($article["link"], "cad-comic.com") !== FALSE) { - if (strpos($article["title"], "News:") === FALSE) { + if (strpos($article["link"], "cad-comic.com") !== false) { + if (strpos($article["title"], "News:") === false) { global $fetch_last_error_content; $doc = new DOMDocument(); - $res = fetch_file_contents($article["link"], false, false, false, + $res = UrlHelper::fetch($article["link"], false, false, false, false, false, 0, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0"); diff --git a/plugins/af_comics/filters/af_comics_comicclass.php b/plugins/af_comics/filters/af_comics_comicclass.php index b4b3a962c..ff32375d3 100644 --- a/plugins/af_comics/filters/af_comics_comicclass.php +++ b/plugins/af_comics/filters/af_comics_comicclass.php @@ -6,12 +6,12 @@ class Af_Comics_ComicClass extends Af_ComicFilter { } function process(&$article) { - if (strpos($article["guid"], "loadingartist.com") !== FALSE) { + if (strpos($article["guid"], "loadingartist.com") !== false) { // lol at people who block clients by user agent // oh noes my ad revenue Q_Q - $res = fetch_file_contents($article["link"], false, false, false, + $res = UrlHelper::fetch($article["link"], false, false, false, false, false, 0, "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); diff --git a/plugins/af_comics/filters/af_comics_comicpress.php b/plugins/af_comics/filters/af_comics_comicpress.php index 7755bcb1a..29b064612 100755 --- a/plugins/af_comics/filters/af_comics_comicpress.php +++ b/plugins/af_comics/filters/af_comics_comicpress.php @@ -7,18 +7,18 @@ class Af_Comics_ComicPress extends Af_ComicFilter { } function process(&$article) { - if (strpos($article["guid"], "bunicomic.com") !== FALSE || - strpos($article["guid"], "buttersafe.com") !== FALSE || - strpos($article["guid"], "extrafabulouscomics.com") !== FALSE || - strpos($article["guid"], "happyjar.com") !== FALSE || - strpos($article["guid"], "nedroid.com") !== FALSE || - strpos($article["guid"], "stonetoss.com") !== FALSE || - strpos($article["guid"], "csectioncomics.com") !== FALSE) { + if (strpos($article["guid"], "bunicomic.com") !== false || + strpos($article["guid"], "buttersafe.com") !== false || + strpos($article["guid"], "extrafabulouscomics.com") !== false || + strpos($article["guid"], "happyjar.com") !== false || + strpos($article["guid"], "nedroid.com") !== false || + strpos($article["guid"], "stonetoss.com") !== false || + strpos($article["guid"], "csectioncomics.com") !== false) { // lol at people who block clients by user agent // oh noes my ad revenue Q_Q - $res = fetch_file_contents(["url" => $article["link"], + $res = UrlHelper::fetch(["url" => $article["link"], "useragent" => "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"]); $doc = new DOMDocument(); @@ -37,7 +37,7 @@ class Af_Comics_ComicPress extends Af_ComicFilter { if ($webtoon_link) { - $res = fetch_file_contents(["url" => $webtoon_link->getAttribute("href"), + $res = UrlHelper::fetch(["url" => $webtoon_link->getAttribute("href"), "useragent" => "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"]); if (@$doc->loadHTML($res)) { diff --git a/plugins/af_comics/filters/af_comics_darklegacy.php b/plugins/af_comics/filters/af_comics_darklegacy.php index 0882514d0..978545431 100644 --- a/plugins/af_comics/filters/af_comics_darklegacy.php +++ b/plugins/af_comics/filters/af_comics_darklegacy.php @@ -7,9 +7,9 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter { function process(&$article) { - if (strpos($article["guid"], "darklegacycomics.com") !== FALSE) { + if (strpos($article["guid"], "darklegacycomics.com") !== false) { - $res = fetch_file_contents($article["link"], false, false, false, + $res = UrlHelper::fetch($article["link"], false, false, false, false, false, 0, "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); diff --git a/plugins/af_comics/filters/af_comics_dilbert.php b/plugins/af_comics/filters/af_comics_dilbert.php index a40f8a9ba..31a72d88d 100644 --- a/plugins/af_comics/filters/af_comics_dilbert.php +++ b/plugins/af_comics/filters/af_comics_dilbert.php @@ -7,10 +7,10 @@ class Af_Comics_Dilbert extends Af_ComicFilter { } function process(&$article) { - if (strpos($article["link"], "dilbert.com") !== FALSE || - strpos($article["link"], "/DilbertDailyStrip") !== FALSE) { + if (strpos($article["link"], "dilbert.com") !== false || + strpos($article["link"], "/DilbertDailyStrip") !== false) { - $res = fetch_file_contents($article["link"], false, false, false, + $res = UrlHelper::fetch($article["link"], false, false, false, false, false, 0, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0"); diff --git a/plugins/af_comics/filters/af_comics_explosm.php b/plugins/af_comics/filters/af_comics_explosm.php index c47014da4..bfe38e53b 100644 --- a/plugins/af_comics/filters/af_comics_explosm.php +++ b/plugins/af_comics/filters/af_comics_explosm.php @@ -7,11 +7,11 @@ class Af_Comics_Explosm extends Af_ComicFilter { function process(&$article) { - if (strpos($article["link"], "explosm.net/comics") !== FALSE) { + if (strpos($article["link"], "explosm.net/comics") !== false) { $doc = new DOMDocument(); - if (@$doc->loadHTML(fetch_file_contents($article["link"]))) { + if (@$doc->loadHTML(UrlHelper::fetch($article["link"]))) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('(//img[@id="main-comic"])')->item(0); diff --git a/plugins/af_comics/filters/af_comics_gocomics.php b/plugins/af_comics/filters/af_comics_gocomics.php index 791dc07d3..949b7a235 100644 --- a/plugins/af_comics/filters/af_comics_gocomics.php +++ b/plugins/af_comics/filters/af_comics_gocomics.php @@ -29,15 +29,13 @@ class Af_Comics_Gocomics extends Af_ComicFilter { $article_link = $site_url . date('/Y/m/d'); - $body = fetch_file_contents(array('url' => $article_link, 'type' => 'text/html', 'followlocation' => false)); - - require_once 'lib/MiniTemplator.class.php'; + $body = UrlHelper::fetch(array('url' => $article_link, 'type' => 'text/html', 'followlocation' => false)); $feed_title = htmlspecialchars($comic[1]); $site_url = htmlspecialchars($site_url); $article_link = htmlspecialchars($article_link); - $tpl = new MiniTemplator(); + $tpl = new Templator(); $tpl->readTemplateFromFile('templates/generated_feed.txt'); diff --git a/plugins/af_comics/filters/af_comics_gocomics_farside.php b/plugins/af_comics/filters/af_comics_gocomics_farside.php index 783907e17..9663da8f9 100644 --- a/plugins/af_comics/filters/af_comics_gocomics_farside.php +++ b/plugins/af_comics/filters/af_comics_gocomics_farside.php @@ -25,11 +25,10 @@ class Af_Comics_Gocomics_FarSide extends Af_ComicFilter { public function on_fetch($url) { if (preg_match("#^https?://www\.thefarside\.com#", $url)) { - require_once 'lib/MiniTemplator.class.php'; $article_link = htmlspecialchars("https://www.thefarside.com" . date('/Y/m/d')); - $tpl = new MiniTemplator(); + $tpl = new Templator(); $tpl->readTemplateFromFile('templates/generated_feed.txt'); @@ -38,7 +37,7 @@ class Af_Comics_Gocomics_FarSide extends Af_ComicFilter { $tpl->setVariable('FEED_URL', htmlspecialchars($url), true); $tpl->setVariable('SELF_URL', htmlspecialchars($url), true); - $body = fetch_file_contents(['url' => $article_link, 'type' => 'text/html', 'followlocation' => false]); + $body = UrlHelper::fetch(['url' => $article_link, 'type' => 'text/html', 'followlocation' => false]); if ($body) { $doc = new DOMDocument(); diff --git a/plugins/af_comics/filters/af_comics_pa.php b/plugins/af_comics/filters/af_comics_pa.php index 7a60feabb..380e84596 100644 --- a/plugins/af_comics/filters/af_comics_pa.php +++ b/plugins/af_comics/filters/af_comics_pa.php @@ -6,11 +6,11 @@ class Af_Comics_Pa extends Af_ComicFilter { } function process(&$article) { - if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "Comic:") !== FALSE) { + if (strpos($article["link"], "penny-arcade.com") !== false && strpos($article["title"], "Comic:") !== false) { $doc = new DOMDocument(); - if ($doc->loadHTML(fetch_file_contents($article["link"]))) { + if ($doc->loadHTML(UrlHelper::fetch($article["link"]))) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0); @@ -22,10 +22,10 @@ class Af_Comics_Pa extends Af_ComicFilter { return true; } - if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "News Post:") !== FALSE) { + if (strpos($article["link"], "penny-arcade.com") !== false && strpos($article["title"], "News Post:") !== false) { $doc = new DOMDocument(); - if ($doc->loadHTML(fetch_file_contents($article["link"]))) { + if ($doc->loadHTML(UrlHelper::fetch($article["link"]))) { $xpath = new DOMXPath($doc); $entries = $xpath->query('(//div[@class="post"])'); diff --git a/plugins/af_comics/filters/af_comics_pvp.php b/plugins/af_comics/filters/af_comics_pvp.php index cf0b79d78..105d3f490 100644 --- a/plugins/af_comics/filters/af_comics_pvp.php +++ b/plugins/af_comics/filters/af_comics_pvp.php @@ -6,9 +6,9 @@ class Af_Comics_Pvp extends Af_ComicFilter { } function process(&$article) { - if (strpos($article["guid"], "pvponline.com") !== FALSE) { + if (strpos($article["guid"], "pvponline.com") !== false) { - $res = fetch_file_contents($article["link"], false, false, false, + $res = UrlHelper::fetch($article["link"], false, false, false, false, false, 0, "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); diff --git a/plugins/af_comics/filters/af_comics_tfd.php b/plugins/af_comics/filters/af_comics_tfd.php index 376ec0714..e0216705c 100644 --- a/plugins/af_comics/filters/af_comics_tfd.php +++ b/plugins/af_comics/filters/af_comics_tfd.php @@ -6,9 +6,9 @@ class Af_Comics_Tfd extends Af_ComicFilter { } function process(&$article) { - if (strpos($article["link"], "toothpastefordinner.com") !== FALSE || - strpos($article["link"], "marriedtothesea.com") !== FALSE) { - $res = fetch_file_contents($article["link"], false, false, false, + if (strpos($article["link"], "toothpastefordinner.com") !== false || + strpos($article["link"], "marriedtothesea.com") !== false) { + $res = UrlHelper::fetch($article["link"], false, false, false, false, false, 0, "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); @@ -16,7 +16,7 @@ class Af_Comics_Tfd extends Af_ComicFilter { $doc = new DOMDocument(); - if (@$doc->loadHTML(fetch_file_contents($article["link"]))) { + if (@$doc->loadHTML(UrlHelper::fetch($article["link"]))) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0); diff --git a/plugins/af_comics/filters/af_comics_twp.php b/plugins/af_comics/filters/af_comics_twp.php index f53b89b63..38a8ca32b 100644 --- a/plugins/af_comics/filters/af_comics_twp.php +++ b/plugins/af_comics/filters/af_comics_twp.php @@ -7,11 +7,11 @@ class Af_Comics_Twp extends Af_ComicFilter { function process(&$article) { - if (strpos($article["link"], "threewordphrase.com") !== FALSE) { + if (strpos($article["link"], "threewordphrase.com") !== false) { $doc = new DOMDocument(); - if (@$doc->loadHTML(fetch_file_contents($article["link"]))) { + if (@$doc->loadHTML(UrlHelper::fetch($article["link"]))) { $xpath = new DOMXpath($doc); $basenode = $xpath->query("//td/center/img")->item(0); diff --git a/plugins/af_comics/filters/af_comics_whomp.php b/plugins/af_comics/filters/af_comics_whomp.php index d574bf5d3..021a2952a 100644 --- a/plugins/af_comics/filters/af_comics_whomp.php +++ b/plugins/af_comics/filters/af_comics_whomp.php @@ -6,9 +6,9 @@ class Af_Comics_Whomp extends Af_ComicFilter { } function process(&$article) { - if (strpos($article["guid"], "whompcomic.com") !== FALSE) { + if (strpos($article["guid"], "whompcomic.com") !== false) { - $res = fetch_file_contents($article["link"], false, false, false, + $res = UrlHelper::fetch($article["link"], false, false, false, false, false, 0, "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); diff --git a/plugins/af_comics/init.php b/plugins/af_comics/init.php index d07220894..c99d4b1d8 100755 --- a/plugins/af_comics/init.php +++ b/plugins/af_comics/init.php @@ -27,7 +27,7 @@ class Af_Comics extends Plugin { foreach ($filters as $file) { $filter_name = preg_replace("/\..*$/", "", basename($file)); - if (array_search($filter_name, $names) === FALSE) { + if (array_search($filter_name, $names) === false) { if (!class_exists($filter_name)) { require_once $file; } diff --git a/plugins/af_proxy_http/init.php b/plugins/af_proxy_http/init.php index 80100160d..2d9ae59b5 100644 --- a/plugins/af_proxy_http/init.php +++ b/plugins/af_proxy_http/init.php @@ -28,6 +28,9 @@ class Af_Proxy_Http extends Plugin { $host->add_hook($host::HOOK_ENCLOSURE_ENTRY, $this); $host->add_hook($host::HOOK_PREFS_TAB, $this); + + if (!$_SESSION['af_proxy_http_token']) + $_SESSION['af_proxy_http_token'] = bin2hex(get_random_bytes(16)); } function hook_enclosure_entry($enc) { @@ -45,11 +48,10 @@ class Af_Proxy_Http extends Plugin { } public function imgproxy() { - - $url = rewrite_relative_url(get_self_url_prefix(), $_REQUEST["url"]); + $url = UrlHelper::validate(clean($_REQUEST["url"])); // called without user context, let's just redirect to original URL - if (!$_SESSION["uid"]) { + if (!$_SESSION["uid"] || $_REQUEST['af_proxy_http_token'] != $_SESSION['af_proxy_http_token']) { header("Location: $url"); return; } @@ -59,22 +61,14 @@ class Af_Proxy_Http extends Plugin { if ($this->cache->exists($local_filename)) { header("Location: " . $this->cache->getUrl($local_filename)); return; - //$this->cache->send($local_filename); } else { - $data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]); + $data = UrlHelper::fetch(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]); if ($data) { - - $disable_cache = $this->host->get($this, "disable_cache"); - - if (!$disable_cache) { - if ($this->cache->put($local_filename, $data)) { - header("Location: " . $this->cache->getUrl($local_filename)); - return; - } + if ($this->cache->put($local_filename, $data)) { + header("Location: " . $this->cache->getUrl($local_filename)); + return; } - - print $data; } else { global $fetch_last_error; global $fetch_last_error_code; @@ -97,14 +91,13 @@ class Af_Proxy_Http extends Plugin { imagedestroy($img); } else { - header("Content-type: text/html"); + header("Content-type: text/plain"); http_response_code(400); - print "<h1>Proxy request failed.</h1>"; - print "<p>Fetch error $fetch_last_error ($fetch_last_error_code)</p>"; - print "<p>URL: $url</p>"; - print "<textarea cols='80' rows='25'>" . htmlspecialchars($fetch_last_error_content) . "</textarea>"; + print "Proxy request failed.\n". + "Fetch error $fetch_last_error ($fetch_last_error_code)\n". + "Requested URL: $url"; } } } @@ -132,7 +125,7 @@ class Af_Proxy_Http extends Plugin { foreach (explode(" " , $this->ssl_known_whitelist) as $host) { if (substr(strtolower($parts['host']), -strlen($host)) === strtolower($host)) { $parts['scheme'] = 'https'; - $url = build_url($parts); + $url = UrlHelper::build_url($parts); if ($all_remote && $is_remote) { break; } else { @@ -141,7 +134,8 @@ class Af_Proxy_Http extends Plugin { } } - return $this->host->get_public_method_url($this, "imgproxy", ["url" => $url]); + return $this->host->get_public_method_url($this, "imgproxy", + ["url" => $url, "af_proxy_http_token" => $_SESSION["af_proxy_http_token"]]); } } } @@ -208,7 +202,7 @@ class Af_Proxy_Http extends Plugin { function hook_prefs_tab($args) { if ($args != "prefFeeds") return; - print "<div dojoType=\"dijit.layout.AccordionPane\" + print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"<i class='material-icons'>extension</i> ".__('Image proxy settings (af_proxy_http)')."\">"; print "<form dojoType=\"dijit.form.Form\">"; @@ -235,10 +229,6 @@ class Af_Proxy_Http extends Plugin { print_checkbox("proxy_all", $proxy_all); print " <label for=\"proxy_all\">" . __("Enable proxy for all remote images.") . "</label><br/>"; - $disable_cache = $this->host->get($this, "disable_cache"); - print_checkbox("disable_cache", $disable_cache); - print " <label for=\"disable_cache\">" . __("Don't cache files locally.") . "</label>"; - print "<p>"; print_button("submit", __("Save")); print "</form>"; @@ -248,10 +238,8 @@ class Af_Proxy_Http extends Plugin { function save() { $proxy_all = checkbox_to_sql_bool($_POST["proxy_all"]); - $disable_cache = checkbox_to_sql_bool($_POST["disable_cache"]); $this->host->set($this, "proxy_all", $proxy_all, false); - $this->host->set($this, "disable_cache", $disable_cache); echo __("Configuration saved"); } diff --git a/plugins/af_psql_trgm/init.php b/plugins/af_psql_trgm/init.php index dbc99cfe4..b6aea67fb 100644 --- a/plugins/af_psql_trgm/init.php +++ b/plugins/af_psql_trgm/init.php @@ -228,7 +228,7 @@ class Af_Psql_Trgm extends Plugin { if (!array($enabled_feeds)) $enabled_feeds = array(); $key = array_search($feed_id, $enabled_feeds); - $checked = $key !== FALSE ? "checked" : ""; + $checked = $key !== false ? "checked" : ""; print "<fieldset>"; @@ -248,11 +248,11 @@ class Af_Psql_Trgm extends Plugin { $key = array_search($feed_id, $enabled_feeds); if ($enable) { - if ($key === FALSE) { + if ($key === false) { array_push($enabled_feeds, $feed_id); } } else { - if ($key !== FALSE) { + if ($key !== false) { unset($enabled_feeds[$key]); } } @@ -272,7 +272,7 @@ class Af_Psql_Trgm extends Plugin { if (!$enable_globally) { $enabled_feeds = $this->host->get($this, "enabled_feeds"); $key = array_search($article["feed"]["id"], $enabled_feeds); - if ($key === FALSE) return $article; + if ($key === false) return $article; } $similarity = (float) $this->host->get($this, "similarity"); diff --git a/plugins/af_readability/init.js b/plugins/af_readability/init.js index 644dff9fe..3155475cc 100644 --- a/plugins/af_readability/init.js +++ b/plugins/af_readability/init.js @@ -9,7 +9,7 @@ Plugins.Af_Readability = { content.innerHTML = content.getAttribute(self.orig_attr_name); content.removeAttribute(self.orig_attr_name); - if (App.isCombinedMode()) Article.cdmScrollToId(id); + if (App.isCombinedMode()) Article.cdmMoveToId(id); return; } @@ -23,7 +23,7 @@ Plugins.Af_Readability = { content.innerHTML = reply.content; Notify.close(); - if (App.isCombinedMode()) Article.cdmScrollToId(id); + if (App.isCombinedMode()) Article.cdmMoveToId(id); } else { Notify.error("Unable to fetch full text for this article"); diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php index 9c62a4772..111462c4b 100755 --- a/plugins/af_readability/init.php +++ b/plugins/af_readability/init.php @@ -133,7 +133,7 @@ class Af_Readability extends Plugin { if (!is_array($enabled_feeds)) $enabled_feeds = array(); $key = array_search($feed_id, $enabled_feeds); - $checked = $key !== FALSE ? "checked" : ""; + $checked = $key !== false ? "checked" : ""; print "<fieldset>"; @@ -153,11 +153,11 @@ class Af_Readability extends Plugin { $key = array_search($feed_id, $enabled_feeds); if ($enable) { - if ($key === FALSE) { + if ($key === false) { array_push($enabled_feeds, $feed_id); } } else { - if ($key !== FALSE) { + if ($key !== false) { unset($enabled_feeds[$key]); } } @@ -176,7 +176,7 @@ class Af_Readability extends Plugin { global $fetch_effective_url; - $tmp = fetch_file_contents([ + $tmp = UrlHelper::fetch([ "url" => $url, "http_accept" => "text/*", "type" => "text/html"]); @@ -235,7 +235,7 @@ class Af_Readability extends Plugin { $extracted_content = $this->extract_content($article["link"]); # let's see if there's anything of value in there - $content_test = trim(strip_tags(sanitize($extracted_content))); + $content_test = trim(strip_tags(Sanitizer::sanitize($extracted_content))); if ($content_test) { $article["content"] = $extracted_content; @@ -250,7 +250,7 @@ class Af_Readability extends Plugin { if (!is_array($enabled_feeds)) return $article; $key = array_search($article["feed"]["id"], $enabled_feeds); - if ($key === FALSE) return $article; + if ($key === false) return $article; return $this->process_article($article); @@ -264,7 +264,7 @@ class Af_Readability extends Plugin { $extracted_content = $this->extract_content($link); # let's see if there's anything of value in there - $content_test = trim(strip_tags(sanitize($extracted_content))); + $content_test = trim(strip_tags(Sanitizer::sanitize($extracted_content))); if ($content_test) { return $extracted_content; @@ -303,7 +303,7 @@ class Af_Readability extends Plugin { $ret = []; if ($row = $sth->fetch()) { - $ret["content"] = sanitize($this->extract_content($row["link"])); + $ret["content"] = Sanitizer::sanitize($this->extract_content($row["link"])); } print json_encode($ret); diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index d28e072f4..2c213c10b 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -94,7 +94,7 @@ class Af_RedditImgur extends Plugin { //$debug = 1; foreach ($entries as $entry) { - if ($entry->hasAttribute("href") && strpos($entry->getAttribute("href"), "reddit.com") === FALSE) { + if ($entry->hasAttribute("href") && strpos($entry->getAttribute("href"), "reddit.com") === false) { Debug::log("processing href: " . $entry->getAttribute("href"), Debug::$LOG_VERBOSE); @@ -103,7 +103,7 @@ class Af_RedditImgur extends Plugin { if (!$found && preg_match("/^https?:\/\/twitter.com\/(.*?)\/status\/(.*)/", $entry->getAttribute("href"), $matches)) { Debug::log("handling as twitter: " . $matches[1] . " " . $matches[2], Debug::$LOG_VERBOSE); - $oembed_result = fetch_file_contents("https://publish.twitter.com/oembed?url=" . urlencode($entry->getAttribute("href"))); + $oembed_result = UrlHelper::fetch("https://publish.twitter.com/oembed?url=" . urlencode($entry->getAttribute("href"))); if ($oembed_result) { $oembed_result = json_decode($oembed_result, true); @@ -140,7 +140,7 @@ class Af_RedditImgur extends Plugin { $content_type = $this->get_content_type($source_stream); - if (strpos($content_type, "video/") !== FALSE) { + if (strpos($content_type, "video/") !== false) { $this->handle_as_video($doc, $entry, $source_stream, $poster_url); $found = 1; } @@ -165,7 +165,7 @@ class Af_RedditImgur extends Plugin { $source_stream = false; if ($source_article_url) { - $j = json_decode(fetch_file_contents($source_article_url.".json"), true); + $j = json_decode(UrlHelper::fetch($source_article_url.".json"), true); if ($j) { foreach ($j as $listing) { @@ -195,7 +195,7 @@ class Af_RedditImgur extends Plugin { Debug::log("Handling as Streamable", Debug::$LOG_VERBOSE); - $tmp = fetch_file_contents($entry->getAttribute("href")); + $tmp = UrlHelper::fetch($entry->getAttribute("href")); if ($tmp) { $tmpdoc = new DOMDocument(); @@ -230,7 +230,7 @@ class Af_RedditImgur extends Plugin { $source_stream = str_replace(".gifv", ".mp4", $entry->getAttribute("href")); - if (strpos($source_stream, "imgur.com") !== FALSE) + if (strpos($source_stream, "imgur.com") !== false) $poster_url = str_replace(".mp4", "h.jpg", $source_stream); $this->handle_as_video($doc, $entry, $source_stream, $poster_url); @@ -265,8 +265,8 @@ class Af_RedditImgur extends Plugin { } if (!$found && (preg_match("/\.(jpg|jpeg|gif|png)(\?[0-9][0-9]*)?[$\?]/i", $entry->getAttribute("href")) || - mb_strpos($entry->getAttribute("href"), "i.reddituploads.com") !== FALSE || - mb_strpos($this->get_content_type($entry->getAttribute("href")), "image/") !== FALSE)) { + mb_strpos($entry->getAttribute("href"), "i.reddituploads.com") !== false || + mb_strpos($this->get_content_type($entry->getAttribute("href")), "image/") !== false)) { Debug::log("Handling as a picture", Debug::$LOG_VERBOSE); @@ -285,7 +285,7 @@ class Af_RedditImgur extends Plugin { Debug::log("handling as imgur page/whatever", Debug::$LOG_VERBOSE); - $content = fetch_file_contents(["url" => $entry->getAttribute("href"), + $content = UrlHelper::fetch(["url" => $entry->getAttribute("href"), "http_accept" => "text/*"]); if ($content) { @@ -331,7 +331,7 @@ class Af_RedditImgur extends Plugin { if (!$found) { Debug::log("looking for meta og:image", Debug::$LOG_VERBOSE); - $content = fetch_file_contents(["url" => $entry->getAttribute("href"), + $content = UrlHelper::fetch(["url" => $entry->getAttribute("href"), "http_accept" => "text/*"]); if ($content) { @@ -393,7 +393,7 @@ class Af_RedditImgur extends Plugin { function hook_article_filter($article) { - if (strpos($article["link"], "reddit.com/r/") !== FALSE) { + if (strpos($article["link"], "reddit.com/r/") !== false) { $doc = new DOMDocument(); @$doc->loadHTML($article["content"]); $xpath = new DOMXPath($doc); @@ -437,6 +437,7 @@ class Af_RedditImgur extends Plugin { if ($node && $found) { $article["content"] = $doc->saveHTML($node); + $article["enclosures"] = []; } else if ($content_link) { $article = $this->readability($article, $content_link->getAttribute("href"), $doc, $xpath); } @@ -470,11 +471,11 @@ class Af_RedditImgur extends Plugin { $entry->parentNode->insertBefore($video, $entry); $entry->parentNode->insertBefore($br, $entry); - $img = $doc->createElement('img'); + /*$img = $doc->createElement('img'); $img->setAttribute("src", "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D"); - $entry->parentNode->insertBefore($img, $entry); + $entry->parentNode->insertBefore($img, $entry);*/ } function testurl() { @@ -542,7 +543,7 @@ class Af_RedditImgur extends Plugin { // do not try to embed posts linking back to other reddit posts // readability.php requires PHP 5.6 - if ($url && strpos($url, "reddit.com") === FALSE && version_compare(PHP_VERSION, '5.6.0', '>=')) { + if ($url && strpos($url, "reddit.com") === false && version_compare(PHP_VERSION, '5.6.0', '>=')) { /* link may lead to a huge video file or whatever, we need to check content type before trying to parse it which p much requires curl */ @@ -550,7 +551,7 @@ class Af_RedditImgur extends Plugin { $useragent_compat = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"; $content_type = $this->get_content_type($url, $useragent_compat); - if ($content_type && strpos($content_type, "text/html") !== FALSE) { + if ($content_type && strpos($content_type, "text/html") !== false) { foreach ($this->host->get_hooks(PluginHost::HOOK_GET_FULL_TEXT) as $p) { $extracted_content = $p->hook_get_full_text($url); diff --git a/plugins/af_unburn/init.php b/plugins/af_unburn/init.php index bfd0f66e1..d867e83be 100755 --- a/plugins/af_unburn/init.php +++ b/plugins/af_unburn/init.php @@ -24,9 +24,9 @@ class Af_Unburn extends Plugin { if (defined('NO_CURL') || !function_exists("curl_init") || ini_get("open_basedir")) return $article; - if ((strpos($article["link"], "feedproxy.google.com") !== FALSE || - strpos($article["link"], "/~r/") !== FALSE || - strpos($article["link"], "feedsportal.com") !== FALSE)) { + if ((strpos($article["link"], "feedproxy.google.com") !== false || + strpos($article["link"], "/~r/") !== false || + strpos($article["link"], "feedsportal.com") !== false)) { $ch = curl_init($article["link"]); @@ -52,7 +52,7 @@ class Af_Unburn extends Plugin { $query = parse_url($real_url, PHP_URL_QUERY); - if ($query && strpos($query, "utm_source") !== FALSE) { + if ($query && strpos($query, "utm_source") !== false) { $args = array(); parse_str($query, $args); diff --git a/plugins/auth_internal/init.php b/plugins/auth_internal/init.php index 8dbc37fb3..0ad3e9436 100644 --- a/plugins/auth_internal/init.php +++ b/plugins/auth_internal/init.php @@ -22,7 +22,7 @@ class Auth_Internal extends Plugin implements IAuthModule { $pwd_hash1 = encrypt_password($password); $pwd_hash2 = encrypt_password($password, $login); - $otp = $_REQUEST["otp"]; + $otp = (int)$_REQUEST["otp"]; if (get_schema_version() > 96) { @@ -52,7 +52,7 @@ class Auth_Internal extends Plugin implements IAuthModule { $totp_legacy = new \OTPHP\TOTP($secret_legacy); $otp_check_legacy = $totp_legacy->now(); - if ($otp != $otp_check && $otp != $otp_check_legacy) { + if ($otp !== $otp_check && $otp !== $otp_check_legacy) { return false; } } else { @@ -235,11 +235,9 @@ class Auth_Internal extends Plugin implements IAuthModule { if ($row = $sth->fetch()) { $mailer = new Mailer(); - require_once "lib/MiniTemplator.class.php"; + $tpl = new Templator(); - $tpl = new MiniTemplator; - - $tpl->readTemplateFromFile("templates/password_change_template.txt"); + $tpl->readTemplateFromFile("password_change_template.txt"); $tpl->setVariable('LOGIN', $row["login"]); $tpl->setVariable('TTRSS_HOST', SELF_URL_PATH); @@ -262,8 +260,8 @@ class Auth_Internal extends Plugin implements IAuthModule { } private function check_app_password($login, $password, $service) { - $sth = $this->pdo->prepare("SELECT p.id, p.pwd_hash, u.id AS uid - FROM ttrss_app_passwords p, ttrss_users u + $sth = $this->pdo->prepare("SELECT p.id, p.pwd_hash, u.id AS uid + FROM ttrss_app_passwords p, ttrss_users u WHERE p.owner_uid = u.id AND u.login = ? AND service = ?"); $sth->execute([$login, $service]); diff --git a/plugins/cache_starred_images/init.php b/plugins/cache_starred_images/init.php index ae369f56e..5fe963e32 100755 --- a/plugins/cache_starred_images/init.php +++ b/plugins/cache_starred_images/init.php @@ -40,16 +40,16 @@ class Cache_Starred_Images extends Plugin { Debug::log("caching media of starred articles for user " . $this->host->get_owner_uid() . "..."); - $sth = $this->pdo->prepare("SELECT content, ttrss_entries.title, + $sth = $this->pdo->prepare("SELECT content, ttrss_entries.title, ttrss_user_entries.owner_uid, link, site_url, ttrss_entries.id, plugin_data FROM ttrss_entries, ttrss_user_entries LEFT JOIN ttrss_feeds ON (ttrss_user_entries.feed_id = ttrss_feeds.id) WHERE ref_id = ttrss_entries.id AND marked = true AND - site_url != '' AND + site_url != '' AND ttrss_user_entries.owner_uid = ? AND plugin_data NOT LIKE '%starred_cache_images%' - ORDER BY ".sql_random_function()." LIMIT 100"); + ORDER BY ".Db::sql_random_function()." LIMIT 100"); if ($sth->execute([$this->host->get_owner_uid()])) { @@ -139,7 +139,7 @@ class Cache_Starred_Images extends Plugin { if (!$this->cache->exists($local_filename)) { Debug::log("cache_images: downloading: $url to $local_filename", Debug::$LOG_VERBOSE); - $data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]); + $data = UrlHelper::fetch(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]); if ($data) return $this->cache->put($local_filename, $data);; diff --git a/plugins/hotkeys_force_top/init.js b/plugins/hotkeys_force_top/init.js new file mode 100644 index 000000000..8d6280fc9 --- /dev/null +++ b/plugins/hotkeys_force_top/init.js @@ -0,0 +1,6 @@ +require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { + ready(function () { + Headlines.default_force_to_top = true; + }); +}); + diff --git a/plugins/hotkeys_force_top/init.php b/plugins/hotkeys_force_top/init.php new file mode 100644 index 000000000..faddc9148 --- /dev/null +++ b/plugins/hotkeys_force_top/init.php @@ -0,0 +1,24 @@ +<?php +class Hotkeys_Force_Top extends Plugin { + private $host; + + function about() { + return array(1.0, + "Force open article to the top", + "itsamenathan"); + } + + function init($host) { + $this->host = $host; + + } + + function get_js() { + return file_get_contents(__DIR__ . "/init.js"); + } + + function api_version() { + return 2; + } + +} diff --git a/plugins/hotkeys_noscroll/init.php b/plugins/hotkeys_noscroll/init.php index 2038997f5..b31ee92ae 100644 --- a/plugins/hotkeys_noscroll/init.php +++ b/plugins/hotkeys_noscroll/init.php @@ -4,7 +4,7 @@ class Hotkeys_Noscroll extends Plugin { function about() { return array(1.0, - "n/p hotkeys move between articles without scrolling", + "n/p (and up/down) hotkeys move between articles without scrolling", "fox"); } diff --git a/plugins/swap_jk/init.php b/plugins/hotkeys_swap_jk/init.php index d85149ef3..b1e3dbe04 100644 --- a/plugins/swap_jk/init.php +++ b/plugins/hotkeys_swap_jk/init.php @@ -1,5 +1,5 @@ <?php -class Swap_JK extends Plugin { +class Hotkeys_Swap_JK extends Plugin { private $host; @@ -27,4 +27,4 @@ class Swap_JK extends Plugin { return 2; } -}
\ No newline at end of file +} diff --git a/plugins/mail/init.php b/plugins/mail/init.php index e85053566..40d147fc9 100644 --- a/plugins/mail/init.php +++ b/plugins/mail/init.php @@ -92,18 +92,20 @@ class Mail extends Plugin { if ($row = $sth->fetch()) { $user_email = htmlspecialchars($row['email']); $user_name = htmlspecialchars($row['full_name']); + } else { + $user_name = ""; + $user_email = ""; } - if (!$user_name) $user_name = $_SESSION['name']; + if (!$user_name) + $user_name = $_SESSION['name']; print_hidden("from_email", "$user_email"); print_hidden("from_name", "$user_name"); - require_once "lib/MiniTemplator.class.php"; - - $tpl = new MiniTemplator; + $tpl = new Templator(); - $tpl->readTemplateFromFile("templates/email_article_template.txt"); + $tpl->readTemplateFromFile("email_article_template.txt"); $tpl->setVariable('USER_NAME', $_SESSION["name"], true); $tpl->setVariable('USER_EMAIL', $user_email, true); @@ -116,6 +118,8 @@ class Mail extends Plugin { if (count($ids) > 1) { $subject = __("[Forwarded]") . " " . __("Multiple articles"); + } else { + $subject = ""; } while ($line = $sth->fetch()) { diff --git a/plugins/mailto/init.php b/plugins/mailto/init.php index 421d5fd59..390984b71 100644 --- a/plugins/mailto/init.php +++ b/plugins/mailto/init.php @@ -29,11 +29,9 @@ class MailTo extends Plugin { $ids = explode(",", $_REQUEST['param']); $ids_qmarks = arr_qmarks($ids); - require_once "lib/MiniTemplator.class.php"; + $tpl = new Templator(); - $tpl = new MiniTemplator; - - $tpl->readTemplateFromFile("templates/email_article_template.txt"); + $tpl->readTemplateFromFile("email_article_template.txt"); $tpl->setVariable('USER_NAME', $_SESSION["name"], true); //$tpl->setVariable('USER_EMAIL', $user_email, true); diff --git a/plugins/no_iframes/init.php b/plugins/no_iframes/init.php index 18cc3ba17..9711eeb24 100644 --- a/plugins/no_iframes/init.php +++ b/plugins/no_iframes/init.php @@ -23,7 +23,7 @@ class No_Iframes extends Plugin { $entries = $xpath->query('//iframe'); foreach ($entries as $entry) { - if (!iframe_whitelisted($entry)) + if (!Sanitizer::iframe_whitelisted($entry)) $entry->parentNode->removeChild($entry); } @@ -34,4 +34,4 @@ class No_Iframes extends Plugin { return 2; } -}
\ No newline at end of file +} diff --git a/plugins/shorten_expanded/init.js b/plugins/shorten_expanded/init.js index 6371bd1c6..587fcea42 100644 --- a/plugins/shorten_expanded/init.js +++ b/plugins/shorten_expanded/init.js @@ -42,8 +42,6 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { ${__("Click to expand article")}</button>`; dojo.parser.parse(c_inner); - - Headlines.unpackVisible(); } } }, 150); @@ -21,7 +21,7 @@ if (!init_plugins()) return; - login_sequence(); + UserHelper::login_sequence(); header('Content-Type: text/html; charset=utf-8'); ?> @@ -31,7 +31,7 @@ <title>Tiny Tiny RSS : <?php echo __("Preferences") ?></title> <meta name="viewport" content="initial-scale=1,width=device-width" /> - <?php if ($_SESSION["uid"]) { + <?php if ($_SESSION["uid"] && !isset($_REQUEST["ignore-theme"])) { $theme = get_pref("USER_CSS_THEME", false, false); if ($theme && theme_exists("$theme")) { echo stylesheet_tag(get_theme_path($theme), 'theme_css'); @@ -39,7 +39,11 @@ } ?> - <?php print_user_stylesheet() ?> + <script type="text/javascript"> + const __csrf_token = "<?php echo $_SESSION["csrf_token"]; ?>"; + </script> + + <?php UserHelper::print_user_stylesheet() ?> <link rel="shortcut icon" type="image/png" href="images/favicon.png"/> <link rel="icon" type="image/png" sizes="72x72" href="images/favicon-72px.png" /> @@ -159,11 +163,11 @@ </div> <?php $version = get_version($git_commit, $git_timestamp, $last_error); ?> <div id="footer" dojoType="dijit.layout.ContentPane" region="bottom"> - <a class="text-muted" target="_blank" href="http://tt-rss.org/">Tiny Tiny RSS</a> + <a class="text-muted" target="_blank" href="https://tt-rss.org/">Tiny Tiny RSS</a> <span title="<?php echo htmlspecialchars($last_error) ?>">v<?php echo $version ?></span> © 2005-<?php echo date('Y') ?> <a class="text-muted" target="_blank" - href="http://fakecake.org/">Andrew Dolgov</a> + href="https://fakecake.org/">Andrew Dolgov</a> </div> <!-- footer --> </div> diff --git a/public.php b/public.php index e37c44172..36308e25e 100644 --- a/public.php +++ b/public.php @@ -32,7 +32,14 @@ if (implements_interface($handler, "IHandler") && $handler->before($method)) { if ($method && method_exists($handler, $method)) { - $handler->$method(); + $reflection = new ReflectionMethod($handler, $method); + + if ($reflection->getNumberOfRequiredParameters() == 0) { + $handler->$method(); + } else { + header("Content-Type: text/json"); + print error_json(6); + } } else if (method_exists($handler, 'index')) { $handler->index(); } diff --git a/register.php b/register.php index 027a0f2b8..47aa39a09 100644 --- a/register.php +++ b/register.php @@ -288,7 +288,7 @@ $new_uid = db_fetch_result($result, 0, "id"); - initialize_user( $new_uid); + Pref_Users::initialize_user($new_uid); $reg_text = "Hi!\n". "\n". diff --git a/templates.local/index.html b/templates.local/index.html new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/templates.local/index.html diff --git a/templates/generated_feed.txt b/templates/generated_feed.txt index 5e35f9be1..617162652 100644 --- a/templates/generated_feed.txt +++ b/templates/generated_feed.txt @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<?xml-stylesheet type="text/xsl" href="atom-to-html.xsl"?> <!-- $BeginBlock feed --> <feed xmlns="http://www.w3.org/2005/Atom"> <title>${FEED_TITLE}</title> diff --git a/themes/Makefile b/themes/Makefile new file mode 100644 index 000000000..b9298207c --- /dev/null +++ b/themes/Makefile @@ -0,0 +1,9 @@ +.PHONY: clean + +ALL: compact.css compact_night.css light.css night_blue.css night.css + +%.css: %.less light/*.less + lessc --source-map=$(patsubst %.less,%.css.map,${<}) ${<} ${@} + +clean: + rm -f *.css *.css.map diff --git a/themes/compact.css b/themes/compact.css index 00d6e22c6..c8323cbe4 100644 --- a/themes/compact.css +++ b/themes/compact.css @@ -70,12 +70,19 @@ body.ttrss_main div.post div.content video { max-width: 98%; height: auto; } -body.ttrss_main div.post div.content p { - hyphens: auto; +body.ttrss_main div.post div.content div.embed-responsive { + overflow: hidden; + padding-bottom: 56.25%; + position: relative; } -body.ttrss_main div.post div.content iframe { - min-width: 50%; - max-width: 98%; +body.ttrss_main div.post div.content div.embed-responsive iframe { + border: 0; + bottom: 0; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; } body.ttrss_main .inline-player { display: flex; @@ -661,13 +668,6 @@ body.ttrss_main #headlines-frame div.feed-title a { body.ttrss_main #headlines-frame div.feed-title a:hover { color: #257aa7; } -body.ttrss_main #headlines-frame.smooth-scroll { - scroll-behavior: smooth; -} -body.ttrss_main #headlines-frame.forbid-smooth-scroll, -body.ttrss_main #content-insert.forbid-smooth-scroll { - scroll-behavior: auto; -} body.ttrss_main #toolbar-frame_splitter { display: none; } @@ -754,7 +754,6 @@ body.ttrss_main #content-insert { line-height: 1.5; overflow: auto; -webkit-overflow-scrolling: touch; - scroll-behavior: smooth; } body.ttrss_main img.feed-icon, body.ttrss_main img.icon { @@ -865,6 +864,22 @@ body.ttrss_main #feedEditDlg img.feedIcon { height: auto; width: auto; } +body.ttrss_main .dijitTooltipContents { + background: #1c5c7d; + color: #f5f5f5; +} +body.ttrss_main .dijitTooltipRight .dijitTooltipConnector { + border-right-color: #1c5c7d; +} +body.ttrss_main .dijitTooltipLeft .dijitTooltipConnector { + border-left-color: #1c5c7d; +} +body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector { + border-bottom-color: #1c5c7d; +} +body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { + border-top-color: #1c5c7d; +} body.ttrss_main .dijitDialog h1:first-of-type, body.ttrss_main .dijitDialog h2:first-of-type, body.ttrss_main .dijitDialog h3:first-of-type, @@ -877,10 +892,10 @@ body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Ma body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .counterNode.marked { display: inline-block; } -body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.AlwaysVisible):not(.Special):not(.Has_Marked) { +body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.AlwaysVisible):not(.Special):not(.Has_Marked) { display: none; } -body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.AlwaysVisible):not(.Has_Marked) { +body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.AlwaysVisible):not(.Has_Marked) { display: none; } body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow.Unread .counterNode.unread { @@ -889,10 +904,10 @@ body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow. body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow.Has_Aux:not(.Unread) .counterNode.aux { display: inline-block; } -body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.Unread):not(.AlwaysVisible):not(.Special) { +body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.Unread):not(.AlwaysVisible):not(.Special) { display: none; } -body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.Unread):not(.AlwaysVisible) { +body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.Unread):not(.AlwaysVisible) { display: none; } body.ttrss_main #toolbar-headlines i.icon-syndicate { @@ -917,12 +932,10 @@ body.ttrss_main i.icon-no-feed { body.ttrss_main .dijitTreeRow.UpdatesDisabled .dijitTreeLabel { opacity: 0.5; } -body.ttrss_main #floatingTitle.marked i.marked-pic, body.ttrss_main .cdm.marked .left i.marked-pic, body.ttrss_main .hl.marked .left i.marked-pic { color: #ffc069; } -body.ttrss_main #floatingTitle.published i.pub-pic, body.ttrss_main .cdm.published .left i.pub-pic, body.ttrss_main .hl.published .left i.pub-pic { color: #ff7c4b; @@ -1116,6 +1129,11 @@ video::-webkit-media-controls-overlay-play-button { .cdm i.material-icons { color: #777; } +.cdm .header { + position: sticky; + top: 0; + z-index: 3; +} .cdm .header, .cdm .footer { display: flex; @@ -1128,6 +1146,9 @@ video::-webkit-media-controls-overlay-play-button { margin: 0px 4px; vertical-align: middle; } +.cdm .header-sticky-guard { + height: 0; +} .cdm .header { align-items: center; } @@ -1207,9 +1228,6 @@ video::-webkit-media-controls-overlay-play-button { margin-top: 0px; margin-bottom: 0px; } -div.cdm.expanded div.header { - background: transparent ! important; -} div.cdm.expanded div.header a.title { font-size: 16px; color: #999; @@ -1267,15 +1285,19 @@ div.cdm.vgrlf .feed { font-style: italic; font-size: 11px; } -.cdm div.content-inner p { - /*max-width : 650px;*/ - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; +.cdm div.content-inner div.embed-responsive { + overflow: hidden; + padding-bottom: 56.25%; + position: relative; } -.cdm div.content-inner iframe { - min-width: 50%; - max-width: 98%; +.cdm div.content-inner div.embed-responsive iframe { + border: 0; + bottom: 0; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; } .cdm div.header span.author { white-space: nowrap; @@ -1288,115 +1310,6 @@ div.cdm.vgrlf .feed { display: inline-block; padding: 1px 4px 1px 4px; } -#main:not(.expandable) div#floatingTitle .collapse { - display: none; -} -div#floatingTitle { - position: absolute; - z-index: 5; - top: 0px; - right: 0px; - left: 0px; - border: 0px solid #ddd; - border-bottom-width: 1px; - background: white; - color: #555; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1); - align-items: center; -} -div#floatingTitle > * { - white-space: nowrap; - padding: 4px; -} -div#floatingTitle .left, -div#floatingTitle .right { - display: flex; - align-items: center; -} -div#floatingTitle .left i.material-icons, -div#floatingTitle .right i.material-icons { - margin-left: 2px; - font-size: 21px; - padding: 2px; - user-select: none; -} -div#floatingTitle .left i.icon-anchor, -div#floatingTitle .right i.icon-anchor { - margin-left: 0px; - margin-right: 1px; - padding: 0px; - color: #ccc; - cursor: pointer; -} -div#floatingTitle .excerpt { - display: none; -} -div#floatingTitle .collapse i.material-icons { - color: #257aa7; - cursor: pointer; -} -div#floatingTitle span.author { - color: #555; - font-size: 11px; - font-weight: normal; -} -div#floatingTitle a.title { - font-size: 16px; - color: #999; - transition: color 0.2s, background 0.2s; - font-weight: 600; - text-rendering: optimizelegibility; - font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; -} -div#floatingTitle div.feed { - padding-right: 10px; - color: #555; - font-weight: normal; - font-style: italic; - font-size: 11px; - white-space: nowrap; -} -div#floatingTitle div.feed a { - border-radius: 4px; - display: inline-block; - padding: 1px 4px 1px 4px; -} -div#floatingTitle span.updated { - padding-right: 10px; - white-space: nowrap; - color: #555; - font-size: 11px; -} -div#floatingTitle div.feed a { - color: #555; -} -div#floatingTitle span.titleWrap { - width: 100%; - white-space: normal; -} -div#floatingTitle .feed-title > * { - display: table-cell; - vertical-align: middle; -} -div#floatingTitle .feed-title a.title { - width: 100%; -} -div#floatingTitle .feed-title a.catchup { - text-align: right; - color: #555; - padding-right: 10px; - font-size: 11px; - white-space: nowrap; -} -div#floatingTitle .feed-title a.catchup:hover { - color: #257aa7; -} -div#floatingTitle.Unread a.title { - color: black; -} .cdm.expandable { background-color: #f5f5f5; border: 0px solid #ddd; @@ -1469,6 +1382,15 @@ div.cdm.expandable:not(.active) .content, div.cdm.expandable:not(.active) .collapse { display: none; } +div.cdm.expandable.active .header[stuck], +div.cdm.expanded .header[stuck] { + box-shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.1); + border: 0 solid #ddd; + border-bottom-width: 1px; + background: white ! important; + opacity: 0.9; + backdrop-filter: blur(6px); +} body.ttrss_prefs { background-color: #f5f5f5; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; @@ -1594,12 +1516,12 @@ body.ttrss_prefs .phpinfo td.v { font-family: monospace; word-break: break-all; } -body.ttrss_prefs #filterNewRuleDlg .invalid, -body.ttrss_main #filterNewRuleDlg .invalid { +body.ttrss_prefs #filterNewRuleDlg .dijitValidationTextAreaError, +body.ttrss_main #filterNewRuleDlg .dijitValidationTextAreaError { background: #ffc0c0; } -body.ttrss_prefs #filterNewRuleDlg .valid, -body.ttrss_main #filterNewRuleDlg .valid { +body.ttrss_prefs #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError), +body.ttrss_main #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError) { background: #c0ffc0; } body.ttrss_prefs fieldset, @@ -1906,11 +1828,6 @@ body.ttrss_zoom div.post div.header .row { align-items: center; justify-content: space-between; } -body.ttrss_zoom div.post p { - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; -} body.ttrss_zoom div.post div.content { font-size: 15px; line-height: 1.5; @@ -1962,8 +1879,6 @@ body.ttrss_main.ttrss_index.flat div[id*=RROW] i.material-icons { } body.ttrss_main.ttrss_index.flat .hl, body.ttrss_main.ttrss_index.flat .post .header .title, -body.ttrss_main.ttrss_index.flat #floatingTitle a.title, body.ttrss_main.ttrss_index.flat .cdm .title { font-size: 13px ! important; } -/*# sourceMappingURL=compact.css.map */
\ No newline at end of file diff --git a/themes/compact.css.map b/themes/compact.css.map deleted file mode 100644 index 717d60fbf..000000000 --- a/themes/compact.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["C:/Users/fox/Projects/tt-rss/css/default.less","C:/Users/fox/Projects/tt-rss/css/defines.less","C:/Users/fox/Projects/tt-rss/css/tt-rss.less","C:/Users/fox/Projects/tt-rss/css/cdm.less","C:/Users/fox/Projects/tt-rss/css/prefs.less","C:/Users/fox/Projects/tt-rss/css/utility.less","C:/Users/fox/Projects/tt-rss/css/dijit_basic.less","C:/Users/fox/Projects/tt-rss/css/dijit_light.less","C:/Users/fox/Projects/tt-rss/css/zoom.less","compact.less"],"names":[],"mappings":"QAGQ;ACcR,IAAI;AACJ,IAAI;AACJ;EACE,kBAAA;EACA,WAAA;EACA,YAAA;EACA,SAAA;EACA,UAAA;EACA,SAAA;;ACzBF,IAAI;EACH,iBAAA;EACA,YAAA;EACA,aAAa,8CAAb;EACA,eAAA;EACA,gBAAA;;AALD,IAAI,WAOH;EACC,aAAA;;AARF,IAAI,WAWH,IAAG;EACF,YAAA;EACA,eAAA;;AAbF,IAAI,WAWH,IAAG,KAIF,IAAG;EACF,YAAA;EACA,cAAA;EACA,sBAAA;EACA,wBAAA;EACA,mBAAA;;AApBH,IAAI,WAWH,IAAG,KAIF,IAAG,OAOF;AAtBH,IAAI,WAWH,IAAG,KAIF,IAAG,OAOK;EACN,aAAA;;AAvBJ,IAAI,WAWH,IAAG,KAIF,IAAG,OAWF;EACC,aAAA;EACA,kBAAA;EACA,iBAAA;EACA,mBAAA;EACA,8BAAA;;AA/BJ,IAAI,WAWH,IAAG,KAIF,IAAG,OAmBF;EACC,YAAA;;AAnCJ,IAAI,WAWH,IAAG,KAIF,IAAG,OAuBF;EACC,mBAAA;;AAvCJ,IAAI,WAWH,IAAG,KAIF,IAAG,OA2BF;AA1CH,IAAI,WAWH,IAAG,KAIF,IAAG,OA2BG,EAAC;EACL,eAAA;EACA,sBAAA;EACA,WAAA;;AA7CJ,IAAI,WAWH,IAAG,KAIF,IAAG,OAiCF;EACC,YAAA;EACA,eAAA;EACA,gBAAA;EACA,kCAAA;EACA,aDrDY,qBAAqB,qBAAqB,yBAAyB,oBAAoB,8CCqDnG;;AArDJ,IAAI,WAWH,IAAG,KA8CF,IAAG;EACF,aAAA;EACA,eAAA;;AA3DH,IAAI,WAWH,IAAG,KA8CF,IAAG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hBN,IAAI,WAAW,YAAY,KAoBzB;AApBF,IAAI,WAAW,YAAY,KAqBzB,MAAM,QAAQ;AArBhB,IAAI,WAAW,YAAY,KAsBzB,eAAe,EAAC;AAtBlB,IAAI,WAAW,YAAY,KAuBzB,KAAK;EACH,2BAAA","file":"compact.css"}
\ No newline at end of file diff --git a/themes/compact.less b/themes/compact.less index 3da095c54..2159d46a6 100644 --- a/themes/compact.less +++ b/themes/compact.less @@ -1,33 +1,2 @@ -@import "../css/default.less"; - -/* rules specific to compact.css */ - -body.ttrss_main.ttrss_index.flat { - - #feedTree.dijitTree .dijitTreeLabel { - font-size : 13px ! important; - } - - .dijitMenu .dijitMenuItemLabel, - .content-inner, - #content-insert, - .cdm .content, - .post .content { - font-size : 12px ! important; - } - - div[id*=RROW] { - i.material-icons { - font-size: 18px; - } - } - - .hl, - .post .header .title, - #floatingTitle a.title, - .cdm .title { - font-size : 13px ! important; - } - - -} +@import "light/light_base.less"; +@import "compact_base.less"; diff --git a/themes/compact_base.less b/themes/compact_base.less new file mode 100644 index 000000000..b3b48802b --- /dev/null +++ b/themes/compact_base.less @@ -0,0 +1,30 @@ +/* rules specific to compact.css */ + +body.ttrss_main.ttrss_index.flat { + + #feedTree.dijitTree .dijitTreeLabel { + font-size : 13px ! important; + } + + .dijitMenu .dijitMenuItemLabel, + .content-inner, + #content-insert, + .cdm .content, + .post .content { + font-size : 12px ! important; + } + + div[id*=RROW] { + i.material-icons { + font-size: 18px; + } + } + + .hl, + .post .header .title, + .cdm .title { + font-size : 13px ! important; + } + + +} diff --git a/themes/compact_night.css b/themes/compact_night.css new file mode 100644 index 000000000..b47a8821e --- /dev/null +++ b/themes/compact_night.css @@ -0,0 +1,2119 @@ +@import "../lib/flat-ttrss/flat_combined_dark.css"; +body.ttrss_main, +body.ttrss_prefs, +#main { + position: absolute; + width: 100%; + height: 100%; + border: 0; + padding: 0; + margin: 0; +} +body.ttrss_main { + background: #333; + color: #ccc; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + overflow: hidden; +} +body.ttrss_main :focus { + outline: none; +} +body.ttrss_main div.post { + padding: 0px; + font-size: 13px; +} +body.ttrss_main div.post div.header { + padding: 5px; + color: #909090; + border: 0px solid #222; + border-bottom-width: 1px; + background: #222; +} +body.ttrss_main div.post div.header .left, +body.ttrss_main div.post div.header .right { + display: flex; +} +body.ttrss_main div.post div.header .row { + display: flex; + margin-bottom: 4px; + flex-wrap: nowrap; + align-items: center; + justify-content: space-between; +} +body.ttrss_main div.post div.header .comments { + flex-grow: 2; +} +body.ttrss_main div.post div.header .date { + white-space: nowrap; +} +body.ttrss_main div.post div.header img, +body.ttrss_main div.post div.header i.material-icons { + margin: 0px 4px; + vertical-align: middle; + color: #777; +} +body.ttrss_main div.post div.header .title { + flex-grow: 2; + font-size: 15px; + font-weight: 600; + text-rendering: optimizelegibility; + font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; +} +body.ttrss_main div.post div.content { + padding: 10px; + font-size: 16px; +} +body.ttrss_main div.post div.content img, +body.ttrss_main div.post div.content video { + border-width: 0px; + max-width: 98%; + height: auto; +} +body.ttrss_main div.post div.content div.embed-responsive { + overflow: hidden; + padding-bottom: 56.25%; + position: relative; +} +body.ttrss_main div.post div.content div.embed-responsive iframe { + border: 0; + bottom: 0; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; +} +body.ttrss_main .inline-player { + display: flex; + align-items: center; +} +body.ttrss_main .inline-player audio { + margin-right: 8px; +} +body.ttrss_main .article-note { + background-color: #fff7d5; + margin: 5px; + border: 1px solid #e7d796; + color: #9a8c59; + display: flex; + align-items: center; +} +body.ttrss_main .article-note > * { + padding: 5px; +} +body.ttrss_main .article-note.editable { + cursor: pointer; +} +body.ttrss_main h1 { + font-size: 18px; + font-weight: 600; + text-rendering: optimizelegibility; +} +body.ttrss_main h2 { + font-size: 16px; + font-weight: 600; + text-rendering: optimizelegibility; +} +body.ttrss_main h3 { + font-size: 16px; + font-weight: 600; + text-rendering: optimizelegibility; +} +body.ttrss_main h4 { + font-size: 14px; + font-weight: 600; + text-rendering: optimizelegibility; +} +body.ttrss_main a { + color: #b87d2c; + text-decoration: none; +} +body.ttrss_main a:hover { + color: #664518; + text-decoration: underline; +} +body.ttrss_main #notify.visible { + opacity: 100; +} +body.ttrss_main #notify { + bottom: 20px; + right: 20px; + min-width: 200px; + max-width: 350px; + border-width: 1px; + border-style: solid; + position: fixed; + font-size: 14px; + z-index: 99; + display: flex; + opacity: 0; + align-items: center; + padding: 10px; + transition: opacity 0.2s linear; + box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1); +} +body.ttrss_main #notify img { + vertical-align: middle; +} +body.ttrss_main #notify .msg { + flex-grow: 2; + padding: 0 10px; + line-height: 20px; +} +body.ttrss_main #notify .icon-close { + cursor: pointer; +} +body.ttrss_main .notify { + border-color: #d7c47a; + background-color: #fff7d5; +} +body.ttrss_main .notify.notify_progress { + border-color: #d7c47a; + background-color: #fff7d5; +} +body.ttrss_main .notify.notify_info { + border-color: #b87d2c; + background-color: #faf3e9; +} +body.ttrss_main .notify.notify_info i.icon-notify { + color: #b87d2c; +} +body.ttrss_main .notify.notify_error { + background-color: #c00; + border-color: #900; + color: white; +} +body.ttrss_main .notify.notify_error i.icon-notify, +body.ttrss_main .notify.notify_error i.icon-close { + color: white; +} +body.ttrss_main .action-chooser .action-button .dijitButtonText { + vertical-align: unset; +} +body.ttrss_main .action-chooser .action-button .dijitArrowButtonInner { + display: none; +} +body.ttrss_main .hl { + border: 0px solid #222; + border-bottom-width: 1px; + transition: color 0.2s, background 0.2s; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + background: #222; + align-items: center; + user-select: none; +} +body.ttrss_main .hl > * { + white-space: nowrap; + padding: 4px; +} +body.ttrss_main .hl img { + vertical-align: middle; +} +body.ttrss_main .hl .left, +body.ttrss_main .hl .right { + display: flex; + align-items: center; +} +body.ttrss_main .hl .left i.material-icons, +body.ttrss_main .hl .right i.material-icons { + margin-left: 2px; + padding: 2px; + transition: color 0.2s linear; + user-select: none; + font-size: 21px; +} +body.ttrss_main .hl .right i.material-icons { + color: #777; +} +body.ttrss_main .hl div.title { + cursor: pointer; + flex-grow: 2; + overflow: hidden; + text-overflow: ellipsis; +} +body.ttrss_main .hl span.author { + white-space: nowrap; + color: #ccc; + font-size: 11px; + font-weight: normal; +} +body.ttrss_main .hl div.right { + text-align: right; +} +body.ttrss_main .hl span.feed a { + border-radius: 4px; + display: inline-block; + padding: 1px 4px; + font-size: 11px; + font-style: italic; + font-weight: normal; + color: #ccc; +} +body.ttrss_main .hl span.feed a:hover { + color: #b87d2c; +} +body.ttrss_main .hl span.updated { + color: #ccc; + text-align: right; + font-size: 11px; + padding-left: 10px; +} +body.ttrss_main .hl span.updated div { + display: inline-block; +} +body.ttrss_main .hl div.left input { + margin: 0px 4px; +} +body.ttrss_main .hl div.left img, +body.ttrss_main .hl div.right img { + margin: 0px 4px; +} +body.ttrss_main .hl div.title a { + font-weight: 600; + text-rendering: optimizelegibility; + font-family: "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; + color: #555; +} +body.ttrss_main .hl a.title.high, +body.ttrss_main .hl span.hl-content.high .preview { + color: #00aa00; +} +body.ttrss_main .hl.vgrlf .feed { + display: none; +} +body.ttrss_main .hl.Unread { + background: white; +} +body.ttrss_main .hl.Unread div.title a { + color: black; +} +body.ttrss_main .hl.active div.title a { + color: #b87d2c; + /* text-shadow : 1px 1px 2px #fff; */ +} +body.ttrss_main .hl.active { + background: #b87d2c ! important; +} +body.ttrss_main .hl.active, +body.ttrss_main .hl.Selected { + color: white; + background: #9c7948; +} +body.ttrss_main .hl.active a, +body.ttrss_main .hl.Selected a, +body.ttrss_main .hl.active .feed a, +body.ttrss_main .hl.Selected .feed a, +body.ttrss_main .hl.active .hl-content a.title, +body.ttrss_main .hl.Selected .hl-content a.title, +body.ttrss_main .hl.active span, +body.ttrss_main .hl.Selected span { + color: white; +} +body.ttrss_main .hl.Grayed { + color: #909090; +} +body.ttrss_main #content-insert blockquote, +body.ttrss_main #headlines-frame blockquote, +body.ttrss_main .dijitContentPane blockquote { + margin: 5px 0px 5px 0px; + color: #ccc; + padding-left: 10px; + border: 0px solid #ccc; + border-left-width: 4px; +} +body.ttrss_main #content-insert code, +body.ttrss_main #headlines-frame code, +body.ttrss_main .dijitContentPane code { + color: #009900; + font-family: monospace; +} +body.ttrss_main #content-insert pre, +body.ttrss_main #headlines-frame pre, +body.ttrss_main .dijitContentPane pre { + margin: 5px 0px 5px 0px; + padding: 10px; + color: #ccc; + font-family: monospace; + font-size: 12px; + border: 0px solid #ccc; + background: #222; + display: block; + max-width: 98%; + overflow: auto; +} +body.ttrss_main div.prefHelp { + color: #ccc; + padding: 5px; +} +body.ttrss_main span.preview { + color: #999; + font-weight: normal; + font-size: 12px; + padding-left: 4px; +} +body.ttrss_main .label { + display: inline-block; + vertical-align: middle; + background-color: #fff7d5; + font-size: 9px; + color: #ccc; + font-weight: normal; + margin-left: 2px; + padding: 2px 4px; + white-space: nowrap; +} +body.ttrss_main i.marked-pic, +body.ttrss_main i.pub-pic { + cursor: pointer; + color: #ccc; +} +body.ttrss_main div.errorExplained { + border: 1px solid #222; + margin: 5px 0px 5px 0px; + padding: 5px; +} +body.ttrss_main ul.browseFeedList { + height: 300px; + width: 100%; + overflow: auto; + border-width: 0px 1px 1px 1px; + border-color: #222; + border-style: solid; + margin: 0px 0px 5px 0px; + background-color: white; + list-style-type: none; + padding: 0px; +} +body.ttrss_main ul.browseFeedList li { + display: flex; + align-items: center; +} +body.ttrss_main ul.browseFeedList li > * { + margin: 2px; +} +body.ttrss_main .browseFeedList span.subscribers { + color: #808080; +} +body.ttrss_main ul.compact { + list-style-type: none; + margin: 0px; + padding: 0px; +} +body.ttrss_main ul.compact li { + margin: 0px; + padding: 0px; +} +body.ttrss_main .noborder { + border-width: 0px; +} +body.ttrss_main #overlay { + background: #333; + left: 0; + top: 0; + height: 100%; + width: 100%; + z-index: 100; + position: absolute; +} +body.ttrss_main #overlay_inner { + font-weight: bold; + margin: 1em; +} +body.ttrss_main div.loadingPrompt { + padding: 1em; + text-align: center; + font-weight: bold; +} +body.ttrss_main div.whiteBox { + margin-left: 1px; + text-align: center; + padding: 1em 1em 0px 1em; + font-size: 11px; + border: 0px solid #222; + border-bottom-width: 1px; +} +body.ttrss_main div#headlines-frame.wide .title { + overflow: visible; + white-space: normal; +} +body.ttrss_main div#headlines-frame.wide .hl .feed { + display: none; +} +body.ttrss_main .dijitDialog header, +body.ttrss_main .dijitDialog .dlgSec, +body.ttrss_main .dijitDialog .dlgSecHoriz { + font-size: 16px; + font-weight: 600; + color: #ccc; + font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; +} +body.ttrss_main .dijitDialog section, +body.ttrss_main .dijitDialog .dlgSecCont { + margin: 10px 20px; +} +body.ttrss_main .dijitDialog header.horizontal + section, +body.ttrss_main .dijitDialog .dlgSecHoriz + .dlgSecCont { + margin: 10px 0; +} +body.ttrss_main .dijitDialog section.narrow { + margin: 0; +} +body.ttrss_main .dijitDialog section fieldset > label, +body.ttrss_main .dijitDialog div.dlgSecCont fieldset > label, +body.ttrss_main .dijitDialog div.dlgSecSimple fieldset > label { + font-weight: bold; + margin-right: 10px; + display: inline-block; + min-width: 140px; + text-align: right; +} +body.ttrss_main .dijitDialog section fieldset > label.checkbox, +body.ttrss_main .dijitDialog div.dlgSecCont fieldset > label.checkbox, +body.ttrss_main .dijitDialog div.dlgSecSimple fieldset > label.checkbox { + font-weight: normal; + display: inline; +} +body.ttrss_main .dijitDialog section fieldset > label.inline, +body.ttrss_main .dijitDialog div.dlgSecCont fieldset > label.inline, +body.ttrss_main .dijitDialog div.dlgSecSimple fieldset > label.inline { + display: inline; +} +body.ttrss_main .dijitDialog section fieldset, +body.ttrss_main .dijitDialog div.dlgSecCont fieldset, +body.ttrss_main .dijitDialog div.dlgSecSimple fieldset { + border-width: 0px; + padding: 5px 0px; +} +body.ttrss_main .dijitDialog section fieldset.narrow, +body.ttrss_main .dijitDialog div.dlgSecCont fieldset.narrow, +body.ttrss_main .dijitDialog div.dlgSecSimple fieldset.narrow { + padding: 2px 0px; +} +body.ttrss_main .dijitDialog section fieldset.align-right, +body.ttrss_main .dijitDialog div.dlgSecCont fieldset.align-right, +body.ttrss_main .dijitDialog div.dlgSecSimple fieldset.align-right { + text-align: right; +} +body.ttrss_main .dijitDialog footer, +body.ttrss_main .dijitDialog .dlgButtons { + margin-top: 5px; + text-align: right; +} +body.ttrss_main .dijitDialog footer.text-center { + text-align: center; +} +body.ttrss_main i.icon-label { + color: #fff7d5; +} +body.ttrss_main div#cmdline { + position: absolute; + left: 5px; + bottom: 5px; + font-size: 11px; + color: #ccc; + font-weight: bold; + background-color: #333; + border: 1px solid #b87d2c; + padding: 3px 5px 3px 5px; + z-index: 5; +} +body.ttrss_main #feed_browser_spinner { + vertical-align: middle; + height: 18px; + width: 18px; +} +body.ttrss_main #exceptionDlg .dijitDialogTitleBar { + background: red; + color: white; +} +body.ttrss_main #exceptionDlg .dijitDialogPaneContent { + background: #fcc; +} +body.ttrss_main #exceptionDlg .error-contents .message { + color: red; +} +body.ttrss_main #exceptionDlg .error-contents textarea { + width: 99%; + height: 200px; +} +body.ttrss_main #exceptionDlg .error-contents .dlgButtons { + text-align: center; +} +body.ttrss_main #content-wrap { + padding: 0px; + border-width: 0px; + margin: 0px; +} +body.ttrss_main #feeds-holder { + padding: 0px; + border: 0px solid #222; + overflow: hidden; + background: #222; + box-shadow: inset -1px 0px 2px -1px rgba(0, 0, 0, 0.1); + -webkit-overflow-scrolling: touch; +} +body.ttrss_main #feeds-holder #feedTree { + height: 100%; + overflow-x: hidden; + text-rendering: optimizelegibility; + font-family: "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; +} +body.ttrss_main #feeds-holder #feedTree .counterNode.aux, +body.ttrss_main #feeds-holder #feedTree .counterNode.marked { + background: #222; + color: #e6e6e6; + border-color: #080808; +} +body.ttrss_main #feeds-holder #feedTree .counterNode.marked { + border-color: #b87d2c; + background: #ffffff; +} +body.ttrss_main #feeds-holder #feedTree .counterNode { + font-weight: bold; + display: none; + font-size: 9px; + text-align: center; + border: 1px solid #cd8b31; + color: white; + background: #cd8b31; + border-radius: 4px; + vertical-align: middle; + float: right; + position: relative; + line-height: 14px; + margin-right: 8px; + margin-top: 2px; + min-width: 23px; + height: 14px; +} +body.ttrss_main #feeds-holder #feedTree .dijitTreeNode .loadingExpando { + left: -3px; + height: 22px; + position: relative; + top: -3px; +} +body.ttrss_main #feeds-holder #feedTree .dijitTreeRow .dijitTreeLabel.Unread { + font-weight: bold; +} +body.ttrss_main #feeds-holder #feedTree .dijitTreeRow.Error .dijitTreeLabel { + color: red; +} +body.ttrss_main #feeds-holder #feedTree .dijitTreeNode .dijitTreeRow { + border: 1px solid transparent; +} +body.ttrss_main #feeds-holder #feedTree .dijitTreeNode .dijitTreeRowSelected { + box-shadow: -1px 0px 2px -1px rgba(0, 0, 0, 0.1); + border-color: #222 transparent; + background: #333; + color: #333; +} +body.ttrss_main #feeds-holder #feedTree .dijitIcon.feed-icon { + margin-right: 2px; +} +body.ttrss_main #feeds-holder #feedTree i.icon.icon-inbox { + color: #555; +} +body.ttrss_main #feeds-holder #feedTree i.icon.icon-archive { + color: #c77b2e; +} +body.ttrss_main #feeds-holder #feedTree i.icon.icon-star { + position: relative; + color: #ffc069; + font-size: 21px; + left: -2px; +} +body.ttrss_main #feeds-holder #feedTree i.icon.icon-rss_feed { + color: #ff7c4b; +} +body.ttrss_main #feeds-holder #feedTree i.icon.icon-whatshot { + color: #69C671; +} +body.ttrss_main #feeds-holder #feedTree i.icon.icon-restore { + position: relative; + top: -1px; + font-weight: bold; + color: #b87d2c; +} +body.ttrss_main #headlines-wrap-inner { + padding: 0px; + margin: 0px; + border-width: 0px; +} +body.ttrss_main #headlines-frame[is-vfeed="0"] .header .feed { + display: none; +} +body.ttrss_main #headlines-frame { + padding: 0px; + border: 0px #222; + margin-top: 0px; + -webkit-overflow-scrolling: touch; + -webkit-transform: translateZ(0); + -webkit-backface-visibility: hidden; +} +body.ttrss_main #headlines-frame div.feed-title { + border: 0px solid #b87d2c; + border-bottom-width: 1px; + padding: 5px 8px; +} +body.ttrss_main #headlines-frame div.feed-title a.title { + color: #ccc; + font-weight: bold; +} +body.ttrss_main #headlines-frame div.feed-title a { + color: #ccc; +} +body.ttrss_main #headlines-frame div.feed-title a:hover { + color: #b87d2c; +} +body.ttrss_main #toolbar-frame_splitter { + display: none; +} +body.ttrss_main #toolbar-frame { + padding: 0px; + margin: 0px; + border-width: 0px; + white-space: nowrap; + font-size: 12px; +} +body.ttrss_main #toolbar-frame #toolbar { + background: white; + border: 0px solid #222; + border-bottom-width: 1px; + padding-left: 4px; + height: 32px; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + color: #ccc; + font-size: 12px; + align-items: center; +} +body.ttrss_main #toolbar-frame #toolbar .dijitSelect, +body.ttrss_main #toolbar-frame #toolbar .dijitDropDownButton .dijitButtonNode, +body.ttrss_main #toolbar-frame #toolbar .dijitComboButton .dijitButtonNode { + border: 0px; +} +body.ttrss_main #toolbar-frame #toolbar i.net-alert, +body.ttrss_main #toolbar-frame #toolbar .left i.icon-error { + color: red; +} +body.ttrss_main #toolbar-frame #toolbar i.log-alert { + color: #ddba1c; +} +body.ttrss_main #toolbar-frame #toolbar #toolbar-headlines { + padding-right: 4px; + flex-grow: 2; + display: flex; +} +body.ttrss_main #toolbar-frame #toolbar #toolbar-headlines .left { + flex-grow: 2; + display: flex; + align-items: center; +} +body.ttrss_main #toolbar-frame #toolbar #toolbar-headlines .left img { + vertical-align: middle; + margin-right: 8px; +} +body.ttrss_main #toolbar-frame #toolbar #toolbar-headlines .right { + display: flex; + align-items: center; +} +body.ttrss_main #toolbar-frame #toolbar #updates-available { + color: #69C671; + padding-right: 4px; +} +body.ttrss_main #toolbar-frame #toolbar #selected_prompt { + font-style: italic; + text-align: right; + margin-right: 4px; + color: #b87d2c; +} +@media (max-width: 992px) { + body.ttrss_main #toolbar-frame #toolbar #selected_prompt { + display: none; + } +} +body.ttrss_main #header { + border-width: 0px; + text-align: right; + color: #ccc; + padding: 5px 5px 0px 0px; + margin: 0px; + position: absolute; + right: 0px; + top: 0px; + z-index: 5; +} +body.ttrss_main #content-insert { + padding: 0px; + border-color: #222; + border-width: 0px; + line-height: 1.5; + overflow: auto; + -webkit-overflow-scrolling: touch; +} +body.ttrss_main img.feed-icon, +body.ttrss_main img.icon { + width: 16px; + height: 16px; + line-height: 16px; + vertical-align: middle; + display: inline-block; +} +body.ttrss_main .player { + display: inline-block; + color: #ccc; + font-size: 11px; + font-family: sans-serif; + border: 1px solid #ccc; + padding: 0px 4px 0px 4px; + margin: 0px 2px 0px 2px; + width: 50px; + text-align: center; + background: #333; +} +body.ttrss_main .player.playing { + color: #00c000; + border-color: #00c000; +} +body.ttrss_main .player:hover { + background: #222; + cursor: pointer; +} +body.ttrss_main #headlines-frame.auto_catchup #headlines-spacer { + height: 100%; +} +body.ttrss_main #headlines-spacer { + margin-left: 1px; + text-align: center; + color: #ccc; + font-size: 11px; + font-style: italic; +} +body.ttrss_main #headlines-spacer a, +body.ttrss_main #headlines-spacer span { + color: #ccc; + padding: 10px; + display: block; +} +body.ttrss_main #headlines-spacer a:hover { + color: #b87d2c; +} +body.ttrss_main ul#filterDlg_Matches, +body.ttrss_main ul#filterDlg_Actions { + max-height: 100px; + overflow: auto; + list-style-type: none; + border-style: solid; + border-color: #222; + border-width: 1px 1px 1px 1px; + background-color: #333; + margin: 0px 0px 5px 0px; + padding: 4px; + min-height: 16px; +} +body.ttrss_main ul#filterDlg_Matches li, +body.ttrss_main ul#filterDlg_Actions li { + cursor: pointer; +} +body.ttrss_main ul#filterDlg_Matches li .dijitCheckBox, +body.ttrss_main ul#filterDlg_Actions li .dijitCheckBox { + margin-right: 4px; +} +body.ttrss_main ul.hotkeys-help li { + display: flex; +} +body.ttrss_main ul.hotkeys-help li.desc { + flex-grow: 2; +} +body.ttrss_main ul.hotkeys-help .hk { + color: #b87d2c; + width: 100px; +} +body.ttrss_main ul.hotkeys-help h3 { + margin: 8px 0px; +} +body.ttrss_main select.attachments { + display: block; + margin-top: 10px; + max-width: 120px; +} +body.ttrss_main #filterDlg_feeds select { + height: 150px; + width: 410px; +} +body.ttrss_main span.highlight { + background-color: #ffff00; + color: #cc90cc; +} +body.ttrss_main #headlines-frame .dijitCheckBox { + margin-right: 4px; +} +body.ttrss_main #editTagsDlg { + overflow: visible; +} +body.ttrss_main #feedEditDlg img.feedIcon { + border: 1px solid #ccc; + padding: 5px; + margin: 5px; + max-width: 20px; + max-height: 20px; + height: auto; + width: auto; +} +body.ttrss_main .dijitTooltipContents { + background: #d29745; + color: #222; +} +body.ttrss_main .dijitTooltipRight .dijitTooltipConnector { + border-right-color: #d29745; +} +body.ttrss_main .dijitTooltipLeft .dijitTooltipConnector { + border-left-color: #d29745; +} +body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector { + border-bottom-color: #d29745; +} +body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { + border-top-color: #d29745; +} +body.ttrss_main .dijitDialog h1:first-of-type, +body.ttrss_main .dijitDialog h2:first-of-type, +body.ttrss_main .dijitDialog h3:first-of-type, +body.ttrss_main .dijitDialog h4:first-of-type { + margin-top: 0px; +} +body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .dijitTreeLabel { + color: #b87d2c; +} +body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .counterNode.marked { + display: inline-block; +} +body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.AlwaysVisible):not(.Special):not(.Has_Marked) { + display: none; +} +body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.AlwaysVisible):not(.Has_Marked) { + display: none; +} +body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow.Unread .counterNode.unread { + display: inline-block; +} +body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow.Has_Aux:not(.Unread) .counterNode.aux { + display: inline-block; +} +body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.Unread):not(.AlwaysVisible):not(.Special) { + display: none; +} +body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.Unread):not(.AlwaysVisible) { + display: none; +} +body.ttrss_main #toolbar-headlines i.icon-syndicate { + color: #ff7c4b; + margin-right: 8px; + border: 1px solid #ff7c4b; + border-radius: 4px; +} +body.ttrss_main #toolbar-headlines #feed_current_unread { + margin-left: 8px; + font-weight: bold; + text-align: center; + border: 1px solid #cd8b31; + color: white; + background: #cd8b31; + border-radius: 4px; + min-width: 23px; +} +body.ttrss_main i.icon-no-feed { + opacity: 0.2; +} +body.ttrss_main .dijitTreeRow.UpdatesDisabled .dijitTreeLabel { + opacity: 0.5; +} +body.ttrss_main .cdm.marked .left i.marked-pic, +body.ttrss_main .hl.marked .left i.marked-pic { + color: #ffc069; +} +body.ttrss_main .cdm.published .left i.pub-pic, +body.ttrss_main .hl.published .left i.pub-pic { + color: #ff7c4b; +} +body.ttrss_main .score-high i.icon-score { + color: #69C671; +} +body.ttrss_main .score-low i.icon-score { + color: #500; +} +body.ttrss_main .score-neutral i.icon-score { + opacity: 0.5; +} +body.ttrss_main i.icon-score { + cursor: pointer; +} +body.ttrss_main .panel { + border: 1px solid #222; + background: #222; + padding: 4px; +} +body.ttrss_main .dijitDialog .panel { + background: #333; +} +body.ttrss_main .panel-scrollable { + overflow: auto; + height: 200px; +} +body.ttrss_main ul.list li { + padding: 2px; +} +body.ttrss_main ul.list { + padding: 4px; +} +body.ttrss_main ul.list-unstyled { + list-style-type: none; +} +body.ttrss_main .text-center { + text-align: center; +} +body.ttrss_main #prefFilterTestResultList .preview { + margin: 8px; +} +body.ttrss_main #prefFilterTestResultList .title { + font-weight: bold; +} +body.ttrss_main #prefFilterTestResultList .feed { + color: #b87d2c; +} +body.ttrss_main .alert, +body.ttrss_utility .alert { + padding: 8px 35px 8px 14px; + margin-bottom: 10px; + /* text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); */ + background-color: #fcf8e3; + border: 1px solid #fbeed5; + border-radius: 4px; +} +body.ttrss_main .alert .close, +body.ttrss_utility .alert .close { + position: relative; + top: -2px; + right: -21px; + line-height: 20px; + cursor: pointer; +} +body.ttrss_main .pull-right, +body.ttrss_utility .pull-right { + float: right; +} +body.ttrss_main .pull-left, +body.ttrss_utility .pull-left { + float: left; +} +body.ttrss_main .text-error, +body.ttrss_utility .text-error { + color: #b94a48; +} +body.ttrss_main .text-info, +body.ttrss_utility .text-info { + color: #3a87ad; +} +body.ttrss_main .text-success, +body.ttrss_utility .text-success { + color: #468847; +} +body.ttrss_main .text-warning, +body.ttrss_utility .text-warning { + color: #a47e3c; +} +body.ttrss_main .alert, +body.ttrss_utility .alert, +body.ttrss_main .alert h4, +body.ttrss_utility .alert h4 { + color: #c09853; +} +body.ttrss_main .alert h4, +body.ttrss_utility .alert h4 { + margin: 0; +} +body.ttrss_main .alert-success, +body.ttrss_utility .alert-success { + color: #468847; + background-color: #dff0d8; + border-color: #d6e9c6; +} +body.ttrss_main .alert-success h4, +body.ttrss_utility .alert-success h4 { + color: #468847; +} +body.ttrss_main .alert-danger, +body.ttrss_utility .alert-danger, +body.ttrss_main .alert-error, +body.ttrss_utility .alert-error { + color: #b94a48; + background-color: #f2dede; + border-color: #eed3d7; +} +body.ttrss_main .alert-danger h4, +body.ttrss_utility .alert-danger h4, +body.ttrss_main .alert-error h4, +body.ttrss_utility .alert-error h4 { + color: #b94a48; +} +body.ttrss_main .alert-info, +body.ttrss_utility .alert-info { + color: #3a87ad; + background-color: #d9edf7; + border-color: #bce8f1; +} +body.ttrss_main .alert-info h4, +body.ttrss_utility .alert-info h4 { + color: #3a87ad; +} +body.ttrss_main hr, +body.ttrss_utility hr { + border: 0px solid #ccc; + border-bottom-width: 1px; +} +body.ttrss_main .text-muted, +body.ttrss_utility .text-muted { + color: #ccc; +} +body.ttrss_main .small, +body.ttrss_utility .small { + font-size: 11px; +} +body.ttrss_main div.autocomplete, +body.ttrss_utility div.autocomplete { + position: absolute; + width: 250px; + background-color: #333; + border: 1px solid #222; + margin: 0px; + padding: 0px; +} +body.ttrss_main div.autocomplete ul, +body.ttrss_utility div.autocomplete ul { + list-style-type: none; + margin: 0px; + padding: 0px; +} +body.ttrss_main div.autocomplete ul li.selected, +body.ttrss_utility div.autocomplete ul li.selected { + background-color: #1a1a1a; +} +body.ttrss_main div.autocomplete ul li, +body.ttrss_utility div.autocomplete ul li { + list-style-type: none; + display: block; + margin: 0; + padding: 2px; + cursor: pointer; +} +::selection { + background: #b87d2c; + color: #333; +} +::-webkit-scrollbar { + width: 4px; +} +::-webkit-scrollbar-thumb { + background-color: #b87d2c; +} +::-webkit-scrollbar-track { + background-color: #eee; +} +video::-webkit-media-controls-overlay-play-button { + display: none; +} +.cdm i.material-icons { + color: #777; +} +.cdm .header { + position: sticky; + top: 0; + z-index: 3; +} +.cdm .header, +.cdm .footer { + display: flex; + flex-direction: row; + flex-wrap: nowrap; +} +.cdm .header img, +.cdm .footer img, +.cdm .footer i.material-icons { + margin: 0px 4px; + vertical-align: middle; +} +.cdm .header-sticky-guard { + height: 0; +} +.cdm .header { + align-items: center; +} +.cdm .header > * { + padding: 4px; + white-space: nowrap; +} +.cdm .header .left, +.cdm .header .right { + display: flex; + align-items: center; +} +.cdm .header .left i.material-icons, +.cdm .header .right i.material-icons { + margin-left: 2px; + padding: 2px; + transition: color 0.2s linear; + user-select: none; + font-size: 21px; +} +.cdm .header .titleWrap { + flex-grow: 2; +} +.cdm .header span.updated { + color: #ccc; + font-weight: normal; + font-size: 11px; + white-space: nowrap; +} +.cdm .header input { + margin: 0px 4px; +} +.cdm .footer { + height: 30px; + padding-left: 5px; + font-weight: normal; + color: #ccc; + clear: both; + align-items: center; +} +.cdm .footer .left { + flex-grow: 2; +} +.cdm .intermediate { + margin-top: 10px; + margin-left: 10px; +} +.cdm .content-inner { + margin: 10px; + line-height: 1.5; + font-size: 16px; +} +.cdm .intermediate img, +.cdm .intermediate video, +.cdm .content-inner img, +.cdm .content-inner video { + border-width: 0px; + max-width: 98%; + height: auto; +} +.cdm.expanded { + /*margin-top : 4px; + margin-bottom : 4px;*/ +} +.cdm.expanded .collapse, +.cdm.expanded .excerpt { + display: none; +} +.cdm.expanded .titleWrap { + white-space: normal; +} +.cdm.expanded .footer { + border: 0px solid #222; + border-bottom-width: 1px; +} +.cdm.expanded > hr { + margin-top: 0px; + margin-bottom: 0px; +} +div.cdm.expanded div.header a.title { + font-size: 16px; + color: #999; + font-weight: 600; + transition: color 0.2s, background 0.2s; + text-rendering: optimizelegibility; + font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; +} +div.cdm.expanded.active { + background: white; +} +div.cdm.expanded.active div.header a.title { + color: #b87d2c; +} +div.cdm.expanded.Unread div.header a.title { + color: black; +} +div.cdm.expanded div.content { + color: #ccc; +} +div.cdm.expanded.Unread div.content { + color: black; +} +div.cdm.active div.content { + color: black; +} +div.cdm.vgrlf .feed { + display: none; +} +.cdm div.feed-title { + border: 0px solid #b87d2c; + border-bottom-width: 1px; + padding: 5px 3px 5px 5px; +} +.cdm div.feed-title a.title { + color: #ccc; + font-weight: bold; +} +.cdm div.feed-title a { + color: #ccc; +} +.cdm div.feed-title a:hover { + color: #b87d2c; +} +.cdm div.header span.feed { + float: right; + font-weight: normal; + font-style: italic; +} +.cdm div.header div.feed, +.cdm div.header div.feed a { + vertical-align: middle; + color: #ccc; + font-weight: normal; + font-style: italic; + font-size: 11px; +} +.cdm div.content-inner div.embed-responsive { + overflow: hidden; + padding-bottom: 56.25%; + position: relative; +} +.cdm div.content-inner div.embed-responsive iframe { + border: 0; + bottom: 0; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; +} +.cdm div.header span.author { + white-space: nowrap; + color: #ccc; + font-size: 11px; + font-weight: normal; +} +.cdm .feed a { + border-radius: 4px; + display: inline-block; + padding: 1px 4px 1px 4px; +} +.cdm.expandable { + background-color: #222; + border: 0px solid #222; + border-bottom-width: 1px; +} +.cdm.expandable > hr { + display: none; +} +.cdm.expandable div.header span.titleWrap { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +.cdm.expandable .excerpt { + white-space: nowrap; + font-size: 11px; + color: #999; + font-weight: normal; + cursor: pointer; +} +.cdm.expandable:not(.active) { + user-select: none; +} +.cdm.expandable.Unread { + background: white; +} +.cdm.expandable.Selected:not(.active) { + background: #9c7948; +} +.cdm.expandable.Selected:not(.active) a, +.cdm.expandable.Selected:not(.active) .header a.title, +.cdm.expandable.Selected:not(.active) span { + color: white; +} +.cdm.expandable.active { + background: white ! important; +} +div.cdm.expandable.active div.header span.titleWrap { + white-space: normal; +} +div.cdm.expandable div.header a.title { + font-weight: 600; + color: #ccc; + font-size: 14px; + transition: color 0.2s, background 0.2s; + text-rendering: optimizelegibility; + font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; +} +div.cdm.expandable.Unread div.header a.title { + color: black; +} +div.cdm.expandable.active .collapse i.material-icons { + color: #b87d2c; + cursor: pointer; +} +div.cdm.expandable.active .excerpt { + display: none; +} +div.cdm.expandable.active div.header a.title { + color: #b87d2c; + font-size: 16px; + font-weight: 600; + text-rendering: optimizelegibility; + font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; +} +div.cdm.expandable:not(.active) { + cursor: pointer; +} +div.cdm.expandable:not(.active) .content, +div.cdm.expandable:not(.active) .collapse { + display: none; +} +div.cdm.expandable.active .header[stuck], +div.cdm.expanded .header[stuck] { + box-shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.1); + border: 0 solid #222; + border-bottom-width: 1px; + background: #333 ! important; + opacity: 0.9; + backdrop-filter: blur(6px); +} +body.ttrss_prefs { + background-color: #222; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; +} +body.ttrss_prefs h1, +body.ttrss_prefs h2, +body.ttrss_prefs h3, +body.ttrss_prefs h4 { + font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: 600; + color: #ccc; +} +body.ttrss_prefs .dijitContentPane h1:first-of-type, +body.ttrss_prefs .dijitContentPane h2:first-of-type, +body.ttrss_prefs .dijitContentPane h3:first-of-type { + margin-top: 0px; +} +body.ttrss_prefs #footer, +body.ttrss_prefs #header { + padding: 8px; + font-size: 13px; +} +body.ttrss_prefs #header { + float: right; +} +body.ttrss_prefs #footer_splitter { + display: none; +} +body.ttrss_prefs #footer { + background-color: #222; + font-size: 13px; + border: 0px; + text-align: center; +} +body.ttrss_prefs #header img { + vertical-align: middle; + cursor: pointer; +} +body.ttrss_prefs .dijitTree#filterTree .dijitTreeIcon, +body.ttrss_prefs .dijitTree#labelTree .dijitTreeIcon, +body.ttrss_prefs .dijitTree#filterTree .dijitTreeIcon { + display: none; +} +body.ttrss_prefs .dijitAccordionTitle i.material-icons { + top: -1px; + position: relative; +} +body.ttrss_prefs .dijitAccordionTitleSelected i.material-icons { + color: white; +} +body.ttrss_prefs .dijitDialog #pref-profiles-list .dijitInlineEditBoxDisplayMode { + padding: 0px; +} +body.ttrss_prefs div#feedlistLoading, +body.ttrss_prefs div#filterlistLoading, +body.ttrss_prefs div#labellistLoading { + text-align: center; + padding: 5px; + color: #ccc; +} +body.ttrss_prefs div#feedlistLoading img, +body.ttrss_prefs div#filterlistLoading img, +body.ttrss_prefs div#labellistLoading { + margin-right: 5px; +} +body.ttrss_prefs #errorButton { + color: red; +} +body.ttrss_prefs .user-css-editor { + height: 300px; + width: 575px; +} +body.ttrss_prefs fieldset.prefs { + min-height: 30px; +} +body.ttrss_prefs fieldset.prefs label:first-of-type { + min-width: 300px; +} +body.ttrss_prefs fieldset.prefs .help-text { + display: inline-block; + margin-left: 10px; +} +body.ttrss_prefs fieldset.plugin label.description { + width: 600px; + margin-right: 150px; + display: inline-block; +} +body.ttrss_prefs fieldset.plugin label.description .dijitCheckBox { + margin-right: 10px; +} +body.ttrss_prefs .prefErrorLog tr td { + font-size: 10px; +} +body.ttrss_prefs .prefErrorLog tr .errno { + font-style: italic; + font-weight: bold; + white-space: nowrap; +} +body.ttrss_prefs .prefErrorLog tr .errstr { + word-break: break-all; +} +body.ttrss_prefs .prefErrorLog tr .filename, +body.ttrss_prefs .prefErrorLog tr .login, +body.ttrss_prefs .prefErrorLog tr .timestamp { + color: #ccc; +} +body.ttrss_prefs hr { + border-color: #222; + max-width: 100%; +} +body.ttrss_prefs .phpinfo table { + border-collapse: collapse; +} +body.ttrss_prefs .phpinfo td.e, +body.ttrss_prefs .phpinfo td.v { + border: 1px solid #ccc; +} +body.ttrss_prefs .phpinfo td.e { + font-weight: bold; +} +body.ttrss_prefs .phpinfo td.v { + font-family: monospace; + word-break: break-all; +} +body.ttrss_prefs #filterNewRuleDlg .dijitValidationTextAreaError, +body.ttrss_main #filterNewRuleDlg .dijitValidationTextAreaError { + background: #ffc0c0; +} +body.ttrss_prefs #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError), +body.ttrss_main #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError) { + background: #c0ffc0; +} +body.ttrss_prefs fieldset, +body.ttrss_utility fieldset { + border-width: 0px; + padding: 5px 0px; +} +body.ttrss_prefs fieldset.narrow, +body.ttrss_utility fieldset.narrow { + padding: 2px 0px; +} +body.ttrss_prefs fieldset.align-right, +body.ttrss_utility fieldset.align-right { + text-align: right; +} +body.ttrss_prefs fieldset > label:first-of-type, +body.ttrss_utility fieldset > label:first-of-type { + min-width: 140px; + margin-right: 20px; + display: inline-block; + text-align: right; + font-weight: bold; +} +body.ttrss_prefs fieldset > label.checkbox, +body.ttrss_utility fieldset > label.checkbox { + display: inline; + font-weight: normal; +} +.flat li { + padding: 2px; +} +.flat #feedTree .dijitTreeContent .dijitInline { + vertical-align: baseline; +} +.flat .dijitButton i.material-icons { + position: relative; + top: -1px; +} +.flat .tabLabel > i.material-icons { + position: relative; + top: -1px; +} +.flat #filterDlg_Matches span.filterRule { + color: green; +} +.flat #filterTree .filterRules li.inverse, +.flat #filterDlg_Matches span.filterRule.inverse { + color: red; +} +.flat .dijitToolbar { + font-size: 13px; + padding: 0px; +} +.flat .dijitAccordionContainer { + box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1); +} +.flat .dijitCheckBox.dijitCheckBoxChecked { + background-color: #69C671; + border-color: #45b74f; +} +.flat .dijitMenu .dijitMenuItem .dijitMenuItemLabel { + padding: 4px 8px; + font-size: 13px; +} +.flat .dijitMenu .dijitMenuItem.dijitDisabled:not(.dijitMenuItemSelected) .dijitMenuItemLabel { + color: #d29745; +} +.flat .dijitMenu .dijitMenuItem td { + padding: 0px; +} +.flat .dijitCheckBox { + margin: 1px; +} +.flat .dijitCheckBox:before { + font-family: "flat-icon"; + content: "\f00c"; + color: white; +} +.flat .dijitTab i.material-icons, +.flat .dijitAccordionInnerContainer:not(.dijitSelected) i.material-icons { + color: #b87d2c; +} +.flat .dijitTree .dijitFolderClosed, +.flat .dijitTree .dijitFolderOpened { + display: none; +} +.flat .dijitTree .dijitTreeRowSelected .filterRules li { + color: white; +} +.flat .dijitTree .dijitTreeRowSelected .dijitTreeExpando { + color: #b87d2c; +} +.flat .dijitTree .dijitTreeNode .dijitTreeRow.dijitTreeRowSelected { + color: white; +} +.flat .dijitTree .dijitTreeRow .dijitTreeExpando { + position: relative; + top: -2px; +} +.flat .dijitTree .labelParam { + float: right; + margin-right: 16px; +} +.flat .dijitTree .dijitTreeRow.filterDisabled { + opacity: 0.5; +} +.flat .dijitTree .dijitTreeRow.filterDisabled .filterRules { + filter: saturate(0%); +} +.flat .dijitTree .feedParam { + float: right; +} +.flat .dijitTree .filterRules { + font-size: 12px; + line-height: normal; + white-space: normal; + margin-left: 28px; +} +.flat .dijitTree .filterRules li { + color: green; +} +.flat .dijitTree .dijitTreeContainer { + max-width: 100%; +} +.flat .dijitTree .dijitTreeRow { + overflow: hidden; + -moz-user-select: none; + text-overflow: ellipsis; +} +.flat label.dijitButton { + border: 1px solid #ccc; + padding: 6px; + border-radius: 4px; + cursor: pointer; + position: relative; + top: 1px; +} +.flat label.dijitButton:hover { + background-color: #222; +} +.flat .dijitTree .dijitTreeNode .dijitTreeRow { + padding: 4px 0px 4px; + border-width: 1px; + color: #ccc; +} +@font-face { + font-family: 'Material Icons'; + font-style: normal; + font-weight: 400; + src: url(../lib/iconfont/MaterialIcons-Regular.eot); + /* For IE6-8 */ + src: local('Material Icons'), local('MaterialIcons-Regular'), url(../lib/iconfont/MaterialIcons-Regular.woff2) format('woff2'), url(../lib/iconfont/MaterialIcons-Regular.woff) format('woff'), url(../lib/iconfont/MaterialIcons-Regular.ttf) format('truetype'); +} +.material-icons { + font-family: 'Material Icons'; + font-weight: normal; + font-style: normal; + font-size: 18px; + /* Preferred icon size */ + display: inline-block; + line-height: 1; + text-transform: none; + letter-spacing: normal; + word-wrap: normal; + white-space: nowrap; + direction: ltr; + vertical-align: middle; + /* Support for all WebKit browsers. */ + -webkit-font-smoothing: antialiased; + /* Support for Safari and Chrome. */ + text-rendering: optimizeLegibility; + /* Support for Firefox. */ + -moz-osx-font-smoothing: grayscale; + /* Support for IE. */ + font-feature-settings: 'liga'; +} +body.ttrss_utility.sanity_failed { + background: #900; +} +body.ttrss_utility { + background: #222; + color: #ccc; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + margin: 4em; +} +body.ttrss_utility .content { + background: #333; + border: 1px solid #222; + padding: 20px; + box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1); +} +body.ttrss_utility .content h2:first-of-type { + margin-top: 0; +} +body.ttrss_utility .content h2, +body.ttrss_utility .content h3, +body.ttrss_utility .content h4 { + color: #b87d2c; + font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; +} +body.ttrss_utility .content h2 { + font-size: 18px; +} +body.ttrss_utility .content h3 { + font-size: 16px; +} +body.ttrss_utility a { + color: #b87d2c; + text-decoration: none; +} +body.ttrss_utility a:hover, +body.ttrss_utility a:focus { + color: #664518; + text-decoration: underline; +} +body.ttrss_utility h1 { + color: gray; + font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 18px; + margin: 10px 0 0 0; +} +body.ttrss_utility .footer { + text-align: center; + padding-top: 10px; +} +body.ttrss_utility .footer a { + color: gray; +} +body.ttrss_utility .footer a:hover { + color: #b87d2c; +} +body.ttrss_utility form { + margin: 0; +} +body.ttrss_utility.otp .content fieldset > label { + display: inline; +} +body.ttrss_utility.ttrss_login { + margin: 0; + padding: 0; + width: 100%; + height: 100%; + position: absolute; + display: flex; + align-items: center; + justify-content: center; +} +body.ttrss_utility.ttrss_login .container { + max-width: 600px; + margin-left: auto; + margin-right: auto; +} +body.ttrss_utility.ttrss_login .container .content { + padding: 40px; +} +body.ttrss_utility.installer, +body.ttrss_utility.feed_debugger { + margin: 2em; +} +body.ttrss_utility.share_popup { + margin: 0; + padding: 0; + background: white; +} +body.ttrss_utility.share_popup .content { + padding: 15px; + border-width: 0; + box-shadow: none; +} +body.ttrss_zoom { + max-width: 900px; + margin: 2em auto; +} +body.ttrss_zoom div.post { + border: 1px solid #222; + background: #333; + box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1); +} +body.ttrss_zoom div.post .attachments { + display: none; +} +body.ttrss_zoom div.post div.header { + padding-bottom: 10px; + border: 0px solid #222; + border-bottom-width: 1px; + background: #333; + font-size: 12px; + color: #ccc; +} +body.ttrss_zoom div.post div.header .row { + display: flex; + margin-bottom: 4px; + flex-wrap: nowrap; + align-items: center; + justify-content: space-between; +} +body.ttrss_zoom div.post div.content { + font-size: 15px; + line-height: 1.5; + border-width: 0; + padding: 0; +} +body.ttrss_zoom div.post div.content img, +body.ttrss_zoom div.post div.content video { + max-width: 760px; + height: auto; +} +body.ttrss_zoom div.post div.content blockquote { + margin: 5px 0px 5px 0px; + color: #ccc; + padding-left: 10px; + border: 0px solid #222; + border-left-width: 4px; +} +body.ttrss_zoom div.post div.content code { + color: #009900; + font-family: monospace; + font-size: 12px; +} +body.ttrss_zoom div.post div.content pre { + margin: 5px 0px 5px 0px; + padding: 10px; + color: #ccc; + font-family: monospace; + font-size: 12px; + border: 0px solid #ccc; + background: #222; + display: block; + max-width: 98%; + overflow: auto; +} +body.flat.ttrss_main.ttrss_prefs #main, +body.flat.ttrss_main.ttrss_prefs #footer { + background: #222; +} +body.flat.ttrss_main.ttrss_prefs #footer a { + color: #fff; +} +body.flat.ttrss_main.ttrss_prefs td.filename, +body.flat.ttrss_main.ttrss_prefs div.prefHelp { + color: #999999; +} +body.flat.ttrss_main.ttrss_prefs hr { + border-color: #666; +} +body.flat.ttrss_main { + /* + .post .content img, + .cdm .content-inner img, + .post .content video, + .cdm .content-inner video { + transition : opacity 0.2s linear, filter 0.2s linear; + } + + .post .content img:not(:hover), + .cdm .content-inner img:not(:hover), + .post .content video:not(:hover), + .cdm .content-inner video:not(:hover) { + opacity : 0.5; + filter: grayscale(80%); + } */ +} +body.flat.ttrss_main img[src*='indicator_white.gif'] { + filter: invert(1); +} +body.flat.ttrss_main a:hover { + color: #dcae6e; +} +body.flat.ttrss_main #main, +body.flat.ttrss_main #overlay { + color: #ccc; + background: #333; +} +body.flat.ttrss_main #toolbar-frame #toolbar { + background: #222; + color: #e6e6e6; +} +body.flat.ttrss_main #feeds-holder { + background: #222; + box-shadow: inset -1px 0px 2px -1px #666; +} +body.flat.ttrss_main #feeds-holder #feedTree .counterNode.aux, +body.flat.ttrss_main #feeds-holder #feedTree .counterNode.marked { + background: #222; + color: #ccc; + border-color: #333; +} +body.flat.ttrss_main #feeds-holder #feedTree .counterNode.marked { + border-color: #b87d2c; +} +body.flat.ttrss_main #feeds-holder #feedTree .dijitTreeRowSelected { + background: #333; + border-color: #333 transparent; + color: #e6e6e6; +} +body.flat.ttrss_main #feeds-holder #feedTree .dijitTreeRowSelected .dijitTreeLabel { + text-shadow: none; +} +body.flat.ttrss_main #feeds-holder #feedTree i.icon.icon-inbox { + color: #999999; +} +body.flat.ttrss_main #headlines-frame .hl:not(.active):not(.Selected):not(.Unread), +body.flat.ttrss_main #headlines-frame .cdm.expandable:not(.active):not(.Selected):not(.Unread) { + background: #333; +} +body.flat.ttrss_main #headlines-frame .hl.Unread:not(.active):not(.Selected), +body.flat.ttrss_main #headlines-frame .cdm.expandable.Unread:not(.active):not(.Selected) { + background: #222; +} +body.flat.ttrss_main #headlines-frame .cdm.expanded { + background: #333; +} +body.flat.ttrss_main #headlines-frame .hl.Unread .title, +body.flat.ttrss_main #headlines-frame .cdm.Unread .title { + color: #e6e6e6; +} +body.flat.ttrss_main #headlines-frame .hl.active > *, +body.flat.ttrss_main #headlines-frame .hl.Selected > *, +body.flat.ttrss_main #headlines-frame .cdm.expandable.Selected > * { + filter: invert(1); +} +body.flat.ttrss_main #headlines-frame .hl.active > * img, +body.flat.ttrss_main #headlines-frame .hl.Selected > * img, +body.flat.ttrss_main #headlines-frame .cdm.expandable.Selected > * img { + filter: invert(1); +} +body.flat.ttrss_main #headlines-frame .hl.active .dijitCheckBox, +body.flat.ttrss_main #headlines-frame .hl.Selected .dijitCheckBox, +body.flat.ttrss_main #headlines-frame .cdm.expandable.Selected .dijitCheckBox { + filter: invert(1); +} +body.flat.ttrss_main #headlines-frame .hl.Selected.marked i.marked-pic, +body.flat.ttrss_main #headlines-frame .cdm.expandable.Selected.marked i.marked-pic, +body.flat.ttrss_main #headlines-frame .hl.active.marked i.marked-pic { + filter: invert(1); +} +body.flat.ttrss_main #headlines-frame .hl.Selected.published i.pub-pic, +body.flat.ttrss_main #headlines-frame .cdm.expandable.Selected.published i.pub-pic, +body.flat.ttrss_main #headlines-frame .hl.active.published i.pub-pic { + filter: invert(1); +} +body.flat.ttrss_main #headlines-frame .cdm.expanded.active .title, +body.flat.ttrss_main #headlines-frame .cdm.expandable.active .title { + color: #b87d2c; +} +body.flat.ttrss_main #headlines-frame .cdm.expandable.active { + background: #222 ! important; +} +body.flat.ttrss_main #headlines-frame .hl, +body.flat.ttrss_main #headlines-frame .cdm { + color: #ccc; +} +body.flat.ttrss_main #headlines-frame .hl .title, +body.flat.ttrss_main #headlines-frame .cdm .title { + color: #ccc; +} +body.flat.ttrss_main #headlines-frame .hl .author, +body.flat.ttrss_main #headlines-frame .cdm .author { + color: #999999; +} +body.flat.ttrss_main #headlines-frame .hl .updated, +body.flat.ttrss_main #headlines-frame .cdm .updated, +body.flat.ttrss_main #headlines-frame .hl .content, +body.flat.ttrss_main #headlines-frame .cdm .content { + color: #ccc; +} +body.flat.ttrss_main #headlines-frame .hl .feed a, +body.flat.ttrss_main #headlines-frame .cdm .feed a { + color: #e6e6e6; +} +body.flat.ttrss_main #headlines-frame .cdm .footer { + border-color: #222; + color: #ccc; +} +body.flat.ttrss_main #headlines-frame .left i.material-icons, +body.flat.ttrss_main #headlines-frame .left .dijitCheckBox { + opacity: 0.7; +} +body.flat.ttrss_main .dijitToolbar .dijitSelect .dijitButtonContents, +body.flat.ttrss_main .dijitToolbar .dijitSelect .dijitButtonNode { + transition: background-color 0.3s linear; +} +body.flat.ttrss_main .dijitToolbar .dijitSelect:not(.dijitHover) .dijitButtonContents, +body.flat.ttrss_main .dijitToolbar .dijitSelect:not(.dijitHover) .dijitButtonNode { + background-color: #222; +} +body.flat.ttrss_main .dijitCheckBox:not(.dijitChecked)::before { + color: #999999; + background: #222; +} +body.flat.ttrss_main .text-muted { + color: #999999; +} +body.flat.ttrss_main .dijitAccordionInnerContainerSelected .dijitAccordionTitle { + color: white; +} +body.flat.ttrss_main .dijitDialog .dijitDialogPaneContent { + background: #222; +} +body.flat.ttrss_main .dijitTab:not(.dijitTabChecked) { + background: #222; +} +body.flat.ttrss_main .dijitTab.dijitTabChecked.dijitTabHover { + color: #e6e6e6; +} +body.flat.ttrss_main label.dijitButton { + border: 1px solid #666; +} +body.flat.ttrss_main label.dijitButton:hover { + border-color: #2f2f2f; + background-color: #333; +} +body.flat.ttrss_main textarea { + color: #e6e6e6; +} +body.flat.ttrss_main code { + color: #c90 ! important; +} +body.flat.ttrss_main .panel { + background-color: #222; + border-color: #666; +} +body.flat.ttrss_main .dijitDialog .panel { + background-color: #333; +} +body.flat.ttrss_main #headlines-frame blockquote, +body.flat.ttrss_main #content-insert blockquote { + color: #ccc; + border-color: #b87d2c; +} +body.flat.ttrss_main pre { + color: #ccc; + background: #222 ! important; +} +body.flat.ttrss_main ul#filterDlg_Matches, +body.flat.ttrss_main ul#filterDlg_Actions { + background: #222; + border-color: #666; +} +body.flat.ttrss_main .article-note { + background: #b87d2c; + border-color: #b87d2c; + color: #333; +} +body.flat.ttrss_main .article-note i.material-icons { + color: #333; +} +body.flat.ttrss_main ::-webkit-scrollbar { + width: 4px; +} +body.flat.ttrss_main ::-webkit-scrollbar-thumb { + background-color: #666; +} +body.flat.ttrss_main ::-webkit-scrollbar-track { + background-color: #222; +} +body.flat.ttrss_main .alert { + background: #222; + border-color: #664518; + color: #b87d2c; +} +body.flat.ttrss_main .alert.alert-info { + color: #3a87ad; + border-color: #204b61; +} +body.flat.ttrss_main .alert.alert-danger { + color: #b94a48; + border-color: #702c2b; +} +body.flat.ttrss_main #filterNewRuleDlg .dijitValidationTextAreaError { + background: #503030; +} +body.flat.ttrss_main #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError) { + background: #305030; +} +/* rules specific to compact.css */ +body.ttrss_main.ttrss_index.flat #feedTree.dijitTree .dijitTreeLabel { + font-size: 13px ! important; +} +body.ttrss_main.ttrss_index.flat .dijitMenu .dijitMenuItemLabel, +body.ttrss_main.ttrss_index.flat .content-inner, +body.ttrss_main.ttrss_index.flat #content-insert, +body.ttrss_main.ttrss_index.flat .cdm .content, +body.ttrss_main.ttrss_index.flat .post .content { + font-size: 12px ! important; +} +body.ttrss_main.ttrss_index.flat div[id*=RROW] i.material-icons { + font-size: 18px; +} +body.ttrss_main.ttrss_index.flat .hl, +body.ttrss_main.ttrss_index.flat .post .header .title, +body.ttrss_main.ttrss_index.flat .cdm .title { + font-size: 13px ! important; +} diff --git a/themes/compact_night.less b/themes/compact_night.less new file mode 100644 index 000000000..5cefa726d --- /dev/null +++ b/themes/compact_night.less @@ -0,0 +1,2 @@ +@import "night_base.less"; +@import "compact_base.less"; diff --git a/themes/light.css b/themes/light.css index f8f8b65ce..d713e071d 100644 --- a/themes/light.css +++ b/themes/light.css @@ -70,12 +70,19 @@ body.ttrss_main div.post div.content video { max-width: 98%; height: auto; } -body.ttrss_main div.post div.content p { - hyphens: auto; +body.ttrss_main div.post div.content div.embed-responsive { + overflow: hidden; + padding-bottom: 56.25%; + position: relative; } -body.ttrss_main div.post div.content iframe { - min-width: 50%; - max-width: 98%; +body.ttrss_main div.post div.content div.embed-responsive iframe { + border: 0; + bottom: 0; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; } body.ttrss_main .inline-player { display: flex; @@ -661,13 +668,6 @@ body.ttrss_main #headlines-frame div.feed-title a { body.ttrss_main #headlines-frame div.feed-title a:hover { color: #257aa7; } -body.ttrss_main #headlines-frame.smooth-scroll { - scroll-behavior: smooth; -} -body.ttrss_main #headlines-frame.forbid-smooth-scroll, -body.ttrss_main #content-insert.forbid-smooth-scroll { - scroll-behavior: auto; -} body.ttrss_main #toolbar-frame_splitter { display: none; } @@ -754,7 +754,6 @@ body.ttrss_main #content-insert { line-height: 1.5; overflow: auto; -webkit-overflow-scrolling: touch; - scroll-behavior: smooth; } body.ttrss_main img.feed-icon, body.ttrss_main img.icon { @@ -865,6 +864,22 @@ body.ttrss_main #feedEditDlg img.feedIcon { height: auto; width: auto; } +body.ttrss_main .dijitTooltipContents { + background: #1c5c7d; + color: #f5f5f5; +} +body.ttrss_main .dijitTooltipRight .dijitTooltipConnector { + border-right-color: #1c5c7d; +} +body.ttrss_main .dijitTooltipLeft .dijitTooltipConnector { + border-left-color: #1c5c7d; +} +body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector { + border-bottom-color: #1c5c7d; +} +body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { + border-top-color: #1c5c7d; +} body.ttrss_main .dijitDialog h1:first-of-type, body.ttrss_main .dijitDialog h2:first-of-type, body.ttrss_main .dijitDialog h3:first-of-type, @@ -877,10 +892,10 @@ body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Ma body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .counterNode.marked { display: inline-block; } -body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.AlwaysVisible):not(.Special):not(.Has_Marked) { +body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.AlwaysVisible):not(.Special):not(.Has_Marked) { display: none; } -body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.AlwaysVisible):not(.Has_Marked) { +body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.AlwaysVisible):not(.Has_Marked) { display: none; } body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow.Unread .counterNode.unread { @@ -889,10 +904,10 @@ body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow. body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow.Has_Aux:not(.Unread) .counterNode.aux { display: inline-block; } -body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.Unread):not(.AlwaysVisible):not(.Special) { +body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.Unread):not(.AlwaysVisible):not(.Special) { display: none; } -body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.Unread):not(.AlwaysVisible) { +body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.Unread):not(.AlwaysVisible) { display: none; } body.ttrss_main #toolbar-headlines i.icon-syndicate { @@ -917,12 +932,10 @@ body.ttrss_main i.icon-no-feed { body.ttrss_main .dijitTreeRow.UpdatesDisabled .dijitTreeLabel { opacity: 0.5; } -body.ttrss_main #floatingTitle.marked i.marked-pic, body.ttrss_main .cdm.marked .left i.marked-pic, body.ttrss_main .hl.marked .left i.marked-pic { color: #ffc069; } -body.ttrss_main #floatingTitle.published i.pub-pic, body.ttrss_main .cdm.published .left i.pub-pic, body.ttrss_main .hl.published .left i.pub-pic { color: #ff7c4b; @@ -1116,6 +1129,11 @@ video::-webkit-media-controls-overlay-play-button { .cdm i.material-icons { color: #777; } +.cdm .header { + position: sticky; + top: 0; + z-index: 3; +} .cdm .header, .cdm .footer { display: flex; @@ -1128,6 +1146,9 @@ video::-webkit-media-controls-overlay-play-button { margin: 0px 4px; vertical-align: middle; } +.cdm .header-sticky-guard { + height: 0; +} .cdm .header { align-items: center; } @@ -1207,9 +1228,6 @@ video::-webkit-media-controls-overlay-play-button { margin-top: 0px; margin-bottom: 0px; } -div.cdm.expanded div.header { - background: transparent ! important; -} div.cdm.expanded div.header a.title { font-size: 16px; color: #999; @@ -1267,15 +1285,19 @@ div.cdm.vgrlf .feed { font-style: italic; font-size: 11px; } -.cdm div.content-inner p { - /*max-width : 650px;*/ - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; +.cdm div.content-inner div.embed-responsive { + overflow: hidden; + padding-bottom: 56.25%; + position: relative; } -.cdm div.content-inner iframe { - min-width: 50%; - max-width: 98%; +.cdm div.content-inner div.embed-responsive iframe { + border: 0; + bottom: 0; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; } .cdm div.header span.author { white-space: nowrap; @@ -1288,115 +1310,6 @@ div.cdm.vgrlf .feed { display: inline-block; padding: 1px 4px 1px 4px; } -#main:not(.expandable) div#floatingTitle .collapse { - display: none; -} -div#floatingTitle { - position: absolute; - z-index: 5; - top: 0px; - right: 0px; - left: 0px; - border: 0px solid #ddd; - border-bottom-width: 1px; - background: white; - color: #555; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1); - align-items: center; -} -div#floatingTitle > * { - white-space: nowrap; - padding: 4px; -} -div#floatingTitle .left, -div#floatingTitle .right { - display: flex; - align-items: center; -} -div#floatingTitle .left i.material-icons, -div#floatingTitle .right i.material-icons { - margin-left: 2px; - font-size: 21px; - padding: 2px; - user-select: none; -} -div#floatingTitle .left i.icon-anchor, -div#floatingTitle .right i.icon-anchor { - margin-left: 0px; - margin-right: 1px; - padding: 0px; - color: #ccc; - cursor: pointer; -} -div#floatingTitle .excerpt { - display: none; -} -div#floatingTitle .collapse i.material-icons { - color: #257aa7; - cursor: pointer; -} -div#floatingTitle span.author { - color: #555; - font-size: 11px; - font-weight: normal; -} -div#floatingTitle a.title { - font-size: 16px; - color: #999; - transition: color 0.2s, background 0.2s; - font-weight: 600; - text-rendering: optimizelegibility; - font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; -} -div#floatingTitle div.feed { - padding-right: 10px; - color: #555; - font-weight: normal; - font-style: italic; - font-size: 11px; - white-space: nowrap; -} -div#floatingTitle div.feed a { - border-radius: 4px; - display: inline-block; - padding: 1px 4px 1px 4px; -} -div#floatingTitle span.updated { - padding-right: 10px; - white-space: nowrap; - color: #555; - font-size: 11px; -} -div#floatingTitle div.feed a { - color: #555; -} -div#floatingTitle span.titleWrap { - width: 100%; - white-space: normal; -} -div#floatingTitle .feed-title > * { - display: table-cell; - vertical-align: middle; -} -div#floatingTitle .feed-title a.title { - width: 100%; -} -div#floatingTitle .feed-title a.catchup { - text-align: right; - color: #555; - padding-right: 10px; - font-size: 11px; - white-space: nowrap; -} -div#floatingTitle .feed-title a.catchup:hover { - color: #257aa7; -} -div#floatingTitle.Unread a.title { - color: black; -} .cdm.expandable { background-color: #f5f5f5; border: 0px solid #ddd; @@ -1469,6 +1382,15 @@ div.cdm.expandable:not(.active) .content, div.cdm.expandable:not(.active) .collapse { display: none; } +div.cdm.expandable.active .header[stuck], +div.cdm.expanded .header[stuck] { + box-shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.1); + border: 0 solid #ddd; + border-bottom-width: 1px; + background: white ! important; + opacity: 0.9; + backdrop-filter: blur(6px); +} body.ttrss_prefs { background-color: #f5f5f5; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; @@ -1594,12 +1516,12 @@ body.ttrss_prefs .phpinfo td.v { font-family: monospace; word-break: break-all; } -body.ttrss_prefs #filterNewRuleDlg .invalid, -body.ttrss_main #filterNewRuleDlg .invalid { +body.ttrss_prefs #filterNewRuleDlg .dijitValidationTextAreaError, +body.ttrss_main #filterNewRuleDlg .dijitValidationTextAreaError { background: #ffc0c0; } -body.ttrss_prefs #filterNewRuleDlg .valid, -body.ttrss_main #filterNewRuleDlg .valid { +body.ttrss_prefs #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError), +body.ttrss_main #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError) { background: #c0ffc0; } body.ttrss_prefs fieldset, @@ -1906,11 +1828,6 @@ body.ttrss_zoom div.post div.header .row { align-items: center; justify-content: space-between; } -body.ttrss_zoom div.post p { - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; -} body.ttrss_zoom div.post div.content { font-size: 15px; line-height: 1.5; @@ -1946,4 +1863,3 @@ body.ttrss_zoom div.post div.content pre { max-width: 98%; overflow: auto; } -/*# sourceMappingURL=light.css.map */
\ No newline at end of file diff --git a/themes/light.css.map b/themes/light.css.map deleted file mode 100644 index 00664b779..000000000 --- a/themes/light.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["C:/Users/fox/Projects/tt-rss/css/default.less","C:/Users/fox/Projects/tt-rss/css/defines.less","C:/Users/fox/Projects/tt-rss/css/tt-rss.less","C:/Users/fox/Projects/tt-rss/css/cdm.less","C:/Users/fox/Projects/tt-rss/css/prefs.less","C:/Users/fox/Projects/tt-rss/css/utility.less","C:/Users/fox/Projects/tt-rss/css/dijit_basic.less","C:/Users/fox/Projects/tt-rss/css/dijit_light.less","C:/Users/fox/Projects/tt-rss/css/zoom.less"],"names":[],"mappings":"QAGQ;ACcR,IAAI;AACJ,IAAI;AACJ;EACE,kBAAA;EACA,WAAA;EACA,YAAA;EACA,SAAA;EACA,UAAA;EACA,SAAA;;ACzBF,IAAI;EACH,iBAAA;EACA,YAAA;EACA,aAAa,8CAAb;EACA,eAAA;EAC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A,kBAAA;EACA,aAAA;;AAjCH,IAAI,WAIH,IAAG,KAgCF,IAAG;EACF,eAAA;EACA,gBAAA;EACA,eAAA;EACA,UAAA;;AAxCH,IAAI,WAIH,IAAG,KAgCF,IAAG,QAMF;AA1CH,IAAI,WAIH,IAAG,KAgCF,IAAG,QAMG;EACJ,gBAAA;EACA,YAAA;;AA5CJ,IAAI,WAIH,IAAG,KAgCF,IAAG,QAWF;EACC,uBAAA;EACA,WAAA;EACA,kBAAA;EACA,sBAAA;EACA,sBAAA;;AApDJ,IAAI,WAIH,IAAG,KAgCF,IAAG,QAmBF;EACC,cAAA;EACA,sBAAA;EACA,eAAA;;AA1DJ,IAAI,WAIH,IAAG,KAgCF,IAAG,QAyBF;EACC,uBAAA;EACA,aAAA;EACA,WAAA;EACA,sBAAA;EACA,eAAA;EACA,sBAAA;EACA,mBAAA;EACA,cAAA;EACA,cAAA;EACA,cAAA","file":"light.css"}
\ No newline at end of file diff --git a/themes/light.less b/themes/light.less index e0f21f110..2e9b4da6a 100644 --- a/themes/light.less +++ b/themes/light.less @@ -1 +1 @@ -@import "../css/default.less"; +@import "light/light_base.less"; diff --git a/css/cdm.less b/themes/light/cdm.less index 7ac28913e..3a5b602f2 100755..100644 --- a/css/cdm.less +++ b/themes/light/cdm.less @@ -3,6 +3,12 @@ color : @color-icon; } + .header { + position: sticky; + top : 0; + z-index: 3; + } + .header, .footer { display : flex; flex-direction : row; @@ -15,6 +21,10 @@ vertical-align: middle; } + .header-sticky-guard { + height : 0; + } + .header { align-items : center; @@ -110,10 +120,6 @@ } -div.cdm.expanded div.header { - background : transparent ! important; -} - div.cdm.expanded div.header a.title { font-size : 16px; color : #999; @@ -185,16 +191,20 @@ div.cdm.vgrlf .feed { font-size: 11px; } - div.content-inner p { - /*max-width : 650px;*/ - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; - } - - div.content-inner iframe { - min-width : 50%; - max-width : 98%; + div.content-inner div.embed-responsive { + overflow : hidden; + padding-bottom : @embed-responsive-padding; + position : relative; + + iframe { + border : 0; + bottom : 0; + height : 100%; + left : 0; + position : absolute; + top : 0; + width : 100%; + } } div.header span.author { @@ -211,137 +221,6 @@ div.cdm.vgrlf .feed { } } -#main:not(.expandable) div#floatingTitle { - .collapse { - display : none; - } -} - -div#floatingTitle { - position : absolute; - z-index : 5; - top : 0px; - right : 0px; - left : 0px; - border: 0px solid @border-default; - border-bottom-width: 1px; - background : white; - color : @default-text; - display : flex; - flex-direction : row; - flex-wrap : nowrap; - box-shadow : 0px 1px 1px -1px rgba(0,0,0,0.1); - align-items: center; - - > * { - white-space : nowrap; - padding : 4px; - } - - .left, .right { - display : flex; - align-items : center; - - i.material-icons { - margin-left : 2px; - font-size : 21px; - padding : 2px; - user-select: none; - } - - i.icon-anchor { - margin-left : 0px; - margin-right : 1px; // replaces checkbox which is a bit wider - padding : 0px; - color : #ccc; - cursor : pointer; - } - } - - .excerpt { - display : none; - } - - .collapse i.material-icons { - color : @color-accent; - cursor : pointer; - } - - span.author { - color : @default-text; - font-size : 11px; - font-weight : normal; - } - - a.title { - font-size : 16px; - color : #999; - transition : color 0.2s, background 0.2s; - font-weight : 600; - text-rendering: optimizelegibility; - font-family : @fonts-ui-bold; - } - - div.feed { - padding-right : 10px; - color : @default-text; - font-weight : normal; - font-style : italic; - font-size : 11px; - white-space : nowrap; - } - - div.feed a { - border-radius : 4px; - display : inline-block; - padding : 1px 4px 1px 4px; - } - - span.updated { - padding-right : 10px; - white-space : nowrap; - color : @default-text; - font-size : 11px; - } - - div.feed a { - color : @default-text; - } - - span.titleWrap { - width : 100%; - white-space : normal; - } - - .feed-title { - > * { - display : table-cell; - vertical-align : middle; - } - - a.title { - width : 100%; - } - - a.catchup { - text-align : right; - color : @default-text; - padding-right : 10px; - font-size : 11px; - white-space : nowrap; - } - - a.catchup:hover { - color : @color-link; - } - - } -} - -div#floatingTitle.Unread a.title { - color : black; -} - .cdm.expandable { background-color : @color-panel-bg; border: 0px solid @border-default; @@ -432,3 +311,17 @@ div.cdm.expandable:not(.active) { display : none; } } + +div.cdm { + &.expandable.active, + &.expanded { + .header[stuck] { + box-shadow : 0 1px 1px -1px rgba(0,0,0,0.1); + border: 0 solid @border-default; + border-bottom-width: 1px; + background : @default-bg ! important; + opacity: 0.9; + backdrop-filter: blur(6px); + } + } +} diff --git a/css/defines.less b/themes/light/defines.less index 1926a06a5..7de7a7686 100644 --- a/css/defines.less +++ b/themes/light/defines.less @@ -14,6 +14,10 @@ @border-default : #ddd; @default-text: #555; @color-icon: #777; +@color-tooltip-fg: @color-panel-bg; +@color-tooltip-bg: darken(@color-accent, 10%); + +@embed-responsive-padding: 56.25%; // Use 56.25% for 16:9 aspect ratio, 75% for 4:3. body.ttrss_main, body.ttrss_prefs, diff --git a/css/dijit_basic.less b/themes/light/dijit_basic.less index a00cc5e59..a00cc5e59 100644 --- a/css/dijit_basic.less +++ b/themes/light/dijit_basic.less diff --git a/css/dijit_light.less b/themes/light/dijit_light.less index 53b098bba..53b098bba 100644 --- a/css/dijit_light.less +++ b/themes/light/dijit_light.less diff --git a/css/default.less b/themes/light/light_base.less index 3e94b6a09..769f23efe 100644 --- a/css/default.less +++ b/themes/light/light_base.less @@ -1,4 +1,4 @@ @import "defines.less"; @import "dijit_light.less"; @import "zoom.less"; -@import "../lib/flat-ttrss/flat_combined.css";
\ No newline at end of file +@import "../lib/flat-ttrss/flat_combined.css"; diff --git a/css/prefs.less b/themes/light/prefs.less index 7b187e584..92084a9c8 100644 --- a/css/prefs.less +++ b/themes/light/prefs.less @@ -155,10 +155,10 @@ body.ttrss_prefs { body.ttrss_prefs, body.ttrss_main { #filterNewRuleDlg { - .invalid { + .dijitValidationTextAreaError { background : #ffc0c0; } - .valid { + .dijitValidationTextArea:not(.dijitValidationTextAreaError) { background : #c0ffc0; } } diff --git a/css/tt-rss.less b/themes/light/tt-rss.less index 82be48d75..b3fba8cf9 100755..100644 --- a/css/tt-rss.less +++ b/themes/light/tt-rss.less @@ -66,13 +66,20 @@ body.ttrss_main { height: auto; } - p { - hyphens: auto; - } + div.embed-responsive { + overflow : hidden; + padding-bottom : @embed-responsive-padding; + position : relative; - iframe { - min-width : 50%; - max-width : 98%; + iframe { + border : 0; + bottom : 0; + height : 100%; + left : 0; + position : absolute; + top : 0; + width : 100%; + } } } } @@ -777,15 +784,6 @@ body.ttrss_main { } } - #headlines-frame.smooth-scroll { - scroll-behavior: smooth; - } - - #headlines-frame.forbid-smooth-scroll, - #content-insert.forbid-smooth-scroll { - scroll-behavior : auto; - } - #toolbar-frame_splitter { display : none; } @@ -885,7 +883,6 @@ body.ttrss_main { line-height: 1.5; overflow : auto; -webkit-overflow-scrolling : touch; - scroll-behavior: smooth; } img.feed-icon, img.icon { @@ -1018,6 +1015,27 @@ body.ttrss_main { height : auto; width : auto; } + + .dijitTooltipContents { + background : @color-tooltip-bg; + color : @color-tooltip-fg; + } + + .dijitTooltipRight .dijitTooltipConnector { + border-right-color : @color-tooltip-bg; + } + + .dijitTooltipLeft .dijitTooltipConnector { + border-left-color : @color-tooltip-bg; + } + + .dijitTooltipBelow .dijitTooltipConnector { + border-bottom-color : @color-tooltip-bg; + } + + .dijitTooltipAbove .dijitTooltipConnector { + border-top-color : @color-tooltip-bg; + } } body.ttrss_main .dijitDialog { @@ -1039,12 +1057,12 @@ body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree { } body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree - .dijitTreeRow:not(.dijitTreeRowSelected):not(.AlwaysVisible):not(.Special):not(.Has_Marked) { + .dijitTreeRow:not(.AlwaysVisible):not(.Special):not(.Has_Marked) { display : none; } body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree - .dijitTreeRow:not(.dijitTreeRowSelected):not(.AlwaysVisible):not(.Has_Marked) { + .dijitTreeRow:not(.AlwaysVisible):not(.Has_Marked) { display : none; } @@ -1059,12 +1077,12 @@ body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree { } body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree - .dijitTreeRow:not(.dijitTreeRowSelected):not(.Unread):not(.AlwaysVisible):not(.Special) { + .dijitTreeRow:not(.Unread):not(.AlwaysVisible):not(.Special) { display : none; } body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree - .dijitTreeRow:not(.dijitTreeRowSelected):not(.Unread):not(.AlwaysVisible) { + .dijitTreeRow:not(.Unread):not(.AlwaysVisible) { display : none; } @@ -1096,13 +1114,11 @@ body.ttrss_main { opacity : 0.5; } - #floatingTitle.marked i.marked-pic, .cdm.marked .left i.marked-pic, .hl.marked .left i.marked-pic { color : @color-marked; } - #floatingTitle.published i.pub-pic, .cdm.published .left i.pub-pic, .hl.published .left i.pub-pic { color : @color-published; diff --git a/css/utility.less b/themes/light/utility.less index 087c4ced3..087c4ced3 100644 --- a/css/utility.less +++ b/themes/light/utility.less diff --git a/css/zoom.less b/themes/light/zoom.less index ae8de7dba..e06939ac2 100644 --- a/css/zoom.less +++ b/themes/light/zoom.less @@ -28,12 +28,6 @@ body.ttrss_zoom { } } - p { - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; - } - div.content { font-size : 15px; line-height : 1.5; diff --git a/themes/night.css b/themes/night.css index 35cced3cf..7edc043a0 100644 --- a/themes/night.css +++ b/themes/night.css @@ -71,12 +71,19 @@ body.ttrss_main div.post div.content video { max-width: 98%; height: auto; } -body.ttrss_main div.post div.content p { - hyphens: auto; +body.ttrss_main div.post div.content div.embed-responsive { + overflow: hidden; + padding-bottom: 56.25%; + position: relative; } -body.ttrss_main div.post div.content iframe { - min-width: 50%; - max-width: 98%; +body.ttrss_main div.post div.content div.embed-responsive iframe { + border: 0; + bottom: 0; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; } body.ttrss_main .inline-player { display: flex; @@ -662,13 +669,6 @@ body.ttrss_main #headlines-frame div.feed-title a { body.ttrss_main #headlines-frame div.feed-title a:hover { color: #b87d2c; } -body.ttrss_main #headlines-frame.smooth-scroll { - scroll-behavior: smooth; -} -body.ttrss_main #headlines-frame.forbid-smooth-scroll, -body.ttrss_main #content-insert.forbid-smooth-scroll { - scroll-behavior: auto; -} body.ttrss_main #toolbar-frame_splitter { display: none; } @@ -755,7 +755,6 @@ body.ttrss_main #content-insert { line-height: 1.5; overflow: auto; -webkit-overflow-scrolling: touch; - scroll-behavior: smooth; } body.ttrss_main img.feed-icon, body.ttrss_main img.icon { @@ -866,6 +865,22 @@ body.ttrss_main #feedEditDlg img.feedIcon { height: auto; width: auto; } +body.ttrss_main .dijitTooltipContents { + background: #d29745; + color: #222; +} +body.ttrss_main .dijitTooltipRight .dijitTooltipConnector { + border-right-color: #d29745; +} +body.ttrss_main .dijitTooltipLeft .dijitTooltipConnector { + border-left-color: #d29745; +} +body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector { + border-bottom-color: #d29745; +} +body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { + border-top-color: #d29745; +} body.ttrss_main .dijitDialog h1:first-of-type, body.ttrss_main .dijitDialog h2:first-of-type, body.ttrss_main .dijitDialog h3:first-of-type, @@ -878,10 +893,10 @@ body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Ma body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .counterNode.marked { display: inline-block; } -body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.AlwaysVisible):not(.Special):not(.Has_Marked) { +body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.AlwaysVisible):not(.Special):not(.Has_Marked) { display: none; } -body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.AlwaysVisible):not(.Has_Marked) { +body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.AlwaysVisible):not(.Has_Marked) { display: none; } body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow.Unread .counterNode.unread { @@ -890,10 +905,10 @@ body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow. body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow.Has_Aux:not(.Unread) .counterNode.aux { display: inline-block; } -body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.Unread):not(.AlwaysVisible):not(.Special) { +body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.Unread):not(.AlwaysVisible):not(.Special) { display: none; } -body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.Unread):not(.AlwaysVisible) { +body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.Unread):not(.AlwaysVisible) { display: none; } body.ttrss_main #toolbar-headlines i.icon-syndicate { @@ -918,12 +933,10 @@ body.ttrss_main i.icon-no-feed { body.ttrss_main .dijitTreeRow.UpdatesDisabled .dijitTreeLabel { opacity: 0.5; } -body.ttrss_main #floatingTitle.marked i.marked-pic, body.ttrss_main .cdm.marked .left i.marked-pic, body.ttrss_main .hl.marked .left i.marked-pic { color: #ffc069; } -body.ttrss_main #floatingTitle.published i.pub-pic, body.ttrss_main .cdm.published .left i.pub-pic, body.ttrss_main .hl.published .left i.pub-pic { color: #ff7c4b; @@ -1117,6 +1130,11 @@ video::-webkit-media-controls-overlay-play-button { .cdm i.material-icons { color: #777; } +.cdm .header { + position: sticky; + top: 0; + z-index: 3; +} .cdm .header, .cdm .footer { display: flex; @@ -1129,6 +1147,9 @@ video::-webkit-media-controls-overlay-play-button { margin: 0px 4px; vertical-align: middle; } +.cdm .header-sticky-guard { + height: 0; +} .cdm .header { align-items: center; } @@ -1208,9 +1229,6 @@ video::-webkit-media-controls-overlay-play-button { margin-top: 0px; margin-bottom: 0px; } -div.cdm.expanded div.header { - background: transparent ! important; -} div.cdm.expanded div.header a.title { font-size: 16px; color: #999; @@ -1268,15 +1286,19 @@ div.cdm.vgrlf .feed { font-style: italic; font-size: 11px; } -.cdm div.content-inner p { - /*max-width : 650px;*/ - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; +.cdm div.content-inner div.embed-responsive { + overflow: hidden; + padding-bottom: 56.25%; + position: relative; } -.cdm div.content-inner iframe { - min-width: 50%; - max-width: 98%; +.cdm div.content-inner div.embed-responsive iframe { + border: 0; + bottom: 0; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; } .cdm div.header span.author { white-space: nowrap; @@ -1289,115 +1311,6 @@ div.cdm.vgrlf .feed { display: inline-block; padding: 1px 4px 1px 4px; } -#main:not(.expandable) div#floatingTitle .collapse { - display: none; -} -div#floatingTitle { - position: absolute; - z-index: 5; - top: 0px; - right: 0px; - left: 0px; - border: 0px solid #222; - border-bottom-width: 1px; - background: white; - color: #ccc; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1); - align-items: center; -} -div#floatingTitle > * { - white-space: nowrap; - padding: 4px; -} -div#floatingTitle .left, -div#floatingTitle .right { - display: flex; - align-items: center; -} -div#floatingTitle .left i.material-icons, -div#floatingTitle .right i.material-icons { - margin-left: 2px; - font-size: 21px; - padding: 2px; - user-select: none; -} -div#floatingTitle .left i.icon-anchor, -div#floatingTitle .right i.icon-anchor { - margin-left: 0px; - margin-right: 1px; - padding: 0px; - color: #ccc; - cursor: pointer; -} -div#floatingTitle .excerpt { - display: none; -} -div#floatingTitle .collapse i.material-icons { - color: #b87d2c; - cursor: pointer; -} -div#floatingTitle span.author { - color: #ccc; - font-size: 11px; - font-weight: normal; -} -div#floatingTitle a.title { - font-size: 16px; - color: #999; - transition: color 0.2s, background 0.2s; - font-weight: 600; - text-rendering: optimizelegibility; - font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; -} -div#floatingTitle div.feed { - padding-right: 10px; - color: #ccc; - font-weight: normal; - font-style: italic; - font-size: 11px; - white-space: nowrap; -} -div#floatingTitle div.feed a { - border-radius: 4px; - display: inline-block; - padding: 1px 4px 1px 4px; -} -div#floatingTitle span.updated { - padding-right: 10px; - white-space: nowrap; - color: #ccc; - font-size: 11px; -} -div#floatingTitle div.feed a { - color: #ccc; -} -div#floatingTitle span.titleWrap { - width: 100%; - white-space: normal; -} -div#floatingTitle .feed-title > * { - display: table-cell; - vertical-align: middle; -} -div#floatingTitle .feed-title a.title { - width: 100%; -} -div#floatingTitle .feed-title a.catchup { - text-align: right; - color: #ccc; - padding-right: 10px; - font-size: 11px; - white-space: nowrap; -} -div#floatingTitle .feed-title a.catchup:hover { - color: #b87d2c; -} -div#floatingTitle.Unread a.title { - color: black; -} .cdm.expandable { background-color: #222; border: 0px solid #222; @@ -1470,6 +1383,15 @@ div.cdm.expandable:not(.active) .content, div.cdm.expandable:not(.active) .collapse { display: none; } +div.cdm.expandable.active .header[stuck], +div.cdm.expanded .header[stuck] { + box-shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.1); + border: 0 solid #222; + border-bottom-width: 1px; + background: #333 ! important; + opacity: 0.9; + backdrop-filter: blur(6px); +} body.ttrss_prefs { background-color: #222; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; @@ -1595,12 +1517,12 @@ body.ttrss_prefs .phpinfo td.v { font-family: monospace; word-break: break-all; } -body.ttrss_prefs #filterNewRuleDlg .invalid, -body.ttrss_main #filterNewRuleDlg .invalid { +body.ttrss_prefs #filterNewRuleDlg .dijitValidationTextAreaError, +body.ttrss_main #filterNewRuleDlg .dijitValidationTextAreaError { background: #ffc0c0; } -body.ttrss_prefs #filterNewRuleDlg .valid, -body.ttrss_main #filterNewRuleDlg .valid { +body.ttrss_prefs #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError), +body.ttrss_main #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError) { background: #c0ffc0; } body.ttrss_prefs fieldset, @@ -1898,11 +1820,6 @@ body.ttrss_zoom div.post div.header .row { align-items: center; justify-content: space-between; } -body.ttrss_zoom div.post p { - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; -} body.ttrss_zoom div.post div.content { font-size: 15px; line-height: 1.5; @@ -1949,11 +1866,8 @@ body.flat.ttrss_main.ttrss_prefs td.filename, body.flat.ttrss_main.ttrss_prefs div.prefHelp { color: #999999; } -body.flat.ttrss_main.ttrss_prefs #filterNewRuleDlg .invalid { - background: #503030; -} -body.flat.ttrss_main.ttrss_prefs #filterNewRuleDlg .valid { - background: #305030; +body.flat.ttrss_main.ttrss_prefs hr { + border-color: #666; } body.flat.ttrss_main { /* @@ -2011,18 +1925,6 @@ body.flat.ttrss_main #feeds-holder #feedTree .dijitTreeRowSelected .dijitTreeLab body.flat.ttrss_main #feeds-holder #feedTree i.icon.icon-inbox { color: #999999; } -body.flat.ttrss_main #floatingTitle { - background-color: #333; -} -body.flat.ttrss_main #floatingTitle .feed a { - color: #e6e6e6; -} -body.flat.ttrss_main #floatingTitle i.material-icons { - opacity: 0.7; -} -body.flat.ttrss_main div#floatingTitle.Unread a.title { - color: #e6e6e6; -} body.flat.ttrss_main #headlines-frame .hl:not(.active):not(.Selected):not(.Unread), body.flat.ttrss_main #headlines-frame .cdm.expandable:not(.active):not(.Selected):not(.Unread) { background: #333; @@ -2191,7 +2093,9 @@ body.flat.ttrss_main .alert.alert-danger { color: #b94a48; border-color: #702c2b; } -body.ttrss_prefs hr { - border-color: #666; +body.flat.ttrss_main #filterNewRuleDlg .dijitValidationTextAreaError { + background: #503030; +} +body.flat.ttrss_main #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError) { + background: #305030; } -/*# sourceMappingURL=night.css.map */
\ No newline at end of file diff --git a/themes/night.css.map b/themes/night.css.map deleted file mode 100644 index 6f8de00c0..000000000 --- a/themes/night.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["night_base.less","night.less","C:/Users/fox/Projects/tt-rss/css/defines.less","C:/Users/fox/Projects/tt-rss/css/tt-rss.less","C:/Users/fox/Projects/tt-rss/css/cdm.less","C:/Users/fox/Projects/tt-rss/css/prefs.less","C:/Users/fox/Projects/tt-rss/css/dijit_basic.less","C:/Users/fox/Projects/tt-rss/css/utility.less","C:/Users/fox/Projects/tt-rss/css/zoom.less"],"names":[],"mappings":"QAGQ;QCFA;ACgBR,IAAI;AACJ,IAAI;AACJ;EACE,kBAAA;EACA,WAAA;EACA,YAAA;EACA,SAAA;EACA,UAAA;EACA,SAAA;;ACzBF,IAAI;EACH,gBAAA;EACA,WAAA;EACA,aAAa,8CAAb;EACA,eAAA;EACA,gBAAA;;AALD,IAAI,WAOH;EACC,aAAA;;AARF,IAAI,WAWH,IAAG;EACF,YAAA;EACA,eAAA;;AAbF,IAAI,WAWH,IAAG,KAIF,IAAG;EACF,YAAA;EACA,cAAA;EACA,sBAAA;EACA,wBAAA;EACA,gBAAA;;AApBH,IAAI,WAWH,IAAG,KAIF,IAAG,OAOF;AAtBH,IAAI,WAWH,IAAG,KAIF,IAAG,OAOK;EACN,aAAA;;AAvBJ,IAAI,WAWH,IAAG,KAIF,IAAG,OAWF;EACC,aAAA;EACA,kBAAA;EACA,iBAAA;EACA,mBAAA;EACA,8BAAA;;AA/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;AAhSF,IAAI,KAAK,WAmSR,OAAM;EACL,cAAA;EACA,qBAAA;;AAKF,IAAI,YACH;EACC,kBAAA","file":"night.css"}
\ No newline at end of file diff --git a/themes/night_base.less b/themes/night_base.less index 7ab1f85b1..0dff7d191 100644 --- a/themes/night_base.less +++ b/themes/night_base.less @@ -1,6 +1,6 @@ -@import "../css/defines.less"; -@import "../css/utility.less"; -@import "../css/zoom.less"; +@import "light/defines.less"; +@import "light/utility.less"; +@import "light/zoom.less"; @import "../lib/flat-ttrss/flat_combined_dark.css"; @color-accent: #b87d2c; @@ -20,6 +20,8 @@ @color-alert-info : #3a87ad; @color-alert-danger : #b94a48; +@color-tooltip-bg : lighten(@color-accent, 10%); + body.flat.ttrss_main.ttrss_prefs { #main, #footer { background: @color-panel-bg; @@ -34,13 +36,8 @@ body.flat.ttrss_main.ttrss_prefs { color : @fg-text-muted; } - #filterNewRuleDlg { - .invalid { - background : #503030; - } - .valid { - background : #305030; - } + hr { + border-color : @border-light; } } @@ -94,22 +91,6 @@ body.flat.ttrss_main { } } - #floatingTitle { - background-color : @default-bg; - - .feed a { - color : @fg-light; - } - - i.material-icons { - opacity : 0.7; - } - } - - div#floatingTitle.Unread a.title { - color : @fg-light; - } - #headlines-frame { .hl:not(.active):not(.Selected):not(.Unread), .cdm.expandable:not(.active):not(.Selected):not(.Unread) { @@ -340,10 +321,12 @@ body.flat.ttrss_main { border-color : darken(@color-alert-danger, 20%); } -} - -body.ttrss_prefs { - hr { - border-color : @border-light; + #filterNewRuleDlg { + .dijitValidationTextAreaError { + background : #503030; + } + .dijitValidationTextArea:not(.dijitValidationTextAreaError) { + background : #305030; + } } } diff --git a/themes/night_blue.css b/themes/night_blue.css index a2fcf2c54..09a996262 100644 --- a/themes/night_blue.css +++ b/themes/night_blue.css @@ -71,12 +71,19 @@ body.ttrss_main div.post div.content video { max-width: 98%; height: auto; } -body.ttrss_main div.post div.content p { - hyphens: auto; +body.ttrss_main div.post div.content div.embed-responsive { + overflow: hidden; + padding-bottom: 56.25%; + position: relative; } -body.ttrss_main div.post div.content iframe { - min-width: 50%; - max-width: 98%; +body.ttrss_main div.post div.content div.embed-responsive iframe { + border: 0; + bottom: 0; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; } body.ttrss_main .inline-player { display: flex; @@ -662,13 +669,6 @@ body.ttrss_main #headlines-frame div.feed-title a { body.ttrss_main #headlines-frame div.feed-title a:hover { color: #257aa7; } -body.ttrss_main #headlines-frame.smooth-scroll { - scroll-behavior: smooth; -} -body.ttrss_main #headlines-frame.forbid-smooth-scroll, -body.ttrss_main #content-insert.forbid-smooth-scroll { - scroll-behavior: auto; -} body.ttrss_main #toolbar-frame_splitter { display: none; } @@ -755,7 +755,6 @@ body.ttrss_main #content-insert { line-height: 1.5; overflow: auto; -webkit-overflow-scrolling: touch; - scroll-behavior: smooth; } body.ttrss_main img.feed-icon, body.ttrss_main img.icon { @@ -866,6 +865,22 @@ body.ttrss_main #feedEditDlg img.feedIcon { height: auto; width: auto; } +body.ttrss_main .dijitTooltipContents { + background: #2e99d1; + color: #222; +} +body.ttrss_main .dijitTooltipRight .dijitTooltipConnector { + border-right-color: #2e99d1; +} +body.ttrss_main .dijitTooltipLeft .dijitTooltipConnector { + border-left-color: #2e99d1; +} +body.ttrss_main .dijitTooltipBelow .dijitTooltipConnector { + border-bottom-color: #2e99d1; +} +body.ttrss_main .dijitTooltipAbove .dijitTooltipConnector { + border-top-color: #2e99d1; +} body.ttrss_main .dijitDialog h1:first-of-type, body.ttrss_main .dijitDialog h2:first-of-type, body.ttrss_main .dijitDialog h3:first-of-type, @@ -878,10 +893,10 @@ body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Ma body.ttrss_main[view-mode="marked"] #feeds-holder #feedTree .dijitTreeRow.Has_Marked .counterNode.marked { display: inline-block; } -body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.AlwaysVisible):not(.Special):not(.Has_Marked) { +body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.AlwaysVisible):not(.Special):not(.Has_Marked) { display: none; } -body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.AlwaysVisible):not(.Has_Marked) { +body.ttrss_main[view-mode="marked"][hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.AlwaysVisible):not(.Has_Marked) { display: none; } body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow.Unread .counterNode.unread { @@ -890,10 +905,10 @@ body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow. body.ttrss_main:not([view-mode="marked"]) #feeds-holder #feedTree .dijitTreeRow.Has_Aux:not(.Unread) .counterNode.aux { display: inline-block; } -body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.Unread):not(.AlwaysVisible):not(.Special) { +body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="true"] #feeds-holder #feedTree .dijitTreeRow:not(.Unread):not(.AlwaysVisible):not(.Special) { display: none; } -body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.dijitTreeRowSelected):not(.Unread):not(.AlwaysVisible) { +body.ttrss_main:not([view-mode="marked"])[hide-read-feeds="true"][hide-read-shows-special="false"] #feeds-holder #feedTree .dijitTreeRow:not(.Unread):not(.AlwaysVisible) { display: none; } body.ttrss_main #toolbar-headlines i.icon-syndicate { @@ -918,12 +933,10 @@ body.ttrss_main i.icon-no-feed { body.ttrss_main .dijitTreeRow.UpdatesDisabled .dijitTreeLabel { opacity: 0.5; } -body.ttrss_main #floatingTitle.marked i.marked-pic, body.ttrss_main .cdm.marked .left i.marked-pic, body.ttrss_main .hl.marked .left i.marked-pic { color: #ffc069; } -body.ttrss_main #floatingTitle.published i.pub-pic, body.ttrss_main .cdm.published .left i.pub-pic, body.ttrss_main .hl.published .left i.pub-pic { color: #ff7c4b; @@ -1117,6 +1130,11 @@ video::-webkit-media-controls-overlay-play-button { .cdm i.material-icons { color: #777; } +.cdm .header { + position: sticky; + top: 0; + z-index: 3; +} .cdm .header, .cdm .footer { display: flex; @@ -1129,6 +1147,9 @@ video::-webkit-media-controls-overlay-play-button { margin: 0px 4px; vertical-align: middle; } +.cdm .header-sticky-guard { + height: 0; +} .cdm .header { align-items: center; } @@ -1208,9 +1229,6 @@ video::-webkit-media-controls-overlay-play-button { margin-top: 0px; margin-bottom: 0px; } -div.cdm.expanded div.header { - background: transparent ! important; -} div.cdm.expanded div.header a.title { font-size: 16px; color: #999; @@ -1268,15 +1286,19 @@ div.cdm.vgrlf .feed { font-style: italic; font-size: 11px; } -.cdm div.content-inner p { - /*max-width : 650px;*/ - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; +.cdm div.content-inner div.embed-responsive { + overflow: hidden; + padding-bottom: 56.25%; + position: relative; } -.cdm div.content-inner iframe { - min-width: 50%; - max-width: 98%; +.cdm div.content-inner div.embed-responsive iframe { + border: 0; + bottom: 0; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; } .cdm div.header span.author { white-space: nowrap; @@ -1289,115 +1311,6 @@ div.cdm.vgrlf .feed { display: inline-block; padding: 1px 4px 1px 4px; } -#main:not(.expandable) div#floatingTitle .collapse { - display: none; -} -div#floatingTitle { - position: absolute; - z-index: 5; - top: 0px; - right: 0px; - left: 0px; - border: 0px solid #222; - border-bottom-width: 1px; - background: white; - color: #ccc; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1); - align-items: center; -} -div#floatingTitle > * { - white-space: nowrap; - padding: 4px; -} -div#floatingTitle .left, -div#floatingTitle .right { - display: flex; - align-items: center; -} -div#floatingTitle .left i.material-icons, -div#floatingTitle .right i.material-icons { - margin-left: 2px; - font-size: 21px; - padding: 2px; - user-select: none; -} -div#floatingTitle .left i.icon-anchor, -div#floatingTitle .right i.icon-anchor { - margin-left: 0px; - margin-right: 1px; - padding: 0px; - color: #ccc; - cursor: pointer; -} -div#floatingTitle .excerpt { - display: none; -} -div#floatingTitle .collapse i.material-icons { - color: #257aa7; - cursor: pointer; -} -div#floatingTitle span.author { - color: #ccc; - font-size: 11px; - font-weight: normal; -} -div#floatingTitle a.title { - font-size: 16px; - color: #999; - transition: color 0.2s, background 0.2s; - font-weight: 600; - text-rendering: optimizelegibility; - font-family: "Segoe WP Semibold", "Segoe UI Semibold", "Segoe UI Web Semibold", "Segoe UI", Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif; -} -div#floatingTitle div.feed { - padding-right: 10px; - color: #ccc; - font-weight: normal; - font-style: italic; - font-size: 11px; - white-space: nowrap; -} -div#floatingTitle div.feed a { - border-radius: 4px; - display: inline-block; - padding: 1px 4px 1px 4px; -} -div#floatingTitle span.updated { - padding-right: 10px; - white-space: nowrap; - color: #ccc; - font-size: 11px; -} -div#floatingTitle div.feed a { - color: #ccc; -} -div#floatingTitle span.titleWrap { - width: 100%; - white-space: normal; -} -div#floatingTitle .feed-title > * { - display: table-cell; - vertical-align: middle; -} -div#floatingTitle .feed-title a.title { - width: 100%; -} -div#floatingTitle .feed-title a.catchup { - text-align: right; - color: #ccc; - padding-right: 10px; - font-size: 11px; - white-space: nowrap; -} -div#floatingTitle .feed-title a.catchup:hover { - color: #257aa7; -} -div#floatingTitle.Unread a.title { - color: black; -} .cdm.expandable { background-color: #222; border: 0px solid #222; @@ -1470,6 +1383,15 @@ div.cdm.expandable:not(.active) .content, div.cdm.expandable:not(.active) .collapse { display: none; } +div.cdm.expandable.active .header[stuck], +div.cdm.expanded .header[stuck] { + box-shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.1); + border: 0 solid #222; + border-bottom-width: 1px; + background: #333 ! important; + opacity: 0.9; + backdrop-filter: blur(6px); +} body.ttrss_prefs { background-color: #222; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; @@ -1595,12 +1517,12 @@ body.ttrss_prefs .phpinfo td.v { font-family: monospace; word-break: break-all; } -body.ttrss_prefs #filterNewRuleDlg .invalid, -body.ttrss_main #filterNewRuleDlg .invalid { +body.ttrss_prefs #filterNewRuleDlg .dijitValidationTextAreaError, +body.ttrss_main #filterNewRuleDlg .dijitValidationTextAreaError { background: #ffc0c0; } -body.ttrss_prefs #filterNewRuleDlg .valid, -body.ttrss_main #filterNewRuleDlg .valid { +body.ttrss_prefs #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError), +body.ttrss_main #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError) { background: #c0ffc0; } body.ttrss_prefs fieldset, @@ -1898,11 +1820,6 @@ body.ttrss_zoom div.post div.header .row { align-items: center; justify-content: space-between; } -body.ttrss_zoom div.post p { - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; -} body.ttrss_zoom div.post div.content { font-size: 15px; line-height: 1.5; @@ -1949,11 +1866,8 @@ body.flat.ttrss_main.ttrss_prefs td.filename, body.flat.ttrss_main.ttrss_prefs div.prefHelp { color: #999999; } -body.flat.ttrss_main.ttrss_prefs #filterNewRuleDlg .invalid { - background: #503030; -} -body.flat.ttrss_main.ttrss_prefs #filterNewRuleDlg .valid { - background: #305030; +body.flat.ttrss_main.ttrss_prefs hr { + border-color: #666; } body.flat.ttrss_main { /* @@ -2011,18 +1925,6 @@ body.flat.ttrss_main #feeds-holder #feedTree .dijitTreeRowSelected .dijitTreeLab body.flat.ttrss_main #feeds-holder #feedTree i.icon.icon-inbox { color: #999999; } -body.flat.ttrss_main #floatingTitle { - background-color: #333; -} -body.flat.ttrss_main #floatingTitle .feed a { - color: #e6e6e6; -} -body.flat.ttrss_main #floatingTitle i.material-icons { - opacity: 0.7; -} -body.flat.ttrss_main div#floatingTitle.Unread a.title { - color: #e6e6e6; -} body.flat.ttrss_main #headlines-frame .hl:not(.active):not(.Selected):not(.Unread), body.flat.ttrss_main #headlines-frame .cdm.expandable:not(.active):not(.Selected):not(.Unread) { background: #333; @@ -2191,7 +2093,9 @@ body.flat.ttrss_main .alert.alert-danger { color: #b94a48; border-color: #702c2b; } -body.ttrss_prefs hr { - border-color: #666; +body.flat.ttrss_main #filterNewRuleDlg .dijitValidationTextAreaError { + background: #503030; +} +body.flat.ttrss_main #filterNewRuleDlg .dijitValidationTextArea:not(.dijitValidationTextAreaError) { + background: #305030; } -/*# sourceMappingURL=night_blue.css.map */
\ No newline at end of file diff --git a/themes/night_blue.css.map b/themes/night_blue.css.map deleted file mode 100644 index 93af60643..000000000 --- a/themes/night_blue.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["night_base.less","night_blue.less","C:/Users/fox/Projects/tt-rss/css/defines.less","C:/Users/fox/Projects/tt-rss/css/tt-rss.less","C:/Users/fox/Projects/tt-rss/css/cdm.less","C:/Users/fox/Projects/tt-rss/css/prefs.less","C:/Users/fox/Projects/tt-rss/css/dijit_basic.less","C:/Users/fox/Projects/tt-rss/css/utility.less","C:/Users/fox/Projects/tt-rss/css/zoom.less"],"names":[],"mappings":"QAGQ;QCFA;ACgBR,IAAI;AACJ,IAAI;AACJ;EACE,kBAAA;EACA,WAAA;EACA,YAAA;EACA,SAAA;EACA,UAAA;EACA,SAAA;;ACzBF,IAAI;EACH,gBAAA;EACA,WAAA;EACA,aAAa,8CAAb;EACA,eAAA;EACA,gBAAA;;AALD,IAAI,WAOH;EACC,aAAA;;AARF,IAAI,WAWH,IAAG;EACF,YAAA;EACA,eAAA;;AAbF,IAAI,WAWH,IAAG,KAIF,IAAG;EACF,YAAA;EACA,cAAA;EACA,sBAAA;EACA,wBAAA;EACA,gBA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R;EACC,UAAA;;AA7QF,IAAI,KAAK,WAgRR;EACC,sBAAA;;AAjRF,IAAI,KAAK,WAoRR;EACC,sBAAA;;AArRF,IAAI,KAAK,WAwRR;EACC,gBAAA;EACA,qBAAA;EACA,cAAA;;AA3RF,IAAI,KAAK,WA8RR,OAAM;EACL,cAAA;EACA,qBAAA;;AAhSF,IAAI,KAAK,WAmSR,OAAM;EACL,cAAA;EACA,qBAAA;;AAKF,IAAI,YACH;EACC,kBAAA","file":"night_blue.css"}
\ No newline at end of file diff --git a/update.php b/update.php index 5b723277f..8b325d7bb 100755 --- a/update.php +++ b/update.php @@ -14,6 +14,19 @@ require_once "db.php"; require_once "db-prefs.php"; + function make_stampfile($filename) { + $fp = fopen(LOCK_DIRECTORY . "/$filename", "w"); + + if (flock($fp, LOCK_EX | LOCK_NB)) { + fwrite($fp, time() . "\n"); + flock($fp, LOCK_UN); + fclose($fp); + return true; + } else { + return false; + } + } + function cleanup_tags($days = 14, $limit = 1000) { $days = (int) $days; @@ -85,6 +98,7 @@ "debug-feed:", "force-refetch", "force-rehash", + "opml-export:", "help"); foreach (PluginHost::getInstance()->get_commands() as $command => $data) { @@ -122,29 +136,30 @@ if (count($options) == 0 || isset($options["help"]) ) { print "Tiny Tiny RSS data update script.\n\n"; print "Options:\n"; - print " --feeds - update feeds\n"; - print " --daemon - start single-process update daemon\n"; - print " --task N - create lockfile using this task id\n"; - print " --cleanup-tags - perform tags table maintenance\n"; - print " --quiet - don't output messages to stdout\n"; - print " --log FILE - log messages to FILE\n"; - print " --log-level N - log verbosity level\n"; - print " --indexes - recreate missing schema indexes\n"; - print " --update-schema - update database schema\n"; - print " --gen-search-idx - generate basic PostgreSQL fulltext search index\n"; - print " --convert-filters - convert type1 filters to type2\n"; - print " --send-digests - send pending email digests\n"; - print " --force-update - force update of all feeds\n"; - print " --list-plugins - list all available plugins\n"; - print " --debug-feed N - perform debug update of feed N\n"; - print " --force-refetch - debug update: force refetch feed data\n"; - print " --force-rehash - debug update: force rehash articles\n"; - print " --help - show this help\n"; + print " --feeds - update feeds\n"; + print " --daemon - start single-process update daemon\n"; + print " --task N - create lockfile using this task id\n"; + print " --cleanup-tags - perform tags table maintenance\n"; + print " --quiet - don't output messages to stdout\n"; + print " --log FILE - log messages to FILE\n"; + print " --log-level N - log verbosity level\n"; + print " --indexes - recreate missing schema indexes\n"; + print " --update-schema - update database schema\n"; + print " --gen-search-idx - generate basic PostgreSQL fulltext search index\n"; + print " --convert-filters - convert type1 filters to type2\n"; + print " --send-digests - send pending email digests\n"; + print " --force-update - force update of all feeds\n"; + print " --list-plugins - list all available plugins\n"; + print " --debug-feed N - perform debug update of feed N\n"; + print " --force-refetch - debug update: force refetch feed data\n"; + print " --force-rehash - debug update: force rehash articles\n"; + print " --opml-export \"USER FILE\" - export feeds of selected user to OPML\n"; + print " --help - show this help\n"; print "Plugin options:\n"; foreach (PluginHost::getInstance()->get_commands() as $command => $data) { $args = $data['arghelp']; - printf(" --%-19s - %s\n", "$command $args", $data["description"]); + printf(" --%-26s - %s\n", "$command $args", $data["description"]); } return; @@ -483,6 +498,26 @@ Digest::send_headlines_digests(); } + if (isset($options["opml-export"])) { + list ($user, $filename) = explode(" ", $options["opml-export"], 2); + + Debug::log("Exporting feeds of user $user to $filename as OPML..."); + + $sth = $pdo->prepare("SELECT id FROM ttrss_users WHERE login = ?"); + $sth->execute([$user]); + + if ($res = $sth->fetch()) { + $opml = new OPML(""); + + $rc = $opml->opml_export($filename, $res["id"], false, true, true); + + Debug::log($rc ? "Success." : "Failed."); + } else { + Debug::log("User not found: $user"); + } + + } + PluginHost::getInstance()->run_commands($options); if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) |