@@ -79,11 +79,14 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | return true; // can only check locally |
| 81 | 81 | } |
| 82 | - if (!file_exists($this->header_path) || filesize($this->header_path) < 200) // redirect header in rpms is ~150 byte |
|
| 82 | + if (!file_exists($this->header_path) || filesize($this->header_path) < 200) |
|
| 83 | + { |
|
| 84 | + // redirect header in rpms is ~150 byte |
|
| 83 | 85 | { |
| 84 | 86 | if ($this->sub_command != 'create') |
| 85 | 87 | { |
| 86 | 88 | throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) does NOT exist.')."\n".lang('Use --create-header to create the configuration file (--usage gives more options).'),1); |
| 89 | + } |
|
| 87 | 90 | } |
| 88 | 91 | $this->defaults(false); |
| 89 | 92 | } |
@@ -104,10 +107,13 @@ discard block |
||
| 104 | 107 | $GLOBALS['egw_info']['server']['include_root'] = EGW_INCLUDE_ROOT; |
| 105 | 108 | } |
| 106 | 109 | |
| 107 | - if ($this->arguments) // we have command line arguments |
|
| 110 | + if ($this->arguments) |
|
| 111 | + { |
|
| 112 | + // we have command line arguments |
|
| 108 | 113 | { |
| 109 | 114 | $this->_parse_cli_arguments(); |
| 110 | 115 | } |
| 116 | + } |
|
| 111 | 117 | elseif ($this->sub_command == 'delete') |
| 112 | 118 | { |
| 113 | 119 | self::_delete_domain($this->domain); |
@@ -138,11 +144,14 @@ discard block |
||
| 138 | 144 | echo $header; // for cli, we echo the header |
| 139 | 145 | } |
| 140 | 146 | if (file_exists($this->header_path) && is_writable($this->header_path) || is_writable(dirname($this->header_path)) || |
| 141 | - function_exists('posix_getuid') && !posix_getuid()) // root has all rights |
|
| 147 | + function_exists('posix_getuid') && !posix_getuid()) |
|
| 148 | + { |
|
| 149 | + // root has all rights |
|
| 142 | 150 | { |
| 143 | 151 | if (file_exists($this->header_path) && !is_writable($this->header_path)) |
| 144 | 152 | { |
| 145 | 153 | unlink($this->header_path); |
| 154 | + } |
|
| 146 | 155 | } |
| 147 | 156 | if (($f = fopen($this->header_path,'wb')) && fwrite($f,$header)) |
| 148 | 157 | { |
@@ -278,11 +287,17 @@ discard block |
||
| 278 | 287 | |
| 279 | 288 | $option = self::$options[$arg]; |
| 280 | 289 | $vals = !is_array($option) ? array($values) : explode(',',$values); |
| 281 | - if (!is_array($option)) $option = array($option => $option); |
|
| 290 | + if (!is_array($option)) |
|
| 291 | + { |
|
| 292 | + $option = array($option => $option); |
|
| 293 | + } |
|
| 282 | 294 | $n = 0; |
| 283 | 295 | foreach($option as $name => $data) |
| 284 | 296 | { |
| 285 | - if ($n >= count($vals)) break; |
|
| 297 | + if ($n >= count($vals)) |
|
| 298 | + { |
|
| 299 | + break; |
|
| 300 | + } |
|
| 286 | 301 | |
| 287 | 302 | $this->_parse_value($arg,$name,$data,$vals[$n++]); |
| 288 | 303 | } |
@@ -315,7 +330,10 @@ discard block |
||
| 315 | 330 | { |
| 316 | 331 | static $domain=null; |
| 317 | 332 | |
| 318 | - if (!is_array($data)) $data = array('type' => $data); |
|
| 333 | + if (!is_array($data)) |
|
| 334 | + { |
|
| 335 | + $data = array('type' => $data); |
|
| 336 | + } |
|
| 319 | 337 | $type = $data['type']; |
| 320 | 338 | |
| 321 | 339 | if (isset($data['allowed'])) |
@@ -354,13 +372,19 @@ discard block |
||
| 354 | 372 | */ |
| 355 | 373 | static private function _set_value(&$arr,$index,$name,$value) |
| 356 | 374 | { |
| 357 | - if (substr($index,-1) == '/') $index .= $name; |
|
| 375 | + if (substr($index,-1) == '/') |
|
| 376 | + { |
|
| 377 | + $index .= $name; |
|
| 378 | + } |
|
| 358 | 379 | |
| 359 | 380 | $var =& $arr; |
| 360 | 381 | foreach(explode('/',$index) as $name) |
| 361 | 382 | { |
| 362 | 383 | $var =& $var[$name]; |
| 363 | 384 | } |
| 364 | - if (true) $var = strpos($name,'passw') !== false ? md5($value) : $value; |
|
| 385 | + if (true) |
|
| 386 | + { |
|
| 387 | + $var = strpos($name,'passw') !== false ? md5($value) : $value; |
|
| 388 | + } |
|
| 365 | 389 | } |
| 366 | 390 | } |
@@ -113,8 +113,14 @@ |
||
| 113 | 113 | self::$egw_setup->db->Link_ID->SetCharSet($this->charset); |
| 114 | 114 | $_POST['ConfigLang'] = $this->lang; |
| 115 | 115 | |
| 116 | - if ($this->verbose) echo lang('Installation started, this might take a few minutes ...')."\n"; |
|
| 117 | - if (true) $setup_info = self::$egw_setup->process->pass($setup_info,'new',false,True,$this->config); |
|
| 116 | + if ($this->verbose) |
|
| 117 | + { |
|
| 118 | + echo lang('Installation started, this might take a few minutes ...')."\n"; |
|
| 119 | + } |
|
| 120 | + if (true) |
|
| 121 | + { |
|
| 122 | + $setup_info = self::$egw_setup->process->pass($setup_info,'new',false,True,$this->config); |
|
| 123 | + } |
|
| 118 | 124 | |
| 119 | 125 | $this->restore_db(); |
| 120 | 126 | |
@@ -108,7 +108,9 @@ discard block |
||
| 108 | 108 | while($pass_string != $passing_string) |
| 109 | 109 | { |
| 110 | 110 | $passing = array(); |
| 111 | - if($DEBUG) { echo '<br>process->pass(): #' . $i . ' for ' . $method . ' processing' . "\n"; } |
|
| 111 | + if($DEBUG) |
|
| 112 | + { |
|
| 113 | +echo '<br>process->pass(): #' . $i . ' for ' . $method . ' processing' . "\n"; } |
|
| 112 | 114 | |
| 113 | 115 | // Check current versions and dependencies |
| 114 | 116 | $setup_info = $GLOBALS['egw_setup']->detection->check_depends( |
@@ -143,7 +145,10 @@ discard block |
||
| 143 | 145 | } |
| 144 | 146 | /* Create tables and insert new records for each app in this list */ |
| 145 | 147 | $passing_c = $this->current($pass,$DEBUG); |
| 146 | - if (isset($pass['api'])) $this->save_minimal_config($preset_config); |
|
| 148 | + if (isset($pass['api'])) |
|
| 149 | + { |
|
| 150 | + $this->save_minimal_config($preset_config); |
|
| 151 | + } |
|
| 147 | 152 | $passing = $this->default_records($passing_c,$DEBUG); |
| 148 | 153 | break; |
| 149 | 154 | case 'upgrade': |
@@ -162,29 +167,40 @@ discard block |
||
| 162 | 167 | if($value['status'] == 'C') |
| 163 | 168 | { |
| 164 | 169 | $passed[$value['name']] = $passing[$value['name']]; |
| 165 | - if($DEBUG) { echo '<br>process->pass(): '.$passed[$value['name']]['name'] . ' install completed'."\n"; } |
|
| 170 | + if($DEBUG) |
|
| 171 | + { |
|
| 172 | +echo '<br>process->pass(): '.$passed[$value['name']]['name'] . ' install completed'."\n"; } |
|
| 166 | 173 | } |
| 167 | 174 | elseif($value['status'] == 'F') |
| 168 | 175 | { |
| 169 | 176 | $setup_info[$value['name']] = $passing[$value['name']]; |
| 170 | - if($DEBUG) { echo '<br>process->pass(): '.$setup_info[$value['name']]['name'] . ' install failed'."\n"; } |
|
| 177 | + if($DEBUG) |
|
| 178 | + { |
|
| 179 | +echo '<br>process->pass(): '.$setup_info[$value['name']]['name'] . ' install failed'."\n"; } |
|
| 171 | 180 | } |
| 172 | 181 | elseif($value['status'] == 'D') |
| 173 | 182 | { |
| 174 | 183 | $pass[$value['name']] = $setup_info[$value['name']]; |
| 175 | - if($DEBUG) { echo '<br>process->pass(): '.$pass[$value['name']]['name'] . ' fails dependency check on this pass'."\n"; } |
|
| 184 | + if($DEBUG) |
|
| 185 | + { |
|
| 186 | +echo '<br>process->pass(): '.$pass[$value['name']]['name'] . ' fails dependency check on this pass'."\n"; } |
|
| 176 | 187 | } |
| 177 | 188 | else |
| 178 | 189 | { |
| 179 | 190 | $tmp = $passing[$value['name']]['name']; |
| 180 | - if($DEBUG) { echo '<br>process->pass(): '.$tmp . ' skipped on this pass'."\n"; } |
|
| 191 | + if($DEBUG) |
|
| 192 | + { |
|
| 193 | +echo '<br>process->pass(): '.$tmp . ' skipped on this pass'."\n"; } |
|
| 181 | 194 | } |
| 182 | 195 | } |
| 183 | 196 | |
| 184 | 197 | $i++; |
| 185 | - if($i == 20) /* Then oops it broke */ |
|
| 198 | + if($i == 20) |
|
| 199 | + { |
|
| 200 | + /* Then oops it broke */ |
|
| 186 | 201 | { |
| 187 | 202 | echo '<br>Setup failure: excess looping in process->pass():'."\n"; |
| 203 | + } |
|
| 188 | 204 | echo '<br>Pass:<br>'."\n"; |
| 189 | 205 | _debug_array($pass); |
| 190 | 206 | echo '<br>Passed:<br>'."\n"; |
@@ -376,7 +392,9 @@ discard block |
||
| 376 | 392 | //echo $table; |
| 377 | 393 | if(in_array($table,$tables)) |
| 378 | 394 | { |
| 379 | - if($DEBUG){ echo '<br>process->droptables(): Dropping :'. $app_name . ' table: ' . $table; } |
|
| 395 | + if($DEBUG) |
|
| 396 | + { |
|
| 397 | +echo '<br>process->droptables(): Dropping :'. $app_name . ' table: ' . $table; } |
|
| 380 | 398 | $GLOBALS['egw_setup']->oProc->DropTable($table); |
| 381 | 399 | // Update the array values for return below |
| 382 | 400 | $setup_info[$app_name]['status'] = 'U'; |
@@ -408,13 +426,17 @@ discard block |
||
| 408 | 426 | $enabled = False; |
| 409 | 427 | $apptitle = $appdata['title']; |
| 410 | 428 | |
| 411 | - if($DEBUG) { echo '<br>process->current(): Incoming status: ' . $appname . ',status: '. $appdata['status']; } |
|
| 429 | + if($DEBUG) |
|
| 430 | + { |
|
| 431 | +echo '<br>process->current(): Incoming status: ' . $appname . ',status: '. $appdata['status']; } |
|
| 412 | 432 | |
| 413 | 433 | $appdir = EGW_SERVER_ROOT . '/' . $appname . '/setup/'; |
| 414 | 434 | |
| 415 | 435 | if($appdata['tables'] && file_exists($appdir.'tables_current.inc.php')) |
| 416 | 436 | { |
| 417 | - if($DEBUG) { echo '<br>process->current(): Including: ' . $appdir.'tables_current.inc.php'; } |
|
| 437 | + if($DEBUG) |
|
| 438 | + { |
|
| 439 | +echo '<br>process->current(): Including: ' . $appdir.'tables_current.inc.php'; } |
|
| 418 | 440 | $phpgw_baseline = null; |
| 419 | 441 | include ($appdir.'tables_current.inc.php'); |
| 420 | 442 | $ret = $this->post_process($phpgw_baseline,$DEBUG); |
@@ -435,13 +457,17 @@ discard block |
||
| 435 | 457 | else |
| 436 | 458 | { |
| 437 | 459 | /* script processing failed */ |
| 438 | - if($DEBUG) { echo '<br>process->current(): Failed for ' . $appname . ',status: '. $appdata['status']; } |
|
| 460 | + if($DEBUG) |
|
| 461 | + { |
|
| 462 | +echo '<br>process->current(): Failed for ' . $appname . ',status: '. $appdata['status']; } |
|
| 439 | 463 | $appdata['status'] = 'F'; |
| 440 | 464 | } |
| 441 | 465 | } |
| 442 | 466 | else |
| 443 | 467 | { |
| 444 | - if($DEBUG) { echo '<br>process->current(): No current tables for ' . $apptitle . "\n"; } |
|
| 468 | + if($DEBUG) |
|
| 469 | + { |
|
| 470 | +echo '<br>process->current(): No current tables for ' . $apptitle . "\n"; } |
|
| 445 | 471 | /* |
| 446 | 472 | Add the app, but disable it if it has tables defined. |
| 447 | 473 | A manual sql script install is needed, but we do add the hooks |
@@ -462,7 +488,9 @@ discard block |
||
| 462 | 488 | } |
| 463 | 489 | $appdata['status'] = 'C'; |
| 464 | 490 | } |
| 465 | - if($DEBUG) { echo '<br>process->current(): Outgoing status: ' . $appname . ',status: '. $appdata['status']; } |
|
| 491 | + if($DEBUG) |
|
| 492 | + { |
|
| 493 | +echo '<br>process->current(): Outgoing status: ' . $appname . ',status: '. $appdata['status']; } |
|
| 466 | 494 | } |
| 467 | 495 | |
| 468 | 496 | // update hooks |
@@ -638,9 +666,12 @@ discard block |
||
| 638 | 666 | { |
| 639 | 667 | echo '<div style="text-align: left; border: thin dashed black; margin-top: 5px;">'."process->upgrade(): Incoming : appname: $appname, version: $appdata[currentver], status: $appdata[status]\n"; |
| 640 | 668 | } |
| 641 | - if($appdata['status'] == 'U' || $appdata['status'] == 'D' ||$appdata['status'] == 'V' || $appdata['status'] == '') // TODO this is not getting set for api upgrade, sometimes ??? |
|
| 669 | + if($appdata['status'] == 'U' || $appdata['status'] == 'D' ||$appdata['status'] == 'V' || $appdata['status'] == '') |
|
| 670 | + { |
|
| 671 | + // TODO this is not getting set for api upgrade, sometimes ??? |
|
| 642 | 672 | { |
| 643 | 673 | $currentver = $appdata['currentver']; |
| 674 | + } |
|
| 644 | 675 | $targetver = $appdata['version']; // The version we need to match when done |
| 645 | 676 | $appdir = EGW_SERVER_ROOT . '/' . $appname . '/setup/'; |
| 646 | 677 | |
@@ -674,11 +705,14 @@ discard block |
||
| 674 | 705 | } |
| 675 | 706 | } |
| 676 | 707 | } |
| 677 | - if ($currentver == $targetver) // upgrades succesful |
|
| 708 | + if ($currentver == $targetver) |
|
| 709 | + { |
|
| 710 | + // upgrades succesful |
|
| 678 | 711 | { |
| 679 | 712 | if($DEBUG) |
| 680 | 713 | { |
| 681 | 714 | echo "<br>process->upgrade(): Upgrade of $appname to $targetver is completed.\n"; |
| 715 | + } |
|
| 682 | 716 | } |
| 683 | 717 | $appstatus = 'C'; |
| 684 | 718 | } |
@@ -700,9 +734,12 @@ discard block |
||
| 700 | 734 | } |
| 701 | 735 | $appstatus = 'C'; |
| 702 | 736 | } |
| 703 | - if ($appstatus == 'C') // update successful completed |
|
| 737 | + if ($appstatus == 'C') |
|
| 738 | + { |
|
| 739 | + // update successful completed |
|
| 704 | 740 | { |
| 705 | 741 | $appdata['currentver'] = $targetver; |
| 742 | + } |
|
| 706 | 743 | |
| 707 | 744 | if($GLOBALS['egw_setup']->app_registered($appname)) |
| 708 | 745 | { |
@@ -70,10 +70,13 @@ discard block |
||
| 70 | 70 | self::auth_types(true); |
| 71 | 71 | |
| 72 | 72 | $values = array(); |
| 73 | - if ($this->arguments) // we have command line arguments |
|
| 73 | + if ($this->arguments) |
|
| 74 | + { |
|
| 75 | + // we have command line arguments |
|
| 74 | 76 | { |
| 75 | 77 | $save_mail_account = $this->_parse_cli_arguments($values); |
| 76 | 78 | } |
| 79 | + } |
|
| 77 | 80 | else |
| 78 | 81 | { |
| 79 | 82 | $save_mail_account = $this->_parse_properties($values); |
@@ -82,7 +85,10 @@ discard block |
||
| 82 | 85 | // store the config |
| 83 | 86 | foreach($values as $name => $value) |
| 84 | 87 | { |
| 85 | - if (substr($name, 0, 4) == 'acc_') continue; |
|
| 88 | + if (substr($name, 0, 4) == 'acc_') |
|
| 89 | + { |
|
| 90 | + continue; |
|
| 91 | + } |
|
| 86 | 92 | |
| 87 | 93 | $app = 'phpgwapi'; |
| 88 | 94 | if (strpos($name, '/') !== false) |
@@ -98,7 +104,10 @@ discard block |
||
| 98 | 104 | } |
| 99 | 105 | if (count($values)) |
| 100 | 106 | { |
| 101 | - if ($save_mail_account) $this->_save_mail_account($values); |
|
| 107 | + if ($save_mail_account) |
|
| 108 | + { |
|
| 109 | + $this->_save_mail_account($values); |
|
| 110 | + } |
|
| 102 | 111 | |
| 103 | 112 | // flush instance cache, so above config get read from database not cache |
| 104 | 113 | Api\Cache::flush(); |
@@ -322,13 +331,19 @@ discard block |
||
| 322 | 331 | */ |
| 323 | 332 | private function _parse_value($arg,$n,$data,$value,array &$values) |
| 324 | 333 | { |
| 325 | - if ($value === '' && is_array($data) && !isset($data[$n]['default'])) return false; |
|
| 334 | + if ($value === '' && is_array($data) && !isset($data[$n]['default'])) |
|
| 335 | + { |
|
| 336 | + return false; |
|
| 337 | + } |
|
| 326 | 338 | |
| 327 | 339 | $name = is_array($data) || $n ? $data[$n] : $data; |
| 328 | 340 | |
| 329 | 341 | if (is_array($name)) |
| 330 | 342 | { |
| 331 | - if (!$value && isset($name['default'])) $value = $name['default']; |
|
| 343 | + if (!$value && isset($name['default'])) |
|
| 344 | + { |
|
| 345 | + $value = $name['default']; |
|
| 346 | + } |
|
| 332 | 347 | |
| 333 | 348 | if (isset($name['allowed']) && !in_array($value,$name['allowed'])) |
| 334 | 349 | { |
@@ -15,10 +15,13 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | chdir(dirname(__FILE__)); // to enable our relative pathes to work |
| 17 | 17 | |
| 18 | -if (php_sapi_name() !== 'cli') // security precaution: forbit calling setup-cli as web-page |
|
| 18 | +if (php_sapi_name() !== 'cli') |
|
| 19 | +{ |
|
| 20 | + // security precaution: forbit calling setup-cli as web-page |
|
| 19 | 21 | { |
| 20 | 22 | die('<h1>setup-cli.php must NOT be called as web-page --> exiting !!!</h1>'); |
| 21 | 23 | } |
| 24 | +} |
|
| 22 | 25 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); |
| 23 | 26 | |
| 24 | 27 | $dry_run = false; |
@@ -33,7 +36,11 @@ discard block |
||
| 33 | 36 | } |
| 34 | 37 | $arguments = $_SERVER['argv']; |
| 35 | 38 | $action = array_shift($arguments); |
| 36 | - if (isset($arguments[0])) list($_POST['FormDomain']) = explode(',',$arguments[0]); // header include needs that to detects the right domain |
|
| 39 | + if (isset($arguments[0])) |
|
| 40 | + { |
|
| 41 | + list($_POST['FormDomain']) = explode(',',$arguments[0]); |
|
| 42 | + } |
|
| 43 | + // header include needs that to detects the right domain |
|
| 37 | 44 | } |
| 38 | 45 | else |
| 39 | 46 | { |
@@ -51,7 +58,10 @@ discard block |
||
| 51 | 58 | // check if date.timezone is set, report it and set something if not, as it gives tons of errors in install log |
| 52 | 59 | if (!ini_get('date.timezone')) |
| 53 | 60 | { |
| 54 | - if (!($tz = date_default_timezone_get())) $tz = 'UTC'; |
|
| 61 | + if (!($tz = date_default_timezone_get())) |
|
| 62 | + { |
|
| 63 | + $tz = 'UTC'; |
|
| 64 | + } |
|
| 55 | 65 | echo "No default timezone (php.ini date.timezone) set, we temporary set '$tz'. You should fix that permanent!\n"; |
| 56 | 66 | ini_set('date.timezone',$tz); |
| 57 | 67 | } |
@@ -132,13 +142,19 @@ discard block |
||
| 132 | 142 | foreach($arguments as $arg) |
| 133 | 143 | { |
| 134 | 144 | list($name,$value) = explode('=',$arg,2); |
| 135 | - if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
| 145 | + if(property_exists('admin_cmd',$name)) |
|
| 146 | + { |
|
| 147 | + // dont allow to overwrite admin_cmd properties |
|
| 136 | 148 | { |
| 137 | 149 | throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
| 138 | 150 | } |
| 139 | - if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
| 151 | + } |
|
| 152 | + if (substr($name,-1) == ']') |
|
| 153 | + { |
|
| 154 | + // allow 1-dim. arrays |
|
| 140 | 155 | { |
| 141 | 156 | list($name,$sub) = explode('[',substr($name,0,-1),2); |
| 157 | + } |
|
| 142 | 158 | $args[$name][$sub] = $value; |
| 143 | 159 | } |
| 144 | 160 | else |
@@ -148,7 +164,10 @@ discard block |
||
| 148 | 164 | } |
| 149 | 165 | $cmd = new $class($args); |
| 150 | 166 | $msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run); |
| 151 | - if (is_array($msg)) $msg = print_r($msg,true); |
|
| 167 | + if (is_array($msg)) |
|
| 168 | + { |
|
| 169 | + $msg = print_r($msg,true); |
|
| 170 | + } |
|
| 152 | 171 | echo "$msg\n"; |
| 153 | 172 | break; |
| 154 | 173 | } |
@@ -164,14 +183,20 @@ discard block |
||
| 164 | 183 | function do_config($args) |
| 165 | 184 | { |
| 166 | 185 | $arg0 = explode(',',array_shift($args)); |
| 167 | - if (!($domain = @array_shift($arg0))) $domain = 'default'; |
|
| 186 | + if (!($domain = @array_shift($arg0))) |
|
| 187 | + { |
|
| 188 | + $domain = 'default'; |
|
| 189 | + } |
|
| 168 | 190 | $user = @array_shift($arg0); |
| 169 | 191 | $password = @array_shift($arg0); |
| 170 | 192 | _fetch_user_password($user,$password); |
| 171 | 193 | |
| 172 | - if ($arg0) // direct assignments (name=value,...) left |
|
| 194 | + if ($arg0) |
|
| 195 | + { |
|
| 196 | + // direct assignments (name=value,...) left |
|
| 173 | 197 | { |
| 174 | 198 | array_unshift($args,implode(',',$arg0)); |
| 199 | + } |
|
| 175 | 200 | array_unshift($args,'--config'); |
| 176 | 201 | } |
| 177 | 202 | |
@@ -238,9 +263,15 @@ discard block |
||
| 238 | 263 | { |
| 239 | 264 | $options[0] = $domain; |
| 240 | 265 | |
| 241 | - if ($quite_check) ob_start(); |
|
| 266 | + if ($quite_check) |
|
| 267 | + { |
|
| 268 | + ob_start(); |
|
| 269 | + } |
|
| 242 | 270 | _check_auth_config(implode(',',$options),14); |
| 243 | - if ($quite_check) ob_end_clean(); |
|
| 271 | + if ($quite_check) |
|
| 272 | + { |
|
| 273 | + ob_end_clean(); |
|
| 274 | + } |
|
| 244 | 275 | |
| 245 | 276 | if ($backup == 'no') |
| 246 | 277 | { |
@@ -316,7 +347,10 @@ discard block |
||
| 316 | 347 | function _check_auth_config($arg,$stop,$set_lang=true) |
| 317 | 348 | { |
| 318 | 349 | $options = explode(',',$arg); |
| 319 | - if (!($domain = array_shift($options))) $domain = 'default'; |
|
| 350 | + if (!($domain = array_shift($options))) |
|
| 351 | + { |
|
| 352 | + $domain = 'default'; |
|
| 353 | + } |
|
| 320 | 354 | $user = array_shift($options); |
| 321 | 355 | $password = array_shift($options); |
| 322 | 356 | _fetch_user_password($user,$password); |
@@ -324,7 +358,10 @@ discard block |
||
| 324 | 358 | setup_cmd::check_installed($domain,$stop,true); |
| 325 | 359 | |
| 326 | 360 | // reset charset for the output to the charset used by the OS |
| 327 | - if ($set_lang) $GLOBALS['egw_setup']->system_charset = $GLOBALS['charset']; |
|
| 361 | + if ($set_lang) |
|
| 362 | + { |
|
| 363 | + $GLOBALS['egw_setup']->system_charset = $GLOBALS['charset']; |
|
| 364 | + } |
|
| 328 | 365 | |
| 329 | 366 | setup_cmd::check_setup_auth($user,$password,$domain); |
| 330 | 367 | |
@@ -360,7 +397,10 @@ discard block |
||
| 360 | 397 | function _fetch_user_password(&$user,&$password) |
| 361 | 398 | { |
| 362 | 399 | // read password from enviroment or query it from user, if not given |
| 363 | - if (!$user) $user = 'admin'; |
|
| 400 | + if (!$user) |
|
| 401 | + { |
|
| 402 | + $user = 'admin'; |
|
| 403 | + } |
|
| 364 | 404 | if (!$password && !($password = $_SERVER['EGW_CLI_PASSWORD'])) |
| 365 | 405 | { |
| 366 | 406 | echo lang('Admin password to header manager').' '; |
@@ -406,9 +446,15 @@ discard block |
||
| 406 | 446 | list($code,$language) = explode("\t",$line); |
| 407 | 447 | $languages[$code] = $language; |
| 408 | 448 | } |
| 409 | - if (isset($languages[$lang.'-'.$nation])) return $lang.'-'.$nation; |
|
| 449 | + if (isset($languages[$lang.'-'.$nation])) |
|
| 450 | + { |
|
| 451 | + return $lang.'-'.$nation; |
|
| 452 | + } |
|
| 410 | 453 | |
| 411 | - if (isset($languages[$lang])) return $lang; |
|
| 454 | + if (isset($languages[$lang])) |
|
| 455 | + { |
|
| 456 | + return $lang; |
|
| 457 | + } |
|
| 412 | 458 | |
| 413 | 459 | return 'en'; |
| 414 | 460 | } |
@@ -448,7 +494,10 @@ discard block |
||
| 448 | 494 | if (!$what || $what == 'config') |
| 449 | 495 | { |
| 450 | 496 | echo '--config '.lang('domain(default),[config user(admin)],password,[name=value,...] sets config values beside:')."\n"; |
| 451 | - if (!$what) echo ' --help config '.lang('gives further options')."\n"; |
|
| 497 | + if (!$what) |
|
| 498 | + { |
|
| 499 | + echo ' --help config '.lang('gives further options')."\n"; |
|
| 500 | + } |
|
| 452 | 501 | } |
| 453 | 502 | if ($what == 'config') |
| 454 | 503 | { |
@@ -477,7 +526,10 @@ discard block |
||
| 477 | 526 | echo lang('Create or edit the EGroupware configuration file: header.inc.php:')."\n"; |
| 478 | 527 | echo '--create-header '.lang('header-password[,header-user(admin)]')."\n"; |
| 479 | 528 | echo '--edit-header '.lang('[header-password],[header-user],[new-password],[new-user]')."\n"; |
| 480 | - if (!$what) echo ' --help header '.lang('gives further options')."\n"; |
|
| 529 | + if (!$what) |
|
| 530 | + { |
|
| 531 | + echo ' --help header '.lang('gives further options')."\n"; |
|
| 532 | + } |
|
| 481 | 533 | } |
| 482 | 534 | if ($what == 'header') |
| 483 | 535 | { |
@@ -49,10 +49,13 @@ discard block |
||
| 49 | 49 | $GLOBALS['egw_info']['setup']['stage']['header'] = $GLOBALS['egw_setup']->detection->check_header(); |
| 50 | 50 | if ($GLOBALS['egw_info']['setup']['stage']['header'] != '10') |
| 51 | 51 | { |
| 52 | - if ($GLOBALS['egw_info']['setup']['stage']['header'] == 4) // header needs update, go there direct |
|
| 52 | + if ($GLOBALS['egw_info']['setup']['stage']['header'] == 4) |
|
| 53 | + { |
|
| 54 | + // header needs update, go there direct |
|
| 53 | 55 | { |
| 54 | 56 | Header('Location: manageheader.php'); |
| 55 | 57 | } |
| 58 | + } |
|
| 56 | 59 | else // run check-install first |
| 57 | 60 | { |
| 58 | 61 | Header('Location: check_install.php?intro=1'); |
@@ -97,7 +100,9 @@ discard block |
||
| 97 | 100 | } |
| 98 | 101 | } |
| 99 | 102 | |
| 100 | -if ($GLOBALS['DEBUG']) { echo 'Stage: ' . $GLOBALS['egw_info']['setup']['stage']['db']; } |
|
| 103 | +if ($GLOBALS['DEBUG']) |
|
| 104 | +{ |
|
| 105 | +echo 'Stage: ' . $GLOBALS['egw_info']['setup']['stage']['db']; } |
|
| 101 | 106 | // begin DEBUG code |
| 102 | 107 | //$GLOBALS['egw_info']['setup']['stage']['db'] = 0; |
| 103 | 108 | //$action = 'Upgrade'; |
@@ -501,8 +506,14 @@ discard block |
||
| 501 | 506 | $msg = ''; |
| 502 | 507 | if ($to_upgrade || $to_install) |
| 503 | 508 | { |
| 504 | - if ($to_upgrade) $msg = '<b>'.lang('The following applications need to be upgraded:').'</b> '.implode(', ',$to_upgrade); |
|
| 505 | - if ($to_install) $msg .= ($msg?'<br />':'').'<b>'.lang('The following applications are required, but NOT installed:').'</b> '.implode(', ',$to_install); |
|
| 509 | + if ($to_upgrade) |
|
| 510 | + { |
|
| 511 | + $msg = '<b>'.lang('The following applications need to be upgraded:').'</b> '.implode(', ',$to_upgrade); |
|
| 512 | + } |
|
| 513 | + if ($to_install) |
|
| 514 | + { |
|
| 515 | + $msg .= ($msg?'<br />':'').'<b>'.lang('The following applications are required, but NOT installed:').'</b> '.implode(', ',$to_install); |
|
| 516 | + } |
|
| 506 | 517 | } |
| 507 | 518 | $btn_manage_apps = $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
| 508 | 519 | $msg ? $msg : lang('This stage is completed<br />'), |
@@ -285,7 +285,10 @@ |
||
| 285 | 285 | $val = array2string($val); |
| 286 | 286 | break; |
| 287 | 287 | default: |
| 288 | - if (is_array($val)) $val = implode(', ', $val); |
|
| 288 | + if (is_array($val)) |
|
| 289 | + { |
|
| 290 | + $val = implode(', ', $val); |
|
| 291 | + } |
|
| 289 | 292 | break; |
| 290 | 293 | } |
| 291 | 294 | $setup_tpl->set_var('bg_color', $bgcolor[++$i & 1]); |
@@ -13,10 +13,13 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | chdir(dirname(__FILE__)); // to enable our relative pathes to work |
| 15 | 15 | |
| 16 | -if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-page |
|
| 16 | +if (php_sapi_name() !== 'cli') |
|
| 17 | +{ |
|
| 18 | + // security precaution: forbit calling as web-page |
|
| 17 | 19 | { |
| 18 | 20 | die('<h1>setup/doc/chown.php must NOT be called as web-page --> exiting !!!</h1>'); |
| 19 | 21 | } |
| 22 | +} |
|
| 20 | 23 | |
| 21 | 24 | $recursive = false; |
| 22 | 25 | |
@@ -70,7 +73,10 @@ discard block |
||
| 70 | 73 | { |
| 71 | 74 | global $change; |
| 72 | 75 | |
| 73 | - if (is_null($stat) && !($stat = stat($path))) return false; |
|
| 76 | + if (is_null($stat) && !($stat = stat($path))) |
|
| 77 | + { |
|
| 78 | + return false; |
|
| 79 | + } |
|
| 74 | 80 | |
| 75 | 81 | if (isset($change[$stat['uid']]) && !chown($path, $uid=$change[$stat['uid']])) |
| 76 | 82 | { |
@@ -86,10 +92,12 @@ discard block |
||
| 86 | 92 | foreach(new DirectoryIterator($path) as $child) |
| 87 | 93 | { |
| 88 | 94 | if (!$child->isDot()) |
| 89 | - chown_grp($child->getPathname(), array( |
|
| 95 | + { |
|
| 96 | + chown_grp($child->getPathname(), array( |
|
| 90 | 97 | 'uid' => $child->getOwner(), |
| 91 | 98 | 'gid' => $child->getGroup(), |
| 92 | 99 | ), $recursive); |
| 100 | + } |
|
| 93 | 101 | } |
| 94 | 102 | } |
| 95 | 103 | } |
@@ -81,18 +81,26 @@ |
||
| 81 | 81 | |
| 82 | 82 | // step through every source code intstalled app |
| 83 | 83 | $egwdir = dir(EGW_INCLUDE_ROOT); |
| 84 | - while (false !== ($appdir = $egwdir->read())) { |
|
| 84 | + while (false !== ($appdir = $egwdir->read())) |
|
| 85 | + { |
|
| 85 | 86 | $defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/"; |
| 86 | - if ( !is_dir( $defdir ) ) continue; |
|
| 87 | + if ( !is_dir( $defdir ) ) |
|
| 88 | + { |
|
| 89 | + continue; |
|
| 90 | + } |
|
| 87 | 91 | |
| 88 | 92 | // step through each file in defdir of app |
| 89 | 93 | $d = dir($defdir); |
| 90 | - while (false !== ($entry = $d->read())) { |
|
| 94 | + while (false !== ($entry = $d->read())) |
|
| 95 | + { |
|
| 91 | 96 | try |
| 92 | 97 | { |
| 93 | 98 | $file = $defdir. '/'. $entry; |
| 94 | 99 | list( $filename, $extension) = explode('.',$entry); |
| 95 | - if ( $extension != 'xml' ) continue; |
|
| 100 | + if ( $extension != 'xml' ) |
|
| 101 | + { |
|
| 102 | + continue; |
|
| 103 | + } |
|
| 96 | 104 | importexport_definitions_bo::import( $file ); |
| 97 | 105 | } |
| 98 | 106 | catch (Exception $e) |