fixes for dualstack by tilman19

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-04-29 10:02:44 +02:00
parent 80f19c7dfb
commit 8aa74a9b90
5 changed files with 72 additions and 82 deletions

View File

@@ -128,6 +128,8 @@ if($page == 'domains'
{ {
$row['customername'] = getCorrectFullUserDetails($row); $row['customername'] = getCorrectFullUserDetails($row);
$row = htmlentities_array($row); $row = htmlentities_array($row);
// display a nice list of IP's
$row['ipandport'] = str_replace("\n", "<br />", $row['ipandport']);
eval("\$domains.=\"" . getTemplate("domains/domains_domain") . "\";"); eval("\$domains.=\"" . getTemplate("domains/domains_domain") . "\";");
$count++; $count++;
} }
@@ -993,28 +995,20 @@ if($page == 'domains'
$additional_ip_condition = ''; $additional_ip_condition = '';
} }
$ipandport = intval($_POST['ipandport']);
$ipandport_check = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = '" . $db->escape($ipandport) . "' AND `ssl` = '0'" . $additional_ip_condition);
$ipandports = array(); $ipandports = array();
if (isset($_POST['ipandport']) && !is_array($_POST['ipandport'])) if (isset($_POST['ipandport']) && !is_array($_POST['ipandport'])) {
{
$_POST['ipandport'] = unserialize($_POST['ipandport']); $_POST['ipandport'] = unserialize($_POST['ipandport']);
} }
if (isset($_POST['ipandport']) && is_array($_POST['ipandport'])) if (isset($_POST['ipandport']) && is_array($_POST['ipandport'])) {
{ foreach($_POST['ipandport'] as $ipandport) {
foreach($_POST['ipandport'] as $ipandport)
{
$ipandport = intval($ipandport); $ipandport = intval($ipandport);
$ipandport_check = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = '" . $db->escape($ipandport) . "' " . $additional_ip_condition); $ipandport_check = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = '" . $db->escape($ipandport) . "' " . $additional_ip_condition);
if(!isset($ipandport_check['id']) if (!isset($ipandport_check['id'])
|| $ipandport_check['id'] == '0' || $ipandport_check['id'] == '0'
|| $ipandport_check['id'] != $ipandport) || $ipandport_check['id'] != $ipandport
{ ) {
standard_error('ipportdoesntexist'); standard_error('ipportdoesntexist');
} } else {
else
{
$ipandports[] = $ipandport; $ipandports[] = $ipandport;
} }
} }
@@ -1029,28 +1023,20 @@ if($page == 'domains'
$ssl_redirect = (int)$_POST['ssl_redirect']; $ssl_redirect = (int)$_POST['ssl_redirect'];
} }
$ssl_ipandport = intval($_POST['ssl_ipandport']);
$ssl_ipandport_check = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = '" . $db->escape($ssl_ipandport) . "' AND `ssl` = '1'" . $additional_ip_condition);
$ssl_ipandports = array(); $ssl_ipandports = array();
if (isset($_POST['ssl_ipandport']) && !is_array($_POST['ssl_ipandport'])) if (isset($_POST['ssl_ipandport']) && !is_array($_POST['ssl_ipandport'])) {
{
$_POST['ssl_ipandport'] = unserialize($_POST['ssl_ipandport']); $_POST['ssl_ipandport'] = unserialize($_POST['ssl_ipandport']);
} }
if (isset($_POST['ssl_ipandport']) && is_array($_POST['ssl_ipandport'])) if (isset($_POST['ssl_ipandport']) && is_array($_POST['ssl_ipandport'])) {
{ foreach ($_POST['ssl_ipandport'] as $ssl_ipandport) {
foreach($_POST['ssl_ipandport'] as $ssl_ipandport)
{
$ssl_ipandport = intval($ssl_ipandport); $ssl_ipandport = intval($ssl_ipandport);
$ssl_ipandport_check = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = '" . $db->escape($ssl_ipandport) . "' " . $additional_ip_condition); $ssl_ipandport_check = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = '" . $db->escape($ssl_ipandport) . "' " . $additional_ip_condition);
if(!isset($ssl_ipandport_check['id']) if (!isset($ssl_ipandport_check['id'])
|| $ssl_ipandport_check['id'] == '0' || $ssl_ipandport_check['id'] == '0'
|| $ssl_ipandport_check['id'] != $ssl_ipandport) || $ssl_ipandport_check['id'] != $ssl_ipandport
{ ) {
standard_error('ipportdoesntexist'); standard_error('ipportdoesntexist');
} } else {
else
{
$ssl_ipandports[] = $ssl_ipandport; $ssl_ipandports[] = $ssl_ipandport;
} }
} }

View File

@@ -2154,5 +2154,5 @@ if (isFroxlorVersion('0.9.29-dev3')) {
$db->query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` DROP `ssl_ipandport`;"); $db->query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` DROP `ssl_ipandport`;");
lastStepStatus(0); lastStepStatus(0);
updateToVersion('0.9.28-svn6'); updateToVersion('0.9.29-dev4');
} }

View File

@@ -266,7 +266,7 @@ class htmlform
// default value is none, so the checkbox isn't an array // default value is none, so the checkbox isn't an array
$isArray = ''; $isArray = '';
if (count($data['values']) > 1) { if (count($data['values']) > 1 || (isset($data['is_array']) && $data['is_array'] == 1)) {
$isArray = '[]'; $isArray = '[]';
} }

View File

@@ -91,13 +91,15 @@ return array(
'type' => 'checkbox', 'type' => 'checkbox',
'values' => $ipsandports, 'values' => $ipsandports,
'value' => array($settings['system']['defaultip']), 'value' => array($settings['system']['defaultip']),
'is_array' => 1,
'mandatory' => true 'mandatory' => true
), ),
'ssl_ipandport' => array( 'ssl_ipandport' => array(
'label' => 'IP/Port (SSL)', 'label' => 'IP/Port (SSL)',
'type' => 'checkbox', 'type' => 'checkbox',
'values' => $ssl_ipsandports, 'values' => $ssl_ipsandports,
'value' => '' 'value' => '',
'is_array' => 1
), ),
'ssl_redirect' => array( 'ssl_redirect' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false), 'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false),

View File

@@ -102,13 +102,15 @@ return array(
'type' => 'checkbox', 'type' => 'checkbox',
'values' => $ipsandports, 'values' => $ipsandports,
'value' => $usedips, 'value' => $usedips,
'is_array' => 1,
'mandatory' => true 'mandatory' => true
), ),
'ssl_ipandport' => array( 'ssl_ipandport' => array(
'label' => 'IP/Port (SSL)', 'label' => 'IP/Port (SSL)',
'type' => 'checkbox', 'type' => 'checkbox',
'values' => $ssl_ipsandports, 'values' => $ssl_ipsandports,
'value' => $usedips 'value' => $usedips,
'is_array' => 1
), ),
'ssl_redirect' => array( 'ssl_redirect' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false), 'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false),