From ad54a2b8af7d23aa80cb5984c886a9423b6d6067 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Jan 2019 15:06:28 +0100 Subject: [PATCH] Fix website edit of virtualhost --- htdocs/langs/en_US/errors.lang | 1 + htdocs/website/index.php | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index cb183d12ce2..a2d0c8c31cf 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -215,6 +215,7 @@ ErrorAPageWithThisNameOrAliasAlreadyExists=The page/container %sloadLangs(array("admin","other","website")); +$langs->loadLangs(array("admin","other","website","errors")); if (! $user->rights->website->read) accessforbidden(); @@ -280,6 +280,12 @@ if ($action == 'addsite') { $db->begin(); + if (GETPOST('virtualhost','alpha') && ! preg_match('/^http/',GETPOST('virtualhost','alpha'))) + { + $error++; + setEventMessages($langs->trans('ErrorURLMustStartWithHttp', $langs->transnoentitiesnoconv("VirtualHost")), null, 'errors'); + } + if (! $error && ! GETPOST('WEBSITE_REF','alpha')) { $error++; @@ -353,6 +359,7 @@ if ($action == 'addcontainer') if (! preg_match('/^http/', $urltograb)) { $error++; + $langs->load("errors"); setEventMessages('Error URL must start with http:// or https://', null, 'errors'); $action = 'createcontainer'; } @@ -872,7 +879,7 @@ if ($action == 'updatecss') if (GETPOST('virtualhost','alpha') && ! preg_match('/^http/',GETPOST('virtualhost','alpha'))) { $error++; - setEventMessages('Error URL must start with http:// or https://', null, 'errors'); + setEventMessages($langs->trans('ErrorURLMustStartWithHttp', $langs->transnoentitiesnoconv("VirtualHost")), null, 'errors'); $action='editcss'; } @@ -1825,11 +1832,11 @@ if (! GETPOST('hide_websitemenu')) $htmltext = ''; if (empty($object->fk_default_home)) { - $htmltext.= ''.$langs->trans("YouMustDefineTheHomePage").'

'; + $htmltext.= '
'.$langs->trans("YouMustDefineTheHomePage").'

'; } - if (empty($virtualurl)) + elseif (empty($virtualurl)) { - $htmltext.= ''.$langs->trans("VirtualHostUrlNotDefined").'

'; + $htmltext.= '
'.$langs->trans("VirtualHostUrlNotDefined").'

'; } else { @@ -2150,7 +2157,7 @@ if (! GETPOST('hide_websitemenu')) newurl=jQuery("#previewsiteurl").val(); if (! newurl.startsWith("http")) { - alert(\''.dol_escape_js($langs->trans("ExternalURLMustStartWithHttp")).'\'); + alert(\''.dol_escape_js($langs->trans("ErrorURLMustStartWithHttp")).'\'); return false; } @@ -2412,7 +2419,7 @@ if ($action == 'createsite') print $form->textwithpicto($langs->trans('Virtualhost'), $htmltext, 1, 'help', '', 0, 2, 'virtualhosttooltip'); print ''; - print ''; + print ''; print '';