@@ -16,9 +16,9 @@ discard block |
||
| 16 | 16 | use EGroupware\Api; |
| 17 | 17 | use EGroupware\Api\Vfs; |
| 18 | 18 | |
| 19 | -chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
| 19 | +chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
| 20 | 20 | |
| 21 | -error_reporting(error_reporting() & ~E_NOTICE & ~E_DEPRECATED); |
|
| 21 | +error_reporting(error_reporting()&~E_NOTICE&~E_DEPRECATED); |
|
| 22 | 22 | |
| 23 | 23 | if (php_sapi_name() !== 'cli') // security precaution: forbit calling filemanager/cli.php as web-page |
| 24 | 24 | { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @param string $error_msg ='' error-message to be printed in front of usage |
| 49 | 49 | */ |
| 50 | -function usage($error_msg='') |
|
| 50 | +function usage($error_msg = '') |
|
| 51 | 51 | { |
| 52 | 52 | if ($error_msg) |
| 53 | 53 | { |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | $long = $numeric = $recursive = $perms = $all = $inode = false; |
| 83 | 83 | $args = $_SERVER['argv']; |
| 84 | -$cmd = basename(array_shift($args),'.php'); |
|
| 85 | -if ($args[0][0] != '-' && $args[0][0] != '/' && strpos($args[0],'://') === false) |
|
| 84 | +$cmd = basename(array_shift($args), '.php'); |
|
| 85 | +if ($args[0][0] != '-' && $args[0][0] != '/' && strpos($args[0], '://') === false) |
|
| 86 | 86 | { |
| 87 | 87 | $cmd = array_shift($args); |
| 88 | 88 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | if (!$args) $args = array('-h'); |
| 91 | 91 | |
| 92 | 92 | $argv = $find_options = array(); |
| 93 | -while(!is_null($option = array_shift($args))) |
|
| 93 | +while (!is_null($option = array_shift($args))) |
|
| 94 | 94 | { |
| 95 | 95 | if ($option == '-' || $option[0] != '-') // no option --> argument |
| 96 | 96 | { |
@@ -98,34 +98,34 @@ discard block |
||
| 98 | 98 | continue; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - switch($option) |
|
| 101 | + switch ($option) |
|
| 102 | 102 | { |
| 103 | 103 | default: |
| 104 | 104 | if ($cmd == 'find') |
| 105 | 105 | { |
| 106 | - if (!in_array($option,array('-type','-depth','-mindepth','-maxdepth','-name','-path', |
|
| 107 | - '-uid','-user','-nouser','-gid','-group','-nogroup','-mime', |
|
| 108 | - '-empty','-size','-cmin','-ctime','-mmin','-mtime','-limit','-order','-sort', |
|
| 109 | - '-hidden','-show-deleted','-name-preg','-path','-path-preg'))) |
|
| 106 | + if (!in_array($option, array('-type', '-depth', '-mindepth', '-maxdepth', '-name', '-path', |
|
| 107 | + '-uid', '-user', '-nouser', '-gid', '-group', '-nogroup', '-mime', |
|
| 108 | + '-empty', '-size', '-cmin', '-ctime', '-mmin', '-mtime', '-limit', '-order', '-sort', |
|
| 109 | + '-hidden', '-show-deleted', '-name-preg', '-path', '-path-preg'))) |
|
| 110 | 110 | { |
| 111 | 111 | usage("Unknown find option '$option'!"); |
| 112 | 112 | } |
| 113 | - if (in_array($option,array('-empty','-depth','-nouser','-nogroup','-hidden','-show-deleted'))) |
|
| 113 | + if (in_array($option, array('-empty', '-depth', '-nouser', '-nogroup', '-hidden', '-show-deleted'))) |
|
| 114 | 114 | { |
| 115 | - $find_options[substr($option,1)] = true; |
|
| 115 | + $find_options[substr($option, 1)] = true; |
|
| 116 | 116 | } |
| 117 | 117 | else |
| 118 | 118 | { |
| 119 | - $find_options[str_replace('-','_',substr($option,1))] = array_shift($args); |
|
| 119 | + $find_options[str_replace('-', '_', substr($option, 1))] = array_shift($args); |
|
| 120 | 120 | } |
| 121 | 121 | break; |
| 122 | 122 | } |
| 123 | 123 | // multiple options, eg. -rp --> -r -p |
| 124 | - elseif($option[0] == '-' && $option[1] != '-' && strlen($option) > 2) |
|
| 124 | + elseif ($option[0] == '-' && $option[1] != '-' && strlen($option) > 2) |
|
| 125 | 125 | { |
| 126 | - for($i = 1; $i < strlen($option); ++$i) |
|
| 126 | + for ($i = 1; $i < strlen($option); ++$i) |
|
| 127 | 127 | { |
| 128 | - array_unshift($args,'-'.$option[$i]); |
|
| 128 | + array_unshift($args, '-'.$option[$i]); |
|
| 129 | 129 | } |
| 130 | 130 | break; |
| 131 | 131 | } |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | if ($user && $passwd) |
| 183 | 183 | { |
| 184 | - load_egw($user,$passwd,$domain ? $domain : 'default'); |
|
| 184 | + load_egw($user, $passwd, $domain ? $domain : 'default'); |
|
| 185 | 185 | } |
| 186 | 186 | $argc = count($argv); |
| 187 | 187 | |
| 188 | -switch($cmd) |
|
| 188 | +switch ($cmd) |
|
| 189 | 189 | { |
| 190 | 190 | case 'umount': |
| 191 | 191 | if ($argc != 1 && !$all) |
@@ -193,13 +193,13 @@ discard block |
||
| 193 | 193 | usage('Wrong number of parameters!'); |
| 194 | 194 | } |
| 195 | 195 | if (($url = $argv[0])) load_wrapper($url); |
| 196 | - if(!Vfs::$is_root) |
|
| 196 | + if (!Vfs::$is_root) |
|
| 197 | 197 | { |
| 198 | 198 | die("You need to be root to do that!\n"); |
| 199 | 199 | } |
| 200 | 200 | if ($all) |
| 201 | 201 | { |
| 202 | - Api\Config::save_value('vfs_fstab',$GLOBALS['egw_info']['server']['vfs_fstab']='','phpgwapi'); |
|
| 202 | + Api\Config::save_value('vfs_fstab', $GLOBALS['egw_info']['server']['vfs_fstab'] = '', 'phpgwapi'); |
|
| 203 | 203 | echo "Restored default mounts:\n"; |
| 204 | 204 | } |
| 205 | 205 | elseif (!Vfs::umount($url)) |
@@ -216,16 +216,16 @@ discard block |
||
| 216 | 216 | { |
| 217 | 217 | usage('Wrong number of parameters!'); |
| 218 | 218 | } |
| 219 | - load_wrapper($url=$argv[0]); |
|
| 219 | + load_wrapper($url = $argv[0]); |
|
| 220 | 220 | |
| 221 | - if($argc > 1 && !Vfs::$is_root) |
|
| 221 | + if ($argc > 1 && !Vfs::$is_root) |
|
| 222 | 222 | { |
| 223 | 223 | die("You need to be root to do that!\n"); |
| 224 | 224 | } |
| 225 | - $fstab = Vfs::mount($url,$path=$argv[1]); |
|
| 225 | + $fstab = Vfs::mount($url, $path = $argv[1]); |
|
| 226 | 226 | if (is_array($fstab)) |
| 227 | 227 | { |
| 228 | - foreach($fstab as $path => $url) |
|
| 228 | + foreach ($fstab as $path => $url) |
|
| 229 | 229 | { |
| 230 | 230 | echo "$url\t$path\n"; |
| 231 | 231 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | break; |
| 246 | 246 | |
| 247 | 247 | case 'find': |
| 248 | - do_find($argv,$find_options); |
|
| 248 | + do_find($argv, $find_options); |
|
| 249 | 249 | break; |
| 250 | 250 | |
| 251 | 251 | case 'lntree': |
@@ -253,14 +253,14 @@ discard block |
||
| 253 | 253 | break; |
| 254 | 254 | |
| 255 | 255 | case 'cp': |
| 256 | - do_cp($argv,$recursive,$perms); |
|
| 256 | + do_cp($argv, $recursive, $perms); |
|
| 257 | 257 | break; |
| 258 | 258 | |
| 259 | 259 | case 'rename': |
| 260 | 260 | if (count($argv) != 2) usage('Wrong number of parameters!'); |
| 261 | 261 | load_wrapper($argv[0]); |
| 262 | 262 | load_wrapper($argv[1]); |
| 263 | - rename($argv[0],$argv[1]); |
|
| 263 | + rename($argv[0], $argv[1]); |
|
| 264 | 264 | break; |
| 265 | 265 | |
| 266 | 266 | case 'migrate-db2fs': |
@@ -268,21 +268,21 @@ discard block |
||
| 268 | 268 | { |
| 269 | 269 | die("\nYou need to be root to do that!\n\n"); |
| 270 | 270 | } |
| 271 | - if (!is_writable($GLOBALS['egw_info']['server']['files_dir'])) exit; // we need write access, error msg already given |
|
| 271 | + if (!is_writable($GLOBALS['egw_info']['server']['files_dir'])) exit; // we need write access, error msg already given |
|
| 272 | 272 | $fstab = Vfs::mount(); |
| 273 | - if (!is_array($fstab) || !isset($fstab['/']) || strpos($fstab['/'],'storage=db') === false) |
|
| 273 | + if (!is_array($fstab) || !isset($fstab['/']) || strpos($fstab['/'], 'storage=db') === false) |
|
| 274 | 274 | { |
| 275 | - foreach($fstab as $path => $url) |
|
| 275 | + foreach ($fstab as $path => $url) |
|
| 276 | 276 | { |
| 277 | 277 | echo "$url\t$path\n"; |
| 278 | 278 | } |
| 279 | 279 | die("\n/ NOT mounted with 'storage=db' --> no need to convert!\n\n"); |
| 280 | 280 | } |
| 281 | - $num_files = Vfs\Sqlfs\Utils::migrate_db2fs(); // throws exception on error |
|
| 281 | + $num_files = Vfs\Sqlfs\Utils::migrate_db2fs(); // throws exception on error |
|
| 282 | 282 | echo "\n$num_files files migrated from DB to filesystem.\n"; |
| 283 | - $new_url = preg_replace('/storage=db&?/','',$fstab['/']); |
|
| 284 | - if (substr($new_url,-1) == '?') $new_url = substr($new_url,0,-1); |
|
| 285 | - if (Vfs::mount($new_url,'/')) |
|
| 283 | + $new_url = preg_replace('/storage=db&?/', '', $fstab['/']); |
|
| 284 | + if (substr($new_url, -1) == '?') $new_url = substr($new_url, 0, -1); |
|
| 285 | + if (Vfs::mount($new_url, '/')) |
|
| 286 | 286 | { |
| 287 | 287 | echo "/ successful re-mounted on $new_url\n"; |
| 288 | 288 | } |
@@ -293,24 +293,24 @@ discard block |
||
| 293 | 293 | break; |
| 294 | 294 | |
| 295 | 295 | default: |
| 296 | - while($argv) |
|
| 296 | + while ($argv) |
|
| 297 | 297 | { |
| 298 | 298 | $url = array_shift($argv); |
| 299 | 299 | |
| 300 | 300 | load_wrapper($url); |
| 301 | 301 | echo "$cmd $url (long=".(int)$long.", numeric=".(int)$numeric.", recursive=".(int)$recursive.")\n"; |
| 302 | 302 | |
| 303 | - switch($cmd) |
|
| 303 | + switch ($cmd) |
|
| 304 | 304 | { |
| 305 | 305 | case 'rm': |
| 306 | 306 | if ($recursive) |
| 307 | 307 | { |
| 308 | 308 | if (!class_exists('EGroupware\\Api\\Vfs')) |
| 309 | 309 | { |
| 310 | - die("rm -r only implemented for eGW streams!"); // dont want to repeat the code here |
|
| 310 | + die("rm -r only implemented for eGW streams!"); // dont want to repeat the code here |
|
| 311 | 311 | } |
| 312 | - array_unshift($argv,$url); |
|
| 313 | - Vfs::remove($argv,true); |
|
| 312 | + array_unshift($argv, $url); |
|
| 313 | + Vfs::remove($argv, true); |
|
| 314 | 314 | $argv = array(); |
| 315 | 315 | } |
| 316 | 316 | else |
@@ -324,27 +324,27 @@ discard block |
||
| 324 | 324 | break; |
| 325 | 325 | |
| 326 | 326 | case 'mkdir': |
| 327 | - if (!mkdir($url,null,$recursive)) echo "Can't create directory, permission denied!\n"; |
|
| 327 | + if (!mkdir($url, null, $recursive)) echo "Can't create directory, permission denied!\n"; |
|
| 328 | 328 | break; |
| 329 | 329 | |
| 330 | 330 | case 'touch': |
| 331 | 331 | case 'chmod': |
| 332 | 332 | case 'chown': |
| 333 | 333 | case 'chgrp': |
| 334 | - switch($cmd) |
|
| 334 | + switch ($cmd) |
|
| 335 | 335 | { |
| 336 | 336 | case 'touch': |
| 337 | - $params = array($url,$time); |
|
| 337 | + $params = array($url, $time); |
|
| 338 | 338 | break; |
| 339 | 339 | case 'chmod': |
| 340 | 340 | if (!isset($mode)) |
| 341 | 341 | { |
| 342 | - $mode = $url; // first param is mode |
|
| 342 | + $mode = $url; // first param is mode |
|
| 343 | 343 | $url = array_shift($argv); |
| 344 | 344 | } |
| 345 | - if (Vfs::parse_url($url,PHP_URL_SCHEME)) load_wrapper($url); // cant use stat or Vfs::mode2int otherwise! |
|
| 345 | + if (Vfs::parse_url($url, PHP_URL_SCHEME)) load_wrapper($url); // cant use stat or Vfs::mode2int otherwise! |
|
| 346 | 346 | |
| 347 | - if (strpos($mode,'+') !== false || strpos($mode,'-') !== false) |
|
| 347 | + if (strpos($mode, '+') !== false || strpos($mode, '-') !== false) |
|
| 348 | 348 | { |
| 349 | 349 | $stat = stat($url); |
| 350 | 350 | $set = $stat['mode']; |
@@ -355,19 +355,19 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | if (!class_exists('EGroupware\\Api\\Vfs')) |
| 357 | 357 | { |
| 358 | - die("chmod only implemented for eGW streams!"); // dont want to repeat the code here |
|
| 358 | + die("chmod only implemented for eGW streams!"); // dont want to repeat the code here |
|
| 359 | 359 | } |
| 360 | - $set = Vfs::mode2int($mode,$set); |
|
| 361 | - $params = array($url,$set); |
|
| 360 | + $set = Vfs::mode2int($mode, $set); |
|
| 361 | + $params = array($url, $set); |
|
| 362 | 362 | break; |
| 363 | 363 | case 'chown': |
| 364 | 364 | case 'chgrp': |
| 365 | 365 | $type = $cmd == 'chgrp' ? 'group' : 'user'; |
| 366 | 366 | if (!isset($owner)) |
| 367 | 367 | { |
| 368 | - $owner = $url; // first param is owner/group |
|
| 368 | + $owner = $url; // first param is owner/group |
|
| 369 | 369 | $url = array_shift($argv); |
| 370 | - if (Vfs::parse_url($url,PHP_URL_SCHEME)) load_wrapper($url); // we need the header loaded |
|
| 370 | + if (Vfs::parse_url($url, PHP_URL_SCHEME)) load_wrapper($url); // we need the header loaded |
|
| 371 | 371 | if ($owner == 'root') |
| 372 | 372 | { |
| 373 | 373 | $owner = 0; |
@@ -378,34 +378,34 @@ discard block |
||
| 378 | 378 | { |
| 379 | 379 | die("only numeric user/group-id's allowed for non eGW streams!"); |
| 380 | 380 | } |
| 381 | - if (!($owner = $GLOBALS['egw']->accounts->name2id($owner_was=$owner,'account_lid',$type[0])) || |
|
| 381 | + if (!($owner = $GLOBALS['egw']->accounts->name2id($owner_was = $owner, 'account_lid', $type[0])) || |
|
| 382 | 382 | ($owner < 0) != ($cmd == 'chgrp')) |
| 383 | 383 | { |
| 384 | 384 | die("Unknown $type '$owner_was'!"); |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | - elseif($owner && is_object($GLOBALS['egw']) && (!$GLOBALS['egw']->accounts->id2name($owner) || |
|
| 387 | + elseif ($owner && is_object($GLOBALS['egw']) && (!$GLOBALS['egw']->accounts->id2name($owner) || |
|
| 388 | 388 | ($owner < 0) != ($cmd == 'chgrp'))) |
| 389 | 389 | { |
| 390 | 390 | die("Unknown $type '$owner_was'!"); |
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | - $params = array($url,$owner); |
|
| 393 | + $params = array($url, $owner); |
|
| 394 | 394 | break; |
| 395 | 395 | } |
| 396 | - if (($scheme = Vfs::parse_url($url,PHP_URL_SCHEME))) |
|
| 396 | + if (($scheme = Vfs::parse_url($url, PHP_URL_SCHEME))) |
|
| 397 | 397 | { |
| 398 | 398 | load_wrapper($url); |
| 399 | 399 | } |
| 400 | 400 | if ($recursive && class_exists('EGroupware\\Api\\Vfs')) |
| 401 | 401 | { |
| 402 | - array_unshift($argv,$url); |
|
| 403 | - $params = array($argv,null,$cmd,$params[1]); |
|
| 404 | - $cmd = array('EGroupware\\Api\\Vfs','find'); |
|
| 405 | - $argv = array(); // we processed all url's |
|
| 402 | + array_unshift($argv, $url); |
|
| 403 | + $params = array($argv, null, $cmd, $params[1]); |
|
| 404 | + $cmd = array('EGroupware\\Api\\Vfs', 'find'); |
|
| 405 | + $argv = array(); // we processed all url's |
|
| 406 | 406 | } |
| 407 | 407 | //echo "calling cmd=".print_r($cmd,true).", params=".print_r($params,true)."\n"; |
| 408 | - call_user_func_array($cmd,$params); |
|
| 408 | + call_user_func_array($cmd, $params); |
|
| 409 | 409 | break; |
| 410 | 410 | |
| 411 | 411 | case 'cat': |
@@ -415,35 +415,35 @@ discard block |
||
| 415 | 415 | if ($cmd != 'cat' && $recursive && class_exists('EGroupware\\Api\\Vfs')) |
| 416 | 416 | { |
| 417 | 417 | load_wrapper($url); |
| 418 | - array_unshift($argv,$url); |
|
| 419 | - Vfs::find($argv,array('url'=>true,),'do_stat',array($long,$numeric,true,$inode)); |
|
| 418 | + array_unshift($argv, $url); |
|
| 419 | + Vfs::find($argv, array('url'=>true,), 'do_stat', array($long, $numeric, true, $inode)); |
|
| 420 | 420 | $argv = array(); |
| 421 | 421 | } |
| 422 | 422 | elseif (is_dir($url) && ($dir = opendir($url))) |
| 423 | 423 | { |
| 424 | 424 | if ($argc) |
| 425 | 425 | { |
| 426 | - if (!($name = basename(Vfs::parse_url($url,PHP_URL_PATH)))) $name = '/'; |
|
| 426 | + if (!($name = basename(Vfs::parse_url($url, PHP_URL_PATH)))) $name = '/'; |
|
| 427 | 427 | echo "\n$name:\n"; |
| 428 | 428 | } |
| 429 | 429 | // separate evtl. query part, to re-add it after the file-name |
| 430 | 430 | unset($query); |
| 431 | - list($url,$query) = explode('?',$url,2); |
|
| 431 | + list($url, $query) = explode('?', $url, 2); |
|
| 432 | 432 | if ($query) $query = '?'.$query; |
| 433 | 433 | |
| 434 | - if (substr($url,-1) == '/') |
|
| 434 | + if (substr($url, -1) == '/') |
|
| 435 | 435 | { |
| 436 | - $url = substr($url,0,-1); |
|
| 436 | + $url = substr($url, 0, -1); |
|
| 437 | 437 | } |
| 438 | - while(($file = readdir($dir)) !== false) |
|
| 438 | + while (($file = readdir($dir)) !== false) |
|
| 439 | 439 | { |
| 440 | - do_stat($url.'/'.$file.$query,$long,$numeric,false,$inode); |
|
| 440 | + do_stat($url.'/'.$file.$query, $long, $numeric, false, $inode); |
|
| 441 | 441 | } |
| 442 | 442 | closedir($dir); |
| 443 | 443 | } |
| 444 | 444 | elseif ($cmd == 'cat') |
| 445 | 445 | { |
| 446 | - if (!($f = fopen($url,'r'))) |
|
| 446 | + if (!($f = fopen($url, 'r'))) |
|
| 447 | 447 | { |
| 448 | 448 | echo "File $url not found !!!\n\n"; |
| 449 | 449 | } |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | { |
| 452 | 452 | if ($argc) |
| 453 | 453 | { |
| 454 | - echo "\n".basename(Vfs::parse_url($url,PHP_URL_PATH)).":\n"; |
|
| 454 | + echo "\n".basename(Vfs::parse_url($url, PHP_URL_PATH)).":\n"; |
|
| 455 | 455 | } |
| 456 | 456 | fpassthru($f); |
| 457 | 457 | fclose($f); |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | } |
| 460 | 460 | else |
| 461 | 461 | { |
| 462 | - do_stat($url,$long,$numeric,false,$inode); |
|
| 462 | + do_stat($url, $long, $numeric, false, $inode); |
|
| 463 | 463 | } |
| 464 | 464 | if (!$long && $cmd == 'ls') echo "\n"; |
| 465 | 465 | break; |
@@ -474,10 +474,10 @@ discard block |
||
| 474 | 474 | */ |
| 475 | 475 | function load_wrapper($url) |
| 476 | 476 | { |
| 477 | - if (($scheme = parse_url($url,PHP_URL_SCHEME)) && |
|
| 477 | + if (($scheme = parse_url($url, PHP_URL_SCHEME)) && |
|
| 478 | 478 | !in_array($scheme, stream_get_wrappers())) |
| 479 | 479 | { |
| 480 | - switch($scheme) |
|
| 480 | + switch ($scheme) |
|
| 481 | 481 | { |
| 482 | 482 | case 'webdav': |
| 483 | 483 | case 'webdavs': |
@@ -485,10 +485,10 @@ discard block |
||
| 485 | 485 | break; |
| 486 | 486 | |
| 487 | 487 | default: |
| 488 | - if (!isset($GLOBALS['egw']) && !in_array($scheme,array('smb','imap')) && |
|
| 489 | - ($user = parse_url($url,PHP_URL_USER)) && ($pass = parse_url($url,PHP_URL_PASS))) |
|
| 488 | + if (!isset($GLOBALS['egw']) && !in_array($scheme, array('smb', 'imap')) && |
|
| 489 | + ($user = parse_url($url, PHP_URL_USER)) && ($pass = parse_url($url, PHP_URL_PASS))) |
|
| 490 | 490 | { |
| 491 | - load_egw($user, $pass, ($host = parse_url($url,PHP_URL_HOST)) ? $host : 'default'); |
|
| 491 | + load_egw($user, $pass, ($host = parse_url($url, PHP_URL_HOST)) ? $host : 'default'); |
|
| 492 | 492 | } |
| 493 | 493 | // get eGW's __autoload() function |
| 494 | 494 | include_once(EGW_SERVER_ROOT.'/api/src/loader/common.php'); |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | * @param string $passwd |
| 510 | 510 | * @param string $domain |
| 511 | 511 | */ |
| 512 | -function load_egw($user,$passwd,$domain='default') |
|
| 512 | +function load_egw($user, $passwd, $domain = 'default') |
|
| 513 | 513 | { |
| 514 | 514 | //echo "load_egw($user,$passwd,$domain)\n"; |
| 515 | 515 | $_REQUEST['domain'] = $domain; |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | |
| 522 | 522 | if (ini_get('session.save_handler') == 'files' && !is_writable(ini_get('session.save_path')) && is_dir('/tmp') && is_writable('/tmp')) |
| 523 | 523 | { |
| 524 | - ini_set('session.save_path','/tmp'); // regular users may have no rights to apache's session dir |
|
| 524 | + ini_set('session.save_path', '/tmp'); // regular users may have no rights to apache's session dir |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | $GLOBALS['egw_info'] = array( |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | ) |
| 534 | 534 | ); |
| 535 | 535 | |
| 536 | - if (substr($user,0,5) != 'root_') |
|
| 536 | + if (substr($user, 0, 5) != 'root_') |
|
| 537 | 537 | { |
| 538 | 538 | include('../header.inc.php'); |
| 539 | 539 | } |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | $cmd = $GLOBALS['cmd']; |
| 562 | - if (!in_array($cmd,array('ls','find','mount','umount','eacl')) && $GLOBALS['egw_info']['server']['files_dir'] && !is_writable($GLOBALS['egw_info']['server']['files_dir'])) |
|
| 562 | + if (!in_array($cmd, array('ls', 'find', 'mount', 'umount', 'eacl')) && $GLOBALS['egw_info']['server']['files_dir'] && !is_writable($GLOBALS['egw_info']['server']['files_dir'])) |
|
| 563 | 563 | { |
| 564 | 564 | echo "\nError: eGroupWare's files directory {$GLOBALS['egw_info']['server']['files_dir']} is NOT writable by the user running ".basename(__FILE__)."!\n". |
| 565 | 565 | "--> Please run it as the same user the webserver uses or root, otherwise the $cmd command will fail!\n\n"; |
@@ -590,22 +590,22 @@ discard block |
||
| 590 | 590 | } |
| 591 | 591 | if ($argc == 1) |
| 592 | 592 | { |
| 593 | - foreach(Vfs::get_eacl($url) as $acl) |
|
| 593 | + foreach (Vfs::get_eacl($url) as $acl) |
|
| 594 | 594 | { |
| 595 | - $mode = ($acl['rights'] & Vfs::READABLE ? 'r' : '-'). |
|
| 596 | - ($acl['rights'] & Vfs::WRITABLE ? 'w' : '-'). |
|
| 597 | - ($acl['rights'] & Vfs::EXECUTABLE ? 'x' : '-'); |
|
| 595 | + $mode = ($acl['rights']&Vfs::READABLE ? 'r' : '-'). |
|
| 596 | + ($acl['rights']&Vfs::WRITABLE ? 'w' : '-'). |
|
| 597 | + ($acl['rights']&Vfs::EXECUTABLE ? 'x' : '-'); |
|
| 598 | 598 | echo $acl['path']."\t$mode\t".$GLOBALS['egw']->accounts->id2name($acl['owner'])."\n"; |
| 599 | 599 | } |
| 600 | 600 | return; |
| 601 | 601 | } |
| 602 | 602 | if ($argc > 1 && !is_numeric($argv[1])) |
| 603 | 603 | { |
| 604 | - $mode=$argv[1]; |
|
| 604 | + $mode = $argv[1]; |
|
| 605 | 605 | $argv[1] = null; |
| 606 | - for($i = 0; $mode[$i]; ++$i) |
|
| 606 | + for ($i = 0; $mode[$i]; ++$i) |
|
| 607 | 607 | { |
| 608 | - switch($mode[$i]) |
|
| 608 | + switch ($mode[$i]) |
|
| 609 | 609 | { |
| 610 | 610 | case 'x': $argv[1] |= Vfs::EXECUTABLE; break; |
| 611 | 611 | case 'w': $argv[1] |= Vfs::WRITABLE; break; |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | } |
| 615 | 615 | } |
| 616 | - if (!Vfs::eacl($url,$argv[1],$argc > 2 && !is_numeric($argv[2]) ? $GLOBALS['egw']->accounts->name2id($argv[2]) : $argv[2])) |
|
| 616 | + if (!Vfs::eacl($url, $argv[1], $argc > 2 && !is_numeric($argv[2]) ? $GLOBALS['egw']->accounts->name2id($argv[2]) : $argv[2])) |
|
| 617 | 617 | { |
| 618 | 618 | echo "Error setting extended Acl for $argv[0]!\n"; |
| 619 | 619 | } |
@@ -628,10 +628,10 @@ discard block |
||
| 628 | 628 | * @param boolean $full_path =false true=give full path instead of just filename |
| 629 | 629 | * @param boolean $inode =false true=display inode (sqlfs id) |
| 630 | 630 | */ |
| 631 | -function do_stat($url,$long=false,$numeric=false,$full_path=false,$inode=false) |
|
| 631 | +function do_stat($url, $long = false, $numeric = false, $full_path = false, $inode = false) |
|
| 632 | 632 | { |
| 633 | 633 | //echo "do_stat($url,$long,$numeric,$full_path)\n"; |
| 634 | - $bname = Vfs::parse_url($url,PHP_URL_PATH); |
|
| 634 | + $bname = Vfs::parse_url($url, PHP_URL_PATH); |
|
| 635 | 635 | |
| 636 | 636 | if (!$full_path) |
| 637 | 637 | { |
@@ -662,25 +662,23 @@ discard block |
||
| 662 | 662 | { |
| 663 | 663 | if ($stat['uid']) |
| 664 | 664 | { |
| 665 | - $uid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name($stat['uid']) : |
|
| 666 | - (function_exists('posix_getpwuid') ? posix_getpwuid($stat['uid']) : $stat['uid']); |
|
| 665 | + $uid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name($stat['uid']) : (function_exists('posix_getpwuid') ? posix_getpwuid($stat['uid']) : $stat['uid']); |
|
| 667 | 666 | if (is_array($uid)) $uid = $uid['name']; |
| 668 | 667 | if (empty($uid)) $uid = $stat['uid']; |
| 669 | 668 | } |
| 670 | 669 | if (!isset($uid)) $uid = 'root'; |
| 671 | 670 | if ($stat['gid']) |
| 672 | 671 | { |
| 673 | - $gid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name(-abs($stat['gid'])) : |
|
| 674 | - (function_exists('posix_getgrgid') ? posix_getgrgid($stat['gid']) : $stat['gid']); |
|
| 672 | + $gid = isset($GLOBALS['egw']) ? $GLOBALS['egw']->accounts->id2name(-abs($stat['gid'])) : (function_exists('posix_getgrgid') ? posix_getgrgid($stat['gid']) : $stat['gid']); |
|
| 675 | 673 | if (is_array($gid)) $gid = $gid['name']; |
| 676 | 674 | if (empty($gid)) $gid = $stat['gid']; |
| 677 | 675 | } |
| 678 | 676 | if (!isset($gid)) $gid = 'root'; |
| 679 | 677 | } |
| 680 | 678 | $size = hsize($stat['size']); |
| 681 | - $mtime = date('Y-m-d H:i:s',$stat['mtime']); |
|
| 679 | + $mtime = date('Y-m-d H:i:s', $stat['mtime']); |
|
| 682 | 680 | $nlink = $stat['nlink']; |
| 683 | - if (($stat['mode'] & 0xA000) == 0xA000) |
|
| 681 | + if (($stat['mode']&0xA000) == 0xA000) |
|
| 684 | 682 | { |
| 685 | 683 | $symlink = " -> ".(class_exists('EGroupware\\Api\\Vfs') ? Vfs::readlink($url) : readlink($url)); |
| 686 | 684 | } |
@@ -699,12 +697,12 @@ discard block |
||
| 699 | 697 | function hsize($size) |
| 700 | 698 | { |
| 701 | 699 | if ($size < 1024) return $size; |
| 702 | - if ($size < 1024*1024) return sprintf('%3.1lfk',(float)$size/1024); |
|
| 703 | - return sprintf('%3.1lfM',(float)$size/(1024*1024)); |
|
| 700 | + if ($size < 1024 * 1024) return sprintf('%3.1lfk', (float)$size / 1024); |
|
| 701 | + return sprintf('%3.1lfM', (float)$size / (1024 * 1024)); |
|
| 704 | 702 | } |
| 705 | 703 | |
| 706 | 704 | |
| 707 | -function do_cp($argv,$recursive=false,$perms=false) |
|
| 705 | +function do_cp($argv, $recursive = false, $perms = false) |
|
| 708 | 706 | { |
| 709 | 707 | $to = array_pop($argv); |
| 710 | 708 | load_wrapper($to); |
@@ -716,13 +714,13 @@ discard block |
||
| 716 | 714 | usage("No such directory '$to'!"); |
| 717 | 715 | } |
| 718 | 716 | $anz_dirs = $anz_files = 0; |
| 719 | - foreach($argv as $from) |
|
| 717 | + foreach ($argv as $from) |
|
| 720 | 718 | { |
| 721 | 719 | if (is_dir($from) && (!file_exists($to) || is_dir($to)) && $recursive && class_exists('EGroupware\\Api\\Vfs')) |
| 722 | 720 | { |
| 723 | - foreach(Vfs::find($from,array('url' => true)) as $f) |
|
| 721 | + foreach (Vfs::find($from, array('url' => true)) as $f) |
|
| 724 | 722 | { |
| 725 | - $t = $to.substr($f,strlen($from)); |
|
| 723 | + $t = $to.substr($f, strlen($from)); |
|
| 726 | 724 | if (is_dir($f)) |
| 727 | 725 | { |
| 728 | 726 | ++$anz_dirs; |
@@ -731,43 +729,43 @@ discard block |
||
| 731 | 729 | else |
| 732 | 730 | { |
| 733 | 731 | ++$anz_files; |
| 734 | - _cp($f,$t); |
|
| 732 | + _cp($f, $t); |
|
| 735 | 733 | } |
| 736 | - if ($perms) _cp_perms($f,$t); |
|
| 734 | + if ($perms) _cp_perms($f, $t); |
|
| 737 | 735 | } |
| 738 | - echo ($anz_dirs?"$anz_dirs dir(s) created and ":'')."$anz_files file(s) copied.\n"; |
|
| 736 | + echo ($anz_dirs ? "$anz_dirs dir(s) created and " : '')."$anz_files file(s) copied.\n"; |
|
| 739 | 737 | } |
| 740 | 738 | else |
| 741 | 739 | { |
| 742 | - _cp($from,$to,true); |
|
| 743 | - if ($perms) _cp_perms($from,$to); |
|
| 740 | + _cp($from, $to, true); |
|
| 741 | + if ($perms) _cp_perms($from, $to); |
|
| 744 | 742 | } |
| 745 | 743 | } |
| 746 | 744 | } |
| 747 | 745 | |
| 748 | -function _cp($from,$to,$verbose=false) |
|
| 746 | +function _cp($from, $to, $verbose = false) |
|
| 749 | 747 | { |
| 750 | 748 | load_wrapper($from); |
| 751 | 749 | |
| 752 | 750 | if (is_dir($to)) |
| 753 | 751 | { |
| 754 | - $path = Vfs::parse_url($from,PHP_URL_PATH); |
|
| 752 | + $path = Vfs::parse_url($from, PHP_URL_PATH); |
|
| 755 | 753 | if (is_dir($to)) |
| 756 | 754 | { |
| 757 | - list($to,$query) = explode('?',$to,2); |
|
| 755 | + list($to, $query) = explode('?', $to, 2); |
|
| 758 | 756 | $to .= '/'.basename($path).($query ? '?'.$query : ''); |
| 759 | 757 | } |
| 760 | 758 | } |
| 761 | - if (!($from_fp = fopen($from,'r'))) |
|
| 759 | + if (!($from_fp = fopen($from, 'r'))) |
|
| 762 | 760 | { |
| 763 | 761 | die("File $from not found!\n"); |
| 764 | 762 | } |
| 765 | - if (!($to_fp = fopen($to,'w'))) |
|
| 763 | + if (!($to_fp = fopen($to, 'w'))) |
|
| 766 | 764 | { |
| 767 | 765 | die("Can't open $to for writing!\n"); |
| 768 | 766 | } |
| 769 | 767 | //stream_filter_append($from_fp,'convert.base64-decode'); |
| 770 | - $count = stream_copy_to_stream($from_fp,$to_fp); |
|
| 768 | + $count = stream_copy_to_stream($from_fp, $to_fp); |
|
| 771 | 769 | |
| 772 | 770 | if ($verbose) echo hsize($count)." bytes written to $to\n"; |
| 773 | 771 | |
@@ -780,11 +778,11 @@ discard block |
||
| 780 | 778 | } |
| 781 | 779 | |
| 782 | 780 | |
| 783 | -function _cp_perms($from,$to) |
|
| 781 | +function _cp_perms($from, $to) |
|
| 784 | 782 | { |
| 785 | 783 | if (($from_stat = stat($from)) && ($to_stat = stat($to))) |
| 786 | 784 | { |
| 787 | - foreach(array( |
|
| 785 | + foreach (array( |
|
| 788 | 786 | 'mode' => 'chmod', |
| 789 | 787 | 'uid' => 'chown', |
| 790 | 788 | 'gid' => 'chgrp', |
@@ -793,27 +791,27 @@ discard block |
||
| 793 | 791 | if ($from_stat[$perm] != $to_stat[$perm]) |
| 794 | 792 | { |
| 795 | 793 | //echo "Vfs::$cmd($to,{$from_stat[$perm]}\n"; |
| 796 | - call_user_func(array('EGroupware\\Api\\Vfs',$cmd),$to,$from_stat[$perm]); |
|
| 794 | + call_user_func(array('EGroupware\\Api\\Vfs', $cmd), $to, $from_stat[$perm]); |
|
| 797 | 795 | } |
| 798 | 796 | } |
| 799 | 797 | } |
| 800 | 798 | } |
| 801 | 799 | |
| 802 | -function do_find($bases,$options) |
|
| 800 | +function do_find($bases, $options) |
|
| 803 | 801 | { |
| 804 | - foreach($bases as $url) |
|
| 802 | + foreach ($bases as $url) |
|
| 805 | 803 | { |
| 806 | 804 | load_wrapper($url); |
| 807 | 805 | } |
| 808 | - $options['url'] = true; // we use url's not vfs pathes in filemanager/cli.php |
|
| 806 | + $options['url'] = true; // we use url's not vfs pathes in filemanager/cli.php |
|
| 809 | 807 | |
| 810 | - foreach(Vfs::find($bases,$options) as $path) |
|
| 808 | + foreach (Vfs::find($bases, $options) as $path) |
|
| 811 | 809 | { |
| 812 | 810 | echo "$path\n"; |
| 813 | 811 | } |
| 814 | 812 | } |
| 815 | 813 | |
| 816 | -function do_lntree($from,$to) |
|
| 814 | +function do_lntree($from, $to) |
|
| 817 | 815 | { |
| 818 | 816 | echo "lntree $from $to\n"; |
| 819 | 817 | if ($from[0] == '/') $from = 'sqlfs://default'.$from; |
@@ -876,33 +874,33 @@ discard block |
||
| 876 | 874 | * @param int $mode |
| 877 | 875 | * @return string |
| 878 | 876 | */ |
| 879 | -function int2mode( $mode ) |
|
| 877 | +function int2mode($mode) |
|
| 880 | 878 | { |
| 881 | - if(($mode & 0xA000) == 0xA000) // Symbolic Link |
|
| 879 | + if (($mode&0xA000) == 0xA000) // Symbolic Link |
|
| 882 | 880 | { |
| 883 | 881 | $sP = 'l'; |
| 884 | 882 | } |
| 885 | - elseif(($mode & 0xC000) == 0xC000) // Socket |
|
| 883 | + elseif (($mode&0xC000) == 0xC000) // Socket |
|
| 886 | 884 | { |
| 887 | 885 | $sP = 's'; |
| 888 | 886 | } |
| 889 | - elseif($mode & 0x1000) // FIFO pipe |
|
| 887 | + elseif ($mode&0x1000) // FIFO pipe |
|
| 890 | 888 | { |
| 891 | 889 | $sP = 'p'; |
| 892 | 890 | } |
| 893 | - elseif($mode & 0x2000) // Character special |
|
| 891 | + elseif ($mode&0x2000) // Character special |
|
| 894 | 892 | { |
| 895 | 893 | $sP = 'c'; |
| 896 | 894 | } |
| 897 | - elseif($mode & 0x4000) // Directory |
|
| 895 | + elseif ($mode&0x4000) // Directory |
|
| 898 | 896 | { |
| 899 | 897 | $sP = 'd'; |
| 900 | 898 | } |
| 901 | - elseif($mode & 0x6000) // Block special |
|
| 899 | + elseif ($mode&0x6000) // Block special |
|
| 902 | 900 | { |
| 903 | 901 | $sP = 'b'; |
| 904 | 902 | } |
| 905 | - elseif($mode & 0x8000) // Regular |
|
| 903 | + elseif ($mode&0x8000) // Regular |
|
| 906 | 904 | { |
| 907 | 905 | $sP = '-'; |
| 908 | 906 | } |
@@ -912,22 +910,19 @@ discard block |
||
| 912 | 910 | } |
| 913 | 911 | |
| 914 | 912 | // owner |
| 915 | - $sP .= (($mode & 0x0100) ? 'r' : '-') . |
|
| 916 | - (($mode & 0x0080) ? 'w' : '-') . |
|
| 917 | - (($mode & 0x0040) ? (($mode & 0x0800) ? 's' : 'x' ) : |
|
| 918 | - (($mode & 0x0800) ? 'S' : '-')); |
|
| 913 | + $sP .= (($mode&0x0100) ? 'r' : '-'). |
|
| 914 | + (($mode&0x0080) ? 'w' : '-'). |
|
| 915 | + (($mode&0x0040) ? (($mode&0x0800) ? 's' : 'x') : (($mode&0x0800) ? 'S' : '-')); |
|
| 919 | 916 | |
| 920 | 917 | // group |
| 921 | - $sP .= (($mode & 0x0020) ? 'r' : '-') . |
|
| 922 | - (($mode & 0x0010) ? 'w' : '-') . |
|
| 923 | - (($mode & 0x0008) ? (($mode & 0x0400) ? 's' : 'x' ) : |
|
| 924 | - (($mode & 0x0400) ? 'S' : '-')); |
|
| 918 | + $sP .= (($mode&0x0020) ? 'r' : '-'). |
|
| 919 | + (($mode&0x0010) ? 'w' : '-'). |
|
| 920 | + (($mode&0x0008) ? (($mode&0x0400) ? 's' : 'x') : (($mode&0x0400) ? 'S' : '-')); |
|
| 925 | 921 | |
| 926 | 922 | // world |
| 927 | - $sP .= (($mode & 0x0004) ? 'r' : '-') . |
|
| 928 | - (($mode & 0x0002) ? 'w' : '-') . |
|
| 929 | - (($mode & 0x0001) ? (($mode & 0x0200) ? 't' : 'x' ) : |
|
| 930 | - (($mode & 0x0200) ? 'T' : '-')); |
|
| 923 | + $sP .= (($mode&0x0004) ? 'r' : '-'). |
|
| 924 | + (($mode&0x0002) ? 'w' : '-'). |
|
| 925 | + (($mode&0x0001) ? (($mode&0x0200) ? 't' : 'x') : (($mode&0x0200) ? 'T' : '-')); |
|
| 931 | 926 | |
| 932 | 927 | return $sP; |
| 933 | 928 | } |
@@ -24,19 +24,19 @@ discard block |
||
| 24 | 24 | // Only variables should be assigned by reference, eg. soetemplate::tree_walk() |
| 25 | 25 | // Declaration of <extended method> should be compatible with <parent method>, varios places where method parameters change |
| 26 | 26 | // --> switching it off for now, as it makes error-log unusable |
| 27 | -error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); |
|
| 27 | +error_reporting(E_ALL&~E_NOTICE&~E_STRICT); |
|
| 28 | 28 | if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime()) |
| 29 | 29 | { |
| 30 | 30 | set_magic_quotes_runtime(false); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $egw_min_php_version = '5.4'; |
| 34 | -if (!function_exists('version_compare') || version_compare(PHP_VERSION,$egw_min_php_version) < 0) |
|
| 34 | +if (!function_exists('version_compare') || version_compare(PHP_VERSION, $egw_min_php_version) < 0) |
|
| 35 | 35 | { |
| 36 | 36 | die("EGroupware requires PHP $egw_min_php_version or greater.<br />Please contact your System Administrator to upgrade PHP!"); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | -if (!defined('EGW_API_INC')) define('EGW_API_INC',PHPGW_API_INC); // this is to support the header upgrade |
|
| 39 | +if (!defined('EGW_API_INC')) define('EGW_API_INC', PHPGW_API_INC); // this is to support the header upgrade |
|
| 40 | 40 | |
| 41 | 41 | /* Make sure the header.inc.php is current. */ |
| 42 | 42 | if (!isset($GLOBALS['egw_domain']) || $GLOBALS['egw_info']['server']['versions']['header'] < $GLOBALS['egw_info']['server']['versions']['current_header']) |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | $GLOBALS['egw_info']['flags']['restored_from_session'] = true; |
| 68 | 68 | |
| 69 | 69 | // restoring the egw_info-array |
| 70 | - $GLOBALS['egw_info'] = array_merge($_SESSION[Session::EGW_INFO_CACHE],array('flags' => $GLOBALS['egw_info']['flags'])); |
|
| 70 | + $GLOBALS['egw_info'] = array_merge($_SESSION[Session::EGW_INFO_CACHE], array('flags' => $GLOBALS['egw_info']['flags'])); |
|
| 71 | 71 | |
| 72 | 72 | // include required class-definitions |
| 73 | 73 | if (is_array($_SESSION[Session::EGW_REQUIRED_FILES])) // all classes, which can not be autoloaded |
| 74 | 74 | { |
| 75 | - foreach($_SESSION[Session::EGW_REQUIRED_FILES] as $file) |
|
| 75 | + foreach ($_SESSION[Session::EGW_REQUIRED_FILES] as $file) |
|
| 76 | 76 | { |
| 77 | 77 | require_once($file); |
| 78 | 78 | } |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | if (is_object($GLOBALS['egw']) && ($GLOBALS['egw'] instanceof Egw)) // only egw object has wakeup2, setups egw_minimal eg. has not! |
| 83 | 83 | { |
| 84 | - $GLOBALS['egw']->wakeup2(); // adapt the restored egw-object/enviroment to this request (eg. changed current app) |
|
| 84 | + $GLOBALS['egw']->wakeup2(); // adapt the restored egw-object/enviroment to this request (eg. changed current app) |
|
| 85 | 85 | |
| 86 | 86 | $GLOBALS['egw_info']['flags']['session_restore_time'] = microtime(true) - $GLOBALS['egw_info']['flags']['page_start_time']; |
| 87 | - if (is_object($GLOBALS['egw']->translation)) return; // exit this file, as the rest of the file creates a new egw-object and -enviroment |
|
| 87 | + if (is_object($GLOBALS['egw']->translation)) return; // exit this file, as the rest of the file creates a new egw-object and -enviroment |
|
| 88 | 88 | } |
| 89 | 89 | // egw object could NOT be restored from the session, create a new one |
| 90 | 90 | unset($GLOBALS['egw']); |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $GLOBALS['egw_info']['user']['domain'] = Session::search_instance( |
| 111 | 111 | isset($_POST['login']) ? $_POST['login'] : (isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : $_SERVER['REMOTE_USER']), |
| 112 | - Session::get_request('domain'),$GLOBALS['egw_info']['server']['default_domain'], |
|
| 113 | - array($_SERVER['HTTP_HOST'], $_SERVER['SERVER_NAME']),$GLOBALS['egw_domain']); |
|
| 112 | + Session::get_request('domain'), $GLOBALS['egw_info']['server']['default_domain'], |
|
| 113 | + array($_SERVER['HTTP_HOST'], $_SERVER['SERVER_NAME']), $GLOBALS['egw_domain']); |
|
| 114 | 114 | |
| 115 | 115 | $GLOBALS['egw_info']['server'] += $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]; |
| 116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | // store domain config user&pw as a hash (originals get unset) |
| 121 | 121 | $GLOBALS['egw_info']['server']['config_hash'] = Session::user_pw_hash($GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['config_user'], |
| 122 | - $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['config_passwd'],true); |
|
| 122 | + $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['config_passwd'], true); |
|
| 123 | 123 | |
| 124 | 124 | if ($GLOBALS['egw_info']['flags']['currentapp'] != 'login' && !$GLOBALS['egw_info']['server']['show_domain_selectbox']) |
| 125 | 125 | { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | if ($GLOBALS['egw_info']['flags']['currentapp'] != 'login') |
| 133 | 133 | { |
| 134 | 134 | $_SESSION[Session::EGW_INFO_CACHE] = $GLOBALS['egw_info']; |
| 135 | - unset($_SESSION[Session::EGW_INFO_CACHE]['flags']); // dont save the flags, they change on each request |
|
| 135 | + unset($_SESSION[Session::EGW_INFO_CACHE]['flags']); // dont save the flags, they change on each request |
|
| 136 | 136 | |
| 137 | 137 | // dont save preferences, as Session::verify restores them from instance cache anyway |
| 138 | 138 | $_SESSION[Session::EGW_INFO_CACHE]['user']['preferences'] = array( |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | function read_repository() |
| 60 | 60 | { |
| 61 | - if (!isset($GLOBALS['egw_info']['apps']) || !is_array($GLOBALS['egw_info']['apps'])) |
|
| 61 | + if (!isset($GLOBALS['egw_info']['apps']) || !is_array($GLOBALS['egw_info']['apps'])) |
|
| 62 | 62 | { |
| 63 | 63 | $this->read_installed_apps(); |
| 64 | 64 | } |
| 65 | - if(!$this->account_id) |
|
| 65 | + if (!$this->account_id) |
|
| 66 | 66 | { |
| 67 | 67 | return False; |
| 68 | 68 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $GLOBALS['egw_info']['apps'] = Api\Cache::getInstance(__CLASS__, 'apps', function() |
| 80 | 80 | { |
| 81 | 81 | $apps = array(); |
| 82 | - foreach($this->db->select($this->table_name,'*',false,__LINE__,__FILE__,false,'ORDER BY app_order ASC') as $row) |
|
| 82 | + foreach ($this->db->select($this->table_name, '*', false, __LINE__, __FILE__, false, 'ORDER BY app_order ASC') as $row) |
|
| 83 | 83 | { |
| 84 | 84 | $apps[$row['app_name']] = Array( |
| 85 | 85 | 'title' => $row['app_name'], |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | if (!empty($GLOBALS['egw_info']['user']['preferences']['common']['lang'])) |
| 101 | 101 | { |
| 102 | - foreach($GLOBALS['egw_info']['apps'] as &$app) |
|
| 102 | + foreach ($GLOBALS['egw_info']['apps'] as &$app) |
|
| 103 | 103 | { |
| 104 | 104 | $app['title'] = lang($app['title']); |
| 105 | 105 | } |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | $apps = array(); |
| 82 | 82 | foreach($this->db->select($this->table_name,'*',false,__LINE__,__FILE__,false,'ORDER BY app_order ASC') as $row) |
| 83 | 83 | { |
| 84 | - $apps[$row['app_name']] = Array( |
|
| 84 | + $apps[$row['app_name']] = array( |
|
| 85 | 85 | 'title' => $row['app_name'], |
| 86 | 86 | 'name' => $row['app_name'], |
| 87 | 87 | 'enabled' => True, |