* 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 21f5ba615d
commit 5248a9bc33
4 changed files with 12 additions and 7 deletions

View file

@ -100,6 +100,11 @@ function url_dir($url, $onlyPath = 1)
return '/';
}
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

@ -51,7 +51,7 @@ function redirectWithHashRoute(array $q, array $hash)
function js_options()
{
$a = array(
"title" => get_mttinfo('title', false),
"title" => get_unsafe_mttinfo('title'),
"lang" => Lang::instance()->jsStrings(),
"mttUrl" => get_mttinfo('mtt_url'),
"homeUrl" => get_mttinfo('url'),

View file

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

View file

@ -43,10 +43,10 @@ if(isset($_POST['save']))
Config::set('autotag', (int)_post('autotag'));
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;