Completed
Push — 14.2 ( e07840...cec2da )
by Ralf
83:18 queued 52:04
created
api/src/Vfs.php 1 patch
Braces   +237 added lines, -62 removed lines patch added patch discarded remove patch
@@ -221,7 +221,10 @@  discard block
 block discarded – undo
221 221
 		}
222 222
 		foreach($props as &$prop)
223 223
 		{
224
-			if ($prop['name'] == $name && $prop['ns'] == $ns) return $prop;
224
+			if ($prop['name'] == $name && $prop['ns'] == $ns)
225
+			{
226
+				return $prop;
227
+			}
225 228
 		}
226 229
 		return null;
227 230
 	}
@@ -314,11 +317,17 @@  discard block
 block discarded – undo
314 317
 	 */
315 318
 	static function mount($url=null,$path=null,$check_url=null,$persitent_mount=true,$clear_fstab=false)
316 319
 	{
317
-		if (is_null($check_url)) $check_url = strpos($url,'$') === false;
320
+		if (is_null($check_url))
321
+		{
322
+			$check_url = strpos($url,'$') === false;
323
+		}
318 324
 
319
-		if (!isset($GLOBALS['egw_info']['server']['vfs_fstab']))	// happens eg. in setup
325
+		if (!isset($GLOBALS['egw_info']['server']['vfs_fstab']))
326
+		{
327
+			// happens eg. in setup
320 328
 		{
321 329
 			$api_config = Config::read('phpgwapi');
330
+		}
322 331
 			if (isset($api_config['vfs_fstab']) && is_array($api_config['vfs_fstab']))
323 332
 			{
324 333
 				self::$fstab = $api_config['vfs_fstab'];
@@ -334,12 +343,18 @@  discard block
 block discarded – undo
334 343
 		}
335 344
 		if (is_null($url) || is_null($path))
336 345
 		{
337
-			if (self::LOG_LEVEL > 1) error_log(__METHOD__.'('.array2string($url).','.array2string($path).') returns '.array2string(self::$fstab));
346
+			if (self::LOG_LEVEL > 1)
347
+			{
348
+				error_log(__METHOD__.'('.array2string($url).','.array2string($path).') returns '.array2string(self::$fstab));
349
+			}
338 350
 			return self::$fstab;
339 351
 		}
340 352
 		if (!self::$is_root)
341 353
 		{
342
-			if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($url).','.array2string($path).') permission denied, you are NOT root!');
354
+			if (self::LOG_LEVEL > 0)
355
+			{
356
+				error_log(__METHOD__.'('.array2string($url).','.array2string($path).') permission denied, you are NOT root!');
357
+			}
343 358
 			return false;	// only root can mount
344 359
 		}
345 360
 		if ($clear_fstab)
@@ -348,14 +363,20 @@  discard block
 block discarded – undo
348 363
 		}
349 364
 		if (isset(self::$fstab[$path]) && self::$fstab[$path] === $url)
350 365
 		{
351
-			if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($url).','.array2string($path).') already mounted.');
366
+			if (self::LOG_LEVEL > 0)
367
+			{
368
+				error_log(__METHOD__.'('.array2string($url).','.array2string($path).') already mounted.');
369
+			}
352 370
 			return true;	// already mounted
353 371
 		}
354 372
 		self::load_wrapper(self::parse_url($url,PHP_URL_SCHEME));
355 373
 
356 374
 		if ($check_url && (!file_exists($url) || opendir($url) === false))
357 375
 		{
358
-			if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($url).','.array2string($path).') url does NOT exist!');
376
+			if (self::LOG_LEVEL > 0)
377
+			{
378
+				error_log(__METHOD__.'('.array2string($url).','.array2string($path).') url does NOT exist!');
379
+			}
359 380
 			return false;	// url does not exist
360 381
 		}
361 382
 		self::$fstab[$path] = $url;
@@ -370,12 +391,18 @@  discard block
 block discarded – undo
370 391
 			Config::save_value('vfs_fstab',self::$fstab,'phpgwapi');
371 392
 			$GLOBALS['egw_info']['server']['vfs_fstab'] = self::$fstab;
372 393
 			// invalidate session cache
373
-			if (method_exists($GLOBALS['egw'],'invalidate_session_cache'))	// egw object in setup is limited
394
+			if (method_exists($GLOBALS['egw'],'invalidate_session_cache'))
395
+			{
396
+				// egw object in setup is limited
374 397
 			{
375 398
 				$GLOBALS['egw']->invalidate_session_cache();
376 399
 			}
400
+			}
401
+		}
402
+		if (self::LOG_LEVEL > 1)
403
+		{
404
+			error_log(__METHOD__.'('.array2string($url).','.array2string($path).') returns true (successful new mount).');
377 405
 		}
378
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__.'('.array2string($url).','.array2string($path).') returns true (successful new mount).');
379 406
 		return true;
380 407
 	}
381 408
 
@@ -388,12 +415,18 @@  discard block
 block discarded – undo
388 415
 	{
389 416
 		if (!self::$is_root)
390 417
 		{
391
-			if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($path).','.array2string($path).') permission denied, you are NOT root!');
418
+			if (self::LOG_LEVEL > 0)
419
+			{
420
+				error_log(__METHOD__.'('.array2string($path).','.array2string($path).') permission denied, you are NOT root!');
421
+			}
392 422
 			return false;	// only root can mount
393 423
 		}
394 424
 		if (!isset(self::$fstab[$path]) && ($path = array_search($path,self::$fstab)) === false)
395 425
 		{
396
-			if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($path).') NOT mounted!');
426
+			if (self::LOG_LEVEL > 0)
427
+			{
428
+				error_log(__METHOD__.'('.array2string($path).') NOT mounted!');
429
+			}
397 430
 			return false;	// $path not mounted
398 431
 		}
399 432
 		unset(self::$fstab[$path]);
@@ -401,11 +434,17 @@  discard block
 block discarded – undo
401 434
 		Config::save_value('vfs_fstab',self::$fstab,'phpgwapi');
402 435
 		$GLOBALS['egw_info']['server']['vfs_fstab'] = self::$fstab;
403 436
 		// invalidate session cache
404
-		if (method_exists($GLOBALS['egw'],'invalidate_session_cache'))	// egw object in setup is limited
437
+		if (method_exists($GLOBALS['egw'],'invalidate_session_cache'))
438
+		{
439
+			// egw object in setup is limited
405 440
 		{
406 441
 			$GLOBALS['egw']->invalidate_session_cache();
407 442
 		}
408
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__.'('.array2string($path).') returns true (successful unmount).');
443
+		}
444
+		if (self::LOG_LEVEL > 1)
445
+		{
446
+			error_log(__METHOD__.'('.array2string($path).') returns true (successful unmount).');
447
+		}
409 448
 		return true;
410 449
 	}
411 450
 
@@ -460,17 +499,27 @@  discard block
 block discarded – undo
460 499
 		$dirs_last = $options['depth'];	// put content of dirs before the dir itself
461 500
 		// show dirs on top by default, if no recursive listing (allways disabled if $type specified, as unnecessary)
462 501
 		$dirsontop = !$type && (isset($options['dirsontop']) ? (boolean)$options['dirsontop'] : isset($options['maxdepth'])&&$options['maxdepth']>0);
463
-		if ($dirsontop) $options['need_mime'] = true;	// otherwise dirsontop can NOT work
502
+		if ($dirsontop)
503
+		{
504
+			$options['need_mime'] = true;
505
+		}
506
+		// otherwise dirsontop can NOT work
464 507
 
465 508
 		// process some of the options (need to be done only once)
466
-		if (isset($options['name']) && !isset($options['name_preg']))	// change from simple *,? wildcards to preg regular expression once
509
+		if (isset($options['name']) && !isset($options['name_preg']))
510
+		{
511
+			// change from simple *,? wildcards to preg regular expression once
467 512
 		{
468 513
 			$options['name_preg'] = '/^'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($options['name'])).'$/i';
469 514
 		}
470
-		if (isset($options['path']) && !isset($options['preg_path']))	// change from simple *,? wildcards to preg regular expression once
515
+		}
516
+		if (isset($options['path']) && !isset($options['preg_path']))
517
+		{
518
+			// change from simple *,? wildcards to preg regular expression once
471 519
 		{
472 520
 			$options['path_preg'] = '/^'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($options['path'])).'$/i';
473 521
 		}
522
+		}
474 523
 		if (!isset($options['uid']))
