@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | if (!$this->header_secret && $this->header_admin_user) // no secret specified but header_admin_user/password |
| 36 | 36 | { |
| 37 | 37 | if (!$this->uid) $this->uid = true; |
| 38 | - $this->set_header_secret($this->header_admin_user,$this->header_admin_password); |
|
| 38 | + $this->set_header_secret($this->header_admin_user, $this->header_admin_password); |
|
| 39 | 39 | } |
| 40 | 40 | $secret = $this->_calc_header_secret($GLOBALS['egw_info']['server']['header_admin_user'], |
| 41 | 41 | $GLOBALS['egw_info']['server']['header_admin_password']); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | if ($this->header_secret != $secret) |
| 45 | 45 | { |
| 46 | 46 | //echo "_check_header_access: header_secret='$this->header_secret' != '$secret'=_calc_header_secret({$GLOBALS['egw_info']['server']['header_admin_user']},{$GLOBALS['egw_info']['server']['header_admin_password']})\n"; |
| 47 | - throw new Api\Exception\NoPermission(lang('Wrong credentials to access the header.inc.php file!'),5); |
|
| 47 | + throw new Api\Exception\NoPermission(lang('Wrong credentials to access the header.inc.php file!'), 5); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | } |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | * @param string $user |
| 56 | 56 | * @param string $pw password or md5 hash of it |
| 57 | 57 | */ |
| 58 | - public function set_header_secret($user,$pw) |
|
| 58 | + public function set_header_secret($user, $pw) |
|
| 59 | 59 | { |
| 60 | 60 | if ($this->uid || parent::save(false)) // we need to save first, to get the uid |
| 61 | 61 | { |
| 62 | - $this->header_secret = $this->_calc_header_secret($user,$pw); |
|
| 62 | + $this->header_secret = $this->_calc_header_secret($user, $pw); |
|
| 63 | 63 | } |
| 64 | 64 | else |
| 65 | 65 | { |
| 66 | - throw new Exception ('failed to set header_secret!'); |
|
| 66 | + throw new Exception('failed to set header_secret!'); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param string $header_admin_password |
| 77 | 77 | * @return string |
| 78 | 78 | */ |
| 79 | - private function _calc_header_secret($header_admin_user=null,$header_admin_password=null) |
|
| 79 | + private function _calc_header_secret($header_admin_user = null, $header_admin_password = null) |
|
| 80 | 80 | { |
| 81 | 81 | if (!self::is_md5($header_admin_password)) $header_admin_password = md5($header_admin_password); |
| 82 | 82 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @param boolean $set_modifier =true set the current user as modifier or 0 (= run by the system) |
| 92 | 92 | * @return boolean true on success, false otherwise |
| 93 | 93 | */ |
| 94 | - function save($set_modifier=true) |
|
| 94 | + function save($set_modifier = true) |
|
| 95 | 95 | { |
| 96 | 96 | if (isset($GLOBALS['egw']->db) && is_object($GLOBALS['egw']->db) && $GLOBALS['egw']->db->Database) |
| 97 | 97 | { |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | /** |
| 113 | 113 | * Create the setup enviroment (for running within setup or eGW) |
| 114 | 114 | */ |
| 115 | - static protected function _setup_enviroment($domain=null) |
|
| 115 | + static protected function _setup_enviroment($domain = null) |
|
| 116 | 116 | { |
| 117 | 117 | if (!is_object($GLOBALS['egw_setup'])) |
| 118 | 118 | { |
| 119 | 119 | require_once(EGW_INCLUDE_ROOT.'/setup/inc/class.setup.inc.php'); |
| 120 | - $GLOBALS['egw_setup'] = new setup(true,true); |
|
| 120 | + $GLOBALS['egw_setup'] = new setup(true, true); |
|
| 121 | 121 | } |
| 122 | 122 | self::$egw_setup = $GLOBALS['egw_setup']; |
| 123 | 123 | self::$egw_setup->ConfigDomain = $domain; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | is_object($GLOBALS['egw']) && $GLOBALS['egw'] instanceof Egw) |
| 127 | 127 | { |
| 128 | 128 | // we run inside eGW, not setup --> read egw_domain array from the header via the showheader cmd |
| 129 | - $cmd = new setup_cmd_showheader(null); // null = only header, no db stuff, no hashes |
|
| 129 | + $cmd = new setup_cmd_showheader(null); // null = only header, no db stuff, no hashes |
|
| 130 | 130 | $header = $cmd->run(); |
| 131 | 131 | $GLOBALS['egw_domain'] = $header['egw_domain']; |
| 132 | 132 | |
@@ -179,26 +179,26 @@ discard block |
||
| 179 | 179 | * @throws Api\Exception\NoPermission(lang('Access denied: wrong username or password for manage-header !!!'),21); |
| 180 | 180 | * @throws Api\Exception\NoPermission(lang("Access denied: wrong username or password to configure the domain '%1(%2)' !!!",$domain,$GLOBALS['egw_domain'][$domain]['db_type']),40); |
| 181 | 181 | */ |
| 182 | - static function check_setup_auth($user,$pw,$domain=null) |
|
| 182 | + static function check_setup_auth($user, $pw, $domain = null) |
|
| 183 | 183 | { |
| 184 | 184 | self::_setup_enviroment($domain); |
| 185 | 185 | |
| 186 | 186 | // check the authentication if a header_admin_password is set, if not we dont have a header yet and no authentication |
| 187 | 187 | if ($GLOBALS['egw_info']['server']['header_admin_password']) // if that's not given we dont have a header yet |
| 188 | 188 | { |
| 189 | - if (!self::$egw_setup->check_auth($user,$pw,$GLOBALS['egw_info']['server']['header_admin_user'], |
|
| 189 | + if (!self::$egw_setup->check_auth($user, $pw, $GLOBALS['egw_info']['server']['header_admin_user'], |
|
| 190 | 190 | $GLOBALS['egw_info']['server']['header_admin_password']) && |
| 191 | 191 | (is_null($domain) || !isset($GLOBALS['egw_domain'][$domain]) || // if valid domain given check it's config user/pw |
| 192 | - !self::$egw_setup->check_auth($user,$pw,$GLOBALS['egw_domain'][$domain]['config_user'], |
|
| 192 | + !self::$egw_setup->check_auth($user, $pw, $GLOBALS['egw_domain'][$domain]['config_user'], |
|
| 193 | 193 | $GLOBALS['egw_domain'][$domain]['config_passwd']))) |
| 194 | 194 | { |
| 195 | 195 | if (is_null($domain)) |
| 196 | 196 | { |
| 197 | - throw new Api\Exception\NoPermission(lang('Access denied: wrong username or password for manage-header !!!'),21); |
|
| 197 | + throw new Api\Exception\NoPermission(lang('Access denied: wrong username or password for manage-header !!!'), 21); |
|
| 198 | 198 | } |
| 199 | 199 | else |
| 200 | 200 | { |
| 201 | - throw new Api\Exception\NoPermission(lang("Access denied: wrong username or password to configure the domain '%1(%2)' !!!",$domain,$GLOBALS['egw_domain'][$domain]['db_type']),40); |
|
| 201 | + throw new Api\Exception\NoPermission(lang("Access denied: wrong username or password to configure the domain '%1(%2)' !!!", $domain, $GLOBALS['egw_domain'][$domain]['db_type']), 40); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -209,13 +209,13 @@ discard block |
||
| 209 | 209 | * |
| 210 | 210 | * @var array |
| 211 | 211 | */ |
| 212 | - static public $apps_to_install=array(); |
|
| 212 | + static public $apps_to_install = array(); |
|
| 213 | 213 | /** |
| 214 | 214 | * Applications which are currently need update (set after call to check_installed, for the last/only domain only) |
| 215 | 215 | * |
| 216 | 216 | * @var array |
| 217 | 217 | */ |
| 218 | - static public $apps_to_upgrade=array(); |
|
| 218 | + static public $apps_to_upgrade = array(); |
|
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | 221 | * Check if eGW is installed, which versions and if an update is needed |
@@ -227,66 +227,66 @@ discard block |
||
| 227 | 227 | * @param boolean $verbose =false echo messages as they happen, instead returning them |
| 228 | 228 | * @return array with translated messages |
| 229 | 229 | */ |
| 230 | - static function check_installed($domain='',$stop=0,$verbose=false) |
|
| 230 | + static function check_installed($domain = '', $stop = 0, $verbose = false) |
|
| 231 | 231 | { |
| 232 | 232 | self::_setup_enviroment($domain); |
| 233 | 233 | |
| 234 | 234 | global $setup_info; |
| 235 | - static $header_checks=true; // output the header checks only once |
|
| 235 | + static $header_checks = true; // output the header checks only once |
|
| 236 | 236 | |
| 237 | 237 | $messages = array(); |
| 238 | 238 | |
| 239 | 239 | if ($stop && !is_array($stop)) $stop = array($stop); |
| 240 | 240 | |
| 241 | - $versions =& $GLOBALS['egw_info']['server']['versions']; |
|
| 241 | + $versions = & $GLOBALS['egw_info']['server']['versions']; |
|
| 242 | 242 | |
| 243 | 243 | if (!$versions['api']) |
| 244 | 244 | { |
| 245 | 245 | if (!include(EGW_INCLUDE_ROOT.'/api/setup/setup.inc.php')) |
| 246 | 246 | { |
| 247 | - throw new Api\Exception\WrongUserinput(lang("EGroupware sources in '%1' are not complete, file '%2' missing !!!",realpath('..'),'api/setup/setup.inc.php'),99); // should not happen ;-) |
|
| 247 | + throw new Api\Exception\WrongUserinput(lang("EGroupware sources in '%1' are not complete, file '%2' missing !!!", realpath('..'), 'api/setup/setup.inc.php'), 99); // should not happen ;-) |
|
| 248 | 248 | } |
| 249 | 249 | $versions['api'] = $setup_info['api']['version']; |
| 250 | 250 | unset($setup_info); |
| 251 | 251 | } |
| 252 | 252 | if ($header_checks) |
| 253 | 253 | { |
| 254 | - $messages[] = self::_echo_message($verbose,lang('EGroupware API version %1 found.',$versions['api'])); |
|
| 254 | + $messages[] = self::_echo_message($verbose, lang('EGroupware API version %1 found.', $versions['api'])); |
|
| 255 | 255 | } |
| 256 | 256 | $header_stage = self::$egw_setup->detection->check_header(); |
| 257 | - if ($stop && in_array($header_stage,$stop)) return true; |
|
| 257 | + if ($stop && in_array($header_stage, $stop)) return true; |
|
| 258 | 258 | |
| 259 | 259 | switch ($header_stage) |
| 260 | 260 | { |
| 261 | - case 1: 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); |
|
| 261 | + case 1: 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); |
|
| 262 | 262 | |
| 263 | 263 | // case 2: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('No header admin password set! Use --edit-header <password>[,<user>] to set one (--usage gives more options).'),2); |
| 264 | 264 | |
| 265 | - case 3: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('No EGroupware domains / database instances exist! Use --edit-header --domain to add one (--usage gives more options).'),3); |
|
| 265 | + case 3: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) version %1 exists%2', $versions['header'], '.')."\n".lang('No EGroupware domains / database instances exist! Use --edit-header --domain to add one (--usage gives more options).'), 3); |
|
| 266 | 266 | |
| 267 | - case 4: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('It needs upgrading to version %1! Use --update-header <password>[,<user>] to do so (--usage gives more options).',$versions['current_header']),4); |
|
| 267 | + case 4: throw new Api\Exception\WrongUserinput(lang('EGroupware configuration file (header.inc.php) version %1 exists%2', $versions['header'], '.')."\n".lang('It needs upgrading to version %1! Use --update-header <password>[,<user>] to do so (--usage gives more options).', $versions['current_header']), 4); |
|
| 268 | 268 | } |
| 269 | 269 | if ($header_checks) |
| 270 | 270 | { |
| 271 | - $messages[] = self::_echo_message($verbose,lang('EGroupware configuration file (header.inc.php) version %1 exists%2', |
|
| 272 | - $versions['header'],' '.lang('and is up to date'))); |
|
| 271 | + $messages[] = self::_echo_message($verbose, lang('EGroupware configuration file (header.inc.php) version %1 exists%2', |
|
| 272 | + $versions['header'], ' '.lang('and is up to date'))); |
|
| 273 | 273 | } |
| 274 | - unset($header_checks); // no further output of the header checks |
|
| 274 | + unset($header_checks); // no further output of the header checks |
|
| 275 | 275 | |
| 276 | 276 | $domains = $GLOBALS['egw_domain']; |
| 277 | 277 | if ($domain) // domain to check given |
| 278 | 278 | { |
| 279 | - if (!isset($GLOBALS['egw_domain'][$domain])) throw new Api\Exception\WrongUserinput(lang("Domain '%1' does NOT exist !!!",$domain), 92); |
|
| 279 | + if (!isset($GLOBALS['egw_domain'][$domain])) throw new Api\Exception\WrongUserinput(lang("Domain '%1' does NOT exist !!!", $domain), 92); |
|
| 280 | 280 | |
| 281 | 281 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
| 282 | 282 | } |
| 283 | - foreach($domains as $domain => $data) |
|
| 283 | + foreach ($domains as $domain => $data) |
|
| 284 | 284 | { |
| 285 | - self::$egw_setup->ConfigDomain = $domain; // set the domain the setup class operates on |
|
| 285 | + self::$egw_setup->ConfigDomain = $domain; // set the domain the setup class operates on |
|
| 286 | 286 | if (count($GLOBALS['egw_domain']) > 1) |
| 287 | 287 | { |
| 288 | 288 | self::_echo_message($verbose); |
| 289 | - $messages[] = self::_echo_message($verbose,lang('EGroupware domain/instance %1(%2):',$domain,$data['db_type'])); |
|
| 289 | + $messages[] = self::_echo_message($verbose, lang('EGroupware domain/instance %1(%2):', $domain, $data['db_type'])); |
|
| 290 | 290 | } |
| 291 | 291 | $setup_info = self::$egw_setup->detection->get_versions(); |
| 292 | 292 | // check if there's already a db-connection and close if, otherwise the db-connection of the previous domain will be used |
@@ -298,27 +298,27 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | $db = $data['db_type'].'://'.$data['db_user'].':'.$data['db_pass'].'@'.$data['db_host'].'/'.$data['db_name']; |
| 300 | 300 | |
| 301 | - $db_stage =& $GLOBALS['egw_info']['setup']['stage']['db']; |
|
| 301 | + $db_stage = & $GLOBALS['egw_info']['setup']['stage']['db']; |
|
| 302 | 302 | if (($db_stage = self::$egw_setup->detection->check_db($setup_info)) != 1) |
| 303 | 303 | { |
| 304 | 304 | $setup_info = self::$egw_setup->detection->get_db_versions($setup_info); |
| 305 | 305 | $db_stage = self::$egw_setup->detection->check_db($setup_info); |
| 306 | 306 | } |
| 307 | - if ($stop && in_array(10+$db_stage,$stop)) |
|
| 307 | + if ($stop && in_array(10 + $db_stage, $stop)) |
|
| 308 | 308 | { |
| 309 | 309 | return $messages; |
| 310 | 310 | } |
| 311 | - switch($db_stage) |
|
| 311 | + switch ($db_stage) |
|
| 312 | 312 | { |
| 313 | - case 1: throw new Api\Exception\WrongUserinput(lang('Your Database is not working!')." $db: ".self::$egw_setup->db->Error,11); |
|
| 313 | + case 1: throw new Api\Exception\WrongUserinput(lang('Your Database is not working!')." $db: ".self::$egw_setup->db->Error, 11); |
|
| 314 | 314 | |
| 315 | - case 3: throw new Api\Exception\WrongUserinput(lang('Your database is working, but you dont have any applications installed')." ($db). ".lang("Use --install to install EGroupware."),13); |
|
| 315 | + case 3: throw new Api\Exception\WrongUserinput(lang('Your database is working, but you dont have any applications installed')." ($db). ".lang("Use --install to install EGroupware."), 13); |
|
| 316 | 316 | |
| 317 | - case 4: throw new Api\Exception\WrongUserinput(lang('EGroupware API needs a database (schema) update from version %1 to %2!',$setup_info['phpgwapi']['currentver'],$versions['phpgwapi']).' '.lang('Use --update to do so.'),14); |
|
| 317 | + case 4: throw new Api\Exception\WrongUserinput(lang('EGroupware API needs a database (schema) update from version %1 to %2!', $setup_info['phpgwapi']['currentver'], $versions['phpgwapi']).' '.lang('Use --update to do so.'), 14); |
|
| 318 | 318 | |
| 319 | 319 | case 10: // also check apps of updates |
| 320 | 320 | self::$apps_to_upgrade = self::$apps_to_install = array(); |
| 321 | - foreach($setup_info as $app => $data) |
|
| 321 | + foreach ($setup_info as $app => $data) |
|
| 322 | 322 | { |
| 323 | 323 | if ($data['currentver'] && $data['version'] && $data['version'] != 'deleted' && $data['version'] != $data['currentver']) |
| 324 | 324 | { |
@@ -332,23 +332,23 @@ discard block |
||
| 332 | 332 | if (self::$apps_to_install) |
| 333 | 333 | { |
| 334 | 334 | self::_echo_message($verbose); |
| 335 | - $messages[] = self::_echo_message($verbose,lang('The following applications are NOT installed:').' '.implode(', ',self::$apps_to_install)); |
|
| 335 | + $messages[] = self::_echo_message($verbose, lang('The following applications are NOT installed:').' '.implode(', ', self::$apps_to_install)); |
|
| 336 | 336 | } |
| 337 | 337 | if (self::$apps_to_upgrade) |
| 338 | 338 | { |
| 339 | 339 | $db_stage = 4; |
| 340 | - if ($stop && in_array(10+$db_stage,$stop)) return $messages; |
|
| 340 | + if ($stop && in_array(10 + $db_stage, $stop)) return $messages; |
|
| 341 | 341 | |
| 342 | - throw new Api\Exception\WrongUserinput(lang('The following applications need to be upgraded:').' '.implode(', ',self::$apps_to_upgrade).'! '.lang('Use --update to do so.'),14); |
|
| 342 | + throw new Api\Exception\WrongUserinput(lang('The following applications need to be upgraded:').' '.implode(', ', self::$apps_to_upgrade).'! '.lang('Use --update to do so.'), 14); |
|
| 343 | 343 | } |
| 344 | 344 | break; |
| 345 | 345 | } |
| 346 | - $messages[] = self::_echo_message($verbose,lang("database is version %1 and up to date.",$setup_info['api']['currentver'])); |
|
| 346 | + $messages[] = self::_echo_message($verbose, lang("database is version %1 and up to date.", $setup_info['api']['currentver'])); |
|
| 347 | 347 | |
| 348 | 348 | self::$egw_setup->detection->check_config(); |
| 349 | - if ($GLOBALS['egw_info']['setup']['config_errors'] && $stop && !in_array(15,$stop)) |
|
| 349 | + if ($GLOBALS['egw_info']['setup']['config_errors'] && $stop && !in_array(15, $stop)) |
|
| 350 | 350 | { |
| 351 | - throw new Api\Exception\WrongUserinput(lang('You need to configure EGroupware:')."\n- ".@implode("\n- ",$GLOBALS['egw_info']['setup']['config_errors']),15); |
|
| 351 | + throw new Api\Exception\WrongUserinput(lang('You need to configure EGroupware:')."\n- ".@implode("\n- ", $GLOBALS['egw_info']['setup']['config_errors']), 15); |
|
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | return $messages; |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | * @param string $msg |
| 378 | 378 | * @return string $msg |
| 379 | 379 | */ |
| 380 | - static function _echo_message($verbose,$msg='') |
|
| 380 | + static function _echo_message($verbose, $msg = '') |
|
| 381 | 381 | { |
| 382 | 382 | if ($verbose) echo $msg."\n"; |
| 383 | 383 | |
@@ -32,14 +32,20 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | protected function _check_header_access() |
| 34 | 34 | { |
| 35 | - if (!$this->header_secret && $this->header_admin_user) // no secret specified but header_admin_user/password |
|
| 35 | + if (!$this->header_secret && $this->header_admin_user) |
|
| 36 | + { |
|
| 37 | + // no secret specified but header_admin_user/password |
|
| 36 | 38 | { |
| 37 | 39 | if (!$this->uid) $this->uid = true; |
| 40 | + } |
|
| 38 | 41 | $this->set_header_secret($this->header_admin_user,$this->header_admin_password); |
| 39 | 42 | } |
| 40 | 43 | $secret = $this->_calc_header_secret($GLOBALS['egw_info']['server']['header_admin_user'], |
| 41 | 44 | $GLOBALS['egw_info']['server']['header_admin_password']); |
| 42 | - if ($this->uid === true) unset($this->uid); |
|
| 45 | + if ($this->uid === true) |
|
| 46 | + { |
|
| 47 | + unset($this->uid); |
|
| 48 | + } |
|
| 43 | 49 | |
| 44 | 50 | if ($this->header_secret != $secret) |
| 45 | 51 | { |
@@ -57,10 +63,13 @@ discard block |
||
| 57 | 63 | */ |
| 58 | 64 | public function set_header_secret($user,$pw) |
| 59 | 65 | { |
| 60 | - if ($this->uid || parent::save(false)) // we need to save first, to get the uid |
|
| 66 | + if ($this->uid || parent::save(false)) |
|
| 67 | + { |
|
| 68 | + // we need to save first, to get the uid |
|
| 61 | 69 | { |
| 62 | 70 | $this->header_secret = $this->_calc_header_secret($user,$pw); |
| 63 | 71 | } |
| 72 | + } |
|
| 64 | 73 | else |
| 65 | 74 | { |
| 66 | 75 | throw new Exception ('failed to set header_secret!'); |
@@ -78,7 +87,10 @@ discard block |
||
| 78 | 87 | */ |
| 79 | 88 | private function _calc_header_secret($header_admin_user=null,$header_admin_password=null) |
| 80 | 89 | { |
| 81 | - if (!self::is_md5($header_admin_password)) $header_admin_password = md5($header_admin_password); |
|
| 90 | + if (!self::is_md5($header_admin_password)) |
|
| 91 | + { |
|
| 92 | + $header_admin_password = md5($header_admin_password); |
|
| 93 | + } |
|
| 82 | 94 | |
| 83 | 95 | $secret = md5($this->uid.$header_admin_user.$header_admin_password); |
| 84 | 96 | //echo "header_secret='$secret' = md5('$this->uid'.'$header_admin_user'.'$header_admin_password')\n"; |
@@ -135,7 +147,10 @@ discard block |
||
| 135 | 147 | self::$egw_accounts_backup = $GLOBALS['egw']->accounts; |
| 136 | 148 | unset($GLOBALS['egw']->accounts); |
| 137 | 149 | } |
| 138 | - if ($this->config) self::$egw_setup->setup_account_object($this->config); |
|
| 150 | + if ($this->config) |
|
| 151 | + { |
|
| 152 | + self::$egw_setup->setup_account_object($this->config); |
|
| 153 | + } |
|
| 139 | 154 | } |
| 140 | 155 | if (is_object($GLOBALS['egw']->db) && $domain) |
| 141 | 156 | { |
@@ -184,7 +199,9 @@ discard block |
||
| 184 | 199 | self::_setup_enviroment($domain); |
| 185 | 200 | |
| 186 | 201 | // check the authentication if a header_admin_password is set, if not we dont have a header yet and no authentication |
| 187 | - if ($GLOBALS['egw_info']['server']['header_admin_password']) // if that's not given we dont have a header yet |
|
| 202 | + if ($GLOBALS['egw_info']['server']['header_admin_password']) |
|
| 203 | + { |
|
| 204 | + // if that's not given we dont have a header yet |
|
| 188 | 205 | { |
| 189 | 206 | if (!self::$egw_setup->check_auth($user,$pw,$GLOBALS['egw_info']['server']['header_admin_user'], |
| 190 | 207 | $GLOBALS['egw_info']['server']['header_admin_password']) && |
@@ -195,6 +212,7 @@ discard block |
||
| 195 | 212 | if (is_null($domain)) |
| 196 | 213 | { |
| 197 | 214 | throw new Api\Exception\NoPermission(lang('Access denied: wrong username or password for manage-header !!!'),21); |
| 215 | + } |
|
| 198 | 216 | } |
| 199 | 217 | else |
| 200 | 218 | { |
@@ -236,7 +254,10 @@ discard block |
||
| 236 | 254 | |
| 237 | 255 | $messages = array(); |
| 238 | 256 | |
| 239 | - if ($stop && !is_array($stop)) $stop = array($stop); |
|
| 257 | + if ($stop && !is_array($stop)) |
|
| 258 | + { |
|
| 259 | + $stop = array($stop); |
|
| 260 | + } |
|
| 240 | 261 | |
| 241 | 262 | $versions =& $GLOBALS['egw_info']['server']['versions']; |
| 242 | 263 | |
@@ -254,7 +275,10 @@ discard block |
||
| 254 | 275 | $messages[] = self::_echo_message($verbose,lang('EGroupware API version %1 found.',$versions['api'])); |
| 255 | 276 | } |
| 256 | 277 | $header_stage = self::$egw_setup->detection->check_header(); |
| 257 | - if ($stop && in_array($header_stage,$stop)) return true; |
|
| 278 | + if ($stop && in_array($header_stage,$stop)) |
|
| 279 | + { |
|
| 280 | + return true; |
|
| 281 | + } |
|
| 258 | 282 | |
| 259 | 283 | switch ($header_stage) |
| 260 | 284 | { |
@@ -274,9 +298,12 @@ discard block |
||
| 274 | 298 | unset($header_checks); // no further output of the header checks |
| 275 | 299 | |
| 276 | 300 | $domains = $GLOBALS['egw_domain']; |
| 277 | - if ($domain) // domain to check given |
|
| 301 | + if ($domain) |
|
| 302 | + { |
|
| 303 | + // domain to check given |
|
| 278 | 304 | { |
| 279 | 305 | if (!isset($GLOBALS['egw_domain'][$domain])) throw new Api\Exception\WrongUserinput(lang("Domain '%1' does NOT exist !!!",$domain), 92); |
| 306 | + } |
|
| 280 | 307 | |
| 281 | 308 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
| 282 | 309 | } |
@@ -324,10 +351,13 @@ discard block |
||
| 324 | 351 | { |
| 325 | 352 | self::$apps_to_upgrade[] = $app; |
| 326 | 353 | } |
| 327 | - if (!isset($data['enabled']) && isset($data['version'])) // jdots eg. is no app, but a template |
|
| 354 | + if (!isset($data['enabled']) && isset($data['version'])) |
|
| 355 | + { |
|
| 356 | + // jdots eg. is no app, but a template |
|
| 328 | 357 | { |
| 329 | 358 | self::$apps_to_install[] = $app; |
| 330 | 359 | } |
| 360 | + } |
|
| 331 | 361 | } |
| 332 | 362 | if (self::$apps_to_install) |
| 333 | 363 | { |
@@ -337,7 +367,10 @@ discard block |
||
| 337 | 367 | if (self::$apps_to_upgrade) |
| 338 | 368 | { |
| 339 | 369 | $db_stage = 4; |
| 340 | - if ($stop && in_array(10+$db_stage,$stop)) return $messages; |
|
| 370 | + if ($stop && in_array(10+$db_stage,$stop)) |
|
| 371 | + { |
|
| 372 | + return $messages; |
|
| 373 | + } |
|
| 341 | 374 | |
| 342 | 375 | throw new Api\Exception\WrongUserinput(lang('The following applications need to be upgraded:').' '.implode(', ',self::$apps_to_upgrade).'! '.lang('Use --update to do so.'),14); |
| 343 | 376 | } |
@@ -379,7 +412,10 @@ discard block |
||
| 379 | 412 | */ |
| 380 | 413 | static function _echo_message($verbose,$msg='') |
| 381 | 414 | { |
| 382 | - if ($verbose) echo $msg."\n"; |
|
| 415 | + if ($verbose) |
|
| 416 | + { |
|
| 417 | + echo $msg."\n"; |
|
| 418 | + } |
|
| 383 | 419 | |
| 384 | 420 | return $msg; |
| 385 | 421 | } |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | * @version $Id$ |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -error_reporting(error_reporting() & ~E_NOTICE & ~E_STRICT); |
|
| 16 | +error_reporting(error_reporting()&~E_NOTICE&~E_STRICT); |
|
| 17 | 17 | |
| 18 | 18 | // for an old header, we need to setup the reference before including it |
| 19 | -$GLOBALS['phpgw_info'] =& $GLOBALS['egw_info']; |
|
| 19 | +$GLOBALS['phpgw_info'] = & $GLOBALS['egw_info']; |
|
| 20 | 20 | |
| 21 | 21 | $GLOBALS['egw_info'] = array( |
| 22 | 22 | 'flags' => array( |
@@ -25,48 +25,48 @@ discard block |
||
| 25 | 25 | 'currentapp' => 'setup', |
| 26 | 26 | 'noapi' => True |
| 27 | 27 | )); |
| 28 | -if(file_exists('../header.inc.php')) |
|
| 28 | +if (file_exists('../header.inc.php')) |
|
| 29 | 29 | { |
| 30 | 30 | include('../header.inc.php'); |
| 31 | 31 | } |
| 32 | 32 | // for an old header we need to setup a reference for the domains |
| 33 | -if (!is_array($GLOBALS['egw_domain'])) $GLOBALS['egw_domain'] =& $GLOBALS['phpgw_domain']; |
|
| 33 | +if (!is_array($GLOBALS['egw_domain'])) $GLOBALS['egw_domain'] = & $GLOBALS['phpgw_domain']; |
|
| 34 | 34 | |
| 35 | 35 | /* If we included the header.inc.php, but it is somehow broken, cover ourselves... */ |
| 36 | -if(!defined('EGW_SERVER_ROOT') && !defined('EGW_INCLUDE_ROOT')) |
|
| 36 | +if (!defined('EGW_SERVER_ROOT') && !defined('EGW_INCLUDE_ROOT')) |
|
| 37 | 37 | { |
| 38 | 38 | if (defined('PHPGW_SERVER_ROOT') && defined('PHPGW_INCLUDE_ROOT')) // pre 1.2 install |
| 39 | 39 | { |
| 40 | - define('EGW_SERVER_ROOT',PHPGW_SERVER_ROOT); |
|
| 41 | - define('EGW_INCLUDE_ROOT',PHPGW_INCLUDE_ROOT); |
|
| 40 | + define('EGW_SERVER_ROOT', PHPGW_SERVER_ROOT); |
|
| 41 | + define('EGW_INCLUDE_ROOT', PHPGW_INCLUDE_ROOT); |
|
| 42 | 42 | } |
| 43 | 43 | else // no install |
| 44 | 44 | { |
| 45 | - define('EGW_SERVER_ROOT',realpath('..')); |
|
| 46 | - define('EGW_INCLUDE_ROOT',realpath('..')); |
|
| 47 | - define('PHPGW_SERVER_ROOT',realpath('..')); |
|
| 48 | - define('PHPGW_INCLUDE_ROOT',realpath('..')); |
|
| 45 | + define('EGW_SERVER_ROOT', realpath('..')); |
|
| 46 | + define('EGW_INCLUDE_ROOT', realpath('..')); |
|
| 47 | + define('PHPGW_SERVER_ROOT', realpath('..')); |
|
| 48 | + define('PHPGW_INCLUDE_ROOT', realpath('..')); |
|
| 49 | 49 | } |
| 50 | - define('EGW_API_INC',EGW_SERVER_ROOT.'/phpgwapi/inc'); |
|
| 50 | + define('EGW_API_INC', EGW_SERVER_ROOT.'/phpgwapi/inc'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -require_once(EGW_INCLUDE_ROOT . '/api/src/loader/common.php'); |
|
| 53 | +require_once(EGW_INCLUDE_ROOT.'/api/src/loader/common.php'); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * function to handle multilanguage support |
| 57 | 57 | * |
| 58 | 58 | */ |
| 59 | -function lang($key,$vars=null) |
|
| 59 | +function lang($key, $vars = null) |
|
| 60 | 60 | { |
| 61 | - if(!is_array($vars)) |
|
| 61 | + if (!is_array($vars)) |
|
| 62 | 62 | { |
| 63 | 63 | $vars = func_get_args(); |
| 64 | - array_shift($vars); // remove $key |
|
| 64 | + array_shift($vars); // remove $key |
|
| 65 | 65 | } |
| 66 | 66 | return $GLOBALS['egw_setup']->translation->translate("$key", $vars); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | -if(file_exists(EGW_SERVER_ROOT.'/api/setup/setup.inc.php')) |
|
| 69 | +if (file_exists(EGW_SERVER_ROOT.'/api/setup/setup.inc.php')) |
|
| 70 | 70 | { |
| 71 | 71 | include(EGW_SERVER_ROOT.'/api/setup/setup.inc.php'); /* To set the current core version */ |
| 72 | 72 | /* This will change to just use setup_info */ |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $GLOBALS['egw_info']['server']['app_images'] = 'templates/default/images'; |
| 81 | 81 | |
| 82 | -CreateObject('setup.setup',True,True); // setup constuctor assigns itself to $GLOBALS['egw_setup'], doing it twice fails on some php4 |
|
| 83 | -$GLOBALS['phpgw_setup'] =& $GLOBALS['egw_setup']; |
|
| 82 | +CreateObject('setup.setup', True, True); // setup constuctor assigns itself to $GLOBALS['egw_setup'], doing it twice fails on some php4 |
|
| 83 | +$GLOBALS['phpgw_setup'] = & $GLOBALS['egw_setup']; |
|
| 84 | 84 | |
| 85 | -if (!function_exists('version_compare') || version_compare(PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,'<')) |
|
| 85 | +if (!function_exists('version_compare') || version_compare(PHP_VERSION, $GLOBALS['egw_setup']->required_php_version, '<')) |
|
| 86 | 86 | { |
| 87 | 87 | if (isset($_SERVER['HTTP_HOST'])) echo "<pre>\n"; |
| 88 | 88 | echo "EGroupware now requires PHP {$GLOBALS['egw_setup']->required_php_version} or greater.\nYour PHP version is: ".PHP_VERSION."\n"; |
@@ -30,14 +30,20 @@ discard block |
||
| 30 | 30 | include('../header.inc.php'); |
| 31 | 31 | } |
| 32 | 32 | // for an old header we need to setup a reference for the domains |
| 33 | -if (!is_array($GLOBALS['egw_domain'])) $GLOBALS['egw_domain'] =& $GLOBALS['phpgw_domain']; |
|
| 33 | +if (!is_array($GLOBALS['egw_domain'])) |
|
| 34 | +{ |
|
| 35 | + $GLOBALS['egw_domain'] =& $GLOBALS['phpgw_domain']; |
|
| 36 | +} |
|
| 34 | 37 | |
| 35 | 38 | /* If we included the header.inc.php, but it is somehow broken, cover ourselves... */ |
| 36 | 39 | if(!defined('EGW_SERVER_ROOT') && !defined('EGW_INCLUDE_ROOT')) |
| 37 | 40 | { |
| 38 | - if (defined('PHPGW_SERVER_ROOT') && defined('PHPGW_INCLUDE_ROOT')) // pre 1.2 install |
|
| 41 | + if (defined('PHPGW_SERVER_ROOT') && defined('PHPGW_INCLUDE_ROOT')) |
|
| 42 | + { |
|
| 43 | + // pre 1.2 install |
|
| 39 | 44 | { |
| 40 | 45 | define('EGW_SERVER_ROOT',PHPGW_SERVER_ROOT); |
| 46 | + } |
|
| 41 | 47 | define('EGW_INCLUDE_ROOT',PHPGW_INCLUDE_ROOT); |
| 42 | 48 | } |
| 43 | 49 | else // no install |
@@ -84,7 +90,10 @@ discard block |
||
| 84 | 90 | |
| 85 | 91 | if (!function_exists('version_compare') || version_compare(PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,'<')) |
| 86 | 92 | { |
| 87 | - if (isset($_SERVER['HTTP_HOST'])) echo "<pre>\n"; |
|
| 93 | + if (isset($_SERVER['HTTP_HOST'])) |
|
| 94 | + { |
|
| 95 | + echo "<pre>\n"; |
|
| 96 | + } |
|
| 88 | 97 | echo "EGroupware now requires PHP {$GLOBALS['egw_setup']->required_php_version} or greater.\nYour PHP version is: ".PHP_VERSION."\n"; |
| 89 | 98 | echo 'Please contact your System Administrator.'; |
| 90 | 99 | exit; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param array $config =array() configuration to preset the defaults during the install, eg. set the account_repository |
| 35 | 35 | * @param string $lang ='en' |
| 36 | 36 | */ |
| 37 | - function __construct($domain,$config_user=null,$config_passwd=null,$backup=null,$charset='utf-8',$verbose=false,array $config=array(),$lang='en') |
|
| 37 | + function __construct($domain, $config_user = null, $config_passwd = null, $backup = null, $charset = 'utf-8', $verbose = false, array $config = array(), $lang = 'en') |
|
| 38 | 38 | { |
| 39 | 39 | if (!is_array($domain)) |
| 40 | 40 | { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'lang' => $lang, |
| 50 | 50 | ); |
| 51 | 51 | } |
| 52 | - elseif(!$domain['charset']) |
|
| 52 | + elseif (!$domain['charset']) |
|
| 53 | 53 | { |
| 54 | 54 | $domain['charset'] = 'utf-8'; |
| 55 | 55 | } |
@@ -65,24 +65,24 @@ discard block |
||
| 65 | 65 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
| 66 | 66 | * @throws Exception('header.inc.php not found!'); |
| 67 | 67 | */ |
| 68 | - protected function exec($check_only=false) |
|
| 68 | + protected function exec($check_only = false) |
|
| 69 | 69 | { |
| 70 | - unset($check_only); // not used; |
|
| 70 | + unset($check_only); // not used; |
|
| 71 | 71 | global $setup_info; |
| 72 | 72 | |
| 73 | 73 | // instanciate setup object and check authorisation |
| 74 | - $this->check_setup_auth($this->config_user,$this->config_passwd,$this->domain); |
|
| 74 | + $this->check_setup_auth($this->config_user, $this->config_passwd, $this->domain); |
|
| 75 | 75 | |
| 76 | - $this->check_installed($this->domain,array(13,14,20),$this->verbose); |
|
| 76 | + $this->check_installed($this->domain, array(13, 14, 20), $this->verbose); |
|
| 77 | 77 | |
| 78 | 78 | // use uploaded backup, instead installing from scratch |
| 79 | 79 | if ($this->backup) |
| 80 | 80 | { |
| 81 | 81 | $db_backup = new db_backup(); |
| 82 | 82 | |
| 83 | - if (!is_resource($f = $db_backup->fopen_backup($this->backup,true))) |
|
| 83 | + if (!is_resource($f = $db_backup->fopen_backup($this->backup, true))) |
|
| 84 | 84 | { |
| 85 | - throw new Api\Exception\WrongUserinput(lang('Restore failed').' ('.$f.')',31); |
|
| 85 | + throw new Api\Exception\WrongUserinput(lang('Restore failed').' ('.$f.')', 31); |
|
| 86 | 86 | } |
| 87 | 87 | if ($this->verbose) |
| 88 | 88 | { |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | else |
| 92 | 92 | { |
| 93 | - ob_start(); // restore echos the table structure |
|
| 93 | + ob_start(); // restore echos the table structure |
|
| 94 | 94 | } |
| 95 | - $db_backup->restore($f,$this->charset,$this->backup); |
|
| 95 | + $db_backup->restore($f, $this->charset, $this->backup); |
|
| 96 | 96 | fclose($f); |
| 97 | 97 | |
| 98 | 98 | if (!$this->verbose) |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | // regular (new) install |
| 105 | 105 | if ($GLOBALS['egw_info']['setup']['stage']['db'] != 3) |
| 106 | 106 | { |
| 107 | - throw new Api\Exception\WrongUserinput(lang('eGroupWare is already installed!'),30); |
|
| 107 | + throw new Api\Exception\WrongUserinput(lang('eGroupWare is already installed!'), 30); |
|
| 108 | 108 | } |
| 109 | 109 | $setup_info = self::$egw_setup->detection->upgrade_exclude($setup_info); |
| 110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $_POST['ConfigLang'] = $this->lang; |
| 115 | 115 | |
| 116 | 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); |
|
| 117 | + if (true) $setup_info = self::$egw_setup->process->pass($setup_info, 'new', false, True, $this->config); |
|
| 118 | 118 | |
| 119 | 119 | $this->restore_db(); |
| 120 | 120 | |
@@ -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 | |
@@ -28,54 +28,54 @@ discard block |
||
| 28 | 28 | // variable names with underscores. |
| 29 | 29 | |
| 30 | 30 | $GLOBALS['header_template']->set_file(array('header' => 'header.inc.php.template')); |
| 31 | - $GLOBALS['header_template']->set_block('header','domain','domain'); |
|
| 31 | + $GLOBALS['header_template']->set_block('header', 'domain', 'domain'); |
|
| 32 | 32 | $var = Array(); |
| 33 | 33 | |
| 34 | 34 | $deletedomain = $_POST['deletedomain']; |
| 35 | 35 | $domains = $_POST['domains']; |
| 36 | 36 | |
| 37 | - foreach($domains as $k => $v) |
|
| 37 | + foreach ($domains as $k => $v) |
|
| 38 | 38 | { |
| 39 | - if(is_array($deletedomain) && isset($deletedomain[$k])) |
|
| 39 | + if (is_array($deletedomain) && isset($deletedomain[$k])) |
|
| 40 | 40 | { |
| 41 | 41 | continue; |
| 42 | 42 | } |
| 43 | - $variableName = str_replace('.','_',$k); |
|
| 43 | + $variableName = str_replace('.', '_', $k); |
|
| 44 | 44 | $dom = $_POST['setting_'.$variableName]; |
| 45 | - $GLOBALS['header_template']->set_var('DB_DOMAIN',$v); |
|
| 46 | - foreach($dom as $x => $y) |
|
| 45 | + $GLOBALS['header_template']->set_var('DB_DOMAIN', $v); |
|
| 46 | + foreach ($dom as $x => $y) |
|
| 47 | 47 | { |
| 48 | - if(strtoupper($x) == 'CONFIG_PASS') |
|
| 48 | + if (strtoupper($x) == 'CONFIG_PASS') |
|
| 49 | 49 | { |
| 50 | - $GLOBALS['header_template']->set_var(strtoupper($x),md5($y)); |
|
| 50 | + $GLOBALS['header_template']->set_var(strtoupper($x), md5($y)); |
|
| 51 | 51 | } |
| 52 | 52 | else |
| 53 | 53 | { |
| 54 | - $GLOBALS['header_template']->set_var(strtoupper($x),$y); |
|
| 54 | + $GLOBALS['header_template']->set_var(strtoupper($x), $y); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | /* Admin did not type a new password, so use the old one from the hidden field, |
| 58 | 58 | * which is already md5 encoded. |
| 59 | 59 | */ |
| 60 | - if($dom['config_password'] && !$dom['config_pass']) |
|
| 60 | + if ($dom['config_password'] && !$dom['config_pass']) |
|
| 61 | 61 | { |
| 62 | 62 | /* Real == hidden */ |
| 63 | - $GLOBALS['header_template']->set_var('CONFIG_PASS',$dom['config_password']); |
|
| 63 | + $GLOBALS['header_template']->set_var('CONFIG_PASS', $dom['config_password']); |
|
| 64 | 64 | } |
| 65 | 65 | /* If the admin didn't select a db_port, set to the default */ |
| 66 | - if(!$dom['db_port']) |
|
| 66 | + if (!$dom['db_port']) |
|
| 67 | 67 | { |
| 68 | - $GLOBALS['header_template']->set_var('DB_PORT',$GLOBALS['default_db_ports'][$dom['db_type']]); |
|
| 68 | + $GLOBALS['header_template']->set_var('DB_PORT', $GLOBALS['default_db_ports'][$dom['db_type']]); |
|
| 69 | 69 | } |
| 70 | - $GLOBALS['header_template']->parse('domains','domain',True); |
|
| 70 | + $GLOBALS['header_template']->parse('domains', 'domain', True); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $GLOBALS['header_template']->set_var('domain',''); |
|
| 73 | + $GLOBALS['header_template']->set_var('domain', ''); |
|
| 74 | 74 | |
| 75 | 75 | $setting = $_POST['setting']; |
| 76 | - while($setting && list($k,$v) = @each($setting)) |
|
| 76 | + while ($setting && list($k, $v) = @each($setting)) |
|
| 77 | 77 | { |
| 78 | - if(strtoupper($k) == 'HEADER_ADMIN_PASSWORD') |
|
| 78 | + if (strtoupper($k) == 'HEADER_ADMIN_PASSWORD') |
|
| 79 | 79 | { |
| 80 | 80 | $var[strtoupper($k)] = md5($v); |
| 81 | 81 | } |
@@ -87,21 +87,21 @@ discard block |
||
| 87 | 87 | /* Admin did not type a new header password, so use the old one from the hidden field, |
| 88 | 88 | * which is already md5 encoded. |
| 89 | 89 | */ |
| 90 | - if($var['HEADER_ADMIN_PASS'] && empty($setting['HEADER_ADMIN_PASSWORD'])) |
|
| 90 | + if ($var['HEADER_ADMIN_PASS'] && empty($setting['HEADER_ADMIN_PASSWORD'])) |
|
| 91 | 91 | { |
| 92 | 92 | /* Real == hidden */ |
| 93 | 93 | $var['HEADER_ADMIN_PASSWORD'] = $var['HEADER_ADMIN_PASS']; |
| 94 | 94 | } |
| 95 | 95 | $GLOBALS['header_template']->set_var($var); |
| 96 | - return $GLOBALS['header_template']->parse('out','header'); |
|
| 96 | + return $GLOBALS['header_template']->parse('out', 'header'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - static function setup_tpl_dir($app_name='setup') |
|
| 99 | + static function setup_tpl_dir($app_name = 'setup') |
|
| 100 | 100 | { |
| 101 | 101 | /* hack to get tpl dir */ |
| 102 | 102 | if (is_dir(EGW_SERVER_ROOT)) |
| 103 | 103 | { |
| 104 | - $srv_root = EGW_SERVER_ROOT . '/' . $app_name . '/'; |
|
| 104 | + $srv_root = EGW_SERVER_ROOT.'/'.$app_name.'/'; |
|
| 105 | 105 | } |
| 106 | 106 | else |
| 107 | 107 | { |
@@ -109,16 +109,16 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $tpl_typical = 'templates/default'; |
| 112 | - $tpl_root = "$srv_root" ."$tpl_typical"; |
|
| 112 | + $tpl_root = "$srv_root"."$tpl_typical"; |
|
| 113 | 113 | return $tpl_root; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - static function show_header($title='',$nologoutbutton=False, $logoutfrom='config', $configdomain='') |
|
| 116 | + static function show_header($title = '', $nologoutbutton = False, $logoutfrom = 'config', $configdomain = '') |
|
| 117 | 117 | { |
| 118 | 118 | // add a content-type header to overwrite an existing default charset in apache (AddDefaultCharset directiv) |
| 119 | 119 | header('Content-type: text/html; charset='.$GLOBALS['egw_setup']->system_charset); |
| 120 | 120 | |
| 121 | - $GLOBALS['setup_tpl']->set_var('charset',$GLOBALS['egw_setup']->system_charset); |
|
| 121 | + $GLOBALS['setup_tpl']->set_var('charset', $GLOBALS['egw_setup']->system_charset); |
|
| 122 | 122 | $style = array( |
| 123 | 123 | 'th_bg' => '#486591', |
| 124 | 124 | 'th_text' => '#FFFFFF', |
@@ -130,34 +130,34 @@ discard block |
||
| 130 | 130 | $GLOBALS['setup_tpl']->set_var($style); |
| 131 | 131 | if ($nologoutbutton) |
| 132 | 132 | { |
| 133 | - $GLOBALS['setup_tpl']->set_block('T_head','loged_in'); |
|
| 134 | - $GLOBALS['setup_tpl']->set_var('loged_in',''); |
|
| 133 | + $GLOBALS['setup_tpl']->set_block('T_head', 'loged_in'); |
|
| 134 | + $GLOBALS['setup_tpl']->set_var('loged_in', ''); |
|
| 135 | 135 | } |
| 136 | 136 | else |
| 137 | 137 | { |
| 138 | - $btn_logout = '<a href="index.php?FormLogout=' . $logoutfrom . '" class="link">' . lang('Logout').'</a>'; |
|
| 138 | + $btn_logout = '<a href="index.php?FormLogout='.$logoutfrom.'" class="link">'.lang('Logout').'</a>'; |
|
| 139 | 139 | $check_install = '<a class="textsidebox" href="check_install.php">'.lang('Check installation').'</a>'; |
| 140 | 140 | $register_hooks = '<a class="textsidebox" href="applications.php?hooks=1">'.lang('Clear cache and register hooks').'</a>'; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $GLOBALS['setup_tpl']->set_var('lang_setup', lang('setup')); |
| 144 | - $GLOBALS['setup_tpl']->set_var('page_title',$title); |
|
| 144 | + $GLOBALS['setup_tpl']->set_var('page_title', $title); |
|
| 145 | 145 | if ($configdomain == '') |
| 146 | 146 | { |
| 147 | - $GLOBALS['setup_tpl']->set_var('configdomain',''); |
|
| 147 | + $GLOBALS['setup_tpl']->set_var('configdomain', ''); |
|
| 148 | 148 | } |
| 149 | 149 | else |
| 150 | 150 | { |
| 151 | - $GLOBALS['setup_tpl']->set_var('configdomain',' - ' . lang('Domain') . ': ' . $configdomain); |
|
| 151 | + $GLOBALS['setup_tpl']->set_var('configdomain', ' - '.lang('Domain').': '.$configdomain); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if(basename($_SERVER['SCRIPT_FILENAME']) != 'index.php') |
|
| 154 | + if (basename($_SERVER['SCRIPT_FILENAME']) != 'index.php') |
|
| 155 | 155 | { |
| 156 | - $index_btn = '<a href="index.php" class="link">' . lang('Setup Main Menu') . '</a>'; |
|
| 156 | + $index_btn = '<a href="index.php" class="link">'.lang('Setup Main Menu').'</a>'; |
|
| 157 | 157 | $index_img = '<img src="../api/templates/default/images/bullet.png" />'; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - $GLOBALS['setup_tpl']->set_var('lang_version',lang('version')); |
|
| 160 | + $GLOBALS['setup_tpl']->set_var('lang_version', lang('version')); |
|
| 161 | 161 | if (!isset($GLOBALS['setup_info']) || !isset($GLOBALS['setup_info']['api'])) |
| 162 | 162 | { |
| 163 | 163 | include(EGW_SERVER_ROOT.'/api/setup/setup.inc.php'); |
@@ -179,66 +179,66 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | // manual / help link to the install manual on egroupware.org |
| 181 | 181 | $manual_remote_egw_url = 'http://manual.egroupware.org/egroupware'; |
| 182 | - $url_parts = explode('/',$_SERVER['PHP_SELF']); |
|
| 182 | + $url_parts = explode('/', $_SERVER['PHP_SELF']); |
|
| 183 | 183 | $script = array_pop($url_parts); |
| 184 | 184 | $lang = setup::get_lang(); |
| 185 | 185 | $url = $manual_remote_egw_url.'/manual/index.php?referer='.urlencode($manual_remote_egw_url.'/setup/'.$script). |
| 186 | 186 | ($lang ? '&lang='.urlencode($lang) : ''); |
| 187 | - $GLOBALS['setup_tpl']->set_var('manual','<a href="'.$url.'" target="manual" onclick="'. |
|
| 187 | + $GLOBALS['setup_tpl']->set_var('manual', '<a href="'.$url.'" target="manual" onclick="'. |
|
| 188 | 188 | "window.open('$url','manual','width=800,height=600,scrollbars=yes,resizable=yes'); return false;".'">'. |
| 189 | 189 | htmlspecialchars(lang('Manual / help')).'</a>'); |
| 190 | 190 | |
| 191 | - $GLOBALS['setup_tpl']->pparse('out','T_head'); |
|
| 191 | + $GLOBALS['setup_tpl']->pparse('out', 'T_head'); |
|
| 192 | 192 | /* $setup_tpl->set_var('T_head',''); */ |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | static function show_footer() |
| 196 | 196 | { |
| 197 | - $GLOBALS['setup_tpl']->pparse('out','T_footer'); |
|
| 197 | + $GLOBALS['setup_tpl']->pparse('out', 'T_footer'); |
|
| 198 | 198 | unset($GLOBALS['setup_tpl']); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - static function show_alert_msg($alert_word='Setup alert',$alert_msg='setup alert (generic)') |
|
| 201 | + static function show_alert_msg($alert_word = 'Setup alert', $alert_msg = 'setup alert (generic)') |
|
| 202 | 202 | { |
| 203 | - $GLOBALS['setup_tpl']->set_var('V_alert_word',$alert_word); |
|
| 204 | - $GLOBALS['setup_tpl']->set_var('V_alert_msg',$alert_msg); |
|
| 205 | - $GLOBALS['setup_tpl']->pparse('out','T_alert_msg'); |
|
| 203 | + $GLOBALS['setup_tpl']->set_var('V_alert_word', $alert_word); |
|
| 204 | + $GLOBALS['setup_tpl']->set_var('V_alert_msg', $alert_msg); |
|
| 205 | + $GLOBALS['setup_tpl']->pparse('out', 'T_alert_msg'); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - static function make_frm_btn_simple($pre_frm_blurb='',$frm_method='post',$frm_action='',$input_type='submit',$input_value='',$post_frm_blurb='') |
|
| 208 | + static function make_frm_btn_simple($pre_frm_blurb = '', $frm_method = 'post', $frm_action = '', $input_type = 'submit', $input_value = '', $post_frm_blurb = '') |
|
| 209 | 209 | { |
| 210 | 210 | /* a simple form has simple components */ |
| 211 | - $simple_form = $pre_frm_blurb ."\n" |
|
| 212 | - . '<form method="' . $frm_method . '" action="' . $frm_action . '">' . "\n" |
|
| 213 | - . '<input type="' . $input_type . '" value="' . $input_value . '" />' . "\n" |
|
| 214 | - . '</form>' . "\n" |
|
| 215 | - . $post_frm_blurb . "\n"; |
|
| 211 | + $simple_form = $pre_frm_blurb."\n" |
|
| 212 | + . '<form method="'.$frm_method.'" action="'.$frm_action.'">'."\n" |
|
| 213 | + . '<input type="'.$input_type.'" value="'.$input_value.'" />'."\n" |
|
| 214 | + . '</form>'."\n" |
|
| 215 | + . $post_frm_blurb."\n"; |
|
| 216 | 216 | return $simple_form; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - static function make_href_link_simple($pre_link_blurb='',$href_link='',$href_text='default text',$post_link_blurb='') |
|
| 219 | + static function make_href_link_simple($pre_link_blurb = '', $href_link = '', $href_text = 'default text', $post_link_blurb = '') |
|
| 220 | 220 | { |
| 221 | 221 | /* a simple href link has simple components */ |
| 222 | 222 | $simple_link = $pre_link_blurb |
| 223 | - . '<a href="' . $href_link . '">' . $href_text . '</a> ' |
|
| 224 | - . $post_link_blurb . "\n"; |
|
| 223 | + . '<a href="'.$href_link.'">'.$href_text.'</a> ' |
|
| 224 | + . $post_link_blurb."\n"; |
|
| 225 | 225 | return $simple_link; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | static function login_form() |
| 229 | 229 | { |
| 230 | 230 | /* begin use TEMPLATE login_main.tpl */ |
| 231 | - $GLOBALS['setup_tpl']->set_var('ConfigLoginMSG',@$GLOBALS['egw_info']['setup']['ConfigLoginMSG']); |
|
| 232 | - $GLOBALS['setup_tpl']->set_var('HeaderLoginMSG',@$GLOBALS['egw_info']['setup']['HeaderLoginMSG']); |
|
| 233 | - $GLOBALS['setup_tpl']->set_var('lang_header_username',lang('Header Username')); |
|
| 234 | - $GLOBALS['setup_tpl']->set_var('lang_header_password',lang('Header Password')); |
|
| 235 | - $GLOBALS['setup_tpl']->set_var('lang_header_login',lang('Header Admin Login')); |
|
| 236 | - $GLOBALS['setup_tpl']->set_var('lang_config_login',lang('Setup/Config Admin Login')); |
|
| 237 | - $GLOBALS['setup_tpl']->set_var('lang_config_username',lang('Config Username')); |
|
| 238 | - $GLOBALS['setup_tpl']->set_var('lang_config_password',lang('Config Password')); |
|
| 239 | - $GLOBALS['setup_tpl']->set_var('lang_domain',lang('Domain')); |
|
| 231 | + $GLOBALS['setup_tpl']->set_var('ConfigLoginMSG', @$GLOBALS['egw_info']['setup']['ConfigLoginMSG']); |
|
| 232 | + $GLOBALS['setup_tpl']->set_var('HeaderLoginMSG', @$GLOBALS['egw_info']['setup']['HeaderLoginMSG']); |
|
| 233 | + $GLOBALS['setup_tpl']->set_var('lang_header_username', lang('Header Username')); |
|
| 234 | + $GLOBALS['setup_tpl']->set_var('lang_header_password', lang('Header Password')); |
|
| 235 | + $GLOBALS['setup_tpl']->set_var('lang_header_login', lang('Header Admin Login')); |
|
| 236 | + $GLOBALS['setup_tpl']->set_var('lang_config_login', lang('Setup/Config Admin Login')); |
|
| 237 | + $GLOBALS['setup_tpl']->set_var('lang_config_username', lang('Config Username')); |
|
| 238 | + $GLOBALS['setup_tpl']->set_var('lang_config_password', lang('Config Password')); |
|
| 239 | + $GLOBALS['setup_tpl']->set_var('lang_domain', lang('Domain')); |
|
| 240 | 240 | |
| 241 | - $GLOBALS['setup_tpl']->set_var('lang_select',self::lang_select()); |
|
| 241 | + $GLOBALS['setup_tpl']->set_var('lang_select', self::lang_select()); |
|
| 242 | 242 | |
| 243 | 243 | if ($GLOBALS['egw_info']['setup']['stage']['header'] == '10') |
| 244 | 244 | { |
@@ -248,54 +248,54 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | if (count($GLOBALS['egw_domain']) > 1) |
| 250 | 250 | { |
| 251 | - foreach(array_keys($GLOBALS['egw_domain']) as $domain) |
|
| 251 | + foreach (array_keys($GLOBALS['egw_domain']) as $domain) |
|
| 252 | 252 | { |
| 253 | 253 | $domains .= "<option value=\"$domain\" ".($domain == @$GLOBALS['egw_info']['setup']['LastDomain'] ? ' selected="selected"' : '').">$domain</option>\n"; |
| 254 | 254 | } |
| 255 | - $GLOBALS['setup_tpl']->set_var('domains',$domains); |
|
| 255 | + $GLOBALS['setup_tpl']->set_var('domains', $domains); |
|
| 256 | 256 | |
| 257 | 257 | // use BLOCK B_multi_domain inside of login_stage_header |
| 258 | - $GLOBALS['setup_tpl']->parse('V_multi_domain','B_multi_domain'); |
|
| 258 | + $GLOBALS['setup_tpl']->parse('V_multi_domain', 'B_multi_domain'); |
|
| 259 | 259 | // in this case, the single domain block needs to be nothing |
| 260 | - $GLOBALS['setup_tpl']->set_var('V_single_domain',''); |
|
| 260 | + $GLOBALS['setup_tpl']->set_var('V_single_domain', ''); |
|
| 261 | 261 | } |
| 262 | 262 | else |
| 263 | 263 | { |
| 264 | 264 | reset($GLOBALS['egw_domain']); |
| 265 | 265 | $default_domain = each($GLOBALS['egw_domain']); |
| 266 | - $GLOBALS['setup_tpl']->set_var('default_domain_zero',$default_domain[0]); |
|
| 266 | + $GLOBALS['setup_tpl']->set_var('default_domain_zero', $default_domain[0]); |
|
| 267 | 267 | |
| 268 | 268 | /* Use BLOCK B_single_domain inside of login_stage_header */ |
| 269 | - $GLOBALS['setup_tpl']->parse('V_single_domain','B_single_domain'); |
|
| 269 | + $GLOBALS['setup_tpl']->parse('V_single_domain', 'B_single_domain'); |
|
| 270 | 270 | /* in this case, the multi domain block needs to be nothing */ |
| 271 | - $GLOBALS['setup_tpl']->set_var('V_multi_domain',''); |
|
| 271 | + $GLOBALS['setup_tpl']->set_var('V_multi_domain', ''); |
|
| 272 | 272 | } |
| 273 | 273 | /* |
| 274 | 274 | End use SUB-TEMPLATE login_stage_header |
| 275 | 275 | put all this into V_login_stage_header for use inside login_main |
| 276 | 276 | */ |
| 277 | - $GLOBALS['setup_tpl']->parse('V_login_stage_header','T_login_stage_header'); |
|
| 277 | + $GLOBALS['setup_tpl']->parse('V_login_stage_header', 'T_login_stage_header'); |
|
| 278 | 278 | } |
| 279 | 279 | else |
| 280 | 280 | { |
| 281 | 281 | /* begin SKIP SUB-TEMPLATE login_stage_header */ |
| 282 | - $GLOBALS['setup_tpl']->set_var('V_multi_domain',''); |
|
| 283 | - $GLOBALS['setup_tpl']->set_var('V_single_domain',''); |
|
| 284 | - $GLOBALS['setup_tpl']->set_var('V_login_stage_header',''); |
|
| 282 | + $GLOBALS['setup_tpl']->set_var('V_multi_domain', ''); |
|
| 283 | + $GLOBALS['setup_tpl']->set_var('V_single_domain', ''); |
|
| 284 | + $GLOBALS['setup_tpl']->set_var('V_login_stage_header', ''); |
|
| 285 | 285 | } |
| 286 | 286 | /* |
| 287 | 287 | end use TEMPLATE login_main.tpl |
| 288 | 288 | now out the login_main template |
| 289 | 289 | */ |
| 290 | - $GLOBALS['setup_tpl']->pparse('out','T_login_main'); |
|
| 290 | + $GLOBALS['setup_tpl']->pparse('out', 'T_login_main'); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - static function lang_select($onChange=False,$ConfigLang='') |
|
| 293 | + static function lang_select($onChange = False, $ConfigLang = '') |
|
| 294 | 294 | { |
| 295 | 295 | if (empty($ConfigLang)) |
| 296 | 296 | { |
| 297 | 297 | $ConfigLang = setup::get_lang(); |
| 298 | - if (empty($ConfigLang)) $ConfigLang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2); |
|
| 298 | + if (empty($ConfigLang)) $ConfigLang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); |
|
| 299 | 299 | } |
| 300 | 300 | return Api\Html::select('ConfigLang', $ConfigLang, Api\Translation::get_available_langs(false), true, |
| 301 | 301 | $onChange ? ' onchange="this.form.submit();"' : ''); |
@@ -303,19 +303,19 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | static function get_template_list() |
| 305 | 305 | { |
| 306 | - $d = dir(EGW_SERVER_ROOT . '/phpgwapi/templates'); |
|
| 306 | + $d = dir(EGW_SERVER_ROOT.'/phpgwapi/templates'); |
|
| 307 | 307 | |
| 308 | 308 | $list = array(); |
| 309 | - while($entry = $d->read()) |
|
| 309 | + while ($entry = $d->read()) |
|
| 310 | 310 | { |
| 311 | 311 | if ($entry != 'CVS' && $entry != '.' && $entry != '..') |
| 312 | 312 | { |
| 313 | 313 | $list[$entry]['name'] = $entry; |
| 314 | - $f = EGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry . '/details.inc.php'; |
|
| 315 | - if (file_exists ($f)) |
|
| 314 | + $f = EGW_SERVER_ROOT.'/phpgwapi/templates/'.$entry.'/details.inc.php'; |
|
| 315 | + if (file_exists($f)) |
|
| 316 | 316 | { |
| 317 | 317 | include($f); |
| 318 | - $list[$entry]['title'] = 'Use ' . $GLOBALS['egw_info']['template'][$entry]['title'] . 'interface'; |
|
| 318 | + $list[$entry]['title'] = 'Use '.$GLOBALS['egw_info']['template'][$entry]['title'].'interface'; |
|
| 319 | 319 | } |
| 320 | 320 | else |
| 321 | 321 | { |
@@ -324,22 +324,22 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | $d->close(); |
| 327 | - reset ($list); |
|
| 327 | + reset($list); |
|
| 328 | 328 | return $list; |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | static function list_themes() |
| 332 | 332 | { |
| 333 | - $dh = dir(EGW_SERVER_ROOT . '/phpgwapi/themes'); |
|
| 333 | + $dh = dir(EGW_SERVER_ROOT.'/phpgwapi/themes'); |
|
| 334 | 334 | while ($file = $dh->read()) |
| 335 | 335 | { |
| 336 | 336 | if (preg_match('/'."\.theme$".'/i', $file)) |
| 337 | 337 | { |
| 338 | - $list[] = substr($file,0,strpos($file,'.')); |
|
| 338 | + $list[] = substr($file, 0, strpos($file, '.')); |
|
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | $dh->close(); |
| 342 | - reset ($list); |
|
| 342 | + reset($list); |
|
| 343 | 343 | return $list; |
| 344 | 344 | } |
| 345 | 345 | } |
@@ -295,7 +295,10 @@ |
||
| 295 | 295 | if (empty($ConfigLang)) |
| 296 | 296 | { |
| 297 | 297 | $ConfigLang = setup::get_lang(); |
| 298 | - if (empty($ConfigLang)) $ConfigLang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2); |
|
| 298 | + if (empty($ConfigLang)) |
|
| 299 | + { |
|
| 300 | + $ConfigLang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2); |
|
| 301 | + } |
|
| 299 | 302 | } |
| 300 | 303 | return Api\Html::select('ConfigLang', $ConfigLang, Api\Translation::get_available_langs(false), true, |
| 301 | 304 | $onChange ? ' onchange="this.form.submit();"' : ''); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | $GLOBALS['header_template']->set_file(array('header' => 'header.inc.php.template')); |
| 31 | 31 | $GLOBALS['header_template']->set_block('header','domain','domain'); |
| 32 | - $var = Array(); |
|
| 32 | + $var = array(); |
|
| 33 | 33 | |
| 34 | 34 | $deletedomain = $_POST['deletedomain']; |
| 35 | 35 | $domains = $_POST['domains']; |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | if ($_POST['download']) |
| 42 | 42 | { |
| 43 | 43 | list($file) = each($_POST['download']); |
| 44 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir |
|
| 44 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir |
|
| 45 | 45 | while (@ob_end_clean()) {} // end all active output buffering |
| 46 | - ini_set('zlib.output_compression',0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit |
|
| 46 | + ini_set('zlib.output_compression', 0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit |
|
| 47 | 47 | Api\Header\Content::type(basename($file)); |
| 48 | 48 | readfile($file); |
| 49 | 49 | exit; |
@@ -61,23 +61,23 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | Api\Csrf::validate($_POST['csrf_token'], __FILE__); |
| 63 | 63 | } |
| 64 | -$setup_tpl->set_block('T_db_backup','schedule_row','schedule_rows'); |
|
| 65 | -$setup_tpl->set_block('T_db_backup','set_row','set_rows'); |
|
| 64 | +$setup_tpl->set_block('T_db_backup', 'schedule_row', 'schedule_rows'); |
|
| 65 | +$setup_tpl->set_block('T_db_backup', 'set_row', 'set_rows'); |
|
| 66 | 66 | |
| 67 | -$setup_tpl->set_var('stage_title',$stage_title = lang('DB backup and restore')); |
|
| 68 | -$setup_tpl->set_var('stage_desc',lang('This program lets you backup your database, schedule a backup or restore it.')); |
|
| 69 | -$setup_tpl->set_var('error_msg',''); |
|
| 67 | +$setup_tpl->set_var('stage_title', $stage_title = lang('DB backup and restore')); |
|
| 68 | +$setup_tpl->set_var('stage_desc', lang('This program lets you backup your database, schedule a backup or restore it.')); |
|
| 69 | +$setup_tpl->set_var('error_msg', ''); |
|
| 70 | 70 | |
| 71 | -$bgcolor = array('#DDDDDD','#EEEEEE'); |
|
| 71 | +$bgcolor = array('#DDDDDD', '#EEEEEE'); |
|
| 72 | 72 | |
| 73 | 73 | if (is_object($GLOBALS['egw_setup']->html)) |
| 74 | 74 | { |
| 75 | - $GLOBALS['egw_setup']->html->show_header($stage_title,False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
| 75 | + $GLOBALS['egw_setup']->html->show_header($stage_title, False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
| 76 | 76 | } |
| 77 | 77 | else |
| 78 | 78 | { |
| 79 | - $setup_tpl->set_block('T_db_backup','setup_header'); |
|
| 80 | - $setup_tpl->set_var('setup_header',''); |
|
| 79 | + $setup_tpl->set_block('T_db_backup', 'setup_header'); |
|
| 80 | + $setup_tpl->set_var('setup_header', ''); |
|
| 81 | 81 | $GLOBALS['egw_info']['flags']['app_header'] = $stage_title; |
| 82 | 82 | echo $GLOBALS['egw']->framework->header(); |
| 83 | 83 | echo $GLOBALS['egw']->framework->navbar(); |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | if (empty($minCount)) |
| 94 | 94 | { |
| 95 | 95 | $minCount = 0; |
| 96 | - $setup_tpl->set_var('error_msg',htmlspecialchars(lang("'%1' must be integer", lang("backup min count")))); |
|
| 96 | + $setup_tpl->set_var('error_msg', htmlspecialchars(lang("'%1' must be integer", lang("backup min count")))); |
|
| 97 | 97 | } |
| 98 | - $db_backup->saveConfig($minCount,$is_setup ? (boolean)$filesBackup : null); |
|
| 98 | + $db_backup->saveConfig($minCount, $is_setup ? (boolean)$filesBackup : null); |
|
| 99 | 99 | |
| 100 | 100 | if (is_int($minCount) && $minCount > 0) |
| 101 | 101 | { |
@@ -112,22 +112,21 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | Vfs::$is_root = true; |
| 114 | 114 | echo '<div align="center">'. |
| 115 | - (Vfs::mount('filesystem://default'.$db_backup->backup_dir.'?group=Admins&mode=070','/backup',false) ? |
|
| 116 | - lang('Backup directory %1 mounted as %2',$db_backup->backup_dir,'/backup') : |
|
| 117 | - lang('Failed to mount Backup directory!')). |
|
| 115 | + (Vfs::mount('filesystem://default'.$db_backup->backup_dir.'?group=Admins&mode=070', '/backup', false) ? |
|
| 116 | + lang('Backup directory %1 mounted as %2', $db_backup->backup_dir, '/backup') : lang('Failed to mount Backup directory!')). |
|
| 118 | 117 | "</div>\n"; |
| 119 | 118 | Vfs::$is_root = false; |
| 120 | 119 | } |
| 121 | 120 | // create a backup now |
| 122 | -if($_POST['backup']) |
|
| 121 | +if ($_POST['backup']) |
|
| 123 | 122 | { |
| 124 | 123 | if (is_resource($f = $db_backup->fopen_backup())) |
| 125 | 124 | { |
| 126 | - echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
|
| 125 | + echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ', 4096); |
|
| 127 | 126 | $db_backup->backup($f); |
| 128 | - if(is_resource($f)) |
|
| 127 | + if (is_resource($f)) |
|
| 129 | 128 | fclose($f); |
| 130 | - $setup_tpl->set_var('error_msg',lang('backup finished')); |
|
| 129 | + $setup_tpl->set_var('error_msg', lang('backup finished')); |
|
| 131 | 130 | |
| 132 | 131 | /* Remove old backups. */ |
| 133 | 132 | $cleaned_files = array(); |
@@ -139,38 +138,38 @@ discard block |
||
| 139 | 138 | } |
| 140 | 139 | else |
| 141 | 140 | { |
| 142 | - $setup_tpl->set_var('error_msg',$f); |
|
| 141 | + $setup_tpl->set_var('error_msg', $f); |
|
| 143 | 142 | } |
| 144 | 143 | } |
| 145 | -$setup_tpl->set_var('backup_now_button','<input type="submit" name="backup" title="'.htmlspecialchars(lang("back's up your DB now, this might take a few minutes")).'" value="'.htmlspecialchars(lang('backup now')).'" />'); |
|
| 146 | -$setup_tpl->set_var('upload','<input type="file" name="uploaded" /> '. |
|
| 144 | +$setup_tpl->set_var('backup_now_button', '<input type="submit" name="backup" title="'.htmlspecialchars(lang("back's up your DB now, this might take a few minutes")).'" value="'.htmlspecialchars(lang('backup now')).'" />'); |
|
| 145 | +$setup_tpl->set_var('upload', '<input type="file" name="uploaded" /> '. |
|
| 147 | 146 | '<input type="submit" name="upload" value="'.htmlspecialchars(lang('upload backup')).'" title="'.htmlspecialchars(lang("uploads a backup to the backup-dir, from where you can restore it")).'" />'); |
| 148 | -$setup_tpl->set_var('backup_mincount','<input type="text" name="backup_mincount" value="'.$db_backup->backup_mincount.'" size="3" maxlength="3"/>'); |
|
| 149 | -$setup_tpl->set_var('backup_files','<input type="checkbox" name="backup_files" value="backup_files"'. |
|
| 150 | - ($db_backup->backup_files ? ' checked="true"':''). |
|
| 147 | +$setup_tpl->set_var('backup_mincount', '<input type="text" name="backup_mincount" value="'.$db_backup->backup_mincount.'" size="3" maxlength="3"/>'); |
|
| 148 | +$setup_tpl->set_var('backup_files', '<input type="checkbox" name="backup_files" value="backup_files"'. |
|
| 149 | + ($db_backup->backup_files ? ' checked="true"' : ''). |
|
| 151 | 150 | // do NOT allow to change "backup files" outside of setup |
| 152 | 151 | ($is_setup ? '' : ' disabled="true" title="'.htmlspecialchars(lang('Can only be change via Setup!')).'"').'/>'); |
| 153 | -$setup_tpl->set_var('backup_save_settings','<input type="submit" name="save_backup_settings" value="'.htmlspecialchars(lang('save')).'" />'); |
|
| 154 | -$setup_tpl->set_var('backup_mount','<input type="submit" name="mount" value="'.htmlspecialchars(lang('Mount backup directory to %1','/backup')).'" />'); |
|
| 152 | +$setup_tpl->set_var('backup_save_settings', '<input type="submit" name="save_backup_settings" value="'.htmlspecialchars(lang('save')).'" />'); |
|
| 153 | +$setup_tpl->set_var('backup_mount', '<input type="submit" name="mount" value="'.htmlspecialchars(lang('Mount backup directory to %1', '/backup')).'" />'); |
|
| 155 | 154 | |
| 156 | 155 | if ($_POST['upload'] && is_array($_FILES['uploaded']) && !$_FILES['uploaded']['error'] && |
| 157 | 156 | is_uploaded_file($_FILES['uploaded']['tmp_name'])) |
| 158 | 157 | { |
| 159 | - move_uploaded_file($_FILES['uploaded']['tmp_name'],$db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
|
| 158 | + move_uploaded_file($_FILES['uploaded']['tmp_name'], $db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
|
| 160 | 159 | |
| 161 | 160 | $md5 = ', md5='.md5_file($db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
| 162 | 161 | $md5 .= ', sha1='.sha1_file($db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); |
| 163 | 162 | |
| 164 | - $setup_tpl->set_var('error_msg',lang("succesfully uploaded file %1",$_FILES['uploaded']['name'].', '. |
|
| 165 | - sprintf('%3.1lf MB (%d)',$_FILES['uploaded']['size']/(1024*1024),$_FILES['uploaded']['size']).$md5)); |
|
| 163 | + $setup_tpl->set_var('error_msg', lang("succesfully uploaded file %1", $_FILES['uploaded']['name'].', '. |
|
| 164 | + sprintf('%3.1lf MB (%d)', $_FILES['uploaded']['size'] / (1024 * 1024), $_FILES['uploaded']['size']).$md5)); |
|
| 166 | 165 | } |
| 167 | 166 | // delete a backup |
| 168 | 167 | if ($_POST['delete']) |
| 169 | 168 | { |
| 170 | 169 | list($file) = each($_POST['delete']); |
| 171 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
| 170 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
| 172 | 171 | |
| 173 | - if (unlink($file)) $setup_tpl->set_var('error_msg',lang("backup '%1' deleted",$file)); |
|
| 172 | + if (unlink($file)) $setup_tpl->set_var('error_msg', lang("backup '%1' deleted", $file)); |
|
| 174 | 173 | } |
| 175 | 174 | // rename a backup |
| 176 | 175 | if ($_POST['rename']) |
@@ -181,44 +180,44 @@ discard block |
||
| 181 | 180 | { |
| 182 | 181 | list($ending) = array_reverse(explode('.', $file)); |
| 183 | 182 | list($new_ending, $has_ending) = array_reverse(explode('.', $new_name)); |
| 184 | - if(!$has_ending || $new_ending != $ending) $new_name .= '.'.$ending; |
|
| 185 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
| 186 | - $ext = preg_match('/(\.gz|\.bz2)+$/i',$file,$matches) ? $matches[1] : ''; |
|
| 187 | - $new_file = $db_backup->backup_dir.'/'.preg_replace('/(\.gz|\.bz2)+$/i','',basename($new_name)).$ext; |
|
| 188 | - if (rename($file,$new_file)) $setup_tpl->set_var('error_msg',lang("backup '%1' renamed to '%2'",basename($file),basename($new_file))); |
|
| 183 | + if (!$has_ending || $new_ending != $ending) $new_name .= '.'.$ending; |
|
| 184 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
| 185 | + $ext = preg_match('/(\.gz|\.bz2)+$/i', $file, $matches) ? $matches[1] : ''; |
|
| 186 | + $new_file = $db_backup->backup_dir.'/'.preg_replace('/(\.gz|\.bz2)+$/i', '', basename($new_name)).$ext; |
|
| 187 | + if (rename($file, $new_file)) $setup_tpl->set_var('error_msg', lang("backup '%1' renamed to '%2'", basename($file), basename($new_file))); |
|
| 189 | 188 | } |
| 190 | 189 | } |
| 191 | 190 | // restore a backup |
| 192 | 191 | if ($_POST['restore']) |
| 193 | 192 | { |
| 194 | 193 | list($file) = each($_POST['restore']); |
| 195 | - $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
| 194 | + $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
|
| 196 | 195 | |
| 197 | - if (is_resource($f = $db_backup->fopen_backup($file,true))) |
|
| 196 | + if (is_resource($f = $db_backup->fopen_backup($file, true))) |
|
| 198 | 197 | { |
| 199 | - echo '<p align="center">'.lang('restore started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
|
| 198 | + echo '<p align="center">'.lang('restore started, this might take a few minutes ...')."</p>\n".str_repeat(' ', 4096); |
|
| 200 | 199 | $start = time(); |
| 201 | - $db_backup->restore($f, true, $file); // allways convert to current system charset on restore |
|
| 202 | - $setup_tpl->set_var('error_msg',lang("backup '%1' restored",$file).' ('.(time()-$start).' s)'); |
|
| 200 | + $db_backup->restore($f, true, $file); // allways convert to current system charset on restore |
|
| 201 | + $setup_tpl->set_var('error_msg', lang("backup '%1' restored", $file).' ('.(time() - $start).' s)'); |
|
| 203 | 202 | if ($run_in_egw) |
| 204 | 203 | { |
| 205 | 204 | // updating the backup |
| 206 | 205 | $cmd = new setup_cmd_update($GLOBALS['egw']->session->account_domain, |
| 207 | - $GLOBALS['egw_info']['server']['header_admin_user']='admin', |
|
| 208 | - $GLOBALS['egw_info']['server']['header_admin_password']=uniqid('pw',true),false,true); |
|
| 206 | + $GLOBALS['egw_info']['server']['header_admin_user'] = 'admin', |
|
| 207 | + $GLOBALS['egw_info']['server']['header_admin_password'] = uniqid('pw', true), false, true); |
|
| 209 | 208 | echo $cmd->run()."\n"; |
| 210 | - echo '<h3>'.lang('You should %1log out%2 and in again, to update your current session!','<a href="'.Egw::link('/logout.php').'" target="_parent">','</a>')."</h3>\n"; |
|
| 209 | + echo '<h3>'.lang('You should %1log out%2 and in again, to update your current session!', '<a href="'.Egw::link('/logout.php').'" target="_parent">', '</a>')."</h3>\n"; |
|
| 211 | 210 | } |
| 212 | 211 | } |
| 213 | 212 | else |
| 214 | 213 | { |
| 215 | - $setup_tpl->set_var('error_msg',$f); |
|
| 214 | + $setup_tpl->set_var('error_msg', $f); |
|
| 216 | 215 | } |
| 217 | 216 | } |
| 218 | 217 | // create a new scheduled backup |
| 219 | 218 | if ($_POST['schedule']) |
| 220 | 219 | { |
| 221 | - $asyncservice->set_timer($_POST['times'],'db_backup-'.implode(':',$_POST['times']),'admin.admin_db_backup.do_backup',''); |
|
| 220 | + $asyncservice->set_timer($_POST['times'], 'db_backup-'.implode(':', $_POST['times']), 'admin.admin_db_backup.do_backup', ''); |
|
| 222 | 221 | } |
| 223 | 222 | // cancel a scheduled backup |
| 224 | 223 | if (is_array($_POST['cancel'])) |
@@ -229,29 +228,29 @@ discard block |
||
| 229 | 228 | // list scheduled backups |
| 230 | 229 | if (($jobs = $asyncservice->read('db_backup-%'))) |
| 231 | 230 | { |
| 232 | - foreach($jobs as $job) |
|
| 231 | + foreach ($jobs as $job) |
|
| 233 | 232 | { |
| 234 | 233 | $setup_tpl->set_var($job['times']); |
| 235 | - $setup_tpl->set_var('next_run',date('Y-m-d H:i',$job['next'])); |
|
| 236 | - $setup_tpl->set_var('actions','<input type="submit" name="cancel['.$job['id'].']" value="'.htmlspecialchars(lang('delete')).'" />'); |
|
| 237 | - $setup_tpl->parse('schedule_rows','schedule_row',true); |
|
| 234 | + $setup_tpl->set_var('next_run', date('Y-m-d H:i', $job['next'])); |
|
| 235 | + $setup_tpl->set_var('actions', '<input type="submit" name="cancel['.$job['id'].']" value="'.htmlspecialchars(lang('delete')).'" />'); |
|
| 236 | + $setup_tpl->parse('schedule_rows', 'schedule_row', true); |
|
| 238 | 237 | } |
| 239 | 238 | } |
| 240 | 239 | // input-fields to create a new scheduled backup |
| 241 | -foreach($times=array('year'=>'*','month'=>'*','day'=>'*','dow'=>'2-6','hour'=>3,'min'=>0) as $name => $default) |
|
| 240 | +foreach ($times = array('year'=>'*', 'month'=>'*', 'day'=>'*', 'dow'=>'2-6', 'hour'=>3, 'min'=>0) as $name => $default) |
|
| 242 | 241 | { |
| 243 | - $setup_tpl->set_var($name,'<input name="times['.$name.']" size="5" value="'.$default.'" />'); |
|
| 242 | + $setup_tpl->set_var($name, '<input name="times['.$name.']" size="5" value="'.$default.'" />'); |
|
| 244 | 243 | } |
| 245 | -$setup_tpl->set_var('next_run',' '); |
|
| 246 | -$setup_tpl->set_var('actions','<input type="submit" name="schedule" value="'.htmlspecialchars(lang('schedule')).'" />'); |
|
| 247 | -$setup_tpl->parse('schedule_rows','schedule_row',true); |
|
| 244 | +$setup_tpl->set_var('next_run', ' '); |
|
| 245 | +$setup_tpl->set_var('actions', '<input type="submit" name="schedule" value="'.htmlspecialchars(lang('schedule')).'" />'); |
|
| 246 | +$setup_tpl->parse('schedule_rows', 'schedule_row', true); |
|
| 248 | 247 | |
| 249 | 248 | // listing the availible backup sets |
| 250 | -$setup_tpl->set_var('backup_dir',$db_backup->backup_dir); |
|
| 251 | -$setup_tpl->set_var('set_rows',''); |
|
| 249 | +$setup_tpl->set_var('backup_dir', $db_backup->backup_dir); |
|
| 250 | +$setup_tpl->set_var('set_rows', ''); |
|
| 252 | 251 | $handle = @opendir($db_backup->backup_dir); |
| 253 | 252 | $files = array(); |
| 254 | -while($handle && ($file = readdir($handle))) |
|
| 253 | +while ($handle && ($file = readdir($handle))) |
|
| 255 | 254 | { |
| 256 | 255 | if ($file != '.' && $file != '..') |
| 257 | 256 | { |
@@ -261,13 +260,13 @@ discard block |
||
| 261 | 260 | if ($handle) closedir($handle); |
| 262 | 261 | |
| 263 | 262 | arsort($files); |
| 264 | -foreach($files as $file => $ctime) |
|
| 263 | +foreach ($files as $file => $ctime) |
|
| 265 | 264 | { |
| 266 | 265 | $size = filesize($db_backup->backup_dir.'/'.$file); |
| 267 | 266 | $setup_tpl->set_var(array( |
| 268 | 267 | 'filename' => $file, |
| 269 | - 'mod' => date('Y-m-d H:i',$ctime), |
|
| 270 | - 'size' => sprintf('%3.1lf MB (%d)',$size/(1024*1024),$size), |
|
| 268 | + 'mod' => date('Y-m-d H:i', $ctime), |
|
| 269 | + 'size' => sprintf('%3.1lf MB (%d)', $size / (1024 * 1024), $size), |
|
| 271 | 270 | 'actions' => '<input type="submit" name="download['.$file.']" value="'.htmlspecialchars(lang('download')).'" /> '."\n". |
| 272 | 271 | '<input type="submit" name="delete['.$file.']" value="'.htmlspecialchars(lang('delete')).'" onclick="return confirm(\''. |
| 273 | 272 | htmlspecialchars(lang('Confirm to delete this backup?')).'\');" /> '."\n". |
@@ -275,7 +274,7 @@ discard block |
||
| 275 | 274 | '<input type="submit" name="restore['.$file.']" value="'.htmlspecialchars(lang('restore')).'" onclick="return confirm(\''. |
| 276 | 275 | htmlspecialchars(lang('Restoring a backup will delete/replace all content in your database. Are you sure?')).'\');" />', |
| 277 | 276 | )); |
| 278 | - $setup_tpl->parse('set_rows','set_row',true); |
|
| 277 | + $setup_tpl->parse('set_rows', 'set_row', true); |
|
| 279 | 278 | } |
| 280 | 279 | |
| 281 | 280 | $setup_tpl->set_var(array( |
@@ -299,8 +298,8 @@ discard block |
||
| 299 | 298 | 'lang_size' => lang('size'), |
| 300 | 299 | )); |
| 301 | 300 | |
| 302 | -$setup_tpl->set_var('self',$self); |
|
| 303 | -$setup_tpl->pparse('out','T_db_backup'); |
|
| 301 | +$setup_tpl->set_var('self', $self); |
|
| 302 | +$setup_tpl->pparse('out', 'T_db_backup'); |
|
| 304 | 303 | |
| 305 | 304 | if ($run_in_egw) |
| 306 | 305 | { |
@@ -14,9 +14,12 @@ discard block |
||
| 14 | 14 | use EGroupware\Api\Egw; |
| 15 | 15 | use EGroupware\Api\Vfs; |
| 16 | 16 | |
| 17 | -if (!is_object(@$GLOBALS['egw'])) // called from outside eGW ==> setup |
|
| 17 | +if (!is_object(@$GLOBALS['egw'])) |
|
| 18 | +{ |
|
| 19 | + // called from outside eGW ==> setup |
|
| 18 | 20 | { |
| 19 | 21 | include ('./inc/functions.inc.php'); |
| 22 | +} |
|
| 20 | 23 | |
| 21 | 24 | @set_time_limit(0); |
| 22 | 25 | |
@@ -42,7 +45,9 @@ discard block |
||
| 42 | 45 | { |
| 43 | 46 | list($file) = each($_POST['download']); |
| 44 | 47 | $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir |
| 45 | - while (@ob_end_clean()) {} // end all active output buffering |
|
| 48 | + while (@ob_end_clean()) |
|
| 49 | + { |
|
| 50 | +} // end all active output buffering |
|
| 46 | 51 | ini_set('zlib.output_compression',0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit |
| 47 | 52 | Api\Header\Content::type(basename($file)); |
| 48 | 53 | readfile($file); |
@@ -126,7 +131,9 @@ discard block |
||
| 126 | 131 | echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
| 127 | 132 | $db_backup->backup($f); |
| 128 | 133 | if(is_resource($f)) |
| 129 | - fclose($f); |
|
| 134 | + { |
|
| 135 | + fclose($f); |
|
| 136 | + } |
|
| 130 | 137 | $setup_tpl->set_var('error_msg',lang('backup finished')); |
| 131 | 138 | |
| 132 | 139 | /* Remove old backups. */ |
@@ -170,8 +177,11 @@ discard block |
||
| 170 | 177 | list($file) = each($_POST['delete']); |
| 171 | 178 | $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
| 172 | 179 | |
| 173 | - if (unlink($file)) $setup_tpl->set_var('error_msg',lang("backup '%1' deleted",$file)); |
|
| 174 | -} |
|
| 180 | + if (unlink($file)) |
|
| 181 | + { |
|
| 182 | + $setup_tpl->set_var('error_msg',lang("backup '%1' deleted",$file)); |
|
| 183 | + } |
|
| 184 | + } |
|
| 175 | 185 | // rename a backup |
| 176 | 186 | if ($_POST['rename']) |
| 177 | 187 | { |
@@ -181,11 +191,17 @@ discard block |
||
| 181 | 191 | { |
| 182 | 192 | list($ending) = array_reverse(explode('.', $file)); |
| 183 | 193 | list($new_ending, $has_ending) = array_reverse(explode('.', $new_name)); |
| 184 | - if(!$has_ending || $new_ending != $ending) $new_name .= '.'.$ending; |
|
| 194 | + if(!$has_ending || $new_ending != $ending) |
|
| 195 | + { |
|
| 196 | + $new_name .= '.'.$ending; |
|
| 197 | + } |
|
| 185 | 198 | $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir |
| 186 | 199 | $ext = preg_match('/(\.gz|\.bz2)+$/i',$file,$matches) ? $matches[1] : ''; |
| 187 | 200 | $new_file = $db_backup->backup_dir.'/'.preg_replace('/(\.gz|\.bz2)+$/i','',basename($new_name)).$ext; |
| 188 | - if (rename($file,$new_file)) $setup_tpl->set_var('error_msg',lang("backup '%1' renamed to '%2'",basename($file),basename($new_file))); |
|
| 201 | + if (rename($file,$new_file)) |
|
| 202 | + { |
|
| 203 | + $setup_tpl->set_var('error_msg',lang("backup '%1' renamed to '%2'",basename($file),basename($new_file))); |
|
| 204 | + } |
|
| 189 | 205 | } |
| 190 | 206 | } |
| 191 | 207 | // restore a backup |
@@ -258,7 +274,10 @@ discard block |
||
| 258 | 274 | $files[$file] = filectime($db_backup->backup_dir.'/'.$file); |
| 259 | 275 | } |
| 260 | 276 | } |
| 261 | -if ($handle) closedir($handle); |
|
| 277 | +if ($handle) |
|
| 278 | +{ |
|
| 279 | + closedir($handle); |
|
| 280 | +} |
|
| 262 | 281 | |
| 263 | 282 | arsort($files); |
| 264 | 283 | foreach($files as $file => $ctime) |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | use EGroupware\Api; |
| 14 | 14 | use EGroupware\Api\Framework; |
| 15 | 15 | |
| 16 | -if (strpos($_SERVER['PHP_SELF'],'admin_account.php') !== false) |
|
| 16 | +if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') !== false) |
|
| 17 | 17 | { |
| 18 | 18 | include('./inc/functions.inc.php'); |
| 19 | 19 | |
| 20 | 20 | // Authorize the user to use setup app and load the database |
| 21 | 21 | // Does not return unless user is authorized |
| 22 | - if(!$GLOBALS['egw_setup']->auth('Config') || $_POST['cancel']) |
|
| 22 | + if (!$GLOBALS['egw_setup']->auth('Config') || $_POST['cancel']) |
|
| 23 | 23 | { |
| 24 | 24 | Header('Location: index.php'); |
| 25 | 25 | exit; |
@@ -43,16 +43,16 @@ discard block |
||
| 43 | 43 | $lname = $_POST['lname']; |
| 44 | 44 | $email = $_POST['email']; |
| 45 | 45 | |
| 46 | - if($passwd != $passwd2 || !$username) |
|
| 46 | + if ($passwd != $passwd2 || !$username) |
|
| 47 | 47 | { |
| 48 | - $error = '<p>'.lang('Passwords did not match, please re-enter') . ".</p>\n"; |
|
| 48 | + $error = '<p>'.lang('Passwords did not match, please re-enter').".</p>\n"; |
|
| 49 | 49 | } |
| 50 | - if(!$username) |
|
| 50 | + if (!$username) |
|
| 51 | 51 | { |
| 52 | - $error = '<p>'.lang('You must enter a username for the admin') . ".</p>\n"; |
|
| 52 | + $error = '<p>'.lang('You must enter a username for the admin').".</p>\n"; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | -if(!$_POST['submit'] || $error) |
|
| 55 | +if (!$_POST['submit'] || $error) |
|
| 56 | 56 | { |
| 57 | 57 | $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); |
| 58 | 58 | $setup_tpl = new Framework\Template($tpl_root); |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | 'T_login_stage_header' => 'login_stage_header.tpl', |
| 65 | 65 | 'T_admin_account' => 'admin_account.tpl' |
| 66 | 66 | )); |
| 67 | - $setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
|
| 68 | - $setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
|
| 67 | + $setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain'); |
|
| 68 | + $setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain'); |
|
| 69 | 69 | |
| 70 | 70 | $GLOBALS['egw_setup']->html->show_header(lang('Create admin account')); |
| 71 | 71 | |
@@ -76,27 +76,27 @@ discard block |
||
| 76 | 76 | 'lname' => $lname, |
| 77 | 77 | 'email' => $email, |
| 78 | 78 | )); |
| 79 | - $setup_tpl->set_var('action_url','admin_account.php'); |
|
| 80 | - $setup_tpl->set_var('description',lang('This will create a first user in eGroupWare or reset password and admin rights of an exiting user')); |
|
| 81 | - $setup_tpl->set_var('lang_deleteall',lang('Delete all existing SQL accounts, groups, ACLs and preferences (normally not necessary)?')); |
|
| 82 | - |
|
| 83 | - $setup_tpl->set_var('detailadmin',lang('Details for Admin account')); |
|
| 84 | - $setup_tpl->set_var('adminusername',lang('Admin username')); |
|
| 85 | - $setup_tpl->set_var('adminfirstname',lang('Admin first name')); |
|
| 86 | - $setup_tpl->set_var('adminlastname',lang('Admin last name')); |
|
| 87 | - $setup_tpl->set_var('adminemail',lang('Admin email address')); |
|
| 88 | - $setup_tpl->set_var('adminpassword',lang('Admin password')); |
|
| 89 | - $setup_tpl->set_var('adminpassword2',lang('Re-enter password')); |
|
| 90 | - $setup_tpl->set_var('admin_all_apps',lang('Give admin access to all installed apps')); |
|
| 91 | - $setup_tpl->set_var('all_apps_desc',lang('Usually more annoying.<br />Admins can use Admin >> Manage accounts or groups to give access to further apps.')); |
|
| 92 | - $setup_tpl->set_var('create_demo_accounts',lang('Create demo accounts')); |
|
| 93 | - $setup_tpl->set_var('demo_desc',lang('The username/passwords are: demo/guest, demo2/guest and demo3/guest.')); |
|
| 79 | + $setup_tpl->set_var('action_url', 'admin_account.php'); |
|
| 80 | + $setup_tpl->set_var('description', lang('This will create a first user in eGroupWare or reset password and admin rights of an exiting user')); |
|
| 81 | + $setup_tpl->set_var('lang_deleteall', lang('Delete all existing SQL accounts, groups, ACLs and preferences (normally not necessary)?')); |
|
| 82 | + |
|
| 83 | + $setup_tpl->set_var('detailadmin', lang('Details for Admin account')); |
|
| 84 | + $setup_tpl->set_var('adminusername', lang('Admin username')); |
|
| 85 | + $setup_tpl->set_var('adminfirstname', lang('Admin first name')); |
|
| 86 | + $setup_tpl->set_var('adminlastname', lang('Admin last name')); |
|
| 87 | + $setup_tpl->set_var('adminemail', lang('Admin email address')); |
|
| 88 | + $setup_tpl->set_var('adminpassword', lang('Admin password')); |
|
| 89 | + $setup_tpl->set_var('adminpassword2', lang('Re-enter password')); |
|
| 90 | + $setup_tpl->set_var('admin_all_apps', lang('Give admin access to all installed apps')); |
|
| 91 | + $setup_tpl->set_var('all_apps_desc', lang('Usually more annoying.<br />Admins can use Admin >> Manage accounts or groups to give access to further apps.')); |
|
| 92 | + $setup_tpl->set_var('create_demo_accounts', lang('Create demo accounts')); |
|
| 93 | + $setup_tpl->set_var('demo_desc', lang('The username/passwords are: demo/guest, demo2/guest and demo3/guest.')); |
|
| 94 | 94 | |
| 95 | 95 | $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
| 96 | 96 | |
| 97 | - $setup_tpl->set_var('lang_submit',lang('Save')); |
|
| 98 | - $setup_tpl->set_var('lang_cancel',lang('Cancel')); |
|
| 99 | - $setup_tpl->pparse('out','T_admin_account'); |
|
| 97 | + $setup_tpl->set_var('lang_submit', lang('Save')); |
|
| 98 | + $setup_tpl->set_var('lang_cancel', lang('Cancel')); |
|
| 99 | + $setup_tpl->pparse('out', 'T_admin_account'); |
|
| 100 | 100 | $GLOBALS['egw_setup']->html->show_footer(); |
| 101 | 101 | } |
| 102 | 102 | else |
@@ -104,25 +104,25 @@ discard block |
||
| 104 | 104 | /* Begin transaction for acl, etc */ |
| 105 | 105 | $GLOBALS['egw_setup']->db->transaction_begin(); |
| 106 | 106 | |
| 107 | - if($_POST['delete_all']) |
|
| 107 | + if ($_POST['delete_all']) |
|
| 108 | 108 | { |
| 109 | 109 | /* Now, clear out existing tables */ |
| 110 | - foreach(array($GLOBALS['egw_setup']->accounts_table,$GLOBALS['egw_setup']->acl_table,'egw_access_log') as $table) |
|
| 110 | + foreach (array($GLOBALS['egw_setup']->accounts_table, $GLOBALS['egw_setup']->acl_table, 'egw_access_log') as $table) |
|
| 111 | 111 | { |
| 112 | - $GLOBALS['egw_setup']->db->delete($table,'1=1',__LINE__,__FILE__); |
|
| 112 | + $GLOBALS['egw_setup']->db->delete($table, '1=1', __LINE__, __FILE__); |
|
| 113 | 113 | } |
| 114 | 114 | // keep default and forced prefs from installed apps |
| 115 | - $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->prefs_table,'preference_owner NOT IN (-1,-2)',__LINE__,__FILE__); |
|
| 115 | + $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->prefs_table, 'preference_owner NOT IN (-1,-2)', __LINE__, __FILE__); |
|
| 116 | 116 | // remove accounts from addressbook |
| 117 | - $GLOBALS['egw_setup']->db->delete('egw_addressbook','account_id IS NOT NULL',__LINE__,__FILE__); |
|
| 117 | + $GLOBALS['egw_setup']->db->delete('egw_addressbook', 'account_id IS NOT NULL', __LINE__, __FILE__); |
|
| 118 | 118 | } |
| 119 | 119 | // create our stock groups: Default (all users) and Admins (administrators) |
| 120 | - $defaultgroupid = (int)$GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False); |
|
| 121 | - $admingroupid = (int)$GLOBALS['egw_setup']->add_account('Admins','Admin','Group',False,False); |
|
| 120 | + $defaultgroupid = (int)$GLOBALS['egw_setup']->add_account('Default', 'Default', 'Group', False, False); |
|
| 121 | + $admingroupid = (int)$GLOBALS['egw_setup']->add_account('Admins', 'Admin', 'Group', False, False); |
|
| 122 | 122 | |
| 123 | 123 | if (!$defaultgroupid || !$admingroupid) |
| 124 | 124 | { |
| 125 | - if (strpos($_SERVER['PHP_SELF'],'admin_account.php') === false) |
|
| 125 | + if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') === false) |
|
| 126 | 126 | { |
| 127 | 127 | return 42; //lang('Error in group-creation !!!'); // dont exit on setup-cli |
| 128 | 128 | } |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // Group perms for the default group |
| 136 | - $default_group_apps = array('addressbook','calendar','infolog','mail','filemanager','preferences','manual','groupdav','notifications','timesheet','importexport','activesync'); |
|
| 137 | - $GLOBALS['egw_setup']->add_acl($default_group_apps,'run',$defaultgroupid); |
|
| 136 | + $default_group_apps = array('addressbook', 'calendar', 'infolog', 'mail', 'filemanager', 'preferences', 'manual', 'groupdav', 'notifications', 'timesheet', 'importexport', 'activesync'); |
|
| 137 | + $GLOBALS['egw_setup']->add_acl($default_group_apps, 'run', $defaultgroupid); |
|
| 138 | 138 | |
| 139 | 139 | $apps = array(); |
| 140 | - foreach($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->applications_table,'app_name','app_enabled < 3',__LINE__,__FILE__) as $row) |
|
| 140 | + foreach ($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->applications_table, 'app_name', 'app_enabled < 3', __LINE__, __FILE__) as $row) |
|
| 141 | 141 | { |
| 142 | 142 | $apps[] = $row['app_name']; |
| 143 | 143 | } |
@@ -148,24 +148,24 @@ discard block |
||
| 148 | 148 | $apps = array_intersect( |
| 149 | 149 | // also give Admins apps of all users group Defaults, in case one forgot to add admins to it |
| 150 | 150 | array_unique(array_merge($default_group_apps, |
| 151 | - array('admin','bookmarks','emailadmin','news_admin','phpbrain','phpsysinfo','phpfreechat','projectmanager','resources','sitemgr','timesheet','tracker','wiki'))),$apps); |
|
| 151 | + array('admin', 'bookmarks', 'emailadmin', 'news_admin', 'phpbrain', 'phpsysinfo', 'phpfreechat', 'projectmanager', 'resources', 'sitemgr', 'timesheet', 'tracker', 'wiki'))), $apps); |
|
| 152 | 152 | } |
| 153 | - $GLOBALS['egw_setup']->add_acl($apps,'run',$admingroupid); |
|
| 153 | + $GLOBALS['egw_setup']->add_acl($apps, 'run', $admingroupid); |
|
| 154 | 154 | |
| 155 | 155 | /* Creation of the demo accounts is optional - the checkbox is on by default. */ |
| 156 | - if($_POST['create_demo']) |
|
| 156 | + if ($_POST['create_demo']) |
|
| 157 | 157 | { |
| 158 | 158 | // Create 3 demo accounts |
| 159 | - $GLOBALS['egw_setup']->add_account('demo','Demo','Account','guest'); |
|
| 160 | - $GLOBALS['egw_setup']->add_account('demo2','Demo2','Account','guest'); |
|
| 161 | - $GLOBALS['egw_setup']->add_account('demo3','Demo3','Account','guest'); |
|
| 159 | + $GLOBALS['egw_setup']->add_account('demo', 'Demo', 'Account', 'guest'); |
|
| 160 | + $GLOBALS['egw_setup']->add_account('demo2', 'Demo2', 'Account', 'guest'); |
|
| 161 | + $GLOBALS['egw_setup']->add_account('demo3', 'Demo3', 'Account', 'guest'); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /* Create records for administrator account, with Admins as primary and Default as additional group */ |
| 165 | - $accountid = $GLOBALS['egw_setup']->add_account($username,$fname,$lname,$passwd,'Admins',True,$email); |
|
| 165 | + $accountid = $GLOBALS['egw_setup']->add_account($username, $fname, $lname, $passwd, 'Admins', True, $email); |
|
| 166 | 166 | if (!$accountid) |
| 167 | 167 | { |
| 168 | - if (strpos($_SERVER['PHP_SELF'],'admin_account.php') === false) |
|
| 168 | + if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') === false) |
|
| 169 | 169 | { |
| 170 | 170 | return 41; //lang('Error in admin-creation !!!'); // dont exit on setup-cli |
| 171 | 171 | } |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | $GLOBALS['egw_setup']->db->transaction_abort(); |
| 175 | 175 | exit; |
| 176 | 176 | } |
| 177 | - $GLOBALS['egw_setup']->set_memberships(array($admingroupid,$defaultgroupid),$accountid); |
|
| 177 | + $GLOBALS['egw_setup']->set_memberships(array($admingroupid, $defaultgroupid), $accountid); |
|
| 178 | 178 | |
| 179 | 179 | $GLOBALS['egw_setup']->db->transaction_commit(); |
| 180 | 180 | |
| 181 | - if (strpos($_SERVER['PHP_SELF'],'admin_account.php') !== false) |
|
| 181 | + if (strpos($_SERVER['PHP_SELF'], 'admin_account.php') !== false) |
|
| 182 | 182 | { |
| 183 | 183 | Header('Location: index.php'); |
| 184 | 184 | } |
@@ -68,91 +68,91 @@ |
||
| 68 | 68 | |
| 69 | 69 | switch($action) |
| 70 | 70 | { |
| 71 | - case '--version': |
|
| 72 | - case '--check': |
|
| 73 | - setup_cmd::check_installed($arguments[0],0,true); |
|
| 74 | - break; |
|
| 75 | - |
|
| 76 | - case '--create-header': |
|
| 77 | - case '--edit-header': |
|
| 78 | - case '--upgrade-header': |
|
| 79 | - case '--update-header': |
|
| 80 | - do_header($action == '--create-header',$arguments); |
|
| 81 | - break; |
|
| 82 | - |
|
| 83 | - case '--install': |
|
| 84 | - do_install($arguments); |
|
| 85 | - break; |
|
| 86 | - |
|
| 87 | - case '--config': |
|
| 88 | - do_config($arguments); |
|
| 89 | - break; |
|
| 90 | - |
|
| 91 | - case '--admin': |
|
| 92 | - do_admin($arguments[0]); |
|
| 93 | - break; |
|
| 94 | - |
|
| 95 | - case '--update': |
|
| 96 | - do_update($arguments[0]); |
|
| 97 | - break; |
|
| 98 | - |
|
| 99 | - case '--register-hooks': |
|
| 100 | - case '--register-all-hooks': |
|
| 101 | - do_hooks($arguments[0]); |
|
| 102 | - break; |
|
| 103 | - |
|
| 104 | - case '--backup': |
|
| 105 | - do_backup($arguments[0]); |
|
| 106 | - break; |
|
| 107 | - |
|
| 108 | - case '--languages': |
|
| 109 | - echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); |
|
| 110 | - break; |
|
| 111 | - |
|
| 112 | - case '--charsets': |
|
| 113 | - echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n"; |
|
| 114 | - break; |
|
| 115 | - |
|
| 116 | - case '--exit-codes': |
|
| 117 | - list_exit_codes(); |
|
| 118 | - break; |
|
| 119 | - |
|
| 120 | - case '--help': |
|
| 121 | - case '--usage': |
|
| 122 | - do_usage($arguments[0]); |
|
| 123 | - break; |
|
| 124 | - |
|
| 125 | - default: |
|
| 126 | - // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE |
|
| 127 | - if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && |
|
| 128 | - is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
| 129 | - { |
|
| 130 | - $args = array(); |
|
| 131 | - list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
| 132 | - foreach($arguments as $arg) |
|
| 71 | + case '--version': |
|
| 72 | + case '--check': |
|
| 73 | + setup_cmd::check_installed($arguments[0],0,true); |
|
| 74 | + break; |
|
| 75 | + |
|
| 76 | + case '--create-header': |
|
| 77 | + case '--edit-header': |
|
| 78 | + case '--upgrade-header': |
|
| 79 | + case '--update-header': |
|
| 80 | + do_header($action == '--create-header',$arguments); |
|
| 81 | + break; |
|
| 82 | + |
|
| 83 | + case '--install': |
|
| 84 | + do_install($arguments); |
|
| 85 | + break; |
|
| 86 | + |
|
| 87 | + case '--config': |
|
| 88 | + do_config($arguments); |
|
| 89 | + break; |
|
| 90 | + |
|
| 91 | + case '--admin': |
|
| 92 | + do_admin($arguments[0]); |
|
| 93 | + break; |
|
| 94 | + |
|
| 95 | + case '--update': |
|
| 96 | + do_update($arguments[0]); |
|
| 97 | + break; |
|
| 98 | + |
|
| 99 | + case '--register-hooks': |
|
| 100 | + case '--register-all-hooks': |
|
| 101 | + do_hooks($arguments[0]); |
|
| 102 | + break; |
|
| 103 | + |
|
| 104 | + case '--backup': |
|
| 105 | + do_backup($arguments[0]); |
|
| 106 | + break; |
|
| 107 | + |
|
| 108 | + case '--languages': |
|
| 109 | + echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); |
|
| 110 | + break; |
|
| 111 | + |
|
| 112 | + case '--charsets': |
|
| 113 | + echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n"; |
|
| 114 | + break; |
|
| 115 | + |
|
| 116 | + case '--exit-codes': |
|
| 117 | + list_exit_codes(); |
|
| 118 | + break; |
|
| 119 | + |
|
| 120 | + case '--help': |
|
| 121 | + case '--usage': |
|
| 122 | + do_usage($arguments[0]); |
|
| 123 | + break; |
|
| 124 | + |
|
| 125 | + default: |
|
| 126 | + // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE |
|
| 127 | + if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && |
|
| 128 | + is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
| 133 | 129 | { |
| 134 | - list($name,$value) = explode('=',$arg,2); |
|
| 135 | - if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
| 136 | - { |
|
| 137 | - throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
|
| 138 | - } |
|
| 139 | - if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
| 130 | + $args = array(); |
|
| 131 | + list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
| 132 | + foreach($arguments as $arg) |
|
| 140 | 133 | { |
| 141 | - list($name,$sub) = explode('[',substr($name,0,-1),2); |
|
| 142 | - $args[$name][$sub] = $value; |
|
| 143 | - } |
|
| 144 | - else |
|
| 145 | - { |
|
| 146 | - $args[$name] = $value; |
|
| 134 | + list($name,$value) = explode('=',$arg,2); |
|
| 135 | + if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
| 136 | + { |
|
| 137 | + throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
|
| 138 | + } |
|
| 139 | + if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
| 140 | + { |
|
| 141 | + list($name,$sub) = explode('[',substr($name,0,-1),2); |
|
| 142 | + $args[$name][$sub] = $value; |
|
| 143 | + } |
|
| 144 | + else |
|
| 145 | + { |
|
| 146 | + $args[$name] = $value; |
|
| 147 | + } |
|
| 147 | 148 | } |
| 149 | + $cmd = new $class($args); |
|
| 150 | + $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); |
|
| 152 | + echo "$msg\n"; |
|
| 153 | + break; |
|
| 148 | 154 | } |
| 149 | - $cmd = new $class($args); |
|
| 150 | - $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); |
|
| 152 | - echo "$msg\n"; |
|
| 153 | - break; |
|
| 154 | - } |
|
| 155 | - throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90); |
|
| 155 | + throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90); |
|
| 156 | 156 | } |
| 157 | 157 | exit(0); |
| 158 | 158 | |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | use EGroupware\Api; |
| 15 | 15 | |
| 16 | -chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
| 16 | +chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
| 17 | 17 | |
| 18 | 18 | if (php_sapi_name() !== 'cli') // security precaution: forbit calling setup-cli as web-page |
| 19 | 19 | { |
| 20 | 20 | die('<h1>setup-cli.php must NOT be called as web-page --> exiting !!!</h1>'); |
| 21 | 21 | } |
| 22 | -error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); |
|
| 22 | +error_reporting(E_ALL&~E_NOTICE&~E_STRICT); |
|
| 23 | 23 | |
| 24 | 24 | $dry_run = false; |
| 25 | 25 | array_shift($_SERVER['argv']); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | $arguments = $_SERVER['argv']; |
| 35 | 35 | $action = array_shift($arguments); |
| 36 | - if (isset($arguments[0])) list($_POST['FormDomain']) = explode(',',$arguments[0]); // header include needs that to detects the right domain |
|
| 36 | + if (isset($arguments[0])) list($_POST['FormDomain']) = explode(',', $arguments[0]); // header include needs that to detects the right domain |
|
| 37 | 37 | } |
| 38 | 38 | else |
| 39 | 39 | { |
@@ -42,42 +42,42 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | // setting the language from the enviroment |
| 44 | 44 | $_POST['ConfigLang'] = get_lang($charset); |
| 45 | -create_http_enviroment(); // guessing the docroot etc. |
|
| 45 | +create_http_enviroment(); // guessing the docroot etc. |
|
| 46 | 46 | |
| 47 | 47 | if (ini_get('session.save_handler') == 'files' && !is_writable(ini_get('session.save_path')) && is_dir('/tmp') && is_writable('/tmp')) |
| 48 | 48 | { |
| 49 | - ini_set('session.save_path','/tmp'); // regular users may have no rights to apache's session dir |
|
| 49 | + ini_set('session.save_path', '/tmp'); // regular users may have no rights to apache's session dir |
|
| 50 | 50 | } |
| 51 | 51 | // check if date.timezone is set, report it and set something if not, as it gives tons of errors in install log |
| 52 | 52 | if (!ini_get('date.timezone')) |
| 53 | 53 | { |
| 54 | 54 | if (!($tz = date_default_timezone_get())) $tz = 'UTC'; |
| 55 | 55 | echo "No default timezone (php.ini date.timezone) set, we temporary set '$tz'. You should fix that permanent!\n"; |
| 56 | - ini_set('date.timezone',$tz); |
|
| 56 | + ini_set('date.timezone', $tz); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // setting up the $GLOBALS['egw_setup'] object AND including the header.inc.php if it exists |
| 60 | 60 | include('inc/functions.inc.php'); |
| 61 | -$GLOBALS['egw_info']['flags']['no_exception_handler'] = 'cli'; // inc/functions.inc.php does NOT set it |
|
| 61 | +$GLOBALS['egw_info']['flags']['no_exception_handler'] = 'cli'; // inc/functions.inc.php does NOT set it |
|
| 62 | 62 | $GLOBALS['egw_setup']->system_charset = $charset; |
| 63 | 63 | |
| 64 | -if ((float) PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
| 64 | +if ((float)PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
| 65 | 65 | { |
| 66 | - throw new Api\Exception\WrongUserinput(lang('You are using PHP version %1. EGroupware now requires %2 or later, recommended is PHP %3.',PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,$GLOBALS['egw_setup']->recommended_php_version),98); |
|
| 66 | + throw new Api\Exception\WrongUserinput(lang('You are using PHP version %1. EGroupware now requires %2 or later, recommended is PHP %3.', PHP_VERSION, $GLOBALS['egw_setup']->required_php_version, $GLOBALS['egw_setup']->recommended_php_version), 98); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | -switch($action) |
|
| 69 | +switch ($action) |
|
| 70 | 70 | { |
| 71 | 71 | case '--version': |
| 72 | 72 | case '--check': |
| 73 | - setup_cmd::check_installed($arguments[0],0,true); |
|
| 73 | + setup_cmd::check_installed($arguments[0], 0, true); |
|
| 74 | 74 | break; |
| 75 | 75 | |
| 76 | 76 | case '--create-header': |
| 77 | 77 | case '--edit-header': |
| 78 | 78 | case '--upgrade-header': |
| 79 | 79 | case '--update-header': |
| 80 | - do_header($action == '--create-header',$arguments); |
|
| 80 | + do_header($action == '--create-header', $arguments); |
|
| 81 | 81 | break; |
| 82 | 82 | |
| 83 | 83 | case '--install': |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | break; |
| 107 | 107 | |
| 108 | 108 | case '--languages': |
| 109 | - echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); |
|
| 109 | + echo html_entity_decode(file_get_contents('lang/languages'), ENT_COMPAT, 'utf-8'); |
|
| 110 | 110 | break; |
| 111 | 111 | |
| 112 | 112 | case '--charsets': |
| 113 | - echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n"; |
|
| 113 | + echo html_entity_decode(implode("\n", $GLOBALS['egw_setup']->translation->get_charsets(false)), ENT_COMPAT, 'utf-8')."\n"; |
|
| 114 | 114 | break; |
| 115 | 115 | |
| 116 | 116 | case '--exit-codes': |
@@ -124,21 +124,21 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | default: |
| 126 | 126 | // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE |
| 127 | - if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && |
|
| 128 | - is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
| 127 | + if (substr($action, 0, 2) == '--' && class_exists($class = str_replace('-', '_', substr($action, 2))) && |
|
| 128 | + is_subclass_of($class, 'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
| 129 | 129 | { |
| 130 | 130 | $args = array(); |
| 131 | - list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
| 132 | - foreach($arguments as $arg) |
|
| 131 | + list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
| 132 | + foreach ($arguments as $arg) |
|
| 133 | 133 | { |
| 134 | - list($name,$value) = explode('=',$arg,2); |
|
| 135 | - if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
| 134 | + list($name, $value) = explode('=', $arg, 2); |
|
| 135 | + if (property_exists('admin_cmd', $name)) // dont allow to overwrite admin_cmd properties |
|
| 136 | 136 | { |
| 137 | - throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
|
| 137 | + throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!", $arg), 90); |
|
| 138 | 138 | } |
| 139 | - if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
| 139 | + if (substr($name, -1) == ']') // allow 1-dim. arrays |
|
| 140 | 140 | { |
| 141 | - list($name,$sub) = explode('[',substr($name,0,-1),2); |
|
| 141 | + list($name, $sub) = explode('[', substr($name, 0, -1), 2); |
|
| 142 | 142 | $args[$name][$sub] = $value; |
| 143 | 143 | } |
| 144 | 144 | else |
@@ -147,12 +147,12 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | $cmd = new $class($args); |
| 150 | - $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); |
|
| 150 | + $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); |
|
| 152 | 152 | echo "$msg\n"; |
| 153 | 153 | break; |
| 154 | 154 | } |
| 155 | - throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90); |
|
| 155 | + throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!", $action), 90); |
|
| 156 | 156 | } |
| 157 | 157 | exit(0); |
| 158 | 158 | |
@@ -163,19 +163,19 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | function do_config($args) |
| 165 | 165 | { |
| 166 | - $arg0 = explode(',',array_shift($args)); |
|
| 166 | + $arg0 = explode(',', array_shift($args)); |
|
| 167 | 167 | if (!($domain = @array_shift($arg0))) $domain = 'default'; |
| 168 | 168 | $user = @array_shift($arg0); |
| 169 | 169 | $password = @array_shift($arg0); |
| 170 | - _fetch_user_password($user,$password); |
|
| 170 | + _fetch_user_password($user, $password); |
|
| 171 | 171 | |
| 172 | 172 | if ($arg0) // direct assignments (name=value,...) left |
| 173 | 173 | { |
| 174 | - array_unshift($args,implode(',',$arg0)); |
|
| 175 | - array_unshift($args,'--config'); |
|
| 174 | + array_unshift($args, implode(',', $arg0)); |
|
| 175 | + array_unshift($args, '--config'); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $cmd = new setup_cmd_config($domain,$user,$password,$args,true); |
|
| 178 | + $cmd = new setup_cmd_config($domain, $user, $password, $args, true); |
|
| 179 | 179 | echo $cmd->run()."\n\n"; |
| 180 | 180 | |
| 181 | 181 | $cmd->get_config(true); |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | function do_hooks($arg) |
| 190 | 190 | { |
| 191 | - list($domain,$user,$password) = explode(',',$arg); |
|
| 192 | - _fetch_user_password($user,$password); |
|
| 191 | + list($domain, $user, $password) = explode(',', $arg); |
|
| 192 | + _fetch_user_password($user, $password); |
|
| 193 | 193 | |
| 194 | 194 | $domains = $GLOBALS['egw_domain']; |
| 195 | 195 | if ($domain && $domain != 'all') |
@@ -197,9 +197,9 @@ discard block |
||
| 197 | 197 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - foreach(array_keys($domains) as $domain) |
|
| 200 | + foreach (array_keys($domains) as $domain) |
|
| 201 | 201 | { |
| 202 | - $cmd = new setup_cmd_hooks($domain,$user,$password); |
|
| 202 | + $cmd = new setup_cmd_hooks($domain, $user, $password); |
|
| 203 | 203 | echo "$domain: ".$cmd->run()."\n"; |
| 204 | 204 | } |
| 205 | 205 | echo "\n"; |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | function do_admin($arg) |
| 214 | 214 | { |
| 215 | - list($domain,$user,$password,$admin,$pw,$first,$last,$email,$lang) = explode(',',$arg); |
|
| 216 | - _fetch_user_password($user,$password); |
|
| 215 | + list($domain, $user, $password, $admin, $pw, $first, $last, $email, $lang) = explode(',', $arg); |
|
| 216 | + _fetch_user_password($user, $password); |
|
| 217 | 217 | |
| 218 | - $cmd = new setup_cmd_admin($domain,$user,$password,$admin,$pw,$first,$last,$email,array(),$lang); |
|
| 218 | + $cmd = new setup_cmd_admin($domain, $user, $password, $admin, $pw, $first, $last, $email, array(), $lang); |
|
| 219 | 219 | echo $cmd->run()."\n"; |
| 220 | 220 | } |
| 221 | 221 | |
@@ -225,21 +225,21 @@ discard block |
||
| 225 | 225 | * @param string $arg domain(all),[config user(admin)],password,[backup-file, 'no' for no backup or empty for default name] |
| 226 | 226 | * @param boolean $quite_check quiten the call to _check_auth_config |
| 227 | 227 | */ |
| 228 | -function do_backup($arg,$quite_check=false) |
|
| 228 | +function do_backup($arg, $quite_check = false) |
|
| 229 | 229 | { |
| 230 | - list($domain,,,$backup) = $options = explode(',',$arg); |
|
| 230 | + list($domain,,, $backup) = $options = explode(',', $arg); |
|
| 231 | 231 | |
| 232 | 232 | $domains = $GLOBALS['egw_domain']; |
| 233 | 233 | if ($domain && $domain != 'all') |
| 234 | 234 | { |
| 235 | 235 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
| 236 | 236 | } |
| 237 | - foreach(array_keys($domains) as $domain) |
|
| 237 | + foreach (array_keys($domains) as $domain) |
|
| 238 | 238 | { |
| 239 | 239 | $options[0] = $domain; |
| 240 | 240 | |
| 241 | 241 | if ($quite_check) ob_start(); |
| 242 | - _check_auth_config(implode(',',$options),14); |
|
| 242 | + _check_auth_config(implode(',', $options), 14); |
|
| 243 | 243 | if ($quite_check) ob_end_clean(); |
| 244 | 244 | |
| 245 | 245 | if ($backup == 'no') |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | else // backup failed ==> dont start the upgrade |
| 259 | 259 | { |
| 260 | - throw new Api\Exception\WrongUserinput(lang('Backup failed').': '.$f,50); |
|
| 260 | + throw new Api\Exception\WrongUserinput(lang('Backup failed').': '.$f, 50); |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -270,31 +270,31 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | function do_update($arg) |
| 272 | 272 | { |
| 273 | - list($domain,$user,$password,$backup,$app) = explode(',',$arg); |
|
| 274 | - _fetch_user_password($user,$password); |
|
| 273 | + list($domain, $user, $password, $backup, $app) = explode(',', $arg); |
|
| 274 | + _fetch_user_password($user, $password); |
|
| 275 | 275 | |
| 276 | 276 | $domains = $GLOBALS['egw_domain']; |
| 277 | 277 | if ($domain && $domain != 'all') |
| 278 | 278 | { |
| 279 | 279 | $domains = array($domain => $GLOBALS['egw_domain'][$domain]); |
| 280 | 280 | } |
| 281 | - foreach($domains as $domain => $data) |
|
| 281 | + foreach ($domains as $domain => $data) |
|
| 282 | 282 | { |
| 283 | 283 | $arg = "$domain,$user,$password,$backup"; |
| 284 | 284 | |
| 285 | - _check_auth_config($arg,14); |
|
| 285 | + _check_auth_config($arg, 14); |
|
| 286 | 286 | |
| 287 | 287 | if ($GLOBALS['egw_info']['setup']['stage']['db'] != 4 && |
| 288 | 288 | (!$app || !in_array($app, setup_cmd::$apps_to_install) && !in_array($app, setup_cmd::$apps_to_upgrade)) && |
| 289 | 289 | !setup_cmd::check_autoinstall()) |
| 290 | 290 | { |
| 291 | - echo lang('No update necessary, domain %1(%2) is up to date.',$domain,$data['db_type'])."\n"; |
|
| 291 | + echo lang('No update necessary, domain %1(%2) is up to date.', $domain, $data['db_type'])."\n"; |
|
| 292 | 292 | } |
| 293 | 293 | else |
| 294 | 294 | { |
| 295 | - do_backup($arg,true); |
|
| 295 | + do_backup($arg, true); |
|
| 296 | 296 | |
| 297 | - $cmd = new setup_cmd_update($domain,$user,$password,$backup,false,$app); |
|
| 297 | + $cmd = new setup_cmd_update($domain, $user, $password, $backup, false, $app); |
|
| 298 | 298 | echo $cmd->run()."\n"; |
| 299 | 299 | } |
| 300 | 300 | } |
@@ -313,20 +313,20 @@ discard block |
||
| 313 | 313 | * @param boolean $set_lang =true set our charset, overwriting the charset of the eGW installation, default true |
| 314 | 314 | * @return array with unprocessed arguments from $arg |
| 315 | 315 | */ |
| 316 | -function _check_auth_config($arg,$stop,$set_lang=true) |
|
| 316 | +function _check_auth_config($arg, $stop, $set_lang = true) |
|
| 317 | 317 | { |
| 318 | - $options = explode(',',$arg); |
|
| 318 | + $options = explode(',', $arg); |
|
| 319 | 319 | if (!($domain = array_shift($options))) $domain = 'default'; |
| 320 | 320 | $user = array_shift($options); |
| 321 | 321 | $password = array_shift($options); |
| 322 | - _fetch_user_password($user,$password); |
|
| 322 | + _fetch_user_password($user, $password); |
|
| 323 | 323 | |
| 324 | - setup_cmd::check_installed($domain,$stop,true); |
|
| 324 | + setup_cmd::check_installed($domain, $stop, true); |
|
| 325 | 325 | |
| 326 | 326 | // reset charset for the output to the charset used by the OS |
| 327 | 327 | if ($set_lang) $GLOBALS['egw_setup']->system_charset = $GLOBALS['charset']; |
| 328 | 328 | |
| 329 | - setup_cmd::check_setup_auth($user,$password,$domain); |
|
| 329 | + setup_cmd::check_setup_auth($user, $password, $domain); |
|
| 330 | 330 | |
| 331 | 331 | return $options; |
| 332 | 332 | } |
@@ -338,16 +338,16 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | function do_install($args) |
| 340 | 340 | { |
| 341 | - list($domain,$user,$password,$backup,$charset,$lang) = explode(',',array_shift($args)); |
|
| 342 | - _fetch_user_password($user,$password); |
|
| 341 | + list($domain, $user, $password, $backup, $charset, $lang) = explode(',', array_shift($args)); |
|
| 342 | + _fetch_user_password($user, $password); |
|
| 343 | 343 | |
| 344 | 344 | $config = array(); |
| 345 | - foreach($args as $arg) |
|
| 345 | + foreach ($args as $arg) |
|
| 346 | 346 | { |
| 347 | - list($name,$value) = explode('=',$arg,2); |
|
| 347 | + list($name, $value) = explode('=', $arg, 2); |
|
| 348 | 348 | $config[$name] = $value; |
| 349 | 349 | } |
| 350 | - $cmd = new setup_cmd_install($domain,$user,$password,$backup,$charset,true,$config,$lang); |
|
| 350 | + $cmd = new setup_cmd_install($domain, $user, $password, $backup, $charset, true, $config, $lang); |
|
| 351 | 351 | echo $cmd->run()."\n"; |
| 352 | 352 | } |
| 353 | 353 | |
@@ -357,14 +357,14 @@ discard block |
||
| 357 | 357 | * @param string &$user |
| 358 | 358 | * @param string &$password |
| 359 | 359 | */ |
| 360 | -function _fetch_user_password(&$user,&$password) |
|
| 360 | +function _fetch_user_password(&$user, &$password) |
|
| 361 | 361 | { |
| 362 | 362 | // read password from enviroment or query it from user, if not given |
| 363 | 363 | if (!$user) $user = 'admin'; |
| 364 | 364 | if (!$password && !($password = $_SERVER['EGW_CLI_PASSWORD'])) |
| 365 | 365 | { |
| 366 | 366 | echo lang('Admin password to header manager').' '; |
| 367 | - $password = trim(fgets($f = fopen('php://stdin','rb'))); |
|
| 367 | + $password = trim(fgets($f = fopen('php://stdin', 'rb'))); |
|
| 368 | 368 | fclose($f); |
| 369 | 369 | } |
| 370 | 370 | } |
@@ -376,18 +376,18 @@ discard block |
||
| 376 | 376 | * @param array $arguments |
| 377 | 377 | * @return int |
| 378 | 378 | */ |
| 379 | -function do_header($create,&$arguments) |
|
| 379 | +function do_header($create, &$arguments) |
|
| 380 | 380 | { |
| 381 | 381 | if (!$create) |
| 382 | 382 | { |
| 383 | 383 | // read password from enviroment or query it from user, if not given |
| 384 | - $options = explode(',',@$arguments[0]); |
|
| 385 | - _fetch_user_password($options[1],$options[0]); |
|
| 386 | - $arguments[0] = implode(',',$options); |
|
| 384 | + $options = explode(',', @$arguments[0]); |
|
| 385 | + _fetch_user_password($options[1], $options[0]); |
|
| 386 | + $arguments[0] = implode(',', $options); |
|
| 387 | 387 | } |
| 388 | - array_unshift($arguments,$create ? '--create-header' : '--edit-header'); |
|
| 388 | + array_unshift($arguments, $create ? '--create-header' : '--edit-header'); |
|
| 389 | 389 | |
| 390 | - $cmd = new setup_cmd_header($create?'create':'edit',$arguments); |
|
| 390 | + $cmd = new setup_cmd_header($create ? 'create' : 'edit', $arguments); |
|
| 391 | 391 | echo $cmd->run()."\n"; |
| 392 | 392 | } |
| 393 | 393 | |
@@ -399,11 +399,11 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | function get_lang(&$charset) |
| 401 | 401 | { |
| 402 | - @list($lang,$nation,$charset) = preg_split("/[_.]/",strtolower($_SERVER['LANG'])); |
|
| 402 | + @list($lang, $nation, $charset) = preg_split("/[_.]/", strtolower($_SERVER['LANG'])); |
|
| 403 | 403 | |
| 404 | - foreach(file('lang/languages') as $line) |
|
| 404 | + foreach (file('lang/languages') as $line) |
|
| 405 | 405 | { |
| 406 | - list($code,$language) = explode("\t",$line); |
|
| 406 | + list($code, $language) = explode("\t", $line); |
|
| 407 | 407 | $languages[$code] = $language; |
| 408 | 408 | } |
| 409 | 409 | if (isset($languages[$lang.'-'.$nation])) return $lang.'-'.$nation; |
@@ -420,13 +420,13 @@ discard block |
||
| 420 | 420 | { |
| 421 | 421 | $_SERVER['SCRIPT_FILENAME'] = __FILE__; |
| 422 | 422 | |
| 423 | - foreach(array('httpsdocs','httpdocs','htdocs','html','www') as $docroottop) |
|
| 423 | + foreach (array('httpsdocs', 'httpdocs', 'htdocs', 'html', 'www') as $docroottop) |
|
| 424 | 424 | { |
| 425 | - $parts = explode($docroottop,__FILE__); |
|
| 425 | + $parts = explode($docroottop, __FILE__); |
|
| 426 | 426 | if (count($parts) == 2) |
| 427 | 427 | { |
| 428 | 428 | $_SERVER['DOCUMENT_ROOT'] = $parts[0].$docroottop; |
| 429 | - $_SERVER['PHP_SELF'] = str_replace('\\','/',$parts[1]); |
|
| 429 | + $_SERVER['PHP_SELF'] = str_replace('\\', '/', $parts[1]); |
|
| 430 | 430 | break; |
| 431 | 431 | } |
| 432 | 432 | } |
@@ -436,9 +436,9 @@ discard block |
||
| 436 | 436 | /** |
| 437 | 437 | * Echos usage message |
| 438 | 438 | */ |
| 439 | -function do_usage($what='') |
|
| 439 | +function do_usage($what = '') |
|
| 440 | 440 | { |
| 441 | - echo lang('Usage: %1 command [additional options]',basename($_SERVER['argv'][0]))."\n\n"; |
|
| 441 | + echo lang('Usage: %1 command [additional options]', basename($_SERVER['argv'][0]))."\n\n"; |
|
| 442 | 442 | |
| 443 | 443 | if (!$what) |
| 444 | 444 | { |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | if ($what == 'config') |
| 454 | 454 | { |
| 455 | 455 | echo ' --files-dir, --backup-dir, --temp-dir '.lang('path to various directories: have to exist and be writeable by the webserver')."\n"; |
| 456 | - echo ' --webserver-url '.lang('eg. /egroupware or http://domain.com/egroupware, default: %1',str_replace('/setup/setup-cli.php','',$_SERVER['PHP_SELF']))."\n"; |
|
| 456 | + echo ' --webserver-url '.lang('eg. /egroupware or http://domain.com/egroupware, default: %1', str_replace('/setup/setup-cli.php', '', $_SERVER['PHP_SELF']))."\n"; |
|
| 457 | 457 | echo ' --mailserver '.lang('host,port(143),[domain],[{standard(default)|vmailmgr = add domain for mailserver login}]').',[starttls|ssl|tls]'."\n"; |
| 458 | 458 | echo ' --smtpserver '.lang('host,[smtp port],[smtp user],[smtp password],[auth session user/pw=yes|no],[starttls|ssl|tls],[account user editable=yes|no],[further identities=yes|no]')."\n"; |
| 459 | 459 | echo ' --smtp '.lang('MTA (with LDAP): [yes(user edit forwarding)],emailadmin_smtp(|_sql|_ldap|_ads|_qmail|_mandriva|_dbmailuser|_suse)')."\n"; |
@@ -504,13 +504,13 @@ discard block |
||
| 504 | 504 | echo '--charsets '.lang('charsets used by the different languages')."\n"; |
| 505 | 505 | echo '--exit-codes '.lang('all exit codes of the command line interface')."\n"; |
| 506 | 506 | } |
| 507 | - if (!$what || !in_array($what,array('config','header','list'))) |
|
| 507 | + if (!$what || !in_array($what, array('config', 'header', 'list'))) |
|
| 508 | 508 | { |
| 509 | 509 | echo '--help [config|header|list] '.lang('gives further options')."\n"; |
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | -function fail($exit_code,$message) |
|
| 513 | +function fail($exit_code, $message) |
|
| 514 | 514 | { |
| 515 | 515 | echo $message."\n"; |
| 516 | 516 | exit($exit_code); |
@@ -526,40 +526,40 @@ discard block |
||
| 526 | 526 | */ |
| 527 | 527 | function list_exit_codes() |
| 528 | 528 | { |
| 529 | - error_reporting(error_reporting() & ~E_NOTICE); |
|
| 529 | + error_reporting(error_reporting()&~E_NOTICE); |
|
| 530 | 530 | |
| 531 | 531 | $codes = array('Ok'); |
| 532 | 532 | $setup_dir = EGW_SERVER_ROOT.'/setup/'; |
| 533 | 533 | //$files = array('setup-cli.php'); |
| 534 | - foreach(scandir($setup_dir.'/inc') as $file) |
|
| 534 | + foreach (scandir($setup_dir.'/inc') as $file) |
|
| 535 | 535 | { |
| 536 | - if (substr($file,0,strlen('class.setup_cmd')) == 'class.setup_cmd') |
|
| 536 | + if (substr($file, 0, strlen('class.setup_cmd')) == 'class.setup_cmd') |
|
| 537 | 537 | { |
| 538 | 538 | $files[] = 'inc/'.$file; |
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | - foreach($files as $file) |
|
| 541 | + foreach ($files as $file) |
|
| 542 | 542 | { |
| 543 | 543 | $content = file_get_contents($setup_dir.'/'.$file); |
| 544 | 544 | |
| 545 | 545 | $matches = null; |
| 546 | - if (preg_match_all('/throw new (egw_exception[a-z_]*)\((.*),([0-9]+)\);/m',$content,$matches)) |
|
| 546 | + if (preg_match_all('/throw new (egw_exception[a-z_]*)\((.*),([0-9]+)\);/m', $content, $matches)) |
|
| 547 | 547 | { |
| 548 | 548 | //echo $file.":\n"; print_r($matches); |
| 549 | - foreach($matches[3] as $key => $code) |
|
| 549 | + foreach ($matches[3] as $key => $code) |
|
| 550 | 550 | { |
| 551 | 551 | //if (isset($codes[$code])) echo "$file redifines #$code: {$codes[$code]}\n"; |
| 552 | 552 | |
| 553 | - $src = preg_replace('/self::\$[a-z_>-]+/i', "''", $matches[2][$key]); // gives fatal error otherwise |
|
| 554 | - @eval($src='$codes['.$code.'] = '.$src.';'); |
|
| 553 | + $src = preg_replace('/self::\$[a-z_>-]+/i', "''", $matches[2][$key]); // gives fatal error otherwise |
|
| 554 | + @eval($src = '$codes['.$code.'] = '.$src.';'); |
|
| 555 | 555 | //echo "- codes[$code] => '{$codes[$code]}'\n"; |
| 556 | 556 | } |
| 557 | 557 | //echo $file.":\n"; print_r($codes); |
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | - ksort($codes,SORT_NUMERIC); |
|
| 561 | - foreach($codes as $num => $msg) |
|
| 560 | + ksort($codes, SORT_NUMERIC); |
|
| 561 | + foreach ($codes as $num => $msg) |
|
| 562 | 562 | { |
| 563 | - echo $num."\t".str_replace("\n","\n\t",$msg)."\n"; |
|
| 563 | + echo $num."\t".str_replace("\n", "\n\t", $msg)."\n"; |
|
| 564 | 564 | } |
| 565 | 565 | } |
@@ -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 | { |
@@ -222,7 +222,7 @@ |
||
| 222 | 222 | . '<br />'.lang('to allow password authentification add the following line to your pg_hba.conf (above all others) AND restart postgres:') |
| 223 | 223 | . '<br /><i># TYPE DATABASE USER CIDR-ADDRESS METHOD</i>' |
| 224 | 224 | .($info['db_host'] ? "<br /><i><b>host $info[db_name] $info[db_user] $ip/32 password</b></i>" : |
| 225 | - "<br /><i><b>local $info[db_name] $info[db_user] password</b></i>")); |
|
| 225 | + "<br /><i><b>local $info[db_name] $info[db_user] password</b></i>")); |
|
| 226 | 226 | //$setup_tpl->parse('V_db_stage_1','B_db_stage_1'); |
| 227 | 227 | //break; |
| 228 | 228 | default: |
@@ -184,17 +184,17 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | switch($GLOBALS['egw_info']['setup']['stage']['db']) |
| 186 | 186 | { |
| 187 | - case 1: |
|
| 188 | - $setup_tpl->set_var('dbnotexist','<b>'.lang('Your Database is not working!').'</b>: '.$GLOBALS['egw_setup']->db->Error); |
|
| 189 | - $setup_tpl->set_var('makesure',lang('Make sure that your database is created and the account permissions are set')); |
|
| 190 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
| 191 | - $setup_tpl->set_var('oncesetup',lang('Once the database is setup correctly')); |
|
| 192 | - $setup_tpl->set_var('createdb','<b>'.lang('Or we can attempt to create the database for you:').'</b>'); |
|
| 193 | - $setup_tpl->set_var('create_database',lang('Create database')); |
|
| 194 | - $setup_tpl->set_var('instr',''); |
|
| 195 | - $info = $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]; |
|
| 196 | - switch ($info['db_type']) |
|
| 197 | - { |
|
| 187 | + case 1: |
|
| 188 | + $setup_tpl->set_var('dbnotexist','<b>'.lang('Your Database is not working!').'</b>: '.$GLOBALS['egw_setup']->db->Error); |
|
| 189 | + $setup_tpl->set_var('makesure',lang('Make sure that your database is created and the account permissions are set')); |
|
| 190 | + $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
| 191 | + $setup_tpl->set_var('oncesetup',lang('Once the database is setup correctly')); |
|
| 192 | + $setup_tpl->set_var('createdb','<b>'.lang('Or we can attempt to create the database for you:').'</b>'); |
|
| 193 | + $setup_tpl->set_var('create_database',lang('Create database')); |
|
| 194 | + $setup_tpl->set_var('instr',''); |
|
| 195 | + $info = $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]; |
|
| 196 | + switch ($info['db_type']) |
|
| 197 | + { |
|
| 198 | 198 | case 'mysql': |
| 199 | 199 | case 'mysqli': |
| 200 | 200 | case 'mysqlt': |
@@ -227,77 +227,77 @@ discard block |
||
| 227 | 227 | //break; |
| 228 | 228 | default: |
| 229 | 229 | $setup_tpl->parse('V_db_stage_1','B_db_stage_1a'); |
| 230 | - } |
|
| 230 | + } |
|
| 231 | 231 | $db_filled_block = $setup_tpl->get_var('V_db_stage_1'); |
| 232 | 232 | $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
| 233 | 233 | break; |
| 234 | - case 2: |
|
| 235 | - $setup_tpl->set_var('prebeta',lang('You appear to be running a pre-beta version of eGroupWare.<br />These versions are no longer supported, and there is no upgrade path for them in setup.<br /> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br />and then upgrade from there with the current version.')); |
|
| 236 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
| 237 | - $setup_tpl->parse('V_db_stage_2','B_db_stage_2'); |
|
| 238 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_2'); |
|
| 239 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 240 | - break; |
|
| 241 | - case 3: |
|
| 242 | - $setup_tpl->set_var('dbexists','<b>'.lang('Your database is working, but you dont have any applications installed').'</b>'); |
|
| 243 | - $setup_tpl->set_var('install',lang('Install')); |
|
| 244 | - $setup_tpl->set_var('proceed',lang('We can proceed')); |
|
| 245 | - $setup_tpl->set_var('coreapps',lang('all applications')); |
|
| 246 | - $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
| 247 | - $setup_tpl->set_var('lang_restore',lang('Or you can install a previous backup.')); |
|
| 248 | - $setup_tpl->set_var('upload','<input type="file" name="uploaded" /> '. |
|
| 249 | - '<input type="submit" name="upload" value="'.htmlspecialchars(lang('install backup')).'" title="'.htmlspecialchars(lang("uploads a backup and installs it on your DB")).'" />'); |
|
| 250 | - $setup_tpl->set_var('convert_checkbox','<input type="checkbox" name="convert_charset" id="convert_checkbox" value="1"/>'); |
|
| 251 | - $setup_tpl->set_var('lang_convert_charset','<label for="convert_checkbox">'. |
|
| 252 | - lang('Convert backup to charset selected above').'</label>'); |
|
| 253 | - $setup_tpl->parse('V_db_stage_3','B_db_stage_3'); |
|
| 254 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_3'); |
|
| 255 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 256 | - break; |
|
| 257 | - case 4: |
|
| 258 | - $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
|
| 259 | - $setup_tpl->set_var('oldver',lang('You appear to be running version %1 of eGroupWare', |
|
| 260 | - isset($setup_info['api']['currentver']) ? $setup_info['api']['currentver'] : $setup_info['phpgwapi']['currentver'])); |
|
| 261 | - $setup_tpl->set_var('automatic',lang('We will automatically update your tables/records to %1',$setup_info['api']['version'])); |
|
| 262 | - $setup_tpl->set_var('backupwarn',lang('but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>These automated scripts can easily destroy your data.</strong>')); |
|
| 263 | - $setup_tpl->set_var('lang_backup',lang('create a backup before upgrading the DB')); |
|
| 264 | - $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
| 265 | - $setup_tpl->set_var('upgrade',lang('Upgrade')); |
|
| 266 | - $setup_tpl->set_var('goto',lang('Go to')); |
|
| 267 | - $setup_tpl->set_var('configuration',lang('configuration')); |
|
| 268 | - $setup_tpl->set_var('admin_account',lang('Create admin account')); |
|
| 269 | - $setup_tpl->set_var('applications',lang('Manage Applications')); |
|
| 270 | - $setup_tpl->set_var('db_backup',lang('DB backup and restore')); |
|
| 271 | - $setup_tpl->set_var('language_management',lang('Manage Languages')); |
|
| 272 | - $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
| 273 | - $setup_tpl->set_var('dont_touch_my_data',lang('Dont touch my data')); |
|
| 274 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
| 234 | + case 2: |
|
| 235 | + $setup_tpl->set_var('prebeta',lang('You appear to be running a pre-beta version of eGroupWare.<br />These versions are no longer supported, and there is no upgrade path for them in setup.<br /> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br />and then upgrade from there with the current version.')); |
|
| 236 | + $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
| 237 | + $setup_tpl->parse('V_db_stage_2','B_db_stage_2'); |
|
| 238 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_2'); |
|
| 239 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 240 | + break; |
|
| 241 | + case 3: |
|
| 242 | + $setup_tpl->set_var('dbexists','<b>'.lang('Your database is working, but you dont have any applications installed').'</b>'); |
|
| 243 | + $setup_tpl->set_var('install',lang('Install')); |
|
| 244 | + $setup_tpl->set_var('proceed',lang('We can proceed')); |
|
| 245 | + $setup_tpl->set_var('coreapps',lang('all applications')); |
|
| 246 | + $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
| 247 | + $setup_tpl->set_var('lang_restore',lang('Or you can install a previous backup.')); |
|
| 248 | + $setup_tpl->set_var('upload','<input type="file" name="uploaded" /> '. |
|
| 249 | + '<input type="submit" name="upload" value="'.htmlspecialchars(lang('install backup')).'" title="'.htmlspecialchars(lang("uploads a backup and installs it on your DB")).'" />'); |
|
| 250 | + $setup_tpl->set_var('convert_checkbox','<input type="checkbox" name="convert_charset" id="convert_checkbox" value="1"/>'); |
|
| 251 | + $setup_tpl->set_var('lang_convert_charset','<label for="convert_checkbox">'. |
|
| 252 | + lang('Convert backup to charset selected above').'</label>'); |
|
| 253 | + $setup_tpl->parse('V_db_stage_3','B_db_stage_3'); |
|
| 254 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_3'); |
|
| 255 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 256 | + break; |
|
| 257 | + case 4: |
|
| 258 | + $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
|
| 259 | + $setup_tpl->set_var('oldver',lang('You appear to be running version %1 of eGroupWare', |
|
| 260 | + isset($setup_info['api']['currentver']) ? $setup_info['api']['currentver'] : $setup_info['phpgwapi']['currentver'])); |
|
| 261 | + $setup_tpl->set_var('automatic',lang('We will automatically update your tables/records to %1',$setup_info['api']['version'])); |
|
| 262 | + $setup_tpl->set_var('backupwarn',lang('but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>These automated scripts can easily destroy your data.</strong>')); |
|
| 263 | + $setup_tpl->set_var('lang_backup',lang('create a backup before upgrading the DB')); |
|
| 264 | + $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
| 265 | + $setup_tpl->set_var('upgrade',lang('Upgrade')); |
|
| 266 | + $setup_tpl->set_var('goto',lang('Go to')); |
|
| 267 | + $setup_tpl->set_var('configuration',lang('configuration')); |
|
| 268 | + $setup_tpl->set_var('admin_account',lang('Create admin account')); |
|
| 269 | + $setup_tpl->set_var('applications',lang('Manage Applications')); |
|
| 270 | + $setup_tpl->set_var('db_backup',lang('DB backup and restore')); |
|
| 271 | + $setup_tpl->set_var('language_management',lang('Manage Languages')); |
|
| 272 | + $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
| 273 | + $setup_tpl->set_var('dont_touch_my_data',lang('Dont touch my data')); |
|
| 274 | + $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
| 275 | 275 | |
| 276 | - $setup_tpl->parse('V_db_stage_4','B_db_stage_4'); |
|
| 277 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_4'); |
|
| 278 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 279 | - break; |
|
| 280 | - case 5: |
|
| 281 | - $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
|
| 282 | - $setup_tpl->set_var('are_you_sure',lang('ARE YOU SURE?')); |
|
| 283 | - $setup_tpl->set_var('really_uninstall_all_applications',lang('REALLY Uninstall all applications')); |
|
| 284 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
| 285 | - $setup_tpl->set_var('cancel',lang('cancel')); |
|
| 286 | - $setup_tpl->parse('V_db_stage_5','B_db_stage_5'); |
|
| 287 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_5'); |
|
| 288 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 289 | - break; |
|
| 290 | - case 6: |
|
| 291 | - $setup_tpl->set_var('status',lang('Status')); |
|
| 292 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
| 293 | - $setup_tpl->set_var('tblchange',lang('Table Change Messages')); |
|
| 294 | - $setup_tpl->parse('V_db_stage_6_pre','B_db_stage_6_pre'); |
|
| 295 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_6_pre'); |
|
| 296 | - $setup_tpl->set_var('tableshave',lang('If you did not receive any errors, your applications have been')); |
|
| 276 | + $setup_tpl->parse('V_db_stage_4','B_db_stage_4'); |
|
| 277 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_4'); |
|
| 278 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 279 | + break; |
|
| 280 | + case 5: |
|
| 281 | + $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
|
| 282 | + $setup_tpl->set_var('are_you_sure',lang('ARE YOU SURE?')); |
|
| 283 | + $setup_tpl->set_var('really_uninstall_all_applications',lang('REALLY Uninstall all applications')); |
|
| 284 | + $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
| 285 | + $setup_tpl->set_var('cancel',lang('cancel')); |
|
| 286 | + $setup_tpl->parse('V_db_stage_5','B_db_stage_5'); |
|
| 287 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_5'); |
|
| 288 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 289 | + break; |
|
| 290 | + case 6: |
|
| 291 | + $setup_tpl->set_var('status',lang('Status')); |
|
| 292 | + $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
| 293 | + $setup_tpl->set_var('tblchange',lang('Table Change Messages')); |
|
| 294 | + $setup_tpl->parse('V_db_stage_6_pre','B_db_stage_6_pre'); |
|
| 295 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_6_pre'); |
|
| 296 | + $setup_tpl->set_var('tableshave',lang('If you did not receive any errors, your applications have been')); |
|
| 297 | 297 | |
| 298 | - try { // catch DB errors to report them |
|
| 299 | - switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi']) |
|
| 300 | - { |
|
| 298 | + try { // catch DB errors to report them |
|
| 299 | + switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi']) |
|
| 300 | + { |
|
| 301 | 301 | case 'dbcreate': |
| 302 | 302 | $GLOBALS['egw_setup']->db->create_database($_POST['db_root'], $_POST['db_pass'], 'utf8', // create all new db's with utf8 |
| 303 | 303 | !preg_match('/^[0-9.a-z_]+$/i', $_POST['db_grant_host']) ? 'localhost' : $_POST['db_grant_host']); |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion'; |
| 377 | 377 | } |
| 378 | 378 | break; |
| 379 | - } |
|
| 379 | + } |
|
| 380 | 380 | } |
| 381 | 381 | catch (Api\Db\Exception $e) |
| 382 | 382 | { |
@@ -388,21 +388,21 @@ discard block |
||
| 388 | 388 | $db_filled_block = $db_filled_block . $setup_tpl->get_var('V_db_stage_6_post'); |
| 389 | 389 | $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
| 390 | 390 | break; |
| 391 | - case 10: |
|
| 392 | - $setup_tpl->set_var('tablescurrent',lang('Your eGroupWare API is current')); |
|
| 393 | - $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
| 394 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
| 395 | - $setup_tpl->set_var('deletetables',lang('Uninstall all applications')); |
|
| 396 | - $setup_tpl->parse('V_db_stage_10','B_db_stage_10'); |
|
| 397 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_10'); |
|
| 398 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 399 | - break; |
|
| 400 | - default: |
|
| 401 | - $setup_tpl->set_var('dbnotexist',lang('Your database does not exist')); |
|
| 402 | - $setup_tpl->parse('V_db_stage_default','B_db_stage_default'); |
|
| 403 | - $db_filled_block = $setup_tpl->get_var('V_db_stage_default'); |
|
| 404 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 405 | - break; |
|
| 391 | + case 10: |
|
| 392 | + $setup_tpl->set_var('tablescurrent',lang('Your eGroupWare API is current')); |
|
| 393 | + $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
| 394 | + $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
| 395 | + $setup_tpl->set_var('deletetables',lang('Uninstall all applications')); |
|
| 396 | + $setup_tpl->parse('V_db_stage_10','B_db_stage_10'); |
|
| 397 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_10'); |
|
| 398 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 399 | + break; |
|
| 400 | + default: |
|
| 401 | + $setup_tpl->set_var('dbnotexist',lang('Your database does not exist')); |
|
| 402 | + $setup_tpl->parse('V_db_stage_default','B_db_stage_default'); |
|
| 403 | + $db_filled_block = $setup_tpl->get_var('V_db_stage_default'); |
|
| 404 | + $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 405 | + break; |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | // Config Section |
@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); |
| 22 | 22 | $setup_tpl = new Framework\Template($tpl_root); |
| 23 | -$setup_tpl->set_file(array |
|
| 24 | -( |
|
| 23 | +$setup_tpl->set_file(array( |
|
| 25 | 24 | 'T_head' => 'head.tpl', |
| 26 | 25 | 'T_footer' => 'footer.tpl', |
| 27 | 26 | 'T_alert_msg' => 'msg_alert_msg.tpl', |
@@ -31,19 +30,19 @@ discard block |
||
| 31 | 30 | 'T_setup_db_blocks' => 'setup_db_blocks.tpl' |
| 32 | 31 | )); |
| 33 | 32 | |
| 34 | -$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
|
| 35 | -$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
|
| 33 | +$setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain'); |
|
| 34 | +$setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain'); |
|
| 36 | 35 | |
| 37 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_1','V_db_stage_1'); |
|
| 38 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_1a','V_db_stage_1a'); |
|
| 39 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_2','V_db_stage_2'); |
|
| 40 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_3','V_db_stage_3'); |
|
| 41 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_4','V_db_stage_4'); |
|
| 42 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_5','V_db_stage_5'); |
|
| 43 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_6_pre','V_db_stage_6_pre'); |
|
| 44 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_6_post','V_db_stage_6_post'); |
|
| 45 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_10','V_db_stage_10'); |
|
| 46 | -$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_default','V_db_stage_default'); |
|
| 36 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_1', 'V_db_stage_1'); |
|
| 37 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_1a', 'V_db_stage_1a'); |
|
| 38 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_2', 'V_db_stage_2'); |
|
| 39 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_3', 'V_db_stage_3'); |
|
| 40 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_4', 'V_db_stage_4'); |
|
| 41 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_5', 'V_db_stage_5'); |
|
| 42 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_6_pre', 'V_db_stage_6_pre'); |
|
| 43 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_6_post', 'V_db_stage_6_post'); |
|
| 44 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_10', 'V_db_stage_10'); |
|
| 45 | +$setup_tpl->set_block('T_setup_db_blocks', 'B_db_stage_default', 'V_db_stage_default'); |
|
| 47 | 46 | |
| 48 | 47 | // Check header and authentication |
| 49 | 48 | $GLOBALS['egw_info']['setup']['stage']['header'] = $GLOBALS['egw_setup']->detection->check_header(); |
@@ -59,9 +58,9 @@ discard block |
||
| 59 | 58 | } |
| 60 | 59 | exit; |
| 61 | 60 | } |
| 62 | -elseif(!$GLOBALS['egw_setup']->auth('Config')) |
|
| 61 | +elseif (!$GLOBALS['egw_setup']->auth('Config')) |
|
| 63 | 62 | { |
| 64 | - $GLOBALS['egw_setup']->html->show_header(lang('Please login'),True); |
|
| 63 | + $GLOBALS['egw_setup']->html->show_header(lang('Please login'), True); |
|
| 65 | 64 | $GLOBALS['egw_setup']->html->login_form(); |
| 66 | 65 | $GLOBALS['egw_setup']->html->show_footer(); |
| 67 | 66 | exit; |
@@ -73,11 +72,11 @@ discard block |
||
| 73 | 72 | $GLOBALS['egw_info']['setup']['header_msg'], |
| 74 | 73 | False, |
| 75 | 74 | 'config', |
| 76 | - $GLOBALS['egw_setup']->ConfigDomain . ' (' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].'://'. |
|
| 75 | + $GLOBALS['egw_setup']->ConfigDomain.' ('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].'://'. |
|
| 77 | 76 | $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_user'].'@'. |
| 78 | 77 | $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_host'].':'. |
| 79 | 78 | $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_port'].'/'. |
| 80 | - $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_name'] . ')' |
|
| 79 | + $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_name'].')' |
|
| 81 | 80 | ); |
| 82 | 81 | /* Add cleaning of app_sessions per skeeter, but with a check for the table being there, just in case */ |
| 83 | 82 | /* $GLOBALS['egw_setup']->clear_session_cache(); */ |
@@ -91,23 +90,23 @@ discard block |
||
| 91 | 90 | $GLOBALS['egw_setup']->detection->get_versions()); |
| 92 | 91 | |
| 93 | 92 | $GLOBALS['egw_info']['setup']['stage']['db'] = $GLOBALS['egw_setup']->detection->check_db($setup_info); |
| 94 | - if($GLOBALS['DEBUG']) |
|
| 93 | + if ($GLOBALS['DEBUG']) |
|
| 95 | 94 | { |
| 96 | 95 | _debug_array($setup_info); |
| 97 | 96 | } |
| 98 | 97 | } |
| 99 | 98 | |
| 100 | -if ($GLOBALS['DEBUG']) { echo 'Stage: ' . $GLOBALS['egw_info']['setup']['stage']['db']; } |
|
| 99 | +if ($GLOBALS['DEBUG']) { echo 'Stage: '.$GLOBALS['egw_info']['setup']['stage']['db']; } |
|
| 101 | 100 | // begin DEBUG code |
| 102 | 101 | //$GLOBALS['egw_info']['setup']['stage']['db'] = 0; |
| 103 | 102 | //$action = 'Upgrade'; |
| 104 | 103 | // end DEBUG code |
| 105 | 104 | |
| 106 | -switch($_POST['action']) |
|
| 105 | +switch ($_POST['action']) |
|
| 107 | 106 | { |
| 108 | 107 | case 'Uninstall all applications': |
| 109 | 108 | $subtitle = lang('Deleting Tables'); |
| 110 | - $submsg = lang('Are you sure you want to delete your existing tables and data?') . '.'; |
|
| 109 | + $submsg = lang('Are you sure you want to delete your existing tables and data?').'.'; |
|
| 111 | 110 | $subaction = lang('uninstall'); |
| 112 | 111 | $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'predrop'; |
| 113 | 112 | $GLOBALS['egw_info']['setup']['stage']['db'] = 5; |
@@ -121,7 +120,7 @@ discard block |
||
| 121 | 120 | break; |
| 122 | 121 | case 'REALLY Uninstall all applications': |
| 123 | 122 | $subtitle = lang('Deleting Tables'); |
| 124 | - $submsg = lang('At your request, this script is going to take the evil action of uninstalling all your apps, which deletes your existing tables and data') . '.'; |
|
| 123 | + $submsg = lang('At your request, this script is going to take the evil action of uninstalling all your apps, which deletes your existing tables and data').'.'; |
|
| 125 | 124 | $subaction = lang('uninstalled'); |
| 126 | 125 | $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'drop'; |
| 127 | 126 | $GLOBALS['egw_info']['setup']['stage']['db'] = 6; |
@@ -152,17 +151,17 @@ discard block |
||
| 152 | 151 | $GLOBALS['egw_info']['setup']['stage']['db'] = 6; |
| 153 | 152 | break; |
| 154 | 153 | } |
| 155 | -$setup_tpl->set_var('subtitle',@$subtitle); |
|
| 156 | -$setup_tpl->set_var('submsg',@$submsg); |
|
| 157 | -$setup_tpl->set_var('subaction',@$subaction); |
|
| 154 | +$setup_tpl->set_var('subtitle', @$subtitle); |
|
| 155 | +$setup_tpl->set_var('submsg', @$submsg); |
|
| 156 | +$setup_tpl->set_var('subaction', @$subaction); |
|
| 158 | 157 | |
| 159 | 158 | // Old PHP |
| 160 | -if ((float) PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
| 159 | +if ((float)PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
| 161 | 160 | { |
| 162 | - $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['header_msg'],True); |
|
| 161 | + $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['header_msg'], True); |
|
| 163 | 162 | $GLOBALS['egw_setup']->html->show_alert_msg('Error', |
| 164 | 163 | lang('You are using PHP version %1. eGroupWare now requires %2 or later, recommended is PHP %3.', |
| 165 | - PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,$GLOBALS['egw_setup']->recommended_php_version)); |
|
| 164 | + PHP_VERSION, $GLOBALS['egw_setup']->required_php_version, $GLOBALS['egw_setup']->recommended_php_version)); |
|
| 166 | 165 | $GLOBALS['egw_setup']->html->show_footer(); |
| 167 | 166 | exit; |
| 168 | 167 | } |
@@ -171,135 +170,134 @@ discard block |
||
| 171 | 170 | |
| 172 | 171 | //$GLOBALS['egw_setup']->app_status(); |
| 173 | 172 | $GLOBALS['egw_info']['server']['app_images'] = 'templates/default/images'; |
| 174 | -$incomplete = $GLOBALS['egw_info']['server']['app_images'] . '/incomplete.png'; |
|
| 175 | -$completed = $GLOBALS['egw_info']['server']['app_images'] . '/completed.png'; |
|
| 173 | +$incomplete = $GLOBALS['egw_info']['server']['app_images'].'/incomplete.png'; |
|
| 174 | +$completed = $GLOBALS['egw_info']['server']['app_images'].'/completed.png'; |
|
| 176 | 175 | |
| 177 | -$setup_tpl->set_var('img_incomplete',$incomplete); |
|
| 178 | -$setup_tpl->set_var('img_completed',$completed); |
|
| 176 | +$setup_tpl->set_var('img_incomplete', $incomplete); |
|
| 177 | +$setup_tpl->set_var('img_completed', $completed); |
|
| 179 | 178 | |
| 180 | -$setup_tpl->set_var('db_step_text',lang('Step %1 - Simple Application Management', ++$num)); |
|
| 181 | -$setup_tpl->set_var('lang_system_charset',lang('<b>charset to use</b> (use utf-8 if you plan to use languages with different charsets):')); |
|
| 182 | -$setup_tpl->set_var('system_charset',str_replace('&','&', |
|
| 183 | - $GLOBALS['egw_setup']->translation->get_charsets('system_charset',$GLOBALS['egw_setup']->system_charset))); |
|
| 179 | +$setup_tpl->set_var('db_step_text', lang('Step %1 - Simple Application Management', ++$num)); |
|
| 180 | +$setup_tpl->set_var('lang_system_charset', lang('<b>charset to use</b> (use utf-8 if you plan to use languages with different charsets):')); |
|
| 181 | +$setup_tpl->set_var('system_charset', str_replace('&', '&', |
|
| 182 | + $GLOBALS['egw_setup']->translation->get_charsets('system_charset', $GLOBALS['egw_setup']->system_charset))); |
|
| 184 | 183 | |
| 185 | -switch($GLOBALS['egw_info']['setup']['stage']['db']) |
|
| 184 | +switch ($GLOBALS['egw_info']['setup']['stage']['db']) |
|
| 186 | 185 | { |
| 187 | 186 | case 1: |
| 188 | - $setup_tpl->set_var('dbnotexist','<b>'.lang('Your Database is not working!').'</b>: '.$GLOBALS['egw_setup']->db->Error); |
|
| 189 | - $setup_tpl->set_var('makesure',lang('Make sure that your database is created and the account permissions are set')); |
|
| 190 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
| 191 | - $setup_tpl->set_var('oncesetup',lang('Once the database is setup correctly')); |
|
| 192 | - $setup_tpl->set_var('createdb','<b>'.lang('Or we can attempt to create the database for you:').'</b>'); |
|
| 193 | - $setup_tpl->set_var('create_database',lang('Create database')); |
|
| 194 | - $setup_tpl->set_var('instr',''); |
|
| 187 | + $setup_tpl->set_var('dbnotexist', '<b>'.lang('Your Database is not working!').'</b>: '.$GLOBALS['egw_setup']->db->Error); |
|
| 188 | + $setup_tpl->set_var('makesure', lang('Make sure that your database is created and the account permissions are set')); |
|
| 189 | + $setup_tpl->set_var('notcomplete', lang('not complete')); |
|
| 190 | + $setup_tpl->set_var('oncesetup', lang('Once the database is setup correctly')); |
|
| 191 | + $setup_tpl->set_var('createdb', '<b>'.lang('Or we can attempt to create the database for you:').'</b>'); |
|
| 192 | + $setup_tpl->set_var('create_database', lang('Create database')); |
|
| 193 | + $setup_tpl->set_var('instr', ''); |
|
| 195 | 194 | $info = $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]; |
| 196 | 195 | switch ($info['db_type']) |
| 197 | 196 | { |
| 198 | 197 | case 'mysql': |
| 199 | 198 | case 'mysqli': |
| 200 | 199 | case 'mysqlt': |
| 201 | - $set_charset = (float) $GLOBALS['egw_setup']->db->ServerInfo['version'] >= 4.1 ? ' DEFAULT CHARACTER SET utf8' : ''; |
|
| 200 | + $set_charset = (float)$GLOBALS['egw_setup']->db->ServerInfo['version'] >= 4.1 ? ' DEFAULT CHARACTER SET utf8' : ''; |
|
| 202 | 201 | $setup_tpl->set_var('instr', |
| 203 | - '<b>'.lang("Instructions for creating the database in %1:",'MySql').'</b>' |
|
| 202 | + '<b>'.lang("Instructions for creating the database in %1:", 'MySql').'</b>' |
|
| 204 | 203 | . '<br />'.lang('Login to mysql -') |
| 205 | 204 | . '<br /><i>[user@server user]# <b>mysql -u root -p</b></i><br />' |
| 206 | 205 | . lang('Create the empty database and grant user permissions -') |
| 207 | 206 | . "<br /><i>mysql> <b>CREATE DATABASE $info[db_name]$set_charset;</b></i>" |
| 208 | - . "<br /><i>mysql> <b>GRANT ALL ON " . $info['db_name'] |
|
| 209 | - . ".* TO " . $info['db_user'] . "@localhost IDENTIFIED BY '" . $info['db_pass'] . "';</b></i>"); |
|
| 210 | - $setup_tpl->parse('V_db_stage_1','B_db_stage_1'); |
|
| 207 | + . "<br /><i>mysql> <b>GRANT ALL ON ".$info['db_name'] |
|
| 208 | + . ".* TO ".$info['db_user']."@localhost IDENTIFIED BY '".$info['db_pass']."';</b></i>"); |
|
| 209 | + $setup_tpl->parse('V_db_stage_1', 'B_db_stage_1'); |
|
| 211 | 210 | break; |
| 212 | 211 | case 'pgsql': |
| 213 | 212 | $ip = $info['db_host'] == 'localhost' ? '127.0.0.1' : '<ip-address webserver>'; |
| 214 | 213 | $setup_tpl->set_var('instr', |
| 215 | - '<b>'.lang('Instructions for creating the database in %1:','PostgreSQL').'</b>' |
|
| 214 | + '<b>'.lang('Instructions for creating the database in %1:', 'PostgreSQL').'</b>' |
|
| 216 | 215 | . '<br />'.lang('Login as user postgres, eg. by using su as root') |
| 217 | 216 | . "<br /><i>[root@server /root]# <b>su - postgres</b></i><br />" |
| 218 | 217 | . lang('Create the empty database and grant user permissions -') |
| 219 | - . "<br /><i>[postgres@server /var/lib/pgsql]\$ <b>createuser --no-adduser --no-createdb -P " . $info['db_user'] . "</b></i>" |
|
| 220 | - . "<br /><i>Enter password for new user: <b>" . $info['db_pass'] . "</b></i>" |
|
| 221 | - . "<br /><i>[postgres@server /var/lib/pgsql]\$ <b>createdb --encoding=utf-8 --owner " . $info['db_user'] . ' ' . $info['db_name'] . "</b></i>" |
|
| 218 | + . "<br /><i>[postgres@server /var/lib/pgsql]\$ <b>createuser --no-adduser --no-createdb -P ".$info['db_user']."</b></i>" |
|
| 219 | + . "<br /><i>Enter password for new user: <b>".$info['db_pass']."</b></i>" |
|
| 220 | + . "<br /><i>[postgres@server /var/lib/pgsql]\$ <b>createdb --encoding=utf-8 --owner ".$info['db_user'].' '.$info['db_name']."</b></i>" |
|
| 222 | 221 | . '<br />'.lang('to allow password authentification add the following line to your pg_hba.conf (above all others) AND restart postgres:') |
| 223 | 222 | . '<br /><i># TYPE DATABASE USER CIDR-ADDRESS METHOD</i>' |
| 224 | - .($info['db_host'] ? "<br /><i><b>host $info[db_name] $info[db_user] $ip/32 password</b></i>" : |
|
| 225 | - "<br /><i><b>local $info[db_name] $info[db_user] password</b></i>")); |
|
| 223 | + .($info['db_host'] ? "<br /><i><b>host $info[db_name] $info[db_user] $ip/32 password</b></i>" : "<br /><i><b>local $info[db_name] $info[db_user] password</b></i>")); |
|
| 226 | 224 | //$setup_tpl->parse('V_db_stage_1','B_db_stage_1'); |
| 227 | 225 | //break; |
| 228 | 226 | default: |
| 229 | - $setup_tpl->parse('V_db_stage_1','B_db_stage_1a'); |
|
| 227 | + $setup_tpl->parse('V_db_stage_1', 'B_db_stage_1a'); |
|
| 230 | 228 | } |
| 231 | 229 | $db_filled_block = $setup_tpl->get_var('V_db_stage_1'); |
| 232 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 230 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
| 233 | 231 | break; |
| 234 | 232 | case 2: |
| 235 | - $setup_tpl->set_var('prebeta',lang('You appear to be running a pre-beta version of eGroupWare.<br />These versions are no longer supported, and there is no upgrade path for them in setup.<br /> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br />and then upgrade from there with the current version.')); |
|
| 236 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
| 237 | - $setup_tpl->parse('V_db_stage_2','B_db_stage_2'); |
|
| 233 | + $setup_tpl->set_var('prebeta', lang('You appear to be running a pre-beta version of eGroupWare.<br />These versions are no longer supported, and there is no upgrade path for them in setup.<br /> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br />and then upgrade from there with the current version.')); |
|
| 234 | + $setup_tpl->set_var('notcomplete', lang('not complete')); |
|
| 235 | + $setup_tpl->parse('V_db_stage_2', 'B_db_stage_2'); |
|
| 238 | 236 | $db_filled_block = $setup_tpl->get_var('V_db_stage_2'); |
| 239 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 237 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
| 240 | 238 | break; |
| 241 | 239 | case 3: |
| 242 | - $setup_tpl->set_var('dbexists','<b>'.lang('Your database is working, but you dont have any applications installed').'</b>'); |
|
| 243 | - $setup_tpl->set_var('install',lang('Install')); |
|
| 244 | - $setup_tpl->set_var('proceed',lang('We can proceed')); |
|
| 245 | - $setup_tpl->set_var('coreapps',lang('all applications')); |
|
| 246 | - $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
| 247 | - $setup_tpl->set_var('lang_restore',lang('Or you can install a previous backup.')); |
|
| 248 | - $setup_tpl->set_var('upload','<input type="file" name="uploaded" /> '. |
|
| 240 | + $setup_tpl->set_var('dbexists', '<b>'.lang('Your database is working, but you dont have any applications installed').'</b>'); |
|
| 241 | + $setup_tpl->set_var('install', lang('Install')); |
|
| 242 | + $setup_tpl->set_var('proceed', lang('We can proceed')); |
|
| 243 | + $setup_tpl->set_var('coreapps', lang('all applications')); |
|
| 244 | + $setup_tpl->set_var('lang_debug', lang('enable for extra debug-messages')); |
|
| 245 | + $setup_tpl->set_var('lang_restore', lang('Or you can install a previous backup.')); |
|
| 246 | + $setup_tpl->set_var('upload', '<input type="file" name="uploaded" /> '. |
|
| 249 | 247 | '<input type="submit" name="upload" value="'.htmlspecialchars(lang('install backup')).'" title="'.htmlspecialchars(lang("uploads a backup and installs it on your DB")).'" />'); |
| 250 | - $setup_tpl->set_var('convert_checkbox','<input type="checkbox" name="convert_charset" id="convert_checkbox" value="1"/>'); |
|
| 251 | - $setup_tpl->set_var('lang_convert_charset','<label for="convert_checkbox">'. |
|
| 248 | + $setup_tpl->set_var('convert_checkbox', '<input type="checkbox" name="convert_charset" id="convert_checkbox" value="1"/>'); |
|
| 249 | + $setup_tpl->set_var('lang_convert_charset', '<label for="convert_checkbox">'. |
|
| 252 | 250 | lang('Convert backup to charset selected above').'</label>'); |
| 253 | - $setup_tpl->parse('V_db_stage_3','B_db_stage_3'); |
|
| 251 | + $setup_tpl->parse('V_db_stage_3', 'B_db_stage_3'); |
|
| 254 | 252 | $db_filled_block = $setup_tpl->get_var('V_db_stage_3'); |
| 255 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 253 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
| 256 | 254 | break; |
| 257 | 255 | case 4: |
| 258 | 256 | $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
| 259 | - $setup_tpl->set_var('oldver',lang('You appear to be running version %1 of eGroupWare', |
|
| 257 | + $setup_tpl->set_var('oldver', lang('You appear to be running version %1 of eGroupWare', |
|
| 260 | 258 | isset($setup_info['api']['currentver']) ? $setup_info['api']['currentver'] : $setup_info['phpgwapi']['currentver'])); |
| 261 | - $setup_tpl->set_var('automatic',lang('We will automatically update your tables/records to %1',$setup_info['api']['version'])); |
|
| 262 | - $setup_tpl->set_var('backupwarn',lang('but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>These automated scripts can easily destroy your data.</strong>')); |
|
| 263 | - $setup_tpl->set_var('lang_backup',lang('create a backup before upgrading the DB')); |
|
| 264 | - $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
| 265 | - $setup_tpl->set_var('upgrade',lang('Upgrade')); |
|
| 266 | - $setup_tpl->set_var('goto',lang('Go to')); |
|
| 267 | - $setup_tpl->set_var('configuration',lang('configuration')); |
|
| 268 | - $setup_tpl->set_var('admin_account',lang('Create admin account')); |
|
| 269 | - $setup_tpl->set_var('applications',lang('Manage Applications')); |
|
| 270 | - $setup_tpl->set_var('db_backup',lang('DB backup and restore')); |
|
| 271 | - $setup_tpl->set_var('language_management',lang('Manage Languages')); |
|
| 272 | - $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
| 273 | - $setup_tpl->set_var('dont_touch_my_data',lang('Dont touch my data')); |
|
| 274 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
| 259 | + $setup_tpl->set_var('automatic', lang('We will automatically update your tables/records to %1', $setup_info['api']['version'])); |
|
| 260 | + $setup_tpl->set_var('backupwarn', lang('but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>These automated scripts can easily destroy your data.</strong>')); |
|
| 261 | + $setup_tpl->set_var('lang_backup', lang('create a backup before upgrading the DB')); |
|
| 262 | + $setup_tpl->set_var('lang_debug', lang('enable for extra debug-messages')); |
|
| 263 | + $setup_tpl->set_var('upgrade', lang('Upgrade')); |
|
| 264 | + $setup_tpl->set_var('goto', lang('Go to')); |
|
| 265 | + $setup_tpl->set_var('configuration', lang('configuration')); |
|
| 266 | + $setup_tpl->set_var('admin_account', lang('Create admin account')); |
|
| 267 | + $setup_tpl->set_var('applications', lang('Manage Applications')); |
|
| 268 | + $setup_tpl->set_var('db_backup', lang('DB backup and restore')); |
|
| 269 | + $setup_tpl->set_var('language_management', lang('Manage Languages')); |
|
| 270 | + $setup_tpl->set_var('uninstall_all_applications', lang('Uninstall all applications')); |
|
| 271 | + $setup_tpl->set_var('dont_touch_my_data', lang('Dont touch my data')); |
|
| 272 | + $setup_tpl->set_var('dropwarn', lang('Your tables will be dropped and you will lose data')); |
|
| 275 | 273 | |
| 276 | - $setup_tpl->parse('V_db_stage_4','B_db_stage_4'); |
|
| 274 | + $setup_tpl->parse('V_db_stage_4', 'B_db_stage_4'); |
|
| 277 | 275 | $db_filled_block = $setup_tpl->get_var('V_db_stage_4'); |
| 278 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 276 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
| 279 | 277 | break; |
| 280 | 278 | case 5: |
| 281 | 279 | $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__))); |
| 282 | - $setup_tpl->set_var('are_you_sure',lang('ARE YOU SURE?')); |
|
| 283 | - $setup_tpl->set_var('really_uninstall_all_applications',lang('REALLY Uninstall all applications')); |
|
| 284 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
| 285 | - $setup_tpl->set_var('cancel',lang('cancel')); |
|
| 286 | - $setup_tpl->parse('V_db_stage_5','B_db_stage_5'); |
|
| 280 | + $setup_tpl->set_var('are_you_sure', lang('ARE YOU SURE?')); |
|
| 281 | + $setup_tpl->set_var('really_uninstall_all_applications', lang('REALLY Uninstall all applications')); |
|
| 282 | + $setup_tpl->set_var('dropwarn', lang('Your tables will be dropped and you will lose data')); |
|
| 283 | + $setup_tpl->set_var('cancel', lang('cancel')); |
|
| 284 | + $setup_tpl->parse('V_db_stage_5', 'B_db_stage_5'); |
|
| 287 | 285 | $db_filled_block = $setup_tpl->get_var('V_db_stage_5'); |
| 288 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 286 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
| 289 | 287 | break; |
| 290 | 288 | case 6: |
| 291 | - $setup_tpl->set_var('status',lang('Status')); |
|
| 292 | - $setup_tpl->set_var('notcomplete',lang('not complete')); |
|
| 293 | - $setup_tpl->set_var('tblchange',lang('Table Change Messages')); |
|
| 294 | - $setup_tpl->parse('V_db_stage_6_pre','B_db_stage_6_pre'); |
|
| 289 | + $setup_tpl->set_var('status', lang('Status')); |
|
| 290 | + $setup_tpl->set_var('notcomplete', lang('not complete')); |
|
| 291 | + $setup_tpl->set_var('tblchange', lang('Table Change Messages')); |
|
| 292 | + $setup_tpl->parse('V_db_stage_6_pre', 'B_db_stage_6_pre'); |
|
| 295 | 293 | $db_filled_block = $setup_tpl->get_var('V_db_stage_6_pre'); |
| 296 | - $setup_tpl->set_var('tableshave',lang('If you did not receive any errors, your applications have been')); |
|
| 294 | + $setup_tpl->set_var('tableshave', lang('If you did not receive any errors, your applications have been')); |
|
| 297 | 295 | |
| 298 | 296 | try { // catch DB errors to report them |
| 299 | 297 | switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi']) |
| 300 | 298 | { |
| 301 | 299 | case 'dbcreate': |
| 302 | - $GLOBALS['egw_setup']->db->create_database($_POST['db_root'], $_POST['db_pass'], 'utf8', // create all new db's with utf8 |
|
| 300 | + $GLOBALS['egw_setup']->db->create_database($_POST['db_root'], $_POST['db_pass'], 'utf8', // create all new db's with utf8 |
|
| 303 | 301 | !preg_match('/^[0-9.a-z_]+$/i', $_POST['db_grant_host']) ? 'localhost' : $_POST['db_grant_host']); |
| 304 | 302 | break; |
| 305 | 303 | case 'drop': |
@@ -315,25 +313,25 @@ discard block |
||
| 315 | 313 | if (is_array($_FILES['uploaded']) && !$_FILES['uploaded']['error'] && |
| 316 | 314 | is_uploaded_file($_FILES['uploaded']['tmp_name'])) |
| 317 | 315 | { |
| 318 | - if (preg_match('/\.(bz2|gz)$/i',$_FILES['uploaded']['name'],$matches)) |
|
| 316 | + if (preg_match('/\.(bz2|gz)$/i', $_FILES['uploaded']['name'], $matches)) |
|
| 319 | 317 | { |
| 320 | 318 | $ext = '.'.$matches[1]; |
| 321 | - move_uploaded_file($_FILES['uploaded']['tmp_name'],$_FILES['uploaded']['tmp_name'].$ext); |
|
| 319 | + move_uploaded_file($_FILES['uploaded']['tmp_name'], $_FILES['uploaded']['tmp_name'].$ext); |
|
| 322 | 320 | $_FILES['uploaded']['tmp_name'] .= $ext; |
| 323 | 321 | } |
| 324 | - if (is_resource($f = $db_backup->fopen_backup($_FILES['uploaded']['tmp_name'],true))) |
|
| 322 | + if (is_resource($f = $db_backup->fopen_backup($_FILES['uploaded']['tmp_name'], true))) |
|
| 325 | 323 | { |
| 326 | - echo '<p align="center">'.lang('restore started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
|
| 327 | - $db_backup->restore($f,$_POST['convert_charset'],$_FILES['uploaded']['tmp_name'],false); |
|
| 324 | + echo '<p align="center">'.lang('restore started, this might take a few minutes ...')."</p>\n".str_repeat(' ', 4096); |
|
| 325 | + $db_backup->restore($f, $_POST['convert_charset'], $_FILES['uploaded']['tmp_name'], false); |
|
| 328 | 326 | fclose($f); |
| 329 | 327 | echo '<p align="center">'.lang('restore finished')."</p>\n"; |
| 330 | 328 | unlink($_FILES['uploaded']['tmp_name']); |
| 331 | 329 | } |
| 332 | 330 | else // backup failed ==> dont start the upgrade |
| 333 | 331 | { |
| 334 | - $setup_tpl->set_var('submsg',lang('Restore failed')); |
|
| 335 | - $setup_tpl->set_var('tableshave','<b>'.$f.'</b>'); |
|
| 336 | - $setup_tpl->set_var('subaction',''); |
|
| 332 | + $setup_tpl->set_var('submsg', lang('Restore failed')); |
|
| 333 | + $setup_tpl->set_var('tableshave', '<b>'.$f.'</b>'); |
|
| 334 | + $setup_tpl->set_var('subaction', ''); |
|
| 337 | 335 | } |
| 338 | 336 | } |
| 339 | 337 | } |
@@ -346,7 +344,7 @@ discard block |
||
| 346 | 344 | $GLOBALS['egw_setup']->system_charset = $_REQUEST['system_charset']; |
| 347 | 345 | $GLOBALS['egw_setup']->db->Link_ID->SetCharSet($_REQUEST['system_charset']); |
| 348 | 346 | } |
| 349 | - $setup_info = $GLOBALS['egw_setup']->process->pass($s_info,'new',$_REQUEST['debug'],True); |
|
| 347 | + $setup_info = $GLOBALS['egw_setup']->process->pass($s_info, 'new', $_REQUEST['debug'], True); |
|
| 350 | 348 | $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion'; |
| 351 | 349 | } |
| 352 | 350 | break; |
@@ -358,21 +356,21 @@ discard block |
||
| 358 | 356 | $db_backup = new Api\Db\Backup(); |
| 359 | 357 | if (is_resource($f = $db_backup->fopen_backup())) |
| 360 | 358 | { |
| 361 | - echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); |
|
| 359 | + echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ', 4096); |
|
| 362 | 360 | $db_backup->backup($f); |
| 363 | 361 | fclose($f); |
| 364 | 362 | echo '<p align="center">'.lang('backup finished')."</p>\n"; |
| 365 | 363 | } |
| 366 | 364 | else // backup failed ==> dont start the upgrade |
| 367 | 365 | { |
| 368 | - $setup_tpl->set_var('submsg',lang('Backup failed')); |
|
| 369 | - $setup_tpl->set_var('tableshave','<b>'.$f.'</b>'); |
|
| 370 | - $setup_tpl->set_var('subaction',''); |
|
| 366 | + $setup_tpl->set_var('submsg', lang('Backup failed')); |
|
| 367 | + $setup_tpl->set_var('tableshave', '<b>'.$f.'</b>'); |
|
| 368 | + $setup_tpl->set_var('subaction', ''); |
|
| 371 | 369 | } |
| 372 | 370 | } |
| 373 | 371 | if (!@$_POST['backup'] || !is_string($f)) |
| 374 | 372 | { |
| 375 | - $setup_info = $GLOBALS['egw_setup']->process->pass($setup_info,'upgrade',$_REQUEST['debug']); |
|
| 373 | + $setup_info = $GLOBALS['egw_setup']->process->pass($setup_info, 'upgrade', $_REQUEST['debug']); |
|
| 376 | 374 | $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion'; |
| 377 | 375 | } |
| 378 | 376 | break; |
@@ -382,159 +380,159 @@ discard block |
||
| 382 | 380 | { |
| 383 | 381 | echo "<pre>".$e->getMessage()."</pre>\n"; |
| 384 | 382 | } |
| 385 | - $setup_tpl->set_var('re-check_my_installation',lang('Re-Check My Installation')); |
|
| 386 | - $setup_tpl->set_var('system_charset',$GLOBALS['egw']->system_charset); |
|
| 387 | - $setup_tpl->parse('V_db_stage_6_post','B_db_stage_6_post'); |
|
| 388 | - $db_filled_block = $db_filled_block . $setup_tpl->get_var('V_db_stage_6_post'); |
|
| 389 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 383 | + $setup_tpl->set_var('re-check_my_installation', lang('Re-Check My Installation')); |
|
| 384 | + $setup_tpl->set_var('system_charset', $GLOBALS['egw']->system_charset); |
|
| 385 | + $setup_tpl->parse('V_db_stage_6_post', 'B_db_stage_6_post'); |
|
| 386 | + $db_filled_block = $db_filled_block.$setup_tpl->get_var('V_db_stage_6_post'); |
|
| 387 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
| 390 | 388 | break; |
| 391 | 389 | case 10: |
| 392 | - $setup_tpl->set_var('tablescurrent',lang('Your eGroupWare API is current')); |
|
| 393 | - $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); |
|
| 394 | - $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); |
|
| 395 | - $setup_tpl->set_var('deletetables',lang('Uninstall all applications')); |
|
| 396 | - $setup_tpl->parse('V_db_stage_10','B_db_stage_10'); |
|
| 390 | + $setup_tpl->set_var('tablescurrent', lang('Your eGroupWare API is current')); |
|
| 391 | + $setup_tpl->set_var('uninstall_all_applications', lang('Uninstall all applications')); |
|
| 392 | + $setup_tpl->set_var('dropwarn', lang('Your tables will be dropped and you will lose data')); |
|
| 393 | + $setup_tpl->set_var('deletetables', lang('Uninstall all applications')); |
|
| 394 | + $setup_tpl->parse('V_db_stage_10', 'B_db_stage_10'); |
|
| 397 | 395 | $db_filled_block = $setup_tpl->get_var('V_db_stage_10'); |
| 398 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 396 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
| 399 | 397 | break; |
| 400 | 398 | default: |
| 401 | - $setup_tpl->set_var('dbnotexist',lang('Your database does not exist')); |
|
| 402 | - $setup_tpl->parse('V_db_stage_default','B_db_stage_default'); |
|
| 399 | + $setup_tpl->set_var('dbnotexist', lang('Your database does not exist')); |
|
| 400 | + $setup_tpl->parse('V_db_stage_default', 'B_db_stage_default'); |
|
| 403 | 401 | $db_filled_block = $setup_tpl->get_var('V_db_stage_default'); |
| 404 | - $setup_tpl->set_var('V_db_filled_block',$db_filled_block); |
|
| 402 | + $setup_tpl->set_var('V_db_filled_block', $db_filled_block); |
|
| 405 | 403 | break; |
| 406 | 404 | } |
| 407 | 405 | |
| 408 | 406 | // Config Section |
| 409 | -$setup_tpl->set_var('config_step_text',lang('Step %1 - Configuration', ++$num)); |
|
| 407 | +$setup_tpl->set_var('config_step_text', lang('Step %1 - Configuration', ++$num)); |
|
| 410 | 408 | $GLOBALS['egw_info']['setup']['stage']['config'] = $GLOBALS['egw_setup']->detection->check_config(); |
| 411 | 409 | |
| 412 | 410 | // begin DEBUG code |
| 413 | 411 | //$GLOBALS['egw_info']['setup']['stage']['config'] = 10; |
| 414 | 412 | // end DEBUG code |
| 415 | 413 | |
| 416 | -$setup_tpl->set_var('config_status_img',$incomplete); |
|
| 417 | -$setup_tpl->set_var('config_status_alt',lang('not completed')); |
|
| 418 | -switch($GLOBALS['egw_info']['setup']['stage']['config']) |
|
| 414 | +$setup_tpl->set_var('config_status_img', $incomplete); |
|
| 415 | +$setup_tpl->set_var('config_status_alt', lang('not completed')); |
|
| 416 | +switch ($GLOBALS['egw_info']['setup']['stage']['config']) |
|
| 419 | 417 | { |
| 420 | 418 | case 1: // AFAIK this dont happen any more, as we have setup_process::save_minimal_config() now -- RalfBecker |
| 421 | 419 | $btn_config_now = $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
| 422 | 420 | lang('Please configure eGroupWare for your environment'), |
| 423 | - 'post','config.php', |
|
| 424 | - 'submit',lang('Configure Now'), |
|
| 421 | + 'post', 'config.php', |
|
| 422 | + 'submit', lang('Configure Now'), |
|
| 425 | 423 | ''); |
| 426 | - $setup_tpl->set_var('config_table_data',$btn_config_now); |
|
| 424 | + $setup_tpl->set_var('config_table_data', $btn_config_now); |
|
| 427 | 425 | break; |
| 428 | 426 | case 10: |
| 429 | - $setup_tpl->set_var('config_status_img',$completed); |
|
| 430 | - $setup_tpl->set_var('config_status_alt',lang('completed')); |
|
| 427 | + $setup_tpl->set_var('config_status_img', $completed); |
|
| 428 | + $setup_tpl->set_var('config_status_alt', lang('completed')); |
|
| 431 | 429 | $config_msg = lang('Configuration completed'); |
| 432 | 430 | case 2: |
| 433 | 431 | if ($GLOBALS['egw_info']['setup']['config_errors']) |
| 434 | 432 | { |
| 435 | - $config_msg = implode('<br />',$GLOBALS['egw_info']['setup']['config_errors']); |
|
| 433 | + $config_msg = implode('<br />', $GLOBALS['egw_info']['setup']['config_errors']); |
|
| 436 | 434 | } |
| 437 | 435 | $btn_edit_config = $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
| 438 | 436 | $config_msg, |
| 439 | - 'post','config.php', |
|
| 440 | - 'submit',lang('Edit Current Configuration'), |
|
| 437 | + 'post', 'config.php', |
|
| 438 | + 'submit', lang('Edit Current Configuration'), |
|
| 441 | 439 | '' |
| 442 | 440 | ); |
| 443 | - $setup_tpl->set_var('config_table_data',$btn_edit_config); |
|
| 441 | + $setup_tpl->set_var('config_table_data', $btn_edit_config); |
|
| 444 | 442 | break; |
| 445 | 443 | default: |
| 446 | - $setup_tpl->set_var('config_status_img',$incomplete); |
|
| 447 | - $setup_tpl->set_var('config_status_alt',lang('not completed')); |
|
| 448 | - $setup_tpl->set_var('config_table_data',lang('Not ready for this stage yet')); |
|
| 444 | + $setup_tpl->set_var('config_status_img', $incomplete); |
|
| 445 | + $setup_tpl->set_var('config_status_alt', lang('not completed')); |
|
| 446 | + $setup_tpl->set_var('config_table_data', lang('Not ready for this stage yet')); |
|
| 449 | 447 | break; |
| 450 | 448 | } |
| 451 | 449 | // Admin Account Section |
| 452 | -$setup_tpl->set_var('admin_step_text',lang('Step %1 - Admin Account', ++$num)); |
|
| 450 | +$setup_tpl->set_var('admin_step_text', lang('Step %1 - Admin Account', ++$num)); |
|
| 453 | 451 | |
| 454 | -switch($GLOBALS['egw_info']['setup']['stage']['config']) |
|
| 452 | +switch ($GLOBALS['egw_info']['setup']['stage']['config']) |
|
| 455 | 453 | { |
| 456 | 454 | case 10: |
| 457 | 455 | // check if there is already a user account (not the anonymous account of sitemgr or a group) |
| 458 | 456 | $no_accounts = !$GLOBALS['egw_setup']->accounts_exist(); |
| 459 | - $setup_tpl->set_var('admin_status_img',$no_accounts ? $incomplete : $completed); |
|
| 460 | - $setup_tpl->set_var('admin_status_alt',$no_accounts ? lang('not completed') : lang('completed')); |
|
| 461 | - $setup_tpl->set_var('admin_table_data',$GLOBALS['egw_setup']->html->make_frm_btn_simple( |
|
| 457 | + $setup_tpl->set_var('admin_status_img', $no_accounts ? $incomplete : $completed); |
|
| 458 | + $setup_tpl->set_var('admin_status_alt', $no_accounts ? lang('not completed') : lang('completed')); |
|
| 459 | + $setup_tpl->set_var('admin_table_data', $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
|
| 462 | 460 | $no_accounts ? lang('No accounts existing') : lang('Accounts existing'), |
| 463 | - 'post','admin_account.php', |
|
| 464 | - 'submit',lang('Create admin account'), |
|
| 461 | + 'post', 'admin_account.php', |
|
| 462 | + 'submit', lang('Create admin account'), |
|
| 465 | 463 | '' |
| 466 | 464 | )); |
| 467 | 465 | break; |
| 468 | 466 | default: |
| 469 | - $setup_tpl->set_var('admin_status_img',$incomplete); |
|
| 470 | - $setup_tpl->set_var('admin_status_alt',lang('not completed')); |
|
| 471 | - $setup_tpl->set_var('admin_table_data',lang('Not ready for this stage yet')); |
|
| 467 | + $setup_tpl->set_var('admin_status_img', $incomplete); |
|
| 468 | + $setup_tpl->set_var('admin_status_alt', lang('not completed')); |
|
| 469 | + $setup_tpl->set_var('admin_table_data', lang('Not ready for this stage yet')); |
|
| 472 | 470 | break; |
| 473 | 471 | } |
| 474 | 472 | |
| 475 | -$setup_tpl->set_var('apps_step_text',lang('Step %1 - Advanced Application Management', ++$num)); |
|
| 473 | +$setup_tpl->set_var('apps_step_text', lang('Step %1 - Advanced Application Management', ++$num)); |
|
| 476 | 474 | // $GLOBALS['egw_info']['setup']['stage']['apps'] = $GLOBALS['egw_setup']->check_apps(); |
| 477 | -switch($GLOBALS['egw_info']['setup']['stage']['db']) |
|
| 475 | +switch ($GLOBALS['egw_info']['setup']['stage']['db']) |
|
| 478 | 476 | { |
| 479 | 477 | case 10: |
| 480 | - $setup_tpl->set_var('apps_status_img',$completed); |
|
| 481 | - $setup_tpl->set_var('apps_status_alt',lang('completed')); |
|
| 478 | + $setup_tpl->set_var('apps_status_img', $completed); |
|
| 479 | + $setup_tpl->set_var('apps_status_alt', lang('completed')); |
|
| 482 | 480 | // check if we have apps to upgrade or essential apps not installed |
| 483 | 481 | $to_upgrade = $to_install = array(); |
| 484 | - foreach($setup_info as $app => $data) |
|
| 482 | + foreach ($setup_info as $app => $data) |
|
| 485 | 483 | { |
| 486 | 484 | if ($data['currentver'] && $data['version'] && $data['version'] != $data['currentver']) |
| 487 | 485 | { |
| 488 | 486 | $to_upgrade[] = $app; |
| 489 | - $setup_tpl->set_var('apps_status_img',$incomplete); |
|
| 487 | + $setup_tpl->set_var('apps_status_img', $incomplete); |
|
| 490 | 488 | } |
| 491 | 489 | } |
| 492 | 490 | // warn if essential apps are not installed |
| 493 | - foreach(array('api','admin','preferences') as $app) |
|
| 491 | + foreach (array('api', 'admin', 'preferences') as $app) |
|
| 494 | 492 | { |
| 495 | 493 | if (!isset($setup_info[$app]) || empty($setup_info[$app]['currentver'])) |
| 496 | 494 | { |
| 497 | 495 | $to_install[] = $app; |
| 498 | - $setup_tpl->set_var('apps_status_img',$incomplete); |
|
| 496 | + $setup_tpl->set_var('apps_status_img', $incomplete); |
|
| 499 | 497 | } |
| 500 | 498 | } |
| 501 | 499 | $msg = ''; |
| 502 | 500 | if ($to_upgrade || $to_install) |
| 503 | 501 | { |
| 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); |
|
| 502 | + if ($to_upgrade) $msg = '<b>'.lang('The following applications need to be upgraded:').'</b> '.implode(', ', $to_upgrade); |
|
| 503 | + if ($to_install) $msg .= ($msg ? '<br />' : '').'<b>'.lang('The following applications are required, but NOT installed:').'</b> '.implode(', ', $to_install); |
|
| 506 | 504 | } |
| 507 | 505 | $btn_manage_apps = $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
| 508 | 506 | $msg ? $msg : lang('This stage is completed<br />'), |
| 509 | - 'post','applications.php', |
|
| 510 | - 'submit',lang('Manage Applications'), |
|
| 507 | + 'post', 'applications.php', |
|
| 508 | + 'submit', lang('Manage Applications'), |
|
| 511 | 509 | ''); |
| 512 | - $setup_tpl->set_var('apps_table_data',$btn_manage_apps); |
|
| 510 | + $setup_tpl->set_var('apps_table_data', $btn_manage_apps); |
|
| 513 | 511 | break; |
| 514 | 512 | default: |
| 515 | - $setup_tpl->set_var('apps_status_img',$incomplete); |
|
| 516 | - $setup_tpl->set_var('apps_status_alt',lang('not completed')); |
|
| 517 | - $setup_tpl->set_var('apps_table_data',lang('Not ready for this stage yet')); |
|
| 513 | + $setup_tpl->set_var('apps_status_img', $incomplete); |
|
| 514 | + $setup_tpl->set_var('apps_status_alt', lang('not completed')); |
|
| 515 | + $setup_tpl->set_var('apps_table_data', lang('Not ready for this stage yet')); |
|
| 518 | 516 | break; |
| 519 | 517 | } |
| 520 | 518 | // Backup and restore section |
| 521 | -$setup_tpl->set_var('backup_step_text',lang('Step %1 - DB backup and restore', ++$num)); |
|
| 519 | +$setup_tpl->set_var('backup_step_text', lang('Step %1 - DB backup and restore', ++$num)); |
|
| 522 | 520 | if ($GLOBALS['egw_info']['setup']['stage']['db'] == 10 && !$no_backup_dir) |
| 523 | 521 | { |
| 524 | - $setup_tpl->set_var('backup_status_img',$completed); |
|
| 525 | - $setup_tpl->set_var('backup_status_alt',lang('completed')); |
|
| 526 | - $setup_tpl->set_var('backup_table_data',$GLOBALS['egw_setup']->html->make_frm_btn_simple( |
|
| 522 | + $setup_tpl->set_var('backup_status_img', $completed); |
|
| 523 | + $setup_tpl->set_var('backup_status_alt', lang('completed')); |
|
| 524 | + $setup_tpl->set_var('backup_table_data', $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
|
| 527 | 525 | ''/*lang('This stage is completed<br />')*/, |
| 528 | - 'post','db_backup.php', |
|
| 529 | - 'submit',lang('backup and restore'), |
|
| 526 | + 'post', 'db_backup.php', |
|
| 527 | + 'submit', lang('backup and restore'), |
|
| 530 | 528 | '')); |
| 531 | 529 | } |
| 532 | 530 | else |
| 533 | 531 | { |
| 534 | - $setup_tpl->set_var('backup_status_img',$incomplete); |
|
| 535 | - $setup_tpl->set_var('backup_status_alt',lang('not completed')); |
|
| 536 | - $setup_tpl->set_var('backup_table_data',$no_backup_dir ? $no_backup_dir : lang('Not ready for this stage yet')); |
|
| 532 | + $setup_tpl->set_var('backup_status_img', $incomplete); |
|
| 533 | + $setup_tpl->set_var('backup_status_alt', lang('not completed')); |
|
| 534 | + $setup_tpl->set_var('backup_table_data', $no_backup_dir ? $no_backup_dir : lang('Not ready for this stage yet')); |
|
| 537 | 535 | } |
| 538 | 536 | |
| 539 | -$setup_tpl->pparse('out','T_setup_main'); |
|
| 537 | +$setup_tpl->pparse('out', 'T_setup_main'); |
|
| 540 | 538 | $GLOBALS['egw_setup']->html->show_footer(); |
@@ -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 />'), |
@@ -350,7 +350,7 @@ |
||
| 350 | 350 | { |
| 351 | 351 | echo lang('because it depends upon') . ':<br />' . "\n"; |
| 352 | 352 | list($depapp,$depver) = parsedep($setup_info[$resolve]['depends'],False); |
| 353 | - $depapp_count = count($depapp); |
|
| 353 | + $depapp_count = count($depapp); |
|
| 354 | 354 | for ($i=0; $i<$depapp_count; $i++) |
| 355 | 355 | { |
| 356 | 356 | echo '<br />' . $depapp[$i] . ': '; |
@@ -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]); |
@@ -51,36 +51,36 @@ discard block |
||
| 51 | 51 | Api\Csrf::validate($_POST['csrf_token'], __FILE__); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
|
| 55 | -$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
|
| 56 | -$setup_tpl->set_block('T_setup_main','header','header'); |
|
| 57 | -$setup_tpl->set_block('T_setup_main','app_header','app_header'); |
|
| 58 | -$setup_tpl->set_block('T_setup_main','apps','apps'); |
|
| 59 | -$setup_tpl->set_block('T_setup_main','detail','detail'); |
|
| 60 | -$setup_tpl->set_block('T_setup_main','table','table'); |
|
| 61 | -$setup_tpl->set_block('T_setup_main','hook','hook'); |
|
| 62 | -$setup_tpl->set_block('T_setup_main','dep','dep'); |
|
| 63 | -$setup_tpl->set_block('T_setup_main','app_footer','app_footer'); |
|
| 64 | -$setup_tpl->set_block('T_setup_main','submit','submit'); |
|
| 65 | -$setup_tpl->set_block('T_setup_main','footer','footer'); |
|
| 66 | - |
|
| 67 | -$bgcolor = array('#DDDDDD','#EEEEEE'); |
|
| 68 | - |
|
| 69 | -function parsedep($depends,$main=True) |
|
| 54 | +$setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain'); |
|
| 55 | +$setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain'); |
|
| 56 | +$setup_tpl->set_block('T_setup_main', 'header', 'header'); |
|
| 57 | +$setup_tpl->set_block('T_setup_main', 'app_header', 'app_header'); |
|
| 58 | +$setup_tpl->set_block('T_setup_main', 'apps', 'apps'); |
|
| 59 | +$setup_tpl->set_block('T_setup_main', 'detail', 'detail'); |
|
| 60 | +$setup_tpl->set_block('T_setup_main', 'table', 'table'); |
|
| 61 | +$setup_tpl->set_block('T_setup_main', 'hook', 'hook'); |
|
| 62 | +$setup_tpl->set_block('T_setup_main', 'dep', 'dep'); |
|
| 63 | +$setup_tpl->set_block('T_setup_main', 'app_footer', 'app_footer'); |
|
| 64 | +$setup_tpl->set_block('T_setup_main', 'submit', 'submit'); |
|
| 65 | +$setup_tpl->set_block('T_setup_main', 'footer', 'footer'); |
|
| 66 | + |
|
| 67 | +$bgcolor = array('#DDDDDD', '#EEEEEE'); |
|
| 68 | + |
|
| 69 | +function parsedep($depends, $main = True) |
|
| 70 | 70 | { |
| 71 | 71 | $depstring = '('; |
| 72 | - foreach($depends as $b) |
|
| 72 | + foreach ($depends as $b) |
|
| 73 | 73 | { |
| 74 | - foreach($b as $c => $d) |
|
| 74 | + foreach ($b as $c => $d) |
|
| 75 | 75 | { |
| 76 | 76 | if (is_array($d)) |
| 77 | 77 | { |
| 78 | - $depstring .= $c . ': ' .implode(',',$d) . '; '; |
|
| 78 | + $depstring .= $c.': '.implode(',', $d).'; '; |
|
| 79 | 79 | $depver[] = $d; |
| 80 | 80 | } |
| 81 | 81 | else |
| 82 | 82 | { |
| 83 | - $depstring .= $c . ': ' . $d . '; '; |
|
| 83 | + $depstring .= $c.': '.$d.'; '; |
|
| 84 | 84 | $depapp[] = $d; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | else |
| 94 | 94 | { |
| 95 | - return array($depapp,$depver); |
|
| 95 | + return array($depapp, $depver); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -106,17 +106,17 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | @ksort($setup_info); |
| 108 | 108 | |
| 109 | -if(@$_POST['cancel']) |
|
| 109 | +if (@$_POST['cancel']) |
|
| 110 | 110 | { |
| 111 | 111 | Header("Location: index.php"); |
| 112 | 112 | exit; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | -if(@$_POST['submit']) |
|
| 115 | +if (@$_POST['submit']) |
|
| 116 | 116 | { |
| 117 | - $GLOBALS['egw_setup']->html->show_header(lang('Application Management'),False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
| 118 | - $setup_tpl->set_var('description',lang('App install/remove/upgrade') . ':'); |
|
| 119 | - $setup_tpl->pparse('out','header'); |
|
| 117 | + $GLOBALS['egw_setup']->html->show_header(lang('Application Management'), False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
| 118 | + $setup_tpl->set_var('description', lang('App install/remove/upgrade').':'); |
|
| 119 | + $setup_tpl->pparse('out', 'header'); |
|
| 120 | 120 | |
| 121 | 121 | $appname = $_POST['appname']; |
| 122 | 122 | $remove = $_POST['remove']; |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | $register_hooks = false; |
| 127 | 127 | |
| 128 | - if(!empty($remove) && is_array($remove)) |
|
| 128 | + if (!empty($remove) && is_array($remove)) |
|
| 129 | 129 | { |
| 130 | 130 | $historylog = new Api\Storage\History(); |
| 131 | 131 | $historylog->db = $GLOBALS['egw_setup']->db; |
| 132 | 132 | |
| 133 | - foreach($remove as $appname => $key) |
|
| 133 | + foreach ($remove as $appname => $key) |
|
| 134 | 134 | { |
| 135 | 135 | $app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name']; |
| 136 | 136 | $terror = array(); |
@@ -138,30 +138,30 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | if ($setup_info[$appname]['tables']) |
| 140 | 140 | { |
| 141 | - $GLOBALS['egw_setup']->process->droptables($terror,$DEBUG); |
|
| 142 | - echo '<br />' . $app_title . ' ' . lang('tables dropped') . '.'; |
|
| 141 | + $GLOBALS['egw_setup']->process->droptables($terror, $DEBUG); |
|
| 142 | + echo '<br />'.$app_title.' '.lang('tables dropped').'.'; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $GLOBALS['egw_setup']->deregister_app($setup_info[$appname]['name']); |
| 146 | - echo '<br />' . $app_title . ' ' . lang('deregistered') . '.'; |
|
| 146 | + echo '<br />'.$app_title.' '.lang('deregistered').'.'; |
|
| 147 | 147 | |
| 148 | 148 | $register_hooks = true; |
| 149 | 149 | |
| 150 | 150 | $historylog->appname = $appname; |
| 151 | 151 | if ($historylog->delete(null)) |
| 152 | 152 | { |
| 153 | - echo '<br />' . $app_title . ' ' . lang('Historylog removed') . '.'; |
|
| 153 | + echo '<br />'.$app_title.' '.lang('Historylog removed').'.'; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // delete all application categories and ACL |
| 157 | - $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->cats_table,array('cat_appname' => $appname),__LINE__,__FILE__); |
|
| 158 | - $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->acl_table,array('acl_appname' => $appname),__LINE__,__FILE__); |
|
| 157 | + $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->cats_table, array('cat_appname' => $appname), __LINE__, __FILE__); |
|
| 158 | + $GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->acl_table, array('acl_appname' => $appname), __LINE__, __FILE__); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if(!empty($install) && is_array($install)) |
|
| 162 | + if (!empty($install) && is_array($install)) |
|
| 163 | 163 | { |
| 164 | - foreach($install as $appname => $key) |
|
| 164 | + foreach ($install as $appname => $key) |
|
| 165 | 165 | { |
| 166 | 166 | $app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name']; |
| 167 | 167 | $terror = array(); |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | { |
| 172 | 172 | $terror_c = $GLOBALS['egw_setup']->process->current($terror, $DEBUG); |
| 173 | 173 | $terror = $GLOBALS['egw_setup']->process->default_records($terror_c, $DEBUG); |
| 174 | - echo '<br />' . $app_title . ' ' |
|
| 175 | - . lang('tables installed, unless there are errors printed above') . '.'; |
|
| 174 | + echo '<br />'.$app_title.' ' |
|
| 175 | + . lang('tables installed, unless there are errors printed above').'.'; |
|
| 176 | 176 | } |
| 177 | 177 | else |
| 178 | 178 | { |
| 179 | 179 | // check default_records for apps without tables, they might need some initial work too |
| 180 | - $terror = $GLOBALS['egw_setup']->process->default_records($terror,$DEBUG); |
|
| 180 | + $terror = $GLOBALS['egw_setup']->process->default_records($terror, $DEBUG); |
|
| 181 | 181 | if ($GLOBALS['egw_setup']->app_registered($setup_info[$appname]['name'])) |
| 182 | 182 | { |
| 183 | 183 | $GLOBALS['egw_setup']->update_app($setup_info[$appname]['name']); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | $GLOBALS['egw_setup']->register_app($setup_info[$appname]['name']); |
| 188 | 188 | } |
| 189 | - echo '<br />' . $app_title . ' ' . lang('registered') . '.'; |
|
| 189 | + echo '<br />'.$app_title.' '.lang('registered').'.'; |
|
| 190 | 190 | |
| 191 | 191 | if ($setup_info[$appname]['hooks']) |
| 192 | 192 | { |
@@ -196,23 +196,23 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if(!empty($upgrade) && is_array($upgrade)) |
|
| 199 | + if (!empty($upgrade) && is_array($upgrade)) |
|
| 200 | 200 | { |
| 201 | - foreach($upgrade as $appname => $key) |
|
| 201 | + foreach ($upgrade as $appname => $key) |
|
| 202 | 202 | { |
| 203 | 203 | $app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name']; |
| 204 | 204 | $terror = array(); |
| 205 | 205 | $terror[$appname] = $setup_info[$appname]; |
| 206 | 206 | |
| 207 | - $GLOBALS['egw_setup']->process->upgrade($terror,$DEBUG); |
|
| 207 | + $GLOBALS['egw_setup']->process->upgrade($terror, $DEBUG); |
|
| 208 | 208 | if ($setup_info[$appname]['tables']) |
| 209 | 209 | { |
| 210 | - echo '<br />' . $app_title . ' ' . lang('tables upgraded') . '.'; |
|
| 210 | + echo '<br />'.$app_title.' '.lang('tables upgraded').'.'; |
|
| 211 | 211 | // The process_upgrade() function also handles registration |
| 212 | 212 | } |
| 213 | 213 | else |
| 214 | 214 | { |
| 215 | - echo '<br />' . $app_title . ' ' . lang('upgraded') . '.'; |
|
| 215 | + echo '<br />'.$app_title.' '.lang('upgraded').'.'; |
|
| 216 | 216 | } |
| 217 | 217 | $register_hooks = true; |
| 218 | 218 | } |
@@ -221,61 +221,61 @@ discard block |
||
| 221 | 221 | if ($register_hooks) |
| 222 | 222 | { |
| 223 | 223 | Api\Hooks::read(true); |
| 224 | - echo '<br />' . $app_title . ' ' . lang('hooks registered') . '.'; |
|
| 224 | + echo '<br />'.$app_title.' '.lang('hooks registered').'.'; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | //$setup_tpl->set_var('goback', |
| 228 | - echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>'; |
|
| 228 | + echo '<br /><a href="applications.php?debug='.$DEBUG.'">'.lang('Go back').'</a>'; |
|
| 229 | 229 | //$setup_tpl->pparse('out','submit'); |
| 230 | - $setup_tpl->pparse('out','footer'); |
|
| 230 | + $setup_tpl->pparse('out', 'footer'); |
|
| 231 | 231 | exit; |
| 232 | 232 | } |
| 233 | 233 | else |
| 234 | 234 | { |
| 235 | - $GLOBALS['egw_setup']->html->show_header(lang('Application Management'),False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
| 235 | + $GLOBALS['egw_setup']->html->show_header(lang('Application Management'), False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | -if(@$_GET['hooks']) |
|
| 238 | +if (@$_GET['hooks']) |
|
| 239 | 239 | { |
| 240 | 240 | Api\Cache::flush(Api\Cache::INSTANCE); |
| 241 | 241 | |
| 242 | - echo lang('Cached cleared') . '<br />'; |
|
| 242 | + echo lang('Cached cleared').'<br />'; |
|
| 243 | 243 | } |
| 244 | 244 | $detail = $_GET['detail']; |
| 245 | 245 | $resolve = $_GET['resolve']; |
| 246 | -if(@$detail) |
|
| 246 | +if (@$detail) |
|
| 247 | 247 | { |
| 248 | 248 | @ksort($setup_info[$detail]); |
| 249 | - $setup_tpl->set_var('description',lang('App details') . ':'); |
|
| 250 | - $setup_tpl->pparse('out','header'); |
|
| 249 | + $setup_tpl->set_var('description', lang('App details').':'); |
|
| 250 | + $setup_tpl->pparse('out', 'header'); |
|
| 251 | 251 | |
| 252 | - $setup_tpl->set_var('name','application'); |
|
| 252 | + $setup_tpl->set_var('name', 'application'); |
|
| 253 | 253 | $setup_tpl->set_var('details', lang($setup_info[$detail]['title'])); |
| 254 | - $setup_tpl->pparse('out','detail'); |
|
| 254 | + $setup_tpl->pparse('out', 'detail'); |
|
| 255 | 255 | |
| 256 | - foreach($setup_info[$detail] as $key => $val) |
|
| 256 | + foreach ($setup_info[$detail] as $key => $val) |
|
| 257 | 257 | { |
| 258 | - switch($key) |
|
| 258 | + switch ($key) |
|
| 259 | 259 | { |
| 260 | 260 | case 'title': |
| 261 | 261 | continue 2; |
| 262 | 262 | case 'tables': |
| 263 | 263 | $tblcnt = count($setup_info[$detail][$key]); |
| 264 | - if(is_array($val)) |
|
| 264 | + if (is_array($val)) |
|
| 265 | 265 | { |
| 266 | - $key = '<a href="sqltoarray.php?appname=' . $detail . '&submit=True&apps=True">' . $key . '(' . $tblcnt . ')</a>' . "\n"; |
|
| 267 | - $val = implode(',' . "\n",$val); |
|
| 266 | + $key = '<a href="sqltoarray.php?appname='.$detail.'&submit=True&apps=True">'.$key.'('.$tblcnt.')</a>'."\n"; |
|
| 267 | + $val = implode(','."\n", $val); |
|
| 268 | 268 | } |
| 269 | 269 | break; |
| 270 | 270 | case 'hooks': |
| 271 | - foreach($val as &$hooks) |
|
| 271 | + foreach ($val as &$hooks) |
|
| 272 | 272 | { |
| 273 | 273 | $hooks = (array)$hooks; |
| 274 | 274 | } |
| 275 | 275 | $val = str_replace('EGroupware\\', '', implode(', ', call_user_func_array('array_merge', $val))); |
| 276 | 276 | break; |
| 277 | 277 | case 'depends': |
| 278 | - foreach($val as &$dep) |
|
| 278 | + foreach ($val as &$dep) |
|
| 279 | 279 | { |
| 280 | 280 | $dep = $dep['appname'].': '.implode(', ', $dep['versions']); |
| 281 | 281 | } |
@@ -288,174 +288,174 @@ discard block |
||
| 288 | 288 | if (is_array($val)) $val = implode(', ', $val); |
| 289 | 289 | break; |
| 290 | 290 | } |
| 291 | - $setup_tpl->set_var('bg_color', $bgcolor[++$i & 1]); |
|
| 292 | - $setup_tpl->set_var('name',$key); |
|
| 293 | - $setup_tpl->set_var('details',$val); |
|
| 294 | - $setup_tpl->pparse('out','detail'); |
|
| 291 | + $setup_tpl->set_var('bg_color', $bgcolor[++$i&1]); |
|
| 292 | + $setup_tpl->set_var('name', $key); |
|
| 293 | + $setup_tpl->set_var('details', $val); |
|
| 294 | + $setup_tpl->pparse('out', 'detail'); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>'; |
|
| 298 | - $setup_tpl->pparse('out','footer'); |
|
| 297 | + echo '<br /><a href="applications.php?debug='.$DEBUG.'">'.lang('Go back').'</a>'; |
|
| 298 | + $setup_tpl->pparse('out', 'footer'); |
|
| 299 | 299 | exit; |
| 300 | 300 | } |
| 301 | 301 | elseif (@$resolve) |
| 302 | 302 | { |
| 303 | 303 | $version = $_GET['version']; |
| 304 | 304 | $notables = $_GET['notables']; |
| 305 | - $setup_tpl->set_var('description',lang('Problem resolution'). ':'); |
|
| 306 | - $setup_tpl->pparse('out','header'); |
|
| 305 | + $setup_tpl->set_var('description', lang('Problem resolution').':'); |
|
| 306 | + $setup_tpl->pparse('out', 'header'); |
|
| 307 | 307 | $app_title = $setup_info[$resolve]['title'] ? $setup_info[$resolve]['title'] : $setup_info[$resolve]['name']; |
| 308 | 308 | |
| 309 | - if($_GET['post']) |
|
| 309 | + if ($_GET['post']) |
|
| 310 | 310 | { |
| 311 | - echo '"' . $app_title . '" ' . lang('may be broken') . ' '; |
|
| 311 | + echo '"'.$app_title.'" '.lang('may be broken').' '; |
|
| 312 | 312 | echo lang('because an application it depends upon was upgraded'); |
| 313 | 313 | echo '<br />'; |
| 314 | - echo lang('to a version it does not know about') . '.'; |
|
| 314 | + echo lang('to a version it does not know about').'.'; |
|
| 315 | 315 | echo '<br />'; |
| 316 | - echo lang('However, the application may still work') . '.'; |
|
| 316 | + echo lang('However, the application may still work').'.'; |
|
| 317 | 317 | } |
| 318 | - elseif($_GET['badinstall']) |
|
| 318 | + elseif ($_GET['badinstall']) |
|
| 319 | 319 | { |
| 320 | - echo '"' . $app_title . '" ' . lang('is broken') . ' '; |
|
| 321 | - echo lang('because of a failed upgrade or install') . '.'; |
|
| 320 | + echo '"'.$app_title.'" '.lang('is broken').' '; |
|
| 321 | + echo lang('because of a failed upgrade or install').'.'; |
|
| 322 | 322 | echo '<br />'; |
| 323 | - echo lang('Some or all of its tables are missing') . '.'; |
|
| 323 | + echo lang('Some or all of its tables are missing').'.'; |
|
| 324 | 324 | echo '<br />'; |
| 325 | - echo lang('You should either uninstall and then reinstall it, or attempt manual repairs') . '.'; |
|
| 325 | + echo lang('You should either uninstall and then reinstall it, or attempt manual repairs').'.'; |
|
| 326 | 326 | } |
| 327 | - elseif($_GET['deleted']) |
|
| 327 | + elseif ($_GET['deleted']) |
|
| 328 | 328 | { |
| 329 | - echo '"' . $app_title . '" ' . lang('is broken') . ' '; |
|
| 330 | - echo lang('because its sources are missing') . '!'; |
|
| 329 | + echo '"'.$app_title.'" '.lang('is broken').' '; |
|
| 330 | + echo lang('because its sources are missing').'!'; |
|
| 331 | 331 | echo '<br />'; |
| 332 | - echo lang('However the tables are still in the database') . '.'; |
|
| 332 | + echo lang('However the tables are still in the database').'.'; |
|
| 333 | 333 | echo '<br />'; |
| 334 | - echo lang('You should either install the sources or uninstall it, to get rid of the tables') . '.'; |
|
| 334 | + echo lang('You should either install the sources or uninstall it, to get rid of the tables').'.'; |
|
| 335 | 335 | } |
| 336 | 336 | elseif (!$version) |
| 337 | 337 | { |
| 338 | - if($setup_info[$resolve]['enabled']) |
|
| 338 | + if ($setup_info[$resolve]['enabled']) |
|
| 339 | 339 | { |
| 340 | - echo '"' . $app_title . '" ' . lang('is broken') . ' '; |
|
| 340 | + echo '"'.$app_title.'" '.lang('is broken').' '; |
|
| 341 | 341 | } |
| 342 | 342 | else |
| 343 | 343 | { |
| 344 | - echo '"' . $app_title . '" ' . lang('is disabled') . ' '; |
|
| 344 | + echo '"'.$app_title.'" '.lang('is disabled').' '; |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | if (!$notables) |
| 348 | 348 | { |
| 349 | - if($setup_info[$resolve]['status'] == 'D') |
|
| 349 | + if ($setup_info[$resolve]['status'] == 'D') |
|
| 350 | 350 | { |
| 351 | - echo lang('because it depends upon') . ':<br />' . "\n"; |
|
| 352 | - list($depapp,$depver) = parsedep($setup_info[$resolve]['depends'],False); |
|
| 351 | + echo lang('because it depends upon').':<br />'."\n"; |
|
| 352 | + list($depapp, $depver) = parsedep($setup_info[$resolve]['depends'], False); |
|
| 353 | 353 | $depapp_count = count($depapp); |
| 354 | - for ($i=0; $i<$depapp_count; $i++) |
|
| 354 | + for ($i = 0; $i < $depapp_count; $i++) |
|
| 355 | 355 | { |
| 356 | - echo '<br />' . $depapp[$i] . ': '; |
|
| 356 | + echo '<br />'.$depapp[$i].': '; |
|
| 357 | 357 | $list = ''; |
| 358 | - foreach($depver[$i] as $x => $y) |
|
| 358 | + foreach ($depver[$i] as $x => $y) |
|
| 359 | 359 | { |
| 360 | - $list .= $y . ', '; |
|
| 360 | + $list .= $y.', '; |
|
| 361 | 361 | } |
| 362 | - echo substr($list,0,-2)."\n"; |
|
| 362 | + echo substr($list, 0, -2)."\n"; |
|
| 363 | 363 | } |
| 364 | - echo '<br /><br />' . lang('The table definition was correct, and the tables were installed') . '.'; |
|
| 364 | + echo '<br /><br />'.lang('The table definition was correct, and the tables were installed').'.'; |
|
| 365 | 365 | } |
| 366 | 366 | else |
| 367 | 367 | { |
| 368 | - echo lang('because it was manually disabled') . '.'; |
|
| 368 | + echo lang('because it was manually disabled').'.'; |
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | - elseif($setup_info[$resolve]['enable'] == 2) |
|
| 371 | + elseif ($setup_info[$resolve]['enable'] == 2) |
|
| 372 | 372 | { |
| 373 | - echo lang('because it is not a user application, or access is controlled via acl') . '.'; |
|
| 373 | + echo lang('because it is not a user application, or access is controlled via acl').'.'; |
|
| 374 | 374 | } |
| 375 | - elseif($setup_info[$resolve]['enable'] == 0) |
|
| 375 | + elseif ($setup_info[$resolve]['enable'] == 0) |
|
| 376 | 376 | { |
| 377 | - echo lang('because the enable flag for this app is set to 0, or is undefined') . '.'; |
|
| 377 | + echo lang('because the enable flag for this app is set to 0, or is undefined').'.'; |
|
| 378 | 378 | } |
| 379 | 379 | else |
| 380 | 380 | { |
| 381 | - echo lang('because it requires manual table installation, <br />or the table definition was incorrect') . ".\n" |
|
| 382 | - . lang("Please check for sql scripts within the application's directory") . '.'; |
|
| 381 | + echo lang('because it requires manual table installation, <br />or the table definition was incorrect').".\n" |
|
| 382 | + . lang("Please check for sql scripts within the application's directory").'.'; |
|
| 383 | 383 | } |
| 384 | - echo '<br />' . lang('However, the application is otherwise installed') . '.'; |
|
| 384 | + echo '<br />'.lang('However, the application is otherwise installed').'.'; |
|
| 385 | 385 | } |
| 386 | 386 | else |
| 387 | 387 | { |
| 388 | - echo $app_title . ' ' . lang('has a version mismatch') . ' '; |
|
| 389 | - echo lang('because of a failed upgrade, or the database is newer than the installed version of this app') . '.'; |
|
| 388 | + echo $app_title.' '.lang('has a version mismatch').' '; |
|
| 389 | + echo lang('because of a failed upgrade, or the database is newer than the installed version of this app').'.'; |
|
| 390 | 390 | echo '<br />'; |
| 391 | - echo lang('If the application has no defined tables, selecting upgrade should remedy the problem') . '.'; |
|
| 392 | - echo '<br />' . lang('However, the application is otherwise installed') . '.'; |
|
| 391 | + echo lang('If the application has no defined tables, selecting upgrade should remedy the problem').'.'; |
|
| 392 | + echo '<br />'.lang('However, the application is otherwise installed').'.'; |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>'; |
|
| 396 | - $setup_tpl->pparse('out','footer'); |
|
| 395 | + echo '<br /><a href="applications.php?debug='.$DEBUG.'">'.lang('Go back').'</a>'; |
|
| 396 | + $setup_tpl->pparse('out', 'footer'); |
|
| 397 | 397 | exit; |
| 398 | 398 | } |
| 399 | 399 | else |
| 400 | 400 | { |
| 401 | - $setup_tpl->set_var('description',lang('Select the desired action(s) from the available choices')); |
|
| 402 | - $setup_tpl->set_var('action_url','applications.php'); |
|
| 403 | - $setup_tpl->pparse('out','header'); |
|
| 404 | - |
|
| 405 | - $setup_tpl->set_var('appdata',lang('Application Data')); |
|
| 406 | - $setup_tpl->set_var('actions',lang('Actions')); |
|
| 407 | - $setup_tpl->set_var('app_info',lang('Application Name and Status Information')); |
|
| 408 | - $setup_tpl->set_var('app_title',lang('Application Title')); |
|
| 409 | - $setup_tpl->set_var('app_currentver',lang('Current Version')); |
|
| 410 | - $setup_tpl->set_var('app_version',lang('Available Version')); |
|
| 411 | - $setup_tpl->set_var('app_install',lang('Install')); |
|
| 412 | - $setup_tpl->set_var('app_remove',lang('Remove')); |
|
| 413 | - $setup_tpl->set_var('app_upgrade',lang('Upgrade')); |
|
| 414 | - $setup_tpl->set_var('app_resolve',lang('Resolve')); |
|
| 415 | - $setup_tpl->set_var('check','check.png'); |
|
| 416 | - $setup_tpl->set_var('install_all',lang('Install All')); |
|
| 417 | - $setup_tpl->set_var('upgrade_all',lang('Upgrade All')); |
|
| 418 | - $setup_tpl->set_var('remove_all',lang('Remove All')); |
|
| 419 | - $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); |
|
| 420 | - $setup_tpl->set_var('debug','<input type="checkbox" name="debug" value="True"' .($DEBUG ? ' checked="checked"' : '') . ' />'); |
|
| 421 | - $setup_tpl->set_var('bg_color',$bgcolor[0]); |
|
| 422 | - |
|
| 423 | - $setup_tpl->pparse('out','app_header'); |
|
| 401 | + $setup_tpl->set_var('description', lang('Select the desired action(s) from the available choices')); |
|
| 402 | + $setup_tpl->set_var('action_url', 'applications.php'); |
|
| 403 | + $setup_tpl->pparse('out', 'header'); |
|
| 404 | + |
|
| 405 | + $setup_tpl->set_var('appdata', lang('Application Data')); |
|
| 406 | + $setup_tpl->set_var('actions', lang('Actions')); |
|
| 407 | + $setup_tpl->set_var('app_info', lang('Application Name and Status Information')); |
|
| 408 | + $setup_tpl->set_var('app_title', lang('Application Title')); |
|
| 409 | + $setup_tpl->set_var('app_currentver', lang('Current Version')); |
|
| 410 | + $setup_tpl->set_var('app_version', lang('Available Version')); |
|
| 411 | + $setup_tpl->set_var('app_install', lang('Install')); |
|
| 412 | + $setup_tpl->set_var('app_remove', lang('Remove')); |
|
| 413 | + $setup_tpl->set_var('app_upgrade', lang('Upgrade')); |
|
| 414 | + $setup_tpl->set_var('app_resolve', lang('Resolve')); |
|
| 415 | + $setup_tpl->set_var('check', 'check.png'); |
|
| 416 | + $setup_tpl->set_var('install_all', lang('Install All')); |
|
| 417 | + $setup_tpl->set_var('upgrade_all', lang('Upgrade All')); |
|
| 418 | + $setup_tpl->set_var('remove_all', lang('Remove All')); |
|
| 419 | + $setup_tpl->set_var('lang_debug', lang('enable for extra debug-messages')); |
|
| 420 | + $setup_tpl->set_var('debug', '<input type="checkbox" name="debug" value="True"'.($DEBUG ? ' checked="checked"' : '').' />'); |
|
| 421 | + $setup_tpl->set_var('bg_color', $bgcolor[0]); |
|
| 422 | + |
|
| 423 | + $setup_tpl->pparse('out', 'app_header'); |
|
| 424 | 424 | |
| 425 | 425 | $i = 0; |
| 426 | - foreach($setup_info as $key => $value) |
|
| 426 | + foreach ($setup_info as $key => $value) |
|
| 427 | 427 | { |
| 428 | - if(@$value['name']) |
|
| 428 | + if (@$value['name']) |
|
| 429 | 429 | { |
| 430 | 430 | $i = ($i ? 0 : 1); |
| 431 | - $setup_tpl->set_var('apptitle',$value['title']?$value['title']:lang($value['name'])); |
|
| 432 | - $setup_tpl->set_var('currentver',@$value['currentver']); |
|
| 433 | - $setup_tpl->set_var('version',$value['version']); |
|
| 434 | - $setup_tpl->set_var('bg_color',$bgcolor[$i]); |
|
| 431 | + $setup_tpl->set_var('apptitle', $value['title'] ? $value['title'] : lang($value['name'])); |
|
| 432 | + $setup_tpl->set_var('currentver', @$value['currentver']); |
|
| 433 | + $setup_tpl->set_var('version', $value['version']); |
|
| 434 | + $setup_tpl->set_var('bg_color', $bgcolor[$i]); |
|
| 435 | 435 | |
| 436 | - switch($value['status']) |
|
| 436 | + switch ($value['status']) |
|
| 437 | 437 | { |
| 438 | 438 | case 'C': |
| 439 | - $setup_tpl->set_var('remove', $key == 'api' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />'); |
|
| 440 | - $setup_tpl->set_var('upgrade',' '); |
|
| 439 | + $setup_tpl->set_var('remove', $key == 'api' ? ' ' : '<input type="checkbox" name="remove['.$value['name'].']" />'); |
|
| 440 | + $setup_tpl->set_var('upgrade', ' '); |
|
| 441 | 441 | if (!$GLOBALS['egw_setup']->detection->check_app_tables($value['name'])) |
| 442 | 442 | { |
| 443 | 443 | // App installed and enabled, but some tables are missing |
| 444 | - $setup_tpl->set_var('instimg','table.png'); |
|
| 445 | - $setup_tpl->set_var('bg_color','FFCCAA'); |
|
| 446 | - $setup_tpl->set_var('instalt',lang('Not Completed')); |
|
| 447 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>'); |
|
| 448 | - $status = lang('Requires reinstall or manual repair') . ' - ' . $value['status']; |
|
| 444 | + $setup_tpl->set_var('instimg', 'table.png'); |
|
| 445 | + $setup_tpl->set_var('bg_color', 'FFCCAA'); |
|
| 446 | + $setup_tpl->set_var('instalt', lang('Not Completed')); |
|
| 447 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&badinstall=True">'.lang('Potential Problem').'</a>'); |
|
| 448 | + $status = lang('Requires reinstall or manual repair').' - '.$value['status']; |
|
| 449 | 449 | } |
| 450 | 450 | else |
| 451 | 451 | { |
| 452 | - $setup_tpl->set_var('instimg','completed.png'); |
|
| 453 | - $setup_tpl->set_var('instalt',lang('Completed')); |
|
| 454 | - $setup_tpl->set_var('install',' '); |
|
| 455 | - if($value['enabled']) |
|
| 452 | + $setup_tpl->set_var('instimg', 'completed.png'); |
|
| 453 | + $setup_tpl->set_var('instalt', lang('Completed')); |
|
| 454 | + $setup_tpl->set_var('install', ' '); |
|
| 455 | + if ($value['enabled']) |
|
| 456 | 456 | { |
| 457 | - $setup_tpl->set_var('resolution',''); |
|
| 458 | - $status = lang('OK') . ' - ' . $value['status']; |
|
| 457 | + $setup_tpl->set_var('resolution', ''); |
|
| 458 | + $status = lang('OK').' - '.$value['status']; |
|
| 459 | 459 | } |
| 460 | 460 | else |
| 461 | 461 | { |
@@ -463,123 +463,123 @@ discard block |
||
| 463 | 463 | { |
| 464 | 464 | $notables = '¬ables=True'; |
| 465 | 465 | } |
| 466 | - $setup_tpl->set_var('bg_color','CCCCFF'); |
|
| 466 | + $setup_tpl->set_var('bg_color', 'CCCCFF'); |
|
| 467 | 467 | $setup_tpl->set_var('resolution', |
| 468 | - '<a href="applications.php?resolve=' . $value['name'] . $notables . '">' . lang('Possible Reasons') . '</a>' |
|
| 468 | + '<a href="applications.php?resolve='.$value['name'].$notables.'">'.lang('Possible Reasons').'</a>' |
|
| 469 | 469 | ); |
| 470 | - $status = lang('Disabled') . ' - ' . $value['status']; |
|
| 470 | + $status = lang('Disabled').' - '.$value['status']; |
|
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | break; |
| 474 | 474 | case 'U': |
| 475 | - $setup_tpl->set_var('instimg','incomplete.png'); |
|
| 476 | - $setup_tpl->set_var('instalt',lang('Not Completed')); |
|
| 475 | + $setup_tpl->set_var('instimg', 'incomplete.png'); |
|
| 476 | + $setup_tpl->set_var('instalt', lang('Not Completed')); |
|
| 477 | 477 | if (!@$value['currentver']) |
| 478 | 478 | { |
| 479 | - if ($value['tables'] && $GLOBALS['egw_setup']->detection->check_app_tables($value['name'],True)) |
|
| 479 | + if ($value['tables'] && $GLOBALS['egw_setup']->detection->check_app_tables($value['name'], True)) |
|
| 480 | 480 | { |
| 481 | 481 | // Some tables missing |
| 482 | - $setup_tpl->set_var('remove',$key == 'api' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />'); |
|
| 483 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>'); |
|
| 484 | - $status = lang('Requires reinstall or manual repair') . ' - ' . $value['status']; |
|
| 482 | + $setup_tpl->set_var('remove', $key == 'api' ? ' ' : '<input type="checkbox" name="remove['.$value['name'].']" />'); |
|
| 483 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&badinstall=True">'.lang('Potential Problem').'</a>'); |
|
| 484 | + $status = lang('Requires reinstall or manual repair').' - '.$value['status']; |
|
| 485 | 485 | } |
| 486 | 486 | else |
| 487 | 487 | { |
| 488 | - $setup_tpl->set_var('remove',' '); |
|
| 489 | - $setup_tpl->set_var('resolution',''); |
|
| 490 | - $status = lang('Requires upgrade') . ' - ' . $value['status']; |
|
| 488 | + $setup_tpl->set_var('remove', ' '); |
|
| 489 | + $setup_tpl->set_var('resolution', ''); |
|
| 490 | + $status = lang('Requires upgrade').' - '.$value['status']; |
|
| 491 | 491 | } |
| 492 | 492 | // show not installed apps without icon |
| 493 | - $setup_tpl->set_var('instimg','spacer.png'); |
|
| 494 | - $setup_tpl->set_var('instalt',''); |
|
| 495 | - $setup_tpl->set_var('bg_color','CCFFCC'); |
|
| 496 | - $setup_tpl->set_var('install','<input type="checkbox" name="install[' . $value['name'] . ']" />'); |
|
| 497 | - $setup_tpl->set_var('upgrade',' '); |
|
| 498 | - $status = lang('Please install') . ' - ' . $value['status']; |
|
| 493 | + $setup_tpl->set_var('instimg', 'spacer.png'); |
|
| 494 | + $setup_tpl->set_var('instalt', ''); |
|
| 495 | + $setup_tpl->set_var('bg_color', 'CCFFCC'); |
|
| 496 | + $setup_tpl->set_var('install', '<input type="checkbox" name="install['.$value['name'].']" />'); |
|
| 497 | + $setup_tpl->set_var('upgrade', ' '); |
|
| 498 | + $status = lang('Please install').' - '.$value['status']; |
|
| 499 | 499 | } |
| 500 | 500 | else |
| 501 | 501 | { |
| 502 | - $setup_tpl->set_var('bg_color','CCCCFF'); |
|
| 503 | - $setup_tpl->set_var('install',' '); |
|
| 502 | + $setup_tpl->set_var('bg_color', 'CCCCFF'); |
|
| 503 | + $setup_tpl->set_var('install', ' '); |
|
| 504 | 504 | // TODO display some info about breakage if you mess with this app |
| 505 | - $setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']" />'); |
|
| 506 | - $setup_tpl->set_var('remove',$key == 'api' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />'); |
|
| 507 | - $setup_tpl->set_var('resolution',''); |
|
| 508 | - $status = lang('Requires upgrade') . ' - ' . $value['status']; |
|
| 505 | + $setup_tpl->set_var('upgrade', '<input type="checkbox" name="upgrade['.$value['name'].']" />'); |
|
| 506 | + $setup_tpl->set_var('remove', $key == 'api' ? ' ' : '<input type="checkbox" name="remove['.$value['name'].']" />'); |
|
| 507 | + $setup_tpl->set_var('resolution', ''); |
|
| 508 | + $status = lang('Requires upgrade').' - '.$value['status']; |
|
| 509 | 509 | } |
| 510 | 510 | break; |
| 511 | 511 | case 'V': |
| 512 | - $setup_tpl->set_var('instimg','incomplete.png'); |
|
| 513 | - $setup_tpl->set_var('instalt',lang('Not Completed')); |
|
| 514 | - $setup_tpl->set_var('install',' '); |
|
| 515 | - $setup_tpl->set_var('remove',$key == 'api' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />'); |
|
| 512 | + $setup_tpl->set_var('instimg', 'incomplete.png'); |
|
| 513 | + $setup_tpl->set_var('instalt', lang('Not Completed')); |
|
| 514 | + $setup_tpl->set_var('install', ' '); |
|
| 515 | + $setup_tpl->set_var('remove', $key == 'api' ? ' ' : '<input type="checkbox" name="remove['.$value['name'].']" />'); |
|
| 516 | 516 | if ($value['version'] == 'deleted') |
| 517 | 517 | { |
| 518 | - $setup_tpl->set_var('bg_color','CCAAAA'); |
|
| 519 | - $setup_tpl->set_var('upgrade',' '); |
|
| 520 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&deleted=True">' . lang('Possible Solutions') . '</a>'); |
|
| 521 | - $status = lang('Sources deleted/missing') . ' - ' . $value['status']; |
|
| 518 | + $setup_tpl->set_var('bg_color', 'CCAAAA'); |
|
| 519 | + $setup_tpl->set_var('upgrade', ' '); |
|
| 520 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&deleted=True">'.lang('Possible Solutions').'</a>'); |
|
| 521 | + $status = lang('Sources deleted/missing').' - '.$value['status']; |
|
| 522 | 522 | } |
| 523 | 523 | else |
| 524 | 524 | { |
| 525 | - $setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']" />'); |
|
| 526 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&version=True">' . lang('Possible Solutions') . '</a>'); |
|
| 527 | - $status = lang('Version Mismatch') . ' - ' . $value['status']; |
|
| 525 | + $setup_tpl->set_var('upgrade', '<input type="checkbox" name="upgrade['.$value['name'].']" />'); |
|
| 526 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&version=True">'.lang('Possible Solutions').'</a>'); |
|
| 527 | + $status = lang('Version Mismatch').' - '.$value['status']; |
|
| 528 | 528 | } |
| 529 | 529 | break; |
| 530 | 530 | case 'D': |
| 531 | - $setup_tpl->set_var('bg_color','FFCCCC'); |
|
| 531 | + $setup_tpl->set_var('bg_color', 'FFCCCC'); |
|
| 532 | 532 | $depstring = parsedep($value['depends']); |
| 533 | 533 | $depstring .= ')'; |
| 534 | - $setup_tpl->set_var('instimg','dep.png'); |
|
| 535 | - $setup_tpl->set_var('instalt',lang('Dependency Failure')); |
|
| 536 | - $setup_tpl->set_var('install',' '); |
|
| 534 | + $setup_tpl->set_var('instimg', 'dep.png'); |
|
| 535 | + $setup_tpl->set_var('instalt', lang('Dependency Failure')); |
|
| 536 | + $setup_tpl->set_var('install', ' '); |
|
| 537 | 537 | if ($values['currentver']) |
| 538 | 538 | { |
| 539 | - $setup_tpl->set_var('remove',$key == 'api' ? ' ' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />'); |
|
| 540 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '">' . lang('Possible Solutions') . '</a>'); |
|
| 539 | + $setup_tpl->set_var('remove', $key == 'api' ? ' ' : '<input type="checkbox" name="remove['.$value['name'].']" />'); |
|
| 540 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'">'.lang('Possible Solutions').'</a>'); |
|
| 541 | 541 | } |
| 542 | 542 | else |
| 543 | 543 | { |
| 544 | - $setup_tpl->set_var('remove',' '); |
|
| 545 | - $setup_tpl->set_var('resolution',' '); |
|
| 544 | + $setup_tpl->set_var('remove', ' '); |
|
| 545 | + $setup_tpl->set_var('resolution', ' '); |
|
| 546 | 546 | } |
| 547 | - $setup_tpl->set_var('upgrade',' '); |
|
| 548 | - $status = lang('Dependency Failure') . ':' . $depstring . $value['status']; |
|
| 547 | + $setup_tpl->set_var('upgrade', ' '); |
|
| 548 | + $status = lang('Dependency Failure').':'.$depstring.$value['status']; |
|
| 549 | 549 | break; |
| 550 | 550 | case 'P': |
| 551 | - $setup_tpl->set_var('bg_color','FFCCFF'); |
|
| 551 | + $setup_tpl->set_var('bg_color', 'FFCCFF'); |
|
| 552 | 552 | $depstring = parsedep($value['depends']); |
| 553 | 553 | $depstring .= ')'; |
| 554 | - $setup_tpl->set_var('instimg','dep.png'); |
|
| 555 | - $setup_tpl->set_var('instalt',lang('Post-install Dependency Failure')); |
|
| 556 | - $setup_tpl->set_var('install',' '); |
|
| 557 | - $setup_tpl->set_var('remove',' '); |
|
| 558 | - $setup_tpl->set_var('upgrade',' '); |
|
| 559 | - $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&post=True">' . lang('Possible Solutions') . '</a>'); |
|
| 560 | - $status = lang('Post-install Dependency Failure') . ':' . $depstring . $value['status']; |
|
| 554 | + $setup_tpl->set_var('instimg', 'dep.png'); |
|
| 555 | + $setup_tpl->set_var('instalt', lang('Post-install Dependency Failure')); |
|
| 556 | + $setup_tpl->set_var('install', ' '); |
|
| 557 | + $setup_tpl->set_var('remove', ' '); |
|
| 558 | + $setup_tpl->set_var('upgrade', ' '); |
|
| 559 | + $setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&post=True">'.lang('Possible Solutions').'</a>'); |
|
| 560 | + $status = lang('Post-install Dependency Failure').':'.$depstring.$value['status']; |
|
| 561 | 561 | break; |
| 562 | 562 | default: |
| 563 | - $setup_tpl->set_var('instimg','incomplete.png'); |
|
| 564 | - $setup_tpl->set_var('instalt',lang('Not Completed')); |
|
| 565 | - $setup_tpl->set_var('install',' '); |
|
| 566 | - $setup_tpl->set_var('remove',' '); |
|
| 567 | - $setup_tpl->set_var('upgrade',' '); |
|
| 568 | - $setup_tpl->set_var('resolution',''); |
|
| 563 | + $setup_tpl->set_var('instimg', 'incomplete.png'); |
|
| 564 | + $setup_tpl->set_var('instalt', lang('Not Completed')); |
|
| 565 | + $setup_tpl->set_var('install', ' '); |
|
| 566 | + $setup_tpl->set_var('remove', ' '); |
|
| 567 | + $setup_tpl->set_var('upgrade', ' '); |
|
| 568 | + $setup_tpl->set_var('resolution', ''); |
|
| 569 | 569 | $status = ''; |
| 570 | 570 | break; |
| 571 | 571 | } |
| 572 | 572 | //$setup_tpl->set_var('appname',$value['name'] . '-' . $status . ',' . $value['filename']); |
| 573 | - $setup_tpl->set_var('appinfo',$value['name'] . '-' . $status); |
|
| 574 | - $setup_tpl->set_var('appname',$value['name']); |
|
| 573 | + $setup_tpl->set_var('appinfo', $value['name'].'-'.$status); |
|
| 574 | + $setup_tpl->set_var('appname', $value['name']); |
|
| 575 | 575 | |
| 576 | - $setup_tpl->pparse('out','apps',True); |
|
| 576 | + $setup_tpl->pparse('out', 'apps', True); |
|
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | - $setup_tpl->set_var('submit',lang('Save')); |
|
| 581 | - $setup_tpl->set_var('cancel',lang('Cancel')); |
|
| 582 | - $setup_tpl->pparse('out','app_footer'); |
|
| 583 | - $setup_tpl->pparse('out','footer'); |
|
| 580 | + $setup_tpl->set_var('submit', lang('Save')); |
|
| 581 | + $setup_tpl->set_var('cancel', lang('Cancel')); |
|
| 582 | + $setup_tpl->pparse('out', 'app_footer'); |
|
| 583 | + $setup_tpl->pparse('out', 'footer'); |
|
| 584 | 584 | $GLOBALS['egw_setup']->html->show_footer(); |
| 585 | 585 | } |