Skip to content

Commit

Permalink
Fix title in html header
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 21, 2017
1 parent a696018 commit 23d9353
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
6 changes: 4 additions & 2 deletions htdocs/core/lib/functions.lib.php
Expand Up @@ -806,17 +806,19 @@ function dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
* @param string $stringtoescape String to escape
* @param int $keepb 1=Preserve b tags (otherwise, remove them)
* @param int $keepn 1=Preserve \r\n strings (otherwise, remove them)
* @param int $onlytags Only special chars like (", &, >, > ...) are replaced, not all chars that has an existing entity.
* @return string Escaped string
*
* @see dol_string_nohtmltag
*/
function dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
function dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $onlytags=0)
{
// escape quotes and backslashes, newlines, etc.
$tmp=dol_html_entity_decode($stringtoescape,ENT_COMPAT,'UTF-8');
if (! $keepb) $tmp=strtr($tmp, array("<b>"=>'','</b>'=>''));
if (! $keepn) $tmp=strtr($tmp, array("\r"=>'\\r',"\n"=>'\\n'));
return dol_htmlentities($tmp,ENT_COMPAT,'UTF-8');
if ($onlytags) return htmlspecialchars($tmp,ENT_COMPAT,'UTF-8');
else return dol_htmlentities($tmp,ENT_COMPAT,'UTF-8');
}


Expand Down
18 changes: 10 additions & 8 deletions htdocs/websites/index.php
Expand Up @@ -450,15 +450,16 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0,
$tplcontent.= '<?php require "./master.inc.php"; ?>'."\n";
$tplcontent.= '<html>'."\n";
$tplcontent.= '<header>'."\n";
$tplcontent.= '<title>'.dol_escape_htmltag($objectpage->title).'</title>'."\n";
$tplcontent.= '<title>'.dol_escape_htmltag($objectpage->title, 0, 0, 1).'</title>'."\n";
$tplcontent.= '<meta charset="UTF-8">'."\n";
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
$tplcontent.= '<meta name="viewport" content="width=device-width, initial-scale=0.8">'."\n";
$tplcontent.= '<link rel="canonical" href="'.$objectpage->pageurl.'">'."\n";
$tplcontent.= '<meta name="keywords" content="'.join(', ', explode(',',$objectpage->keywords)).'" />'."\n";
$tplcontent.= '<meta name="title" content="'.dol_escape_htmltag($objectpage->title).'" />'."\n";
$tplcontent.= '<meta name="description" content="'.dol_escape_htmltag($objectpage->description).'" />'."\n";
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.'" />'."\n";
$tplcontent.= '<meta name="title" content="'.dol_escape_htmltag($objectpage->title, 0, 0, 1).'" />'."\n";
$tplcontent.= '<meta name="description" content="'.dol_escape_htmltag($objectpage->description, 0, 0, 1).'" />'."\n";
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.'" />'."\n";
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
$tplcontent.= '<!-- Include common HTML header file -->'."\n";
Expand Down Expand Up @@ -607,14 +608,15 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0,
$tplcontent.= "// END PHP ?>\n";
$tplcontent.= '<html>'."\n";
$tplcontent.= '<header>'."\n";
$tplcontent.= '<title>'.dol_escape_htmltag($objectpage->title).'</title>'."\n";
$tplcontent.= '<title>'.dol_escape_htmltag($objectpage->title, 0, 0, 1).'</title>'."\n";
$tplcontent.= '<meta charset="UTF-8">'."\n";
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
$tplcontent.= '<meta name="viewport" content="width=device-width, initial-scale=0.8">'."\n";
$tplcontent.= '<meta name="keywords" content="'.join(', ', explode(',',$objectpage->keywords)).'" />'."\n";
$tplcontent.= '<meta name="title" content="'.dol_escape_htmltag($objectpage->title).'" />'."\n";
$tplcontent.= '<meta name="description" content="'.dol_escape_htmltag($objectpage->description).'" />'."\n";
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.'" />'."\n";
$tplcontent.= '<meta name="title" content="'.dol_escape_htmltag($objectpage->title, 0, 0, 1).'" />'."\n";
$tplcontent.= '<meta name="description" content="'.dol_escape_htmltag($objectpage->description, 0, 0, 1).'" />'."\n";
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.'" />'."\n";
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
$tplcontent.= '<!-- Include common HTML header file -->'."\n";
Expand Down

0 comments on commit 23d9353

Please sign in to comment.