only show 'SSL redirect' checkbox for customers when there really is a ip/port combination for SSL; fixes #1179

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-03-27 08:34:59 +01:00
parent c986c08cfb
commit a903455ee0
3 changed files with 17 additions and 9 deletions

View File

@@ -396,7 +396,13 @@ elseif($page == 'domains')
} }
} }
//$ssl_redirect = makeyesno('ssl_redirect', '1', '0', $result['ssl_redirect']); // check if we at least have one ssl-ip/port, #1179
$ssl_ipsandports = '';
$resultX = $db->query_first("SELECT COUNT(*) as countSSL FROM `panel_ipsandports` WHERE `ssl`='1'");
if (isset($resultX['countSSL']) && (int)$resultX['countSSL'] > 0) {
$ssl_ipsandports = 'notempty';
}
$openbasedir = makeoption($lng['domain']['docroot'], 0, NULL, true) . makeoption($lng['domain']['homedir'], 1, NULL, true); $openbasedir = makeoption($lng['domain']['docroot'], 0, NULL, true) . makeoption($lng['domain']['homedir'], 1, NULL, true);
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']); $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
@@ -602,11 +608,13 @@ elseif($page == 'domains')
} }
} }
/* // check if we at least have one ssl-ip/port, #1179
$ssl_redirect = makeyesno('ssl_redirect', '1', '0', $result['ssl_redirect']); $ssl_ipsandports = '';
$iswildcarddomain = makeyesno('iswildcarddomain', '1', '0', $result['iswildcarddomain']); $resultX = $db->query_first("SELECT COUNT(*) as countSSL FROM `panel_ipsandports` WHERE `ssl`='1'");
$isemaildomain = makeyesno('isemaildomain', '1', '0', $result['isemaildomain']); if (isset($resultX['countSSL']) && (int)$resultX['countSSL'] > 0) {
*/ $ssl_ipsandports = 'notempty';
}
$openbasedir = makeoption($lng['domain']['docroot'], 0, $result['openbasedir_path'], true) . makeoption($lng['domain']['homedir'], 1, $result['openbasedir_path'], true); $openbasedir = makeoption($lng['domain']['docroot'], 0, $result['openbasedir_path'], true) . makeoption($lng['domain']['homedir'], 1, $result['openbasedir_path'], true);
$result_ipandport = $db->query_first("SELECT `ip` FROM `".TABLE_PANEL_IPSANDPORTS."` WHERE `id`='".(int)$result['ipandport']."'"); $result_ipandport = $db->query_first("SELECT `ip` FROM `".TABLE_PANEL_IPSANDPORTS."` WHERE `id`='".(int)$result['ipandport']."'");

View File

@@ -61,13 +61,13 @@ return array(
'select_var' => isset($redirectcode) ? $redirectcode : null 'select_var' => isset($redirectcode) ? $redirectcode : null
), ),
'ssl_redirect' => array( 'ssl_redirect' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? true : false), 'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false),
'label' => 'SSL Redirect', 'label' => 'SSL Redirect',
'type' => 'checkbox', 'type' => 'checkbox',
'values' => array( 'values' => array(
array ('label' => $lng['panel']['yes'], 'value' => '1') array ('label' => $lng['panel']['yes'], 'value' => '1')
), ),
'value' => array($result['ssl_redirect']) 'value' => array()
), ),
'openbasedir_path' => array( 'openbasedir_path' => array(
'label' => $lng['domain']['openbasedirpath'], 'label' => $lng['domain']['openbasedirpath'],

View File

@@ -79,7 +79,7 @@ return array(
'value' => array($result['isemaildomain']) 'value' => array($result['isemaildomain'])
), ),
'ssl_redirect' => array( 'ssl_redirect' => array(
'visible' => ($settings['system']['use_ssl'] == '1' ? true : false), 'visible' => ($settings['system']['use_ssl'] == '1' ? ($ssl_ipsandports != '' ? true : false) : false),
'label' => 'SSL Redirect', 'label' => 'SSL Redirect',
'type' => 'checkbox', 'type' => 'checkbox',
'values' => array( 'values' => array(