475 524
 		{
476 525
 			if (isset($options['user']))
@@ -517,7 +566,10 @@  discard block
 block discarded – undo
517 566
 		{
518 567
 			if (!$url)
519 568
 			{
520
-				if ($path[0] != '/' || !self::stat($path)) continue;
569
+				if ($path[0] != '/' || !self::stat($path))
570
+				{
571
+					continue;
572
+				}
521 573
 				$path = self::PREFIX . $path;
522 574
 			}
523 575
 			if (!isset($options['remove']))
@@ -535,9 +587,17 @@  discard block
 block discarded – undo
535 587
 			{
536 588
 				while(($fname = readdir($dir)) !== false)
537 589
 				{
538
-					if ($fname == '.' || $fname == '..') continue;	// ignore current and parent dir!
590
+					if ($fname == '.' || $fname == '..')
591
+					{
592
+						continue;
593
+					}
594
+					// ignore current and parent dir!
539 595
 
540
-					if (self::is_hidden($fname, $options['show-deleted']) && !$options['hidden']) continue;	// ignore hidden files
596
+					if (self::is_hidden($fname, $options['show-deleted']) && !$options['hidden'])
597
+					{
598
+						continue;
599
+					}
600
+					// ignore hidden files
541 601
 
542 602
 					$file = self::concat($path, $fname);
543 603
 
@@ -549,8 +609,14 @@  discard block
 block discarded – undo
549 609
 					if (is_dir($file) && ($options['follow'] || !is_link($file)) && (!isset($options['maxdepth']) || $options['maxdepth'] > 1))
550 610
 					{
551 611
 						$opts = $options;
552
-						if ($opts['mindepth']) $opts['mindepth']--;
553
-						if ($opts['maxdepth']) $opts['depth']++;
612
+						if ($opts['mindepth'])
613
+						{
614
+							$opts['mindepth']--;
615
+						}
616
+						if ($opts['maxdepth'])
617
+						{
618
+							$opts['depth']++;
619
+						}
554 620
 						unset($opts['order']);
555 621
 						unset($opts['limit']);
556 622
 						foreach(self::find($options['url']?$file:self::parse_url($file,PHP_URL_PATH),$opts,true) as $p => $s)
@@ -615,7 +681,10 @@  discard block
 block discarded – undo
615 681
 		if (isset($options['limit']))
616 682
 		{
617 683
 			list($limit,$start) = explode(',',$options['limit']);
618
-			if (!$limit && !($limit = $GLOBALS['egw_info']['user']['preferences']['comman']['maxmatches'])) $limit = 15;
684
+			if (!$limit && !($limit = $GLOBALS['egw_info']['user']['preferences']['comman']['maxmatches']))
685
+			{
686
+				$limit = 15;
687
+			}
619 688
 			//echo "total=".self::$find_total.", limit=$options[limit] --> start=$start, limit=$limit<br>\n";
620 689
 
621 690
 			if ((int)$start || self::$find_total > $limit)
@@ -672,9 +741,13 @@  discard block
 block discarded – undo
672 741
 			return;	// not found, should not happen
673 742
 		}
674 743
 		if ($type && (($type == 'd') == !($stat['mode'] & Vfs\Sqlfs\StreamWrapper::MODE_DIR) ||	// != is_dir() which can be true for symlinks
675
-		    $type == 'F' && is_dir($path)))	// symlink to a directory
744
+		    $type == 'F' && is_dir($path)))
676 745
 		{
677
-			return;	// wrong type
746
+			// symlink to a directory
747
+		{
748
+			return;
749
+		}
750
+		// wrong type
678 751
 		}
679 752
 		$stat = array_slice($stat,13);	// remove numerical indices 0-12
680 753
 		$stat['path'] = self::parse_url($path,PHP_URL_PATH);
@@ -697,11 +770,15 @@  discard block
 block discarded – undo
697 770
 		}
698 771
 		if (isset($options['mime']) && $options['mime'] != $stat['mime'])
699 772
 		{
700
-			if ($options['mime'][0] == '/')	// perl regular expression given
773
+			if ($options['mime'][0] == '/')
774
+			{
775
+				// perl regular expression given
701 776
 			{
702 777
 				if (!preg_match($options['mime'], $stat['mime']))
703 778
 				{
704
-					return;	// wrong mime-type
779
+					return;
780
+			}
781
+			// wrong mime-type
705 782
 				}
706 783
 			}
707 784
 			else
@@ -1018,7 +1095,8 @@  discard block
 block discarded – undo
1018 1095
 			}
1019 1096
 
1020 1097
 			// sort by length descending, to show precedence
1021
-			usort($eacls, function($a, $b) {
1098
+			usort($eacls, function($a, $b)
1099
+			{
1022 1100
 				return strlen($b['path']) - strlen($a['path']);
1023 1101
 			});
1024 1102
 		}
@@ -1073,14 +1151,21 @@  discard block
 block discarded – undo
1073 1151
 	 */
1074 1152
 	static function mode2int($set,$mode=0)
1075 1153
 	{
1076
-		if (is_int($set))		// already an integer
1154
+		if (is_int($set))
1155
+		{
1156
+			// already an integer
1077 1157
 		{
1078 1158
 			return $set;
1079 1159
 		}
1080
-		if (is_numeric($set))	// octal string
1160
+		}
1161
+		if (is_numeric($set))
1162
+		{
1163
+			// octal string
1081 1164
 		{
1082 1165
 			//error_log(__METHOD__."($set,$mode) returning ".(int)base_convert($set,8,10));
1083
-			return (int)base_convert($set,8,10);	// convert octal to decimal
1166
+			return (int)base_convert($set,8,10);
1167
+		}
1168
+		// convert octal to decimal
1084 1169
 		}
1085 1170
 		foreach(explode(',',$set) as $s)
1086 1171
 		{
@@ -1136,34 +1221,55 @@  discard block
 block discarded – undo
1136 1221
 	 */
1137 1222
 	static function int2mode( $mode )
1138 1223
 	{
1139
-		if(($mode & self::MODE_LINK) == self::MODE_LINK) // Symbolic Link
1224
+		if(($mode & self::MODE_LINK) == self::MODE_LINK)
1225
+		{
1226
+			// Symbolic Link
1140 1227
 		{
1141 1228
 			$sP = 'l';
1142 1229
 		}
1143
-		elseif(($mode & 0xC000) == 0xC000) // Socket
1230
+		}
1231
+		elseif(($mode & 0xC000) == 0xC000)
1232
+		{
1233
+			// Socket
1144 1234
 		{
1145 1235
 			$sP = 's';
1146 1236
 		}
1147
-		elseif($mode & 0x1000)     // FIFO pipe
1237
+		}
1238
+		elseif($mode & 0x1000)
1239
+		{
1240
+			// FIFO pipe
1148 1241
 		{
1149 1242
 			$sP = 'p';
1150 1243
 		}
1151
-		elseif($mode & 0x2000) // Character special
1244
+		}
1245
+		elseif($mode & 0x2000)
1246
+		{
1247
+			// Character special
1152 1248
 		{
1153 1249
 			$sP = 'c';
1154 1250
 		}
1155
-		elseif($mode & 0x4000) // Directory
1251
+		}
1252
+		elseif($mode & 0x4000)
1253
+		{
1254
+			// Directory
1156 1255
 		{
1157 1256
 			$sP = 'd';
1158 1257
 		}
1159
-		elseif($mode & 0x6000) // Block special
1258
+		}
1259
+		elseif($mode & 0x6000)
1260
+		{
1261
+			// Block special
1160 1262
 		{
1161 1263
 			$sP = 'b';
1162 1264
 		}
1163
-		elseif($mode & 0x8000) // Regular
1265
+		}
1266
+		elseif($mode & 0x8000)
1267
+		{
1268
+			// Regular
1164 1269
 		{
1165 1270
 			$sP = '-';
1166 1271
 		}
1272
+		}
1167 1273
 		else                         // UNKNOWN
1168 1274
 		{
1169 1275
 			$sP = 'u';
@@ -1230,9 +1336,18 @@  discard block
 block discarded – undo
1230 1336
 	 */
1231 1337
 	static function hsize($size)
1232 1338
 	{
1233
-		if ($size < 1024) return $size;
1234
-		if ($size < 1024*1024) return sprintf('%3.1lfk',(float)$size/1024);
1235
-		if ($size < 1024*1024*1024) return sprintf('%3.1lfM',(float)$size/(1024*1024));
1339
+		if ($size < 1024)
1340
+		{
1341
+			return $size;
1342
+		}
1343
+		if ($size < 1024*1024)
1344
+		{
1345
+			return sprintf('%3.1lfk',(float)$size/1024);
1346
+		}
1347
+		if ($size < 1024*1024*1024)
1348
+		{
1349
+			return sprintf('%3.1lfM',(float)$size/(1024*1024));
1350
+		}
1236 1351
 		return sprintf('%3.1lfG',(float)$size/(1024*1024*1024));
1237 1352
 	}
1238 1353
 
@@ -1243,7 +1358,10 @@  discard block
 block discarded – undo
1243 1358
 	 */
1244 1359
 	static function int_size($_val)
1245 1360
 	{
1246
-		if(empty($_val))return 0;
1361
+		if(empty($_val))
1362
+		{
1363
+			return 0;
1364
+		}
1247 1365
 
1248 1366
 		$val = trim($_val);
1249 1367
 
@@ -1251,11 +1369,13 @@  discard block
 block discarded – undo
1251 1369
 		preg_match('#([0-9]+)[\s]*([a-z]+)#i', $val, $matches);
1252 1370
 
1253 1371
 		$last = '';
1254
-		if(isset($matches[2])){
1372
+		if(isset($matches[2]))
1373
+		{
1255 1374
 			$last = $matches[2];
1256 1375
 		}
1257 1376
 
1258
-		if(isset($matches[1])){
1377
+		if(isset($matches[1]))
1378
+		{
1259 1379
 			$val = (int) $matches[1];
1260 1380
 		}
1261 1381
 
@@ -1307,7 +1427,10 @@  discard block
 block discarded – undo
1307 1427
 			return false;
1308 1428
 		}
1309 1429
 		$parts = explode('/',$url);
1310
-		if (substr($url,-1) == '/') array_pop($parts);
1430
+		if (substr($url,-1) == '/')
1431
+		{
1432
+			array_pop($parts);
1433
+		}
1311 1434
 		array_pop($parts);
1312 1435
 		if ($url[0] != '/' && count($parts) == 3 || count($parts) == 1 && $parts[0] === '')
1313 1436
 		{
@@ -1328,7 +1451,10 @@  discard block
 block discarded – undo
1328 1451
 	 */
1329 1452
 	static function has_owner_rights($path,array $stat=null)
1330 1453
 	{
1331
-		if (!$stat) $stat = self::url_stat($path,0);
1454
+		if (!$stat)
1455
+		{
1456
+			$stat = self::url_stat($path,0);
1457
+		}
1332 1458
 
1333 1459
 		return $stat['uid'] == self::$user ||	// user is the owner
1334 1460
 			self::$is_root ||					// class runs with root rights
@@ -1347,7 +1473,10 @@  discard block
 block discarded – undo
1347 1473
 	static function concat($_url,$relative)
1348 1474
 	{
1349 1475
 		list($url,$query) = explode('?',$_url,2);
1350
-		if (substr($url,-1) == '/') $url = substr($url,0,-1);
1476
+		if (substr($url,-1) == '/')
1477
+		{
1478
+			$url = substr($url,0,-1);
1479
+		}
1351 1480
 		$ret = ($relative === '' || $relative[0] == '/' ? $url.$relative : $url.'/'.$relative);
1352 1481
 
1353 1482
 		// now normalize the path (remove "/something/..")
@@ -1440,7 +1569,8 @@  discard block
 block discarded – undo
1440 1569
 		if(count($paths) > 0)
1441 1570
 		{
1442 1571
 			// Shortest to longest
1443
-			usort($paths, function($a, $b) {
1572
+			usort($paths, function($a, $b)
1573
+			{
1444 1574
 				return strlen($a) - strlen($b);
1445 1575
 			});
1446 1576
 
@@ -1513,7 +1643,10 @@  discard block
 block discarded – undo
1513 1643
 			// Don't go infinite with app entries
1514 1644
 			if(self::is_link($addfile))
1515 1645
 			{
1516
-				if(in_array($addfile, $links)) continue;
1646
+				if(in_array($addfile, $links))
1647
+				{
1648
+					continue;
1649
+				}
1517 1650
 				$links[] = $addfile;
1518 1651
 			}
1519 1652
 			// Add directory - if empty, client app might not show it though
@@ -1624,12 +1757,17 @@  discard block
 block discarded – undo
1624 1757
     	// remove the lock info evtl. set in the cache
1625 1758
     	unset(self::$lock_cache[$path]);
1626 1759
 
1627
-    	if ($timeout < 1000000)	// < 1000000 is a relative timestamp, so we add the current time
1760
+    	if ($timeout < 1000000)
1761
+    	{
1762
+    		// < 1000000 is a relative timestamp, so we add the current time
1628 1763
     	{
1629 1764
     		$timeout += time();
1630 1765
     	}
1766
+    	}
1631 1767
 
1632
-		if ($update)	// Lock Update
1768
+		if ($update)
1769
+		{
1770
+			// Lock Update
1633 1771
 		{
1634 1772
 			if (($ret = (boolean)($row = self::$db->select(self::LOCK_TABLE,array('lock_owner','lock_exclusive','lock_write'),array(
1635 1773
 				'lock_path' => $path,
@@ -1637,6 +1775,7 @@  discard block
 block discarded – undo
1637 1775
 			),__LINE__,__FILE__)->fetch())))
1638 1776
 			{
1639 1777
 				$owner = $row['lock_owner'];
1778
+		}
1640 1779
 				$scope = Db::from_bool($row['lock_exclusive']) ? 'exclusive' : 'shared';
1641 1780
 				$type  = Db::from_bool($row['lock_write']) ? 'write' : 'read';
1642 1781
 
@@ -1684,7 +1823,10 @@  discard block
 block discarded – undo
1684 1823
 				$ret = false;	// there's already a lock
1685 1824
 			}
1686 1825
 		}
1687
-		if (self::LOCK_DEBUG) error_log(__METHOD__."($path,$token,$timeout,$owner,$scope,$type,update=$update,check_writable=$check_writable) returns ".($ret ? 'true' : 'false'));
1826
+		if (self::LOCK_DEBUG)
1827
+		{
1828
+			error_log(__METHOD__."($path,$token,$timeout,$owner,$scope,$type,update=$update,check_writable=$check_writable) returns ".($ret ? 'true' : 'false'));
1829
+		}
1688 1830
 		return $ret;
1689 1831
 	}
1690 1832
 
@@ -1711,7 +1853,10 @@  discard block
 block discarded – undo
1711 1853
         	// remove the lock from the cache too
1712 1854
         	unset(self::$lock_cache[$path]);
1713 1855
         }
1714
-		if (self::LOCK_DEBUG) error_log(__METHOD__."($path,$token,$check_writable) returns ".($ret ? 'true' : 'false'));
1856
+		if (self::LOCK_DEBUG)
1857
+		{
1858
+			error_log(__METHOD__."($path,$token,$check_writable) returns ".($ret ? 'true' : 'false'));
1859
+		}
1715 1860
 		return $ret;
1716 1861
     }
1717 1862
 
@@ -1725,7 +1870,10 @@  discard block
 block discarded – undo
1725 1870
 	{
1726 1871
 		if (isset(self::$lock_cache[$path]))
1727 1872
 		{
1728
-			if (self::LOCK_DEBUG) error_log(__METHOD__."($path) returns from CACHE ".str_replace(array("\n",'    '),'',print_r(self::$lock_cache[$path],true)));
1873
+			if (self::LOCK_DEBUG)
1874
+			{
1875
+				error_log(__METHOD__."($path) returns from CACHE ".str_replace(array("\n",'    '),'',print_r(self::$lock_cache[$path],true)));
1876
+			}
1729 1877
 			return self::$lock_cache[$path];
1730 1878
 		}
1731 1879
 		$where = 'lock_path='.self::$db->quote($path);
@@ -1739,17 +1887,26 @@  discard block
 block discarded – undo
1739 1887
 			$result['scope'] = Db::from_bool($result['exclusive']) ? 'exclusive' : 'shared';
1740 1888
 			$result['depth'] = Db::from_bool($result['recursive']) ? 'infinite' : 0;
1741 1889
 		}
1742
-		if ($result && $result['expires'] < time())	// lock is expired --> remove it
1890
+		if ($result && $result['expires'] < time())
1891
+		{
1892
+			// lock is expired --> remove it
1743 1893
 		{
1744 1894
 	        self::$db->delete(self::LOCK_TABLE,array(
1745 1895
 	        	'lock_path' => $result['path'],
1746 1896
 	        	'lock_token' => $result['token'],
1747 1897
 	        ),__LINE__,__FILE__);
1898
+		}
1748 1899
 
1749
-			if (self::LOCK_DEBUG) error_log(__METHOD__."($path) lock is expired at ".date('Y-m-d H:i:s',$result['expires'])." --> removed");
1900
+			if (self::LOCK_DEBUG)
1901
+			{
1902
+				error_log(__METHOD__."($path) lock is expired at ".date('Y-m-d H:i:s',$result['expires'])." --> removed");
1903
+			}
1750 1904
 	        $result = false;
1751 1905
 		}
1752
-		if (self::LOCK_DEBUG) error_log(__METHOD__."($path) returns ".($result?array2string($result):'false'));
1906
+		if (self::LOCK_DEBUG)
1907
+		{
1908
+			error_log(__METHOD__."($path) returns ".($result?array2string($result):'false'));
1909
+		}
1753 1910
 		return self::$lock_cache[$path] = $result;
1754 1911
 	}
1755 1912
 
@@ -1763,10 +1920,13 @@  discard block
 block discarded – undo
1763 1920
 	static function getExtraInfo($path,array $content=null)
1764 1921
 	{
1765 1922
 		$extra = array();
1766
-		if (($extra_info = self::_call_on_backend('extra_info',array($path,$content),true)))	// true = fail silent if backend does NOT support it
1923
+		if (($extra_info = self::_call_on_backend('extra_info',array($path,$content),true)))
1924
+		{
1925
+			// true = fail silent if backend does NOT support it
1767 1926
 		{
1768 1927
 			$extra[] = $extra_info;
1769 1928
 		}
1929
+		}
1770 1930
 
1771 1931
 		if (($vfs_extra = Hooks::process(array(
1772 1932
 			'location' => 'vfs_extra',
@@ -2044,30 +2204,42 @@  discard block
 block discarded – undo
2044 2204
 		}
2045 2205
 		if ($check_is_uploaded_file && !is_resource($tmp_name) && !is_uploaded_file($tmp_name))
2046 2206
 		{
2047
-			if (self::LOG_LEVEL) error_log(__METHOD__."($tmp_name, $target, ".array2string($props).",$check_is_uploaded_file) returning FALSE !is_uploaded_file()");
2207
+			if (self::LOG_LEVEL)
2208
+			{
2209
+				error_log(__METHOD__."($tmp_name, $target, ".array2string($props).",$check_is_uploaded_file) returning FALSE !is_uploaded_file()");
2210
+			}
2048 2211
 			return false;
2049 2212
 		}
2050 2213
 		if (!(self::is_writable($target) || self::is_writable(self::dirname($target))))
2051 2214
 		{
2052
-			if (self::LOG_LEVEL) error_log(__METHOD__."($tmp_name, $target, ".array2string($props).",$check_is_uploaded_file) returning FALSE !writable");
2215
+			if (self::LOG_LEVEL)
2216
+			{
2217
+				error_log(__METHOD__."($tmp_name, $target, ".array2string($props).",$check_is_uploaded_file) returning FALSE !writable");
2218
+			}
2053 2219
 			return false;
2054 2220
 		}
2055 2221
 		if ($props)
2056 2222
 		{
2057
-			if (!is_array($props)) $props = array(array('name' => 'comment','val' => $props));
2223
+			if (!is_array($props))
2224
+			{
2225
+				$props = array(array('name' => 'comment','val' => $props));
2226
+			}
2058 2227
 
2059 2228
 			// if $props is name => value pairs, convert it to internal array or array with values for keys 'name', 'val' and optional 'ns'
2060 2229
 			if (!isset($props[0]))
2061 2230
 			{
2062 2231
 				foreach($props as $name => $val)
2063 2232
 				{
2064
-					if (($name == 'comment' || $name[0] == '#') && $val)	// only copy 'comment' and cfs
2233
+					if (($name == 'comment' || $name[0] == '#') && $val)
2234
+					{
2235
+						// only copy 'comment' and cfs
2065 2236
 					{
2066 2237
 						$vfs_props[] = array(
2067 2238
 							'name' => $name,
2068 2239
 							'val'  => $val,
2069 2240
 						);
2070 2241
 					}
2242
+					}
2071 2243
 				}
2072 2244
 				$props = $vfs_props;
2073 2245
 			}
@@ -2094,7 +2266,10 @@  discard block
 block discarded – undo
2094 2266
 		{
2095 2267
 			$ret = copy($tmp_name,self::PREFIX.$target) ? self::stat($target) : false;
2096 2268
 		}
2097
-		if (self::LOG_LEVEL > 1 || !$ret && self::LOG_LEVEL) error_log(__METHOD__."($tmp_name, $target, ".array2string($props).") returning ".array2string($ret));
2269
+		if (self::LOG_LEVEL > 1 || !$ret && self::LOG_LEVEL)
2270
+		{
2271
+			error_log(__METHOD__."($tmp_name, $target, ".array2string($props).") returning ".array2string($ret));
2272
+		}
2098 2273
 		return $ret;
2099 2274
 	}
2100 2275
 
Please login to merge, or discard this patch.
api/src/Vfs/StreamWrapper.php 1 patch
Braces   +184 added lines, -45 removed lines patch added patch discarded remove patch
@@ -165,7 +165,10 @@  discard block
 block discarded – undo
165 165
 		{
166 166
 			$url = null;
167 167
 			$stat = self::check_symlink_components($path,0,$url);
168
-			if (self::LOG_LEVEL > 1) $log = " (check_symlink_components('$path',0,'$url') = $stat)";
168
+			if (self::LOG_LEVEL > 1)
169
+			{
170
+				$log = " (check_symlink_components('$path',0,'$url') = $stat)";
171
+			}
169 172
 		}
170 173
 		else
171 174
 		{
@@ -176,7 +179,10 @@  discard block
 block discarded – undo
176 179
 		{
177 180
 			$url = self::resolve_url(self::parse_url($url,PHP_URL_PATH));
178 181
 		}
179
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__."($path,file_exists=$file_exists,resolve_last_symlink=$resolve_last_symlink) = '$url'$log");
182
+		if (self::LOG_LEVEL > 1)
183
+		{
184
+			error_log(__METHOD__."($path,file_exists=$file_exists,resolve_last_symlink=$resolve_last_symlink) = '$url'$log");
185
+		}
180 186
 		return $url;
181 187
 	}
182 188
 
@@ -204,7 +210,10 @@  discard block
 block discarded – undo
204 210
 		// we do some caching here
205 211
 		if (isset(self::$resolve_url_cache[$path]) && $replace_user_pass_host)
206 212
 		{
207
-			if (self::LOG_LEVEL > 1) error_log(__METHOD__."('$path') = '".self::$resolve_url_cache[$path]."' (from cache)");
213
+			if (self::LOG_LEVEL > 1)
214
+			{
215
+				error_log(__METHOD__."('$path') = '".self::$resolve_url_cache[$path]."' (from cache)");
216
+			}
208 217
 			return self::$resolve_url_cache[$path];
209 218
 		}
210 219
 		// check if we can already resolve path (or a part of it) with a known symlinks
@@ -224,14 +233,24 @@  discard block
 block discarded – undo
224 233
 			);
225 234
 		}
226 235
 		$parts = array_merge(self::parse_url($path),$defaults);
227
-		if (!$parts['host']) $parts['host'] = 'default';	// otherwise we get an invalid url (scheme:///path/to/something)!
236
+		if (!$parts['host'])
237
+		{
238
+			$parts['host'] = 'default';
239
+		}
240
+		// otherwise we get an invalid url (scheme:///path/to/something)!
228 241
 
229 242
 		if (!empty($parts['scheme']) && $parts['scheme'] != self::SCHEME)
230 243
 		{
231
-			if (self::LOG_LEVEL > 1) error_log(__METHOD__."('$path') = '$path' (path is already an url)");
244
+			if (self::LOG_LEVEL > 1)
245
+			{
246
+				error_log(__METHOD__."('$path') = '$path' (path is already an url)");
247
+			}
232 248
 			return $path;	// path is already a non-vfs url --> nothing to do
233 249
 		}
234
-		if (empty($parts['path'])) $parts['path'] = '/';
250
+		if (empty($parts['path']))
251
+		{
252
+			$parts['path'] = '/';
253
+		}
235 254
 
236 255
 		foreach(array_reverse(self::$fstab) as $mounted => $url)
237 256
 		{
@@ -257,17 +276,32 @@  discard block
 block discarded – undo
257 276
 				{
258 277
 					$url = str_replace(array('$user','$pass','$host','$home'),array($parts['user'],$parts['pass'],$parts['host'],$parts['home']),$url);
259 278
 				}
260
-				if ($parts['query']) $url .= '?'.$parts['query'];
261
-				if ($parts['fragment']) $url .= '#'.$parts['fragment'];
279
+				if ($parts['query'])
280
+				{
281
+					$url .= '?'.$parts['query'];
282
+				}
283
+				if ($parts['fragment'])
284
+				{
285
+					$url .= '#'.$parts['fragment'];
286
+				}
262 287
 
263
-				if (self::LOG_LEVEL > 1) error_log(__METHOD__."('$path') = '$url'");
288
+				if (self::LOG_LEVEL > 1)
289
+				{
290
+					error_log(__METHOD__."('$path') = '$url'");
291
+				}
264 292
 
265
-				if ($replace_user_pass_host) self::$resolve_url_cache[$path] = $url;
293
+				if ($replace_user_pass_host)
294
+				{
295
+					self::$resolve_url_cache[$path] = $url;
296
+				}
266 297
 
267 298
 				return $url;
268 299
 			}
269 300
 		}
270
-		if (self::LOG_LEVEL > 0) error_log(__METHOD__."('$path') can't resolve path!\n");
301
+		if (self::LOG_LEVEL > 0)
302
+		{
303
+			error_log(__METHOD__."('$path') can't resolve path!\n");
304
+		}
271 305
 		trigger_error(__METHOD__."($path) can't resolve path!\n",E_USER_WARNING);
272 306
 		return false;
273 307
 	}
@@ -491,10 +525,13 @@  discard block
 block discarded – undo
491 525
 	 */
492 526
 	static function unlink ( $path )
493 527
 	{
494
-		if (!($url = self::resolve_url_symlinks($path,true,false)))	// true,false file need to exist, but do not resolve last component
528
+		if (!($url = self::resolve_url_symlinks($path,true,false)))
529
+		{
530
+			// true,false file need to exist, but do not resolve last component
495 531
 		{
496 532
 			return false;
497 533
 		}
534
+		}
498 535
 		if (self::url_is_readonly($url))
499 536
 		{
500 537
 			return false;
@@ -547,7 +584,10 @@  discard block
 block discarded – undo
547 584
 			$ret = stream_copy_to_stream($from,$to) !== false;
548 585
 			fclose($from);
549 586
 			fclose($to);
550
-			if ($ret) self::unlink($path_from);
587
+			if ($ret)
588
+			{
589
+				self::unlink($path_from);
590
+			}
551 591
 		}
552 592
 		else
553 593
 		{
@@ -584,10 +624,13 @@  discard block
 block discarded – undo
584 624
 	 */
585 625
 	static function mkdir ( $path, $mode, $options )
586 626
 	{
587
-		if (!($url = self::resolve_url_symlinks($path,false)))	// false = directory does not need to exists
627
+		if (!($url = self::resolve_url_symlinks($path,false)))
628
+		{
629
+			// false = directory does not need to exists
588 630
 		{
589 631
 			return false;
590 632
 		}
633
+		}
591 634
 		$ret = mkdir($url,$mode,$options);
592 635
 
593 636
 		// call "vfs_mkdir" hook
@@ -665,7 +708,10 @@  discard block
 block discarded – undo
665 708
 				return false;
666 709
 			}
667 710
 			$k=(string)self::parse_url($url,PHP_URL_SCHEME);
668
-			if (!(is_array($scheme2urls[$k]))) $scheme2urls[$k] = array();
711
+			if (!(is_array($scheme2urls[$k])))
712
+			{
713
+				$scheme2urls[$k] = array();
714
+			}
669 715
 			$scheme2urls[$k][$path] = $url;
670 716
 		}
671 717
 		$ret = array();
@@ -675,7 +721,10 @@  discard block
 block discarded – undo
675 721
 			{
676 722
 				if (!class_exists($class = self::scheme2class($scheme)) || !method_exists($class,$name))
677 723
 				{
678
-					if (!$fail_silent) trigger_error("Can't $name for scheme $scheme!\n",E_USER_WARNING);
724
+					if (!$fail_silent)
725
+					{
726
+						trigger_error("Can't $name for scheme $scheme!\n",E_USER_WARNING);
727
+					}
679 728
 					return false;
680 729
 				}
681 730
 				if (!is_array($pathes))
@@ -793,10 +842,13 @@  discard block
 block discarded – undo
793 842
 	 */
794 843
 	static function symlink($target,$link)
795 844
 	{
796
-		if (($ret = self::_call_on_backend('symlink',array($target,$link),false,1)))	// 1=path is in $link!
845
+		if (($ret = self::_call_on_backend('symlink',array($target,$link),false,1)))
846
+		{
847
+			// 1=path is in $link!
797 848
 		{
798 849
 			self::symlinkCache_remove($link);
799 850
 		}
851
+		}
800 852
 		return $ret;
801 853
 	}
802 854
 
@@ -866,13 +918,19 @@  discard block
 block discarded – undo
866 918
 
867 919
 		if (!($this->opened_dir_url = self::resolve_url_symlinks($path)))
868 920
 		{
869
-			if (self::LOG_LEVEL > 0) error_log(__METHOD__."( $path,$options) resolve_url_symlinks() failed!");
921
+			if (self::LOG_LEVEL > 0)
922
+			{
923
+				error_log(__METHOD__."( $path,$options) resolve_url_symlinks() failed!");
924
+			}
870 925
 			return false;
871 926
 		}
872 927
 		if (!($this->opened_dir = $this->context ?
873 928
 			opendir($this->opened_dir_url, $this->context) : opendir($this->opened_dir_url)))
874 929
 		{
875
-			if (self::LOG_LEVEL > 0) error_log(__METHOD__."( $path,$options) opendir($this->opened_dir_url) failed!");
930
+			if (self::LOG_LEVEL > 0)
931
+			{
932
+				error_log(__METHOD__."( $path,$options) opendir($this->opened_dir_url) failed!");
933
+			}
876 934
 			return false;
877 935
 		}
878 936
 		$this->opened_dir_writable = Vfs::check_access($this->opened_dir_url,Vfs::WRITABLE);
@@ -890,7 +948,10 @@  discard block
 block discarded – undo
890 948
 		}
891 949
 
892 950
 
893
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__."( $path,$options): opendir($this->opened_dir_url)=$this->opened_dir, extra_dirs=".array2string($this->extra_dirs).', '.function_backtrace());
951
+		if (self::LOG_LEVEL > 1)
952
+		{
953
+			error_log(__METHOD__."( $path,$options): opendir($this->opened_dir_url)=$this->opened_dir, extra_dirs=".array2string($this->extra_dirs).', '.function_backtrace());
954
+		}
894 955
 		return true;
895 956
 	}
896 957
 
@@ -926,7 +987,10 @@  discard block
 block discarded – undo
926 987
 	{
927 988
 		if (!($url = self::resolve_url($path,!($flags & STREAM_URL_STAT_LINK), $check_symlink_components)))
928 989
 		{
929
-			if (self::LOG_LEVEL > 0) error_log(__METHOD__."('$path',$flags) can NOT resolve path!");
990
+			if (self::LOG_LEVEL > 0)
991
+			{
992
+				error_log(__METHOD__."('$path',$flags) can NOT resolve path!");
993
+			}
930 994
 			return false;
931 995
 		}
932 996
 
@@ -943,18 +1007,27 @@  discard block
 block discarded – undo
943 1007
 				{
944 1008
 					if (!$check_symlink_depth)
945 1009
 					{
946
-						if (self::LOG_LEVEL > 0) error_log(__METHOD__."('$path',$flags) maximum symlink depth exceeded, might be a circular symlink!");
1010
+						if (self::LOG_LEVEL > 0)
1011
+						{
1012
+							error_log(__METHOD__."('$path',$flags) maximum symlink depth exceeded, might be a circular symlink!");
1013
+						}
947 1014
 						$stat = false;
948 1015
 					}
949 1016
 					elseif (($lpath = self::readlink($url)))
950 1017
 					{
951
-						if ($lpath[0] != '/')	// concat relative path
1018
+						if ($lpath[0] != '/')
1019
+						{
1020
+							// concat relative path
952 1021
 						{
953 1022
 							$lpath = Vfs::concat(self::parse_url($path,PHP_URL_PATH),'../'.$lpath);
954 1023
 						}
1024
+						}
955 1025
 						$u_query = parse_url($url,PHP_URL_QUERY);
956 1026
 						$url = Vfs::PREFIX.$lpath;
957
-						if (self::LOG_LEVEL > 1) error_log(__METHOD__."($path,$flags) symlif (substr($path,-1) == '/' && $path != '/') $path = substr($path,0,-1);	// remove trailing slash eg. added by WebDAVink found and resolved to $url");
1027
+						if (self::LOG_LEVEL > 1)
1028
+						{
1029
+							error_log(__METHOD__."($path,$flags) symlif (substr($path,-1) == '/' && $path != '/') $path = substr($path,0,-1);	// remove trailing slash eg. added by WebDAVink found and resolved to $url");
1030
+						}
958 1031
 						// try reading the stat of the link
959 1032
 						if (($stat = self::url_stat($lpath, STREAM_URL_STAT_QUIET, false, true, $check_symlink_depth-1)))
960 1033
 						{
@@ -967,7 +1040,11 @@  discard block
 block discarded – undo
967 1040
 								$stat_query = http_build_query(array_merge($stat_query, $u_query));
968 1041
 								$stat['url'] = $stat_url['scheme'].'://'.$stat_url['host'].$stat_url['path'].'?'.$stat_query;
969 1042
 							}
970
-							if(isset($stat['url'])) $url = $stat['url'];	// if stat returns an url use that, as there might be more links ...
1043
+							if(isset($stat['url']))
1044
+							{
1045
+								$url = $stat['url'];
1046
+							}
1047
+							// if stat returns an url use that, as there might be more links ...
971 1048
 							self::symlinkCache_add($path,$url);
972 1049
 						}
973 1050
 					}
@@ -990,7 +1067,9 @@  discard block
 block discarded – undo
990 1067
 		// check if a failed url_stat was for a home dir, in that case silently create it
991 1068
 		if (!$stat && $try_create_home && Vfs::dirname(self::parse_url($path,PHP_URL_PATH)) == '/home' &&
992 1069
 			($id = $GLOBALS['egw']->accounts->name2id(basename($path))) &&
993
-			$GLOBALS['egw']->accounts->id2name($id) == basename($path))	// make sure path has the right case!
1070
+			$GLOBALS['egw']->accounts->id2name($id) == basename($path))
1071
+		{
1072
+			// make sure path has the right case!
994 1073
 		{
995 1074
 			$hook_data = array(
996 1075
 				'location' => $GLOBALS['egw']->accounts->get_type($id) == 'g' ? 'addgroup' : 'addaccount',
@@ -998,15 +1077,22 @@  discard block
 block discarded – undo
998 1077
 				'account_lid' => basename($path),
999 1078
 				'account_name' => basename($path),
1000 1079
 			);
1080
+		}
1001 1081
 			call_user_func(array(__NAMESPACE__.'\\Hooks',$hook_data['location']),$hook_data);
1002 1082
 			unset($hook_data);
1003 1083
 			$stat = self::url_stat($path,$flags,false);
1004 1084
 		}
1005 1085
 		$query = parse_url($url, PHP_URL_QUERY);
1006
-		if (!$stat && $check_symlink_components)	// check if there's a symlink somewhere inbetween the path
1086
+		if (!$stat && $check_symlink_components)
1087
+		{
1088
+			// check if there's a symlink somewhere inbetween the path
1007 1089
 		{
1008 1090
 			$stat = self::check_symlink_components($path,$flags,$url);
1009
-			if ($stat && isset($stat['url']) && !$query) self::symlinkCache_add($path,$stat['url']);
1091
+		}
1092
+			if ($stat && isset($stat['url']) && !$query)
1093
+			{
1094
+				self::symlinkCache_add($path,$stat['url']);
1095
+			}
1010 1096
 		}
1011 1097
 		elseif(is_array($stat) && !isset($stat['url']))
1012 1098
 		{
@@ -1021,7 +1107,10 @@  discard block
 block discarded – undo
1021 1107
 			$stat['url'] .= '?'.$query;
1022 1108
 		}
1023 1109
 
1024
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__."('$path',$flags,try_create_home=$try_create_home,check_symlink_components=$check_symlink_components) returning ".array2string($stat));
1110
+		if (self::LOG_LEVEL > 1)
1111
+		{
1112
+			error_log(__METHOD__."('$path',$flags,try_create_home=$try_create_home,check_symlink_components=$check_symlink_components) returning ".array2string($stat));
1113
+		}
1025 1114
 
1026 1115
 		return $stat;
1027 1116
 
@@ -1047,10 +1136,16 @@  discard block
 block discarded – undo
1047 1136
 	{
1048 1137
 		if (is_null($url) && !($url = self::resolve_url($path)))
1049 1138
 		{
1050
-			if (self::LOG_LEVEL > 0) error_log(__METHOD__."('$path',$flags,'$url') can NOT resolve path: ".function_backtrace(1));
1139
+			if (self::LOG_LEVEL > 0)
1140
+			{
1141
+				error_log(__METHOD__."('$path',$flags,'$url') can NOT resolve path: ".function_backtrace(1));
1142
+			}
1051 1143
 			return false;
1052 1144
 		}
1053
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__."('$path',$flags,'$url'): ".function_backtrace(1));
1145
+		if (self::LOG_LEVEL > 1)
1146
+		{
1147
+			error_log(__METHOD__."('$path',$flags,'$url'): ".function_backtrace(1));
1148
+		}
1054 1149
 
1055 1150
 		while (($rel_path = Vfs::basename($url).($rel_path ? '/'.$rel_path : '')) &&
1056 1151
 		       ($url = Vfs::dirname($url)))
@@ -1059,7 +1154,10 @@  discard block
 block discarded – undo
1059 1154
 			{
1060 1155
 				if (is_link($url) && ($lpath = self::readlink($url)))
1061 1156
 				{
1062
-					if (self::LOG_LEVEL > 1) $log = "rel_path='$rel_path', url='$url': lpath='$lpath'";
1157
+					if (self::LOG_LEVEL > 1)
1158
+					{
1159
+						$log = "rel_path='$rel_path', url='$url': lpath='$lpath'";
1160
+					}
1063 1161
 
1064 1162
 					if ($lpath[0] != '/')
1065 1163
 					{
@@ -1067,15 +1165,24 @@  discard block
 block discarded – undo
1067 1165
 					}
1068 1166
 					//self::symlinkCache_add($path,Vfs::PREFIX.$lpath);
1069 1167
 					$url = Vfs::PREFIX.Vfs::concat($lpath,$rel_path);
1070
-					if (self::LOG_LEVEL > 1) error_log("$log --> lpath='$lpath', url='$url'");
1168
+					if (self::LOG_LEVEL > 1)
1169
+					{
1170
+						error_log("$log --> lpath='$lpath', url='$url'");
1171
+					}
1071 1172
 					return self::url_stat($url,$flags);
1072 1173
 				}
1073 1174
 				$url = Vfs::concat($url,$rel_path);
1074
-				if (self::LOG_LEVEL > 1) error_log(__METHOD__."('$path',$flags,'$url') returning null");
1175
+				if (self::LOG_LEVEL > 1)
1176
+				{
1177
+					error_log(__METHOD__."('$path',$flags,'$url') returning null");
1178
+				}
1075 1179
 				return null;
1076 1180
 			}
1077 1181
 		}
1078
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__."('$path',$flags,'$url') returning false");
1182
+		if (self::LOG_LEVEL > 1)
1183
+		{
1184
+			error_log(__METHOD__."('$path',$flags,'$url') returning false");
1185
+		}
1079 1186
 		return false;	// $path does not exist
1080 1187
 	}
1081 1188
 
@@ -1096,9 +1203,16 @@  discard block
 block discarded – undo
1096 1203
 	{
1097 1204
 		$path = self::get_path($_path);
1098 1205
 
1099
-		if (isset(self::$symlink_cache[$path])) return;	// nothing to do
1206
+		if (isset(self::$symlink_cache[$path]))
1207
+		{
1208
+			return;
1209
+		}
1210
+		// nothing to do
1100 1211
 
1101
-		if ($target[0] != '/') $target = self::parse_url($target,PHP_URL_PATH);
1212
+		if ($target[0] != '/')
1213
+		{
1214
+			$target = self::parse_url($target,PHP_URL_PATH);
1215
+		}
1102 1216
 
1103 1217
 		self::$symlink_cache[$path] = $target;
1104 1218
 
@@ -1107,7 +1221,10 @@  discard block
 block discarded – undo
1107 1221
 		{
1108 1222
 			return strlen($a) - strlen($b);
1109 1223
 		});
1110
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__."($path,$target) cache now ".array2string(self::$symlink_cache));
1224
+		if (self::LOG_LEVEL > 1)
1225
+		{
1226
+			error_log(__METHOD__."($path,$target) cache now ".array2string(self::$symlink_cache));
1227
+		}
1111 1228
 	}
1112 1229
 
1113 1230
 	/**
@@ -1120,7 +1237,10 @@  discard block
 block discarded – undo
1120 1237
 		$path = self::get_path($_path);
1121 1238
 
1122 1239
 		unset(self::$symlink_cache[$path]);
1123
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__."($path) cache now ".array2string(self::$symlink_cache));
1240
+		if (self::LOG_LEVEL > 1)
1241
+		{
1242
+			error_log(__METHOD__."($path) cache now ".array2string(self::$symlink_cache));
1243
+		}
1124 1244
 	}
1125 1245
 
1126 1246
 	/**
@@ -1141,11 +1261,18 @@  discard block
 block discarded – undo
1141 1261
 
1142 1262
 		foreach(self::$symlink_cache as $p => $t)
1143 1263
 		{
1144
-			if (($strlen_p = strlen($p)) > $strlen_path) continue;	// $path can NOT start with $p
1264
+			if (($strlen_p = strlen($p)) > $strlen_path)
1265
+			{
1266
+				continue;
1267
+			}
1268
+			// $path can NOT start with $p
1145 1269
 
1146 1270
 			if ($path == $p)
1147 1271
 			{
1148
-				if ($do_symlink) $target = $t;
1272
+				if ($do_symlink)
1273
+				{
1274
+					$target = $t;
1275
+				}
1149 1276
 				break;
1150 1277
 			}
1151 1278
 			elseif (substr($path,0,$strlen_p+1) == $p.'/')
@@ -1154,7 +1281,10 @@  discard block
 block discarded – undo
1154 1281
 				break;
1155 1282
 			}
1156 1283
 		}
1157
-		if (self::LOG_LEVEL > 1 && isset($target)) error_log(__METHOD__."($path) = $target");
1284
+		if (self::LOG_LEVEL > 1 && isset($target))
1285
+		{
1286
+			error_log(__METHOD__."($path) = $target");
1287
+		}
1158 1288
 		return isset($target) ? $target : $path;
1159 1289
 	}
1160 1290
 
@@ -1203,7 +1333,10 @@  discard block
 block discarded – undo
1203 1333
 				self::HIDE_UNREADABLES && !$this->opened_dir_writable &&
1204 1334
 				!Vfs::check_access(Vfs::concat($this->opened_dir_url,$file),Vfs::READABLE)));
1205 1335
 		}
1206
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__."( $this->opened_dir ) = '$file'");
1336
+		if (self::LOG_LEVEL > 1)
1337
+		{
1338
+			error_log(__METHOD__."( $this->opened_dir ) = '$file'");
1339
+		}
1207 1340
 		return $file;
1208 1341
 	}
1209 1342
 
@@ -1306,7 +1439,10 @@  discard block
 block discarded – undo
1306 1439
 		) as $class)
1307 1440
 		{
1308 1441
 			//error_log(__METHOD__."('$scheme') class_exists('$class')=".array2string(class_exists($class)));
1309
-			if (class_exists($class))  return $class;
1442
+			if (class_exists($class))
1443
+			{
1444
+				return $class;
1445
+			}
1310 1446
 		}
1311 1447
 	}
1312 1448
 
@@ -1341,7 +1477,10 @@  discard block
 block discarded – undo
1341 1477
 			static $entities = array('%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%24', '%2C', '%2F', '%3F', '%23', '%5B', '%5D');
1342 1478
 			static $replacements = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "=", "$", ",", "/", "?", "#", "[", "]");
1343 1479
 			static $str_replace = null;
1344
-			if (!isset($str_replace)) $str_replace = function_exists('mb_str_replace') ? 'mb_str_replace' : 'str_replace';
1480
+			if (!isset($str_replace))
1481
+			{
1482
+				$str_replace = function_exists('mb_str_replace') ? 'mb_str_replace' : 'str_replace';
1483
+			}
1345 1484
 
1346 1485
 			// Create encoded URL with special URL characters decoded so it can be parsed
1347 1486
 			// All other characters will be encoded
Please login to merge, or discard this patch.
api/src/Vfs/Filesystem/StreamWrapper.php 1 patch
Braces   +90 added lines, -22 removed lines patch added patch discarded remove patch
@@ -131,14 +131,20 @@  discard block
 block discarded – undo
131 131
 		$read_only = str_replace('b','',$mode) == 'r';
132 132
 
133 133
 		// check access rights, based on the eGW mount perms
134
-		if (!($stat = self::url_stat($url,0)) || $mode[0] == 'x')	// file not found or file should NOT exist
134
+		if (!($stat = self::url_stat($url,0)) || $mode[0] == 'x')
135
+		{
136
+			// file not found or file should NOT exist
135 137
 		{
136 138
 			$dir = Vfs::dirname($url);
139
+		}
137 140
 			if ($mode[0] == 'r' ||	// does $mode require the file to exist (r,r+)
138 141
 				$mode[0] == 'x' ||	// or file should not exist, but does
139
-				!Vfs::check_access($dir,Vfs::WRITABLE,$dir_stat=self::url_stat($dir,0)))	// or we are not allowed to 																																			create it
142
+				!Vfs::check_access($dir,Vfs::WRITABLE,$dir_stat=self::url_stat($dir,0)))
143
+			{
144
+				// or we are not allowed to 																																			create it
140 145
 			{
141 146
 				if (self::LOG_LEVEL) error_log(__METHOD__."($url,$mode,$options) file does not exist or can not be created!");
147
+			}
142 148
 				if (!($options & STREAM_URL_STAT_QUIET))
143 149
 				{
144 150
 					trigger_error(__METHOD__."($url,$mode,$options) file does not exist or can not be created!",E_USER_WARNING);
@@ -146,9 +152,12 @@  discard block
 block discarded – undo
146 152
 				return false;
147 153
 			}
148 154
 		}
149
-		elseif (!$read_only && !Vfs::check_access($url,Vfs::WRITABLE,$stat))	// we are not allowed to edit it
155
+		elseif (!$read_only && !Vfs::check_access($url,Vfs::WRITABLE,$stat))
156
+		{
157
+			// we are not allowed to edit it
150 158
 		{
151 159
 			if (self::LOG_LEVEL) error_log(__METHOD__."($url,$mode,$options) file can not be edited!");
160
+		}
152 161
 			if (!($options & STREAM_URL_STAT_QUIET))
153 162
 			{
154 163
 				trigger_error(__METHOD__."($url,$mode,$options) file can not be edited!",E_USER_WARNING);
@@ -157,7 +166,10 @@  discard block
 block discarded – undo
157 166
 		}
158 167
 		if (!$read_only && self::deny_script($url))
159 168
 		{
160
-			if (self::LOG_LEVEL) error_log(__METHOD__."($url,$mode,$options) permission denied, file is a script!");
169
+			if (self::LOG_LEVEL)
170
+			{
171
+				error_log(__METHOD__."($url,$mode,$options) permission denied, file is a script!");
172
+			}
161 173
 			if (!($options & STREAM_URL_STAT_QUIET))
162 174
 			{
163 175
 				trigger_error(__METHOD__."($url,$mode,$options) permission denied, file is a script!",E_USER_WARNING);
@@ -168,7 +180,10 @@  discard block
 block discarded – undo
168 180
 		// open the "real" file
169 181
 		if (!($this->opened_stream = fopen($path=Vfs::decodePath(Vfs::parse_url($url,PHP_URL_PATH)),$mode,$options)))
170 182
 		{
171
-			if (self::LOG_LEVEL) error_log(__METHOD__."($url,$mode,$options) fopen('$path','$mode',$options) returned false!");
183
+			if (self::LOG_LEVEL)
184
+			{
185
+				error_log(__METHOD__."($url,$mode,$options) fopen('$path','$mode',$options) returned false!");
186
+			}
172 187
 			return false;
173 188
 		}
174 189
 		$this->opened_stream_url = $url;
@@ -313,7 +328,10 @@  discard block
 block discarded – undo
313 328
 		// check access rights (file need to exist and directory need to be writable
314 329
 		if (!file_exists($path) || is_dir($path) || !Vfs::check_access(Vfs::dirname($url),Vfs::WRITABLE))
315 330
 		{
316
-			if (self::LOG_LEVEL) error_log(__METHOD__."($url) permission denied!");
331
+			if (self::LOG_LEVEL)
332
+			{
333
+				error_log(__METHOD__."($url) permission denied!");
334
+			}
317 335
 			return false;	// no permission or file does not exist
318 336
 		}
319 337
 		return unlink($path);
@@ -339,18 +357,27 @@  discard block
 block discarded – undo
339 357
 		// check access rights
340 358
 		if (!($from_stat = self::url_stat($url_from,0)) || !Vfs::check_access(Vfs::dirname($url_from),Vfs::WRITABLE))
341 359
 		{
342
-			if (self::LOG_LEVEL) error_log(__METHOD__."($url_from,$url_to): $from[path] permission denied!");
360
+			if (self::LOG_LEVEL)
361
+			{
362
+				error_log(__METHOD__."($url_from,$url_to): $from[path] permission denied!");
363
+			}
343 364
 			return false;	// no permission or file does not exist
344 365
 		}
345 366
 		$to_dir = Vfs::dirname($url_to);
346 367
 		if (!Vfs::check_access($to_dir,Vfs::WRITABLE,$to_dir_stat = self::url_stat($to_dir,0)))
347 368
 		{
348
-			if (self::LOG_LEVEL) error_log(__METHOD__."($url_from,$url_to): $to_dir permission denied!");
369
+			if (self::LOG_LEVEL)
370
+			{
371
+				error_log(__METHOD__."($url_from,$url_to): $to_dir permission denied!");
372
+			}
349 373
 			return false;	// no permission or parent-dir does not exist
350 374
 		}
351 375
 		if (self::deny_script($url_to))
352 376
 		{
353
-			if (self::LOG_LEVEL) error_log(__METHOD__."($url_from,$url_to) permission denied, file is a script!");
377
+			if (self::LOG_LEVEL)
378
+			{
379
+				error_log(__METHOD__."($url_from,$url_to) permission denied, file is a script!");
380
+			}
354 381
 			return false;
355 382
 		}
356 383
 		// the filesystem stream-wrapper does NOT allow to rename files to directories, as this makes problems
@@ -359,13 +386,19 @@  discard block
 block discarded – undo
359 386
 			($to_stat['mime'] === self::DIR_MIME_TYPE) !== ($from_stat['mime'] === self::DIR_MIME_TYPE))
360 387
 		{
361 388
 			$is_dir = $to_stat['mime'] === self::DIR_MIME_TYPE ? 'a' : 'no';
362
-			if (self::LOG_LEVEL) error_log(__METHOD__."($url_to,$url_from) $to[path] is $is_dir directory!");
389
+			if (self::LOG_LEVEL)
390
+			{
391
+				error_log(__METHOD__."($url_to,$url_from) $to[path] is $is_dir directory!");
392
+			}
363 393
 			return false;	// no permission or file does not exist
364 394
 		}
365 395
 		// if destination file already exists, delete it
366 396
 		if ($to_stat && !self::unlink($url_to))
367 397
 		{
368
-			if (self::LOG_LEVEL) error_log(__METHOD__."($url_to,$url_from) can't unlink existing $url_to!");
398
+			if (self::LOG_LEVEL)
399
+			{
400
+				error_log(__METHOD__."($url_to,$url_from) can't unlink existing $url_to!");
401
+			}
369 402
 			return false;
370 403
 		}
371 404
 		return rename(Vfs::decodePath($from['path']),Vfs::decodePath($to['path']));
@@ -400,7 +433,10 @@  discard block
 block discarded – undo
400 433
 		// check access rights (in real filesystem AND by mount perms)
401 434
 		if (file_exists($path) || !file_exists($parent) || !is_writable($parent) || !Vfs::check_access($parent_url,Vfs::WRITABLE))
402 435
 		{
403
-			if (self::LOG_LEVEL) error_log(__METHOD__."($url) permission denied!");
436
+			if (self::LOG_LEVEL)
437
+			{
438
+				error_log(__METHOD__."($url) permission denied!");
439
+			}
404 440
 			return false;
405 441
 		}
406 442
 		return mkdir($path, 0700, $recursive);	// setting mode 0700 allows (only) apache to write into the dir
@@ -426,7 +462,10 @@  discard block
 block discarded – undo
426 462
 		// check access rights (in real filesystem AND by mount perms)
427 463
 		if (!file_exists($path) || !is_writable($parent) || !Vfs::check_access(Vfs::dirname($url),Vfs::WRITABLE))
428 464
 		{
429
-			if (self::LOG_LEVEL) error_log(__METHOD__."($url) permission denied!");
465
+			if (self::LOG_LEVEL)
466
+			{
467
+				error_log(__METHOD__."($url) permission denied!");
468
+			}
430 469
 			return false;
431 470
 		}
432 471
 		return rmdir($path);
@@ -448,7 +487,10 @@  discard block
 block discarded – undo
448 487
 		// check access rights (in real filesystem AND by mount perms)
449 488
 		if (!file_exists($path) || !is_writable($parent) || !Vfs::check_access(Vfs::dirname($url),Vfs::WRITABLE))
450 489
 		{
451
-			if (self::LOG_LEVEL) error_log(__METHOD__."($url) permission denied!");
490
+			if (self::LOG_LEVEL)
491
+			{
492
+				error_log(__METHOD__."($url) permission denied!");
493
+			}
452 494
 			return false;
453 495
 		}
454 496
 		return touch($path,$time,$atime);
@@ -511,7 +553,10 @@  discard block
 block discarded – undo
511 553
 	 */
512 554
 	function dir_opendir ( $url, $options )
513 555
 	{
514
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__."($url,$options)");
556
+		if (self::LOG_LEVEL > 1)
557
+		{
558
+			error_log(__METHOD__."($url,$options)");
559
+		}
515 560
 
516 561
 		$this->opened_dir = null;
517 562
 
@@ -521,7 +566,10 @@  discard block
 block discarded – undo
521 566
 
522 567
 		if (!($this->opened_dir = opendir($path)))
523 568
 		{
524
-			if (self::LOG_LEVEL > 0) error_log(__METHOD__."($url,$options) opendir('$path') failed!");
569
+			if (self::LOG_LEVEL > 0)
570
+			{
571
+				error_log(__METHOD__."($url,$options) opendir('$path') failed!");
572
+			}
525 573
 			return false;
526 574
 		}
527 575
 		return true;
@@ -577,7 +625,10 @@  discard block
 block discarded – undo
577 625
 				$stat['mode'] = $stat[2] = $stat['mode'] & ~0222;
578 626
 			}
579 627
 		}
580
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__."($url,$flags) path=$path, mount_mode=".sprintf('0%o',$mode).", mode=".sprintf('0%o',$stat['mode']).'='.Vfs::int2mode($stat['mode']));
628
+		if (self::LOG_LEVEL > 1)
629
+		{
630
+			error_log(__METHOD__."($url,$flags) path=$path, mount_mode=".sprintf('0%o',$mode).", mode=".sprintf('0%o',$stat['mode']).'='.Vfs::int2mode($stat['mode']));
631
+		}
581 632
 		return $stat;
