@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | if (!static::$views_init) |
| 81 | 81 | { |
| 82 | 82 | // translate our labels |
| 83 | - foreach(static::$views as &$label) |
|
| 83 | + foreach (static::$views as &$label) |
|
| 84 | 84 | { |
| 85 | 85 | $label = lang($label); |
| 86 | 86 | } |
| 87 | 87 | // search for plugins with additional filemanager views |
| 88 | - foreach(Api\Hooks::process('filemanager_views') as $views) |
|
| 88 | + foreach (Api\Hooks::process('filemanager_views') as $views) |
|
| 89 | 89 | { |
| 90 | 90 | if (is_array($views)) static::$views += $views; |
| 91 | 91 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public static function get_view() |
| 103 | 103 | { |
| 104 | - $view =& Api\Cache::getSession('filemanager', 'view'); |
|
| 104 | + $view = & Api\Cache::getSession('filemanager', 'view'); |
|
| 105 | 105 | if (isset($_GET['view'])) |
| 106 | 106 | { |
| 107 | 107 | $view = $_GET['view']; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | 'open' => array( |
| 126 | 126 | 'caption' => lang('Open'), |
| 127 | 127 | 'icon' => '', |
| 128 | - 'group' => $group=1, |
|
| 128 | + 'group' => $group = 1, |
|
| 129 | 129 | 'allowOnMultiple' => false, |
| 130 | 130 | 'onExecute' => 'javaScript:app.filemanager.open', |
| 131 | 131 | 'default' => true |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | 'caption' => lang('Edit settings'), |
| 151 | 151 | 'group' => $group, |
| 152 | 152 | 'allowOnMultiple' => false, |
| 153 | - 'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.filemanager.viewEntry':'javaScript:app.filemanager.editprefs', |
|
| 153 | + 'onExecute' => Api\Header\UserAgent::mobile() ? 'javaScript:app.filemanager.viewEntry' : 'javaScript:app.filemanager.editprefs', |
|
| 154 | 154 | 'mobileViewTemplate' => 'file?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/filemanager/templates/mobile/file.xet')) |
| 155 | 155 | ), |
| 156 | 156 | 'mkdir' => array( |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | ), |
| 211 | 211 | // DRAG and DROP events |
| 212 | 212 | 'file_drag' => array( |
| 213 | - 'dragType' => array('file','link'), |
|
| 213 | + 'dragType' => array('file', 'link'), |
|
| 214 | 214 | 'type' => 'drag', |
| 215 | 215 | 'onExecute' => 'javaScript:app.filemanager.drag' |
| 216 | 216 | ), |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | else |
| 251 | 251 | { |
| 252 | - foreach(Vfs\Sharing::$modes as $mode => $data) |
|
| 252 | + foreach (Vfs\Sharing::$modes as $mode => $data) |
|
| 253 | 253 | { |
| 254 | 254 | $actions['mail']['children']['mail_'.$mode] = array( |
| 255 | 255 | 'caption' => $data['label'], |
@@ -260,12 +260,12 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | // This would be done automatically, but we're overriding |
| 263 | - foreach($actions as $action_id => $action) |
|
| 263 | + foreach ($actions as $action_id => $action) |
|
| 264 | 264 | { |
| 265 | - if($action['type'] == 'drop' && $action['caption']) |
|
| 265 | + if ($action['type'] == 'drop' && $action['caption']) |
|
| 266 | 266 | { |
| 267 | 267 | $action['type'] = 'popup'; |
| 268 | - if($action['acceptedTypes'] == 'file') |
|
| 268 | + if ($action['acceptedTypes'] == 'file') |
|
| 269 | 269 | { |
| 270 | 270 | $action['enabled'] = 'javaScript:app.filemanager.paste_enabled'; |
| 271 | 271 | } |
@@ -285,10 +285,10 @@ discard block |
||
| 285 | 285 | * |
| 286 | 286 | * @return string merge application or NULL if no property found |
| 287 | 287 | */ |
| 288 | - private static function get_mergeapp($path, $scope='self') |
|
| 288 | + private static function get_mergeapp($path, $scope = 'self') |
|
| 289 | 289 | { |
| 290 | 290 | $app = null; |
| 291 | - switch($scope) |
|
| 291 | + switch ($scope) |
|
| 292 | 292 | { |
| 293 | 293 | case 'self': |
| 294 | 294 | $props = Vfs::propfind($path, static::$merge_prop_namespace); |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | case 'parents': |
| 298 | 298 | // search for props in parent directories |
| 299 | 299 | $currentpath = $path; |
| 300 | - while($dir = Vfs::dirname($currentpath)) |
|
| 300 | + while ($dir = Vfs::dirname($currentpath)) |
|
| 301 | 301 | { |
| 302 | 302 | $props = Vfs::propfind($dir, static::$merge_prop_namespace); |
| 303 | - if(!empty($props)) |
|
| 303 | + if (!empty($props)) |
|
| 304 | 304 | { |
| 305 | 305 | // found prop in parent directory |
| 306 | 306 | return $app = $props[0]['val']; |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | * @param array $content |
| 320 | 320 | * @param string $msg |
| 321 | 321 | */ |
| 322 | - function index(array $content=null,$msg=null) |
|
| 322 | + function index(array $content = null, $msg = null) |
|
| 323 | 323 | { |
| 324 | 324 | if (!is_array($content)) |
| 325 | 325 | { |
@@ -329,16 +329,16 @@ discard block |
||
| 329 | 329 | if (!is_array($content['nm'])) |
| 330 | 330 | { |
| 331 | 331 | $content['nm'] = array( |
| 332 | - 'get_rows' => 'filemanager.filemanager_ui.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
| 333 | - 'filter' => '', // current dir only |
|
| 334 | - 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
| 335 | - 'no_cat' => True, // I disable the cat-selectbox |
|
| 336 | - 'lettersearch' => True, // I show a lettersearch |
|
| 337 | - 'searchletter' => false, // I0 active letter of the lettersearch or false for [all] |
|
| 338 | - 'start' => 0, // IO position in list |
|
| 339 | - 'order' => 'name', // IO name of the column to sort after (optional for the sortheaders) |
|
| 340 | - 'sort' => 'ASC', // IO direction of the sort: 'ASC' or 'DESC' |
|
| 341 | - 'default_cols' => '!comment,ctime', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns |
|
| 332 | + 'get_rows' => 'filemanager.filemanager_ui.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
| 333 | + 'filter' => '', // current dir only |
|
| 334 | + 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
| 335 | + 'no_cat' => True, // I disable the cat-selectbox |
|
| 336 | + 'lettersearch' => True, // I show a lettersearch |
|
| 337 | + 'searchletter' => false, // I0 active letter of the lettersearch or false for [all] |
|
| 338 | + 'start' => 0, // IO position in list |
|
| 339 | + 'order' => 'name', // IO name of the column to sort after (optional for the sortheaders) |
|
| 340 | + 'sort' => 'ASC', // IO direction of the sort: 'ASC' or 'DESC' |
|
| 341 | + 'default_cols' => '!comment,ctime', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns |
|
| 342 | 342 | 'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames, |
| 343 | 343 | //or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type) |
| 344 | 344 | 'row_id' => 'path', |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | 'parent_id' => 'dir', |
| 347 | 347 | 'is_parent' => 'is_dir', |
| 348 | 348 | 'favorites' => true, |
| 349 | - 'placeholder_actions' => array('mkdir','paste','file_drop_mail','file_drop_move','file_drop_copy','file_drop_symlink') |
|
| 349 | + 'placeholder_actions' => array('mkdir', 'paste', 'file_drop_mail', 'file_drop_move', 'file_drop_copy', 'file_drop_symlink') |
|
| 350 | 350 | ); |
| 351 | 351 | $content['nm']['path'] = static::get_home_dir(); |
| 352 | 352 | } |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | } |
| 369 | 369 | if (isset($_GET['path']) && ($path = $_GET['path'])) |
| 370 | 370 | { |
| 371 | - switch($path) |
|
| 371 | + switch ($path) |
|
| 372 | 372 | { |
| 373 | 373 | case '..': |
| 374 | 374 | $path = Vfs::dirname($content['nm']['path']); |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | $path = static::get_home_dir(); |
| 378 | 378 | break; |
| 379 | 379 | } |
| 380 | - if ($path && $path[0] == '/' && Vfs::stat($path,true) && Vfs::is_dir($path) && Vfs::check_access($path,Vfs::READABLE)) |
|
| 380 | + if ($path && $path[0] == '/' && Vfs::stat($path, true) && Vfs::is_dir($path) && Vfs::check_access($path, Vfs::READABLE)) |
|
| 381 | 381 | { |
| 382 | 382 | $content['nm']['path'] = $path; |
| 383 | 383 | } |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | } |
| 394 | 394 | $view = static::get_view(); |
| 395 | 395 | |
| 396 | - call_user_func($view,$content,$msg); |
|
| 396 | + call_user_func($view, $content, $msg); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | * @param boolean &$is_setup=null on return true if authenticated user is setup config user, false otherwise |
| 407 | 407 | * @return boolean true is root user given, false otherwise (including logout / empty $user) |
| 408 | 408 | */ |
| 409 | - protected function sudo($user='',$password=null,&$is_setup=null) |
|
| 409 | + protected function sudo($user = '', $password = null, &$is_setup = null) |
|
| 410 | 410 | { |
| 411 | 411 | if (!$user) |
| 412 | 412 | { |
@@ -415,15 +415,15 @@ discard block |
||
| 415 | 415 | else |
| 416 | 416 | { |
| 417 | 417 | // config user & password |
| 418 | - $is_setup = Api\Session::user_pw_hash($user,$password) === $GLOBALS['egw_info']['server']['config_hash']; |
|
| 418 | + $is_setup = Api\Session::user_pw_hash($user, $password) === $GLOBALS['egw_info']['server']['config_hash']; |
|
| 419 | 419 | // or vfs root user from setup >> configuration |
| 420 | - $is_root = $is_setup || $GLOBALS['egw_info']['server']['vfs_root_user'] && |
|
| 421 | - in_array($user,preg_split('/, */',$GLOBALS['egw_info']['server']['vfs_root_user'])) && |
|
| 420 | + $is_root = $is_setup || $GLOBALS['egw_info']['server']['vfs_root_user'] && |
|
| 421 | + in_array($user, preg_split('/, */', $GLOBALS['egw_info']['server']['vfs_root_user'])) && |
|
| 422 | 422 | $GLOBALS['egw']->auth->authenticate($user, $password, 'text'); |
| 423 | 423 | } |
| 424 | 424 | //error_log(__METHOD__."('$user','$password',$is_setup) user_pw_hash(...)='".Api\Session::user_pw_hash($user,$password)."', config_hash='{$GLOBALS['egw_info']['server']['config_hash']}' --> returning ".array2string($is_root)); |
| 425 | - Api\Cache::setSession('filemanager', 'is_setup',$is_setup); |
|
| 426 | - Api\Cache::setSession('filemanager', 'is_root',Vfs::$is_root = $is_root); |
|
| 425 | + Api\Cache::setSession('filemanager', 'is_setup', $is_setup); |
|
| 426 | + Api\Cache::setSession('filemanager', 'is_root', Vfs::$is_root = $is_root); |
|
| 427 | 427 | return Vfs::$is_root; |
| 428 | 428 | } |
| 429 | 429 | |
@@ -433,18 +433,18 @@ discard block |
||
| 433 | 433 | * @param array $content |
| 434 | 434 | * @param string $msg |
| 435 | 435 | */ |
| 436 | - function listview(array $content=null,$msg=null) |
|
| 436 | + function listview(array $content = null, $msg = null) |
|
| 437 | 437 | { |
| 438 | 438 | $tpl = new Etemplate('filemanager.index'); |
| 439 | 439 | |
| 440 | - if($msg) Framework::message($msg); |
|
| 440 | + if ($msg) Framework::message($msg); |
|
| 441 | 441 | |
| 442 | 442 | if (($content['nm']['action'] || $content['nm']['rows']) && (empty($content['button']) || !isset($content['button']))) |
| 443 | 443 | { |
| 444 | 444 | if ($content['nm']['action']) |
| 445 | 445 | { |
| 446 | - $msg = static::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']); |
|
| 447 | - if($msg) Framework::message($msg); |
|
| 446 | + $msg = static::action($content['nm']['action'], $content['nm']['selected'], $content['nm']['path']); |
|
| 447 | + if ($msg) Framework::message($msg); |
|
| 448 | 448 | |
| 449 | 449 | // clean up after action |
| 450 | 450 | unset($content['nm']['selected']); |
@@ -455,10 +455,10 @@ discard block |
||
| 455 | 455 | // we dont use ['nm']['rows']['delete'], so unset it, if it is present |
| 456 | 456 | if (isset($content['nm']['rows']['delete'])) unset($content['nm']['rows']['delete']); |
| 457 | 457 | } |
| 458 | - elseif($content['nm']['rows']['delete']) |
|
| 458 | + elseif ($content['nm']['rows']['delete']) |
|
| 459 | 459 | { |
| 460 | - $msg = static::action('delete',array_keys($content['nm']['rows']['delete']),$content['nm']['path']); |
|
| 461 | - if($msg) Framework::message($msg); |
|
| 460 | + $msg = static::action('delete', array_keys($content['nm']['rows']['delete']), $content['nm']['path']); |
|
| 461 | + if ($msg) Framework::message($msg); |
|
| 462 | 462 | |
| 463 | 463 | // clean up after action |
| 464 | 464 | unset($content['nm']['rows']['delete']); |
@@ -470,11 +470,11 @@ discard block |
||
| 470 | 470 | if (isset($content['nm']['selected'])) unset($content['nm']['selected']); |
| 471 | 471 | } |
| 472 | 472 | unset($content['nm']['rows']); |
| 473 | - Api\Cache::setSession('filemanager', 'index',$content['nm']); |
|
| 473 | + Api\Cache::setSession('filemanager', 'index', $content['nm']); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | // be tolerant with (in previous versions) not correct urlencoded pathes |
| 477 | - if ($content['nm']['path'][0] == '/' && !Vfs::stat($content['nm']['path'],true) && Vfs::stat(urldecode($content['nm']['path']))) |
|
| 477 | + if ($content['nm']['path'][0] == '/' && !Vfs::stat($content['nm']['path'], true) && Vfs::stat(urldecode($content['nm']['path']))) |
|
| 478 | 478 | { |
| 479 | 479 | $content['nm']['path'] = urldecode($content['nm']['path']); |
| 480 | 480 | } |
@@ -485,22 +485,22 @@ discard block |
||
| 485 | 485 | list($button) = each($content['button']); |
| 486 | 486 | unset($content['button']); |
| 487 | 487 | } |
| 488 | - switch($button) |
|
| 488 | + switch ($button) |
|
| 489 | 489 | { |
| 490 | 490 | case 'upload': |
| 491 | 491 | if (!$content['upload']) |
| 492 | 492 | { |
| 493 | - Framework::message(lang('You need to select some files first!'),'error'); |
|
| 493 | + Framework::message(lang('You need to select some files first!'), 'error'); |
|
| 494 | 494 | break; |
| 495 | 495 | } |
| 496 | 496 | $upload_success = $upload_failure = array(); |
| 497 | - foreach(isset($content['upload'][0]) ? $content['upload'] : array($content['upload']) as $upload) |
|
| 497 | + foreach (isset($content['upload'][0]) ? $content['upload'] : array($content['upload']) as $upload) |
|
| 498 | 498 | { |
| 499 | 499 | // encode chars which special meaning in url/vfs (some like / get removed!) |
| 500 | - $to = Vfs::concat($content['nm']['path'],Vfs::encodePathComponent($upload['name'])); |
|
| 500 | + $to = Vfs::concat($content['nm']['path'], Vfs::encodePathComponent($upload['name'])); |
|
| 501 | 501 | if ($upload && |
| 502 | 502 | (Vfs::is_writable($content['nm']['path']) || Vfs::is_writable($to)) && |
| 503 | - copy($upload['tmp_name'],Vfs::PREFIX.$to)) |
|
| 503 | + copy($upload['tmp_name'], Vfs::PREFIX.$to)) |
|
| 504 | 504 | { |
| 505 | 505 | $upload_success[] = $upload['name']; |
| 506 | 506 | } |
@@ -512,12 +512,11 @@ discard block |
||
| 512 | 512 | $content['nm']['msg'] = ''; |
| 513 | 513 | if ($upload_success) |
| 514 | 514 | { |
| 515 | - Framework::message( count($upload_success) == 1 && !$upload_failure ? lang('File successful uploaded.') : |
|
| 516 | - lang('%1 successful uploaded.',implode(', ',$upload_success))); |
|
| 515 | + Framework::message(count($upload_success) == 1 && !$upload_failure ? lang('File successful uploaded.') : lang('%1 successful uploaded.', implode(', ', $upload_success))); |
|
| 517 | 516 | } |
| 518 | 517 | if ($upload_failure) |
| 519 | 518 | { |
| 520 | - Framework::message(lang('Error uploading file!')."\n".etemplate::max_upload_size_message(),'error'); |
|
| 519 | + Framework::message(lang('Error uploading file!')."\n".etemplate::max_upload_size_message(), 'error'); |
|
| 521 | 520 | } |
| 522 | 521 | break; |
| 523 | 522 | } |
@@ -538,16 +537,16 @@ discard block |
||
| 538 | 537 | $tpl->setElementAttribute('nm[buttons][upload]', 'drop_target', 'popupMainDiv'); |
| 539 | 538 | } |
| 540 | 539 | // Set view button to match current settings |
| 541 | - if($content['nm']['view'] == 'tile') |
|
| 540 | + if ($content['nm']['view'] == 'tile') |
|
| 542 | 541 | { |
| 543 | - $tpl->setElementAttribute('nm[button][change_view]','statustext',lang('List view')); |
|
| 544 | - $tpl->setElementAttribute('nm[button][change_view]','image','list_row'); |
|
| 542 | + $tpl->setElementAttribute('nm[button][change_view]', 'statustext', lang('List view')); |
|
| 543 | + $tpl->setElementAttribute('nm[button][change_view]', 'image', 'list_row'); |
|
| 545 | 544 | } |
| 546 | 545 | // if initial load is done via GET request (idots template or share.php) |
| 547 | 546 | // get_rows cant call app.filemanager.set_readonly, so we need to do that here |
| 548 | 547 | $content['initial_path_readonly'] = !Vfs::is_writable($content['nm']['path']); |
| 549 | 548 | |
| 550 | - $tpl->exec('filemanager.filemanager_ui.index',$content,$sel_options,$readonlys,array('nm' => $content['nm'])); |
|
| 549 | + $tpl->exec('filemanager.filemanager_ui.index', $content, $sel_options, $readonlys, array('nm' => $content['nm'])); |
|
| 551 | 550 | } |
| 552 | 551 | |
| 553 | 552 | /** |
@@ -583,7 +582,7 @@ discard block |
||
| 583 | 582 | * @param int &$files=null on return number of files deleted |
| 584 | 583 | * @return string success or failure message displayed to the user |
| 585 | 584 | */ |
| 586 | - static public function action($action,$selected,$dir=null,&$errs=null,&$files=null,&$dirs=null) |
|
| 585 | + static public function action($action, $selected, $dir = null, &$errs = null, &$files = null, &$dirs = null) |
|
| 587 | 586 | { |
| 588 | 587 | if (!count($selected)) |
| 589 | 588 | { |
@@ -591,20 +590,20 @@ discard block |
||
| 591 | 590 | } |
| 592 | 591 | $errs = $dirs = $files = 0; |
| 593 | 592 | |
| 594 | - switch($action) |
|
| 593 | + switch ($action) |
|
| 595 | 594 | { |
| 596 | 595 | |
| 597 | 596 | case 'delete': |
| 598 | - return static::do_delete($selected,$errs,$files,$dirs); |
|
| 597 | + return static::do_delete($selected, $errs, $files, $dirs); |
|
| 599 | 598 | |
| 600 | 599 | case 'mail': |
| 601 | 600 | case 'copy': |
| 602 | - foreach($selected as $path) |
|
| 601 | + foreach ($selected as $path) |
|
| 603 | 602 | { |
| 604 | 603 | if (strpos($path, 'mail::') === 0 && $path = substr($path, 6)) |
| 605 | 604 | { |
| 606 | 605 | // Support for dropping mail in filemanager - Pass mail back to mail app |
| 607 | - if(ExecMethod2('mail.mail_ui.vfsSaveMessage', $path, $dir, false)) |
|
| 606 | + if (ExecMethod2('mail.mail_ui.vfsSaveMessage', $path, $dir, false)) |
|
| 608 | 607 | { |
| 609 | 608 | ++$files; |
| 610 | 609 | } |
@@ -615,8 +614,8 @@ discard block |
||
| 615 | 614 | } |
| 616 | 615 | elseif (!Vfs::is_dir($path)) |
| 617 | 616 | { |
| 618 | - $to = Vfs::concat($dir,Vfs::basename($path)); |
|
| 619 | - if ($path != $to && Vfs::copy($path,$to)) |
|
| 617 | + $to = Vfs::concat($dir, Vfs::basename($path)); |
|
| 618 | + if ($path != $to && Vfs::copy($path, $to)) |
|
| 620 | 619 | { |
| 621 | 620 | ++$files; |
| 622 | 621 | } |
@@ -628,19 +627,19 @@ discard block |
||
| 628 | 627 | else |
| 629 | 628 | { |
| 630 | 629 | $len = strlen(dirname($path)); |
| 631 | - foreach(Vfs::find($path) as $p) |
|
| 630 | + foreach (Vfs::find($path) as $p) |
|
| 632 | 631 | { |
| 633 | - $to = $dir.substr($p,$len); |
|
| 632 | + $to = $dir.substr($p, $len); |
|
| 634 | 633 | if ($to == $p) // cant copy into itself! |
| 635 | 634 | { |
| 636 | 635 | ++$errs; |
| 637 | 636 | continue; |
| 638 | 637 | } |
| 639 | - if (($is_dir = Vfs::is_dir($p)) && Vfs::mkdir($to,null,STREAM_MKDIR_RECURSIVE)) |
|
| 638 | + if (($is_dir = Vfs::is_dir($p)) && Vfs::mkdir($to, null, STREAM_MKDIR_RECURSIVE)) |
|
| 640 | 639 | { |
| 641 | 640 | ++$dirs; |
| 642 | 641 | } |
| 643 | - elseif(!$is_dir && Vfs::copy($p,$to)) |
|
| 642 | + elseif (!$is_dir && Vfs::copy($p, $to)) |
|
| 644 | 643 | { |
| 645 | 644 | ++$files; |
| 646 | 645 | } |
@@ -653,15 +652,15 @@ discard block |
||
| 653 | 652 | } |
| 654 | 653 | if ($errs) |
| 655 | 654 | { |
| 656 | - return lang('%1 errors copying (%2 diretories and %3 files copied)!',$errs,$dirs,$files); |
|
| 655 | + return lang('%1 errors copying (%2 diretories and %3 files copied)!', $errs, $dirs, $files); |
|
| 657 | 656 | } |
| 658 | - return $dirs ? lang('%1 directories and %2 files copied.',$dirs,$files) : lang('%1 files copied.',$files); |
|
| 657 | + return $dirs ? lang('%1 directories and %2 files copied.', $dirs, $files) : lang('%1 files copied.', $files); |
|
| 659 | 658 | |
| 660 | 659 | case 'move': |
| 661 | - foreach($selected as $path) |
|
| 660 | + foreach ($selected as $path) |
|
| 662 | 661 | { |
| 663 | - $to = Vfs::is_dir($dir) || count($selected) > 1 ? Vfs::concat($dir,Vfs::basename($path)) : $dir; |
|
| 664 | - if ($path != $to && Vfs::rename($path,$to)) |
|
| 662 | + $to = Vfs::is_dir($dir) || count($selected) > 1 ? Vfs::concat($dir, Vfs::basename($path)) : $dir; |
|
| 663 | + if ($path != $to && Vfs::rename($path, $to)) |
|
| 665 | 664 | { |
| 666 | 665 | ++$files; |
| 667 | 666 | } |
@@ -672,17 +671,17 @@ discard block |
||
| 672 | 671 | } |
| 673 | 672 | if ($errs) |
| 674 | 673 | { |
| 675 | - return lang('%1 errors moving (%2 files moved)!',$errs,$files); |
|
| 674 | + return lang('%1 errors moving (%2 files moved)!', $errs, $files); |
|
| 676 | 675 | } |
| 677 | - return lang('%1 files moved.',$files); |
|
| 676 | + return lang('%1 files moved.', $files); |
|
| 678 | 677 | |
| 679 | 678 | case 'symlink': // symlink given files to $dir |
| 680 | - foreach((array)$selected as $target) |
|
| 679 | + foreach ((array)$selected as $target) |
|
| 681 | 680 | { |
| 682 | 681 | $link = Vfs::concat($dir, Vfs::basename($target)); |
| 683 | - if (!Vfs::stat($dir) || ($ok = Vfs::mkdir($dir,0,true))) |
|
| 682 | + if (!Vfs::stat($dir) || ($ok = Vfs::mkdir($dir, 0, true))) |
|
| 684 | 683 | { |
| 685 | - if(!$ok) |
|
| 684 | + if (!$ok) |
|
| 686 | 685 | { |
| 687 | 686 | $errs++; |
| 688 | 687 | continue; |
@@ -704,15 +703,14 @@ discard block |
||
| 704 | 703 | } |
| 705 | 704 | if (count((array)$selected) == 1) |
| 706 | 705 | { |
| 707 | - return $files ? lang('Symlink to %1 created.', Vfs::decodePath($target)) : |
|
| 708 | - lang('Error creating symlink to target %1!', Vfs::decodePath($target)); |
|
| 706 | + return $files ? lang('Symlink to %1 created.', Vfs::decodePath($target)) : lang('Error creating symlink to target %1!', Vfs::decodePath($target)); |
|
| 709 | 707 | } |
| 710 | 708 | $ret = lang('%1 elements linked.', $files); |
| 711 | 709 | if ($errs) |
| 712 | 710 | { |
| 713 | - $ret = lang('%1 errors linking (%2)!',$errs, $ret); |
|
| 711 | + $ret = lang('%1 errors linking (%2)!', $errs, $ret); |
|
| 714 | 712 | } |
| 715 | - return $ret;//." Vfs::symlink('$target', '$link')"; |
|
| 713 | + return $ret; //." Vfs::symlink('$target', '$link')"; |
|
| 716 | 714 | |
| 717 | 715 | case 'createdir': |
| 718 | 716 | $dst = Vfs::concat($dir, is_array($selected) ? $selected[0] : $selected); |
@@ -728,13 +726,13 @@ discard block |
||
| 728 | 726 | |
| 729 | 727 | default: |
| 730 | 728 | list($action, $settings) = explode('_', $action, 2); |
| 731 | - switch($action) |
|
| 729 | + switch ($action) |
|
| 732 | 730 | { |
| 733 | 731 | case 'document': |
| 734 | 732 | if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['filemanager']['default_document']; |
| 735 | 733 | $document_merge = new filemanager_merge(Vfs::decodePath($dir)); |
| 736 | 734 | $msg = $document_merge->download($settings, $selected, '', $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_dir']); |
| 737 | - if($msg) return $msg; |
|
| 735 | + if ($msg) return $msg; |
|
| 738 | 736 | $errs = count($selected); |
| 739 | 737 | return false; |
| 740 | 738 | } |
@@ -751,12 +749,12 @@ discard block |
||
| 751 | 749 | * @param int &$files=null on return number of files deleted |
| 752 | 750 | * @return string |
| 753 | 751 | */ |
| 754 | - public static function do_delete(array $selected, &$errs=null, &$dirs=null, &$files=null) |
|
| 752 | + public static function do_delete(array $selected, &$errs = null, &$dirs = null, &$files = null) |
|
| 755 | 753 | { |
| 756 | 754 | $dirs = $files = $errs = 0; |
| 757 | 755 | // we first delete all selected links (and files) |
| 758 | 756 | // feeding the links to dirs to Vfs::find() deletes the content of the dirs, not just the link! |
| 759 | - foreach($selected as $key => $path) |
|
| 757 | + foreach ($selected as $key => $path) |
|
| 760 | 758 | { |
| 761 | 759 | if (!Vfs::is_dir($path) || Vfs::is_link($path)) |
| 762 | 760 | { |
@@ -774,21 +772,21 @@ discard block |
||
| 774 | 772 | if ($selected) // somethings left to delete |
| 775 | 773 | { |
| 776 | 774 | // some precaution to never allow to (recursivly) remove /, /apps or /home |
| 777 | - foreach((array)$selected as $path) |
|
| 775 | + foreach ((array)$selected as $path) |
|
| 778 | 776 | { |
| 779 | 777 | if (Vfs::isProtectedDir($path)) |
| 780 | 778 | { |
| 781 | 779 | $errs++; |
| 782 | - return lang("Cautiously rejecting to remove folder '%1'!",Vfs::decodePath($path)); |
|
| 780 | + return lang("Cautiously rejecting to remove folder '%1'!", Vfs::decodePath($path)); |
|
| 783 | 781 | } |
| 784 | 782 | } |
| 785 | 783 | // now we use find to loop through all files and dirs: (selected only contains dirs now) |
| 786 | 784 | // - depth=true to get first the files and then the dir containing it |
| 787 | 785 | // - hidden=true to also return hidden files (eg. Thumbs.db), as we cant delete non-empty dirs |
| 788 | 786 | // - show-deleted=false to not (finally) deleted versioned files |
| 789 | - foreach(Vfs::find($selected,array('depth'=>true,'hidden'=>true,'show-deleted'=>false)) as $path) |
|
| 787 | + foreach (Vfs::find($selected, array('depth'=>true, 'hidden'=>true, 'show-deleted'=>false)) as $path) |
|
| 790 | 788 | { |
| 791 | - if (($is_dir = Vfs::is_dir($path) && !Vfs::is_link($path)) && Vfs::rmdir($path,0)) |
|
| 789 | + if (($is_dir = Vfs::is_dir($path) && !Vfs::is_link($path)) && Vfs::rmdir($path, 0)) |
|
| 792 | 790 | { |
| 793 | 791 | ++$dirs; |
| 794 | 792 | } |
@@ -804,13 +802,13 @@ discard block |
||
| 804 | 802 | } |
| 805 | 803 | if ($errs) |
| 806 | 804 | { |
| 807 | - return lang('%1 errors deleteting (%2 directories and %3 files deleted)!',$errs,$dirs,$files); |
|
| 805 | + return lang('%1 errors deleteting (%2 directories and %3 files deleted)!', $errs, $dirs, $files); |
|
| 808 | 806 | } |
| 809 | 807 | if ($dirs) |
| 810 | 808 | { |
| 811 | - return lang('%1 directories and %2 files deleted.',$dirs,$files); |
|
| 809 | + return lang('%1 directories and %2 files deleted.', $dirs, $files); |
|
| 812 | 810 | } |
| 813 | - return $files == 1 ? lang('File deleted.') : lang('%1 files deleted.',$files); |
|
| 811 | + return $files == 1 ? lang('File deleted.') : lang('%1 files deleted.', $files); |
|
| 814 | 812 | } |
| 815 | 813 | |
| 816 | 814 | /** |
@@ -825,37 +823,37 @@ discard block |
||
| 825 | 823 | if (!$query['csv_export']) |
| 826 | 824 | { |
| 827 | 825 | Api\Cache::setSession('filemanager', 'index', |
| 828 | - array_diff_key ($query, array_flip(array('rows','actions','action_links','placeholder_actions')))); |
|
| 826 | + array_diff_key($query, array_flip(array('rows', 'actions', 'action_links', 'placeholder_actions')))); |
|
| 829 | 827 | } |
| 830 | - if(!$query['path']) $query['path'] = static::get_home_dir(); |
|
| 828 | + if (!$query['path']) $query['path'] = static::get_home_dir(); |
|
| 831 | 829 | |
| 832 | 830 | // Change template to match selected view |
| 833 | - if($query['view']) |
|
| 831 | + if ($query['view']) |
|
| 834 | 832 | { |
| 835 | 833 | $query['template'] = ($query['view'] == 'row' ? 'filemanager.index.rows' : 'filemanager.tile'); |
| 836 | 834 | |
| 837 | 835 | // Store as preference but only for index, not home |
| 838 | - if($query['get_rows'] == 'filemanager.filemanager_ui.get_rows') |
|
| 836 | + if ($query['get_rows'] == 'filemanager.filemanager_ui.get_rows') |
|
| 839 | 837 | { |
| 840 | - $GLOBALS['egw']->preferences->add('filemanager','nm_view',$query['view']); |
|
| 838 | + $GLOBALS['egw']->preferences->add('filemanager', 'nm_view', $query['view']); |
|
| 841 | 839 | $GLOBALS['egw']->preferences->save_repository(); |
| 842 | 840 | } |
| 843 | 841 | } |
| 844 | 842 | // be tolerant with (in previous versions) not correct urlencoded pathes |
| 845 | - if (!Vfs::stat($query['path'],true) && Vfs::stat(urldecode($query['path']))) |
|
| 843 | + if (!Vfs::stat($query['path'], true) && Vfs::stat(urldecode($query['path']))) |
|
| 846 | 844 | { |
| 847 | 845 | $query['path'] = urldecode($query['path']); |
| 848 | 846 | } |
| 849 | - if (!Vfs::stat($query['path'],true) || !Vfs::is_dir($query['path']) || !Vfs::check_access($query['path'],Vfs::READABLE)) |
|
| 847 | + if (!Vfs::stat($query['path'], true) || !Vfs::is_dir($query['path']) || !Vfs::check_access($query['path'], Vfs::READABLE)) |
|
| 850 | 848 | { |
| 851 | 849 | // only redirect, if it would be to some other location, gives redirect-loop otherwise |
| 852 | 850 | if ($query['path'] != ($path = static::get_home_dir())) |
| 853 | 851 | { |
| 854 | 852 | // we will leave here, since we are not allowed, or the location does not exist. Index must handle that, and give |
| 855 | 853 | // an appropriate message |
| 856 | - Egw::redirect_link('/index.php',array('menuaction'=>'filemanager.filemanager_ui.index', |
|
| 854 | + Egw::redirect_link('/index.php', array('menuaction'=>'filemanager.filemanager_ui.index', |
|
| 857 | 855 | 'path' => $path, |
| 858 | - 'msg' => lang('The requested path %1 is not available.',Vfs::decodePath($query['path'])), |
|
| 856 | + 'msg' => lang('The requested path %1 is not available.', Vfs::decodePath($query['path'])), |
|
| 859 | 857 | 'ajax' => 'true' |
| 860 | 858 | )); |
| 861 | 859 | } |
@@ -863,35 +861,35 @@ discard block |
||
| 863 | 861 | return 0; |
| 864 | 862 | } |
| 865 | 863 | $rows = $dir_is_writable = array(); |
| 866 | - if($query['searchletter'] && !empty($query['search'])) |
|
| 864 | + if ($query['searchletter'] && !empty($query['search'])) |
|
| 867 | 865 | { |
| 868 | - $namefilter = '/^'.$query['searchletter'].'.*'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).'/i'; |
|
| 866 | + $namefilter = '/^'.$query['searchletter'].'.*'.str_replace(array('\\?', '\\*'), array('.{1}', '.*'), preg_quote($query['search'])).'/i'; |
|
| 869 | 867 | if ($query['searchletter'] == strtolower($query['search'][0])) |
| 870 | 868 | { |
| 871 | - $namefilter = '/^('.$query['searchletter'].'.*'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).'|'. |
|
| 872 | - str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).')/i'; |
|
| 869 | + $namefilter = '/^('.$query['searchletter'].'.*'.str_replace(array('\\?', '\\*'), array('.{1}', '.*'), preg_quote($query['search'])).'|'. |
|
| 870 | + str_replace(array('\\?', '\\*'), array('.{1}', '.*'), preg_quote($query['search'])).')/i'; |
|
| 873 | 871 | } |
| 874 | 872 | } |
| 875 | 873 | elseif ($query['searchletter']) |
| 876 | 874 | { |
| 877 | 875 | $namefilter = '/^'.$query['searchletter'].'/i'; |
| 878 | 876 | } |
| 879 | - elseif(!empty($query['search'])) |
|
| 877 | + elseif (!empty($query['search'])) |
|
| 880 | 878 | { |
| 881 | - $namefilter = '/'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).'/i'; |
|
| 879 | + $namefilter = '/'.str_replace(array('\\?', '\\*'), array('.{1}', '.*'), preg_quote($query['search'])).'/i'; |
|
| 882 | 880 | } |
| 883 | 881 | |
| 884 | 882 | // Re-map so 'No filters' favorite ('') is depth 1 |
| 885 | 883 | $filter = $query['filter'] === '' ? 1 : $query['filter']; |
| 886 | 884 | |
| 887 | 885 | $maxdepth = $filter && $filter != 4 ? (int)(boolean)$filter : null; |
| 888 | - if($filter == 5) $maxdepth = 2; |
|
| 886 | + if ($filter == 5) $maxdepth = 2; |
|
| 889 | 887 | $n = 0; |
| 890 | 888 | $vfs_options = array( |
| 891 | 889 | 'mindepth' => 1, |
| 892 | 890 | 'maxdepth' => $maxdepth, |
| 893 | 891 | 'dirsontop' => $filter <= 1, |
| 894 | - 'type' => $filter && $filter != 5 ? ($filter == 4 ? 'd' : null) : ($filter == 5 ? 'F':'f'), |
|
| 892 | + 'type' => $filter && $filter != 5 ? ($filter == 4 ? 'd' : null) : ($filter == 5 ? 'F' : 'f'), |
|
| 895 | 893 | 'order' => $query['order'], 'sort' => $query['sort'], |
| 896 | 894 | 'limit' => (int)$query['num_rows'].','.(int)$query['start'], |
| 897 | 895 | 'need_mime' => true, |
@@ -899,11 +897,11 @@ discard block |
||
| 899 | 897 | 'hidden' => $filter == 3, |
| 900 | 898 | 'follow' => $filter == 5, |
| 901 | 899 | ); |
| 902 | - if($query['col_filter']['mime']) |
|
| 900 | + if ($query['col_filter']['mime']) |
|
| 903 | 901 | { |
| 904 | 902 | $vfs_options['mime'] = $query['col_filter']['mime']; |
| 905 | 903 | } |
| 906 | - foreach(Vfs::find(!empty($query['col_filter']['dir']) ? $query['col_filter']['dir'] : $query['path'],$vfs_options,true) as $path => $row) |
|
| 904 | + foreach (Vfs::find(!empty($query['col_filter']['dir']) ? $query['col_filter']['dir'] : $query['path'], $vfs_options, true) as $path => $row) |
|
| 907 | 905 | { |
| 908 | 906 | //echo $path; _debug_array($row); |
| 909 | 907 | |
@@ -922,38 +920,38 @@ discard block |
||
| 922 | 920 | $row['class'] .= 'isDir '; |
| 923 | 921 | $row['is_dir'] = 1; |
| 924 | 922 | } |
| 925 | - if(!$dir_is_writable[$path]) |
|
| 923 | + if (!$dir_is_writable[$path]) |
|
| 926 | 924 | { |
| 927 | 925 | $row['class'] .= 'noEdit '; |
| 928 | 926 | } |
| 929 | 927 | $row['class'] .= !$dir_is_writable[$dir] ? 'noDelete' : ''; |
| 930 | 928 | $row['download_url'] = Vfs::download_url($path); |
| 931 | - $row['gid'] = -abs($row['gid']); // gid are positive, but we use negagive account_id for groups internal |
|
| 929 | + $row['gid'] = -abs($row['gid']); // gid are positive, but we use negagive account_id for groups internal |
|
| 932 | 930 | |
| 933 | 931 | $rows[++$n] = $row; |
| 934 | 932 | $path2n[$path] = $n; |
| 935 | 933 | } |
| 936 | 934 | // query comments and cf's for the displayed rows |
| 937 | - $cols_to_show = explode(',',$GLOBALS['egw_info']['user']['preferences']['filemanager']['nextmatch-filemanager.index.rows']); |
|
| 935 | + $cols_to_show = explode(',', $GLOBALS['egw_info']['user']['preferences']['filemanager']['nextmatch-filemanager.index.rows']); |
|
| 938 | 936 | |
| 939 | 937 | // Always include comment in tiles |
| 940 | - if($query['view'] == 'tile') |
|
| 938 | + if ($query['view'] == 'tile') |
|
| 941 | 939 | { |
| 942 | 940 | $cols_to_show[] = 'comment'; |
| 943 | 941 | } |
| 944 | - $all_cfs = in_array('customfields',$cols_to_show) && $cols_to_show[count($cols_to_show)-1][0] != '#'; |
|
| 945 | - if ($path2n && (in_array('comment',$cols_to_show) || in_array('customfields',$cols_to_show)) && |
|
| 942 | + $all_cfs = in_array('customfields', $cols_to_show) && $cols_to_show[count($cols_to_show) - 1][0] != '#'; |
|
| 943 | + if ($path2n && (in_array('comment', $cols_to_show) || in_array('customfields', $cols_to_show)) && |
|
| 946 | 944 | ($path2props = Vfs::propfind(array_keys($path2n)))) |
| 947 | 945 | { |
| 948 | - foreach($path2props as $path => $props) |
|
| 946 | + foreach ($path2props as $path => $props) |
|
| 949 | 947 | { |
| 950 | - unset($row); // fixes a weird problem with php5.1, does NOT happen with php5.2 |
|
| 951 | - $row =& $rows[$path2n[$path]]; |
|
| 952 | - if ( !is_array($props) ) continue; |
|
| 953 | - foreach($props as $prop) |
|
| 948 | + unset($row); // fixes a weird problem with php5.1, does NOT happen with php5.2 |
|
| 949 | + $row = & $rows[$path2n[$path]]; |
|
| 950 | + if (!is_array($props)) continue; |
|
| 951 | + foreach ($props as $prop) |
|
| 954 | 952 | { |
| 955 | - if (!$all_cfs && $prop['name'][0] == '#' && !in_array($prop['name'],$cols_to_show)) continue; |
|
| 956 | - $row[$prop['name']] = strlen($prop['val']) < 64 ? $prop['val'] : substr($prop['val'],0,64).' ...'; |
|
| 953 | + if (!$all_cfs && $prop['name'][0] == '#' && !in_array($prop['name'], $cols_to_show)) continue; |
|
| 954 | + $row[$prop['name']] = strlen($prop['val']) < 64 ? $prop['val'] : substr($prop['val'], 0, 64).' ...'; |
|
| 957 | 955 | } |
| 958 | 956 | } |
| 959 | 957 | } |
@@ -965,7 +963,7 @@ discard block |
||
| 965 | 963 | if ($GLOBALS['egw_info']['flags']['currentapp'] == 'projectmanager') |
| 966 | 964 | { |
| 967 | 965 | // we need our app.css file |
| 968 | - if (!file_exists(EGW_SERVER_ROOT.($css_file='/filemanager/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/app.css'))) |
|
| 966 | + if (!file_exists(EGW_SERVER_ROOT.($css_file = '/filemanager/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/app.css'))) |
|
| 969 | 967 | { |
| 970 | 968 | $css_file = '/filemanager/templates/default/app.css'; |
| 971 | 969 | } |
@@ -981,7 +979,7 @@ discard block |
||
| 981 | 979 | * @param array $content |
| 982 | 980 | * @param string $msg |
| 983 | 981 | */ |
| 984 | - function file(array $content=null,$msg='') |
|
| 982 | + function file(array $content = null, $msg = '') |
|
| 985 | 983 | { |
| 986 | 984 | $tpl = new Etemplate('filemanager.file'); |
| 987 | 985 | |
@@ -991,9 +989,9 @@ discard block |
||
| 991 | 989 | { |
| 992 | 990 | $msg .= $_GET['msg']; |
| 993 | 991 | } |
| 994 | - if (!($path = str_replace(array('#','?'),array('%23','%3F'),$_GET['path'])) || // ?, # need to stay encoded! |
|
| 992 | + if (!($path = str_replace(array('#', '?'), array('%23', '%3F'), $_GET['path'])) || // ?, # need to stay encoded! |
|
| 995 | 993 | // actions enclose pathes containing comma with " |
| 996 | - ($path[0] == '"' && substr($path,-1) == '"' && !($path = substr(str_replace('""','"',$path),1,-1))) || |
|
| 994 | + ($path[0] == '"' && substr($path, -1) == '"' && !($path = substr(str_replace('""', '"', $path), 1, -1))) || |
|
| 997 | 995 | !($stat = Vfs::lstat($path))) |
| 998 | 996 | { |
| 999 | 997 | $msg .= lang('File or directory not found!')." path='$path', stat=".array2string($stat); |
@@ -1006,10 +1004,10 @@ discard block |
||
| 1006 | 1004 | $content['path'] = $path; |
| 1007 | 1005 | $content['hsize'] = Vfs::hsize($stat['size']); |
| 1008 | 1006 | $content['mime'] = Vfs::mime_content_type($path); |
| 1009 | - $content['gid'] *= -1; // our widgets use negative gid's |
|
| 1007 | + $content['gid'] *= -1; // our widgets use negative gid's |
|
| 1010 | 1008 | if (($props = Vfs::propfind($path))) |
| 1011 | 1009 | { |
| 1012 | - foreach($props as $prop) |
|
| 1010 | + foreach ($props as $prop) |
|
| 1013 | 1011 | { |
| 1014 | 1012 | $content[$prop['name']] = $prop['val']; |
| 1015 | 1013 | } |
@@ -1022,9 +1020,9 @@ discard block |
||
| 1022 | 1020 | $content['tabs'] = $_GET['tabs']; |
| 1023 | 1021 | if (!($content['is_dir'] = Vfs::is_dir($path) && !Vfs::is_link($path))) |
| 1024 | 1022 | { |
| 1025 | - $content['perms']['executable'] = (int)!!($content['mode'] & 0111); |
|
| 1023 | + $content['perms']['executable'] = (int)!!($content['mode']&0111); |
|
| 1026 | 1024 | $mask = 6; |
| 1027 | - if (preg_match('/^text/',$content['mime']) && $content['size'] < 100000) |
|
| 1025 | + if (preg_match('/^text/', $content['mime']) && $content['size'] < 100000) |
|
| 1028 | 1026 | { |
| 1029 | 1027 | $content['text_content'] = file_get_contents(Vfs::PREFIX.$path); |
| 1030 | 1028 | } |
@@ -1034,19 +1032,19 @@ discard block |
||
| 1034 | 1032 | //currently not implemented in backend $content['perms']['sticky'] = (int)!!($content['mode'] & 0x201); |
| 1035 | 1033 | $mask = 7; |
| 1036 | 1034 | } |
| 1037 | - foreach(array('owner' => 6,'group' => 3,'other' => 0) as $name => $shift) |
|
| 1035 | + foreach (array('owner' => 6, 'group' => 3, 'other' => 0) as $name => $shift) |
|
| 1038 | 1036 | { |
| 1039 | - $content['perms'][$name] = ($content['mode'] >> $shift) & $mask; |
|
| 1037 | + $content['perms'][$name] = ($content['mode'] >> $shift)&$mask; |
|
| 1040 | 1038 | } |
| 1041 | - $content['is_owner'] = Vfs::has_owner_rights($path,$content); |
|
| 1039 | + $content['is_owner'] = Vfs::has_owner_rights($path, $content); |
|
| 1042 | 1040 | } |
| 1043 | 1041 | else |
| 1044 | 1042 | { |
| 1045 | 1043 | //_debug_array($content); |
| 1046 | - $path =& $content['path']; |
|
| 1044 | + $path = & $content['path']; |
|
| 1047 | 1045 | |
| 1048 | 1046 | list($button) = @each($content['button']); unset($content['button']); |
| 1049 | - if(!$button && $content['sudo']) |
|
| 1047 | + if (!$button && $content['sudo']) |
|
| 1050 | 1048 | { |
| 1051 | 1049 | // Button to stop sudo is not in button namespace |
| 1052 | 1050 | $button = 'sudo'; |
@@ -1055,21 +1053,21 @@ discard block |
||
| 1055 | 1053 | // need to check 'setup' button (submit button in sudo popup), as some browsers (eg. chrome) also fill the hidden field |
| 1056 | 1054 | if ($button == 'sudo' && Vfs::$is_root || $button == 'setup' && $content['sudo']['user']) |
| 1057 | 1055 | { |
| 1058 | - $msg = $this->sudo($button == 'setup' ? $content['sudo']['user'] : '',$content['sudo']['passwd']) ? |
|
| 1056 | + $msg = $this->sudo($button == 'setup' ? $content['sudo']['user'] : '', $content['sudo']['passwd']) ? |
|
| 1059 | 1057 | lang('Root access granted.') : ($button == 'setup' && $content['sudo']['user'] ? |
| 1060 | 1058 | lang('Wrong username or password!') : lang('Root access stopped.')); |
| 1061 | 1059 | unset($content['sudo']); |
| 1062 | 1060 | $content['is_owner'] = Vfs::has_owner_rights($path); |
| 1063 | 1061 | } |
| 1064 | - if (in_array($button,array('save','apply'))) |
|
| 1062 | + if (in_array($button, array('save', 'apply'))) |
|
| 1065 | 1063 | { |
| 1066 | 1064 | $props = array(); |
| 1067 | 1065 | $perm_changed = $perm_failed = 0; |
| 1068 | - foreach($content['old'] as $name => $old_value) |
|
| 1066 | + foreach ($content['old'] as $name => $old_value) |
|
| 1069 | 1067 | { |
| 1070 | 1068 | if (isset($content[$name]) && ($old_value != $content[$name] || |
| 1071 | 1069 | // do not check for modification, if modify_subs is checked! |
| 1072 | - $content['modify_subs'] && in_array($name,array('uid','gid','perms'))) && |
|
| 1070 | + $content['modify_subs'] && in_array($name, array('uid', 'gid', 'perms'))) && |
|
| 1073 | 1071 | ($name != 'uid' || Vfs::$is_root)) |
| 1074 | 1072 | { |
| 1075 | 1073 | if ($name == 'name') |
@@ -1083,23 +1081,23 @@ discard block |
||
| 1083 | 1081 | $to = Vfs::concat($dir, $content['name']); |
| 1084 | 1082 | if (file_exists(Vfs::PREFIX.$to) && $content['confirm_overwrite'] !== $to) |
| 1085 | 1083 | { |
| 1086 | - $tpl->set_validation_error('name',lang("There's already a file with that name!").'<br />'. |
|
| 1087 | - lang('To overwrite the existing file store again.',lang($button))); |
|
| 1084 | + $tpl->set_validation_error('name', lang("There's already a file with that name!").'<br />'. |
|
| 1085 | + lang('To overwrite the existing file store again.', lang($button))); |
|
| 1088 | 1086 | $content['confirm_overwrite'] = $to; |
| 1089 | 1087 | if ($button == 'save') $button = 'apply'; |
| 1090 | 1088 | continue; |
| 1091 | 1089 | } |
| 1092 | - if (Vfs::rename($path,$to)) |
|
| 1090 | + if (Vfs::rename($path, $to)) |
|
| 1093 | 1091 | { |
| 1094 | - $msg .= lang('Renamed %1 to %2.',Vfs::decodePath(basename($path)),Vfs::decodePath(basename($to))).' '; |
|
| 1092 | + $msg .= lang('Renamed %1 to %2.', Vfs::decodePath(basename($path)), Vfs::decodePath(basename($to))).' '; |
|
| 1095 | 1093 | $content['old']['name'] = $content[$name]; |
| 1096 | 1094 | $path = $to; |
| 1097 | - $content['mime'] = Api\MimeMagic::filename2mime($path); // recheck mime type |
|
| 1098 | - $refresh_path = Vfs::dirname($path); // for renames, we have to refresh the parent |
|
| 1095 | + $content['mime'] = Api\MimeMagic::filename2mime($path); // recheck mime type |
|
| 1096 | + $refresh_path = Vfs::dirname($path); // for renames, we have to refresh the parent |
|
| 1099 | 1097 | } |
| 1100 | 1098 | else |
| 1101 | 1099 | { |
| 1102 | - $msg .= lang('Rename of %1 to %2 failed!',Vfs::decodePath(basename($path)),Vfs::decodePath(basename($to))).' '; |
|
| 1100 | + $msg .= lang('Rename of %1 to %2 failed!', Vfs::decodePath(basename($path)), Vfs::decodePath(basename($to))).' '; |
|
| 1103 | 1101 | if (Vfs::deny_script($to)) |
| 1104 | 1102 | { |
| 1105 | 1103 | $msg .= lang('You are NOT allowed to upload a script!').' '; |
@@ -1119,7 +1117,7 @@ discard block |
||
| 1119 | 1117 | 'val' => (!empty($content[$name]) ? $content[$name] : null), |
| 1120 | 1118 | ), |
| 1121 | 1119 | ); |
| 1122 | - if (Vfs::proppatch($path,$mergeprop)) |
|
| 1120 | + if (Vfs::proppatch($path, $mergeprop)) |
|
| 1123 | 1121 | { |
| 1124 | 1122 | $content['old'][$name] = $content[$name]; |
| 1125 | 1123 | $msg .= lang('Setting for document merge saved.'); |
@@ -1131,22 +1129,22 @@ discard block |
||
| 1131 | 1129 | } |
| 1132 | 1130 | else |
| 1133 | 1131 | { |
| 1134 | - static $name2cmd = array('uid' => 'chown','gid' => 'chgrp','perms' => 'chmod'); |
|
| 1135 | - $cmd = array('EGroupware\\Api\\Vfs',$name2cmd[$name]); |
|
| 1132 | + static $name2cmd = array('uid' => 'chown', 'gid' => 'chgrp', 'perms' => 'chmod'); |
|
| 1133 | + $cmd = array('EGroupware\\Api\\Vfs', $name2cmd[$name]); |
|
| 1136 | 1134 | $value = $name == 'perms' ? static::perms2mode($content['perms']) : $content[$name]; |
| 1137 | 1135 | if ($content['modify_subs']) |
| 1138 | 1136 | { |
| 1139 | 1137 | if ($name == 'perms') |
| 1140 | 1138 | { |
| 1141 | - $changed = Vfs::find($path,array('type'=>'d'),$cmd,array($value)); |
|
| 1142 | - $changed += Vfs::find($path,array('type'=>'f'),$cmd,array($value & 0666)); // no execute for files |
|
| 1139 | + $changed = Vfs::find($path, array('type'=>'d'), $cmd, array($value)); |
|
| 1140 | + $changed += Vfs::find($path, array('type'=>'f'), $cmd, array($value&0666)); // no execute for files |
|
| 1143 | 1141 | } |
| 1144 | 1142 | else |
| 1145 | 1143 | { |
| 1146 | - $changed = Vfs::find($path,null,$cmd,array($value)); |
|
| 1144 | + $changed = Vfs::find($path, null, $cmd, array($value)); |
|
| 1147 | 1145 | } |
| 1148 | 1146 | $ok = $failed = 0; |
| 1149 | - foreach($changed as &$r) |
|
| 1147 | + foreach ($changed as &$r) |
|
| 1150 | 1148 | { |
| 1151 | 1149 | if ($r) |
| 1152 | 1150 | { |
@@ -1159,32 +1157,32 @@ discard block |
||
| 1159 | 1157 | } |
| 1160 | 1158 | if ($ok && !$failed) |
| 1161 | 1159 | { |
| 1162 | - if(!$perm_changed++) $msg .= lang('Permissions of %1 changed.',$path.' '.lang('and all it\'s childeren')); |
|
| 1160 | + if (!$perm_changed++) $msg .= lang('Permissions of %1 changed.', $path.' '.lang('and all it\'s childeren')); |
|
| 1163 | 1161 | $content['old'][$name] = $content[$name]; |
| 1164 | 1162 | } |
| 1165 | - elseif($failed) |
|
| 1163 | + elseif ($failed) |
|
| 1166 | 1164 | { |
| 1167 | - if(!$perm_failed++) $msg .= lang('Failed to change permissions of %1!',$path.lang('and all it\'s childeren'). |
|
| 1168 | - ($ok ? ' ('.lang('%1 failed, %2 succeded',$failed,$ok).')' : '')); |
|
| 1165 | + if (!$perm_failed++) $msg .= lang('Failed to change permissions of %1!', $path.lang('and all it\'s childeren'). |
|
| 1166 | + ($ok ? ' ('.lang('%1 failed, %2 succeded', $failed, $ok).')' : '')); |
|
| 1169 | 1167 | } |
| 1170 | 1168 | } |
| 1171 | - elseif (call_user_func_array($cmd,array($path,$value))) |
|
| 1169 | + elseif (call_user_func_array($cmd, array($path, $value))) |
|
| 1172 | 1170 | { |
| 1173 | - $msg .= lang('Permissions of %1 changed.',$path); |
|
| 1171 | + $msg .= lang('Permissions of %1 changed.', $path); |
|
| 1174 | 1172 | $content['old'][$name] = $content[$name]; |
| 1175 | 1173 | } |
| 1176 | 1174 | else |
| 1177 | 1175 | { |
| 1178 | - $msg .= lang('Failed to change permissions of %1!',$path); |
|
| 1176 | + $msg .= lang('Failed to change permissions of %1!', $path); |
|
| 1179 | 1177 | } |
| 1180 | 1178 | } |
| 1181 | 1179 | } |
| 1182 | 1180 | } |
| 1183 | 1181 | if ($props) |
| 1184 | 1182 | { |
| 1185 | - if (Vfs::proppatch($path,$props)) |
|
| 1183 | + if (Vfs::proppatch($path, $props)) |
|
| 1186 | 1184 | { |
| 1187 | - foreach($props as $prop) |
|
| 1185 | + foreach ($props as $prop) |
|
| 1188 | 1186 | { |
| 1189 | 1187 | $content['old'][$prop['name']] = $prop['val']; |
| 1190 | 1188 | } |
@@ -1201,8 +1199,8 @@ discard block |
||
| 1201 | 1199 | if ($content['eacl']['delete']) |
| 1202 | 1200 | { |
| 1203 | 1201 | list($ino_owner) = each($content['eacl']['delete']); |
| 1204 | - list(, $owner) = explode('-',$ino_owner,2); // $owner is a group and starts with a minus! |
|
| 1205 | - $msg .= Vfs::eacl($path,null,$owner) ? lang('ACL deleted.') : lang('Error deleting the ACL entry!'); |
|
| 1202 | + list(, $owner) = explode('-', $ino_owner, 2); // $owner is a group and starts with a minus! |
|
| 1203 | + $msg .= Vfs::eacl($path, null, $owner) ? lang('ACL deleted.') : lang('Error deleting the ACL entry!'); |
|
| 1206 | 1204 | } |
| 1207 | 1205 | elseif ($button == 'eacl') |
| 1208 | 1206 | { |
@@ -1212,7 +1210,7 @@ discard block |
||
| 1212 | 1210 | } |
| 1213 | 1211 | else |
| 1214 | 1212 | { |
| 1215 | - $msg .= Vfs::eacl($path,$content['eacl']['rights'],$content['eacl_owner']) ? |
|
| 1213 | + $msg .= Vfs::eacl($path, $content['eacl']['rights'], $content['eacl_owner']) ? |
|
| 1216 | 1214 | lang('ACL added.') : lang('Error adding the ACL!'); |
| 1217 | 1215 | } |
| 1218 | 1216 | } |
@@ -1222,7 +1220,7 @@ discard block |
||
| 1222 | 1220 | } |
| 1223 | 1221 | if ($content['is_link'] && !Vfs::stat($path)) |
| 1224 | 1222 | { |
| 1225 | - $msg .= ($msg ? "\n" : '').lang('Link target %1 not found!',$content['symlink']); |
|
| 1223 | + $msg .= ($msg ? "\n" : '').lang('Link target %1 not found!', $content['symlink']); |
|
| 1226 | 1224 | } |
| 1227 | 1225 | $content['link'] = Egw::link(Vfs::download_url($path)); |
| 1228 | 1226 | $content['icon'] = Vfs::mime_icon($content['mime']); |
@@ -1231,11 +1229,11 @@ discard block |
||
| 1231 | 1229 | if (($readonlys['uid'] = !Vfs::$is_root) && !$content['uid']) $content['ro_uid_root'] = 'root'; |
| 1232 | 1230 | // only owner can change group & perms |
| 1233 | 1231 | if (($readonlys['gid'] = !$content['is_owner'] || |
| 1234 | - Vfs::parse_url(Vfs::resolve_url($content['path']),PHP_URL_SCHEME) == 'oldvfs') ||// no uid, gid or perms in oldvfs |
|
| 1232 | + Vfs::parse_url(Vfs::resolve_url($content['path']), PHP_URL_SCHEME) == 'oldvfs') || // no uid, gid or perms in oldvfs |
|
| 1235 | 1233 | !Vfs::is_writable($path)) |
| 1236 | 1234 | { |
| 1237 | 1235 | if (!$content['gid']) $content['ro_gid_root'] = 'root'; |
| 1238 | - foreach($content['perms'] as $name => $value) |
|
| 1236 | + foreach ($content['perms'] as $name => $value) |
|
| 1239 | 1237 | { |
| 1240 | 1238 | $readonlys['perms['.$name.']'] = true; |
| 1241 | 1239 | } |
@@ -1254,38 +1252,38 @@ discard block |
||
| 1254 | 1252 | } |
| 1255 | 1253 | elseif (!Vfs::is_writable($path)) |
| 1256 | 1254 | { |
| 1257 | - foreach($cfs as $name => $data) |
|
| 1255 | + foreach ($cfs as $name => $data) |
|
| 1258 | 1256 | { |
| 1259 | 1257 | $readonlys['#'.$name] = true; |
| 1260 | 1258 | } |
| 1261 | 1259 | } |
| 1262 | - $readonlys['tabs']['filemanager.file.eacl'] = true; // eacl off by default |
|
| 1260 | + $readonlys['tabs']['filemanager.file.eacl'] = true; // eacl off by default |
|
| 1263 | 1261 | if ($content['is_dir']) |
| 1264 | 1262 | { |
| 1265 | - $readonlys['tabs']['filemanager.file.preview'] = true; // no preview tab for dirs |
|
| 1266 | - $sel_options['rights']=$sel_options['owner']=$sel_options['group']=$sel_options['other'] = array( |
|
| 1263 | + $readonlys['tabs']['filemanager.file.preview'] = true; // no preview tab for dirs |
|
| 1264 | + $sel_options['rights'] = $sel_options['owner'] = $sel_options['group'] = $sel_options['other'] = array( |
|
| 1267 | 1265 | 7 => lang('Display and modification of content'), |
| 1268 | 1266 | 5 => lang('Display of content'), |
| 1269 | 1267 | 0 => lang('No access'), |
| 1270 | 1268 | ); |
| 1271 | - if(($content['eacl'] = Vfs::get_eacl($content['path'])) !== false && // backend supports eacl |
|
| 1269 | + if (($content['eacl'] = Vfs::get_eacl($content['path'])) !== false && // backend supports eacl |
|
| 1272 | 1270 | $GLOBALS['egw_info']['user']['account_id'] == Vfs::$user) // leave eACL tab disabled for sharing |
| 1273 | 1271 | { |
| 1274 | - unset($readonlys['tabs']['filemanager.file.eacl']); // --> switch the tab on again |
|
| 1275 | - foreach($content['eacl'] as &$eacl) |
|
| 1272 | + unset($readonlys['tabs']['filemanager.file.eacl']); // --> switch the tab on again |
|
| 1273 | + foreach ($content['eacl'] as &$eacl) |
|
| 1276 | 1274 | { |
| 1277 | - $eacl['path'] = rtrim(Vfs::parse_url($eacl['path'],PHP_URL_PATH),'/'); |
|
| 1275 | + $eacl['path'] = rtrim(Vfs::parse_url($eacl['path'], PHP_URL_PATH), '/'); |
|
| 1278 | 1276 | $readonlys['delete['.$eacl['ino'].'-'.$eacl['owner'].']'] = $eacl['ino'] != $content['ino'] || |
| 1279 | 1277 | $eacl['path'] != $content['path'] || !$content['is_owner']; |
| 1280 | 1278 | } |
| 1281 | - array_unshift($content['eacl'],false); // make the keys start with 1, not 0 |
|
| 1279 | + array_unshift($content['eacl'], false); // make the keys start with 1, not 0 |
|
| 1282 | 1280 | $content['eacl']['owner'] = 0; |
| 1283 | 1281 | $content['eacl']['rights'] = 5; |
| 1284 | 1282 | } |
| 1285 | 1283 | } |
| 1286 | 1284 | else |
| 1287 | 1285 | { |
| 1288 | - $sel_options['owner']=$sel_options['group']=$sel_options['other'] = array( |
|
| 1286 | + $sel_options['owner'] = $sel_options['group'] = $sel_options['other'] = array( |
|
| 1289 | 1287 | 6 => lang('Read & write access'), |
| 1290 | 1288 | 4 => lang('Read access only'), |
| 1291 | 1289 | 0 => lang('No access'), |
@@ -1295,11 +1293,11 @@ discard block |
||
| 1295 | 1293 | // mergeapp |
| 1296 | 1294 | $content['mergeapp'] = static::get_mergeapp($path, 'self'); |
| 1297 | 1295 | $content['mergeapp_parent'] = static::get_mergeapp($path, 'parents'); |
| 1298 | - if(!empty($content['mergeapp'])) |
|
| 1296 | + if (!empty($content['mergeapp'])) |
|
| 1299 | 1297 | { |
| 1300 | 1298 | $content['mergeapp_effective'] = $content['mergeapp']; |
| 1301 | 1299 | } |
| 1302 | - elseif(!empty($content['mergeapp_parent'])) |
|
| 1300 | + elseif (!empty($content['mergeapp_parent'])) |
|
| 1303 | 1301 | { |
| 1304 | 1302 | $content['mergeapp_effective'] = $content['mergeapp_parent']; |
| 1305 | 1303 | } |
@@ -1311,7 +1309,7 @@ discard block |
||
| 1311 | 1309 | $mergeapp_list = Link::app_list('merge'); |
| 1312 | 1310 | unset($mergeapp_list[$GLOBALS['egw_info']['flags']['currentapp']]); // exclude filemanager from list |
| 1313 | 1311 | $mergeapp_empty = !empty($content['mergeapp_parent']) |
| 1314 | - ? $mergeapp_list[$content['mergeapp_parent']] . ' (parent setting)' : ''; |
|
| 1312 | + ? $mergeapp_list[$content['mergeapp_parent']].' (parent setting)' : ''; |
|
| 1315 | 1313 | $sel_options['mergeapp'] = array('' => $mergeapp_empty); |
| 1316 | 1314 | $sel_options['mergeapp'] = $sel_options['mergeapp'] + $mergeapp_list; |
| 1317 | 1315 | // mergeapp other gui options |
@@ -1328,7 +1326,7 @@ discard block |
||
| 1328 | 1326 | 'comment' => (string)$content['comment'], |
| 1329 | 1327 | 'mergeapp' => $content['mergeapp'] |
| 1330 | 1328 | ); |
| 1331 | - if ($cfs) foreach($cfs as $name => $data) |
|
| 1329 | + if ($cfs) foreach ($cfs as $name => $data) |
|
| 1332 | 1330 | { |
| 1333 | 1331 | $preserve['old']['#'.$name] = (string)$content['#'.$name]; |
| 1334 | 1332 | } |
@@ -1336,31 +1334,31 @@ discard block |
||
| 1336 | 1334 | if (Vfs::$is_root) |
| 1337 | 1335 | { |
| 1338 | 1336 | $tpl->setElementAttribute('sudouser', 'label', 'Logout'); |
| 1339 | - $tpl->setElementAttribute('sudouser', 'help','Log out as superuser'); |
|
| 1337 | + $tpl->setElementAttribute('sudouser', 'help', 'Log out as superuser'); |
|
| 1340 | 1338 | // Need a more complex submit because button type is buttononly, which doesn't submit |
| 1341 | - $tpl->setElementAttribute('sudouser', 'onclick','app.filemanager.set_sudoButton(widget,"login")'); |
|
| 1339 | + $tpl->setElementAttribute('sudouser', 'onclick', 'app.filemanager.set_sudoButton(widget,"login")'); |
|
| 1342 | 1340 | |
| 1343 | 1341 | } |
| 1344 | 1342 | elseif ($button == 'sudo') |
| 1345 | 1343 | { |
| 1346 | 1344 | $tpl->setElementAttribute('sudouser', 'label', 'Superuser'); |
| 1347 | - $tpl->setElementAttribute('sudouser', 'help','Enter setup user and password to get root rights'); |
|
| 1348 | - $tpl->setElementAttribute('sudouser', 'onclick','app.filemanager.set_sudoButton(widget,"logout")'); |
|
| 1345 | + $tpl->setElementAttribute('sudouser', 'help', 'Enter setup user and password to get root rights'); |
|
| 1346 | + $tpl->setElementAttribute('sudouser', 'onclick', 'app.filemanager.set_sudoButton(widget,"logout")'); |
|
| 1349 | 1347 | } |
| 1350 | 1348 | else if (self::is_anonymous($GLOBALS['egw_info']['user']['account_id'])) |
| 1351 | 1349 | { |
| 1352 | 1350 | // Just hide sudo for anonymous users |
| 1353 | 1351 | $readonlys['sudouser'] = true; |
| 1354 | 1352 | } |
| 1355 | - if (($extra_tabs = Vfs::getExtraInfo($path,$content))) |
|
| 1353 | + if (($extra_tabs = Vfs::getExtraInfo($path, $content))) |
|
| 1356 | 1354 | { |
| 1357 | 1355 | // add to existing tabs in template |
| 1358 | 1356 | $tpl->setElementAttribute('tabs', 'add_tabs', true); |
| 1359 | 1357 | |
| 1360 | - $tabs =& $tpl->getElementAttribute('tabs','tabs'); |
|
| 1358 | + $tabs = & $tpl->getElementAttribute('tabs', 'tabs'); |
|
| 1361 | 1359 | if (true) $tabs = array(); |
| 1362 | 1360 | |
| 1363 | - foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab) |
|
| 1361 | + foreach (isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab) |
|
| 1364 | 1362 | { |
| 1365 | 1363 | $tabs[] = array( |
| 1366 | 1364 | 'label' => $extra_tab['label'], |
@@ -1383,7 +1381,7 @@ discard block |
||
| 1383 | 1381 | Framework::window_focus(); |
| 1384 | 1382 | $GLOBALS['egw_info']['flags']['app_header'] = lang('Preferences').' '.Vfs::decodePath($path); |
| 1385 | 1383 | |
| 1386 | - $tpl->exec('filemanager.filemanager_ui.file',$content,$sel_options,$readonlys,$preserve,2); |
|
| 1384 | + $tpl->exec('filemanager.filemanager_ui.file', $content, $sel_options, $readonlys, $preserve, 2); |
|
| 1387 | 1385 | } |
| 1388 | 1386 | |
| 1389 | 1387 | /** |
@@ -1405,7 +1403,7 @@ discard block |
||
| 1405 | 1403 | * @param string $dir=null current directory |
| 1406 | 1404 | * @see static::action() |
| 1407 | 1405 | */ |
| 1408 | - public static function ajax_action($action, $selected, $dir=null, $props=null) |
|
| 1406 | + public static function ajax_action($action, $selected, $dir = null, $props = null) |
|
| 1409 | 1407 | { |
| 1410 | 1408 | // do we have root rights, need to run here too, as method is static and therefore does NOT run __construct |
| 1411 | 1409 | if (Api\Cache::getSession('filemanager', 'is_root')) |
@@ -1424,15 +1422,15 @@ discard block |
||
| 1424 | 1422 | |
| 1425 | 1423 | if (!isset($dir)) $dir = array_pop($selected); |
| 1426 | 1424 | |
| 1427 | - switch($action) |
|
| 1425 | + switch ($action) |
|
| 1428 | 1426 | { |
| 1429 | 1427 | case 'upload': |
| 1430 | 1428 | $script_error = 0; |
| 1431 | - foreach($selected as $tmp_name => &$data) |
|
| 1429 | + foreach ($selected as $tmp_name => &$data) |
|
| 1432 | 1430 | { |
| 1433 | 1431 | $path = Vfs::concat($dir, Vfs::encodePathComponent($data['name'])); |
| 1434 | 1432 | |
| 1435 | - if(Vfs::deny_script($path)) |
|
| 1433 | + if (Vfs::deny_script($path)) |
|
| 1436 | 1434 | { |
| 1437 | 1435 | if (!isset($script_error)) |
| 1438 | 1436 | { |
@@ -1454,7 +1452,7 @@ discard block |
||
| 1454 | 1452 | { |
| 1455 | 1453 | if (is_dir($GLOBALS['egw_info']['server']['temp_dir']) && is_writable($GLOBALS['egw_info']['server']['temp_dir'])) |
| 1456 | 1454 | { |
| 1457 | - $tmp_path = $GLOBALS['egw_info']['server']['temp_dir'] . '/' . basename($tmp_name); |
|
| 1455 | + $tmp_path = $GLOBALS['egw_info']['server']['temp_dir'].'/'.basename($tmp_name); |
|
| 1458 | 1456 | } |
| 1459 | 1457 | else |
| 1460 | 1458 | { |
@@ -1486,7 +1484,7 @@ discard block |
||
| 1486 | 1484 | break; |
| 1487 | 1485 | |
| 1488 | 1486 | case 'sharelink': |
| 1489 | - $share = Vfs\Sharing::create($selected, Vfs\Sharing::READONLY, basename($selected), array() ); |
|
| 1487 | + $share = Vfs\Sharing::create($selected, Vfs\Sharing::READONLY, basename($selected), array()); |
|
| 1490 | 1488 | $arr["share_link"] = $link = Vfs\Sharing::share2link($share); |
| 1491 | 1489 | $arr["template"] = Api\Etemplate\Widget\Template::rel2url('/filemanager/templates/default/share_dialog.xet'); |
| 1492 | 1490 | break; |
@@ -1495,16 +1493,16 @@ discard block |
||
| 1495 | 1493 | case 'link': |
| 1496 | 1494 | // First upload |
| 1497 | 1495 | $arr = static::ajax_action('upload', $selected, $dir, $props); |
| 1498 | - $app_dir = Link::vfs_path($props['entry']['app'],$props['entry']['id'],'',true); |
|
| 1496 | + $app_dir = Link::vfs_path($props['entry']['app'], $props['entry']['id'], '', true); |
|
| 1499 | 1497 | |
| 1500 | - foreach($arr['uploaded'] as $file) |
|
| 1498 | + foreach ($arr['uploaded'] as $file) |
|
| 1501 | 1499 | { |
| 1502 | - $target=Vfs::concat($dir,Vfs::encodePathComponent($file['name'])); |
|
| 1500 | + $target = Vfs::concat($dir, Vfs::encodePathComponent($file['name'])); |
|
| 1503 | 1501 | if (Vfs::file_exists($target) && $app_dir) |
| 1504 | 1502 | { |
| 1505 | 1503 | if (!Vfs::file_exists($app_dir)) Vfs::mkdir($app_dir); |
| 1506 | 1504 | error_log("Symlinking $target to $app_dir"); |
| 1507 | - Vfs::symlink($target, Vfs::concat($app_dir,Vfs::encodePathComponent($file['name']))); |
|
| 1505 | + Vfs::symlink($target, Vfs::concat($app_dir, Vfs::encodePathComponent($file['name']))); |
|
| 1508 | 1506 | } |
| 1509 | 1507 | } |
| 1510 | 1508 | // Must return to avoid adding to $response again |
@@ -1526,7 +1524,7 @@ discard block |
||
| 1526 | 1524 | */ |
| 1527 | 1525 | private function perms2mode(array $perms) |
| 1528 | 1526 | { |
| 1529 | - $mode = $perms['owner'] << 6 | $perms['group'] << 3 | $perms['other']; |
|
| 1527 | + $mode = $perms['owner'] << 6|$perms['group'] << 3|$perms['other']; |
|
| 1530 | 1528 | if ($mode['executable']) |
| 1531 | 1529 | { |
| 1532 | 1530 | $mode |= 0111; |