@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @param string $domain ='default' domain to set |
65 | 65 | */ |
66 | - function defaults($domain='default') |
|
66 | + function defaults($domain = 'default') |
|
67 | 67 | { |
68 | 68 | $egw_root = realpath(__DIR__.'/../..'); |
69 | 69 | $GLOBALS['egw_info']['server']['server_root'] = $GLOBALS['egw_info']['server']['include_root'] = $egw_root; |
70 | - define('EGW_SERVER_ROOT',$egw_root); // this is usally already defined by setup and cant be changed |
|
71 | - define('EGW_INCLUDE_ROOT',$egw_root); |
|
70 | + define('EGW_SERVER_ROOT', $egw_root); // this is usally already defined by setup and cant be changed |
|
71 | + define('EGW_INCLUDE_ROOT', $egw_root); |
|
72 | 72 | |
73 | 73 | $GLOBALS['egw_info']['server']['header_admin_user'] = 'admin'; |
74 | 74 | $GLOBALS['egw_info']['server']['header_admin_password'] = ''; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $GLOBALS['egw_info']['server']['mcrypt_iv'] = $this->generate_mcyrpt_iv(); |
85 | 85 | } |
86 | 86 | |
87 | - function domain_defaults($user='admin',$passwd='',$supported_db=null) |
|
87 | + function domain_defaults($user = 'admin', $passwd = '', $supported_db = null) |
|
88 | 88 | { |
89 | 89 | $null = null; |
90 | 90 | if (is_null($supported_db)) $supported_db = $this->check_db_support($null); |
@@ -109,19 +109,19 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return array with errors or null if no errors |
111 | 111 | */ |
112 | - function validation_errors($path=EGW_SERVER_ROOT) |
|
112 | + function validation_errors($path = EGW_SERVER_ROOT) |
|
113 | 113 | { |
114 | 114 | $errors = null; |
115 | 115 | |
116 | 116 | if (!is_dir($path) || !is_readable($path) || !is_dir($path.'/api')) |
117 | 117 | { |
118 | - $errors[] = lang("%1 '%2' does NOT exist, is not readable by the webserver or contains no EGroupware installation!",lang('Server root'),$path); |
|
118 | + $errors[] = lang("%1 '%2' does NOT exist, is not readable by the webserver or contains no EGroupware installation!", lang('Server root'), $path); |
|
119 | 119 | } |
120 | - if(!$GLOBALS['egw_info']['server']['header_admin_password']) |
|
120 | + if (!$GLOBALS['egw_info']['server']['header_admin_password']) |
|
121 | 121 | { |
122 | 122 | $errors[] = lang("You didn't enter a header admin password"); |
123 | 123 | } |
124 | - if(!$GLOBALS['egw_info']['server']['header_admin_user']) |
|
124 | + if (!$GLOBALS['egw_info']['server']['header_admin_user']) |
|
125 | 125 | { |
126 | 126 | $errors[] = lang("You didn't enter a header admin username"); |
127 | 127 | } |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | } |
132 | 132 | else |
133 | 133 | { |
134 | - foreach($GLOBALS['egw_domain'] as $domain => $data) |
|
134 | + foreach ($GLOBALS['egw_domain'] as $domain => $data) |
|
135 | 135 | { |
136 | 136 | if (!$data['config_passwd']) |
137 | 137 | { |
138 | - $errors[] = lang("You didn't enter a config password for domain %1",$domain); |
|
138 | + $errors[] = lang("You didn't enter a config password for domain %1", $domain); |
|
139 | 139 | } |
140 | - if(!$data['config_user']) |
|
140 | + if (!$data['config_user']) |
|
141 | 141 | { |
142 | - $errors[] = lang("You didn't enter a config username for domain %1",$domain); |
|
142 | + $errors[] = lang("You didn't enter a config username for domain %1", $domain); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | * @param array $egw_domain info about the existing eGW domains / DB instances |
157 | 157 | * @return string content of header.inc.php |
158 | 158 | */ |
159 | - function generate($egw_info,$egw_domain) |
|
159 | + function generate($egw_info, $egw_domain) |
|
160 | 160 | { |
161 | - $tpl = new Framework\Template('../', 'keep'); // 'keep' to not loose '{hash}' prefix of password-hashes! |
|
161 | + $tpl = new Framework\Template('../', 'keep'); // 'keep' to not loose '{hash}' prefix of password-hashes! |
|
162 | 162 | $tpl->set_file(array('header' => 'header.inc.php.template')); |
163 | - $tpl->set_block('header','domain','domain'); |
|
163 | + $tpl->set_block('header', 'domain', 'domain'); |
|
164 | 164 | |
165 | 165 | $most_secure_pw_hash = null; |
166 | 166 | Api\Auth::passwdhashes($most_secure_pw_hash); |
167 | 167 | |
168 | - foreach($egw_domain as $domain => $data) |
|
168 | + foreach ($egw_domain as $domain => $data) |
|
169 | 169 | { |
170 | 170 | $var = array('DB_DOMAIN' => $domain); |
171 | - foreach($data as $name => $value) |
|
171 | + foreach ($data as $name => $value) |
|
172 | 172 | { |
173 | 173 | if ($name == 'db_port' && !$value) $value = $this->default_db_ports[$data['db_type']]; |
174 | 174 | if ($name == 'config_passwd') |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | } |
182 | 182 | } |
183 | 183 | $tpl->set_var($var); |
184 | - $tpl->parse('domains','domain',True); |
|
184 | + $tpl->parse('domains', 'domain', True); |
|
185 | 185 | } |
186 | - $tpl->set_var('domain',''); |
|
186 | + $tpl->set_var('domain', ''); |
|
187 | 187 | |
188 | 188 | $var = Array(); |
189 | - foreach($egw_info['server'] as $name => $value) |
|
189 | + foreach ($egw_info['server'] as $name => $value) |
|
190 | 190 | { |
191 | 191 | if ($name == 'header_admin_password' && $value && !self::is_hashed($value)) $value = Api\Auth::encrypt_sql($value, $most_secure_pw_hash); |
192 | 192 | if ($name == 'versions') |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | $tpl->set_var($var); |
210 | 210 | |
211 | - return $tpl->parse('out','header'); |
|
211 | + return $tpl->parse('out', 'header'); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -227,18 +227,18 @@ discard block |
||
227 | 227 | return $iv; |
228 | 228 | }*/ |
229 | 229 | $size = 30; |
230 | - srand((double)microtime()*1000000); |
|
230 | + srand((double)microtime() * 1000000); |
|
231 | 231 | $random_char = array( |
232 | - '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f', |
|
233 | - 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', |
|
234 | - 'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L', |
|
235 | - 'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' |
|
232 | + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', |
|
233 | + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', |
|
234 | + 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', |
|
235 | + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' |
|
236 | 236 | ); |
237 | 237 | |
238 | 238 | $iv = ''; |
239 | - for($i=0; $i < $size; $i++) |
|
239 | + for ($i = 0; $i < $size; $i++) |
|
240 | 240 | { |
241 | - $iv .= $random_char[rand(1,count($random_char))]; |
|
241 | + $iv .= $random_char[rand(1, count($random_char))]; |
|
242 | 242 | } |
243 | 243 | //error_log(__METHOD__."() size=$size returning ".array2string($iv)); |
244 | 244 | return $iv; |
@@ -247,15 +247,15 @@ discard block |
||
247 | 247 | function check_db_support(&$detected) |
248 | 248 | { |
249 | 249 | $supported_db = $detected = array(); |
250 | - foreach(array( |
|
250 | + foreach (array( |
|
251 | 251 | // short => array(extension,func_to_check,supported_db(s)) |
252 | - 'mysqli' => array('mysql','mysqli_connect','mysqli'), |
|
253 | - 'mysql' => array('mysql','mysql_connect','mysql'), |
|
254 | - 'mysqlt' => array('mysql','mysql_connect','mysqlt'), |
|
255 | - 'pgsql' => array('pgsql','pg_connect','pgsql'), |
|
256 | - 'mssql' => array('mssql','mssql_connect','mssql'), |
|
257 | - 'odbc' => array('odbc',false,'sapdb','odbc_mssql','odbc_oracle'), |
|
258 | - 'oracle' => array('oci8',false,'oracle'), |
|
252 | + 'mysqli' => array('mysql', 'mysqli_connect', 'mysqli'), |
|
253 | + 'mysql' => array('mysql', 'mysql_connect', 'mysql'), |
|
254 | + 'mysqlt' => array('mysql', 'mysql_connect', 'mysqlt'), |
|
255 | + 'pgsql' => array('pgsql', 'pg_connect', 'pgsql'), |
|
256 | + 'mssql' => array('mssql', 'mssql_connect', 'mssql'), |
|
257 | + 'odbc' => array('odbc', false, 'sapdb', 'odbc_mssql', 'odbc_oracle'), |
|
258 | + 'oracle' => array('oci8', false, 'oracle'), |
|
259 | 259 | ) as $db => $data) |
260 | 260 | { |
261 | 261 | $ext = array_shift($data); |
@@ -263,12 +263,12 @@ discard block |
||
263 | 263 | $name = isset($this->db_fullnames[$db]) ? $this->db_fullnames[$db] : strtoupper($db); |
264 | 264 | if (check_load_extension($ext) || $func_to_check && function_exists($func_to_check)) |
265 | 265 | { |
266 | - $detected[] = lang('You appear to have %1 support.',$name); |
|
267 | - $supported_db = array_merge($supported_db,$data); |
|
266 | + $detected[] = lang('You appear to have %1 support.', $name); |
|
267 | + $supported_db = array_merge($supported_db, $data); |
|
268 | 268 | } |
269 | 269 | else |
270 | 270 | { |
271 | - $detected[] .= lang('No %1 support found. Disabling',$name); |
|
271 | + $detected[] .= lang('No %1 support found. Disabling', $name); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | return $supported_db; |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | // some constanst for pre php4.3 |
292 | 292 | if (!defined('PHP_SHLIB_SUFFIX')) |
293 | 293 | { |
294 | - define('PHP_SHLIB_SUFFIX',strtoupper(substr(PHP_OS, 0,3)) == 'WIN' ? 'dll' : 'so'); |
|
294 | + define('PHP_SHLIB_SUFFIX', strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' ? 'dll' : 'so'); |
|
295 | 295 | } |
296 | 296 | if (!defined('PHP_SHLIB_PREFIX')) |
297 | 297 | { |
298 | - define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : ''); |
|
298 | + define('PHP_SHLIB_PREFIX', PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : ''); |
|
299 | 299 | } |
@@ -74,7 +74,10 @@ discard block |
||
74 | 74 | $GLOBALS['egw_info']['server']['header_admin_password'] = ''; |
75 | 75 | $GLOBALS['egw_info']['server']['setup_acl'] = ''; |
76 | 76 | |
77 | - if ($domain) $GLOBALS['egw_domain'][$domain] = $this->domain_defaults(); |
|
77 | + if ($domain) |
|
78 | + { |
|
79 | + $GLOBALS['egw_domain'][$domain] = $this->domain_defaults(); |
|
80 | + } |
|
78 | 81 | |
79 | 82 | $GLOBALS['egw_info']['server']['show_domain_selectbox'] = false; |
80 | 83 | $GLOBALS['egw_info']['server']['db_persistent'] = True; |
@@ -87,7 +90,10 @@ discard block |
||
87 | 90 | function domain_defaults($user='admin',$passwd='',$supported_db=null) |
88 | 91 | { |
89 | 92 | $null = null; |
90 | - if (is_null($supported_db)) $supported_db = $this->check_db_support($null); |
|
93 | + if (is_null($supported_db)) |
|
94 | + { |
|
95 | + $supported_db = $this->check_db_support($null); |
|
96 | + } |
|
91 | 97 | $default_db = count($supported_db) ? $supported_db[0] : 'mysqli'; |
92 | 98 | |
93 | 99 | return array( |
@@ -170,7 +176,10 @@ discard block |
||
170 | 176 | $var = array('DB_DOMAIN' => $domain); |
171 | 177 | foreach($data as $name => $value) |
172 | 178 | { |
173 | - if ($name == 'db_port' && !$value) $value = $this->default_db_ports[$data['db_type']]; |
|
179 | + if ($name == 'db_port' && !$value) |
|
180 | + { |
|
181 | + $value = $this->default_db_ports[$data['db_type']]; |
|
182 | + } |
|
174 | 183 | if ($name == 'config_passwd') |
175 | 184 | { |
176 | 185 | $var['CONFIG_PASS'] = self::is_hashed($value) ? $value : Api\Auth::encrypt_sql($value, $most_secure_pw_hash); |
@@ -188,7 +197,10 @@ discard block |
||
188 | 197 | $var = Array(); |
189 | 198 | foreach($egw_info['server'] as $name => $value) |
190 | 199 | { |
191 | - if ($name == 'header_admin_password' && $value && !self::is_hashed($value)) $value = Api\Auth::encrypt_sql($value, $most_secure_pw_hash); |
|
200 | + if ($name == 'header_admin_password' && $value && !self::is_hashed($value)) |
|
201 | + { |
|
202 | + $value = Api\Auth::encrypt_sql($value, $most_secure_pw_hash); |
|
203 | + } |
|
192 | 204 | if ($name == 'versions') |
193 | 205 | { |
194 | 206 | $name = 'mcrypt_version'; |
@@ -185,7 +185,7 @@ |
||
185 | 185 | } |
186 | 186 | $tpl->set_var('domain',''); |
187 | 187 | |
188 | - $var = Array(); |
|
188 | + $var = array(); |
|
189 | 189 | foreach($egw_info['server'] as $name => $value) |
190 | 190 | { |
191 | 191 | if ($name == 'header_admin_password' && $value && !self::is_hashed($value)) $value = Api\Auth::encrypt_sql($value, $most_secure_pw_hash); |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @param array $config =array() extra config for the account object: account_repository, ldap_* |
39 | 39 | * @param string $lang ='en' |
40 | 40 | */ |
41 | - function __construct($domain,$config_user=null,$config_passwd=null,$admin_user=null,$admin_password=null, |
|
42 | - $admin_firstname=null,$admin_lastname=null,$admin_email=null,array $config=array(),$lang='en') |
|
41 | + function __construct($domain, $config_user = null, $config_passwd = null, $admin_user = null, $admin_password = null, |
|
42 | + $admin_firstname = null, $admin_lastname = null, $admin_email = null, array $config = array(), $lang = 'en') |
|
43 | 43 | { |
44 | 44 | if (!is_array($domain)) |
45 | 45 | { |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
69 | 69 | * @throws Exception('header.inc.php not found!'); |
70 | 70 | */ |
71 | - protected function exec($check_only=false) |
|
71 | + protected function exec($check_only = false) |
|
72 | 72 | { |
73 | 73 | if ($check_only && $this->remote_id) |
74 | 74 | { |
75 | - return true; // can only check locally |
|
75 | + return true; // can only check locally |
|
76 | 76 | } |
77 | - $this->check_installed($this->domain,15); |
|
77 | + $this->check_installed($this->domain, 15); |
|
78 | 78 | |
79 | 79 | if (!$this->admin_firstname) $this->set_defaults['admin_firstname'] = $this->admin_firstname = lang('Admin'); |
80 | 80 | if (!$this->admin_lastname) $this->set_defaults['admin_lastname'] = $this->admin_lastname = lang('User'); |
81 | - if (strpos($this->admin_email,'$') !== false) |
|
81 | + if (strpos($this->admin_email, '$') !== false) |
|
82 | 82 | { |
83 | 83 | $this->set_defaults['email'] = $this->admin_email = str_replace( |
84 | - array('$domain','$uid','$account_lid'), |
|
85 | - array($this->domain,$this->admin_user,$this->admin_user),$this->admin_email); |
|
84 | + array('$domain', '$uid', '$account_lid'), |
|
85 | + array($this->domain, $this->admin_user, $this->admin_user), $this->admin_email); |
|
86 | 86 | } |
87 | 87 | $_POST['username'] = $this->admin_user; |
88 | 88 | $_POST['passwd2'] = $_POST['passwd'] = $this->admin_password; |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | switch ($error) |
100 | 100 | { |
101 | 101 | case 41: |
102 | - throw new Api\Exception\WrongUserinput(lang('Error in admin-creation !!!'),41); |
|
102 | + throw new Api\Exception\WrongUserinput(lang('Error in admin-creation !!!'), 41); |
|
103 | 103 | case 42: |
104 | - throw new Api\Exception\WrongUserinput(lang('Error in group-creation !!!'),42); |
|
104 | + throw new Api\Exception\WrongUserinput(lang('Error in group-creation !!!'), 42); |
|
105 | 105 | } |
106 | 106 | $this->restore_db(); |
107 | 107 | |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | if (php_sapi_name() !== 'cli' || !file_exists(EGW_SERVER_ROOT.'/stylite') || file_exists(EGW_SERVER_ROOT.'/managementserver')) |
113 | 113 | { |
114 | 114 | $output = $ret = null; |
115 | - exec($cmd,$output,$ret); |
|
115 | + exec($cmd, $output, $ret); |
|
116 | 116 | } |
117 | - $output = implode("\n",$output); |
|
117 | + $output = implode("\n", $output); |
|
118 | 118 | //echo "ret=$ret\n".$output; |
119 | 119 | if ($ret) |
120 | 120 | { |
121 | - throw new Api\Exception ($output,$ret); |
|
121 | + throw new Api\Exception($output, $ret); |
|
122 | 122 | } |
123 | 123 | return lang('Admin account successful created.'); |
124 | 124 | } |
@@ -76,8 +76,14 @@ |
||
76 | 76 | } |
77 | 77 | $this->check_installed($this->domain,15); |
78 | 78 | |
79 | - if (!$this->admin_firstname) $this->set_defaults['admin_firstname'] = $this->admin_firstname = lang('Admin'); |
|
80 | - if (!$this->admin_lastname) $this->set_defaults['admin_lastname'] = $this->admin_lastname = lang('User'); |
|
79 | + if (!$this->admin_firstname) |
|
80 | + { |
|
81 | + $this->set_defaults['admin_firstname'] = $this->admin_firstname = lang('Admin'); |
|
82 | + } |
|
83 | + if (!$this->admin_lastname) |
|
84 | + { |
|
85 | + $this->set_defaults['admin_lastname'] = $this->admin_lastname = lang('User'); |
|
86 | + } |
|
81 | 87 | if (strpos($this->admin_email,'$') !== false) |
82 | 88 | { |
83 | 89 | $this->set_defaults['email'] = $this->admin_email = str_replace( |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | if (!$this->header_secret && $this->header_admin_user) // no secret specified but header_admin_user/password |
36 | 36 | { |
37 | 37 | if (!$this->uid) $this->uid = true; |
38 | - $this->set_header_secret($this->header_admin_user,$this->header_admin_password); |
|
38 | + $this->set_header_secret($this->header_admin_user, $this->header_admin_password); |
|
39 | 39 | } |
40 | 40 | $secret = $this->_calc_header_secret($GLOBALS['egw_info']['server']['header_admin_user'], |
41 | 41 | $GLOBALS['egw_info']['server']['header_admin_password']); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | if ($this->header_secret != $secret) |
45 | 45 | { |
46 | 46 | //echo "_check_header_access: header_secret='$this->header_secret' != '$secret'=_calc_header_secret({$GLOBALS['egw_info']['server']['header_admin_user']},{$GLOBALS['egw_info']['server']['header_admin_password']})\n"; |
47 | - throw new Api\Exception\NoPermission(lang('Wrong credentials to access the header.inc.php file!'),5); |
|
47 | + throw new Api\Exception\NoPermission(lang('Wrong credentials to access the header.inc.php file!'), 5); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | } |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | * @param string $user |
56 | 56 | * @param string $pw password or md5 hash of it |
57 | 57 | */ |
58 | - public function set_header_secret($user,$pw) |
|
58 | + public function set_header_secret($user, $pw) |
|
59 | 59 | { |
60 | 60 | if ($this->uid || parent::save(false)) // we need to save first, to get the uid |
61 | 61 | { |
62 | - $this->header_secret = $this->_calc_header_secret($user,$pw); |
|
62 | + $this->header_secret = $this->_calc_header_secret($user, $pw); |
|
63 | 63 | } |
64 | 64 | else |
65 | 65 | { |
66 | - throw new Exception ('failed to set header_secret!'); |
|
66 | + throw new Exception('failed to set header_secret!'); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param string $header_admin_password |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - private function _calc_header_secret($header_admin_user=null,$header_admin_password=null) |
|
79 | + private function _calc_header_secret($header_admin_user = null, $header_admin_password = null) |
|
80 | 80 | { |
81 | 81 | if (!self::is_md5($header_admin_password)) $header_admin_password = md5($header_admin_password); |
82 | 82 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param boolean $set_modifier =true set the current user as modifier or 0 (= run by the system) |
92 | 92 | * @return boolean true on success, false otherwise |
93 | 93 | */ |
94 | - function save($set_modifier=true) |
|
94 | + function save($set_modifier = true) |
|
95 | 95 | { |
96 | 96 | if (isset($GLOBALS['egw']->db) && is_object($GLOBALS['egw']->db) && $GLOBALS['egw']->db->Database) |
97 | 97 | { |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | /** |
113 | 113 | * Create the setup enviroment (for running within setup or eGW) |
114 | 114 | */ |
115 | - static protected function _setup_enviroment($domain=null) |
|
115 | + static protected function _setup_enviroment($domain = null) |
|
116 | 116 | { |
117 | 117 | if (!is_object($GLOBALS['egw_setup'])) |
118 | 118 | { |
119 | 119 | require_once(EGW_INCLUDE_ROOT.'/setup/inc/class.setup.inc.php'); |
120 | - $GLOBALS['egw_setup'] = new setup(true,true); |
|
120 | + $GLOBALS['egw_setup'] = new setup(true, true); |
|
121 | 121 | } |
122 | 122 | self::$egw_setup = $GLOBALS['egw_setup']; |
123 | 123 | self::$egw_setup->ConfigDomain = $domain; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | is_object($GLOBALS['egw']) && $GLOBALS['egw'] instanceof Egw) |
127 | 127 | { |
128 | 128 | // we run inside eGW, not setup --> read egw_domain array from the header via the showheader cmd |
129 | - $cmd = new setup_cmd_showheader(null); // null = only header, no db stuff, no hashes |
|
129 | + $cmd = new setup_cmd_showheader(null); // null = only header, no db stuff, no hashes |
|
130 | 130 | $header = $cmd->run(); |
131 | 131 | $GLOBALS['egw_domain'] = $header['egw_domain']; |
132 | 132 | |
@@ -179,26 +179,26 @@ discard block |
||
179 | 179 | * @throws Api\Exception\NoPermission(lang('Access denied: wrong username or password for manage-header !!!'),21); |
180 | 180 | * @throws Api\Exception\NoPermission(lang("Access denied: wrong username or password to configure the domain '%1(%2)' !!!",$domain,$GLOBALS['egw_domain'][$domain]['db_type']),40); |
181 | 181 | */ |
182 | - static function check_setup_auth($user,$pw,$domain=null) |
|
182 | + static function check_setup_auth($user, $pw, $domain = null) |
|
183 | 183 | { |
184 | 184 | self::_setup_enviroment($domain); |
185 | 185 | |
186 | 186 | // check the authentication if a header_admin_password is set, if not we dont have a header yet and no authentication |
187 | 187 | if ($GLOBALS['egw_info']['server']['header_admin_password']) // if that's not given we dont have a header yet |
188 | 188 | { |
189 | - if (!self::$egw_setup->check_auth($user,$pw,$GLOBALS['egw_info']['server']['header_admin_user'], |
|
189 | + if (!self::$egw_setup->check_auth($user, $pw, $GLOBALS['egw_info']['server']['header_admin_user'], |
|
190 | 190 | $GLOBALS['egw_info']['server']['header_admin_password']) && |
191 | 191 | (is_null($domain) || !isset($GLOBALS['egw_domain'][$domain]) || // if valid domain given check it's config user/pw |
192 | - !self::$egw_setup->check_auth($user,$pw,$GLOBALS['egw_domain'][$domain]['config_user'], |
|
192 | + !self::$egw_setup->check_auth($user, $pw, $GLOBALS['egw_domain'][$domain]['config_user'], |
|
193 | 193 | $GLOBALS['egw_domain'][$domain]['config_passwd']))) |
194 | 194 | { |
195 | 195 | if (is_null($domain)) |
196 | 196 | { |
197 | - throw new Api\Exception\NoPermission(lang('Access denied: wrong username or password for manage-header !!!'),21); |
|
197 | + throw new Api\Exception\NoPermission(lang('Access denied: wrong username or password for manage-header !!!'), 21); |
|
198 | 198 | } |
199 | 199 | else |
200 | 200 | { |
201 | - throw new Api\Exception\NoPermission(lang("Access denied: wrong username or password to configure the domain '%1(%2)' !!!",$domain,$GLOBALS['egw_domain'][$domain]['db_type']),40); |
|
201 | + throw new Api\Exception\NoPermission(lang("Access denied: wrong username or password to configure the domain '%1(%2)' !!!", $domain, $GLOBALS['egw_domain'][$domain]['db_type']), 40); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -209,13 +209,13 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @var array |
211 | 211 | */ |
212 | - static public $apps_to_install=array(); |
|
212 | + static public $apps_to_install = array(); |
|
213 | 213 | /** |
214 | 214 | * Applications which are currently need update (set after call to check_installed, for the last/only domain only) |
215 | 215 | * |
216 | 216 | * @var array |
217 | 217 | */ |
218 | - static public $apps_to_upgrade=array(); |
|
218 | + static public $apps_to_upgrade = array(); |
|
219 | 219 | |
220 | 220 | /** |
221 | 221 | * Check if eGW is installed, which versions and if an update is needed |
@@ -227,66 +227,66 @@ discard block |
||
227 | 227 | * @param boolean $verbose =false echo messages as they happen, instead returning them |
228 | 228 | * @return array with translated messages |
229 | 229 | */ |
230 | - static function check_installed($domain='',$stop=0,$verbose=false) |
|
230 | + static function check_installed($domain = '', $stop = 0, $verbose = false) |
|
231 | 231 | { |
232 | 232 | self::_setup_enviroment($domain); |
233 | 233 | |
234 | 234 | global $setup_info; |
235 | - static $header_checks=true; // output the header checks only once |
|
235 | + static $header_checks = true; // output the header checks only once |
|
236 | 236 | |
237 | 237 | $messages = array(); |
238 | 238 | |
239 | 239 | if ($stop && !is_array($stop)) $stop = array($stop); |
240 | 240 | |
241 | - $versions =& $GLOBALS['egw_info']['server']['versions']; |
|
241 | + $versions = & $GLOBALS['egw_info']['server']['versions']; |
|
242 | 242 | |
243 | 243 | if (!$versions['api']) |
244 | 244 | { |
245 | 245 | if (!include(EGW_INCLUDE_ROOT.'/api/setup/setup.inc.php')) |
246 | 246 | { |
247 | - throw new Api\Exception\WrongUserinput(lang("EGroupware sources in '%1' are not complete, file '%2' missing !!!",realpath('..'),'api/setup/setup.inc.php'),99); // should not happen ;-) |
|
247 | + throw new Api\Exception\WrongUserinput(lang("EGroupware sources in '%1' are not complete, file '%2' missing !!!", realpath('..'), 'api/setup/setup.inc.php'), 99); // should not happen ;-) |
|
248 | 248 | } |
249 | 249 | $versions['api'] = $setup_info['api']['version']; |
250 | 250 | unset($setup_info); |
251 | 251 | } |
252 | 252 | if ($header_checks) |
253 | 253 | { |
254 | - $messages[] = self::_echo_message($verbose,lang('EGroupware API version %1 found.',$versions['api'])); |
|
254 | + $messages[] = self::_echo_message($verbose, lang('EGroupware API version %1 found.', $versions['api'])); |
|
255 | 255 | } |
256 | 256 | $header_stage = self::$egw_setup->detection->check_header(); |
257 | - if ($stop && in_array($header_stage,$stop)) return true; |
|
257 | + if ($stop && in_array($header_stage, $stop)) return true; |
|
258 | 258 | |
259 | 259 | switch ($header_stage) |
260 | 260 | { |
261 | - case 1: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) does NOT exist.')."\n".lang('Use --create-header to create the configuration file (--usage gives more options).'),1); |
|
261 | + case 1: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) does NOT exist.')."\n".lang('Use --create-header to create the configuration file (--usage gives more options).'), 1); |
|
262 | 262 | |
263 | 263 | // case 2: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('No header admin password set! Use --edit-header <password>[,<user>] to set one (--usage gives more options).'),2); |
264 | 264 | |
265 | - case 3: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('No EGroupware domains / database instances exist! Use --edit-header --domain to add one (--usage gives more options).'),3); |
|
265 | + case 3: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) version %1 exists%2', $versions['header'], '.')."\n".lang('No EGroupware domains / database instances exist! Use --edit-header --domain to add one (--usage gives more options).'), 3); |
|
266 | 266 | |
267 | - case 4: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('It needs upgrading to version %1! Use --update-header <password>[,<user>] to do so (--usage gives more options).',$versions['current_header']),4); |
|
267 | + case 4: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) version %1 exists%2', $versions['header'], '.')."\n".lang('It needs upgrading to version %1! Use --update-header <password>[,<user>] to do so (--usage gives more options).', $versions['current_header']), 4); |
|
268 | 268 | } |
269 | 269 | if ($header_checks) |
270 | 270 | { |
271 | - $messages[] = self::_echo_message($verbose,lang('EGroupware configuration file (header.inc.php) version %1 exists%2', |
|
272 | - $versions['header'],' '.lang('and is up to date'))); |
|
271 | + $messages[] = self::_echo_message($verbose, lang('EGroupware configuration file (header.inc.php) version %1 exists%2', |
|
272 | + $versions['header'], ' '.lang('and is up to date'))); |
|
273 | 273 | } |
274 | - unset($header_checks); // no further output of the header checks |
|
274 | + unset($header_checks); // no further output of the header checks |
|
275 | 275 | |
276 | 276 | $domains = $GLOBALS['egw_domain']; |
277 | 277 | if ($domain) // domain to check given |
278 | 278 | { |
279 | - if (!isset($GLOBALS['egw_domain'][$domain])) throw new Api\Exception\WrongUserinput(lang("Domain '%1' does NOT exist !!!",$domain), 92); |
|
279 | + if (!isset($GLOBALS['egw_domain'][$domain])) throw new Api\Exception\WrongUserinput(lang("Domain '%1' does NOT exist !!!", $domain), 92); |
|
280 | 280 | |
281 | 281 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
282 | 282 | } |
283 | - foreach($domains as $domain => $data) |
|
283 | + foreach ($domains as $domain => $data) |
|
284 | 284 | { |
285 | - self::$egw_setup->ConfigDomain = $domain; // set the domain the setup class operates on |
|
285 | + self::$egw_setup->ConfigDomain = $domain; // set the domain the setup class operates on |
|
286 | 286 | if (count($GLOBALS['egw_domain']) > 1) |
287 | 287 | { |
288 | 288 | self::_echo_message($verbose); |
289 | - $messages[] = self::_echo_message($verbose,lang('EGroupware domain/instance %1(%2):',$domain,$data['db_type'])); |
|
289 | + $messages[] = self::_echo_message($verbose, lang('EGroupware domain/instance %1(%2):', $domain, $data['db_type'])); |
|
290 | 290 | } |
291 | 291 | $setup_info = self::$egw_setup->detection->get_versions(); |
292 | 292 | // check if there's already a db-connection and close if, otherwise the db-connection of the previous domain will be used |
@@ -298,27 +298,27 @@ discard block |
||
298 | 298 | |
299 | 299 | $db = $data['db_type'].'://'.$data['db_user'].':'.$data['db_pass'].'@'.$data['db_host'].'/'.$data['db_name']; |
300 | 300 | |
301 | - $db_stage =& $GLOBALS['egw_info']['setup']['stage']['db']; |
|
301 | + $db_stage = & $GLOBALS['egw_info']['setup']['stage']['db']; |
|
302 | 302 | if (($db_stage = self::$egw_setup->detection->check_db($setup_info)) != 1) |
303 | 303 | { |
304 | 304 | $setup_info = self::$egw_setup->detection->get_db_versions($setup_info); |
305 | 305 | $db_stage = self::$egw_setup->detection->check_db($setup_info); |
306 | 306 | } |
307 | - if ($stop && in_array(10+$db_stage,$stop)) |
|
307 | + if ($stop && in_array(10 + $db_stage, $stop)) |
|
308 | 308 | { |
309 | 309 | return $messages; |
310 | 310 | } |
311 | - switch($db_stage) |
|
311 | + switch ($db_stage) |
|
312 | 312 | { |
313 | - case 1: throw new Api\Exception\WrongUserinput(lang('Your Database is not working!')." $db: ".self::$egw_setup->db->Error,11); |
|
313 | + case 1: throw new Api\Exception\WrongUserinput(lang('Your Database is not working!')." $db: ".self::$egw_setup->db->Error, 11); |
|
314 | 314 | |
315 | - case 3: throw new Api\Exception\WrongUserinput(lang('Your database is working, but you dont have any applications installed')." ($db). ".lang("Use --install to install EGroupware."),13); |
|
315 | + case 3: throw new Api\Exception\WrongUserinput(lang('Your database is working, but you dont have any applications installed')." ($db). ".lang("Use --install to install EGroupware."), 13); |
|
316 | 316 | |
317 | - case 4: throw new Api\Exception\WrongUserinput(lang('EGroupware API needs a database (schema) update from version %1 to %2!',$setup_info['phpgwapi']['currentver'],$versions['phpgwapi']).' '.lang('Use --update to do so.'),14); |
|
317 | + case 4: throw new Api\Exception\WrongUserinput(lang('EGroupware API needs a database (schema) update from version %1 to %2!', $setup_info['phpgwapi']['currentver'], $versions['phpgwapi']).' '.lang('Use --update to do so.'), 14); |
|
318 | 318 | |
319 | 319 | case 10: // also check apps of updates |
320 | 320 | self::$apps_to_upgrade = self::$apps_to_install = array(); |
321 | - foreach($setup_info as $app => $data) |
|
321 | + foreach ($setup_info as $app => $data) |
|
322 | 322 | { |
323 | 323 | if ($data['currentver'] && $data['version'] && $data['version'] != 'deleted' && $data['version'] != $data['currentver']) |
324 | 324 | { |
@@ -332,23 +332,23 @@ discard block |
||
332 | 332 | if (self::$apps_to_install) |
333 | 333 | { |
334 | 334 | self::_echo_message($verbose); |
335 | - $messages[] = self::_echo_message($verbose,lang('The following applications are NOT installed:').' '.implode(', ',self::$apps_to_install)); |
|
335 | + $messages[] = self::_echo_message($verbose, lang('The following applications are NOT installed:').' '.implode(', ', self::$apps_to_install)); |
|
336 | 336 | } |
337 | 337 | if (self::$apps_to_upgrade) |
338 | 338 | { |
339 | 339 | $db_stage = 4; |
340 | - if ($stop && in_array(10+$db_stage,$stop)) return $messages; |
|
340 | + if ($stop && in_array(10 + $db_stage, $stop)) return $messages; |
|
341 | 341 | |
342 | - throw new Api\Exception\WrongUserinput(lang('The following applications need to be upgraded:').' '.implode(', ',self::$apps_to_upgrade).'! '.lang('Use --update to do so.'),14); |
|
342 | + throw new Api\Exception\WrongUserinput(lang('The following applications need to be upgraded:').' '.implode(', ', self::$apps_to_upgrade).'! '.lang('Use --update to do so.'), 14); |
|
343 | 343 | } |
344 | 344 | break; |
345 | 345 | } |
346 | - $messages[] = self::_echo_message($verbose,lang("database is version %1 and up to date.",$setup_info['api']['currentver'])); |
|
346 | + $messages[] = self::_echo_message($verbose, lang("database is version %1 and up to date.", $setup_info['api']['currentver'])); |
|
347 | 347 | |
348 | 348 | self::$egw_setup->detection->check_config(); |
349 | - if ($GLOBALS['egw_info']['setup']['config_errors'] && $stop && !in_array(15,$stop)) |
|
349 | + if ($GLOBALS['egw_info']['setup']['config_errors'] && $stop && !in_array(15, $stop)) |
|
350 | 350 | { |
351 | - throw new Api\Exception\WrongUserinput(lang('You need to configure EGroupware:')."\n- ".@implode("\n- ",$GLOBALS['egw_info']['setup']['config_errors']),15); |
|
351 | + throw new Api\Exception\WrongUserinput(lang('You need to configure EGroupware:')."\n- ".@implode("\n- ", $GLOBALS['egw_info']['setup']['config_errors']), 15); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | return $messages; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @param string $msg |
378 | 378 | * @return string $msg |
379 | 379 | */ |
380 | - static function _echo_message($verbose,$msg='') |
|
380 | + static function _echo_message($verbose, $msg = '') |
|
381 | 381 | { |
382 | 382 | if ($verbose) echo $msg."\n"; |
383 | 383 |
@@ -32,14 +32,20 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected function _check_header_access() |
34 | 34 | { |
35 | - if (!$this->header_secret && $this->header_admin_user) // no secret specified but header_admin_user/password |
|
35 | + if (!$this->header_secret && $this->header_admin_user) |
|
36 | + { |
|
37 | + // no secret specified but header_admin_user/password |
|
36 | 38 | { |
37 | 39 | if (!$this->uid) $this->uid = true; |
40 | + } |
|
38 | 41 | $this->set_header_secret($this->header_admin_user,$this->header_admin_password); |
39 | 42 | } |
40 | 43 | $secret = $this->_calc_header_secret($GLOBALS['egw_info']['server']['header_admin_user'], |
41 | 44 | $GLOBALS['egw_info']['server']['header_admin_password']); |
42 | - if ($this->uid === true) unset($this->uid); |
|
45 | + if ($this->uid === true) |
|
46 | + { |
|
47 | + unset($this->uid); |
|
48 | + } |
|
43 | 49 | |
44 | 50 | if ($this->header_secret != $secret) |
45 | 51 | { |
@@ -57,10 +63,13 @@ discard block |
||
57 | 63 | */ |
58 | 64 | public function set_header_secret($user,$pw) |
59 | 65 | { |
60 | - if ($this->uid || parent::save(false)) // we need to save first, to get the uid |
|
66 | + if ($this->uid || parent::save(false)) |
|
67 | + { |
|
68 | + // we need to save first, to get the uid |
|
61 | 69 | { |
62 | 70 | $this->header_secret = $this->_calc_header_secret($user,$pw); |
63 | 71 | } |
72 | + } |
|
64 | 73 | else |
65 | 74 | { |
66 | 75 | throw new Exception ('failed to set header_secret!'); |
@@ -78,7 +87,10 @@ discard block |
||
78 | 87 | */ |
79 | 88 | private function _calc_header_secret($header_admin_user=null,$header_admin_password=null) |
80 | 89 | { |
81 | - if (!self::is_md5($header_admin_password)) $header_admin_password = md5($header_admin_password); |
|
90 | + if (!self::is_md5($header_admin_password)) |
|
91 | + { |
|
92 | + $header_admin_password = md5($header_admin_password); |
|
93 | + } |
|
82 | 94 | |
83 | 95 | $secret = md5($this->uid.$header_admin_user.$header_admin_password); |
84 | 96 | //echo "header_secret='$secret' = md5('$this->uid'.'$header_admin_user'.'$header_admin_password')\n"; |
@@ -135,7 +147,10 @@ discard block |
||
135 | 147 | self::$egw_accounts_backup = $GLOBALS['egw']->accounts; |
136 | 148 | unset($GLOBALS['egw']->accounts); |
137 | 149 | } |
138 | - if ($this->config) self::$egw_setup->setup_account_object($this->config); |
|
150 | + if ($this->config) |
|
151 | + { |
|
152 | + self::$egw_setup->setup_account_object($this->config); |
|
153 | + } |
|
139 | 154 | } |
140 | 155 | if (is_object($GLOBALS['egw']->db) && $domain) |
141 | 156 | { |
@@ -184,7 +199,9 @@ discard block |
||
184 | 199 | self::_setup_enviroment($domain); |
185 | 200 | |
186 | 201 | // check the authentication if a header_admin_password is set, if not we dont have a header yet and no authentication |
187 | - if ($GLOBALS['egw_info']['server']['header_admin_password']) // if that's not given we dont have a header yet |
|
202 | + if ($GLOBALS['egw_info']['server']['header_admin_password']) |
|
203 | + { |
|
204 | + // if that's not given we dont have a header yet |
|
188 | 205 | { |
189 | 206 | if (!self::$egw_setup->check_auth($user,$pw,$GLOBALS['egw_info']['server']['header_admin_user'], |
190 | 207 | $GLOBALS['egw_info']['server']['header_admin_password']) && |
@@ -195,6 +212,7 @@ discard block |
||
195 | 212 | if (is_null($domain)) |
196 | 213 | { |
197 | 214 | throw new Api\Exception\NoPermission(lang('Access denied: wrong username or password for manage-header !!!'),21); |
215 | + } |
|
198 | 216 | } |
199 | 217 | else |
200 | 218 | { |
@@ -236,7 +254,10 @@ discard block |
||
236 | 254 | |
237 | 255 | $messages = array(); |
238 | 256 | |
239 | - if ($stop && !is_array($stop)) $stop = array($stop); |
|
257 | + if ($stop && !is_array($stop)) |
|
258 | + { |
|
259 | + $stop = array($stop); |
|
260 | + } |
|
240 | 261 | |
241 | 262 | $versions =& $GLOBALS['egw_info']['server']['versions']; |
242 | 263 | |
@@ -254,7 +275,10 @@ discard block |
||
254 | 275 | $messages[] = self::_echo_message($verbose,lang('EGroupware API version %1 found.',$versions['api'])); |
255 | 276 | } |
256 | 277 | $header_stage = self::$egw_setup->detection->check_header(); |
257 | - if ($stop && in_array($header_stage,$stop)) return true; |
|
278 | + if ($stop && in_array($header_stage,$stop)) |
|
279 | + { |
|
280 | + return true; |
|
281 | + } |
|
258 | 282 | |
259 | 283 | switch ($header_stage) |
260 | 284 | { |
@@ -274,9 +298,12 @@ discard block |
||
274 | 298 | unset($header_checks); // no further output of the header checks |
275 | 299 | |
276 | 300 | $domains = $GLOBALS['egw_domain']; |
277 | - if ($domain) // domain to check given |
|
301 | + if ($domain) |
|
302 | + { |
|
303 | + // domain to check given |
|
278 | 304 | { |
279 | 305 | if (!isset($GLOBALS['egw_domain'][$domain])) throw new Api\Exception\WrongUserinput(lang("Domain '%1' does NOT exist !!!",$domain), 92); |
306 | + } |
|
280 | 307 | |
281 | 308 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
282 | 309 | } |
@@ -324,10 +351,13 @@ discard block |
||
324 | 351 | { |
325 | 352 | self::$apps_to_upgrade[] = $app; |
326 | 353 | } |
327 | - if (!isset($data['enabled']) && isset($data['version'])) // jdots eg. is no app, but a template |
|
354 | + if (!isset($data['enabled']) && isset($data['version'])) |
|
355 | + { |
|
356 | + // jdots eg. is no app, but a template |
|
328 | 357 | { |
329 | 358 | self::$apps_to_install[] = $app; |
330 | 359 | } |
360 | + } |
|
331 | 361 | } |
332 | 362 | if (self::$apps_to_install) |
333 | 363 | { |
@@ -337,7 +367,10 @@ discard block |
||
337 | 367 | if (self::$apps_to_upgrade) |
338 | 368 | { |
339 | 369 | $db_stage = 4; |
340 | - if ($stop && in_array(10+$db_stage,$stop)) return $messages; |
|
370 | + if ($stop && in_array(10+$db_stage,$stop)) |
|
371 | + { |
|
372 | + return $messages; |
|
373 | + } |
|
341 | 374 | |
342 | 375 | throw new Api\Exception\WrongUserinput(lang('The following applications need to be upgraded:').' '.implode(', ',self::$apps_to_upgrade).'! '.lang('Use --update to do so.'),14); |
343 | 376 | } |
@@ -379,7 +412,10 @@ discard block |
||
379 | 412 | */ |
380 | 413 | static function _echo_message($verbose,$msg='') |
381 | 414 | { |
382 | - if ($verbose) echo $msg."\n"; |
|
415 | + if ($verbose) |
|
416 | + { |
|
417 | + echo $msg."\n"; |
|
418 | + } |
|
383 | 419 | |
384 | 420 | return $msg; |
385 | 421 | } |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | * @version $Id$ |
14 | 14 | */ |
15 | 15 | |
16 | -error_reporting(error_reporting() & ~E_NOTICE & ~E_STRICT); |
|
16 | +error_reporting(error_reporting()&~E_NOTICE&~E_STRICT); |
|
17 | 17 | |
18 | 18 | // for an old header, we need to setup the reference before including it |
19 | -$GLOBALS['phpgw_info'] =& $GLOBALS['egw_info']; |
|
19 | +$GLOBALS['phpgw_info'] = & $GLOBALS['egw_info']; |
|
20 | 20 | |
21 | 21 | $GLOBALS['egw_info'] = array( |
22 | 22 | 'flags' => array( |
@@ -25,48 +25,48 @@ discard block |
||
25 | 25 | 'currentapp' => 'setup', |
26 | 26 | 'noapi' => True |
27 | 27 | )); |
28 | -if(file_exists('../header.inc.php')) |
|
28 | +if (file_exists('../header.inc.php')) |
|
29 | 29 | { |
30 | 30 | include('../header.inc.php'); |
31 | 31 | } |
32 | 32 | // for an old header we need to setup a reference for the domains |
33 | -if (!is_array($GLOBALS['egw_domain'])) $GLOBALS['egw_domain'] =& $GLOBALS['phpgw_domain']; |
|
33 | +if (!is_array($GLOBALS['egw_domain'])) $GLOBALS['egw_domain'] = & $GLOBALS['phpgw_domain']; |
|
34 | 34 | |
35 | 35 | /* If we included the header.inc.php, but it is somehow broken, cover ourselves... */ |
36 | -if(!defined('EGW_SERVER_ROOT') && !defined('EGW_INCLUDE_ROOT')) |
|
36 | +if (!defined('EGW_SERVER_ROOT') && !defined('EGW_INCLUDE_ROOT')) |
|
37 | 37 | { |
38 | 38 | if (defined('PHPGW_SERVER_ROOT') && defined('PHPGW_INCLUDE_ROOT')) // pre 1.2 install |
39 | 39 | { |
40 | - define('EGW_SERVER_ROOT',PHPGW_SERVER_ROOT); |
|
41 | - define('EGW_INCLUDE_ROOT',PHPGW_INCLUDE_ROOT); |
|
40 | + define('EGW_SERVER_ROOT', PHPGW_SERVER_ROOT); |
|
41 | + define('EGW_INCLUDE_ROOT', PHPGW_INCLUDE_ROOT); |
|
42 | 42 | } |
43 | 43 | else // no install |
44 | 44 | { |
45 | - define('EGW_SERVER_ROOT',realpath('..')); |
|
46 | - define('EGW_INCLUDE_ROOT',realpath('..')); |
|
47 | - define('PHPGW_SERVER_ROOT',realpath('..')); |
|
48 | - define('PHPGW_INCLUDE_ROOT',realpath('..')); |
|
45 | + define('EGW_SERVER_ROOT', realpath('..')); |
|
46 | + define('EGW_INCLUDE_ROOT', realpath('..')); |
|
47 | + define('PHPGW_SERVER_ROOT', realpath('..')); |
|
48 | + define('PHPGW_INCLUDE_ROOT', realpath('..')); |
|
49 | 49 | } |
50 | - define('EGW_API_INC',EGW_SERVER_ROOT.'/phpgwapi/inc'); |
|
50 | + define('EGW_API_INC', EGW_SERVER_ROOT.'/phpgwapi/inc'); |
|
51 | 51 | } |
52 | 52 | |
53 | -require_once(EGW_INCLUDE_ROOT . '/api/src/loader/common.php'); |
|
53 | +require_once(EGW_INCLUDE_ROOT.'/api/src/loader/common.php'); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * function to handle multilanguage support |
57 | 57 | * |
58 | 58 | */ |
59 | -function lang($key,$vars=null) |
|
59 | +function lang($key, $vars = null) |
|
60 | 60 | { |
61 | - if(!is_array($vars)) |
|
61 | + if (!is_array($vars)) |
|
62 | 62 | { |
63 | 63 | $vars = func_get_args(); |
64 | - array_shift($vars); // remove $key |
|
64 | + array_shift($vars); // remove $key |
|
65 | 65 | } |
66 | 66 | return $GLOBALS['egw_setup']->translation->translate("$key", $vars); |
67 | 67 | } |
68 | 68 | |
69 | -if(file_exists(EGW_SERVER_ROOT.'/api/setup/setup.inc.php')) |
|
69 | +if (file_exists(EGW_SERVER_ROOT.'/api/setup/setup.inc.php')) |
|
70 | 70 | { |
71 | 71 | include(EGW_SERVER_ROOT.'/api/setup/setup.inc.php'); /* To set the current core version */ |
72 | 72 | /* This will change to just use setup_info */ |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | |
80 | 80 | $GLOBALS['egw_info']['server']['app_images'] = 'templates/default/images'; |
81 | 81 | |
82 | -CreateObject('setup.setup',True,True); // setup constuctor assigns itself to $GLOBALS['egw_setup'], doing it twice fails on some php4 |
|
83 | -$GLOBALS['phpgw_setup'] =& $GLOBALS['egw_setup']; |
|
82 | +CreateObject('setup.setup', True, True); // setup constuctor assigns itself to $GLOBALS['egw_setup'], doing it twice fails on some php4 |
|
83 | +$GLOBALS['phpgw_setup'] = & $GLOBALS['egw_setup']; |
|
84 | 84 | |
85 | -if (!function_exists('version_compare') || version_compare(PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,'<')) |
|
85 | +if (!function_exists('version_compare') || version_compare(PHP_VERSION, $GLOBALS['egw_setup']->required_php_version, '<')) |
|
86 | 86 | { |
87 | 87 | if (isset($_SERVER['HTTP_HOST'])) echo "<pre>\n"; |
88 | 88 | echo "EGroupware now requires PHP {$GLOBALS['egw_setup']->required_php_version} or greater.\nYour PHP version is: ".PHP_VERSION."\n"; |
@@ -30,14 +30,20 @@ discard block |
||
30 | 30 | include('../header.inc.php'); |
31 | 31 | } |
32 | 32 | // for an old header we need to setup a reference for the domains |
33 | -if (!is_array($GLOBALS['egw_domain'])) $GLOBALS['egw_domain'] =& $GLOBALS['phpgw_domain']; |
|
33 | +if (!is_array($GLOBALS['egw_domain'])) |
|
34 | +{ |
|
35 | + $GLOBALS['egw_domain'] =& $GLOBALS['phpgw_domain']; |
|
36 | +} |
|
34 | 37 | |
35 | 38 | /* If we included the header.inc.php, but it is somehow broken, cover ourselves... */ |
36 | 39 | if(!defined('EGW_SERVER_ROOT') && !defined('EGW_INCLUDE_ROOT')) |
37 | 40 | { |
38 | - if (defined('PHPGW_SERVER_ROOT') && defined('PHPGW_INCLUDE_ROOT')) // pre 1.2 install |
|
41 | + if (defined('PHPGW_SERVER_ROOT') && defined('PHPGW_INCLUDE_ROOT')) |
|
42 | + { |
|
43 | + // pre 1.2 install |
|
39 | 44 | { |
40 | 45 | define('EGW_SERVER_ROOT',PHPGW_SERVER_ROOT); |
46 | + } |
|
41 | 47 | define('EGW_INCLUDE_ROOT',PHPGW_INCLUDE_ROOT); |
42 | 48 | } |
43 | 49 | else // no install |
@@ -84,7 +90,10 @@ discard block |
||
84 | 90 | |
85 | 91 | if (!function_exists('version_compare') || version_compare(PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,'<')) |
86 | 92 | { |
87 | - if (isset($_SERVER['HTTP_HOST'])) echo "<pre>\n"; |
|
93 | + if (isset($_SERVER['HTTP_HOST'])) |
|
94 | + { |
|
95 | + echo "<pre>\n"; |
|
96 | + } |
|
88 | 97 | echo "EGroupware now requires PHP {$GLOBALS['egw_setup']->required_php_version} or greater.\nYour PHP version is: ".PHP_VERSION."\n"; |
89 | 98 | echo 'Please contact your System Administrator.'; |
90 | 99 | exit; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param array $config =array() configuration to preset the defaults during the install, eg. set the account_repository |
35 | 35 | * @param string $lang ='en' |
36 | 36 | */ |
37 | - function __construct($domain,$config_user=null,$config_passwd=null,$backup=null,$charset='utf-8',$verbose=false,array $config=array(),$lang='en') |
|
37 | + function __construct($domain, $config_user = null, $config_passwd = null, $backup = null, $charset = 'utf-8', $verbose = false, array $config = array(), $lang = 'en') |
|
38 | 38 | { |
39 | 39 | if (!is_array($domain)) |
40 | 40 | { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'lang' => $lang, |
50 | 50 | ); |
51 | 51 | } |
52 | - elseif(!$domain['charset']) |
|
52 | + elseif (!$domain['charset']) |
|
53 | 53 | { |
54 | 54 | $domain['charset'] = 'utf-8'; |
55 | 55 | } |
@@ -65,24 +65,24 @@ discard block |
||
65 | 65 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
66 | 66 | * @throws Exception('header.inc.php not found!'); |
67 | 67 | */ |
68 | - protected function exec($check_only=false) |
|
68 | + protected function exec($check_only = false) |
|
69 | 69 | { |
70 | - unset($check_only); // not used; |
|
70 | + unset($check_only); // not used; |
|
71 | 71 | global $setup_info; |
72 | 72 | |
73 | 73 | // instanciate setup object and check authorisation |
74 | - $this->check_setup_auth($this->config_user,$this->config_passwd,$this->domain); |
|
74 | + $this->check_setup_auth($this->config_user, $this->config_passwd, $this->domain); |
|
75 | 75 | |
76 | - $this->check_installed($this->domain,array(13,14,20),$this->verbose); |
|
76 | + $this->check_installed($this->domain, array(13, 14, 20), $this->verbose); |
|
77 | 77 | |
78 | 78 | // use uploaded backup, instead installing from scratch |
79 | 79 | if ($this->backup) |
80 | 80 | { |
81 | 81 | $db_backup = new db_backup(); |
82 | 82 | |
83 | - if (!is_resource($f = $db_backup->fopen_backup($this->backup,true))) |
|
83 | + if (!is_resource($f = $db_backup->fopen_backup($this->backup, true))) |
|
84 | 84 | { |
85 | - throw new Api\Exception\WrongUserinput(lang('Restore failed').' ('.$f.')',31); |
|
85 | + throw new Api\Exception\WrongUserinput(lang('Restore failed').' ('.$f.')', 31); |
|
86 | 86 | } |
87 | 87 | if ($this->verbose) |
88 | 88 | { |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | } |
91 | 91 | else |
92 | 92 | { |
93 | - ob_start(); // restore echos the table structure |
|
93 | + ob_start(); // restore echos the table structure |
|
94 | 94 | } |
95 | - $db_backup->restore($f,$this->charset,$this->backup); |
|
95 | + $db_backup->restore($f, $this->charset, $this->backup); |
|
96 | 96 | fclose($f); |
97 | 97 | |
98 | 98 | if (!$this->verbose) |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | // regular (new) install |
105 | 105 | if ($GLOBALS['egw_info']['setup']['stage']['db'] != 3) |
106 | 106 | { |
107 | - throw new Api\Exception\WrongUserinput(lang('eGroupWare is already installed!'),30); |
|
107 | + throw new Api\Exception\WrongUserinput(lang('eGroupWare is already installed!'), 30); |
|
108 | 108 | } |
109 | 109 | $setup_info = self::$egw_setup->detection->upgrade_exclude($setup_info); |
110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $_POST['ConfigLang'] = $this->lang; |
115 | 115 | |
116 | 116 | if ($this->verbose) echo lang('Installation started, this might take a few minutes ...')."\n"; |
117 | - if (true) $setup_info = self::$egw_setup->process->pass($setup_info,'new',false,True,$this->config); |
|
117 | + if (true) $setup_info = self::$egw_setup->process->pass($setup_info, 'new', false, True, $this->config); |
|
118 | 118 | |
119 | 119 | $this->restore_db(); |
120 | 120 |
@@ -113,8 +113,14 @@ |
||
113 | 113 | self::$egw_setup->db->Link_ID->SetCharSet($this->charset); |
114 | 114 | $_POST['ConfigLang'] = $this->lang; |
115 | 115 | |
116 | - if ($this->verbose) echo lang('Installation started, this might take a few minutes ...')."\n"; |
|
117 | - if (true) $setup_info = self::$egw_setup->process->pass($setup_info,'new',false,True,$this->config); |
|
116 | + if ($this->verbose) |
|
117 | + { |
|
118 | + echo lang('Installation started, this might take a few minutes ...')."\n"; |
|
119 | + } |
|
120 | + if (true) |
|
121 | + { |
|
122 | + $setup_info = self::$egw_setup->process->pass($setup_info,'new',false,True,$this->config); |
|
123 | + } |
|
118 | 124 | |
119 | 125 | $this->restore_db(); |
120 | 126 |
@@ -28,54 +28,54 @@ discard block |
||
28 | 28 | // variable names with underscores. |
29 | 29 | |
30 | 30 | $GLOBALS['header_template']->set_file(array('header' => 'header.inc.php.template')); |
31 | - $GLOBALS['header_template']->set_block('header','domain','domain'); |
|
31 | + $GLOBALS['header_template']->set_block('header', 'domain', 'domain'); |
|
32 | 32 | $var = Array(); |
33 | 33 | |
34 | 34 | $deletedomain = $_POST['deletedomain']; |
35 | 35 | $domains = $_POST['domains']; |
36 | 36 | |
37 | - foreach($domains as $k => $v) |
|
37 | + foreach ($domains as $k => $v) |
|
38 | 38 | { |
39 | - if(is_array($deletedomain) && isset($deletedomain[$k])) |
|
39 | + if (is_array($deletedomain) && isset($deletedomain[$k])) |
|
40 | 40 | { |
41 | 41 | continue; |
42 | 42 | } |
43 | - $variableName = str_replace('.','_',$k); |
|
43 | + $variableName = str_replace('.', '_', $k); |
|
44 | 44 | $dom = $_POST['setting_'.$variableName]; |
45 | - $GLOBALS['header_template']->set_var('DB_DOMAIN',$v); |
|
46 | - foreach($dom as $x => $y) |
|
45 | + $GLOBALS['header_template']->set_var('DB_DOMAIN', $v); |
|
46 | + foreach ($dom as $x => $y) |
|
47 | 47 | { |
48 | - if(strtoupper($x) == 'CONFIG_PASS') |
|
48 | + if (strtoupper($x) == 'CONFIG_PASS') |
|
49 | 49 | { |
50 | - $GLOBALS['header_template']->set_var(strtoupper($x),md5($y)); |
|
50 | + $GLOBALS['header_template']->set_var(strtoupper($x), md5($y)); |
|
51 | 51 | } |
52 | 52 | else |
53 | 53 | { |
54 | - $GLOBALS['header_template']->set_var(strtoupper($x),$y); |
|
54 | + $GLOBALS['header_template']->set_var(strtoupper($x), $y); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | /* Admin did not type a new password, so use the old one from the hidden field, |
58 | 58 | * which is already md5 encoded. |
59 | 59 | */ |
60 | - if($dom['config_password'] && !$dom['config_pass']) |
|
60 | + if ($dom['config_password'] && !$dom['config_pass']) |
|
61 | 61 | { |
62 | 62 | /* Real == hidden */ |
63 | - $GLOBALS['header_template']->set_var('CONFIG_PASS',$dom['config_password']); |
|
63 | + $GLOBALS['header_template']->set_var('CONFIG_PASS', $dom['config_password']); |
|
64 | 64 | } |
65 | 65 | /* If the admin didn't select a db_port, set to the default */ |
66 | - if(!$dom['db_port']) |
|
66 | + if (!$dom['db_port']) |
|
67 | 67 | { |
68 | - $GLOBALS['header_template']->set_var('DB_PORT',$GLOBALS['default_db_ports'][$dom['db_type']]); |
|
68 | + $GLOBALS['header_template']->set_var('DB_PORT', $GLOBALS['default_db_ports'][$dom['db_type']]); |
|
69 | 69 | } |
70 | - $GLOBALS['header_template']->parse('domains','domain',True); |
|
70 | + $GLOBALS['header_template']->parse('domains', 'domain', True); |
|
71 | 71 | } |
72 | 72 | |
73 | - $GLOBALS['header_template']->set_var('domain',''); |
|
73 | + $GLOBALS['header_template']->set_var('domain', ''); |
|
74 | 74 | |
75 | 75 | $setting = $_POST['setting']; |
76 | - while($setting && list($k,$v) = @each($setting)) |
|
76 | + while ($setting && list($k, $v) = @each($setting)) |
|
77 | 77 | { |
78 | - if(strtoupper($k) == 'HEADER_ADMIN_PASSWORD') |
|
78 | + if (strtoupper($k) == 'HEADER_ADMIN_PASSWORD') |
|
79 | 79 | { |
80 | 80 | $var[strtoupper($k)] = md5($v); |
81 | 81 | } |
@@ -87,21 +87,21 @@ discard block |
||
87 | 87 | /* Admin did not type a new header password, so use the old one from the hidden field, |
88 | 88 | * which is already md5 encoded. |
89 | 89 | */ |
90 | - if($var['HEADER_ADMIN_PASS'] && empty($setting['HEADER_ADMIN_PASSWORD'])) |
|
90 | + if ($var['HEADER_ADMIN_PASS'] && empty($setting['HEADER_ADMIN_PASSWORD'])) |
|
91 | 91 | { |
92 | 92 | /* Real == hidden */ |
93 | 93 | $var['HEADER_ADMIN_PASSWORD'] = $var['HEADER_ADMIN_PASS']; |
94 | 94 | } |
95 | 95 | $GLOBALS['header_template']->set_var($var); |
96 | - return $GLOBALS['header_template']->parse('out','header'); |
|
96 | + return $GLOBALS['header_template']->parse('out', 'header'); |
|
97 | 97 | } |
98 | 98 | |
99 | - static function setup_tpl_dir($app_name='setup') |
|
99 | + static function setup_tpl_dir($app_name = 'setup') |
|
100 | 100 | { |
101 | 101 | /* hack to get tpl dir */ |
102 | 102 | if (is_dir(EGW_SERVER_ROOT)) |
103 | 103 | { |
104 | - $srv_root = EGW_SERVER_ROOT . '/' . $app_name . '/'; |
|
104 | + $srv_root = EGW_SERVER_ROOT.'/'.$app_name.'/'; |
|
105 | 105 | } |
106 | 106 | else |
107 | 107 | { |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | $tpl_typical = 'templates/default'; |
112 | - $tpl_root = "$srv_root" ."$tpl_typical"; |
|
112 | + $tpl_root = "$srv_root"."$tpl_typical"; |
|
113 | 113 | return $tpl_root; |
114 | 114 | } |
115 | 115 | |
116 | - static function show_header($title='',$nologoutbutton=False, $logoutfrom='config', $configdomain='') |
|
116 | + static function show_header($title = '', $nologoutbutton = False, $logoutfrom = 'config', $configdomain = '') |
|
117 | 117 | { |
118 | 118 | // add a content-type header to overwrite an existing default charset in apache (AddDefaultCharset directiv) |
119 | 119 | header('Content-type: text/html; charset='.$GLOBALS['egw_setup']->system_charset); |
120 | 120 | |
121 | - $GLOBALS['setup_tpl']->set_var('charset',$GLOBALS['egw_setup']->system_charset); |
|
121 | + $GLOBALS['setup_tpl']->set_var('charset', $GLOBALS['egw_setup']->system_charset); |
|
122 | 122 | $style = array( |
123 | 123 | 'th_bg' => '#486591', |
124 | 124 | 'th_text' => '#FFFFFF', |
@@ -130,34 +130,34 @@ discard block |
||
130 | 130 | $GLOBALS['setup_tpl']->set_var($style); |
131 | 131 | if ($nologoutbutton) |
132 | 132 | { |
133 | - $GLOBALS['setup_tpl']->set_block('T_head','loged_in'); |
|
134 | - $GLOBALS['setup_tpl']->set_var('loged_in',''); |
|
133 | + $GLOBALS['setup_tpl']->set_block('T_head', 'loged_in'); |
|
134 | + $GLOBALS['setup_tpl']->set_var('loged_in', ''); |
|
135 | 135 | } |
136 | 136 | else |
137 | 137 | { |
138 | - $btn_logout = '<a href="index.php?FormLogout=' . $logoutfrom . '" class="link">' . lang('Logout').'</a>'; |
|
138 | + $btn_logout = '<a href="index.php?FormLogout='.$logoutfrom.'" class="link">'.lang('Logout').'</a>'; |
|
139 | 139 | $check_install = '<a class="textsidebox" href="check_install.php">'.lang('Check installation').'</a>'; |
140 | 140 | $register_hooks = '<a class="textsidebox" href="applications.php?hooks=1">'.lang('Clear cache and register hooks').'</a>'; |
141 | 141 | } |
142 | 142 | |
143 | 143 | $GLOBALS['setup_tpl']->set_var('lang_setup', lang('setup')); |
144 | - $GLOBALS['setup_tpl']->set_var('page_title',$title); |
|
144 | + $GLOBALS['setup_tpl']->set_var('page_title', $title); |
|
145 | 145 | if ($configdomain == '') |
146 | 146 | { |
147 | - $GLOBALS['setup_tpl']->set_var('configdomain',''); |
|
147 | + $GLOBALS['setup_tpl']->set_var('configdomain', ''); |
|
148 | 148 | } |
149 | 149 | else |
150 | 150 | { |
151 | - $GLOBALS['setup_tpl']->set_var('configdomain',' - ' . lang('Domain') . ': ' . $configdomain); |
|
151 | + $GLOBALS['setup_tpl']->set_var('configdomain', ' - '.lang('Domain').': '.$configdomain); |
|
152 | 152 | } |
153 | 153 | |
154 | - if(basename($_SERVER['SCRIPT_FILENAME']) != 'index.php') |
|
154 | + if (basename($_SERVER['SCRIPT_FILENAME']) != 'index.php') |
|
155 | 155 | { |
156 | - $index_btn = '<a href="index.php" class="link">' . lang('Setup Main Menu') . '</a>'; |
|
156 | + $index_btn = '<a href="index.php" class="link">'.lang('Setup Main Menu').'</a>'; |
|
157 | 157 | $index_img = '<img src="../api/templates/default/images/bullet.png" />'; |
158 | 158 | } |
159 | 159 | |
160 | - $GLOBALS['setup_tpl']->set_var('lang_version',lang('version')); |
|
160 | + $GLOBALS['setup_tpl']->set_var('lang_version', lang('version')); |
|
161 | 161 | if (!isset($GLOBALS['setup_info']) || !isset($GLOBALS['setup_info']['api'])) |
162 | 162 | { |
163 | 163 | include(EGW_SERVER_ROOT.'/api/setup/setup.inc.php'); |
@@ -179,66 +179,66 @@ discard block |
||
179 | 179 | |
180 | 180 | // manual / help link to the install manual on egroupware.org |
181 | 181 | $manual_remote_egw_url = 'http://manual.egroupware.org/egroupware'; |
182 | - $url_parts = explode('/',$_SERVER['PHP_SELF']); |
|
182 | + $url_parts = explode('/', $_SERVER['PHP_SELF']); |
|
183 | 183 | $script = array_pop($url_parts); |
184 | 184 | $lang = setup::get_lang(); |
185 | 185 | $url = $manual_remote_egw_url.'/manual/index.php?referer='.urlencode($manual_remote_egw_url.'/setup/'.$script). |
186 | 186 | ($lang ? '&lang='.urlencode($lang) : ''); |
187 | - $GLOBALS['setup_tpl']->set_var('manual','<a href="'.$url.'" target="manual" onclick="'. |
|
187 | + $GLOBALS['setup_tpl']->set_var('manual', '<a href="'.$url.'" target="manual" onclick="'. |
|
188 | 188 | "window.open('$url','manual','width=800,height=600,scrollbars=yes,resizable=yes'); return false;".'">'. |
189 | 189 | htmlspecialchars(lang('Manual / help')).'</a>'); |
190 | 190 | |
191 | - $GLOBALS['setup_tpl']->pparse('out','T_head'); |
|
191 | + $GLOBALS['setup_tpl']->pparse('out', 'T_head'); |
|
192 | 192 | /* $setup_tpl->set_var('T_head',''); */ |
193 | 193 | } |
194 | 194 | |
195 | 195 | static function show_footer() |
196 | 196 | { |
197 | - $GLOBALS['setup_tpl']->pparse('out','T_footer'); |
|
197 | + $GLOBALS['setup_tpl']->pparse('out', 'T_footer'); |
|
198 | 198 | unset($GLOBALS['setup_tpl']); |
199 | 199 | } |
200 | 200 | |
201 | - static function show_alert_msg($alert_word='Setup alert',$alert_msg='setup alert (generic)') |
|
201 | + static function show_alert_msg($alert_word = 'Setup alert', $alert_msg = 'setup alert (generic)') |
|
202 | 202 | { |
203 | - $GLOBALS['setup_tpl']->set_var('V_alert_word',$alert_word); |
|
204 | - $GLOBALS['setup_tpl']->set_var('V_alert_msg',$alert_msg); |
|
205 | - $GLOBALS['setup_tpl']->pparse('out','T_alert_msg'); |
|
203 | + $GLOBALS['setup_tpl']->set_var('V_alert_word', $alert_word); |
|
204 | + $GLOBALS['setup_tpl']->set_var('V_alert_msg', $alert_msg); |
|
205 | + $GLOBALS['setup_tpl']->pparse('out', 'T_alert_msg'); |
|
206 | 206 | } |
207 | 207 | |
208 | - static function make_frm_btn_simple($pre_frm_blurb='',$frm_method='post',$frm_action='',$input_type='submit',$input_value='',$post_frm_blurb='') |
|
208 | + static function make_frm_btn_simple($pre_frm_blurb = '', $frm_method = 'post', $frm_action = '', $input_type = 'submit', $input_value = '', $post_frm_blurb = '') |
|
209 | 209 | { |
210 | 210 | /* a simple form has simple components */ |
211 | - $simple_form = $pre_frm_blurb ."\n" |
|
212 | - . '<form method="' . $frm_method . '" action="' . $frm_action . '">' . "\n" |
|
213 | - . '<input type="' . $input_type . '" value="' . $input_value . '" />' . "\n" |
|
214 | - . '</form>' . "\n" |
|
215 | - . $post_frm_blurb . "\n"; |
|
211 | + $simple_form = $pre_frm_blurb."\n" |
|
212 | + . '<form method="'.$frm_method.'" action="'.$frm_action.'">'."\n" |
|
213 | + . '<input type="'.$input_type.'" value="'.$input_value.'" />'."\n" |
|
214 | + . '</form>'."\n" |
|
215 | + . $post_frm_blurb."\n"; |
|
216 | 216 | return $simple_form; |
217 | 217 | } |
218 | 218 | |
219 | - static function make_href_link_simple($pre_link_blurb='',$href_link='',$href_text='default text',$post_link_blurb='') |
|
219 | + static function make_href_link_simple($pre_link_blurb = '', $href_link = '', $href_text = 'default text', $post_link_blurb = '') |
|
220 | 220 | { |
221 | 221 | /* a simple href link has simple components */ |
222 | 222 | $simple_link = $pre_link_blurb |
223 | - . '<a href="' . $href_link . '">' . $href_text . '</a> ' |
|
224 | - . $post_link_blurb . "\n"; |
|
223 | + . '<a href="'.$href_link.'">'.$href_text.'</a> ' |
|
224 | + . $post_link_blurb."\n"; |
|
225 | 225 | return $simple_link; |
226 | 226 | } |
227 | 227 | |
228 | 228 | static function login_form() |
229 | 229 | { |
230 | 230 | /* begin use TEMPLATE login_main.tpl */ |
231 | - $GLOBALS['setup_tpl']->set_var('ConfigLoginMSG',@$GLOBALS['egw_info']['setup']['ConfigLoginMSG']); |
|
232 | - $GLOBALS['setup_tpl']->set_var('HeaderLoginMSG',@$GLOBALS['egw_info']['setup']['HeaderLoginMSG']); |
|
233 | - $GLOBALS['setup_tpl']->set_var('lang_header_username',lang('Header Username')); |
|
234 | - $GLOBALS['setup_tpl']->set_var('lang_header_password',lang('Header Password')); |
|
235 | - $GLOBALS['setup_tpl']->set_var('lang_header_login',lang('Header Admin Login')); |
|
236 | - $GLOBALS['setup_tpl']->set_var('lang_config_login',lang('Setup/Config Admin Login')); |
|
237 | - $GLOBALS['setup_tpl']->set_var('lang_config_username',lang('Config Username')); |
|
238 | - $GLOBALS['setup_tpl']->set_var('lang_config_password',lang('Config Password')); |
|
239 | - $GLOBALS['setup_tpl']->set_var('lang_domain',lang('Domain')); |
|
231 | + $GLOBALS['setup_tpl']->set_var('ConfigLoginMSG', @$GLOBALS['egw_info']['setup']['ConfigLoginMSG']); |
|
232 | + $GLOBALS['setup_tpl']->set_var('HeaderLoginMSG', @$GLOBALS['egw_info']['setup']['HeaderLoginMSG']); |
|
233 | + $GLOBALS['setup_tpl']->set_var('lang_header_username', lang('Header Username')); |
|
234 | + $GLOBALS['setup_tpl']->set_var('lang_header_password', lang('Header Password')); |
|
235 | + $GLOBALS['setup_tpl']->set_var('lang_header_login', lang('Header Admin Login')); |
|
236 | + $GLOBALS['setup_tpl']->set_var('lang_config_login', lang('Setup/Config Admin Login')); |
|
237 | + $GLOBALS['setup_tpl']->set_var('lang_config_username', lang('Config Username')); |
|
238 | + $GLOBALS['setup_tpl']->set_var('lang_config_password', lang('Config Password')); |
|
239 | + $GLOBALS['setup_tpl']->set_var('lang_domain', lang('Domain')); |
|
240 | 240 | |
241 | - $GLOBALS['setup_tpl']->set_var('lang_select',self::lang_select()); |
|
241 | + $GLOBALS['setup_tpl']->set_var('lang_select', self::lang_select()); |
|
242 | 242 | |
243 | 243 | if ($GLOBALS['egw_info']['setup']['stage']['header'] == '10') |
244 | 244 | { |
@@ -248,54 +248,54 @@ discard block |
||
248 | 248 | */ |
249 | 249 | if (count($GLOBALS['egw_domain']) > 1) |
250 | 250 | { |
251 | - foreach(array_keys($GLOBALS['egw_domain']) as $domain) |
|
251 | + foreach (array_keys($GLOBALS['egw_domain']) as $domain) |
|
252 | 252 | { |
253 | 253 | $domains .= "<option value=\"$domain\" ".($domain == @$GLOBALS['egw_info']['setup']['LastDomain'] ? ' selected="selected"' : '').">$domain</option>\n"; |
254 | 254 | } |
255 | - $GLOBALS['setup_tpl']->set_var('domains',$domains); |
|
255 | + $GLOBALS['setup_tpl']->set_var('domains', $domains); |
|
256 | 256 | |
257 | 257 | // use BLOCK B_multi_domain inside of login_stage_header |
258 | - $GLOBALS['setup_tpl']->parse('V_multi_domain','B_multi_domain'); |
|
258 | + $GLOBALS['setup_tpl']->parse('V_multi_domain', 'B_multi_domain'); |
|
259 | 259 | // in this case, the single domain block needs to be nothing |
260 | - $GLOBALS['setup_tpl']->set_var('V_single_domain',''); |
|
260 | + $GLOBALS['setup_tpl']->set_var('V_single_domain', ''); |
|
261 | 261 | } |
262 | 262 | else |
263 | 263 | { |
264 | 264 | reset($GLOBALS['egw_domain']); |
265 | 265 | $default_domain = each($GLOBALS['egw_domain']); |
266 | - $GLOBALS['setup_tpl']->set_var('default_domain_zero',$default_domain[0]); |
|
266 | + $GLOBALS['setup_tpl']->set_var('default_domain_zero', $default_domain[0]); |
|
267 | 267 | |
268 | 268 | /* Use BLOCK B_single_domain inside of login_stage_header */ |
269 | - $GLOBALS['setup_tpl']->parse('V_single_domain','B_single_domain'); |
|
269 | + $GLOBALS['setup_tpl']->parse('V_single_domain', 'B_single_domain'); |
|
270 | 270 | /* in this case, the multi domain block needs to be nothing */ |
271 | - $GLOBALS['setup_tpl']->set_var('V_multi_domain',''); |
|
271 | + $GLOBALS['setup_tpl']->set_var('V_multi_domain', ''); |
|
272 | 272 | } |
273 | 273 | /* |
274 | 274 | End use SUB-TEMPLATE login_stage_header |
275 | 275 | put all this into V_login_stage_header for use inside login_main |
276 | 276 | */ |
277 | - $GLOBALS['setup_tpl']->parse('V_login_stage_header','T_login_stage_header'); |
|
277 | + $GLOBALS['setup_tpl']->parse('V_login_stage_header', 'T_login_stage_header'); |
|
278 | 278 | } |
279 | 279 | else |
280 | 280 | { |
281 | 281 | /* begin SKIP SUB-TEMPLATE login_stage_header */ |
282 | - $GLOBALS['setup_tpl']->set_var('V_multi_domain',''); |
|
283 | - $GLOBALS['setup_tpl']->set_var('V_single_domain',''); |
|
284 | - $GLOBALS['setup_tpl']->set_var('V_login_stage_header',''); |
|
282 | + $GLOBALS['setup_tpl']->set_var('V_multi_domain', ''); |
|
283 | + $GLOBALS['setup_tpl']->set_var('V_single_domain', ''); |
|
284 | + $GLOBALS['setup_tpl']->set_var('V_login_stage_header', ''); |
|
285 | 285 | } |
286 | 286 | /* |
287 | 287 | end use TEMPLATE login_main.tpl |
288 | 288 | now out the login_main template |
289 | 289 | */ |
290 | - $GLOBALS['setup_tpl']->pparse('out','T_login_main'); |
|
290 | + $GLOBALS['setup_tpl']->pparse('out', 'T_login_main'); |
|
291 | 291 | } |
292 | 292 | |
293 | - static function lang_select($onChange=False,$ConfigLang='') |
|
293 | + static function lang_select($onChange = False, $ConfigLang = '') |
|
294 | 294 | { |
295 | 295 | if (empty($ConfigLang)) |
296 | 296 | { |
297 | 297 | $ConfigLang = setup::get_lang(); |
298 | - if (empty($ConfigLang)) $ConfigLang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2); |
|
298 | + if (empty($ConfigLang)) $ConfigLang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); |
|
299 | 299 | } |
300 | 300 | return Api\Html::select('ConfigLang', $ConfigLang, Api\Translation::get_available_langs(false), true, |
301 | 301 | $onChange ? ' onchange="this.form.submit();"' : ''); |
@@ -303,19 +303,19 @@ discard block |
||
303 | 303 | |
304 | 304 | static function get_template_list() |
305 | 305 | { |
306 | - $d = dir(EGW_SERVER_ROOT . '/phpgwapi/templates'); |
|
306 | + $d = dir(EGW_SERVER_ROOT.'/phpgwapi/templates'); |
|
307 | 307 | |
308 | 308 | $list = array(); |
309 | - while($entry = $d->read()) |
|
309 | + while ($entry = $d->read()) |
|
310 | 310 | { |
311 | 311 | if ($entry != 'CVS' && $entry != '.' && $entry != '..') |
312 | 312 | { |
313 | 313 | $list[$entry]['name'] = $entry; |
314 | - $f = EGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry . '/details.inc.php'; |
|
315 | - if (file_exists ($f)) |
|
314 | + $f = EGW_SERVER_ROOT.'/phpgwapi/templates/'.$entry.'/details.inc.php'; |
|
315 | + if (file_exists($f)) |
|
316 | 316 | { |
317 | 317 | include($f); |
318 | - $list[$entry]['title'] = 'Use ' . $GLOBALS['egw_info']['template'][$entry]['title'] . 'interface'; |
|
318 | + $list[$entry]['title'] = 'Use '.$GLOBALS['egw_info']['template'][$entry]['title'].'interface'; |
|
319 | 319 | } |
320 | 320 | else |
321 | 321 | { |
@@ -324,22 +324,22 @@ discard block |
||
324 | 324 | } |
325 | 325 | } |
326 | 326 | $d->close(); |
327 | - reset ($list); |
|
327 | + reset($list); |
|
328 | 328 | return $list; |
329 | 329 | } |
330 | 330 | |
331 | 331 | static function list_themes() |
332 | 332 | { |
333 | - $dh = dir(EGW_SERVER_ROOT . '/phpgwapi/themes'); |
|
333 | + $dh = dir(EGW_SERVER_ROOT.'/phpgwapi/themes'); |
|
334 | 334 | while ($file = $dh->read()) |
335 | 335 | { |
336 | 336 | if (preg_match('/'."\.theme$".'/i', $file)) |
337 | 337 | { |
338 | - $list[] = substr($file,0,strpos($file,'.')); |
|
338 | + $list[] = substr($file, 0, strpos($file, '.')); |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | $dh->close(); |
342 | - reset ($list); |
|
342 | + reset($list); |
|
343 | 343 | return $list; |
344 | 344 | } |
345 | 345 | } |
@@ -295,7 +295,10 @@ |
||
295 | 295 | if (empty($ConfigLang)) |
296 | 296 | { |
297 | 297 | $ConfigLang = setup::get_lang(); |
298 | - if (empty($ConfigLang)) $ConfigLang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2); |
|
298 | + if (empty($ConfigLang)) |
|
299 | + { |
|
300 | + $ConfigLang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2); |
|
301 | + } |
|
299 | 302 | } |
300 | 303 | return Api\Html::select('ConfigLang', $ConfigLang, Api\Translation::get_available_langs(false), true, |
301 | 304 | $onChange ? ' onchange="this.form.submit();"' : ''); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | $GLOBALS['header_template']->set_file(array('header' => 'header.inc.php.template')); |
31 | 31 | $GLOBALS['header_template']->set_block('header','domain','domain'); |
32 | - $var = Array(); |
|
32 | + $var = array(); |
|
33 | 33 | |
34 | 34 | $deletedomain = $_POST['deletedomain']; |
35 | 35 | $domains = $_POST['domains']; |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | if ($_POST['download']) |
42 | 42 | { |
43 | 43 | list($file) = each($_POST['download']); |
44 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir |
|
44 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir |
|
45 | 45 | while (@ob_end_clean()) {} // end all active output buffering |
46 | - ini_set('zlib.output_compression',0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit |
|
46 | + ini_set('zlib.output_compression', 0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit |
|
47 | 47 | Api\Header\Content::type(basename($file)); |
48 | 48 | readfile($file); |
49 | 49 | exit; |
@@ -61,23 +61,23 @@ discard block |
||
61 | 61 | { |
62 | 62 | Api\Csrf::validate($_POST['csrf_token'], __FILE__); |
63 | 63 | } |
64 | -$setup_tpl->set_block('T_db_backup','schedule_row','schedule_rows'); |
|
65 | -$setup_tpl->set_block('T_db_backup','set_row','set_rows'); |
|
64 | +$setup_tpl->set_block('T_db_backup', 'schedule_row', 'schedule_rows'); |
|
65 | +$setup_tpl->set_block('T_db_backup', 'set_row', 'set_rows'); |
|
66 | 66 | |
67 | -$setup_tpl->set_var('stage_title',$stage_title = lang('DB backup and restore')); |
|
68 | -$setup_tpl->set_var('stage_desc',lang('This program lets you backup your database, schedule a backup or restore it.')); |
|
69 | -$setup_tpl->set_var('error_msg',''); |
|
67 | +$setup_tpl->set_var('stage_title', $stage_title = lang('DB backup and restore')); |
|
68 | +$setup_tpl->set_var('stage_desc', lang('This program lets you backup your database, schedule a backup or restore it.')); |
|
69 | +$setup_tpl->set_var('error_msg', ''); |
|
70 | 70 | |
71 | -$bgcolor = array('#DDDDDD','#EEEEEE'); |
|
71 | +$bgcolor = array('#DDDDDD', '#EEEEEE'); |
|
72 | 72 | |
73 | 73 | if (is_object($GLOBALS['egw_setup']->html)) |
74 | 74 | { |
75 | - $GLOBALS['egw_setup']->html->show_header($stage_title,False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
75 | + $GLOBALS['egw_setup']->html->show_header($stage_title, False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
76 | 76 | } |
77 | 77 | else |
78 | 78 | { |
79 | - $setup_tpl->set_block('T_db_backup','setup_header'); |
|
80 | - $setup_tpl->set_var('setup_header',''); |
|
79 | + $setup_tpl->set_block('T_db_backup', 'setup_header'); |
|
80 | + $setup_tpl->set_var('setup_header', ''); |
|
81 | 81 | $GLOBALS['egw_info']['flags']['app_header'] = $stage_title; |
82 | 82 | echo $GLOBALS['egw']->framework->header(); |
83 | 83 | echo $GLOBALS['egw']->framework->navbar(); |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | if (empty($minCount)) |
94 | 94 | { |
95 | 95 | $minCount = 0; |
96 | - $setup_tpl->set_var('error_msg',htmlspecialchars(lang("'%1' must be integer", lang("backup min count")))); |
|
96 | + $setup_tpl->set_var('error_msg', htmlspecialchars(lang("'%1' must be integer", lang("backup min count")))); |
|
97 | 97 | } |
98 | - $db_backup->saveConfig($minCount,$is_setup ? (boolean)$filesBackup : null); |
|
98 | + $db_backup->saveConfig($minCount, $is_setup ? (boolean)$filesBackup : null); |
|
99 | 99 | |
100 | 100 | if (is_int($minCount) && $minCount > 0) |
101 | 101 | { |
@@ -112,22 +112,21 @@ discard block |
||
112 | 112 | { |
113 | 113 | Vfs::$is_root = true; |
114 | 114 | echo '<div align="center">'. |
115 | - (Vfs::mount('filesystem://default'.$db_backup->backup_dir.'?group=Admins&mode=070','/backup',false) ? |
|
116 | - lang('Backup directory %1 mounted as %2',$db_backup->backup_dir,'/backup') : |
|
117 | - lang('Failed to mount Backup directory!')). |
|
115 | + (Vfs::mount('filesystem://default'.$db_backup->backup_dir.'?group=Admins&mode=070', '/backup', false) ? |
|
116 | + lang('Backup directory %1 mounted as %2', $db_backup->backup_dir, '/backup') : lang('Failed to mount Backup directory!')). |
|
118 | 117 | "</div>\n"; |
119 | 118 | Vfs::$is_root = false; |
120 | 119 | } |
121 | 120 | // create a backup now |
122 | -if($_POST['backup']) |
|
121 | +if ($_POST['backup']) |
|
123 | 122 | { |
124 | 123 | if (is_resource($f = $db_backup->fopen_backup())) |
125 | 124 | { |
126 | - echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
|
125 | + echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ', 4096); |
|
127 | 126 | $db_backup->backup($f); |
128 | - if(is_resource($f)) |
|
127 | + if (is_resource($f)) |
|
129 | 128 | fclose($f); |
130 | - $setup_tpl->set_var('error_msg',lang('backup finished')); |
|
129 | + $setup_tpl->set_var('error_msg', lang('backup finished')); |
|
131 | 130 | |
132 | 131 | /* Remove old backups. */ |
133 | 132 | $cleaned_files = array(); |
@@ -139,38 +138,38 @@ discard block |
||
139 | 138 | } |
140 | 139 | else |
141 | 140 | { |
142 | - $setup_tpl->set_var('error_msg',$f); |
|
141 | + $setup_tpl->set_var('error_msg', $f); |
|
143 | 142 | } |
144 | 143 | } |
145 | -$setup_tpl->set_var('backup_now_button','<input type="submit" name="backup" title="'.htmlspecialchars(lang("back's up your DB now, this might take a few minutes")).'" value="'.htmlspecialchars(lang('backup now')).'" />'); |
|
146 | -$setup_tpl->set_var('upload','<input type="file" name="uploaded" /> '. |
|
144 | +$setup_tpl->set_var('backup_now_button', '<input type="submit" name="backup" title="'.htmlspecialchars(lang("back's up your DB now, this might take a few minutes")).'" value="'.htmlspecialchars(lang('backup now')).'" />'); |
|
145 | +$setup_tpl->set_var('upload', '<input type="file" name="uploaded" /> '. |
|
147 | 146 | '<input type="submit" name="upload" value="'.htmlspecialchars(lang('upload backup')).'" title="'.htmlspecialchars(lang("uploads a backup to the backup-dir, from where you can restore it")).'" />'); |
148 | -$setup_tpl->set_var('backup_mincount','<input type="text" name="backup_mincount" value="'.$db_backup->backup_mincount.'" size="3" maxlength="3"/>'); |
|
149 | -$setup_tpl->set_var('backup_files','<input type="checkbox" name="backup_files" value="backup_files"'. |
|
150 | - ($db_backup->backup_files ? ' checked="true"':''). |
|
147 | +$setup_tpl->set_var('backup_mincount', '<input type="text" name="backup_mincount" value="'.$db_backup->backup_mincount.'" size="3" maxlength="3"/>'); |
|
148 | +$setup_tpl->set_var('backup_files', '<input type="checkbox" name="backup_files" value="backup_files"'. |
|
149 | + ($db_backup->backup_files ? ' checked="true"' : ''). |
|
151 | 150 | // do NOT allow to change "backup files" outside of setup |
152 | 151 | ($is_setup ? '' : ' disabled="true" title="'.htmlspecialchars(lang('Can only be change via Setup!')).'"').'/>'); |
153 | -$setup_tpl->set_var('backup_save_settings','<input type="submit" name="save_backup_settings" value="'.htmlspecialchars(lang('save')).'" />'); |
|
154 | -$setup_tpl->set_var('backup_mount','<input type="submit" name="mount" value="'.htmlspecialchars(lang('Mount backup directory to %1','/backup')).'" />'); |
|
152 | +$setup_tpl->set_var('backup_save_settings', '<input type="submit" name="save_backup_settings" value="'.htmlspecialchars(lang('save')).'" />'); |
|
153 | +$setup_tpl->set_var('backup_mount', '<input type="submit" name="mount" value="'.htmlspecialchars(lang('Mount backup directory to %1', '/backup')).'" />'); |
|
155 | 154 | |
156 | 155 | if ($_POST['upload'] && is_array($_FILES['uploaded']) && !$_FILES['uploaded']['error'] && |
157 | 156 | is_uploaded_file($_FILES['uploaded']['tmp_name'])) |
158 | 157 | { |
159 | - move_uploaded_file($_FILES['uploaded']['tmp_name'],$db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
|
158 | + move_uploaded_file($_FILES['uploaded']['tmp_name'], $db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
|
160 | 159 | |
161 | 160 | $md5 = ', md5='.md5_file($db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
162 | 161 | $md5 .= ', sha1='.sha1_file($db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
163 | 162 | |
164 | - $setup_tpl->set_var('error_msg',lang("succesfully uploaded file %1",$_FILES['uploaded']['name'].', '. |
|
165 | - sprintf('%3.1lf MB (%d)',$_FILES['uploaded']['size']/(1024*1024),$_FILES['uploaded']['size']).$md5)); |
|
163 | + $setup_tpl->set_var('error_msg', lang("succesfully uploaded file %1", $_FILES['uploaded']['name'].', '. |
|
164 | + sprintf('%3.1lf MB (%d)', $_FILES['uploaded']['size'] / (1024 * 1024), $_FILES['uploaded']['size']).$md5)); |
|
166 | 165 | } |
167 | 166 | // delete a backup |
168 | 167 | if ($_POST['delete']) |
169 | 168 | { |
170 | 169 | list($file) = each($_POST['delete']); |
171 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
170 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
172 | 171 | |
173 | - if (unlink($file)) $setup_tpl->set_var('error_msg',lang("backup '%1' deleted",$file)); |
|
172 | + if (unlink($file)) $setup_tpl->set_var('error_msg', lang("backup '%1' deleted", $file)); |
|
174 | 173 | } |
175 | 174 | // rename a backup |
176 | 175 | if ($_POST['rename']) |
@@ -181,44 +180,44 @@ discard block |
||
181 | 180 | { |
182 | 181 | list($ending) = array_reverse(explode('.', $file)); |
183 | 182 | list($new_ending, $has_ending) = array_reverse(explode('.', $new_name)); |
184 | - if(!$has_ending || $new_ending != $ending) $new_name .= '.'.$ending; |
|
185 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
186 | - $ext = preg_match('/(\.gz|\.bz2)+$/i',$file,$matches) ? $matches[1] : ''; |
|
187 | - $new_file = $db_backup->backup_dir.'/'.preg_replace('/(\.gz|\.bz2)+$/i','',basename($new_name)).$ext; |
|
188 | - if (rename($file,$new_file)) $setup_tpl->set_var('error_msg',lang("backup '%1' renamed to '%2'",basename($file),basename($new_file))); |
|
183 | + if (!$has_ending || $new_ending != $ending) $new_name .= '.'.$ending; |
|
184 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
185 | + $ext = preg_match('/(\.gz|\.bz2)+$/i', $file, $matches) ? $matches[1] : ''; |
|
186 | + $new_file = $db_backup->backup_dir.'/'.preg_replace('/(\.gz|\.bz2)+$/i', '', basename($new_name)).$ext; |
|
187 | + if (rename($file, $new_file)) $setup_tpl->set_var('error_msg', lang("backup '%1' renamed to '%2'", basename($file), basename($new_file))); |
|
189 | 188 | } |
190 | 189 | } |
191 | 190 | // restore a backup |
192 | 191 | if ($_POST['restore']) |
193 | 192 | { |
194 | 193 | list($file) = each($_POST['restore']); |
195 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
194 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
196 | 195 | |
197 | - if (is_resource($f = $db_backup->fopen_backup($file,true))) |
|
196 | + if (is_resource($f = $db_backup->fopen_backup($file, true))) |
|
198 | 197 | { |
199 | - echo '<p align="center">'.lang('restore started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
|
198 | + echo '<p align="center">'.lang('restore started, this might take a few minutes ...')."</p>\n".str_repeat(' ', 4096); |
|
200 | 199 | $start = time(); |
201 | - $db_backup->restore($f, true, $file); // allways convert to current system charset on restore |
|
202 | - $setup_tpl->set_var('error_msg',lang("backup '%1' restored",$file).' ('.(time()-$start).' s)'); |
|
200 | + $db_backup->restore($f, true, $file); // allways convert to current system charset on restore |
|
201 | + $setup_tpl->set_var('error_msg', lang("backup '%1' restored", $file).' ('.(time() - $start).' s)'); |
|
203 | 202 | if ($run_in_egw) |
204 | 203 | { |
205 | 204 | // updating the backup |
206 | 205 | $cmd = new setup_cmd_update($GLOBALS['egw']->session->account_domain, |
207 | - $GLOBALS['egw_info']['server']['header_admin_user']='admin', |
|
208 | - $GLOBALS['egw_info']['server']['header_admin_password']=uniqid('pw',true),false,true); |
|
206 | + $GLOBALS['egw_info']['server']['header_admin_user'] = 'admin', |
|
207 | + $GLOBALS['egw_info']['server']['header_admin_password'] = uniqid('pw', true), false, true); |
|
209 | 208 | echo $cmd->run()."\n"; |
210 | - echo '<h3>'.lang('You should %1log out%2 and in again, to update your current session!','<a href="'.Egw::link('/logout.php').'" target="_parent">','</a>')."</h3>\n"; |
|
209 | + echo '<h3>'.lang('You should %1log out%2 and in again, to update your current session!', '<a href="'.Egw::link('/logout.php').'" target="_parent">', '</a>')."</h3>\n"; |
|
211 | 210 | } |
212 | 211 | } |
213 | 212 | else |
214 | 213 | { |
215 | - $setup_tpl->set_var('error_msg',$f); |
|
214 | + $setup_tpl->set_var('error_msg', $f); |
|
216 | 215 | } |
217 | 216 | } |
218 | 217 | // create a new scheduled backup |
219 | 218 | if ($_POST['schedule']) |
220 | 219 | { |
221 | - $asyncservice->set_timer($_POST['times'],'db_backup-'.implode(':',$_POST['times']),'admin.admin_db_backup.do_backup',''); |
|
220 | + $asyncservice->set_timer($_POST['times'], 'db_backup-'.implode(':', $_POST['times']), 'admin.admin_db_backup.do_backup', ''); |
|
222 | 221 | } |
223 | 222 | // cancel a scheduled backup |
224 | 223 | if (is_array($_POST['cancel'])) |
@@ -229,29 +228,29 @@ discard block |
||
229 | 228 | // list scheduled backups |
230 | 229 | if (($jobs = $asyncservice->read('db_backup-%'))) |
231 | 230 | { |
232 | - foreach($jobs as $job) |
|
231 | + foreach ($jobs as $job) |
|
233 | 232 | { |
234 | 233 | $setup_tpl->set_var($job['times']); |
235 | - $setup_tpl->set_var('next_run',date('Y-m-d H:i',$job['next'])); |
|
236 | - $setup_tpl->set_var('actions','<input type="submit" name="cancel['.$job['id'].']" value="'.htmlspecialchars(lang('delete')).'" />'); |
|
237 | - $setup_tpl->parse('schedule_rows','schedule_row',true); |
|
234 | + $setup_tpl->set_var('next_run', date('Y-m-d H:i', $job['next'])); |
|
235 | + $setup_tpl->set_var('actions', '<input type="submit" name="cancel['.$job['id'].']" value="'.htmlspecialchars(lang('delete')).'" />'); |
|
236 | + $setup_tpl->parse('schedule_rows', 'schedule_row', true); |
|
238 | 237 | } |
239 | 238 | } |
240 | 239 | // input-fields to create a new scheduled backup |
241 | -foreach($times=array('year'=>'*','month'=>'*','day'=>'*','dow'=>'2-6','hour'=>3,'min'=>0) as $name => $default) |
|
240 | +foreach ($times = array('year'=>'*', 'month'=>'*', 'day'=>'*', 'dow'=>'2-6', 'hour'=>3, 'min'=>0) as $name => $default) |
|
242 | 241 | { |
243 | - $setup_tpl->set_var($name,'<input name="times['.$name.']" size="5" value="'.$default.'" />'); |
|
242 | + $setup_tpl->set_var($name, '<input name="times['.$name.']" size="5" value="'.$default.'" />'); |
|
244 | 243 | } |
245 | -$setup_tpl->set_var('next_run',' '); |
|
246 | -$setup_tpl->set_var('actions','<input type="submit" name="schedule" value="'.htmlspecialchars(lang('schedule')).'" />'); |
|
247 | -$setup_tpl->parse('schedule_rows','schedule_row',true); |
|
244 | +$setup_tpl->set_var('next_run', ' '); |
|
245 | +$setup_tpl->set_var('actions', '<input type="submit" name="schedule" value="'.htmlspecialchars(lang('schedule')).'" />'); |
|
246 | +$setup_tpl->parse('schedule_rows', 'schedule_row', true); |
|
248 | 247 | |
249 | 248 | // listing the availible backup sets |
250 | -$setup_tpl->set_var('backup_dir',$db_backup->backup_dir); |
|
251 | -$setup_tpl->set_var('set_rows',''); |
|
249 | +$setup_tpl->set_var('backup_dir', $db_backup->backup_dir); |
|
250 | +$setup_tpl->set_var('set_rows', ''); |
|
252 | 251 | $handle = @opendir($db_backup->backup_dir); |
253 | 252 | $files = array(); |
254 | -while($handle && ($file = readdir($handle))) |
|
253 | +while ($handle && ($file = readdir($handle))) |
|
255 | 254 | { |
256 | 255 | if ($file != '.' && $file != '..') |
257 | 256 | { |
@@ -261,13 +260,13 @@ discard block |
||
261 | 260 | if ($handle) closedir($handle); |
262 | 261 | |
263 | 262 | arsort($files); |
264 | -foreach($files as $file => $ctime) |
|
263 | +foreach ($files as $file => $ctime) |
|
265 | 264 | { |
266 | 265 | $size = filesize($db_backup->backup_dir.'/'.$file); |
267 | 266 | $setup_tpl->set_var(array( |
268 | 267 | 'filename' => $file, |
269 | - 'mod' => date('Y-m-d H:i',$ctime), |
|
270 | - 'size' => sprintf('%3.1lf MB (%d)',$size/(1024*1024),$size), |
|
268 | + 'mod' => date('Y-m-d H:i', $ctime), |
|
269 | + 'size' => sprintf('%3.1lf MB (%d)', $size / (1024 * 1024), $size), |
|
271 | 270 | 'actions' => '<input type="submit" name="download['.$file.']" value="'.htmlspecialchars(lang('download')).'" /> '."\n". |
272 | 271 | '<input type="submit" name="delete['.$file.']" value="'.htmlspecialchars(lang('delete')).'" onclick="return confirm(\''. |
273 | 272 | htmlspecialchars(lang('Confirm to delete this backup?')).'\');" /> '."\n". |
@@ -275,7 +274,7 @@ discard block |
||
275 | 274 | '<input type="submit" name="restore['.$file.']" value="'.htmlspecialchars(lang('restore')).'" onclick="return confirm(\''. |
276 | 275 | htmlspecialchars(lang('Restoring a backup will delete/replace all content in your database. Are you sure?')).'\');" />', |
277 | 276 | )); |
278 | - $setup_tpl->parse('set_rows','set_row',true); |
|
277 | + $setup_tpl->parse('set_rows', 'set_row', true); |
|
279 | 278 | } |
280 | 279 | |
281 | 280 | $setup_tpl->set_var(array( |
@@ -299,8 +298,8 @@ discard block |
||
299 | 298 | 'lang_size' => lang('size'), |
300 | 299 | )); |
301 | 300 | |
302 | -$setup_tpl->set_var('self',$self); |
|
303 | -$setup_tpl->pparse('out','T_db_backup'); |
|
301 | +$setup_tpl->set_var('self', $self); |
|
302 | +$setup_tpl->pparse('out', 'T_db_backup'); |
|
304 | 303 | |
305 | 304 | if ($run_in_egw) |
306 | 305 | { |
@@ -14,9 +14,12 @@ discard block |
||
14 | 14 | use EGroupware\Api\Egw; |
15 | 15 | use EGroupware\Api\Vfs; |
16 | 16 | |
17 | -if (!is_object(@$GLOBALS['egw'])) // called from outside eGW ==> setup |
|
17 | +if (!is_object(@$GLOBALS['egw'])) |
|
18 | +{ |
|
19 | + // called from outside eGW ==> setup |
|
18 | 20 | { |
19 | 21 | include ('./inc/functions.inc.php'); |
22 | +} |
|
20 | 23 | |
21 | 24 | @set_time_limit(0); |
22 | 25 | |
@@ -42,7 +45,9 @@ discard block |
||
42 | 45 | { |
43 | 46 | list($file) = each($_POST['download']); |
44 | 47 | $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir |
45 | - while (@ob_end_clean()) {} // end all active output buffering |
|
48 | + while (@ob_end_clean()) |
|
49 | + { |
|
50 | +} // end all active output buffering |
|
46 | 51 | ini_set('zlib.output_compression',0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit |
47 | 52 | Api\Header\Content::type(basename($file)); |
48 | 53 | readfile($file); |
@@ -126,7 +131,9 @@ discard block |
||
126 | 131 | echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
127 | 132 | $db_backup->backup($f); |
128 | 133 | if(is_resource($f)) |
129 | - fclose($f); |
|
134 | + { |
|
135 | + fclose($f); |
|
136 | + } |
|
130 | 137 | $setup_tpl->set_var('error_msg',lang('backup finished')); |
131 | 138 | |
132 | 139 | /* Remove old backups. */ |
@@ -170,8 +177,11 @@ discard block |
||
170 | 177 | list($file) = each($_POST['delete']); |
171 | 178 | $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
172 | 179 | |
173 | - if (unlink($file)) $setup_tpl->set_var('error_msg',lang("backup '%1' deleted",$file)); |
|
174 | -} |
|
180 | + if (unlink($file)) |
|
181 | + { |
|
182 | + $setup_tpl->set_var('error_msg',lang("backup '%1' deleted",$file)); |
|
183 | + } |
|
184 | + } |
|
175 | 185 | // rename a backup |
176 | 186 | if ($_POST['rename']) |
177 | 187 | { |
@@ -181,11 +191,17 @@ discard block |
||
181 | 191 | { |
182 | 192 | list($ending) = array_reverse(explode('.', $file)); |
183 | 193 | list($new_ending, $has_ending) = array_reverse(explode('.', $new_name)); |
184 | - if(!$has_ending || $new_ending != $ending) $new_name .= '.'.$ending; |
|
194 | + if(!$has_ending || $new_ending != $ending) |
|
195 | + { |
|
196 | + $new_name .= '.'.$ending; |
|
197 | + } |
|
185 | 198 | $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
186 | 199 | $ext = preg_match('/(\.gz|\.bz2)+$/i',$file,$matches) ? $matches[1] : ''; |
187 | 200 | $new_file = $db_backup->backup_dir.'/'.preg_replace('/(\.gz|\.bz2)+$/i','',basename($new_name)).$ext; |
188 | - if (rename($file,$new_file)) $setup_tpl->set_var('error_msg',lang("backup '%1' renamed to '%2'",basename($file),basename($new_file))); |
|
201 | + if (rename($file,$new_file)) |
|
202 | + { |
|
203 | + $setup_tpl->set_var('error_msg',lang("backup '%1' renamed to '%2'",basename($file),basename($new_file))); |
|
204 | + } |
|
189 | 205 | } |
190 | 206 | } |
191 | 207 | // restore a backup |
@@ -258,7 +274,10 @@ discard block |
||
258 | 274 | $files[$file] = filectime($db_backup->backup_dir.'/'.$file); |
259 | 275 | } |
260 | 276 | } |
261 | -if ($handle) closedir($handle); |
|
277 | +if ($handle) |
|
278 | +{ |
|
279 | + closedir($handle); |
|
280 | +} |
|
262 | 281 | |
263 | 282 | arsort($files); |
264 | 283 | foreach($files as $file => $ctime) |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | use EGroupware\Api; |
14 | 14 | use EGroupware\Api\Framework; |
15 | 15 | |
16 | -if (strpos($_SERVER['PHP_SELF'],'admin_account.php') !== false) |
|
16 | +if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') !== false) |
|
17 | 17 | { |
18 | 18 | include('./inc/functions.inc.php'); |
19 | 19 | |
20 | 20 | // Authorize the user to use setup app and load the database |
21 | 21 | // Does not return unless user is authorized |
22 | - if(!$GLOBALS['egw_setup']->auth('Config') || $_POST['cancel']) |
|
22 | + if (!$GLOBALS['egw_setup']->auth('Config') || $_POST['cancel']) |
|
23 | 23 | { |
24 | 24 | Header('Location: index.php'); |
25 | 25 | exit; |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | $lname = $_POST['lname']; |
44 | 44 | $email = $_POST['email']; |
45 | 45 | |
46 | - if($passwd != $passwd2 || !$username) |
|
46 | + if ($passwd != $passwd2 || !$username) |
|
47 | 47 | { |
48 | - $error = '<p>'.lang('Passwords did not match, please re-enter') . ".</p>\n"; |
|
48 | + $error = '<p>'.lang('Passwords did not match, please re-enter').".</p>\n"; |
|
49 | 49 | } |
50 | - if(!$username) |
|
50 | + if (!$username) |
|
51 | 51 | { |
52 | - $error = '<p>'.lang('You must enter a username for the admin') . ".</p>\n"; |
|
52 | + $error = '<p>'.lang('You must enter a username for the admin').".</p>\n"; |
|
53 | 53 | } |
54 | 54 | } |
55 | -if(!$_POST['submit'] || $error) |
|
55 | +if (!$_POST['submit'] || $error) |
|
56 | 56 | { |
57 | 57 | $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); |
58 | 58 | $setup_tpl = new Framework\Template($tpl_root); |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | 'T_login_stage_header' => 'login_stage_header.tpl', |
65 | 65 | 'T_admin_account' => 'admin_account.tpl' |
66 | 66 | )); |
67 | - $setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
|
68 | - $setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
|
67 | + $setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain'); |
|
68 | + $setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain'); |
|
69 | 69 | |
70 | 70 | $GLOBALS['egw_setup']->html->show_header(lang('Create admin account')); |
71 | 71 | |
@@ -76,27 +76,27 @@ discard block |
||
76 | 76 | 'lname' => $lname, |
77 | 77 | 'email' => $email, |
78 | 78 | )); |
79 | - $setup_tpl->set_var('action_url','admin_account.php'); |
|
80 | - $setup_tpl->set_var('description',lang('This will create a first user in eGroupWare or reset password and admin rights of an exiting user')); |
|
81 | - $setup_tpl->set_var('lang_deleteall',lang('Delete all existing SQL accounts, groups, ACLs and preferences (normally not necessary)?')); |
|
82 | - |
|
83 | - $setup_tpl->set_var('detailadmin',lang('Details for Admin account')); |
|
84 | - $setup_tpl->set_var('adminusername',lang('Admin username')); |
|
85 | - $setup_tpl->set_var('adminfirstname',lang('Admin first name')); |
|
86 | - $setup_tpl->set_var('adminlastname',lang('Admin last name')); |
|
87 | - $setup_tpl->set_var('adminemail',lang('Admin email address')); |
|
88 | - $setup_tpl->set_var('adminpassword',lang('Admin password')); |
|
89 | - $setup_tpl->set_var('adminpassword2',lang('Re-enter password')); |
|
90 | - $setup_tpl->set_var('admin_all_apps',lang('Give admin access to all installed apps')); |
|
91 | - $setup_tpl->set_var('all_apps_desc',lang('Usually more annoying.<br />Admins can use Admin >> Manage accounts or groups to give access to further apps.')); |
|
92 | - $setup_tpl->set_var('create_demo_accounts',lang('Create demo accounts')); |
|
93 | - $setup_tpl->set_var('demo_desc',lang('The username/passwords are: demo/guest, demo2/guest and demo3/guest.')); |
|
79 | + $setup_tpl->set_var('action_url', 'admin_account.php'); |
|
80 | + $setup_tpl->set_var('description', lang('This will create a first user in eGroupWare or reset password and admin rights of an exiting user')); |
|
81 | + $setup_tpl->set_var('lang_deleteall', lang('Delete all existing SQL accounts, groups, ACLs and preferences (normally not necessary)?')); |
|
82 | + |
|
83 | + $setup_tpl->set_var('detailadmin', lang('Details for Admin account')); |
|
84 | + $setup_tpl->set_var('adminusername', lang('Admin username')); |
|
85 | + $setup_tpl->set_var('adminfirstname', lang('Admin first name')); |
|
86 | + $setup_tpl->set_var('adminlastname', lang('Admin last name')); |
|
87 | + $setup_tpl->set_var('adminemail', lang('Admin email address')); |
|
88 | + $setup_tpl->set_var('adminpassword', lang('Admin password')); |
|
89 | + $setup_tpl->set_var('adminpassword2', lang('Re-enter password')); |
|
90 | + $setup_tpl->set_var('admin_all_apps', lang('Give admin access to all installed apps')); |
|
91 | + $setup_tpl->set_var('all_apps_desc', lang('Usually more annoying.<br />Admins can use Admin >> Manage accounts or groups to give access to further apps.')); |
|
92 | + $setup_tpl->set_var('create_demo_accounts', lang('Create demo accounts')); |
|
93 | + $setup_tpl->set_var('demo_desc', lang('The username/passwords are: demo/guest, demo2/guest and demo3/guest.')); |
|
94 | 94 | |
95 | 95 | $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
96 | 96 | |
97 | - $setup_tpl->set_var('lang_submit',lang('Save')); |
|
98 | - $setup_tpl->set_var('lang_cancel',lang('Cancel')); |
|
99 | - $setup_tpl->pparse('out','T_admin_account'); |
|
97 | + $setup_tpl->set_var('lang_submit', lang('Save')); |
|
98 | + $setup_tpl->set_var('lang_cancel', lang('Cancel')); |
|
99 | + $setup_tpl->pparse('out', 'T_admin_account'); |
|
100 | 100 | $GLOBALS['egw_setup']->html->show_footer(); |
101 | 101 | } |
102 | 102 | else |
@@ -104,25 +104,25 @@ discard block |
||
104 | 104 | /* Begin transaction for acl, etc */ |
105 | 105 | $GLOBALS['egw_setup']->db->transaction_begin(); |
106 | 106 | |
107 | - if($_POST['delete_all']) |
|
107 | + if ($_POST['delete_all']) |
|
108 | 108 | { |
109 | 109 | /* Now, clear out existing tables */ |
110 | - foreach(array($GLOBALS['egw_setup']->accounts_table,$GLOBALS['egw_setup']->acl_table,'egw_access_log') as $table) |
|
110 | + foreach (array($GLOBALS['egw_setup']->accounts_table, $GLOBALS['egw_setup']->acl_table, 'egw_access_log') as $table) |
|
111 | 111 | { |
112 | - $GLOBALS['egw_setup']->db->delete($table,'1=1',__LINE__,__FILE__); |
|
112 | + $GLOBALS['egw_setup']->db->delete($table, '1=1', __LINE__, __FILE__); |
|
113 | 113 | } |
114 | 114 | // keep default and forced prefs from installed apps |
115 | - $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->prefs_table,'preference_owner NOT IN (-1,-2)',__LINE__,__FILE__); |
|
115 | + $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->prefs_table, 'preference_owner NOT IN (-1,-2)', __LINE__, __FILE__); |
|
116 | 116 | // remove accounts from addressbook |
117 | - $GLOBALS['egw_setup']->db->delete('egw_addressbook','account_id IS NOT NULL',__LINE__,__FILE__); |
|
117 | + $GLOBALS['egw_setup']->db->delete('egw_addressbook', 'account_id IS NOT NULL', __LINE__, __FILE__); |
|
118 | 118 | } |
119 | 119 | // create our stock groups: Default (all users) and Admins (administrators) |
120 | - $defaultgroupid = (int)$GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False); |
|
121 | - $admingroupid = (int)$GLOBALS['egw_setup']->add_account('Admins','Admin','Group',False,False); |
|
120 | + $defaultgroupid = (int)$GLOBALS['egw_setup']->add_account('Default', 'Default', 'Group', False, False); |
|
121 | + $admingroupid = (int)$GLOBALS['egw_setup']->add_account('Admins', 'Admin', 'Group', False, False); |
|
122 | 122 | |
123 | 123 | if (!$defaultgroupid || !$admingroupid) |
124 | 124 | { |
125 | - if (strpos($_SERVER['PHP_SELF'],'admin_account.php') === false) |
|
125 | + if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') === false) |
|
126 | 126 | { |
127 | 127 | return 42; //lang('Error in group-creation !!!'); // dont exit on setup-cli |
128 | 128 | } |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | // Group perms for the default group |
136 | - $default_group_apps = array('addressbook','calendar','infolog','mail','filemanager','preferences','manual','groupdav','notifications','timesheet','importexport','activesync'); |
|
137 | - $GLOBALS['egw_setup']->add_acl($default_group_apps,'run',$defaultgroupid); |
|
136 | + $default_group_apps = array('addressbook', 'calendar', 'infolog', 'mail', 'filemanager', 'preferences', 'manual', 'groupdav', 'notifications', 'timesheet', 'importexport', 'activesync'); |
|
137 | + $GLOBALS['egw_setup']->add_acl($default_group_apps, 'run', $defaultgroupid); |
|
138 | 138 | |
139 | 139 | $apps = array(); |
140 | - foreach($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->applications_table,'app_name','app_enabled < 3',__LINE__,__FILE__) as $row) |
|
140 | + foreach ($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->applications_table, 'app_name', 'app_enabled < 3', __LINE__, __FILE__) as $row) |
|
141 | 141 | { |
142 | 142 | $apps[] = $row['app_name']; |
143 | 143 | } |
@@ -148,24 +148,24 @@ discard block |
||
148 | 148 | $apps = array_intersect( |
149 | 149 | // also give Admins apps of all users group Defaults, in case one forgot to add admins to it |
150 | 150 | array_unique(array_merge($default_group_apps, |
151 | - array('admin','bookmarks','emailadmin','news_admin','phpbrain','phpsysinfo','phpfreechat','projectmanager','resources','sitemgr','timesheet','tracker','wiki'))),$apps); |
|
151 | + array('admin', 'bookmarks', 'emailadmin', 'news_admin', 'phpbrain', 'phpsysinfo', 'phpfreechat', 'projectmanager', 'resources', 'sitemgr', 'timesheet', 'tracker', 'wiki'))), $apps); |
|
152 | 152 | } |
153 | - $GLOBALS['egw_setup']->add_acl($apps,'run',$admingroupid); |
|
153 | + $GLOBALS['egw_setup']->add_acl($apps, 'run', $admingroupid); |
|
154 | 154 | |
155 | 155 | /* Creation of the demo accounts is optional - the checkbox is on by default. */ |
156 | - if($_POST['create_demo']) |
|
156 | + if ($_POST['create_demo']) |
|
157 | 157 | { |
158 | 158 | // Create 3 demo accounts |
159 | - $GLOBALS['egw_setup']->add_account('demo','Demo','Account','guest'); |
|
160 | - $GLOBALS['egw_setup']->add_account('demo2','Demo2','Account','guest'); |
|
161 | - $GLOBALS['egw_setup']->add_account('demo3','Demo3','Account','guest'); |
|
159 | + $GLOBALS['egw_setup']->add_account('demo', 'Demo', 'Account', 'guest'); |
|
160 | + $GLOBALS['egw_setup']->add_account('demo2', 'Demo2', 'Account', 'guest'); |
|
161 | + $GLOBALS['egw_setup']->add_account('demo3', 'Demo3', 'Account', 'guest'); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /* Create records for administrator account, with Admins as primary and Default as additional group */ |
165 | - $accountid = $GLOBALS['egw_setup']->add_account($username,$fname,$lname,$passwd,'Admins',True,$email); |
|
165 | + $accountid = $GLOBALS['egw_setup']->add_account($username, $fname, $lname, $passwd, 'Admins', True, $email); |
|
166 | 166 | if (!$accountid) |
167 | 167 | { |
168 | - if (strpos($_SERVER['PHP_SELF'],'admin_account.php') === false) |
|
168 | + if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') === false) |
|
169 | 169 | { |
170 | 170 | return 41; //lang('Error in admin-creation !!!'); // dont exit on setup-cli |
171 | 171 | } |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | $GLOBALS['egw_setup']->db->transaction_abort(); |
175 | 175 | exit; |
176 | 176 | } |
177 | - $GLOBALS['egw_setup']->set_memberships(array($admingroupid,$defaultgroupid),$accountid); |
|
177 | + $GLOBALS['egw_setup']->set_memberships(array($admingroupid, $defaultgroupid), $accountid); |
|
178 | 178 | |
179 | 179 | $GLOBALS['egw_setup']->db->transaction_commit(); |
180 | 180 | |
181 | - if (strpos($_SERVER['PHP_SELF'],'admin_account.php') !== false) |
|
181 | + if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') !== false) |
|
182 | 182 | { |
183 | 183 | Header('Location: index.php'); |
184 | 184 | } |
@@ -68,91 +68,91 @@ |
||
68 | 68 | |
69 | 69 | switch($action) |
70 | 70 | { |
71 | - case '--version': |
|
72 | - case '--check': |
|
73 | - setup_cmd::check_installed($arguments[0],0,true); |
|
74 | - break; |
|
75 | - |
|
76 | - case '--create-header': |
|
77 | - case '--edit-header': |
|
78 | - case '--upgrade-header': |
|
79 | - case '--update-header': |
|
80 | - do_header($action == '--create-header',$arguments); |
|
81 | - break; |
|
82 | - |
|
83 | - case '--install': |
|
84 | - do_install($arguments); |
|
85 | - break; |
|
86 | - |
|
87 | - case '--config': |
|
88 | - do_config($arguments); |
|
89 | - break; |
|
90 | - |
|
91 | - case '--admin': |
|
92 | - do_admin($arguments[0]); |
|
93 | - break; |
|
94 | - |
|
95 | - case '--update': |
|
96 | - do_update($arguments[0]); |
|
97 | - break; |
|
98 | - |
|
99 | - case '--register-hooks': |
|
100 | - case '--register-all-hooks': |
|
101 | - do_hooks($arguments[0]); |
|
102 | - break; |
|
103 | - |
|
104 | - case '--backup': |
|
105 | - do_backup($arguments[0]); |
|
106 | - break; |
|
107 | - |
|
108 | - case '--languages': |
|
109 | - echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); |
|
110 | - break; |
|
111 | - |
|
112 | - case '--charsets': |
|
113 | - echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n"; |
|
114 | - break; |
|
115 | - |
|
116 | - case '--exit-codes': |
|
117 | - list_exit_codes(); |
|
118 | - break; |
|
119 | - |
|
120 | - case '--help': |
|
121 | - case '--usage': |
|
122 | - do_usage($arguments[0]); |
|
123 | - break; |
|
124 | - |
|
125 | - default: |
|
126 | - // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE |
|
127 | - if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && |
|
128 | - is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
129 | - { |
|
130 | - $args = array(); |
|
131 | - list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
132 | - foreach($arguments as $arg) |
|
71 | + case '--version': |
|
72 | + case '--check': |
|
73 | + setup_cmd::check_installed($arguments[0],0,true); |
|
74 | + break; |
|
75 | + |
|
76 | + case '--create-header': |
|
77 | + case '--edit-header': |
|
78 | + case '--upgrade-header': |
|
79 | + case '--update-header': |
|
80 | + do_header($action == '--create-header',$arguments); |
|
81 | + break; |
|
82 | + |
|
83 | + case '--install': |
|
84 | + do_install($arguments); |
|
85 | + break; |
|
86 | + |
|
87 | + case '--config': |
|
88 | + do_config($arguments); |
|
89 | + break; |
|
90 | + |
|
91 | + case '--admin': |
|
92 | + do_admin($arguments[0]); |
|
93 | + break; |
|
94 | + |
|
95 | + case '--update': |
|
96 | + do_update($arguments[0]); |
|
97 | + break; |
|
98 | + |
|
99 | + case '--register-hooks': |
|
100 | + case '--register-all-hooks': |
|
101 | + do_hooks($arguments[0]); |
|
102 | + break; |
|
103 | + |
|
104 | + case '--backup': |
|
105 | + do_backup($arguments[0]); |
|
106 | + break; |
|
107 | + |
|
108 | + case '--languages': |
|
109 | + echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); |
|
110 | + break; |
|
111 | + |
|
112 | + case '--charsets': |
|
113 | + echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n"; |
|
114 | + break; |
|
115 | + |
|
116 | + case '--exit-codes': |
|
117 | + list_exit_codes(); |
|
118 | + break; |
|
119 | + |
|
120 | + case '--help': |
|
121 | + case '--usage': |
|
122 | + do_usage($arguments[0]); |
|
123 | + break; |
|
124 | + |
|
125 | + default: |
|
126 | + // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE |
|
127 | + if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && |
|
128 | + is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
133 | 129 | { |
134 | - list($name,$value) = explode('=',$arg,2); |
|
135 | - if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
136 | - { |
|
137 | - throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
|
138 | - } |
|
139 | - if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
130 | + $args = array(); |
|
131 | + list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
132 | + foreach($arguments as $arg) |
|
140 | 133 | { |
141 | - list($name,$sub) = explode('[',substr($name,0,-1),2); |
|
142 | - $args[$name][$sub] = $value; |
|
143 | - } |
|
144 | - else |
|
145 | - { |
|
146 | - $args[$name] = $value; |
|
134 | + list($name,$value) = explode('=',$arg,2); |
|
135 | + if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
136 | + { |
|
137 | + throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
|
138 | + } |
|
139 | + if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
140 | + { |
|
141 | + list($name,$sub) = explode('[',substr($name,0,-1),2); |
|
142 | + $args[$name][$sub] = $value; |
|
143 | + } |
|
144 | + else |
|
145 | + { |
|
146 | + $args[$name] = $value; |
|
147 | + } |
|
147 | 148 | } |
149 | + $cmd = new $class($args); |
|
150 | + $msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run); |
|
151 | + if (is_array($msg)) $msg = print_r($msg,true); |
|
152 | + echo "$msg\n"; |
|
153 | + break; |
|
148 | 154 | } |
149 | - $cmd = new $class($args); |
|
150 | - $msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run); |
|
151 | - if (is_array($msg)) $msg = print_r($msg,true); |
|
152 | - echo "$msg\n"; |
|
153 | - break; |
|
154 | - } |
|
155 | - throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90); |
|
155 | + throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90); |
|
156 | 156 | } |
157 | 157 | exit(0); |
158 | 158 |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | |
14 | 14 | use EGroupware\Api; |
15 | 15 | |
16 | -chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
16 | +chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
17 | 17 | |
18 | 18 | if (php_sapi_name() !== 'cli') // security precaution: forbit calling setup-cli as web-page |
19 | 19 | { |
20 | 20 | die('<h1>setup-cli.php must NOT be called as web-page --> exiting !!!</h1>'); |
21 | 21 | } |
22 | -error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); |
|
22 | +error_reporting(E_ALL&~E_NOTICE&~E_STRICT); |
|
23 | 23 | |
24 | 24 | $dry_run = false; |
25 | 25 | array_shift($_SERVER['argv']); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | $arguments = $_SERVER['argv']; |
35 | 35 | $action = array_shift($arguments); |
36 | - if (isset($arguments[0])) list($_POST['FormDomain']) = explode(',',$arguments[0]); // header include needs that to detects the right domain |
|
36 | + if (isset($arguments[0])) list($_POST['FormDomain']) = explode(',', $arguments[0]); // header include needs that to detects the right domain |
|
37 | 37 | } |
38 | 38 | else |
39 | 39 | { |
@@ -42,42 +42,42 @@ discard block |
||
42 | 42 | |
43 | 43 | // setting the language from the enviroment |
44 | 44 | $_POST['ConfigLang'] = get_lang($charset); |
45 | -create_http_enviroment(); // guessing the docroot etc. |
|
45 | +create_http_enviroment(); // guessing the docroot etc. |
|
46 | 46 | |
47 | 47 | if (ini_get('session.save_handler') == 'files' && !is_writable(ini_get('session.save_path')) && is_dir('/tmp') && is_writable('/tmp')) |
48 | 48 | { |
49 | - ini_set('session.save_path','/tmp'); // regular users may have no rights to apache's session dir |
|
49 | + ini_set('session.save_path', '/tmp'); // regular users may have no rights to apache's session dir |
|
50 | 50 | } |
51 | 51 | // check if date.timezone is set, report it and set something if not, as it gives tons of errors in install log |
52 | 52 | if (!ini_get('date.timezone')) |
53 | 53 | { |
54 | 54 | if (!($tz = date_default_timezone_get())) $tz = 'UTC'; |
55 | 55 | echo "No default timezone (php.ini date.timezone) set, we temporary set '$tz'. You should fix that permanent!\n"; |
56 | - ini_set('date.timezone',$tz); |
|
56 | + ini_set('date.timezone', $tz); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // setting up the $GLOBALS['egw_setup'] object AND including the header.inc.php if it exists |
60 | 60 | include('inc/functions.inc.php'); |
61 | -$GLOBALS['egw_info']['flags']['no_exception_handler'] = 'cli'; // inc/functions.inc.php does NOT set it |
|
61 | +$GLOBALS['egw_info']['flags']['no_exception_handler'] = 'cli'; // inc/functions.inc.php does NOT set it |
|
62 | 62 | $GLOBALS['egw_setup']->system_charset = $charset; |
63 | 63 | |
64 | -if ((float) PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
64 | +if ((float)PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
65 | 65 | { |
66 | - throw new Api\Exception\WrongUserinput(lang('You are using PHP version %1. EGroupware now requires %2 or later, recommended is PHP %3.',PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,$GLOBALS['egw_setup']->recommended_php_version),98); |
|
66 | + throw new Api\Exception\WrongUserinput(lang('You are using PHP version %1. EGroupware now requires %2 or later, recommended is PHP %3.', PHP_VERSION, $GLOBALS['egw_setup']->required_php_version, $GLOBALS['egw_setup']->recommended_php_version), 98); |
|
67 | 67 | } |
68 | 68 | |
69 | -switch($action) |
|
69 | +switch ($action) |
|
70 | 70 | { |
71 | 71 | case '--version': |
72 | 72 | case '--check': |
73 | - setup_cmd::check_installed($arguments[0],0,true); |
|
73 | + setup_cmd::check_installed($arguments[0], 0, true); |
|
74 | 74 | break; |
75 | 75 | |
76 | 76 | case '--create-header': |
77 | 77 | case '--edit-header': |
78 | 78 | case '--upgrade-header': |
79 | 79 | case '--update-header': |
80 | - do_header($action == '--create-header',$arguments); |
|
80 | + do_header($action == '--create-header', $arguments); |
|
81 | 81 | break; |
82 | 82 | |
83 | 83 | case '--install': |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | break; |
107 | 107 | |
108 | 108 | case '--languages': |
109 | - echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); |
|
109 | + echo html_entity_decode(file_get_contents('lang/languages'), ENT_COMPAT, 'utf-8'); |
|
110 | 110 | break; |
111 | 111 | |
112 | 112 | case '--charsets': |
113 | - echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n"; |
|
113 | + echo html_entity_decode(implode("\n", $GLOBALS['egw_setup']->translation->get_charsets(false)), ENT_COMPAT, 'utf-8')."\n"; |
|
114 | 114 | break; |
115 | 115 | |
116 | 116 | case '--exit-codes': |
@@ -124,21 +124,21 @@ discard block |
||
124 | 124 | |
125 | 125 | default: |
126 | 126 | // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE |
127 | - if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && |
|
128 | - is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
127 | + if (substr($action, 0, 2) == '--' && class_exists($class = str_replace('-', '_', substr($action, 2))) && |
|
128 | + is_subclass_of($class, 'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
129 | 129 | { |
130 | 130 | $args = array(); |
131 | - list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
132 | - foreach($arguments as $arg) |
|
131 | + list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
132 | + foreach ($arguments as $arg) |
|
133 | 133 | { |
134 | - list($name,$value) = explode('=',$arg,2); |
|
135 | - if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
134 | + list($name, $value) = explode('=', $arg, 2); |
|
135 | + if (property_exists('admin_cmd', $name)) // dont allow to overwrite admin_cmd properties |
|
136 | 136 | { |
137 | - throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
|
137 | + throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!", $arg), 90); |
|
138 | 138 | } |
139 | - if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
139 | + if (substr($name, -1) == ']') // allow 1-dim. arrays |
|
140 | 140 | { |
141 | - list($name,$sub) = explode('[',substr($name,0,-1),2); |
|
141 | + list($name, $sub) = explode('[', substr($name, 0, -1), 2); |
|
142 | 142 | $args[$name][$sub] = $value; |
143 | 143 | } |
144 | 144 | else |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | } |
148 | 148 | } |
149 | 149 | $cmd = new $class($args); |
150 | - $msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run); |
|
151 | - if (is_array($msg)) $msg = print_r($msg,true); |
|
150 | + $msg = $cmd->run($time = null, $set_modifier = true, $skip_checks = false, $check_only = $dry_run); |
|
151 | + if (is_array($msg)) $msg = print_r($msg, true); |
|
152 | 152 | echo "$msg\n"; |
153 | 153 | break; |
154 | 154 | } |
155 | - throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90); |
|
155 | + throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!", $action), 90); |
|
156 | 156 | } |
157 | 157 | exit(0); |
158 | 158 | |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function do_config($args) |
165 | 165 | { |
166 | - $arg0 = explode(',',array_shift($args)); |
|
166 | + $arg0 = explode(',', array_shift($args)); |
|
167 | 167 | if (!($domain = @array_shift($arg0))) $domain = 'default'; |
168 | 168 | $user = @array_shift($arg0); |
169 | 169 | $password = @array_shift($arg0); |
170 | - _fetch_user_password($user,$password); |
|
170 | + _fetch_user_password($user, $password); |
|
171 | 171 | |
172 | 172 | if ($arg0) // direct assignments (name=value,...) left |
173 | 173 | { |
174 | - array_unshift($args,implode(',',$arg0)); |
|
175 | - array_unshift($args,'--config'); |
|
174 | + array_unshift($args, implode(',', $arg0)); |
|
175 | + array_unshift($args, '--config'); |
|
176 | 176 | } |
177 | 177 | |
178 | - $cmd = new setup_cmd_config($domain,$user,$password,$args,true); |
|
178 | + $cmd = new setup_cmd_config($domain, $user, $password, $args, true); |
|
179 | 179 | echo $cmd->run()."\n\n"; |
180 | 180 | |
181 | 181 | $cmd->get_config(true); |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | */ |
189 | 189 | function do_hooks($arg) |
190 | 190 | { |
191 | - list($domain,$user,$password) = explode(',',$arg); |
|
192 | - _fetch_user_password($user,$password); |
|
191 | + list($domain, $user, $password) = explode(',', $arg); |
|
192 | + _fetch_user_password($user, $password); |
|
193 | 193 | |
194 | 194 | $domains = $GLOBALS['egw_domain']; |
195 | 195 | if ($domain && $domain != 'all') |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
198 | 198 | } |
199 | 199 | |
200 | - foreach(array_keys($domains) as $domain) |
|
200 | + foreach (array_keys($domains) as $domain) |
|
201 | 201 | { |
202 | - $cmd = new setup_cmd_hooks($domain,$user,$password); |
|
202 | + $cmd = new setup_cmd_hooks($domain, $user, $password); |
|
203 | 203 | echo "$domain: ".$cmd->run()."\n"; |
204 | 204 | } |
205 | 205 | echo "\n"; |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | */ |
213 | 213 | function do_admin($arg) |
214 | 214 | { |
215 | - list($domain,$user,$password,$admin,$pw,$first,$last,$email,$lang) = explode(',',$arg); |
|
216 | - _fetch_user_password($user,$password); |
|
215 | + list($domain, $user, $password, $admin, $pw, $first, $last, $email, $lang) = explode(',', $arg); |
|
216 | + _fetch_user_password($user, $password); |
|
217 | 217 | |
218 | - $cmd = new setup_cmd_admin($domain,$user,$password,$admin,$pw,$first,$last,$email,array(),$lang); |
|
218 | + $cmd = new setup_cmd_admin($domain, $user, $password, $admin, $pw, $first, $last, $email, array(), $lang); |
|
219 | 219 | echo $cmd->run()."\n"; |
220 | 220 | } |
221 | 221 | |
@@ -225,21 +225,21 @@ discard block |
||
225 | 225 | * @param string $arg domain(all),[config user(admin)],password,[backup-file, 'no' for no backup or empty for default name] |
226 | 226 | * @param boolean $quite_check quiten the call to _check_auth_config |
227 | 227 | */ |
228 | -function do_backup($arg,$quite_check=false) |
|
228 | +function do_backup($arg, $quite_check = false) |
|
229 | 229 | { |
230 | - list($domain,,,$backup) = $options = explode(',',$arg); |
|
230 | + list($domain,,, $backup) = $options = explode(',', $arg); |
|
231 | 231 | |
232 | 232 | $domains = $GLOBALS['egw_domain']; |
233 | 233 | if ($domain && $domain != 'all') |
234 | 234 | { |
235 | 235 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
236 | 236 | } |
237 | - foreach(array_keys($domains) as $domain) |
|
237 | + foreach (array_keys($domains) as $domain) |
|
238 | 238 | { |
239 | 239 | $options[0] = $domain; |
240 | 240 | |
241 | 241 | if ($quite_check) ob_start(); |
242 | - _check_auth_config(implode(',',$options),14); |
|
242 | + _check_auth_config(implode(',', $options), 14); |
|
243 | 243 | if ($quite_check) ob_end_clean(); |
244 | 244 | |
245 | 245 | if ($backup == 'no') |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | else // backup failed ==> dont start the upgrade |
259 | 259 | { |
260 | - throw new Api\Exception\WrongUserinput(lang('Backup failed').': '.$f,50); |
|
260 | + throw new Api\Exception\WrongUserinput(lang('Backup failed').': '.$f, 50); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | } |
@@ -270,31 +270,31 @@ discard block |
||
270 | 270 | */ |
271 | 271 | function do_update($arg) |
272 | 272 | { |
273 | - list($domain,$user,$password,$backup,$app) = explode(',',$arg); |
|
274 | - _fetch_user_password($user,$password); |
|
273 | + list($domain, $user, $password, $backup, $app) = explode(',', $arg); |
|
274 | + _fetch_user_password($user, $password); |
|
275 | 275 | |
276 | 276 | $domains = $GLOBALS['egw_domain']; |
277 | 277 | if ($domain && $domain != 'all') |
278 | 278 | { |
279 | 279 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
280 | 280 | } |
281 | - foreach($domains as $domain => $data) |
|
281 | + foreach ($domains as $domain => $data) |
|
282 | 282 | { |
283 | 283 | $arg = "$domain,$user,$password,$backup"; |
284 | 284 | |
285 | - _check_auth_config($arg,14); |
|
285 | + _check_auth_config($arg, 14); |
|
286 | 286 | |
287 | 287 | if ($GLOBALS['egw_info']['setup']['stage']['db'] != 4 && |
288 | 288 | (!$app || !in_array($app, setup_cmd::$apps_to_install) && !in_array($app, setup_cmd::$apps_to_upgrade)) && |
289 | 289 | !setup_cmd::check_autoinstall()) |
290 | 290 | { |
291 | - echo lang('No update necessary, domain %1(%2) is up to date.',$domain,$data['db_type'])."\n"; |
|
291 | + echo lang('No update necessary, domain %1(%2) is up to date.', $domain, $data['db_type'])."\n"; |
|
292 | 292 | } |
293 | 293 | else |
294 | 294 | { |
295 | - do_backup($arg,true); |
|
295 | + do_backup($arg, true); |
|
296 | 296 | |
297 | - $cmd = new setup_cmd_update($domain,$user,$password,$backup,false,$app); |
|
297 | + $cmd = new setup_cmd_update($domain, $user, $password, $backup, false, $app); |
|
298 | 298 | echo $cmd->run()."\n"; |
299 | 299 | } |
300 | 300 | } |
@@ -313,20 +313,20 @@ discard block |
||
313 | 313 | * @param boolean $set_lang =true set our charset, overwriting the charset of the eGW installation, default true |
314 | 314 | * @return array with unprocessed arguments from $arg |
315 | 315 | */ |
316 | -function _check_auth_config($arg,$stop,$set_lang=true) |
|
316 | +function _check_auth_config($arg, $stop, $set_lang = true) |
|
317 | 317 | { |
318 | - $options = explode(',',$arg); |
|
318 | + $options = explode(',', $arg); |
|
319 | 319 | if (!($domain = array_shift($options))) $domain = 'default'; |
320 | 320 | $user = array_shift($options); |
321 | 321 | $password = array_shift($options); |
322 | - _fetch_user_password($user,$password); |
|
322 | + _fetch_user_password($user, $password); |
|
323 | 323 | |
324 | - setup_cmd::check_installed($domain,$stop,true); |
|
324 | + setup_cmd::check_installed($domain, $stop, true); |
|
325 | 325 | |
326 | 326 | // reset charset for the output to the charset used by the OS |
327 | 327 | if ($set_lang) $GLOBALS['egw_setup']->system_charset = $GLOBALS['charset']; |
328 | 328 | |
329 | - setup_cmd::check_setup_auth($user,$password,$domain); |
|
329 | + setup_cmd::check_setup_auth($user, $password, $domain); |
|
330 | 330 | |
331 | 331 | return $options; |
332 | 332 | } |
@@ -338,16 +338,16 @@ discard block |
||
338 | 338 | */ |
339 | 339 | function do_install($args) |
340 | 340 | { |
341 | - list($domain,$user,$password,$backup,$charset,$lang) = explode(',',array_shift($args)); |
|
342 | - _fetch_user_password($user,$password); |
|
341 | + list($domain, $user, $password, $backup, $charset, $lang) = explode(',', array_shift($args)); |
|
342 | + _fetch_user_password($user, $password); |
|
343 | 343 | |
344 | 344 | $config = array(); |
345 | - foreach($args as $arg) |
|
345 | + foreach ($args as $arg) |
|
346 | 346 | { |
347 | - list($name,$value) = explode('=',$arg,2); |
|
347 | + list($name, $value) = explode('=', $arg, 2); |
|
348 | 348 | $config[$name] = $value; |
349 | 349 | } |
350 | - $cmd = new setup_cmd_install($domain,$user,$password,$backup,$charset,true,$config,$lang); |
|
350 | + $cmd = new setup_cmd_install($domain, $user, $password, $backup, $charset, true, $config, $lang); |
|
351 | 351 | echo $cmd->run()."\n"; |
352 | 352 | } |
353 | 353 | |
@@ -357,14 +357,14 @@ discard block |
||
357 | 357 | * @param string &$user |
358 | 358 | * @param string &$password |
359 | 359 | */ |
360 | -function _fetch_user_password(&$user,&$password) |
|
360 | +function _fetch_user_password(&$user, &$password) |
|
361 | 361 | { |
362 | 362 | // read password from enviroment or query it from user, if not given |
363 | 363 | if (!$user) $user = 'admin'; |
364 | 364 | if (!$password && !($password = $_SERVER['EGW_CLI_PASSWORD'])) |
365 | 365 | { |
366 | 366 | echo lang('Admin password to header manager').' '; |
367 | - $password = trim(fgets($f = fopen('php://stdin','rb'))); |
|
367 | + $password = trim(fgets($f = fopen('php://stdin', 'rb'))); |
|
368 | 368 | fclose($f); |
369 | 369 | } |
370 | 370 | } |
@@ -376,18 +376,18 @@ discard block |
||
376 | 376 | * @param array $arguments |
377 | 377 | * @return int |
378 | 378 | */ |
379 | -function do_header($create,&$arguments) |
|
379 | +function do_header($create, &$arguments) |
|
380 | 380 | { |
381 | 381 | if (!$create) |
382 | 382 | { |
383 | 383 | // read password from enviroment or query it from user, if not given |
384 | - $options = explode(',',@$arguments[0]); |
|
385 | - _fetch_user_password($options[1],$options[0]); |
|
386 | - $arguments[0] = implode(',',$options); |
|
384 | + $options = explode(',', @$arguments[0]); |
|
385 | + _fetch_user_password($options[1], $options[0]); |
|
386 | + $arguments[0] = implode(',', $options); |
|
387 | 387 | } |
388 | - array_unshift($arguments,$create ? '--create-header' : '--edit-header'); |
|
388 | + array_unshift($arguments, $create ? '--create-header' : '--edit-header'); |
|
389 | 389 | |
390 | - $cmd = new setup_cmd_header($create?'create':'edit',$arguments); |
|
390 | + $cmd = new setup_cmd_header($create ? 'create' : 'edit', $arguments); |
|
391 | 391 | echo $cmd->run()."\n"; |
392 | 392 | } |
393 | 393 | |
@@ -399,11 +399,11 @@ discard block |
||
399 | 399 | */ |
400 | 400 | function get_lang(&$charset) |
401 | 401 | { |
402 | - @list($lang,$nation,$charset) = preg_split("/[_.]/",strtolower($_SERVER['LANG'])); |
|
402 | + @list($lang, $nation, $charset) = preg_split("/[_.]/", strtolower($_SERVER['LANG'])); |
|
403 | 403 | |
404 | - foreach(file('lang/languages') as $line) |
|
404 | + foreach (file('lang/languages') as $line) |
|
405 | 405 | { |
406 | - list($code,$language) = explode("\t",$line); |
|
406 | + list($code, $language) = explode("\t", $line); |
|
407 | 407 | $languages[$code] = $language; |
408 | 408 | } |
409 | 409 | if (isset($languages[$lang.'-'.$nation])) return $lang.'-'.$nation; |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | { |
421 | 421 | $_SERVER['SCRIPT_FILENAME'] = __FILE__; |
422 | 422 | |
423 | - foreach(array('httpsdocs','httpdocs','htdocs','html','www') as $docroottop) |
|
423 | + foreach (array('httpsdocs', 'httpdocs', 'htdocs', 'html', 'www') as $docroottop) |
|
424 | 424 | { |
425 | - $parts = explode($docroottop,__FILE__); |
|
425 | + $parts = explode($docroottop, __FILE__); |
|
426 | 426 | if (count($parts) == 2) |
427 | 427 | { |
428 | 428 | $_SERVER['DOCUMENT_ROOT'] = $parts[0].$docroottop; |
429 | - $_SERVER['PHP_SELF'] = str_replace('\\','/',$parts[1]); |
|
429 | + $_SERVER['PHP_SELF'] = str_replace('\\', '/', $parts[1]); |
|
430 | 430 | break; |
431 | 431 | } |
432 | 432 | } |
@@ -436,9 +436,9 @@ discard block |
||
436 | 436 | /** |
437 | 437 | * Echos usage message |
438 | 438 | */ |
439 | -function do_usage($what='') |
|
439 | +function do_usage($what = '') |
|
440 | 440 | { |
441 | - echo lang('Usage: %1 command [additional options]',basename($_SERVER['argv'][0]))."\n\n"; |
|
441 | + echo lang('Usage: %1 command [additional options]', basename($_SERVER['argv'][0]))."\n\n"; |
|
442 | 442 | |
443 | 443 | if (!$what) |
444 | 444 | { |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | if ($what == 'config') |
454 | 454 | { |
455 | 455 | echo ' --files-dir, --backup-dir, --temp-dir '.lang('path to various directories: have to exist and be writeable by the webserver')."\n"; |
456 | - echo ' --webserver-url '.lang('eg. /egroupware or http://domain.com/egroupware, default: %1',str_replace('/setup/setup-cli.php','',$_SERVER['PHP_SELF']))."\n"; |
|
456 | + echo ' --webserver-url '.lang('eg. /egroupware or http://domain.com/egroupware, default: %1', str_replace('/setup/setup-cli.php', '', $_SERVER['PHP_SELF']))."\n"; |
|
457 | 457 | echo ' --mailserver '.lang('host,port(143),[domain],[{standard(default)|vmailmgr = add domain for mailserver login}]').',[starttls|ssl|tls]'."\n"; |
458 | 458 | echo ' --smtpserver '.lang('host,[smtp port],[smtp user],[smtp password],[auth session user/pw=yes|no],[starttls|ssl|tls],[account user editable=yes|no],[further identities=yes|no]')."\n"; |
459 | 459 | echo ' --smtp '.lang('MTA (with LDAP): [yes(user edit forwarding)],emailadmin_smtp(|_sql|_ldap|_ads|_qmail|_mandriva|_dbmailuser|_suse)')."\n"; |
@@ -504,13 +504,13 @@ discard block |
||
504 | 504 | echo '--charsets '.lang('charsets used by the different languages')."\n"; |
505 | 505 | echo '--exit-codes '.lang('all exit codes of the command line interface')."\n"; |
506 | 506 | } |
507 | - if (!$what || !in_array($what,array('config','header','list'))) |
|
507 | + if (!$what || !in_array($what, array('config', 'header', 'list'))) |
|
508 | 508 | { |
509 | 509 | echo '--help [config|header|list] '.lang('gives further options')."\n"; |
510 | 510 | } |
511 | 511 | } |
512 | 512 | |
513 | -function fail($exit_code,$message) |
|
513 | +function fail($exit_code, $message) |
|
514 | 514 | { |
515 | 515 | echo $message."\n"; |
516 | 516 | exit($exit_code); |
@@ -526,40 +526,40 @@ discard block |
||
526 | 526 | */ |
527 | 527 | function list_exit_codes() |
528 | 528 | { |
529 | - error_reporting(error_reporting() & ~E_NOTICE); |
|
529 | + error_reporting(error_reporting()&~E_NOTICE); |
|
530 | 530 | |
531 | 531 | $codes = array('Ok'); |
532 | 532 | $setup_dir = EGW_SERVER_ROOT.'/setup/'; |
533 | 533 | //$files = array('setup-cli.php'); |
534 | - foreach(scandir($setup_dir.'/inc') as $file) |
|
534 | + foreach (scandir($setup_dir.'/inc') as $file) |
|
535 | 535 | { |
536 | - if (substr($file,0,strlen('class.setup_cmd')) == 'class.setup_cmd') |
|
536 | + if (substr($file, 0, strlen('class.setup_cmd')) == 'class.setup_cmd') |
|
537 | 537 | { |
538 | 538 | $files[] = 'inc/'.$file; |
539 | 539 | } |
540 | 540 | } |
541 | - foreach($files as $file) |
|
541 | + foreach ($files as $file) |
|
542 | 542 | { |
543 | 543 | $content = file_get_contents($setup_dir.'/'.$file); |
544 | 544 | |
545 | 545 | $matches = null; |
546 | - if (preg_match_all('/throw new (egw_exception[a-z_]*)\((.*),([0-9]+)\);/m',$content,$matches)) |
|
546 | + if (preg_match_all('/throw new (egw_exception[a-z_]*)\((.*),([0-9]+)\);/m', $content, $matches)) |
|
547 | 547 | { |
548 | 548 | //echo $file.":\n"; print_r($matches); |
549 | - foreach($matches[3] as $key => $code) |
|
549 | + foreach ($matches[3] as $key => $code) |
|
550 | 550 | { |
551 | 551 | //if (isset($codes[$code])) echo "$file redifines #$code: {$codes[$code]}\n"; |
552 | 552 | |
553 | - $src = preg_replace('/self::\$[a-z_>-]+/i', "''", $matches[2][$key]); // gives fatal error otherwise |
|
554 | - @eval($src='$codes['.$code.'] = '.$src.';'); |
|
553 | + $src = preg_replace('/self::\$[a-z_>-]+/i', "''", $matches[2][$key]); // gives fatal error otherwise |
|
554 | + @eval($src = '$codes['.$code.'] = '.$src.';'); |
|
555 | 555 | //echo "- codes[$code] => '{$codes[$code]}'\n"; |
556 | 556 | } |
557 | 557 | //echo $file.":\n"; print_r($codes); |
558 | 558 | } |
559 | 559 | } |
560 | - ksort($codes,SORT_NUMERIC); |
|
561 | - foreach($codes as $num => $msg) |
|
560 | + ksort($codes, SORT_NUMERIC); |
|
561 | + foreach ($codes as $num => $msg) |
|
562 | 562 | { |
563 | - echo $num."\t".str_replace("\n","\n\t",$msg)."\n"; |
|
563 | + echo $num."\t".str_replace("\n", "\n\t", $msg)."\n"; |
|
564 | 564 | } |
565 | 565 | } |
@@ -15,10 +15,13 @@ discard block |
||
15 | 15 | |
16 | 16 | chdir(dirname(__FILE__)); // to enable our relative pathes to work |
17 | 17 | |
18 | -if (php_sapi_name() !== 'cli') // security precaution: forbit calling setup-cli as web-page |
|
18 | +if (php_sapi_name() !== 'cli') |
|
19 | +{ |
|
20 | + // security precaution: forbit calling setup-cli as web-page |
|
19 | 21 | { |
20 | 22 | die('<h1>setup-cli.php must NOT be called as web-page --> exiting !!!</h1>'); |
21 | 23 | } |
24 | +} |
|
22 | 25 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); |
23 | 26 | |
24 | 27 | $dry_run = false; |
@@ -33,7 +36,11 @@ discard block |
||
33 | 36 | } |
34 | 37 | $arguments = $_SERVER['argv']; |
35 | 38 | $action = array_shift($arguments); |
36 | - if (isset($arguments[0])) list($_POST['FormDomain']) = explode(',',$arguments[0]); // header include needs that to detects the right domain |
|
39 | + if (isset($arguments[0])) |
|
40 | + { |
|
41 | + list($_POST['FormDomain']) = explode(',',$arguments[0]); |
|
42 | + } |
|
43 | + // header include needs that to detects the right domain |
|
37 | 44 | } |
38 | 45 | else |
39 | 46 | { |
@@ -51,7 +58,10 @@ discard block |
||
51 | 58 | // check if date.timezone is set, report it and set something if not, as it gives tons of errors in install log |
52 | 59 | if (!ini_get('date.timezone')) |
53 | 60 | { |
54 | - if (!($tz = date_default_timezone_get())) $tz = 'UTC'; |
|
61 | + if (!($tz = date_default_timezone_get())) |
|
62 | + { |
|
63 | + $tz = 'UTC'; |
|
64 | + } |
|
55 | 65 | echo "No default timezone (php.ini date.timezone) set, we temporary set '$tz'. You should fix that permanent!\n"; |
56 | 66 | ini_set('date.timezone',$tz); |
57 | 67 | } |
@@ -132,13 +142,19 @@ discard block |
||
132 | 142 | foreach($arguments as $arg) |
133 | 143 | { |
134 | 144 | list($name,$value) = explode('=',$arg,2); |
135 | - if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
145 | + if(property_exists('admin_cmd',$name)) |
|
146 | + { |
|
147 | + // dont allow to overwrite admin_cmd properties |
|
136 | 148 | { |
137 | 149 | throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
138 | 150 | } |
139 | - if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
151 | + } |
|
152 | + if (substr($name,-1) == ']') |
|
153 | + { |
|
154 | + // allow 1-dim. arrays |
|
140 | 155 | { |
141 | 156 | list($name,$sub) = explode('[',substr($name,0,-1),2); |
157 | + } |
|
142 | 158 | $args[$name][$sub] = $value; |
143 | 159 | } |
144 | 160 | else |
@@ -148,7 +164,10 @@ discard block |
||
148 | 164 | } |
149 | 165 | $cmd = new $class($args); |
150 | 166 | $msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run); |
151 | - if (is_array($msg)) $msg = print_r($msg,true); |
|
167 | + if (is_array($msg)) |
|
168 | + { |
|
169 | + $msg = print_r($msg,true); |
|
170 | + } |
|
152 | 171 | echo "$msg\n"; |
153 | 172 | break; |
154 | 173 | } |
@@ -164,14 +183,20 @@ discard block |
||
164 | 183 | function do_config($args) |
165 | 184 | { |
166 | 185 | $arg0 = explode(',',array_shift($args)); |
167 | - if (!($domain = @array_shift($arg0))) $domain = 'default'; |
|
186 | + if (!($domain = @array_shift($arg0))) |
|
187 | + { |
|
188 | + $domain = 'default'; |
|
189 | + } |
|
168 | 190 | $user = @array_shift($arg0); |
169 | 191 | $password = @array_shift($arg0); |
170 | 192 | _fetch_user_password($user,$password); |
171 | 193 | |
172 | - if ($arg0) // direct assignments (name=value,...) left |
|
194 | + if ($arg0) |
|
195 | + { |
|
196 | + // direct assignments (name=value,...) left |
|
173 | 197 | { |
174 | 198 | array_unshift($args,implode(',',$arg0)); |
199 | + } |
|
175 | 200 | array_unshift($args,'--config'); |
176 | 201 | } |
177 | 202 | |
@@ -238,9 +263,15 @@ discard block |
||
238 | 263 | { |
239 | 264 | $options[0] = $domain; |
240 | 265 | |
241 | - if ($quite_check) ob_start(); |
|
266 | + if ($quite_check) |
|
267 | + { |
|
268 | + ob_start(); |
|
269 | + } |
|
242 | 270 | _check_auth_config(implode(',',$options),14); |
243 | - if ($quite_check) ob_end_clean(); |
|
271 | + if ($quite_check) |
|
272 | + { |
|
273 | + ob_end_clean(); |
|
274 | + } |
|
244 | 275 | |
245 | 276 | if ($backup == 'no') |
246 | 277 | { |
@@ -316,7 +347,10 @@ discard block |
||
316 | 347 | function _check_auth_config($arg,$stop,$set_lang=true) |
317 | 348 | { |
318 | 349 | $options = explode(',',$arg); |
319 | - if (!($domain = array_shift($options))) $domain = 'default'; |
|
350 | + if (!($domain = array_shift($options))) |
|
351 | + { |
|
352 | + $domain = 'default'; |
|
353 | + } |
|
320 | 354 | $user = array_shift($options); |
321 | 355 | $password = array_shift($options); |
322 | 356 | _fetch_user_password($user,$password); |
@@ -324,7 +358,10 @@ discard block |
||
324 | 358 | setup_cmd::check_installed($domain,$stop,true); |
325 | 359 | |
326 | 360 | // reset charset for the output to the charset used by the OS |
327 | - if ($set_lang) $GLOBALS['egw_setup']->system_charset = $GLOBALS['charset']; |
|
361 | + if ($set_lang) |
|
362 | + { |
|
363 | + $GLOBALS['egw_setup']->system_charset = $GLOBALS['charset']; |
|
364 | + } |
|
328 | 365 | |
329 | 366 | setup_cmd::check_setup_auth($user,$password,$domain); |
330 | 367 | |
@@ -360,7 +397,10 @@ discard block |
||
360 | 397 | function _fetch_user_password(&$user,&$password) |
361 | 398 | { |
362 | 399 | // read password from enviroment or query it from user, if not given |
363 | - if (!$user) $user = 'admin'; |
|
400 | + if (!$user) |
|
401 | + { |
|
402 | + $user = 'admin'; |
|
403 | + } |
|
364 | 404 | if (!$password && !($password = $_SERVER['EGW_CLI_PASSWORD'])) |
365 | 405 | { |
366 | 406 | echo lang('Admin password to header manager').' '; |
@@ -406,9 +446,15 @@ discard block |
||
406 | 446 | list($code,$language) = explode("\t",$line); |
407 | 447 | $languages[$code] = $language; |
408 | 448 | } |
409 | - if (isset($languages[$lang.'-'.$nation])) return $lang.'-'.$nation; |
|
449 | + if (isset($languages[$lang.'-'.$nation])) |
|
450 | + { |
|
451 | + return $lang.'-'.$nation; |
|
452 | + } |
|
410 | 453 | |
411 | - if (isset($languages[$lang])) return $lang; |
|
454 | + if (isset($languages[$lang])) |
|
455 | + { |
|
456 | + return $lang; |
|
457 | + } |
|
412 | 458 | |
413 | 459 | return 'en'; |
414 | 460 | } |
@@ -448,7 +494,10 @@ discard block |
||
448 | 494 | if (!$what || $what == 'config') |
449 | 495 | { |
450 | 496 | echo '--config '.lang('domain(default),[config user(admin)],password,[name=value,...] sets config values beside:')."\n"; |
451 | - if (!$what) echo ' --help config '.lang('gives further options')."\n"; |
|
497 | + if (!$what) |
|
498 | + { |
|
499 | + echo ' --help config '.lang('gives further options')."\n"; |
|
500 | + } |
|
452 | 501 | } |
453 | 502 | if ($what == 'config') |
454 | 503 | { |
@@ -477,7 +526,10 @@ discard block |
||
477 | 526 | echo lang('Create or edit the EGroupware configuration file: header.inc.php:')."\n"; |
478 | 527 | echo '--create-header '.lang('header-password[,header-user(admin)]')."\n"; |
479 | 528 | echo '--edit-header '.lang('[header-password],[header-user],[new-password],[new-user]')."\n"; |
480 | - if (!$what) echo ' --help header '.lang('gives further options')."\n"; |
|
529 | + if (!$what) |
|
530 | + { |
|
531 | + echo ' --help header '.lang('gives further options')."\n"; |
|
532 | + } |
|
481 | 533 | } |
482 | 534 | if ($what == 'header') |
483 | 535 | { |