echo"\n".gettext("Is this the backup you wish to restore?")."\n";
echo"\nIs this the backup you wish to restore?\n";
list_backups($number);
list_backups($number);
$filename=array_keys($confvers)[$number-1];
$filename=array_keys($confvers)[$number-1];
$thisbackup=$confvers[$filename];
$thisbackup=$confvers[$filename];
echogettext("Y/N?")." : ";
echo'Y/N? : ';
$confirm=strtoupper(chop(fgets($fp)));
$confirm=strtoupper(chop(fgets($fp)));
if($confirm==gettext("Y")){
if($confirm=='Y'){
$cnf=OPNsense\Core\Config::getInstance();
$cnf=OPNsense\Core\Config::getInstance();
if($cnf->restoreBackup($filename)){
if($cnf->restoreBackup($filename)){
echo"\n";
echo"\n";
echosprintf(gettext('Successfully reverted to timestamp %s with description "%s".'),date(gettext("n/j/y H:i:s"),$thisbackup['time']),$thisbackup['description']);
echosprintf('Successfully reverted to timestamp %s with description "%s".',date('n/j/y H:i:s',$thisbackup['time']),$thisbackup['description']);
echo"\n".gettext("You may need to reboot the firewall or restart services before the restored configuration is fully active.")."\n\n";
echo"\nYou may need to reboot the firewall or restart services before the restored configuration is fully active.\n\n";
}else{
}else{
echogettext("Unable to revert to the selected configuration.")."\n";
echo"Unable to revert to the selected configuration.\n";
}
}
}else{
}else{
echogettext("Restore canceled.")."\n";
echo"Restore canceled.\n";
}
}
}else{
}else{
echogettext("Restore canceled due to invalid input.")."\n";
echo"Restore canceled due to invalid input.\n";
}
}
}
}
while(true){
while(true){
echo"\nRestore Backup from Configuration History\n\n";
echo"\n";
echo"1) List Backups\n";
echogettext("Restore Backup from Configuration History")."\n\n";
echo"2) Restore Backup\n";
echo"1) ".gettext("List Backups")."\n";
echo"q) Quit\n\n\n";
echo"2) ".gettext("Restore Backup")."\n";
echo"Please select an option to continue: ";
echo"Q) ".gettext("Quit")."\n";
echo"\n\n";
echogettext("Please select an option to continue").": ";
$command=strtolower(chop(fgets($fp)));
$command=strtolower(chop(fgets($fp)));
// Make sure we can detect a foreign language "quit" command.