@@ -87,7 +87,10 @@ discard block |
||
| 87 | 87 | // search for plugins with additional filemanager views |
| 88 | 88 | foreach(Api\Hooks::process('filemanager_views') as $views) |
| 89 | 89 | { |
| 90 | - if (is_array($views)) static::$views += $views; |
|
| 90 | + if (is_array($views)) |
|
| 91 | + { |
|
| 92 | + static::$views += $views; |
|
| 93 | + } |
|
| 91 | 94 | } |
| 92 | 95 | static::$views_init = true; |
| 93 | 96 | } |
@@ -310,7 +313,10 @@ discard block |
||
| 310 | 313 | $content['nm']['home_dir'] = static::get_home_dir(); |
| 311 | 314 | $content['nm']['view'] = $GLOBALS['egw_info']['user']['preferences']['filemanager']['nm_view']; |
| 312 | 315 | |
| 313 | - if (isset($_GET['msg'])) $msg = $_GET['msg']; |
|
| 316 | + if (isset($_GET['msg'])) |
|
| 317 | + { |
|
| 318 | + $msg = $_GET['msg']; |
|
| 319 | + } |
|
| 314 | 320 | |
| 315 | 321 | // Blank favorite set via GET needs special handling for path |
| 316 | 322 | if (isset($_GET['favorite']) && $_GET['favorite'] == 'blank') |
@@ -344,7 +350,10 @@ discard block |
||
| 344 | 350 | // reset lettersearch as it confuses users (they think the dir is empty) |
| 345 | 351 | $content['nm']['searchletter'] = false; |
| 346 | 352 | // switch recusive display off |
| 347 | - if (!$content['nm']['filter']) $content['nm']['filter'] = ''; |
|
| 353 | + if (!$content['nm']['filter']) |
|
| 354 | + { |
|
| 355 | + $content['nm']['filter'] = ''; |
|
| 356 | + } |
|
| 348 | 357 | } |
| 349 | 358 | } |
| 350 | 359 | $view = static::get_view(); |
@@ -392,37 +401,70 @@ discard block |
||
| 392 | 401 | { |
| 393 | 402 | $tpl = new Etemplate('filemanager.index'); |
| 394 | 403 | |
| 395 | - if($msg) Framework::message($msg); |
|
| 404 | + if($msg) |
|
| 405 | + { |
|
| 406 | + Framework::message($msg); |
|
| 407 | + } |
|
| 396 | 408 | |
| 397 | 409 | if (($content['nm']['action'] || $content['nm']['rows']) && (empty($content['button']) || !isset($content['button']))) |
| 398 | 410 | { |
| 399 | 411 | if ($content['nm']['action']) |
| 400 | 412 | { |
| 401 | 413 | $msg = static::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']); |
| 402 | - if($msg) Framework::message($msg); |
|
| 414 | + if($msg) |
|
| 415 | + { |
|
| 416 | + Framework::message($msg); |
|
| 417 | + } |
|
| 403 | 418 | |
| 404 | 419 | // clean up after action |
| 405 | 420 | unset($content['nm']['selected']); |
| 406 | 421 | // reset any occasion where action may be stored, as it may be ressurected out of the helpers by etemplate, which is quite unconvenient in case of action delete |
| 407 | - if (isset($content['nm']['action'])) unset($content['nm']['action']); |
|
| 408 | - if (isset($content['nm']['nm_action'])) unset($content['nm']['nm_action']); |
|
| 409 | - if (isset($content['nm_action'])) unset($content['nm_action']); |
|
| 422 | + if (isset($content['nm']['action'])) |
|
| 423 | + { |
|
| 424 | + unset($content['nm']['action']); |
|
| 425 | + } |
|
| 426 | + if (isset($content['nm']['nm_action'])) |
|
| 427 | + { |
|
| 428 | + unset($content['nm']['nm_action']); |
|
| 429 | + } |
|
| 430 | + if (isset($content['nm_action'])) |
|
| 431 | + { |
|
| 432 | + unset($content['nm_action']); |
|
| 433 | + } |
|
| 410 | 434 | // we dont use ['nm']['rows']['delete'], so unset it, if it is present |
| 411 | - if (isset($content['nm']['rows']['delete'])) unset($content['nm']['rows']['delete']); |
|
| 435 | + if (isset($content['nm']['rows']['delete'])) |
|
| 436 | + { |
|
| 437 | + unset($content['nm']['rows']['delete']); |
|
| 438 | + } |
|
| 412 | 439 | } |
| 413 | 440 | elseif($content['nm']['rows']['delete']) |
| 414 | 441 | { |
| 415 | 442 | $msg = static::action('delete',array_keys($content['nm']['rows']['delete']),$content['nm']['path']); |
| 416 | - if($msg) Framework::message($msg); |
|
| 443 | + if($msg) |
|
| 444 | + { |
|
| 445 | + Framework::message($msg); |
|
| 446 | + } |
|
| 417 | 447 | |
| 418 | 448 | // clean up after action |
| 419 | 449 | unset($content['nm']['rows']['delete']); |
| 420 | 450 | // reset any occasion where action may be stored, as we use ['nm']['rows']['delete'] anyhow |
| 421 | 451 | // we clean this up, as it may be ressurected out of the helpers by etemplate, which is quite unconvenient in case of action delete |
| 422 | - if (isset($content['nm']['action'])) unset($content['nm']['action']); |
|
| 423 | - if (isset($content['nm']['nm_action'])) unset($content['nm']['nm_action']); |
|
| 424 | - if (isset($content['nm_action'])) unset($content['nm_action']); |
|
| 425 | - if (isset($content['nm']['selected'])) unset($content['nm']['selected']); |
|
| 452 | + if (isset($content['nm']['action'])) |
|
| 453 | + { |
|
| 454 | + unset($content['nm']['action']); |
|
| 455 | + } |
|
| 456 | + if (isset($content['nm']['nm_action'])) |
|
| 457 | + { |
|
| 458 | + unset($content['nm']['nm_action']); |
|
| 459 | + } |
|
| 460 | + if (isset($content['nm_action'])) |
|
| 461 | + { |
|
| 462 | + unset($content['nm_action']); |
|
| 463 | + } |
|
| 464 | + if (isset($content['nm']['selected'])) |
|
| 465 | + { |
|
| 466 | + unset($content['nm']['selected']); |
|
| 467 | + } |
|
| 426 | 468 | } |
| 427 | 469 | unset($content['nm']['rows']); |
| 428 | 470 | Api\Cache::setSession('filemanager', 'index',$content['nm']); |
@@ -586,9 +628,12 @@ discard block |
||
| 586 | 628 | foreach(Vfs::find($path) as $p) |
| 587 | 629 | { |
| 588 | 630 | $to = $dir.substr($p,$len); |
| 589 | - if ($to == $p) // cant copy into itself! |
|
| 631 | + if ($to == $p) |
|
| 632 | + { |
|
| 633 | + // cant copy into itself! |
|
| 590 | 634 | { |
| 591 | 635 | ++$errs; |
| 636 | + } |
|
| 592 | 637 | continue; |
| 593 | 638 | } |
| 594 | 639 | if (($is_dir = Vfs::is_dir($p)) && Vfs::mkdir($to,null,STREAM_MKDIR_RECURSIVE)) |
@@ -643,7 +688,10 @@ discard block |
||
| 643 | 688 | continue; |
| 644 | 689 | } |
| 645 | 690 | } |
| 646 | - if ($target[0] != '/') $target = Vfs::concat($dir, $target); |
|
| 691 | + if ($target[0] != '/') |
|
| 692 | + { |
|
| 693 | + $target = Vfs::concat($dir, $target); |
|
| 694 | + } |
|
| 647 | 695 | if (!Vfs::stat($target)) |
| 648 | 696 | { |
| 649 | 697 | return lang('Link target %1 not found!', Vfs::decodePath($target)); |
@@ -686,10 +734,16 @@ discard block |
||
| 686 | 734 | switch($action) |
| 687 | 735 | { |
| 688 | 736 | case 'document': |
| 689 | - if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['filemanager']['default_document']; |
|
| 737 | + if (!$settings) |
|
| 738 | + { |
|
| 739 | + $settings = $GLOBALS['egw_info']['user']['preferences']['filemanager']['default_document']; |
|
| 740 | + } |
|
| 690 | 741 | $document_merge = new filemanager_merge(Vfs::decodePath($dir)); |
| 691 | 742 | $msg = $document_merge->download($settings, $selected, '', $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_dir']); |
| 692 | - if($msg) return $msg; |
|
| 743 | + if($msg) |
|
| 744 | + { |
|
| 745 | + return $msg; |
|
| 746 | + } |
|
| 693 | 747 | $errs = count($selected); |
| 694 | 748 | return false; |
| 695 | 749 | } |
@@ -726,7 +780,9 @@ discard block |
||
| 726 | 780 | unset($selected[$key]); |
| 727 | 781 | } |
| 728 | 782 | } |
| 729 | - if ($selected) // somethings left to delete |
|
| 783 | + if ($selected) |
|
| 784 | + { |
|
| 785 | + // somethings left to delete |
|
| 730 | 786 | { |
| 731 | 787 | // some precaution to never allow to (recursivly) remove /, /apps or /home |
| 732 | 788 | foreach((array)$selected as $path) |
@@ -734,6 +790,7 @@ discard block |
||
| 734 | 790 | if (preg_match('/^\/?(home|apps|)\/*$/',$path)) |
| 735 | 791 | { |
| 736 | 792 | $errs++; |
| 793 | + } |
|
| 737 | 794 | return lang("Cautiously rejecting to remove folder '%1'!",Vfs::decodePath($path)); |
| 738 | 795 | } |
| 739 | 796 | } |
@@ -786,7 +843,10 @@ discard block |
||
| 786 | 843 | { |
| 787 | 844 | Api\Cache::setSession('filemanager', 'index',$query); |
| 788 | 845 | } |
| 789 | - if(!$query['path']) $query['path'] = static::get_home_dir(); |
|
| 846 | + if(!$query['path']) |
|
| 847 | + { |
|
| 848 | + $query['path'] = static::get_home_dir(); |
|
| 849 | + } |
|
| 790 | 850 | |
| 791 | 851 | // Change template to match selected view |
| 792 | 852 | if($query['view']) |
@@ -844,7 +904,10 @@ discard block |
||
| 844 | 904 | $filter = $query['filter'] === '' ? 1 : $query['filter']; |
| 845 | 905 | |
| 846 | 906 | $maxdepth = $filter && $filter != 4 ? (int)(boolean)$filter : null; |
| 847 | - if($filter == 5) $maxdepth = 2; |
|
| 907 | + if($filter == 5) |
|
| 908 | + { |
|
| 909 | + $maxdepth = 2; |
|
| 910 | + } |
|
| 848 | 911 | $n = 0; |
| 849 | 912 | $vfs_options = array( |
| 850 | 913 | 'mindepth' => 1, |
@@ -897,10 +960,16 @@ discard block |
||
| 897 | 960 | { |
| 898 | 961 | unset($row); // fixes a weird problem with php5.1, does NOT happen with php5.2 |
| 899 | 962 | $row =& $rows[$path2n[$path]]; |
| 900 | - if ( !is_array($props) ) continue; |
|
| 963 | + if ( !is_array($props) ) |
|
| 964 | + { |
|
| 965 | + continue; |
|
| 966 | + } |
|
| 901 | 967 | foreach($props as $prop) |
| 902 | 968 | { |
| 903 | - if (!$all_cfs && $prop['name'][0] == '#' && !in_array($prop['name'],$cols_to_show)) continue; |
|
| 969 | + if (!$all_cfs && $prop['name'][0] == '#' && !in_array($prop['name'],$cols_to_show)) |
|
| 970 | + { |
|
| 971 | + continue; |
|
| 972 | + } |
|
| 904 | 973 | $row[$prop['name']] = strlen($prop['val']) < 64 ? $prop['val'] : substr($prop['val'],0,64).' ...'; |
| 905 | 974 | } |
| 906 | 975 | } |
@@ -1028,7 +1097,10 @@ discard block |
||
| 1028 | 1097 | $tpl->set_validation_error('name',lang("There's already a file with that name!").'<br />'. |
| 1029 | 1098 | lang('To overwrite the existing file store again.',lang($button))); |
| 1030 | 1099 | $content['confirm_overwrite'] = $to; |
| 1031 | - if ($button == 'save') $button = 'apply'; |
|
| 1100 | + if ($button == 'save') |
|
| 1101 | + { |
|
| 1102 | + $button = 'apply'; |
|
| 1103 | + } |
|
| 1032 | 1104 | continue; |
| 1033 | 1105 | } |
| 1034 | 1106 | if (Vfs::rename($path,$to)) |
@@ -1101,13 +1173,19 @@ discard block |
||
| 1101 | 1173 | } |
| 1102 | 1174 | if ($ok && !$failed) |
| 1103 | 1175 | { |
| 1104 | - if(!$perm_changed++) $msg .= lang('Permissions of %1 changed.',$path.' '.lang('and all it\'s childeren')); |
|
| 1176 | + if(!$perm_changed++) |
|
| 1177 | + { |
|
| 1178 | + $msg .= lang('Permissions of %1 changed.',$path.' '.lang('and all it\'s childeren')); |
|
| 1179 | + } |
|
| 1105 | 1180 | $content['old'][$name] = $content[$name]; |
| 1106 | 1181 | } |
| 1107 | 1182 | elseif($failed) |
| 1108 | 1183 | { |
| 1109 | - if(!$perm_failed++) $msg .= lang('Failed to change permissions of %1!',$path.lang('and all it\'s childeren'). |
|
| 1184 | + if(!$perm_failed++) |
|
| 1185 | + { |
|
| 1186 | + $msg .= lang('Failed to change permissions of %1!',$path.lang('and all it\'s childeren'). |
|
| 1110 | 1187 | ($ok ? ' ('.lang('%1 failed, %2 succeded',$failed,$ok).')' : '')); |
| 1188 | + } |
|
| 1111 | 1189 | } |
| 1112 | 1190 | } |
| 1113 | 1191 | elseif (call_user_func_array($cmd,array($path,$value))) |
@@ -1160,7 +1238,10 @@ discard block |
||
| 1160 | 1238 | } |
| 1161 | 1239 | } |
| 1162 | 1240 | Framework::refresh_opener($msg, 'filemanager', $refresh_path ? $refresh_path : $path, 'edit', null, '&path=[^&]*'); |
| 1163 | - if ($button == 'save') Framework::window_close(); |
|
| 1241 | + if ($button == 'save') |
|
| 1242 | + { |
|
| 1243 | + Framework::window_close(); |
|
| 1244 | + } |
|
| 1164 | 1245 | } |
| 1165 | 1246 | if ($content['is_link'] && !Vfs::stat($path)) |
| 1166 | 1247 | { |
@@ -1170,12 +1251,18 @@ discard block |
||
| 1170 | 1251 | $content['icon'] = Vfs::mime_icon($content['mime']); |
| 1171 | 1252 | $content['msg'] = $msg; |
| 1172 | 1253 | |
| 1173 | - if (($readonlys['uid'] = !Vfs::$is_root) && !$content['uid']) $content['ro_uid_root'] = 'root'; |
|
| 1254 | + if (($readonlys['uid'] = !Vfs::$is_root) && !$content['uid']) |
|
| 1255 | + { |
|
| 1256 | + $content['ro_uid_root'] = 'root'; |
|
| 1257 | + } |
|
| 1174 | 1258 | // only owner can change group & perms |
| 1175 | 1259 | if (($readonlys['gid'] = !$content['is_owner'] || |
| 1176 | - Vfs::parse_url(Vfs::resolve_url($content['path']),PHP_URL_SCHEME) == 'oldvfs')) // no uid, gid or perms in oldvfs |
|
| 1260 | + Vfs::parse_url(Vfs::resolve_url($content['path']),PHP_URL_SCHEME) == 'oldvfs')) |
|
| 1261 | + { |
|
| 1262 | + // no uid, gid or perms in oldvfs |
|
| 1177 | 1263 | { |
| 1178 | 1264 | if (!$content['gid']) $content['ro_gid_root'] = 'root'; |
| 1265 | + } |
|
| 1179 | 1266 | foreach($content['perms'] as $name => $value) |
| 1180 | 1267 | { |
| 1181 | 1268 | $readonlys['perms['.$name.']'] = true; |
@@ -1208,9 +1295,13 @@ discard block |
||
| 1208 | 1295 | 5 => lang('Display of content'), |
| 1209 | 1296 | 0 => lang('No access'), |
| 1210 | 1297 | ); |
| 1211 | - if(($content['eacl'] = Vfs::get_eacl($content['path'])) !== false) // backend supports eacl |
|
| 1298 | + if(($content['eacl'] = Vfs::get_eacl($content['path'])) !== false) |
|
| 1212 | 1299 | { |
| 1213 | - unset($readonlys['tabs']['filemanager.file.eacl']); // --> switch the tab on again |
|
| 1300 | + // backend supports eacl |
|
| 1301 | + { |
|
| 1302 | + unset($readonlys['tabs']['filemanager.file.eacl']); |
|
| 1303 | + } |
|
| 1304 | + // --> switch the tab on again |
|
| 1214 | 1305 | foreach($content['eacl'] as &$eacl) |
| 1215 | 1306 | { |
| 1216 | 1307 | $eacl['path'] = rtrim(Vfs::parse_url($eacl['path'],PHP_URL_PATH),'/'); |
@@ -1267,10 +1358,13 @@ discard block |
||
| 1267 | 1358 | 'comment' => (string)$content['comment'], |
| 1268 | 1359 | 'mergeapp' => $content['mergeapp'] |
| 1269 | 1360 | ); |
| 1270 | - if ($cfs) foreach($cfs as $name => $data) |
|
| 1361 | + if ($cfs) |
|
| 1362 | + { |
|
| 1363 | + foreach($cfs as $name => $data) |
|
| 1271 | 1364 | { |
| 1272 | 1365 | $preserve['old']['#'.$name] = (string)$content['#'.$name]; |
| 1273 | 1366 | } |
| 1367 | + } |
|
| 1274 | 1368 | } |
| 1275 | 1369 | if (Vfs::$is_root) |
| 1276 | 1370 | { |
@@ -1292,7 +1386,10 @@ discard block |
||
| 1292 | 1386 | $tpl->setElementAttribute('tabs', 'add_tabs', true); |
| 1293 | 1387 | |
| 1294 | 1388 | $tabs =& $tpl->getElementAttribute('tabs','tabs'); |
| 1295 | - if (true) $tabs = array(); |
|
| 1389 | + if (true) |
|
| 1390 | + { |
|
| 1391 | + $tabs = array(); |
|
| 1392 | + } |
|
| 1296 | 1393 | |
| 1297 | 1394 | foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab) |
| 1298 | 1395 | { |
@@ -1345,7 +1442,10 @@ discard block |
||
| 1345 | 1442 | 'files' => 0, |
| 1346 | 1443 | ); |
| 1347 | 1444 | |
| 1348 | - if (!isset($dir)) $dir = array_pop($selected); |
|
| 1445 | + if (!isset($dir)) |
|
| 1446 | + { |
|
| 1447 | + $dir = array_pop($selected); |
|
| 1448 | + } |
|
| 1349 | 1449 | |
| 1350 | 1450 | switch($action) |
| 1351 | 1451 | { |
@@ -1419,7 +1519,10 @@ discard block |
||
| 1419 | 1519 | $target=Vfs::concat($dir,Vfs::encodePathComponent($file['name'])); |
| 1420 | 1520 | if (Vfs::file_exists($target) && $app_dir) |
| 1421 | 1521 | { |
| 1422 | - if (!Vfs::file_exists($app_dir)) Vfs::mkdir($app_dir); |
|
| 1522 | + if (!Vfs::file_exists($app_dir)) |
|
| 1523 | + { |
|
| 1524 | + Vfs::mkdir($app_dir); |
|
| 1525 | + } |
|
| 1423 | 1526 | error_log("Symlinking $target to $app_dir"); |
| 1424 | 1527 | Vfs::symlink($target, Vfs::concat($app_dir,Vfs::encodePathComponent($file['name']))); |
| 1425 | 1528 | } |
@@ -85,7 +85,10 @@ discard block |
||
| 85 | 85 | $file['Shared files'] = Egw::link('/index.php','menuaction=filemanager.filemanager_shares.index&ajax=true'); |
| 86 | 86 | display_sidebox(self::$appname,$title,$file); |
| 87 | 87 | } |
| 88 | - if ($GLOBALS['egw_info']['user']['apps']['admin']) self::admin(self::$appname); |
|
| 88 | + if ($GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 89 | + { |
|
| 90 | + self::admin(self::$appname); |
|
| 91 | + } |
|
| 89 | 92 | } |
| 90 | 93 | |
| 91 | 94 | /** |
@@ -95,7 +98,10 @@ discard block |
||
| 95 | 98 | */ |
| 96 | 99 | static function admin($location = 'admin') |
| 97 | 100 | { |
| 98 | - if (is_array($location)) $location = $location['location']; |
|
| 101 | + if (is_array($location)) |
|
| 102 | + { |
|
| 103 | + $location = $location['location']; |
|
| 104 | + } |
|
| 99 | 105 | |
| 100 | 106 | $file = Array( |
| 101 | 107 | //'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname='.self::$appname.'&ajax=true'), |
@@ -121,7 +127,10 @@ discard block |
||
| 121 | 127 | static function settings() |
| 122 | 128 | { |
| 123 | 129 | $config = Api\Config::read(self::$appname); |
| 124 | - if (!empty($config['max_folderlinks'])) self::$foldercount = (int)$config['max_folderlinks']; |
|
| 130 | + if (!empty($config['max_folderlinks'])) |
|
| 131 | + { |
|
| 132 | + self::$foldercount = (int)$config['max_folderlinks']; |
|
| 133 | + } |
|
| 125 | 134 | |
| 126 | 135 | $yes_no = array( |
| 127 | 136 | 'no' => lang('No'), |
@@ -131,7 +131,10 @@ discard block |
||
| 131 | 131 | ($content['mounts']['enable'] || self::$is_setup && $content['mounts']['mount'])) |
| 132 | 132 | { |
| 133 | 133 | $url = str_replace('$path',$path,$content['mounts']['url']); |
| 134 | - if (empty($url) && $this->versioning) $url = Versioning\StreamWrapper::PREFIX.$path; |
|
| 134 | + if (empty($url) && $this->versioning) |
|
| 135 | + { |
|
| 136 | + $url = Versioning\StreamWrapper::PREFIX.$path; |
|
| 137 | + } |
|
| 135 | 138 | |
| 136 | 139 | if ($content['mounts']['enable'] && !$this->versioning) |
| 137 | 140 | { |
@@ -227,16 +230,25 @@ discard block |
||
| 227 | 230 | $content['versionedpath'] = '/'; |
| 228 | 231 | $content['mtime'] = 100; |
| 229 | 232 | } |
| 230 | - if (true) $content = array( |
|
| 233 | + if (true) |
|
| 234 | + { |
|
| 235 | + $content = array( |
|
| 231 | 236 | 'versionedpath' => $content['versionedpath'], |
| 232 | 237 | 'mtime' => $content['mtime'], |
| 233 | 238 | ); |
| 239 | + } |
|
| 234 | 240 | if ($this->versioning) |
| 235 | 241 | { |
| 236 | 242 | // statistical information |
| 237 | 243 | $content += Versioning\StreamWrapper::summary(); |
| 238 | - if ($content['total_files']) $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%'; |
|
| 239 | - if ($content['total_size']) $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%'; |
|
| 244 | + if ($content['total_files']) |
|
| 245 | + { |
|
| 246 | + $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%'; |
|
| 247 | + } |
|
| 248 | + if ($content['total_size']) |
|
| 249 | + { |
|
| 250 | + $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%'; |
|
| 251 | + } |
|
| 240 | 252 | } |
| 241 | 253 | if (!($content['is_root']=Vfs::$is_root)) |
| 242 | 254 | { |
@@ -169,7 +169,10 @@ discard block |
||
| 169 | 169 | $files[] = Vfs::concat($content['path'],$name); |
| 170 | 170 | } |
| 171 | 171 | //Add an uploaded file to the files result array2string |
| 172 | - if ($copy_result === true) $files[] = $to_path; |
|
| 172 | + if ($copy_result === true) |
|
| 173 | + { |
|
| 174 | + $files[] = $to_path; |
|
| 175 | + } |
|
| 173 | 176 | break; |
| 174 | 177 | |
| 175 | 178 | case 'select-dir': |
@@ -193,7 +196,10 @@ discard block |
||
| 193 | 196 | else if ($content['method'] == 'ckeditor_return') |
| 194 | 197 | { |
| 195 | 198 | $download_url = Vfs::download_url(Vfs::concat($content['path'],$content['name'])); |
| 196 | - if ($download_url[0] == '/') $download_url = Egw::link($download_url); |
|
| 199 | + if ($download_url[0] == '/') |
|
| 200 | + { |
|
| 201 | + $download_url = Egw::link($download_url); |
|
| 202 | + } |
|
| 197 | 203 | $js = "window.opener.CKEDITOR.tools.callFunction(". |
| 198 | 204 | $content['ckeditorfuncnum'].",'". |
| 199 | 205 | htmlspecialchars($download_url)."',". |
@@ -223,7 +229,10 @@ discard block |
||
| 223 | 229 | elseif(isset($content['apps'])) |
| 224 | 230 | { |
| 225 | 231 | list($app) = each($content['apps']); |
| 226 | - if ($app == 'home') $content['path'] = filemanager_ui::get_home_dir(); |
|
| 232 | + if ($app == 'home') |
|
| 233 | + { |
|
| 234 | + $content['path'] = filemanager_ui::get_home_dir(); |
|
| 235 | + } |
|
| 227 | 236 | } |
| 228 | 237 | |
| 229 | 238 | //Deactivate the opload field if the current directory is not writeable or |
@@ -257,8 +266,15 @@ discard block |
||
| 257 | 266 | { |
| 258 | 267 | $path = $favorite['state']['path']; |
| 259 | 268 | // Just directories |
| 260 | - if(!$path) continue; |
|
| 261 | - if ($path == $content['path']) continue; // remove directory itself |
|
| 269 | + if(!$path) |
|
| 270 | + { |
|
| 271 | + continue; |
|
| 272 | + } |
|
| 273 | + if ($path == $content['path']) |
|
| 274 | + { |
|
| 275 | + continue; |
|
| 276 | + } |
|
| 277 | + // remove directory itself |
|
| 262 | 278 | |
| 263 | 279 | $mime = Vfs::mime_content_type($path); |
| 264 | 280 | $content['dir'][$n] = array( |
@@ -289,7 +305,11 @@ discard block |
||
| 289 | 305 | $content['dir'] = array('mode' => $content['mode']); |
| 290 | 306 | foreach($files as $path) |
| 291 | 307 | { |
| 292 | - if ($path == $content['path']) continue; // remove directory itself |
|
| 308 | + if ($path == $content['path']) |
|
| 309 | + { |
|
| 310 | + continue; |
|
| 311 | + } |
|
| 312 | + // remove directory itself |
|
| 293 | 313 | |
| 294 | 314 | $name = Vfs::basename($path); |
| 295 | 315 | $is_dir = Vfs::is_dir($path); |
@@ -310,7 +330,11 @@ discard block |
||
| 310 | 330 | } |
| 311 | 331 | ++$n; |
| 312 | 332 | } |
| 313 | - if (!$n) $readonlys['selected[]'] = true; // remove checkbox from empty line |
|
| 333 | + if (!$n) |
|
| 334 | + { |
|
| 335 | + $readonlys['selected[]'] = true; |
|
| 336 | + } |
|
| 337 | + // remove checkbox from empty line |
|
| 314 | 338 | } |
| 315 | 339 | $readonlys['button[createdir]'] = !Vfs::is_writable($content['path']); |
| 316 | 340 | |
@@ -348,7 +372,10 @@ discard block |
||
| 348 | 372 | static function get_apps() |
| 349 | 373 | { |
| 350 | 374 | $apps = array(false); // index starting from 1 |
| 351 | - if (isset($GLOBALS['egw_info']['apps']['stylite'])) $apps = array('favorites' => lang('Favorites')); |
|
| 375 | + if (isset($GLOBALS['egw_info']['apps']['stylite'])) |
|
| 376 | + { |
|
| 377 | + $apps = array('favorites' => lang('Favorites')); |
|
| 378 | + } |
|
| 352 | 379 | $apps += Link::app_list('query'); |
| 353 | 380 | |
| 354 | 381 | unset($apps['mydms']); // they do NOT support adding files to VFS |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | // Custom fields |
| 125 | 125 | if($content && strpos($content, '#') !== 0) |
| 126 | - { |
|
| 126 | + { |
|
| 127 | 127 | // Expand link-to custom fields |
| 128 | 128 | $this->cf_link_to_expand($file, $content, $info); |
| 129 | 129 | |
@@ -151,12 +151,14 @@ discard block |
||
| 151 | 151 | // Try this first - a normal path /apps/appname/id/file |
| 152 | 152 | list($app, $app_id) = explode('/', substr($file['path'], strpos($file['path'], 'apps/')+5)); |
| 153 | 153 | // Symlink? |
| 154 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
| 154 | + if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) |
|
| 155 | + { |
|
| 155 | 156 | // Try resolving just app + ID - /apps/App Name/Record Title/file |
| 156 | 157 | $resolved = Vfs::resolve_url_symlinks(implode('/',array_slice(explode('/',$file['dir']),0,4))); |
| 157 | 158 | list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
| 158 | 159 | |
| 159 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
| 160 | + if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) |
|
| 161 | + { |
|
| 160 | 162 | // Get rid of any virtual folders (eg: All$) and symlinks |
| 161 | 163 | $resolved = Vfs::resolve_url_symlinks($file['path']); |
| 162 | 164 | list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
@@ -190,7 +192,10 @@ discard block |
||
| 190 | 192 | if(is_array($link)) |
| 191 | 193 | { |
| 192 | 194 | // Directories have their internal protocol in path here |
| 193 | - if($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path']; |
|
| 195 | + if($link['path'] && strpos($link['path'], '://') !== false) |
|
| 196 | + { |
|
| 197 | + $link['path'] = $file['path']; |
|
| 198 | + } |
|
| 194 | 199 | $link = Api\Session::link('/index.php', $link); |
| 195 | 200 | } |
| 196 | 201 | else |
@@ -211,7 +216,10 @@ discard block |
||
| 211 | 216 | // Add markers |
| 212 | 217 | foreach($file as $key => &$value) |
| 213 | 218 | { |
| 214 | - if(!$value) $value = ''; |
|
| 219 | + if(!$value) |
|
| 220 | + { |
|
| 221 | + $value = ''; |
|
| 222 | + } |
|
| 215 | 223 | $info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value; |
| 216 | 224 | } |
| 217 | 225 | if($app_placeholders) |
@@ -252,9 +260,15 @@ discard block |
||
| 252 | 260 | ); |
| 253 | 261 | foreach($fields as $name => $label) |
| 254 | 262 | { |
| 255 | - if (!($n&1)) echo '<tr>'; |
|
| 263 | + if (!($n&1)) |
|
| 264 | + { |
|
| 265 | + echo '<tr>'; |
|
| 266 | + } |
|
| 256 | 267 | echo '<td>{{'.$name.'}}</td><td>'.lang($label).'</td>'; |
| 257 | - if ($n&1) echo "</tr>\n"; |
|
| 268 | + if ($n&1) |
|
| 269 | + { |
|
| 270 | + echo "</tr>\n"; |
|
| 271 | + } |
|
| 258 | 272 | $n++; |
| 259 | 273 | } |
| 260 | 274 | |
@@ -101,7 +101,10 @@ |
||
| 101 | 101 | $row['type'] = $row['share_writable'] ? Sharing::WRITABLE : Sharing::READONLY; |
| 102 | 102 | } |
| 103 | 103 | $row['share_passwd'] = (boolean)$row['share_passwd']; |
| 104 | - if ($row['share_with']) $row['share_with'] = preg_replace('/,([^ ])/', ', $1', $row['share_with']); |
|
| 104 | + if ($row['share_with']) |
|
| 105 | + { |
|
| 106 | + $row['share_with'] = preg_replace('/,([^ ])/', ', $1', $row['share_with']); |
|
| 107 | + } |
|
| 105 | 108 | } |
| 106 | 109 | return $total; |
| 107 | 110 | } |
@@ -104,7 +104,10 @@ |
||
| 104 | 104 | if ($content['nm']['action']) |
| 105 | 105 | { |
| 106 | 106 | $msg = filemanager_ui::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']); |
| 107 | - if($msg) Api\Json\Response::get()->apply('egw.message',array($msg)); |
|
| 107 | + if($msg) |
|
| 108 | + { |
|
| 109 | + Api\Json\Response::get()->apply('egw.message',array($msg)); |
|
| 110 | + } |
|
| 108 | 111 | foreach($content['nm']['selected'] as &$id) |
| 109 | 112 | { |
| 110 | 113 | $id = 'filemanager::'.$id; |
@@ -20,10 +20,13 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | error_reporting(error_reporting() & ~E_NOTICE & ~E_DEPRECATED); |
| 22 | 22 | |
| 23 | -if (php_sapi_name() !== 'cli') // security precaution: forbit calling filemanager/cli.php as web-page |
|
| 23 | +if (php_sapi_name() !== 'cli') |
|
| 24 | +{ |
|
| 25 | + // security precaution: forbit calling filemanager/cli.php as web-page |
|
| 24 | 26 | { |
| 25 | 27 | die('<h1>'.basename(__FILE__).' must NOT be called as web-page --> exiting !!!</h1>'); |
| 26 | 28 | } |
| 29 | +} |
|
| 27 | 30 | |
| 28 | 31 | /** |
| 29 | 32 | * callback if the session-check fails, creates session from user/passwd in $GLOBALS['egw_login_data'] |
@@ -87,14 +90,20 @@ discard block |
||
| 87 | 90 | $cmd = array_shift($args); |
| 88 | 91 | } |
| 89 | 92 | |
| 90 | -if (!$args) $args = array('-h'); |
|
| 93 | +if (!$args) |
|
| 94 | +{ |
|
| 95 | + $args = array('-h'); |
|
| 96 | +} |
|
| 91 | 97 | |
| 92 | 98 | $argv = $find_options = array(); |
| 93 | 99 | while(!is_null($option = array_shift($args))) |
| 94 | 100 | { |
| 95 | - if ($option == '-' || $option[0] != '-') // no option --> argument |
|
| 101 | + if ($option == '-' || $option[0] != '-') |
|
| 102 | + { |
|
| 103 | + // no option --> argument |
|
| 96 | 104 | { |
| 97 | 105 | $argv[] = $option; |
| 106 | + } |
|
| 98 | 107 | continue; |
| 99 | 108 | } |
| 100 | 109 | |
@@ -192,7 +201,10 @@ discard block |
||
| 192 | 201 | { |
| 193 | 202 | usage('Wrong number of parameters!'); |
| 194 | 203 | } |
| 195 | - if (($url = $argv[0])) load_wrapper($url); |
|
| 204 | + if (($url = $argv[0])) |
|
| 205 | + { |
|
| 206 | + load_wrapper($url); |
|
| 207 | + } |
|
| 196 | 208 | if(!Vfs::$is_root) |
| 197 | 209 | { |
| 198 | 210 | die("You need to be root to do that!\n"); |
@@ -257,7 +269,10 @@ discard block |
||
| 257 | 269 | break; |
| 258 | 270 | |
| 259 | 271 | case 'rename': |
| 260 | - if (count($argv) != 2) usage('Wrong number of parameters!'); |
|
| 272 | + if (count($argv) != 2) |
|
| 273 | + { |
|
| 274 | + usage('Wrong number of parameters!'); |
|
| 275 | + } |
|
| 261 | 276 | load_wrapper($argv[0]); |
| 262 | 277 | load_wrapper($argv[1]); |
| 263 | 278 | rename($argv[0],$argv[1]); |
@@ -268,7 +283,11 @@ discard block |
||
| 268 | 283 | { |
| 269 | 284 | die("\nYou need to be root to do that!\n\n"); |
| 270 | 285 | } |
| 271 | - if (!is_writable($GLOBALS['egw_info']['server']['files_dir'])) exit; // we need write access, error msg already given |
|
| 286 | + if (!is_writable($GLOBALS['egw_info']['server']['files_dir'])) |
|
| 287 | + { |
|
| 288 | + exit; |
|
| 289 | + } |
|
| 290 | + // we need write access, error msg already given |
|
| 272 | 291 | $fstab = Vfs::mount(); |
| 273 | 292 | if (!is_array($fstab) || !isset($fstab['/']) || strpos($fstab['/'],'storage=db') === false) |
| 274 | 293 | { |
@@ -281,7 +300,10 @@ discard block |
||
| 281 | 300 | $num_files = Vfs\Sqlfs\Utils::migrate_db2fs(); // throws exception on error |
| 282 | 301 | echo "\n$num_files files migrated from DB to filesystem.\n"; |
| 283 | 302 | $new_url = preg_replace('/storage=db&?/','',$fstab['/']); |
| 284 | - if (substr($new_url,-1) == '?') $new_url = substr($new_url,0,-1); |
|
| 303 | + if (substr($new_url,-1) == '?') |
|
| 304 | + { |
|
| 305 | + $new_url = substr($new_url,0,-1); |
|
| 306 | + } |
|
| 285 | 307 | if (Vfs::mount($new_url,'/')) |
| 286 | 308 | { |
| 287 | 309 | echo "/ successful re-mounted on $new_url\n"; |
@@ -324,7 +346,10 @@ discard block |
||
| 324 | 346 | break; |
| 325 | 347 | |
| 326 | 348 | case 'mkdir': |
| 327 | - if (!mkdir($url,null,$recursive)) echo "Can't create directory, permission denied!\n"; |
|
| 349 | + if (!mkdir($url,null,$recursive)) |
|
| 350 | + { |
|
| 351 | + echo "Can't create directory, permission denied!\n"; |
|
| 352 | + } |
|
| 328 | 353 | break; |
| 329 | 354 | |
| 330 | 355 | case 'touch': |
@@ -342,7 +367,11 @@ discard block |
||
| 342 | 367 | $mode = $url; // first param is mode |
| 343 | 368 | $url = array_shift($argv); |
| 344 | 369 | } |
| 345 | - if (Vfs::parse_url($url,PHP_URL_SCHEME)) load_wrapper($url); // cant use stat or Vfs::mode2int otherwise! |
|
| 370 | + if (Vfs::parse_url($url,PHP_URL_SCHEME)) |
|
| 371 | + { |
|
| 372 | + load_wrapper($url); |
|
| 373 | + } |
|
| 374 | + // cant use stat or Vfs::mode2int otherwise! |
|
| 346 | 375 | |
| 347 | 376 | if (strpos($mode,'+') !== false || strpos($mode,'-') !== false) |
| 348 | 377 | { |
@@ -367,7 +396,11 @@ discard block |
||
| 367 | 396 | { |
| 368 | 397 | $owner = $url; // first param is owner/group |
| 369 | 398 | $url = array_shift($argv); |
| 370 | - if (Vfs::parse_url($url,PHP_URL_SCHEME)) load_wrapper($url); // we need the header loaded |
|
| 399 | + if (Vfs::parse_url($url,PHP_URL_SCHEME)) |
|
| 400 | + { |
|
| 401 | + load_wrapper($url); |
|
| 402 | + } |
|
| 403 | + // we need the header loaded |
|
| 371 | 404 | if ($owner == 'root') |
| 372 | 405 | { |
| 373 | 406 | $owner = 0; |
@@ -423,13 +456,19 @@ discard block |
||
| 423 | 456 | { |
| 424 | 457 | if ($argc) |
| 425 | 458 | { |
| 426 | - if (!($name = basename(Vfs::parse_url($url,PHP_URL_PATH)))) $name = '/'; |
|
| 459 | + if (!($name = basename(Vfs::parse_url($url,PHP_URL_PATH)))) |
|
| 460 | + { |
|
| 461 | + $name = '/'; |
|
| 462 | + } |
|
| 427 | 463 | echo "\n$name:\n"; |
| 428 | 464 | } |
| 429 | 465 | // separate evtl. query part, to re-add it after the file-name |
| 430 | 466 | unset($query); |
| 431 | 467 | list($url,$query) = explode('?',$url,2); |
| 432 | - if ($query) $query = '?'.$query; |
|
| 468 | + if ($query) |
|
| 469 | + { |
|
| 470 | + $query = '?'.$query; |
|
| 471 | + } |
|
| 433 | 472 | |
| 434 | 473 | if (substr($url,-1) == '/') |
| 435 | 474 | { |
@@ -461,7 +500,10 @@ discard block |
||
| 461 | 500 | { |
| 462 | 501 | do_stat($url,$long,$numeric,false,$inode); |
| 463 | 502 | } |
| 464 | - if (!$long && $cmd == 'ls') echo "\n"; |
|
| 503 | + if (!$long && $cmd == 'ls') |
|
| 504 | + { |
|
| 505 | + echo "\n"; |
|
| 506 | + } |
|
| 465 | 507 | break; |
| 466 | 508 | } |
| 467 | 509 | } |
@@ -665,18 +707,36 @@ discard block |
||
| 665 | 707 | { |
| 666 | 708 | $uid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name($stat['uid']) : |
| 667 | 709 | (function_exists('posix_getpwuid') ? posix_getpwuid($stat['uid']) : $stat['uid']); |
| 668 | - if (is_array($uid)) $uid = $uid['name']; |
|
| 669 | - if (empty($uid)) $uid = $stat['uid']; |
|
| 710 | + if (is_array($uid)) |
|
| 711 | + { |
|
| 712 | + $uid = $uid['name']; |
|
| 713 | + } |
|
| 714 | + if (empty($uid)) |
|
| 715 | + { |
|
| 716 | + $uid = $stat['uid']; |
|
| 717 | + } |
|
| 718 | + } |
|
| 719 | + if (!isset($uid)) |
|
| 720 | + { |
|
| 721 | + $uid = 'root'; |
|
| 670 | 722 | } |
| 671 | - if (!isset($uid)) $uid = 'root'; |
|
| 672 | 723 | if ($stat['gid']) |
| 673 | 724 | { |
| 674 | 725 | $gid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name(-abs($stat['gid'])) : |
| 675 | 726 | (function_exists('posix_getgrgid') ? posix_getgrgid($stat['gid']) : $stat['gid']); |
| 676 | - if (is_array($gid)) $gid = $gid['name']; |
|
| 677 | - if (empty($gid)) $gid = $stat['gid']; |
|
| 727 | + if (is_array($gid)) |
|
| 728 | + { |
|
| 729 | + $gid = $gid['name']; |
|
| 730 | + } |
|
| 731 | + if (empty($gid)) |
|
| 732 | + { |
|
| 733 | + $gid = $stat['gid']; |
|
| 734 | + } |
|
| 735 | + } |
|
| 736 | + if (!isset($gid)) |
|
| 737 | + { |
|
| 738 | + $gid = 'root'; |
|
| 678 | 739 | } |
| 679 | - if (!isset($gid)) $gid = 'root'; |
|
| 680 | 740 | } |
| 681 | 741 | $size = hsize($stat['size']); |
| 682 | 742 | $mtime = date('Y-m-d H:i:s',$stat['mtime']); |
@@ -699,8 +759,14 @@ discard block |
||
| 699 | 759 | |
| 700 | 760 | function hsize($size) |
| 701 | 761 | { |
| 702 | - if ($size < 1024) return $size; |
|
| 703 | - if ($size < 1024*1024) return sprintf('%3.1lfk',(float)$size/1024); |
|
| 762 | + if ($size < 1024) |
|
| 763 | + { |
|
| 764 | + return $size; |
|
| 765 | + } |
|
| 766 | + if ($size < 1024*1024) |
|
| 767 | + { |
|
| 768 | + return sprintf('%3.1lfk',(float)$size/1024); |
|
| 769 | + } |
|
| 704 | 770 | return sprintf('%3.1lfM',(float)$size/(1024*1024)); |
| 705 | 771 | } |
| 706 | 772 | |
@@ -734,14 +800,20 @@ discard block |
||
| 734 | 800 | ++$anz_files; |
| 735 | 801 | _cp($f,$t); |
| 736 | 802 | } |
| 737 | - if ($perms) _cp_perms($f,$t); |
|
| 803 | + if ($perms) |
|
| 804 | + { |
|
| 805 | + _cp_perms($f,$t); |
|
| 806 | + } |
|
| 738 | 807 | } |
| 739 | 808 | echo ($anz_dirs?"$anz_dirs dir(s) created and ":'')."$anz_files file(s) copied.\n"; |
| 740 | 809 | } |
| 741 | 810 | else |
| 742 | 811 | { |
| 743 | 812 | _cp($from,$to,true); |
| 744 | - if ($perms) _cp_perms($from,$to); |
|
| 813 | + if ($perms) |
|
| 814 | + { |
|
| 815 | + _cp_perms($from,$to); |
|
| 816 | + } |
|
| 745 | 817 | } |
| 746 | 818 | } |
| 747 | 819 | } |
@@ -770,7 +842,10 @@ discard block |
||
| 770 | 842 | //stream_filter_append($from_fp,'convert.base64-decode'); |
| 771 | 843 | $count = stream_copy_to_stream($from_fp,$to_fp); |
| 772 | 844 | |
| 773 | - if ($verbose) echo hsize($count)." bytes written to $to\n"; |
|
| 845 | + if ($verbose) |
|
| 846 | + { |
|
| 847 | + echo hsize($count)." bytes written to $to\n"; |
|
| 848 | + } |
|
| 774 | 849 | |
| 775 | 850 | fclose($from_fp); |
| 776 | 851 | |
@@ -817,7 +892,10 @@ discard block |
||
| 817 | 892 | function do_lntree($from,$to) |
| 818 | 893 | { |
| 819 | 894 | echo "lntree $from $to\n"; |
| 820 | - if ($from[0] == '/') $from = 'sqlfs://default'.$from; |
|
| 895 | + if ($from[0] == '/') |
|
| 896 | + { |
|
| 897 | + $from = 'sqlfs://default'.$from; |
|
| 898 | + } |
|
| 821 | 899 | load_wrapper($from); |
| 822 | 900 | |
| 823 | 901 | if (!file_exists($from)) |
@@ -879,34 +957,55 @@ discard block |
||
| 879 | 957 | */ |
| 880 | 958 | function int2mode( $mode ) |
| 881 | 959 | { |
| 882 | - if(($mode & 0xA000) == 0xA000) // Symbolic Link |
|
| 960 | + if(($mode & 0xA000) == 0xA000) |
|
| 961 | + { |
|
| 962 | + // Symbolic Link |
|
| 883 | 963 | { |
| 884 | 964 | $sP = 'l'; |
| 885 | 965 | } |
| 886 | - elseif(($mode & 0xC000) == 0xC000) // Socket |
|
| 966 | + } |
|
| 967 | + elseif(($mode & 0xC000) == 0xC000) |
|
| 968 | + { |
|
| 969 | + // Socket |
|
| 887 | 970 | { |
| 888 | 971 | $sP = 's'; |
| 889 | 972 | } |
| 890 | - elseif($mode & 0x1000) // FIFO pipe |
|
| 973 | + } |
|
| 974 | + elseif($mode & 0x1000) |
|
| 975 | + { |
|
| 976 | + // FIFO pipe |
|
| 891 | 977 | { |
| 892 | 978 | $sP = 'p'; |
| 893 | 979 | } |
| 894 | - elseif($mode & 0x2000) // Character special |
|
| 980 | + } |
|
| 981 | + elseif($mode & 0x2000) |
|
| 982 | + { |
|
| 983 | + // Character special |
|
| 895 | 984 | { |
| 896 | 985 | $sP = 'c'; |
| 897 | 986 | } |
| 898 | - elseif($mode & 0x4000) // Directory |
|
| 987 | + } |
|
| 988 | + elseif($mode & 0x4000) |
|
| 989 | + { |
|
| 990 | + // Directory |
|
| 899 | 991 | { |
| 900 | 992 | $sP = 'd'; |
| 901 | 993 | } |
| 902 | - elseif($mode & 0x6000) // Block special |
|
| 994 | + } |
|
| 995 | + elseif($mode & 0x6000) |
|
| 996 | + { |
|
| 997 | + // Block special |
|
| 903 | 998 | { |
| 904 | 999 | $sP = 'b'; |
| 905 | 1000 | } |
| 906 | - elseif($mode & 0x8000) // Regular |
|
| 1001 | + } |
|
| 1002 | + elseif($mode & 0x8000) |
|
| 1003 | + { |
|
| 1004 | + // Regular |
|
| 907 | 1005 | { |
| 908 | 1006 | $sP = '-'; |
| 909 | 1007 | } |
| 1008 | + } |
|
| 910 | 1009 | else // UNKNOWN |
| 911 | 1010 | { |
| 912 | 1011 | $sP = 'u'; |
@@ -22,7 +22,10 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | $path = '/home/'.$GLOBALS['egw_info']['user']['account_lid']; |
| 24 | 24 | } |
| 25 | -if (isset($_REQUEST['path'])) $path = $_REQUEST['path']; |
|
| 25 | +if (isset($_REQUEST['path'])) |
|
| 26 | +{ |
|
| 27 | + $path = $_REQUEST['path']; |
|
| 28 | +} |
|
| 26 | 29 | echo Api\Html::form("<p>Path: ".Api\Html::input('path',$path,'text','size="40"'). |
| 27 | 30 | Api\Html::submit_button('',lang('Submit'))."</p>\n",array(),'','','','','GET'); |
| 28 | 31 | |
@@ -53,9 +56,12 @@ discard block |
||
| 53 | 56 | $stime = number_format(1000*(microtime(true)-$time),1); |
| 54 | 57 | |
| 55 | 58 | $time2 = microtime(true); |
| 56 | - if ($is_dir)// && ($d = Vfs::opendir($path))) |
|
| 59 | + if ($is_dir) |
|
| 60 | + { |
|
| 61 | + // && ($d = Vfs::opendir($path))) |
|
| 57 | 62 | { |
| 58 | 63 | $files = array(); |
| 64 | + } |
|
| 59 | 65 | //while(($file = readdir($d))) |
| 60 | 66 | foreach(Vfs::scandir($path) as $file) |
| 61 | 67 | { |
@@ -69,7 +75,10 @@ discard block |
||
| 69 | 75 | //closedir($d); |
| 70 | 76 | $time2f = number_format(1000*(microtime(true)-$time2),1); |
| 71 | 77 | echo "<p>".($files ? 'Directory' : 'Empty directory')." took $time2f ms</p>\n"; |
| 72 | - if($files) echo '<ol><li>'.implode("</li>\n<li>",$files).'</ol>'."\n"; |
|
| 78 | + if($files) |
|
| 79 | + { |
|
| 80 | + echo '<ol><li>'.implode("</li>\n<li>",$files).'</ol>'."\n"; |
|
| 81 | + } |
|
| 73 | 82 | } |
| 74 | 83 | |
| 75 | 84 | echo "<p><b>stat('$path')</b> took $stime ms (mode = ".(isset($stat['mode'])?sprintf('%o',$stat['mode']).' = '.Vfs::int2mode($stat['mode']):'NULL').')'; |