diff --git a/wwwroot/inc/functions.php b/wwwroot/inc/functions.php index 6d957a808..f922c1a50 100644 --- a/wwwroot/inc/functions.php +++ b/wwwroot/inc/functions.php @@ -5118,12 +5118,13 @@ function showNotice ($message, $option = '') } // asks ok/cancel question -// return string 'true' or 'false' +// return TRUE/FALSE/NULL +// NULL = waiting for choice // adds 'answer' to request post data and repeats request function showChoice ($question) { if (isset ($_POST['answer'])) - return $_POST['answer']; + return ($_POST['answer'] === 'true' ? TRUE : FALSE); $form = "
"; foreach ($_POST as $name => $value) @@ -5144,6 +5145,8 @@ function showChoice ($question) ENDMSG; setMessage ('warning', $msg, FALSE); + + return NULL; } // do not call this directly, use showError and its siblings instead diff --git a/wwwroot/inc/ophandlers.php b/wwwroot/inc/ophandlers.php index e6e07cd89..736eeae61 100644 --- a/wwwroot/inc/ophandlers.php +++ b/wwwroot/inc/ophandlers.php @@ -1021,23 +1021,31 @@ function addIPAllocation () if ($reserved || $ipname) { - if (showChoice ('Assign IP '.ip_format ($ip_bin).'?
'. - ($reserved ? 'IP reservation will be removed!
' : ''). - ($ipname ? 'IP name "'.$address['name'].'" will be removed!' : '') - ) != 'true') + $choice = showChoice ('Assign IP '.ip_format ($ip_bin).' Name: "'.$address['name'].'"?
'. + ($reserved ? 'IP reservation will be removed!
' : ''). + ($ipname ? 'IP name "'.$address['name'].'" and comment will be removed!' : '') + ); + + if ($choice === NULL) // waiting for choice + return; + + if($choice !== TRUE) { - showWarning ('IP '.ip_format ($ip_bin).' NOT assigned
'. + showWarning ('IP '.ip_format ($ip_bin).' Name: "'.$address['name'].'" NOT assigned
'. ($reserved ? 'IP is still reserved!
' : ''). - ($ipname ? 'IP name "'.$address['name'].'" unchanged' : '')); + ($ipname ? 'IP name "'.$address['name'].'" and comment unchanged' : '')); return buildRedirectURL (NULL, NULL, array ('hl_ip' => ip_format ($ip_bin))); } - showWarning ('IP '.ip_format ($ip_bin).' assigned
'. + showWarning ('IP '.ip_format ($ip_bin).' Name: "'.$address['name'].'" assigned
'. ($reserved ? 'IP is NO longer reserved!
' : ''). - ($ipname ? 'IP name "'.$address['name'].'" removed!' : '')); + ($ipname ? 'IP name "'.$address['name'].'" and comment removed!' : '')); } } + else + if ($address['reserved'] == 'yes' && $address['name'] != '') + showWarning ('IP '.ip_format ($ip_bin).' Name: "'.$address['name'].'" is already reserved!'); bindIPToObject (