@@ -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').')'; |
@@ -13,7 +13,10 @@ discard block |
||
| 13 | 13 | use EGroupware\Api\Framework; |
| 14 | 14 | use EGroupware\Api\Framework\Bundle; |
| 15 | 15 | |
| 16 | -if (php_sapi_name() !== 'cli') die("This is a commandline ONLY tool!\n"); |
|
| 16 | +if (php_sapi_name() !== 'cli') |
|
| 17 | +{ |
|
| 18 | + die("This is a commandline ONLY tool!\n"); |
|
| 19 | +} |
|
| 17 | 20 | |
| 18 | 21 | $GLOBALS['egw_info'] = array( |
| 19 | 22 | 'flags' => array( |
@@ -40,12 +43,19 @@ discard block |
||
| 40 | 43 | |
| 41 | 44 | foreach(Bundle::all() as $name => $files) |
| 42 | 45 | { |
| 43 | - if ($name == '.ts') continue; // ignore timestamp |
|
| 46 | + if ($name == '.ts') |
|
| 47 | + { |
|
| 48 | + continue; |
|
| 49 | + } |
|
| 50 | + // ignore timestamp |
|
| 44 | 51 | |
| 45 | 52 | // remove leading / from file-names |
| 46 | 53 | array_walk($files, function(&$path) |
| 47 | 54 | { |
| 48 | - if ($path[0] == '/') $path = substr($path, 1); |
|
| 55 | + if ($path[0] == '/') |
|
| 56 | + { |
|
| 57 | + $path = substr($path, 1); |
|
| 58 | + } |
|
| 49 | 59 | }); |
| 50 | 60 | |
| 51 | 61 | // api/js/jsapi/egw.js loaded via own tag, and we must not load it twice! |
@@ -87,11 +97,18 @@ discard block |
||
| 87 | 97 | $GLOBALS['egw_info']['server']['template_set'] = $template; |
| 88 | 98 | $tpl = Framework::factory(); |
| 89 | 99 | $themes = $tpl->list_themes(); |
| 90 | - if ($template == 'pixelegg') $themes[] = 'fw_mobile'; // this is for mobile devices |
|
| 100 | + if ($template == 'pixelegg') |
|
| 101 | + { |
|
| 102 | + $themes[] = 'fw_mobile'; |
|
| 103 | + } |
|
| 104 | + // this is for mobile devices |
|
| 91 | 105 | foreach($themes as $theme) |
| 92 | 106 | { |
| 93 | 107 | // skip not working cssmin of pixelegg/traditional: Broken @import declaration of "../../etemplate/templates/default/etemplate2.css" |
| 94 | - if ($template == 'pixelegg' && $theme == 'traditional') continue; |
|
| 108 | + if ($template == 'pixelegg' && $theme == 'traditional') |
|
| 109 | + { |
|
| 110 | + continue; |
|
| 111 | + } |
|
| 95 | 112 | $GLOBALS['egw_info']['user']['preferences']['common']['theme'] = $theme; |
| 96 | 113 | // empty include list by not-existing file plus last true |
| 97 | 114 | Framework\CssIncludes::add('*grunt*', null, true, true); |
@@ -178,15 +178,17 @@ discard block |
||
| 178 | 178 | $acl = new Acl($anon_user); |
| 179 | 179 | $acl->read_repository(); |
| 180 | 180 | foreach ($calendar_bo->resources as $type => $data) |
| 181 | - { |
|
| 181 | + { |
|
| 182 | 182 | // Check anon user's permissions - must have at least run for the hook to be available |
| 183 | 183 | if($acl->check('run',EGW_ACL_READ, $data['app']) && |
| 184 | 184 | $type != '' && $data['app'] && Link::get_registry($data['app'], 'query') |
| 185 | - ) |
|
| 186 | - { |
|
| 185 | + ) { |
|
| 187 | 186 | $_results = Link::query($data['app'], $query,$options); |
| 188 | 187 | } |
| 189 | - if(!$_results) continue; |
|
| 188 | + if(!$_results) |
|
| 189 | + { |
|
| 190 | + continue; |
|
| 191 | + } |
|
| 190 | 192 | $_results = array_unique($_results); |
| 191 | 193 | foreach ($_results as $key => $value) |
| 192 | 194 | { |
@@ -223,8 +225,14 @@ discard block |
||
| 223 | 225 | $arguments['sortby'] = 'month'; |
| 224 | 226 | $arguments['date'] = substr($arguments['date'],0,4).'0101'; |
| 225 | 227 | } |
| 226 | - if (isset($_GET['date'])) $arguments['date'] = $_GET['date']; |
|
| 227 | - if (empty($arguments['cat_id'])) $arguments['cat_id'] = ''; |
|
| 228 | + if (isset($_GET['date'])) |
|
| 229 | + { |
|
| 230 | + $arguments['date'] = $_GET['date']; |
|
| 231 | + } |
|
| 232 | + if (empty($arguments['cat_id'])) |
|
| 233 | + { |
|
| 234 | + $arguments['cat_id'] = ''; |
|
| 235 | + } |
|
| 228 | 236 | if(isset($arguments['resources']) && in_array('r0', $arguments['resources'])) |
| 229 | 237 | { |
| 230 | 238 | foreach($arguments['resources'] as $index => $value) |
@@ -259,7 +267,8 @@ discard block |
||
| 259 | 267 | if (is_array($params['owner'])) |
| 260 | 268 | { |
| 261 | 269 | // Buffer, and add anything that gets cleared to the content |
| 262 | - ob_start(function($buffer) use(&$html) { |
|
| 270 | + ob_start(function($buffer) use(&$html) |
|
| 271 | + { |
|
| 263 | 272 | $html .= $buffer; |
| 264 | 273 | return ''; |
| 265 | 274 | }); |
@@ -268,20 +277,26 @@ discard block |
||
| 268 | 277 | $ui->sortby = $arguments['sortby']; |
| 269 | 278 | $ui->owner = $params['owner']; |
| 270 | 279 | |
| 271 | - if (!$ui->planner_view || $ui->planner_view == 'month') // planner monthview |
|
| 280 | + if (!$ui->planner_view || $ui->planner_view == 'month') |
|
| 281 | + { |
|
| 282 | + // planner monthview |
|
| 272 | 283 | { |
| 273 | 284 | if ($ui->day < 15) // show one complete month |
| 274 | 285 | { |
| 275 | 286 | $ui->_week_align_month($ui->first,$ui->last); |
| 287 | + } |
|
| 276 | 288 | } |
| 277 | 289 | else // show 2 half month |
| 278 | 290 | { |
| 279 | 291 | $ui->_week_align_month($ui->first,$ui->last,15); |
| 280 | 292 | } |
| 281 | 293 | } |
| 282 | - elseif ($ui->planner_view == 'week' || $ui->planner_view == 'weekN') // weeekview |
|
| 294 | + elseif ($ui->planner_view == 'week' || $ui->planner_view == 'weekN') |
|
| 295 | + { |
|
| 296 | + // weeekview |
|
| 283 | 297 | { |
| 284 | 298 | $start = new Api\DateTime($ui->date); |
| 299 | + } |
|
| 285 | 300 | $start->setWeekstart(); |
| 286 | 301 | $ui->first = $start->format('ts'); |
| 287 | 302 | $ui->last = $ui->bo->date2array($this->first); |