Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
avoid double encoding of Punycode as with php-5.6 the 'new' idna clas…
…s throws exceptions, thx to housequake

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
  • Loading branch information
d00p committed Aug 26, 2016
1 parent 2f6e34d commit b162fb6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions customer_domains.php
Expand Up @@ -312,14 +312,14 @@
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'];
$_doredirect = true;
} else {
$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,
// set default path to subdomain or domain name
if ((($path == '') || ($path == '/')) && Settings::Get('system.documentroot_use_default_value') == 1) {
Expand Down Expand Up @@ -539,14 +539,14 @@

if (isset($result['customerid']) && $result['customerid'] == $userinfo['customerid']) {
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'];
$_doredirect = true;
} else {
$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,
// set default path to subdomain or domain name
if ((($path == '') || ($path == '/')) && Settings::Get('system.documentroot_use_default_value') == 1) {
Expand Down Expand Up @@ -732,7 +732,7 @@
$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') {
$urlvalue = $result['documentroot'];
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
Expand Down
2 changes: 1 addition & 1 deletion lib/functions/froxlor/function.CorrectErrorDocument.php
Expand Up @@ -32,7 +32,7 @@ function correctErrorDocument($errdoc = null) {
// not a URL
if ((strtoupper(substr($errdoc, 0, 5)) != 'HTTP:'
&& strtoupper(substr($errdoc, 0, 6)) != 'HTTPS:')
|| !validateUrl($idna_convert->encode($errdoc))
|| !validateUrl($errdoc)
) {
// a file
if (substr($errdoc, 0, 1) != '"') {
Expand Down

0 comments on commit b162fb6

Please sign in to comment.