Completed
Push — 14.2 ( 26c8f8...a8a1c7 )
by Ralf
40:44 queued 14:52
created
setup/inc/class.setup_detection.inc.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 	{
26 26
 		$setup_info = array();
27 27
 		$d = dir(EGW_SERVER_ROOT);
28
-		while($entry=$d->read())
28
+		while ($entry = $d->read())
29 29
 		{
30
-			if($entry != ".." && $entry != 'setup' && is_dir(EGW_SERVER_ROOT . '/' . $entry))
30
+			if ($entry != ".." && $entry != 'setup' && is_dir(EGW_SERVER_ROOT.'/'.$entry))
31 31
 			{
32
-				$f = EGW_SERVER_ROOT . '/' . $entry . '/setup/setup.inc.php';
33
-				if (@file_exists ($f))
32
+				$f = EGW_SERVER_ROOT.'/'.$entry.'/setup/setup.inc.php';
33
+				if (@file_exists($f))
34 34
 				{
35 35
 					include($f);
36 36
 					$setup_info[$entry]['filename'] = $f;
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 	 * @param array $setup_info
51 51
 	 * @return array $setup_info
52 52
 	 */
53
-	function get_db_versions($setup_info=null)
53
+	function get_db_versions($setup_info = null)
54 54
 	{
55 55
 		try {	// catch DB errors
56 56
 			$GLOBALS['egw_setup']->set_table_names();
57 57
 
58
-			if($GLOBALS['egw_setup']->table_exist(array($GLOBALS['egw_setup']->applications_table),true))
58
+			if ($GLOBALS['egw_setup']->table_exist(array($GLOBALS['egw_setup']->applications_table), true))
59 59
 			{
60 60
 				/* one of these tables exists. checking for post/pre beta version */
61
-				if($GLOBALS['egw_setup']->applications_table != 'applications')
61
+				if ($GLOBALS['egw_setup']->applications_table != 'applications')
62 62
 				{
63
-					$GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->applications_table,'*',false,__LINE__,__FILE__);
64
-					while(@$GLOBALS['egw_setup']->db->next_record())
63
+					$GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->applications_table, '*', false, __LINE__, __FILE__);
64
+					while (@$GLOBALS['egw_setup']->db->next_record())
65 65
 					{
66 66
 						$app = $GLOBALS['egw_setup']->db->f('app_name');
67 67
 						if (!isset($setup_info[$app]))	// app source no longer there
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 					}
78 78
 					/* This is to catch old setup installs that did not have phpgwapi listed as an app */
79 79
 					$tmp = @$setup_info['phpgwapi']['version']; /* save the file version */
80
-					if(!@$setup_info['phpgwapi']['currentver'])
80
+					if (!@$setup_info['phpgwapi']['currentver'])
81 81
 					{
82 82
 						$setup_info['phpgwapi']['currentver'] = $setup_info['admin']['currentver'];
83 83
 						$setup_info['phpgwapi']['version'] = $setup_info['admin']['currentver'];
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 				else
98 98
 				{
99 99
 					$GLOBALS['egw_setup']->db->query('select * from applications');
100
-					while(@$GLOBALS['egw_setup']->db->next_record())
100
+					while (@$GLOBALS['egw_setup']->db->next_record())
101 101
 					{
102
-						if($GLOBALS['egw_setup']->db->f('app_name') == 'admin')
102
+						if ($GLOBALS['egw_setup']->db->f('app_name') == 'admin')
103 103
 						{
104 104
 							$setup_info['phpgwapi']['currentver'] = $GLOBALS['egw_setup']->db->f('app_version');
105 105
 						}
@@ -127,25 +127,25 @@  discard block
 block discarded – undo
127 127
 	 * 	V	Version mismatch at end of upgrade (Not used, proposed only)
128 128
 	 * 	M	Missing files at start of upgrade (Not used, proposed only)
129 129
 	 */
130
-	function compare_versions($setup_info,$try_downgrade=false)
130
+	function compare_versions($setup_info, $try_downgrade = false)
131 131
 	{
132
-		foreach($setup_info as $key => $value)
132
+		foreach ($setup_info as $key => $value)
133 133
 		{
134 134
 			//echo '<br>'.$value['name'].'STATUS: '.$value['status'];
135 135
 			/* Only set this if it has not already failed to upgrade - Milosch */
136
-			if(!( (@$value['status'] == 'F') || (@$value['status'] == 'C') ))
136
+			if (!((@$value['status'] == 'F') || (@$value['status'] == 'C')))
137 137
 			{
138 138
 				//if ($setup_info[$key]['currentver'] > $setup_info[$key]['version'])
139
-				if(!$try_downgrade && $GLOBALS['egw_setup']->amorethanb($value['currentver'],@$value['version']) ||
139
+				if (!$try_downgrade && $GLOBALS['egw_setup']->amorethanb($value['currentver'], @$value['version']) ||
140 140
 					$value['version'] == 'deleted')
141 141
 				{
142 142
 					$setup_info[$key]['status'] = 'V';
143 143
 				}
144
-				elseif(@$value['currentver'] == @$value['version'])
144
+				elseif (@$value['currentver'] == @$value['version'])
145 145
 				{
146 146
 					$setup_info[$key]['status'] = 'C';
147 147
 				}
148
-				elseif($GLOBALS['egw_setup']->alessthanb(@$value['currentver'],@$value['version']))
148
+				elseif ($GLOBALS['egw_setup']->alessthanb(@$value['currentver'], @$value['version']))
149 149
 				{
150 150
 					$setup_info[$key]['status'] = 'U';
151 151
 				}
@@ -162,35 +162,35 @@  discard block
 block discarded – undo
162 162
 	function check_depends($setup_info)
163 163
 	{
164 164
 		/* Run the list of apps */
165
-		foreach($setup_info as $key => $value)
165
+		foreach ($setup_info as $key => $value)
166 166
 		{
167 167
 			/* Does this app have any depends */
168
-			if(isset($value['depends']))
168
+			if (isset($value['depends']))
169 169
 			{
170 170
 				/* If so find out which apps it depends on */
171
-				foreach($value['depends'] as $depkey => $depvalue)
171
+				foreach ($value['depends'] as $depkey => $depvalue)
172 172
 				{
173 173
 					/* I set this to False until we find a compatible version of this app */
174 174
 					$setup_info['depends'][$depkey]['status'] = False;
175 175
 					/* Now we loop thru the versions looking for a compatible version */
176 176
 
177
-					foreach($depvalue['versions'] as $depsvalue)
177
+					foreach ($depvalue['versions'] as $depsvalue)
178 178
 					{
179 179
 						$currentver = $setup_info[$depvalue['appname']]['currentver'];
180
-						if ($depvalue['appname'] == 'phpgwapi' && substr($currentver,0,6) == '0.9.99')
180
+						if ($depvalue['appname'] == 'phpgwapi' && substr($currentver, 0, 6) == '0.9.99')
181 181
 						{
182 182
 							$currentver = '0.9.14.508';
183 183
 						}
184 184
 						$major = $GLOBALS['egw_setup']->get_major($currentver);
185
-						if ($major >= $depsvalue || $major == $depsvalue && substr($major,0,strlen($depsvalue)+1) == $depsvalue.'.')
185
+						if ($major >= $depsvalue || $major == $depsvalue && substr($major, 0, strlen($depsvalue) + 1) == $depsvalue.'.')
186 186
 						{
187 187
 							$setup_info['depends'][$depkey]['status'] = True;
188 188
 						}
189 189
 						else	// check if majors are equal and minors greater or equal
190 190
 						{
191 191
 							$major_depsvalue = $GLOBALS['egw_setup']->get_major($depsvalue);
192
-							$tmp = explode('.',$depsvalue); $minor_depsvalue = array_pop($tmp);
193
-							$tmp2 = explode('.',$currentver); $minor = array_pop($tmp2);
192
+							$tmp = explode('.', $depsvalue); $minor_depsvalue = array_pop($tmp);
193
+							$tmp2 = explode('.', $currentver); $minor = array_pop($tmp2);
194 194
 							if ($major == $major_depsvalue && $minor <= $minor_depsvalue)
195 195
 							{
196 196
 								$setup_info['depends'][$depkey]['status'] = True;
@@ -203,17 +203,17 @@  discard block
 block discarded – undo
203 203
 				 Finally, we loop through the dependencies again to look for apps that still have a failure status
204 204
 				 If we find one, we set the apps overall status as a dependency failure.
205 205
 				*/
206
-				foreach($value['depends'] as $depkey => $depvalue)
206
+				foreach ($value['depends'] as $depkey => $depvalue)
207 207
 				{
208 208
 					if ($setup_info['depends'][$depkey]['status'] == False)
209 209
 					{
210 210
 						/* Only set this if it has not already failed to upgrade - Milosch */
211
-						if($setup_info[$key]['status'] != 'F')//&& $setup_info[$key]['status'] != 'C')
211
+						if ($setup_info[$key]['status'] != 'F')//&& $setup_info[$key]['status'] != 'C')
212 212
 						{
213 213
 							/* Added check for status U - uninstalled apps carry this flag (upgrade from nothing == install).
214 214
 							 * This should fix apps showing post-install dep failure when they are not yet installed.
215 215
 							 */
216
-							if($setup_info[$key]['status'] == 'C' || $setup_info[$key]['status'] == 'U')
216
+							if ($setup_info[$key]['status'] == 'C' || $setup_info[$key]['status'] == 'U')
217 217
 							{
218 218
 								$setup_info[$key]['status'] = 'D';
219 219
 							}
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	function upgrade_exclude($setup_info)
237 237
 	{
238
-		foreach($setup_info as $key => $value)
238
+		foreach ($setup_info as $key => $value)
239 239
 		{
240
-			if(isset($value['no_mass_update']))
240
+			if (isset($value['no_mass_update']))
241 241
 			{
242 242
 				unset($setup_info[$key]);
243 243
 			}
@@ -252,24 +252,24 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	function check_header()
254 254
 	{
255
-		if(!file_exists(EGW_SERVER_ROOT.'/header.inc.php') || filesize(EGW_SERVER_ROOT.'/header.inc.php') < 200)
255
+		if (!file_exists(EGW_SERVER_ROOT.'/header.inc.php') || filesize(EGW_SERVER_ROOT.'/header.inc.php') < 200)
256 256
 		{
257 257
 			$GLOBALS['egw_info']['setup']['header_msg'] = 'Stage One';
258 258
 			return '1';
259 259
 		}
260 260
 		else
261 261
 		{
262
-			if(!@isset($GLOBALS['egw_info']['server']['header_admin_password']))
262
+			if (!@isset($GLOBALS['egw_info']['server']['header_admin_password']))
263 263
 			{
264 264
 				$GLOBALS['egw_info']['setup']['header_msg'] = 'Stage One (No header admin password set)';
265 265
 				return '2';
266 266
 			}
267
-			elseif(!@isset($GLOBALS['egw_domain']))
267
+			elseif (!@isset($GLOBALS['egw_domain']))
268 268
 			{
269 269
 				$GLOBALS['egw_info']['setup']['header_msg'] = 'Stage One (Add domains to your header.inc.php)';
270 270
 				return '3';
271 271
 			}
272
-			elseif(@$GLOBALS['egw_info']['server']['versions']['header'] != @$GLOBALS['egw_info']['server']['versions']['current_header'])
272
+			elseif (@$GLOBALS['egw_info']['server']['versions']['header'] != @$GLOBALS['egw_info']['server']['versions']['current_header'])
273 273
 			{
274 274
 				$GLOBALS['egw_info']['setup']['header_msg'] = 'Stage One (Upgrade your header.inc.php)';
275 275
 				return '4';
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 * @param array $setup_info =null default use $GLOBALS['setup_info']
287 287
 	 * @return int 1=no database, 3=empty, 4=need upgrade, 10=complete
288 288
 	 */
289
-	function check_db($setup_info=null)
289
+	function check_db($setup_info = null)
290 290
 	{
291 291
 		if (!$setup_info) $setup_info = $GLOBALS['setup_info'];
292 292
 
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
 			if (!$GLOBALS['egw_setup']->db->Link_ID)
295 295
 			{
296 296
 				$old = error_reporting();
297
-				error_reporting($old & ~E_WARNING);	// no warnings
297
+				error_reporting($old&~E_WARNING); // no warnings
298 298
 				$GLOBALS['egw_setup']->db->connect();
299 299
 				error_reporting($old);
300 300
 
301 301
 				$GLOBALS['egw_setup']->set_table_names();
302 302
 			}
303 303
 		}
304
-		catch(egw_exception_db $e) {
304
+		catch (egw_exception_db $e) {
305 305
 			// ignore error
306 306
 		}
307 307
 
@@ -310,14 +310,14 @@  discard block
 block discarded – undo
310 310
 			$GLOBALS['egw_info']['setup']['header_msg'] = 'Stage 1 (Create Database)';
311 311
 			return 1;
312 312
 		}
313
-		if(!isset($setup_info['phpgwapi']['currentver']))
313
+		if (!isset($setup_info['phpgwapi']['currentver']))
314 314
 		{
315 315
 			$setup_info = $this->get_db_versions($setup_info);
316 316
 		}
317 317
 		//_debug_array($setup_info);
318 318
 		if (isset($setup_info['phpgwapi']['currentver']))
319 319
 		{
320
-			if(@$setup_info['phpgwapi']['currentver'] == @$setup_info['phpgwapi']['version'])
320
+			if (@$setup_info['phpgwapi']['currentver'] == @$setup_info['phpgwapi']['version'])
321 321
 			{
322 322
 				$GLOBALS['egw_info']['setup']['header_msg'] = 'Stage 1 (Tables Complete)';
323 323
 				return 10;
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
 	 */
352 352
 	function check_config()
353 353
 	{
354
-		if(@$GLOBALS['egw_info']['setup']['stage']['db'] != 10)
354
+		if (@$GLOBALS['egw_info']['setup']['stage']['db'] != 10)
355 355
 		{
356 356
 			return '';
357 357
 		}
358 358
 
359 359
 		try {	// catch db errors
360
-			$GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table,'config_name,config_value',array('config_app' => 'phpgwapi'),__LINE__,__FILE__);
361
-			while($GLOBALS['egw_setup']->db->next_record())
360
+			$GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table, 'config_name,config_value', array('config_app' => 'phpgwapi'), __LINE__, __FILE__);
361
+			while ($GLOBALS['egw_setup']->db->next_record())
362 362
 			{
363 363
 				$config[$GLOBALS['egw_setup']->db->f(0)] = $GLOBALS['egw_setup']->db->f(1);
364 364
 			}
@@ -368,21 +368,21 @@  discard block
 block discarded – undo
368 368
 			// ignore db errors
369 369
 		}
370 370
 		$GLOBALS['egw_info']['setup']['header_msg'] = 'Stage 2 (Needs Configuration)';
371
-		if(!count($config))
371
+		if (!count($config))
372 372
 		{
373 373
 			return 1;
374 374
 		}
375
-		$config_errors =& $GLOBALS['egw_info']['setup']['config_errors'];
375
+		$config_errors = & $GLOBALS['egw_info']['setup']['config_errors'];
376 376
 		$GLOBALS['egw_info']['setup']['config_errors'] = array();
377 377
 		$error_msg = null;
378
-		if (!$this->check_dir($config['temp_dir'],$error_msg))
378
+		if (!$this->check_dir($config['temp_dir'], $error_msg))
379 379
 		{
380
-			$config_errors[] = lang("Your temporary directory '%1' %2",$config['temp_dir'],$error_msg);
380
+			$config_errors[] = lang("Your temporary directory '%1' %2", $config['temp_dir'], $error_msg);
381 381
 		}
382 382
 
383
-		if (!$this->check_dir($config['files_dir'],$error_msg,true))
383
+		if (!$this->check_dir($config['files_dir'], $error_msg, true))
384 384
 		{
385
-			$config_errors[] = lang("Your files directory '%1' %2",$config['files_dir'],$error_msg);
385
+			$config_errors[] = lang("Your files directory '%1' %2", $config['files_dir'], $error_msg);
386 386
 		}
387 387
 		// set and create the default backup_dir
388 388
 		if (@is_writeable($config['files_dir']) && empty($config['backup_dir']))
@@ -390,35 +390,35 @@  discard block
 block discarded – undo
390 390
 			$config['backup_dir'] = $config['files_dir'].'/db_backup';
391 391
 			if (!is_dir($config['backup_dir']) && mkdir($config['backup_dir']))
392 392
 			{
393
-				$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->config_table,array(
393
+				$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->config_table, array(
394 394
 					'config_value' => $config['backup_dir'],
395
-				),array(
395
+				), array(
396 396
 					'config_app'  => 'phpgwapi',
397 397
 					'config_name' => 'backup_dir',
398
-				),__LINE__,__FILE__);
398
+				), __LINE__, __FILE__);
399 399
 			}
400 400
 		}
401 401
 		if (isset($config['backup_mincount']))
402 402
 		{
403
-			$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->config_table,array(
403
+			$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->config_table, array(
404 404
 				'config_value' => $config['backup_mincount'],
405
-				),array(
405
+				), array(
406 406
 				'config_app'  => 'phpgwapi',
407 407
 				'config_name' => 'backup_mincount',
408
-			),__LINE__,__FILE__);
408
+			), __LINE__, __FILE__);
409 409
 		}
410 410
 		if (isset($config['backup_files']))
411 411
 		{
412
-			$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->config_table,array(
412
+			$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->config_table, array(
413 413
 				'config_value' => (int)$config['backup_files'],
414
-				),array(
414
+				), array(
415 415
 				'config_app'  => 'phpgwapi',
416 416
 				'config_name' => 'backup_files',
417
-			),__LINE__,__FILE__);
417
+			), __LINE__, __FILE__);
418 418
 		}
419
-		if (!$this->check_dir($config['backup_dir'],$error_msg,true))
419
+		if (!$this->check_dir($config['backup_dir'], $error_msg, true))
420 420
 		{
421
-			$config_errors[] = lang("Your backup directory '%1' %2",$config['backup_dir'],$error_msg);
421
+			$config_errors[] = lang("Your backup directory '%1' %2", $config['backup_dir'], $error_msg);
422 422
 		}
423 423
 		if ($config_errors)
424 424
 		{
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 
431 431
 	function check_lang($check = True)
432 432
 	{
433
-		if($check && $GLOBALS['egw_info']['setup']['stage']['db'] != 10)
433
+		if ($check && $GLOBALS['egw_info']['setup']['stage']['db'] != 10)
434 434
 		{
435 435
 			return '';
436 436
 		}
@@ -439,21 +439,21 @@  discard block
 block discarded – undo
439 439
 			$GLOBALS['setup_info'] = $GLOBALS['egw_setup']->detection->get_db_versions($GLOBALS['setup_info']);
440 440
 		}
441 441
 		try {
442
-			$GLOBALS['egw_setup']->db->query($q = "SELECT DISTINCT lang FROM {$GLOBALS['egw_setup']->lang_table}",__LINE__,__FILE__);
442
+			$GLOBALS['egw_setup']->db->query($q = "SELECT DISTINCT lang FROM {$GLOBALS['egw_setup']->lang_table}", __LINE__, __FILE__);
443 443
 		}
444 444
 		catch (egw_exception_db $e) {
445 445
 			// ignore db error
446 446
 		}
447
-		if($e || $GLOBALS['egw_setup']->db->num_rows() == 0)
447
+		if ($e || $GLOBALS['egw_setup']->db->num_rows() == 0)
448 448
 		{
449 449
 			$GLOBALS['egw_info']['setup']['header_msg'] = 'Stage 3 (No languages installed)';
450 450
 			return 1;
451 451
 		}
452
-		while(@$GLOBALS['egw_setup']->db->next_record())
452
+		while (@$GLOBALS['egw_setup']->db->next_record())
453 453
 		{
454 454
 			$GLOBALS['egw_info']['setup']['installed_langs'][$GLOBALS['egw_setup']->db->f('lang')] = $GLOBALS['egw_setup']->db->f('lang');
455 455
 		}
456
-		foreach($GLOBALS['egw_info']['setup']['installed_langs'] as $value)
456
+		foreach ($GLOBALS['egw_info']['setup']['installed_langs'] as $value)
457 457
 		{
458 458
 			$sql = "SELECT lang_name FROM {$GLOBALS['egw_setup']->languages_table} WHERE lang_id = '".$value."'";
459 459
 			$GLOBALS['egw_setup']->db->query($sql);
@@ -471,19 +471,19 @@  discard block
 block discarded – undo
471 471
 	 * @param $appname
472 472
 	 * @param $any		optional, set to True to see if any of the apps tables are installed
473 473
 	 */
474
-	function check_app_tables($appname,$any=False)
474
+	function check_app_tables($appname, $any = False)
475 475
 	{
476 476
 		$none = 0;
477 477
 		$setup_info = $GLOBALS['setup_info'];
478 478
 
479
-		if(@$setup_info[$appname]['tables'])
479
+		if (@$setup_info[$appname]['tables'])
480 480
 		{
481 481
 			/* Make a copy, else we send some callers into an infinite loop */
482 482
 			$copy = $setup_info;
483 483
 			$tables = Array();
484 484
 			try {
485 485
 				$table_names = $GLOBALS['egw_setup']->db->table_names();
486
-				foreach($table_names as $key => $val)
486
+				foreach ($table_names as $key => $val)
487 487
 				{
488 488
 					$tables[] = $val['table_name'];
489 489
 				}
@@ -492,19 +492,19 @@  discard block
 block discarded – undo
492 492
 				unset($e);
493 493
 				// ignore db error
494 494
 			}
495
-			foreach($copy[$appname]['tables'] as $key => $val)
495
+			foreach ($copy[$appname]['tables'] as $key => $val)
496 496
 			{
497
-				if($GLOBALS['DEBUG'])
497
+				if ($GLOBALS['DEBUG'])
498 498
 				{
499
-					echo '<br>check_app_tables(): Checking: ' . $appname . ',table: ' . $val;
499
+					echo '<br>check_app_tables(): Checking: '.$appname.',table: '.$val;
500 500
 				}
501
-				if(!in_array($val,$tables) && !in_array(strtolower($val),$tables))	// names in tables might be lowercase
501
+				if (!in_array($val, $tables) && !in_array(strtolower($val), $tables))	// names in tables might be lowercase
502 502
 				{
503
-					if($GLOBALS['DEBUG'])
503
+					if ($GLOBALS['DEBUG'])
504 504
 					{
505
-						echo '<br>check_app_tables(): ' . $val . ' missing!';
505
+						echo '<br>check_app_tables(): '.$val.' missing!';
506 506
 					}
507
-					if(!$any)
507
+					if (!$any)
508 508
 					{
509 509
 						return False;
510 510
 					}
@@ -515,9 +515,9 @@  discard block
 block discarded – undo
515 515
 				}
516 516
 				else
517 517
 				{
518
-					if($any)
518
+					if ($any)
519 519
 					{
520
-						if($GLOBALS['DEBUG'])
520
+						if ($GLOBALS['DEBUG'])
521 521
 						{
522 522
 							echo '<br>check_app_tables(): Some tables installed';
523 523
 						}
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 				}
527 527
 			}
528 528
 		}
529
-		if($none && $any)
529
+		if ($none && $any)
530 530
 		{
531
-			if($GLOBALS['DEBUG'])
531
+			if ($GLOBALS['DEBUG'])
532 532
 			{
533 533
 				echo '<br>check_app_tables(): No tables installed';
534 534
 			}
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 		else
538 538
 		{
539
-			if($GLOBALS['DEBUG'])
539
+			if ($GLOBALS['DEBUG'])
540 540
 			{
541 541
 				echo '<br>check_app_tables(): All tables installed';
542 542
 			}
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
 	 * @param boolean $check_in_docroot =false run an optional in docroot check
553 553
 	 * @return boolean
554 554
 	 */
555
-	static function check_dir($dir,&$msg,$check_in_docroot=false)
555
+	static function check_dir($dir, &$msg, $check_in_docroot = false)
556 556
 	{
557
-		if (!@is_dir($dir) && !@mkdir($dir,0700,true))
557
+		if (!@is_dir($dir) && !@mkdir($dir, 0700, true))
558 558
 		{
559 559
 			$msg = lang('does not exist');
560 560
 			return false;
@@ -566,16 +566,16 @@  discard block
 block discarded – undo
566 566
 		}
567 567
 		if ($check_in_docroot)
568 568
 		{
569
-			$docroots = array(realpath(EGW_SERVER_ROOT),realpath($_SERVER['DOCUMENT_ROOT']));
569
+			$docroots = array(realpath(EGW_SERVER_ROOT), realpath($_SERVER['DOCUMENT_ROOT']));
570 570
 			$dir = realpath($dir);
571 571
 
572 572
 			foreach ($docroots as $docroot)
573 573
 			{
574 574
 				$len = strlen($docroot);
575 575
 
576
-				if ($docroot == substr($dir,0,$len) && $len>0)
576
+				if ($docroot == substr($dir, 0, $len) && $len > 0)
577 577
 				{
578
-					$rest = substr($dir,$len);
578
+					$rest = substr($dir, $len);
579 579
 
580 580
 					if (!strlen($rest) || $rest[0] == DIRECTORY_SEPARATOR)
581 581
 					{
Please login to merge, or discard this patch.
setup/inc/hook_config_validate.inc.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
  */
31 31
 function auth_type($settings)
32 32
 {
33
-	switch($settings['auth_type'])
33
+	switch ($settings['auth_type'])
34 34
 	{
35 35
 		case 'mail':
36 36
 			if (class_exists('Horde_Imap_Client_Socket') && !in_array($settings['mail_server_type'], array('pop', 'pops')))
37 37
 			{
38
-				return;	// we use Horde code instead of imap extension
38
+				return; // we use Horde code instead of imap extension
39 39
 			}
40 40
 			try {
41 41
 				check_load_extension('imap', true);
@@ -55,33 +55,33 @@  discard block
 block discarded – undo
55 55
  */
56 56
 function vfs_storage_mode($settings)
57 57
 {
58
-	switch($settings['vfs_storage_mode'])
58
+	switch ($settings['vfs_storage_mode'])
59 59
 	{
60 60
 		case 'fs':
61
-			config::save_value('vfs_fstab','','phpgwapi');
61
+			config::save_value('vfs_fstab', '', 'phpgwapi');
62 62
 			break;
63 63
 		case 'db':
64 64
 			config::save_value('vfs_fstab', array(
65 65
 				'/' => 'sqlfs://$host/?storage=db',
66 66
 				'/apps' => 'links://$host/apps?storage=db',
67
-			),'phpgwapi');
67
+			), 'phpgwapi');
68 68
 			break;
69 69
 	}
70 70
 }
71 71
 
72 72
 function temp_dir($settings)
73 73
 {
74
-	if (!setup_detection::check_dir($settings['temp_dir'],$error_msg))
74
+	if (!setup_detection::check_dir($settings['temp_dir'], $error_msg))
75 75
 	{
76
-		$GLOBALS['config_error'] = lang("Your temporary directory '%1' %2",$settings['temp_dir'],$error_msg);
76
+		$GLOBALS['config_error'] = lang("Your temporary directory '%1' %2", $settings['temp_dir'], $error_msg);
77 77
 	}
78 78
 }
79 79
 
80 80
 function files_dir($settings)
81 81
 {
82
-	if (!setup_detection::check_dir($settings['files_dir'],$error_msg,true))
82
+	if (!setup_detection::check_dir($settings['files_dir'], $error_msg, true))
83 83
 	{
84
-		$GLOBALS['config_error'] = lang("Your files directory '%1' %2",$settings['files_dir'],$error_msg);
84
+		$GLOBALS['config_error'] = lang("Your files directory '%1' %2", $settings['files_dir'], $error_msg);
85 85
 	}
86 86
 }
87 87
 
@@ -91,20 +91,20 @@  discard block
 block discarded – undo
91 91
 	{
92 92
 		$settings['backup_dir'] = $settings['files_dir'].'/db_backup';
93 93
 	}
94
-	if (!setup_detection::check_dir($settings['backup_dir'],$error_msg,true))
94
+	if (!setup_detection::check_dir($settings['backup_dir'], $error_msg, true))
95 95
 	{
96
-		$GLOBALS['config_error'] = lang("Your backup directory '%1' %2",$settings['backup_dir'],$error_msg);
96
+		$GLOBALS['config_error'] = lang("Your backup directory '%1' %2", $settings['backup_dir'], $error_msg);
97 97
 	}
98 98
 }
99 99
 
100
-function _mcrypt_test_module_mode($module,$mode)
100
+function _mcrypt_test_module_mode($module, $mode)
101 101
 {
102 102
 	/* Data */
103 103
 	$key = 'this is a very long key, even too long for the cipher';
104 104
 	$plain_text = 'very important data';
105 105
 
106 106
 	/* Open module, and create IV */
107
-	if(!$GLOBALS['td'] = @mcrypt_module_open($module, '',$mode, ''))
107
+	if (!$GLOBALS['td'] = @mcrypt_module_open($module, '', $mode, ''))
108 108
 	{
109 109
 		@mcrypt_module_close($GLOBALS['td']);
110 110
 		return False;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	$iv = @mcrypt_create_iv($iv_size, MCRYPT_RAND);
115 115
 
116 116
 	/* Initialize encryption handle */
117
-	if(mcrypt_generic_init($GLOBALS['td'], $key, $iv) != -1)
117
+	if (mcrypt_generic_init($GLOBALS['td'], $key, $iv) != -1)
118 118
 	{
119 119
 		/* Encrypt data */
120 120
 		$c_t = mcrypt_generic($GLOBALS['td'], $plain_text);
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 	$modes = mcrypt_list_modes();
149 149
 	$algorithms = mcrypt_list_algorithms();
150 150
 
151
-	foreach($algorithms as $cipher)
151
+	foreach ($algorithms as $cipher)
152 152
 	{
153
-		if(mcrypt_module_self_test($cipher))
153
+		if (mcrypt_module_self_test($cipher))
154 154
 		{
155 155
 			$GLOBALS['ciphers'][$cipher] = array();
156
-			foreach($modes as $mode)
156
+			foreach ($modes as $mode)
157 157
 			{
158
-				if(_mcrypt_test_module_mode($cipher,$mode))
158
+				if (_mcrypt_test_module_mode($cipher, $mode))
159 159
 				{
160 160
 					$result = True;
161 161
 				}
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 function mcrypt_algo($settings)
175 175
 {
176 176
 	/* _debug_array($settings);exit; */
177
-	if(@function_exists('mcrypt_list_modes'))
177
+	if (@function_exists('mcrypt_list_modes'))
178 178
 	{
179 179
 		mcrypt_check_sanity();
180
-		if(!@$GLOBALS['ciphers'][$settings['mcrypt_algo']][$settings['mcrypt_mode']])
180
+		if (!@$GLOBALS['ciphers'][$settings['mcrypt_algo']][$settings['mcrypt_mode']])
181 181
 		{
182 182
 			$GLOBALS['config_error'] = lang('Invalid Mcrypt Algorithm/Mode combination');
183 183
 		}
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
  */
192 192
 function ldap_search_filter(&$settings)
193 193
 {
194
-	$filter =& $settings['ldap_search_filter'];
194
+	$filter = & $settings['ldap_search_filter'];
195 195
 
196 196
 	if ($filter && $filter{0} != '(') $filter = '('.$filter.')';
197 197
 }
Please login to merge, or discard this patch.