582 633
 	}
583 634
 
@@ -598,14 +649,23 @@  discard block
 block discarded – undo
598 649
 
599 650
 			$ignore = !($file === false ||							// stop if no more dirs or
600 651
 				($file != '.' && $file != '..' ));					// file not . or ..
601
-			if (self::LOG_LEVEL > 1 && $ignore) error_log(__METHOD__.'() ignoring '.array2string($file));
652
+			if (self::LOG_LEVEL > 1 && $ignore)
653
+			{
654
+				error_log(__METHOD__.'() ignoring '.array2string($file));
655
+			}
602 656
 		}
603 657
 		while ($ignore);
604 658
 
605 659
 		// encode special chars messing up url's
606
-		if ($file !== false) $file = Vfs::encodePathComponent($file);
660
+		if ($file !== false)
661
+		{
662
+			$file = Vfs::encodePathComponent($file);
663
+		}
607 664
 
608
-		if (self::LOG_LEVEL > 1) error_log(__METHOD__.'() returning '.array2string($file));
665
+		if (self::LOG_LEVEL > 1)
666
+		{
667
+			error_log(__METHOD__.'() returning '.array2string($file));
668
+		}
609 669
 
610 670
 		return $file;
611 671
 	}
@@ -760,9 +820,17 @@  discard block
 block discarded – undo
