rc: unify yes/no prompts and indicate their default option when blank

This commit is contained in:
Franco Fichtner 2017-05-12 07:14:18 +02:00
parent 3a2758a942
commit 3069587239
5 changed files with 10 additions and 10 deletions

View File

@ -53,7 +53,7 @@ function set_networking_interfaces_ports($probe = false)
global $config;
$fp = fopen('php://stdin', 'r');
$yes_no_prompt = '[y|n]? ';
$yes_no_prompt = '[y/N]: ';
$interactive = true;
$key = null;
@ -95,7 +95,7 @@ EOD;
You now have the opportunity to configure VLANs. If you don't require VLANs
for initial connectivity, say no here and use the GUI to configure VLANs later.
Do you want to set up VLANs now ${yes_no_prompt}
Do you want to set up VLANs now? ${no_yes_prompt}
EOD;
if ($interactive) {
$key = chop(fgets($fp));
@ -277,7 +277,7 @@ EOD;
echo <<<EOD
Do you want to proceed ${yes_no_prompt}
Do you want to proceed? ${yes_no_prompt}
EOD;
if ($interactive) {
$key = chop(fgets($fp));
@ -454,7 +454,7 @@ function vlan_setup($iflist, $fp)
{
global $config;
$yes_no_prompt = '[y|n]? ';
$yes_no_prompt = '[y/N]: ';
if (isset($config['vlans']['vlan'])) {
@ -462,7 +462,7 @@ function vlan_setup($iflist, $fp)
WARNING: all existing VLANs will be cleared if you proceed!
Do you want to proceed ${yes_no_prompt}
Do you want to proceed? ${yes_no_prompt}
EOD;
if (strcasecmp(chop(fgets($fp)), "y") != 0) {

View File

@ -32,13 +32,13 @@ require_once("config.inc");
require_once("system.inc");
$fp = fopen('php://stdin', 'r');
$yes_no_prompt = '[y|n]? ';
$yes_no_prompt = '[y/N]: ';
echo <<<EOD
You are about to reset the firewall to factory defaults.
The firewall will reboot after resetting the configuration.
Do you want to proceed {$yes_no_prompt}
Do you want to proceed? {$yes_no_prompt}
EOD;
if (strcasecmp(chop(fgets($fp)), 'y') == 0) {

View File

@ -34,7 +34,7 @@ require_once("system.inc");
$fp = fopen('php://stdin', 'r');
echo "The system will halt and power off. Do you want to proceed [y|n]? ";
echo 'The system will halt and power off. Do you want to proceed? [y/N]: ';
if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
system_halt(true);

View File

@ -33,7 +33,7 @@ require_once("system.inc");
$fp = fopen('php://stdin', 'r');
echo "The system will reboot. Do you want to proceed [y|n]? ";
echo 'The system will reboot. Do you want to proceed? [y/N]: ';
if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
system_reboot(true);

View File

@ -69,7 +69,7 @@ function restore_history_backup($number)
list_backups($number);
$filename = array_keys($confvers)[$number-1];
$thisbackup = $confvers[$filename];
echo 'Y/N? : ';
echo '[y/N]: ';
$confirm = strtoupper(chop(fgets($fp)));
if ($confirm == 'Y') {
$cnf = OPNsense\Core\Config::getInstance();