fix error when security question is being asked when adding a domain as admin, thx to Sephi

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-05-08 16:34:04 +02:00
parent 55312a6df4
commit b5fc0ad532
2 changed files with 24 additions and 31 deletions

View File

@@ -392,41 +392,35 @@ if($page == 'domains'
} }
$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_check = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = '" . $db->escape($ipandport) . "' " . $additional_ip_condition);
$ipandport = intval($ipandport); if(!isset($ipandport_check['id'])
$ipandport_check = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = '" . $db->escape($ipandport) . "' " . $additional_ip_condition); || $ipandport_check['id'] == '0'
if(!isset($ipandport_check['id']) || $ipandport_check['id'] != $ipandport
|| $ipandport_check['id'] == '0' ) {
|| $ipandport_check['id'] != $ipandport)
{
standard_error('ipportdoesntexist'); standard_error('ipportdoesntexist');
} } else {
else
{
$ipandports[] = $ipandport; $ipandports[] = $ipandport;
} }
} }
} }
if($settings['system']['use_ssl'] == "1" if ($settings['system']['use_ssl'] == "1"
&& isset($_POST['ssl_ipandport'])) && isset($_POST['ssl_ipandport'])
{ ) {
$ssl_redirect = 0; $ssl_redirect = 0;
if (isset($_POST['ssl_redirect'])) { if (isset($_POST['ssl_redirect'])) {
$ssl_redirect = (int)$_POST['ssl_redirect']; $ssl_redirect = (int)$_POST['ssl_redirect'];
} }
$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']);
} }
@@ -592,9 +586,9 @@ if($page == 'domains'
'dkim' => $dkim, 'dkim' => $dkim,
'speciallogfile' => $speciallogfile, 'speciallogfile' => $speciallogfile,
'wwwserveralias' => $wwwserveralias, 'wwwserveralias' => $wwwserveralias,
'ipandport' => $ipandport, 'ipandport' => serialize($ipandports),
'ssl_redirect' => $ssl_redirect, 'ssl_redirect' => $ssl_redirect,
'ssl_ipandport' => $ssl_ipandport, 'ssl_ipandport' => serialize($ssl_ipandports),
'openbasedir' => $openbasedir, 'openbasedir' => $openbasedir,
'phpsettingid' => $phpsettingid, 'phpsettingid' => $phpsettingid,
'mod_fcgid_starter' => $mod_fcgid_starter, 'mod_fcgid_starter' => $mod_fcgid_starter,

View File

@@ -249,17 +249,15 @@ class htmlform
*/ */
public static function _checkbox($fieldname = '', $data = array()) { public static function _checkbox($fieldname = '', $data = array()) {
// $data['value'] contains checked items // $data['value'] contains checked items
$checked = array();
if (isset($data['value'])) { if (isset($data['value'])) {
$checked = $data['value']; $checked = $data['value'];
} else {
$checked = array();
} }
if (isset($_SESSION['requestData'])) { if (isset($_SESSION['requestData'])) {
if(isset($_SESSION['requestData'][$fieldname])) { if(isset($_SESSION['requestData'][$fieldname])) {
$checked = array($_SESSION['requestData'][$fieldname]); $checked = array($_SESSION['requestData'][$fieldname]);
} else {
$checked = array();
} }
} }
@@ -276,13 +274,14 @@ class htmlform
$key = $val['label']; $key = $val['label'];
// is this box checked? // is this box checked?
$isChecked = ''; $isChecked = '';
foreach($checked as $tmp) { if (is_array($checked) && count($checked) > 0) {
if ($tmp == $val['value']) { foreach($checked as $tmp) {
$isChecked = ' checked="checked" '; if ($tmp == $val['value']) {
break; $isChecked = ' checked="checked" ';
break;
}
} }
} }
$output .= '<label><input type="checkbox" name="'.$fieldname.$isArray.'" value="'.$val['value'].'" '.$isChecked.'/>'.$key.'</label>'; $output .= '<label><input type="checkbox" name="'.$fieldname.$isArray.'" value="'.$val['value'].'" '.$isChecked.'/>'.$key.'</label>';
} }