- go back as many pages as we have security-questions in admin_domains.php, so we always return to the main form, fixes #332

refs #332
This commit is contained in:
Michael Kaufmann (d00p)
2010-09-20 06:07:54 +00:00
parent ca44db25a0
commit 7676acf1f2
3 changed files with 14 additions and 22 deletions

View File

@@ -527,6 +527,7 @@ if($page == 'domains'
'reallydisablesecuritysetting' => (($openbasedir == '0' || $safemode == '0') && $userinfo['change_serversettings'] == '1'),
'reallydocrootoutofcustomerroot' => (substr($documentroot, 0, strlen($customer['documentroot'])) != $customer['documentroot'] && !preg_match('/^https?\:\/\//', $documentroot))
);
$question_nr = 1;
foreach($security_questions as $question_name => $question_launch)
{
if($question_launch !== false)
@@ -536,10 +537,11 @@ if($page == 'domains'
if(!isset($_POST[$question_name])
|| $_POST[$question_name] != $question_name)
{
ask_yesno('admin_domain_' . $question_name, $filename, $params);
ask_yesno('admin_domain_' . $question_name, $filename, $params, $question_nr);
exit;
}
}
$question_nr++;
}
$db->query("INSERT INTO `" . TABLE_PANEL_DOMAINS . "` (`domain`, `customerid`, `adminid`, `documentroot`, `ipandport`,`aliasdomain`, `zonefile`, `dkim`, `wwwserveralias`, `isbinddomain`, `isemaildomain`, `email_only`, `subcanemaildomain`, `caneditdomain`, `openbasedir`, `safemode`,`speciallogfile`, `specialsettings`, `ssl`, `ssl_redirect`, `ssl_ipandport`, `add_date`, `registration_date`, `phpsettingid`, `mod_fcgid_starter`, `mod_fcgid_maxrequests`, `ismainbutsubto`) VALUES ('" . $db->escape($domain) . "', '" . (int)$customerid . "', '" . (int)$adminid . "', '" . $db->escape($documentroot) . "', '" . $db->escape($ipandport) . "', " . (($aliasdomain != 0) ? '\'' . $db->escape($aliasdomain) . '\'' : 'NULL') . ", '" . $db->escape($zonefile) . "', '" . $db->escape($dkim) . "', '" . $db->escape($wwwserveralias) . "', '" . $db->escape($isbinddomain) . "', '" . $db->escape($isemaildomain) . "', '" . $db->escape($email_only) . "', '" . $db->escape($subcanemaildomain) . "', '" . $db->escape($caneditdomain) . "', '" . $db->escape($openbasedir) . "', '" . $db->escape($safemode) . "', '" . $db->escape($speciallogfile) . "', '" . $db->escape($specialsettings) . "', '" . $ssl . "', '" . $ssl_redirect . "' , '" . $ssl_ipandport . "', '" . $db->escape(time()) . "', '" . $db->escape($registration_date) . "', '" . (int)$phpsettingid . "', '" . (int)$mod_fcgid_starter . "', '" . (int)$mod_fcgid_maxrequests . "', '".(int)$issubof."')");

View File

@@ -20,32 +20,22 @@
/**
* Prints Question on screen
*
* @param string The question
* @param string File which will be called with POST if user clicks yes
* @param array Values which will be given to $yesfile. Format: array(variable1=>value1, variable2=>value2, variable3=>value3)
* @param string Name of the target eg Domain or eMail address etc.
* @param string $text The question
* @param string $yesfile File which will be called with POST if user clicks yes
* @param array $params Values which will be given to $yesfile. Format: array(variable1=>value1, variable2=>value2, variable3=>value3)
* @param string $targetname Name of the target eg Domain or eMail address etc.
* @param int $back_nr Number of steps to go back when "No" is pressed
*
* @author Florian Lippert <flo@syscp.org>
* @author Froxlor team <team@froxlor.org> (2010-)
*
* @return string outputs parsed question_yesno template
*/
function ask_yesno($text, $yesfile, $params = array(), $targetname = '')
function ask_yesno($text, $yesfile, $params = array(), $targetname = '', $back_nr = 1)
{
global $userinfo, $db, $s, $header, $footer, $lng;
/*
// For compatibility reasons (if $params contains a string like "field1=value1;field2=value2") this will convert it into a usable array
if(!is_array($params))
{
$params_tmp=explode(';',$params);
unset($params);
$params=array();
while(list(,$param_tmp)=each($params_tmp))
{
$param_tmp=explode('=',$param_tmp);
$params[$param_tmp[0]]=$param_tmp[1];
}
}
*/
$hiddenparams = '';
if(is_array($params))

View File

@@ -9,7 +9,7 @@ $header
</tr>
<tr>
<td class="field_name_border_left">$text</td>
<td class="field_name" nowrap="nowrap"><input type="submit" class="bottom" name="submitbutton" value="{$lng['panel']['yes']}" />&nbsp;<input type="button" class="bottom" value="{$lng['panel']['no']}" onclick="history.back();" /></td>
<td class="field_name" nowrap="nowrap"><input type="submit" class="bottom" name="submitbutton" value="{$lng['panel']['yes']}" />&nbsp;<input type="button" class="bottom" value="{$lng['panel']['no']}" onclick="history.go(-{$back_nr});" /></td>
</tr>
</table>
</form>