760 820
 		list($url,$query) = explode('?',$_url,2);
761 821
 		$get = null;
762 822
 		parse_str($query,$get);
763
-		if (empty($get['url'])) return false;	// no download url given for this mount-point
823
+		if (empty($get['url']))
824
+		{
825
+			return false;
826
+		}
827
+		// no download url given for this mount-point
764 828
 
765
-		if (!($mount_url = Vfs::mount_url($_url))) return false;	// no mount url found, should not happen
829
+		if (!($mount_url = Vfs::mount_url($_url)))
830
+		{
831
+			return false;
832
+		}
833
+		// no mount url found, should not happen
766 834
 		list($mount_url) = explode('?',$mount_url);
767 835
 
768 836
 		$relpath = substr($url,strlen($mount_url));
Please login to merge, or discard this patch.
api/src/Vfs/Links/StreamWrapper.php 1 patch
Braces   +26 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
  */
27 27
 if (!class_exists('EGroupware\\Api\\Vfs\\Links\\LinksParent', false))
28 28
 {
29
-	class LinksParent extends Vfs\Sqlfs\StreamWrapper {}
29
+	class LinksParent extends Vfs\Sqlfs\StreamWrapper
30
+	{
31
+}
30 32
 }
31 33
 
32 34
 /**
@@ -116,7 +118,10 @@  discard block
 block discarded – undo
116 118
 			$access = Api\Link::file_access($app,$id,$required,$rel_path,Vfs::$user);
117 119
 			$what = "from Api\Link::file_access('$app',$id,$required,'$rel_path,".Vfs::$user.")";
118 120
 		}
119
-		if (self::DEBUG) error_log(__METHOD__."($url,$check) user=".Vfs::$user." ($what) ".($access?"access granted ($app:$id:$rel_path)":'no access!!!'));
121
+		if (self::DEBUG)
122
+		{
123
+			error_log(__METHOD__."($url,$check) user=".Vfs::$user." ($what) ".($access?"access granted ($app:$id:$rel_path)":'no access!!!'));
124
+		}
120 125
 		return $access;
121 126
 	}
122 127
 
@@ -180,7 +185,10 @@  discard block
 block discarded – undo
180 185
 				);
181 186
 			}
182 187
 		}
183
-		if (self::DEBUG) error_log(__METHOD__."('$url', $flags) calling parent::url_stat(,,".array2string($eacl_check).') returning '.array2string($ret));
188
+		if (self::DEBUG)
189
+		{
190
+			error_log(__METHOD__."('$url', $flags) calling parent::url_stat(,,".array2string($eacl_check).') returning '.array2string($ret));
191
+		}
184 192
 		return $ret;
185 193
 	}
186 194
 
@@ -238,19 +246,30 @@  discard block
 block discarded – undo
238 246
 
239 247
 		if($path[0] != '/')
240 248
 		{
241
-			if (strpos($path,'?') !== false) $query = Vfs::parse_url($path,PHP_URL_QUERY);
249
+			if (strpos($path,'?') !== false)
250
+			{
251
+				$query = Vfs::parse_url($path,PHP_URL_QUERY);
252
+			}
242 253
 			$path = Vfs::parse_url($path,PHP_URL_PATH).($query ? '?'.$query : '');
243 254
 		}
244 255
 		list(,$apps,$app,$id) = explode('/',$path);
245 256
 
246 257
 		$ret = false;
247
-		if ($apps == 'apps' && $app && !$id || self::check_extended_acl($path,Vfs::WRITABLE))	// app directory itself is allways ok
258
+		if ($apps == 'apps' && $app && !$id || self::check_extended_acl($path,Vfs::WRITABLE))
259
+		{
260
+			// app directory itself is allways ok
248 261
 		{
249
-			$current_is_root = Vfs::$is_root; Vfs::$is_root = true;
262
+			$current_is_root = Vfs::$is_root;
263
+		}
264
+		Vfs::$is_root = true;
250 265
 			$current_user = Vfs::$user; Vfs::$user = 0;
251 266
 
252 267
 			$ret = parent::mkdir($path,0,$options|STREAM_MKDIR_RECURSIVE);
253
-			if ($id) parent::chmod($path,0);	// no other rights
268
+			if ($id)
269
+			{
270
+				parent::chmod($path,0);
271
+			}
272
+			// no other rights
254 273
 
255 274
 			Vfs::$user = $current_user;
256 275
 			Vfs::$is_root = $current_is_root;
Please login to merge, or discard this patch.
setup/fix_mysql_charset.php 1 patch
Braces   +33 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,7 +41,10 @@  discard block
 block discarded – undo
41 41
 $ServerInfo = $db->Link_ID->ServerInfo();
42 42
 $db_version = (float) $ServerInfo['version'];
43 43
 
44
-if ($running_standalone || $_REQUEST['debug']) echo "<p>DB-Type='<b>{$GLOBALS['egw_setup']->db->Type}</b>', DB-Version=<b>$db_version</b> ($ServerInfo[description]), eGroupWare system_charset='<b>{$GLOBALS['egw_setup']->system_charset}</b>', DB-connection charset was '<b>{$GLOBALS['egw_setup']->db_charset_was}</b>'</p>\n";
44
+if ($running_standalone || $_REQUEST['debug'])
45
+{
46
+	echo "<p>DB-Type='<b>{$GLOBALS['egw_setup']->db->Type}</b>', DB-Version=<b>$db_version</b> ($ServerInfo[description]), eGroupWare system_charset='<b>{$GLOBALS['egw_setup']->system_charset}</b>', DB-connection charset was '<b>{$GLOBALS['egw_setup']->db_charset_was}</b>'</p>\n";
47
+}
45 48
 
46 49
 $mysql_system_charset = isset($charset2mysql[$GLOBALS['egw_setup']->system_charset]) ?
47 50
 	$charset2mysql[$GLOBALS['egw_setup']->system_charset] : $GLOBALS['egw_setup']->system_charset;
@@ -84,15 +87,21 @@  discard block
 block discarded – undo
84 87
 				list(,$type,$size) = $matches;
85 88
 				list($charset) = explode('_',$column['Collation']);
86 89
 
87
-				if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset];
90
+				if (isset($mysql2charset[$charset]))
91
+				{
92
+					$charset = $mysql2charset[$charset];
93
+				}
88 94
 
89 95
 				if ($charset != $GLOBALS['egw_setup']->system_charset)
90 96
 				{
91 97
 					$col = $column['Field'];
92 98
 
93
-					if ($type == 'varchar' || $type == 'char')	// old schema_proc (pre 1.0.1) used also char
99
+					if ($type == 'varchar' || $type == 'char')
100
+					{
101
+						// old schema_proc (pre 1.0.1) used also char
94 102
 					{
95 103
 						$type = 'varchar('.$size.')';
104
+					}
96 105
 						$bintype = 'varbinary('.$size.')';
97 106
 					}
98 107
 					else
@@ -125,7 +134,10 @@  discard block
 block discarded – undo
125 134
 			}
126 135
 		}
127 136
 		list($charset) = explode('_',$collation);
128
-		if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset];
137
+		if (isset($mysql2charset[$charset]))
138
+		{
139
+			$charset = $mysql2charset[$charset];
140
+		}
129 141
 		if ($charset != $GLOBALS['egw_setup']->system_charset)
130 142
 		{
131 143
 			$alter_table[] = " DEFAULT CHARACTER SET $mysql_system_charset";
@@ -134,7 +146,10 @@  discard block
 block discarded – undo
134 146
 		{
135 147
 			$alter_table = "ALTER TABLE $table\n".implode(",\n",$alter_table);
136 148
 
137
-			if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table)."</p>\n";
149
+			if ($running_standalone || $_REQUEST['debug'])
150
+			{
151
+				echo '<p>'.nl2br($alter_table)."</p>\n";
152
+			}
138 153
 			if (!$db->query($alter_table,__LINE__,__FILE__))
139 154
 			{
140 155
 				echo "<p>SQL Error: ".nl2br($alter_table)."</p>\n";
@@ -150,7 +165,10 @@  discard block
 block discarded – undo
150 165
 			{
151 166
 				$alter_table_back = "ALTER TABLE $table\n".implode(",\n",$alter_table_back);
152 167
 
153
-				if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table_back)."</p>\n";
168
+				if ($running_standalone || $_REQUEST['debug'])
169
+				{
170
+					echo '<p>'.nl2br($alter_table_back)."</p>\n";
171
+				}
154 172
 				if (!$db->query($alter_table_back,__LINE__,__FILE__))
155 173
 				{
156 174
 					echo "<p><b>SQL Error</b>: ".nl2br($alter_table_back)."</p>\n";
@@ -168,7 +186,10 @@  discard block
 block discarded – undo
168 186
 	if (preg_match('/CHARACTER SET ([a-z1-9_-]+) /i',$create_db,$matches) && $matches[1] != $mysql_system_charset)
169 187
 	{
170 188
 		$alter_db = "ALTER DATABASE `$db->Database` DEFAULT CHARACTER SET $mysql_system_charset";
171
-		if ($running_standalone || $_REQUEST['debug']) echo '<p>'.$alter_db."</p>\n";
189
+		if ($running_standalone || $_REQUEST['debug'])
190
+		{
191
+			echo '<p>'.$alter_db."</p>\n";
192
+		}
172 193
 		$db->query($alter_db,__LINE__,__FILE__);
173 194
 	}
174 195
 }
@@ -176,5 +197,8 @@  discard block
 block discarded – undo
176 197
 {
177 198
 	echo "<p>$tables_modified tables changed to our system_charset {$GLOBALS['egw_setup']->system_charset}($mysql_system_charset)</p>\n";
178 199
 
179
-	if ($running_standalone) $GLOBALS['egw_setup']->html->show_footer();
180
-}
200
+	if ($running_standalone)
201
+	{
202
+		$GLOBALS['egw_setup']->html->show_footer();
203
+	}
204
+	}
Please login to merge, or discard this patch.
setup/check_install.php 1 patch
Braces   +119 added lines, -30 removed lines patch added patch discarded remove patch
@@ -239,10 +239,15 @@  discard block
 block discarded – undo
239 239
 		foreach(explode(PATH_SEPARATOR,$open_basedir) as $dir)
240 240
 		{
241 241
 			$dir = realpath($dir);
242
-			if (($sp_visible = substr($session_path,0,strlen($dir)) == $dir)) break;
242
+			if (($sp_visible = substr($session_path,0,strlen($dir)) == $dir))
243
+			{
244
+				break;
245
+			}
243 246
 		}
244 247
 	}
245
-	if ($sp_visible)	// only check if session_save_path is visible by webserver
248
+	if ($sp_visible)
249
+	{
250
+		// only check if session_save_path is visible by webserver
246 251
 	{
247 252
 		$checks[$session_path] = array(
248 253
 			'func' => 'permission_check',
@@ -251,17 +256,25 @@  discard block
 block discarded – undo
251 256
 			'error' => lang('You will NOT be able to log into eGroupWare using PHP sessions: "session could not be verified" !!!'),
252 257
 		);
253 258
 	}
259
+	}
254 260
 }
255 261
 $setup_info = $GLOBALS['egw_setup']->detection->get_versions();
256 262
 foreach($setup_info as $app => $app_data)
257 263
 {
258
-	if (!isset($app_data['check_install'])) continue;
264
+	if (!isset($app_data['check_install']))
265
+	{
266
+		continue;
267
+	}
259 268
 
260 269
 	foreach ($app_data['check_install'] as $name => $data)
261 270
 	{
262 271
 		if (isset($checks[$name]))
263 272
 		{
264
-			if ($checks[$name] == $data) continue;	// identical check --> ignore it
273
+			if ($checks[$name] == $data)
274
+			{
275
+				continue;
276
+			}
277
+			// identical check --> ignore it
265 278
 
266 279
 			if ($data['func'] == 'pear_check' || in_array($data['func'],array('extension_check','php_ini_check')) && !isset($data['warning']))
267 280
 			{
@@ -269,9 +282,18 @@  discard block
 block discarded – undo
269 282
 				{
270 283
 					$checks[$name]['from'] = array($checks[$name]['from']);
271 284
 				}
272
-				if (!isset($data['from'])) $data['from'] = $app;
273
-				if (!isset($checks[$name]['from']) || !is_array($checks[$name]['from'])) $checks[$name]['from'] = array();
274
-				if (!in_array($data['from'],$checks[$name]['from'])) $checks[$name]['from'][] = $data['from'];
285
+				if (!isset($data['from']))
286
+				{
287
+					$data['from'] = $app;
288
+				}
289
+				if (!isset($checks[$name]['from']) || !is_array($checks[$name]['from']))
290
+				{
291
+					$checks[$name]['from'] = array();
292
+				}
293
+				if (!in_array($data['from'],$checks[$name]['from']))
294
+				{
295
+					$checks[$name]['from'][] = $data['from'];
296
+				}
275 297
 			}
276 298
 			else
277 299
 			{
@@ -280,7 +302,10 @@  discard block
 block discarded – undo
280 302
 		}
281 303
 		else
282 304
 		{
283
-			if (!isset($data['from'])) $data['from'] = $app;
305
+			if (!isset($data['from']))
306
+			{
307
+				$data['from'] = $app;
308
+			}
284 309
 			$checks[$name] = $data;
285 310
 		}
286 311
 		//echo "added check $data[func]($name) for $app"; _debug_array($data);
@@ -298,7 +323,10 @@  discard block
 block discarded – undo
298 323
 		}
299 324
 	}
300 325
 }
301
-if ($checks) $sorted_checks += $checks;
326
+if ($checks)
327
+{
328
+	$sorted_checks += $checks;
329
+}
302 330
 
303 331
 function php_version($name,$args)
304 332
 {
@@ -351,22 +379,35 @@  discard block
 block discarded – undo
351 379
 	}
352 380
 	@include_once 'PEAR/Config.php';
353 381
 
354
-	if (!class_exists('PEAR_Config')) return false;
382
+	if (!class_exists('PEAR_Config'))
383
+	{
384
+		return false;
385
+	}
355 386
 
356 387
 	$config = new PEAR_Config('',$pear_config);
357 388
 	//echo "<pre>config = ".print_r($config,true)."</pre>\n";
358 389
 
359
-	if (empty($channel)) $channel = $config->get('default_channel');
390
+	if (empty($channel))
391
+	{
392
+		$channel = $config->get('default_channel');
393
+	}
360 394
 	//echo "<pre>channel = ".print_r($channel,true)."</pre>\n";
361 395
 
362
-	if (!method_exists($config,'getRegistry')) return false;	// PEAR version to old
396
+	if (!method_exists($config,'getRegistry'))
397
+	{
398
+		return false;
399
+	}
400
+	// PEAR version to old
363 401
 
364 402
 	$reg = &$config->getRegistry();
365 403
 	//echo "<pre>reg = ".print_r($reg,true)."</pre>\n";
366 404
 
367 405
 	// a bug in pear causes an endless loop if the install-dir does not exist
368 406
 	// bug reported: http://pear.php.net/bugs/bug.php?id=11317
369
-	if (!file_exists($reg->install_dir)) return false;
407
+	if (!file_exists($reg->install_dir))
408
+	{
409
+		return false;
410
+	}
370 411
 
371 412
 	$installed = $reg->packageInfo(null,null,$channel);
372 413
 
@@ -376,7 +417,10 @@  discard block
 block discarded – undo
376 417
 	{
377 418
 		$name = isset($package['package']) ? $package['package'] : $package['name'];
378 419
 		$version = $package['version'];
379
-		if (is_array($version)) $version = $version['release'];
420
+		if (is_array($version))
421
+		{
422
+			$version = $version['release'];
423
+		}
380 424
 
381 425
 		$packages[$name] = $version;
382 426
 		//echo "<p>$name: ".print_r($package['version'],true)."</p>\n";
@@ -415,7 +459,10 @@  discard block
 block discarded – undo
415 459
 		{
416 460
 			$pear_available = $found = true;
417 461
 			// check if package is installed
418
-			if ($package && isset($pear_packages[$package])) $available = true;
462
+			if ($package && isset($pear_packages[$package]))
463
+			{
464
+				$available = true;
465
+			}
419 466
 			// check if it's the right version
420 467
 			$version_available = $pear_packages[$package ? $package : 'PEAR'];
421 468
 		}
@@ -425,7 +472,10 @@  discard block
 block discarded – undo
425 472
 			{
426 473
 				$pear_available = @include_once('PEAR.php');
427 474
 
428
-				if (!class_exists('PEAR')) $pear_available = false;
475
+				if (!class_exists('PEAR'))
476
+				{
477
+					$pear_available = false;
478
+				}
429 479
 			}
430 480
 			$found = $pear_available;
431 481
 			if ($pear_available && $package)
@@ -434,7 +484,10 @@  discard block
 block discarded – undo
434 484
 
435 485
 				$found = @include_once($file);
436 486
 
437
-				if (!class_exists($package)) $found = false;
487
+				if (!class_exists($package))
488
+				{
489
+					$found = false;
490
+				}
438 491
 			}
439 492
 		}
440 493
 	}
@@ -445,10 +498,13 @@  discard block
 block discarded – undo
445 498
 		($available ? ($version_available ? $version_available : lang('True')) :
446 499
 		($found ? lang('Found, but unknown version') : lang('False')))."</span></div>\n";
447 500
 
448
-	if (!$available)	// give further info only if not availible
501
+	if (!$available)
502
+	{
503
+		// give further info only if not availible
449 504
 	{
450 505
 		echo '<div class="setup_info">' . lang('PEAR%1 is needed by: %2.',$package ? '::'.$package : '',
451 506
 			is_array($args['from']) ? implode(', ',$args['from']) : $args['from']);
507
+	}
452 508
 
453 509
 		// if using Composer, dont confuse user with PEAR ;-)
454 510
 		if (file_exists(EGW_SERVER_ROOT.'/vendor'))
@@ -541,34 +597,55 @@  discard block
 block discarded – undo
541 597
 
542 598
 function verbosePerms( $in_Perms )
543 599
 {
544
-	if($in_Perms & 0x1000)     // FIFO pipe
600
+	if($in_Perms & 0x1000)
601
+	{
602
+		// FIFO pipe
545 603
 	{
546 604
 		$sP = 'p';
547 605
 	}
548
-	elseif($in_Perms & 0x2000) // Character special
606
+	}
607
+	elseif($in_Perms & 0x2000)
608
+	{
609
+		// Character special
549 610
 	{
550 611
 		$sP = 'c';
551 612
 	}
552
-	elseif($in_Perms & 0x4000) // Directory
613
+	}
614
+	elseif($in_Perms & 0x4000)
615
+	{
616
+		// Directory
553 617
 	{
554 618
 		$sP = 'd';
555 619
 	}
556
-	elseif($in_Perms & 0x6000) // Block special
620
+	}
621
+	elseif($in_Perms & 0x6000)
622
+	{
623
+		// Block special
557 624
 	{
558 625
 		$sP = 'b';
559 626
 	}
560
-	elseif($in_Perms & 0x8000) // Regular
627
+	}
628
+	elseif($in_Perms & 0x8000)
629
+	{
630
+		// Regular
561 631
 	{
562 632
 		$sP = '-';
563 633
 	}
564
-	elseif($in_Perms & 0xA000) // Symbolic Link
634
+	}
635
+	elseif($in_Perms & 0xA000)
636
+	{
637
+		// Symbolic Link
565 638
 	{
566 639
 		$sP = 'l';
567 640
 	}
568
-	elseif($in_Perms & 0xC000) // Socket
641
+	}
642
+	elseif($in_Perms & 0xC000)
643
+	{
644
+		// Socket
569 645
 	{
570 646
 		$sP = 's';
571 647
 	}
648
+	}
572 649
 	else                         // UNKNOWN
573 650
 	{
574 651
 		$sP = 'u';
@@ -709,9 +786,15 @@  discard block
 block discarded – undo
709 786
 				$Ok = $Ok && permission_check(($name!='.'?$name.'/':'').$file,$args,False);
710 787
 			}
711 788
 		}
712
-		if ($handle) closedir($handle);
789
+		if ($handle)
790
+		{
791
+			closedir($handle);
792
+		}
793
+	}
794
+	if ($verbose)
795
+	{
796
+		echo "\n";
713 797
 	}
714
-	if ($verbose) echo "\n";
715 798
 
716 799
 	return $Ok;
717 800
 }
@@ -719,7 +802,10 @@  discard block
 block discarded – undo
719 802
 function mk_value($value)
720 803
 {
721 804
 	$matches = null;
722
-	if (!preg_match('/^([0-9]+)([mk]+)$/i',$value,$matches)) return $value;
805
+	if (!preg_match('/^([0-9]+)([mk]+)$/i',$value,$matches))
806
+	{
807
+		return $value;
808
+	}
723 809
 
724 810
 	return (strtolower($matches[2]) == 'm' ? 1024*1024 : 1024) * (int) $matches[1];
725 811
 }
@@ -848,7 +934,8 @@  discard block
 block discarded – undo
848 934
 		'T_footer' => 'footer.tpl',
849 935
 	));
850 936
 	$ConfigDomain = $_REQUEST['ConfigDomain'];
851
-	if (@$_GET['intro']) {
937
+	if (@$_GET['intro'])
938
+	{
852 939
 		if(($ConfigLang = setup::get_lang()))
853 940
 		{
854 941
 			$GLOBALS['egw_setup']->set_cookie('ConfigLang',$ConfigLang,(int) (time()+(1200*9)),'/');
@@ -865,7 +952,9 @@  discard block
 block discarded – undo
865 952
 		echo '<p><a href="manageheader.php">'.lang('Skip the installation tests (not recommended)')."</a></p>\n";
866 953
 		$setup_tpl->pparse('out','T_footer');
867 954
 		exit;
868
-	} else {
955
+	}
956
+	else
957
+	{
869 958
 		$GLOBALS['egw_setup']->html->show_header(lang('Checking the eGroupWare Installation'),False,'config',$ConfigDomain ? $ConfigDomain . '(' . @$GLOBALS['egw_domain'][$ConfigDomain]['db_type'] . ')' : '');
870 959
 		echo '<h1>'.lang('Checking the eGroupWare Installation')."</h1>\n";
871 960
 		# echo "<pre style=\"text-align: left;\">\n";;
Please login to merge, or discard this patch.
setup/manageheader.php 1 patch
Braces   +38 added lines, -10 removed lines patch added patch discarded remove patch
@@ -84,14 +84,21 @@  discard block
 block discarded – undo
84 84
 {
85 85
 	$GLOBALS['egw_info']['server']['server_root'] = EGW_SERVER_ROOT;
86 86
 }
87
-if (isset($_POST['setting']))	// Post of the header-form
87
+if (isset($_POST['setting']))
88 88
 {
89
-	$validation_errors = check_header_form();	// validate the submitted form
89
+	// Post of the header-form
90
+{
91
+	$validation_errors = check_header_form();
92
+}
93
+// validate the submitted form
90 94
 }
91
-if (!isset($_POST['action']) || $validation_errors)	// generate form to edit the header
95
+if (!isset($_POST['action']) || $validation_errors)
96
+{
97
+	// generate form to edit the header
92 98
 {
93 99
 	show_header_form($validation_errors);
94 100
 }
101
+}
95 102
 else
96 103
 {
97 104
 	$newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']);
@@ -156,7 +163,10 @@  discard block
 block discarded – undo
156 163
 	// setting the non-domain settings from the posted content
157 164
 	foreach($_POST['setting'] as $name => $value)
158 165
 	{
159
-		if (get_magic_quotes_gpc()) $value = stripslashes($value);
166
+		if (get_magic_quotes_gpc())
167
+		{
168
+			$value = stripslashes($value);
169
+		}
160 170
 
161 171
 		switch($name)
162 172
 		{
@@ -166,7 +176,10 @@  discard block
 block discarded – undo
166 176
 				$GLOBALS['egw_info']['server'][$name] = $value == 'True';
167 177
 				break;
168 178
 			case 'new_admin_password':
169
-				if ($value) $GLOBALS['egw_info']['server']['header_admin_password'] = $value;
179
+				if ($value)
180
+				{
181
+					$GLOBALS['egw_info']['server']['header_admin_password'] = $value;
182
+				}
170 183
 				break;
171 184
 			default:
172 185
 				$GLOBALS['egw_info']['server'][$name] = $value;
@@ -186,11 +199,17 @@  discard block
 block discarded – undo
186 199
 
187 200
 		foreach($_POST['setting_'.$key] as $name => $value)
188 201
 		{
189
-			if (get_magic_quotes_gpc()) $value = stripslashes($value);
202
+			if (get_magic_quotes_gpc())
203
+			{
204
+				$value = stripslashes($value);
205
+			}
190 206
 
191 207
 			if ($name == 'new_config_passwd')
192 208
 			{
193
-				if ($value) $GLOBALS['egw_domain'][$domain]['config_passwd'] = $value;
209
+				if ($value)
210
+				{
211
+					$GLOBALS['egw_domain'][$domain]['config_passwd'] = $value;
212
+				}
194 213
 				continue;
195 214
 			}
196 215
 			$GLOBALS['egw_domain'][$domain][$name] = $value;
@@ -255,7 +274,10 @@  discard block
 block discarded – undo
255 274
 	}
256 275
 	$setup_tpl->set_var('js_default_db_ports',$js_default_db_ports);
257 276
 
258
-	if ($validation_errors) $setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n");
277
+	if ($validation_errors)
278
+	{
279
+		$setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n");
280
+	}
259 281
 
260 282
 	if ($_POST['adddomain'])
261 283
 	{
@@ -275,7 +297,10 @@  discard block
 block discarded – undo
275 297
 				$setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'),' selected="selected"');
276 298
 				break;
277 299
 			default:
278
-				if (!is_array($value)) $setup_tpl->set_var($name,htmlspecialchars($value));
300
+				if (!is_array($value))
301
+				{
302
+					$setup_tpl->set_var($name,htmlspecialchars($value));
303
+				}
279 304
 				break;
280 305
 		}
281 306
 	}
@@ -300,10 +325,13 @@  discard block
 block discarded – undo
300 325
 		$setup_tpl->set_var('db_domain',htmlspecialchars($domain));
301 326
 		foreach($data as $name => $value)
302 327
 		{
303
-			if ($name == 'db_port' && !$value)	// Set default here if the admin didn't set a port yet
328
+			if ($name == 'db_port' && !$value)
329
+			{
330
+				// Set default here if the admin didn't set a port yet
304 331
 			{
305 332
 				$value = $GLOBALS['egw_setup']->header->default_db_ports[$data['db_type']];
306 333
 			}
334
+			}
307 335
 			$setup_tpl->set_var($name,htmlspecialchars($value));
308 336
 		}
309 337
 		$dbtype_options = '';
Please login to merge, or discard this patch.
setup/inc/class.setup_cmd_hooks.inc.php 1 patch
Braces   +9 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,11 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	protected function exec($check_only=false)
49 49
 	{
50
-		if ($check_only) return true;	// nothing to check, no arguments ...
50
+		if ($check_only)
51
+		{
52
+			return true;
53
+		}
54
+		// nothing to check, no arguments ...
51 55
 
52 56
 		// instanciate setup object and check authorisation
53 57
 		$this->check_setup_auth($this->config_user,$this->config_passwd,$this->domain);
@@ -57,7 +61,10 @@  discard block
 block discarded – undo
57 61
 		global $setup_info;
58 62
 		foreach($setup_info as $appname => $info)
59 63
 		{
60
-			if ($info['currentver']) self::$egw_setup->register_hooks($appname);
64
+			if ($info['currentver'])
65
+			{
66
+				self::$egw_setup->register_hooks($appname);
67
+			}
61 68
 		}
62 69
 		$this->restore_db();
63 70
 
Please login to merge, or discard this patch.
setup/inc/class.setup_detection.inc.php 1 patch
Braces   +20 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@  discard block
 block discarded – undo
65 65
 					foreach($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->applications_table,'*',false,__LINE__,__FILE__) as $row)
66 66
 					{
67 67
 						$app = $row['app_name'];
68
-						if (!isset($setup_info[$app]))	// app source no longer there
68
+						if (!isset($setup_info[$app]))
69
+						{
70
+							// app source no longer there
69 71
 						{
70 72
 							$setup_info[$app] = array(
71 73
 								'name' => $app,
@@ -73,6 +75,7 @@  discard block
 block discarded – undo
73 75
 								'version' => 'deleted',
74 76
 							);
75 77
 						}
78
+						}
76 79
 						$setup_info[$app]['currentver'] = $row['app_version'];
77 80
 						$setup_info[$app]['enabled'] = $row['app_enabled'];
78 81
 					}
@@ -212,7 +215,9 @@  discard block
 block discarded – undo
212 215
 					if ($setup_info['depends'][$depkey]['status'] == False)
213 216
 					{
214 217
 						/* Only set this if it has not already failed to upgrade - Milosch */
