* fix incorrect title in browser history in some cases

This commit is contained in:
Max Pozdeev 2021-09-06 22:52:08 +03:00
parent 7d5386d68e
commit 815c663319
4 changed files with 13 additions and 9 deletions

View file

@ -28,7 +28,7 @@
<script type="text/javascript">
$().ready(function(){
mytinytodo.init({
title: "<?php mttinfo('title', false); ?>",
title: <?php echo json_encode(get_unsafe_mttinfo('title'), JSON_UNESCAPED_UNICODE); ?> ,
lang: <?php echo Lang::instance()->makeJS() ?>,
mttUrl: "<?php mttinfo('mtt_url'); ?>",
homeUrl: "<?php mttinfo('url'); ?>",

View file

@ -228,6 +228,11 @@ function escapeTags($s)
return $s;
}
function removeNewLines($s)
{
return str_replace( ["\r","\n"], '', $s );
}
/* found in comments on http://www.php.net/manual/en/function.uniqid.php#94959 */
function generateUUID()
{

View file

@ -141,10 +141,9 @@ function __($s)
return Lang::instance()->get($s);
}
function mttinfo($v, $escape = true)
function mttinfo($v)
{
global $_mttinfo;
echo $escape ? get_mttinfo($v) : get_unsafe_mttinfo($v);
echo get_mttinfo($v);
}
/*

View file

@ -41,13 +41,13 @@ if(isset($_POST['save']))
catch (Exception $e) {
}
Config::set('autotag', (int)_post('autotag'));
Config::set('session', _post('session'));
Config::set('session', trim(_post('session')) );
Config::set('firstdayofweek', (int)_post('firstdayofweek'));
Config::set('clock', (int)_post('clock'));
Config::set('dateformat', _post('dateformat'));
Config::set('dateformat2', _post('dateformat2'));
Config::set('dateformatshort', _post('dateformatshort'));
Config::set('title', trim(_post('title')));
Config::set('dateformat', removeNewLines(_post('dateformat')) );
Config::set('dateformat2', removeNewLines(_post('dateformat2')) );
Config::set('dateformatshort', removeNewLines(_post('dateformatshort')) );
Config::set('title', removeNewLines(trim(_post('title'))) );
Config::set('showdate', (int)_post('showdate'));
Config::save();
$t['saved'] = 1;