From ce95440aa1c20dd7aa169d9ac8b1d5db3889b467 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Sat, 11 Aug 2007 10:22:05 -0400
Subject: [PATCH] Enhanced the installer.

---
 install/lib/installer_base.lib.php |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 335a497..e152fe8 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -38,14 +38,64 @@
 	
 	*/
 	
-	function lng() {
-		
+	function lng($text) {
+		return $text;
 	}
 	
 	function error($msg) {
 		die("ERROR: ".$msg."\n");
 	}
 	
+	function simple_query($query,$answers,$default) {
+		global $conf;
+		
+		$finished = false;
+		do {
+			$answers_str = implode(",",$answers);
+			swriteln($this->lng($query).' ('.$answers_str.') ['.$default.']:');
+			$input = sread();
+			
+			// Stop the installation
+			if($input == 'quit') {
+				die($this->lng('Installation interrupted.'));
+			}
+			
+			// Select the default
+			if($input == '') {
+				$answer = $default;
+				$finished = true;
+			}
+			
+			if(in_array($input,$answers)) {
+				$answer = $input;
+				$finished = true;
+			}
+			
+		} while ($finished == false);
+		return $answer;
+	}
+	
+	function free_query($query,$default) {
+		global $conf;
+		
+		$answers_str = implode(",",$answers);
+		swriteln($this->lng($query).' ['.$default.']:');
+		$input = sread();
+			
+		// Stop the installation
+		if($input == 'quit') {
+			die($this->lng('Installation interrupted.'));
+		}
+			
+		// Select the default
+		if($input == '') {
+			$answer = $default;
+		}
+			
+		return $answer;
+	}
+	
+	
 	function request_language() {
 		
 		swriteln(lng('Enter your language'));

--
Gitblit v1.9.1