Fix input of virtual host and canonical url
This commit is contained in:
parent
76663ae3e8
commit
7b29ce036a
@ -196,7 +196,9 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
|
||||
else dol_print_error($db);
|
||||
}
|
||||
// Add canonical reference
|
||||
$tplcontent .= '<link rel="canonical" href="'.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php')).'" />'."\n";
|
||||
if ($object->virtualhost) {
|
||||
$tplcontent .= '<link rel="canonical" href="'.$object->virtualhost.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php')).'" />'."\n";
|
||||
}
|
||||
// Add manifest.json on homepage
|
||||
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";
|
||||
$tplcontent .= '<!-- Include link to CSS file -->'."\n";
|
||||
|
||||
@ -681,6 +681,7 @@ if ($action == 'addcontainer')
|
||||
//$objectpage->htmlheader = preg_replace('/<meta name="msvalidate.01[^>]*>\n*/ims', '', $objectpage->htmlheader);
|
||||
$objectpage->htmlheader = preg_replace('/<title>[^<]*<\/title>\n*/ims', '', $objectpage->htmlheader);
|
||||
$objectpage->htmlheader = preg_replace('/<link[^>]*rel="shortcut[^>]*>\n/ims', '', $objectpage->htmlheader);
|
||||
$objectpage->htmlheader = preg_replace('/<link[^>]*rel="alternate[^>]*>\n/ims', '', $objectpage->htmlheader);
|
||||
$objectpage->htmlheader = preg_replace('/<link[^>]*rel="canonical[^>]*>\n/ims', '', $objectpage->htmlheader);
|
||||
|
||||
// Now loop to fetch JS
|
||||
@ -1155,7 +1156,8 @@ if ($action == 'updatecss')
|
||||
|
||||
if (GETPOSTISSET('virtualhost'))
|
||||
{
|
||||
if (GETPOST('virtualhost', 'alpha') && !preg_match('/^http/', GETPOST('virtualhost', 'alpha')))
|
||||
$tmpvirtualhost = preg_replace('/\/$/', '', GETPOST('virtualhost', 'alpha'));
|
||||
if ($tmpvirtualhost && !preg_match('/^http/', $tmpvirtualhost))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorURLMustStartWithHttp', $langs->transnoentitiesnoconv("VirtualHost")), null, 'errors');
|
||||
@ -1169,7 +1171,7 @@ if ($action == 'updatecss')
|
||||
$arrayotherlang[$key] = substr(trim($val), 0, 2); // Kept short language code only
|
||||
}
|
||||
|
||||
$object->virtualhost = GETPOST('virtualhost', 'alpha');
|
||||
$object->virtualhost = $tmpvirtualhost;
|
||||
$object->lang = GETPOST('WEBSITE_LANG', 'aZ09');
|
||||
$object->otherlang = join(',', $arrayotherlang);
|
||||
$object->use_manifest = GETPOST('use_manifest', 'alpha');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user