From 4e083c632738dfa3103dd341e1ea2bd921d0dbc6 Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Fri, 15 Apr 2022 18:39:45 +0300 Subject: [PATCH] - fix error if script title was saved in settings in non-utf8 encoding --- src/content/themes/default/index.php | 2 +- src/init.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/content/themes/default/index.php b/src/content/themes/default/index.php index 032d9f3..976c7cc 100644 --- a/src/content/themes/default/index.php +++ b/src/content/themes/default/index.php @@ -29,7 +29,7 @@ $().ready(function(){ mytinytodo.init({ token: "" , - title: , + title: , lang: makeJS() ?>, mttUrl: "", homeUrl: "", diff --git a/src/init.php b/src/init.php index a346615..83b5fdb 100644 --- a/src/init.php +++ b/src/init.php @@ -250,6 +250,15 @@ function reset_mttinfo($key) unset( $_mttinfo[$key] ); } +function mtt_quoted_title() +{ + $s = json_encode(get_unsafe_mttinfo('title'), JSON_UNESCAPED_UNICODE); + if ($s === false) { + return '""'; + } + return $s; +} + function getRequestUri() { // Do not use HTTP_X_REWRITE_URL due to CVE-2018-14773