avoid double encoding of Punycode as with php-5.6 the 'new' idna class throws exceptions, thx to housequake

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2016-08-26 09:41:19 +02:00
parent 2f6e34d878
commit b162fb6e99
2 changed files with 6 additions and 6 deletions

View File

@@ -312,14 +312,14 @@ if ($page == 'overview') {
triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $log); triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $log);
} }
if (isset($_POST['url']) && $_POST['url'] != '' && validateUrl($idna_convert->encode($_POST['url']))) { if (isset($_POST['url']) && $_POST['url'] != '' && validateUrl($_POST['url'])) {
$path = $_POST['url']; $path = $_POST['url'];
$_doredirect = true; $_doredirect = true;
} else { } else {
$path = validate($_POST['path'], 'path'); $path = validate($_POST['path'], 'path');
} }
if (!preg_match('/^https?\:\/\//', $path) || !validateUrl($idna_convert->encode($path))) { if (!preg_match('/^https?\:\/\//', $path) || !validateUrl($path)) {
// If path is empty or '/' and 'Use domain name as default value for DocumentRoot path' is enabled in settings, // If path is empty or '/' and 'Use domain name as default value for DocumentRoot path' is enabled in settings,
// set default path to subdomain or domain name // set default path to subdomain or domain name
if ((($path == '') || ($path == '/')) && Settings::Get('system.documentroot_use_default_value') == 1) { if ((($path == '') || ($path == '/')) && Settings::Get('system.documentroot_use_default_value') == 1) {
@@ -539,14 +539,14 @@ if ($page == 'overview') {
if (isset($result['customerid']) && $result['customerid'] == $userinfo['customerid']) { if (isset($result['customerid']) && $result['customerid'] == $userinfo['customerid']) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (isset($_POST['url']) && $_POST['url'] != '' && validateUrl($idna_convert->encode($_POST['url']))) { if (isset($_POST['url']) && $_POST['url'] != '' && validateUrl($_POST['url'])) {
$path = $_POST['url']; $path = $_POST['url'];
$_doredirect = true; $_doredirect = true;
} else { } else {
$path = validate($_POST['path'], 'path'); $path = validate($_POST['path'], 'path');
} }
if (!preg_match('/^https?\:\/\//', $path) || !validateUrl($idna_convert->encode($path))) { if (!preg_match('/^https?\:\/\//', $path) || !validateUrl($path)) {
// If path is empty or '/' and 'Use domain name as default value for DocumentRoot path' is enabled in settings, // If path is empty or '/' and 'Use domain name as default value for DocumentRoot path' is enabled in settings,
// set default path to subdomain or domain name // set default path to subdomain or domain name
if ((($path == '') || ($path == '/')) && Settings::Get('system.documentroot_use_default_value') == 1) { if ((($path == '') || ($path == '/')) && Settings::Get('system.documentroot_use_default_value') == 1) {
@@ -732,7 +732,7 @@ if ($page == 'overview') {
$domains .= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['aliasdomain']); $domains .= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['aliasdomain']);
} }
if (preg_match('/^https?\:\/\//', $result['documentroot']) && validateUrl($idna_convert->encode($result['documentroot']))) { if (preg_match('/^https?\:\/\//', $result['documentroot']) && validateUrl($result['documentroot'])) {
if (Settings::Get('panel.pathedit') == 'Dropdown') { if (Settings::Get('panel.pathedit') == 'Dropdown') {
$urlvalue = $result['documentroot']; $urlvalue = $result['documentroot'];
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']); $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);

View File

@@ -32,7 +32,7 @@ function correctErrorDocument($errdoc = null) {
// not a URL // not a URL
if ((strtoupper(substr($errdoc, 0, 5)) != 'HTTP:' if ((strtoupper(substr($errdoc, 0, 5)) != 'HTTP:'
&& strtoupper(substr($errdoc, 0, 6)) != 'HTTPS:') && strtoupper(substr($errdoc, 0, 6)) != 'HTTPS:')
|| !validateUrl($idna_convert->encode($errdoc)) || !validateUrl($errdoc)
) { ) {
// a file // a file
if (substr($errdoc, 0, 1) != '"') { if (substr($errdoc, 0, 1) != '"') {