From 32814e88d61b673abef07595885e62e653c19827 Mon Sep 17 00:00:00 2001
From: pedro_morgan <pedro_morgan@ispconfig3>
Date: Sun, 19 Aug 2007 22:41:13 -0400
Subject: [PATCH] More php5 on install_base

---
 install/lib/installer_base.lib.php |   49 ++++++++++++++++++++++---------------------------
 1 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 9c5d12c..cde307a 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -37,43 +37,45 @@
 	/*
 	
 	*/
-    function __construct()
+    public function __construct()
     {
         global $conf; //TODO: maybe $conf  should be passed to constructor
         $this->conf = $conf;
     }
-
 	
-	function lng($text) {
+    //TODO  uh ?
+	public function lng($text)
+    {
 		return $text;
 	}
 	
-	function error($msg) {
+	public function error($msg)
+    {
 		die("ERROR: ".$msg."\n");
 	}
 	
-	function simple_query($query,$answers,$default) {
-		global $conf;
-		
+	public function simple_query($query, $answers, $default)
+    {		
 		$finished = false;
 		do {
-			$answers_str = implode(",",$answers);
+			$answers_str = implode(',', $answers);
 			swrite($this->lng($query).' ('.$answers_str.') ['.$default.']: ');
 			$input = sread();
 			
-			// Stop the installation
+			//* Stop the installation
 			if($input == 'quit') {
-				swriteln($this->lng('Installation interrupted.'));
+				swriteln($this->lng("Installation terminated by user.\n"));
 				die();
 			}
 			
-			// Select the default
+			//* Select the default
 			if($input == '') {
 				$answer = $default;
 				$finished = true;
 			}
 			
-			if(in_array($input,$answers)) {
+            //* Set answer id valid
+			if(in_array($input, $answers)) {
 				$answer = $input;
 				$finished = true;
 			}
@@ -83,31 +85,24 @@
 		return $answer;
 	}
 	
-	function free_query($query,$default) {
-		global $conf;
-		
+	public function free_query($query,$default)
+    {		
 		swrite($this->lng($query).' ['.$default.']: ');
 		$input = sread();
 			
-		// Stop the installation
+		//* Stop the installation
 		if($input == 'quit') {
-			swriteln($this->lng('Installation interrupted.'));
-			die();
+            swriteln($this->lng("Installation terminated by user.\n"));
+            die();
 		}
 			
-		// Select the default
-		if($input == '') {
-			$answer = $default;
-		} else {
-			$answer = $input;
-		}
+        $answer =  ($input == '') ? $default : $input;
 		swriteln();
-		
 		return $answer;
 	}
 	
-	
-	function request_language() {
+	// TODO: this function is not used atmo I think - pedro
+	function request_language(){
 		
 		swriteln(lng('Enter your language'));
 		swriteln(lng('de, en'));

--
Gitblit v1.9.1