215
-						if($setup_info[$key]['status'] != 'F')//&& $setup_info[$key]['status'] != 'C')
218
+						if($setup_info[$key]['status'] != 'F')
219
+						{
220
+							//&& $setup_info[$key]['status'] != 'C')
216 221
 						{
217 222
 							/* Added check for status U - uninstalled apps carry this flag (upgrade from nothing == install).
218 223
 							 * This should fix apps showing post-install dep failure when they are not yet installed.
@@ -220,6 +225,7 @@  discard block
 block discarded – undo
220 225
 							if($setup_info[$key]['status'] == 'C' || $setup_info[$key]['status'] == 'U')
221 226
 							{
222 227
 								$setup_info[$key]['status'] = 'D';
228
+						}
223 229
 							}
224 230
 							else
225 231
 							{
@@ -292,7 +298,10 @@  discard block
 block discarded – undo
292 298
 	 */
293 299
 	function check_db($setup_info=null)
294 300
 	{
295
-		if (!$setup_info) $setup_info = $GLOBALS['setup_info'];
301
+		if (!$setup_info)
302
+		{
303
+			$setup_info = $GLOBALS['setup_info'];
304
+		}
296 305
 
297 306
 		try {	// catch DB errors
298 307
 			if (!$GLOBALS['egw_setup']->db->Link_ID)
@@ -482,11 +491,14 @@  discard block
 block discarded – undo
482 491
 				{
483 492
 					echo '<br>check_app_tables(): Checking: ' . $appname . ',table: ' . $val;
484 493
 				}
485
-				if(!in_array($val,$tables) && !in_array(strtolower($val),$tables))	// names in tables might be lowercase
494
+				if(!in_array($val,$tables) && !in_array(strtolower($val),$tables))
495
+				{
496
+					// names in tables might be lowercase
486 497
 				{
487 498
 					if($GLOBALS['DEBUG'])
488 499
 					{
489 500
 						echo '<br>check_app_tables(): ' . $val . ' missing!';
501
+				}
490 502
 					}
491 503
 					if(!$any)
492 504
 					{
@@ -543,9 +555,12 @@  discard block
 block discarded – undo
543 555
 			$msg = lang('does not exist');
544 556
 			return false;
545 557
 		}
546
-		if (!@is_writeable($dir) && $_SERVER['HTTP_HOST'])	// only do the check if we run by the webserver
558
+		if (!@is_writeable($dir) && $_SERVER['HTTP_HOST'])
559
+		{
560
+			// only do the check if we run by the webserver
547 561
 		{
548 562
 			$msg = lang('is not writeable by the webserver');
563
+		}
549 564
 			return false;
550 565
 		}
551 566
 		if ($check_in_docroot)
Please login to merge, or discard this patch.