Skip to content

Commit 32814e8

Browse files
author
pedro_morgan
committed
More php5 on install_base
1 parent b0a1cc4 commit 32814e8

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

install/lib/installer_base.lib.php

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,43 +37,45 @@ class installer_base {
3737
/*
3838
3939
*/
40-
function __construct()
40+
public function __construct()
4141
{
4242
global $conf; //TODO: maybe $conf should be passed to constructor
4343
$this->conf = $conf;
4444
}
45-
4645

47-
function lng($text) {
46+
//TODO uh ?
47+
public function lng($text)
48+
{
4849
return $text;
4950
}
5051

51-
function error($msg) {
52+
public function error($msg)
53+
{
5254
die("ERROR: ".$msg."\n");
5355
}
5456

55-
function simple_query($query,$answers,$default) {
56-
global $conf;
57-
57+
public function simple_query($query, $answers, $default)
58+
{
5859
$finished = false;
5960
do {
60-
$answers_str = implode(",",$answers);
61+
$answers_str = implode(',', $answers);
6162
swrite($this->lng($query).' ('.$answers_str.') ['.$default.']: ');
6263
$input = sread();
6364

64-
// Stop the installation
65+
//* Stop the installation
6566
if($input == 'quit') {
66-
swriteln($this->lng('Installation interrupted.'));
67+
swriteln($this->lng("Installation terminated by user.\n"));
6768
die();
6869
}
6970

70-
// Select the default
71+
//* Select the default
7172
if($input == '') {
7273
$answer = $default;
7374
$finished = true;
7475
}
7576

76-
if(in_array($input,$answers)) {
77+
//* Set answer id valid
78+
if(in_array($input, $answers)) {
7779
$answer = $input;
7880
$finished = true;
7981
}
@@ -83,31 +85,24 @@ function simple_query($query,$answers,$default) {
8385
return $answer;
8486
}
8587

86-
function free_query($query,$default) {
87-
global $conf;
88-
88+
public function free_query($query,$default)
89+
{
8990
swrite($this->lng($query).' ['.$default.']: ');
9091
$input = sread();
9192

92-
// Stop the installation
93+
//* Stop the installation
9394
if($input == 'quit') {
94-
swriteln($this->lng('Installation interrupted.'));
95-
die();
95+
swriteln($this->lng("Installation terminated by user.\n"));
96+
die();
9697
}
9798

98-
// Select the default
99-
if($input == '') {
100-
$answer = $default;
101-
} else {
102-
$answer = $input;
103-
}
99+
$answer = ($input == '') ? $default : $input;
104100
swriteln();
105-
106101
return $answer;
107102
}
108103

109-
110-
function request_language() {
104+
// TODO: this function is not used atmo I think - pedro
105+
function request_language(){
111106

112107
swriteln(lng('Enter your language'));
113108
swriteln(lng('de, en'));

0 commit comments

Comments
 (0)