[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare * 4 * http://www.egroupware.org * 5 * -------------------------------------------- * 6 * This program is free software; you can redistribute it and/or modify it * 7 * under the terms of the GNU General Public License as published by the * 8 * Free Software Foundation; either version 2 of the License, or (at your * 9 * option) any later version. * 10 \**************************************************************************/ 11 /* $Id: index.php 21783 2006-06-08 19:53:04Z ralfbecker $ */ 12 13 $GLOBALS['DEBUG'] = False; 14 $GLOBALS['egw_info'] = array( 15 'flags' => array( 16 'noheader' => True, 17 'nonavbar' => True, 18 'currentapp' => 'home', 19 'noapi' => True, 20 'nocachecontrol' => True 21 )); 22 include ('./inc/functions.inc.php'); 23 24 @set_time_limit(0); 25 26 $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); 27 $setup_tpl = CreateObject('setup.Template',$tpl_root); 28 $setup_tpl->set_file(array 29 ( 30 'T_head' => 'head.tpl', 31 'T_footer' => 'footer.tpl', 32 'T_alert_msg' => 'msg_alert_msg.tpl', 33 'T_login_main' => 'login_main.tpl', 34 'T_login_stage_header' => 'login_stage_header.tpl', 35 'T_setup_main' => 'setup_main.tpl', 36 'T_setup_db_blocks' => 'setup_db_blocks.tpl' 37 )); 38 39 $setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); 40 $setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); 41 42 $setup_tpl->set_block('T_setup_db_blocks','B_db_stage_1','V_db_stage_1'); 43 $setup_tpl->set_block('T_setup_db_blocks','B_db_stage_1a','V_db_stage_1a'); 44 $setup_tpl->set_block('T_setup_db_blocks','B_db_stage_2','V_db_stage_2'); 45 $setup_tpl->set_block('T_setup_db_blocks','B_db_stage_3','V_db_stage_3'); 46 $setup_tpl->set_block('T_setup_db_blocks','B_db_stage_4','V_db_stage_4'); 47 $setup_tpl->set_block('T_setup_db_blocks','B_db_stage_5','V_db_stage_5'); 48 $setup_tpl->set_block('T_setup_db_blocks','B_db_stage_6_pre','V_db_stage_6_pre'); 49 $setup_tpl->set_block('T_setup_db_blocks','B_db_stage_6_post','V_db_stage_6_post'); 50 $setup_tpl->set_block('T_setup_db_blocks','B_db_stage_10','V_db_stage_10'); 51 $setup_tpl->set_block('T_setup_db_blocks','B_db_stage_default','V_db_stage_default'); 52 53 // Check header and authentication 54 $GLOBALS['egw_info']['setup']['stage']['header'] = $GLOBALS['egw_setup']->detection->check_header(); 55 if ($GLOBALS['egw_info']['setup']['stage']['header'] != '10') 56 { 57 if ($GLOBALS['egw_info']['setup']['stage']['header'] == 4) // header needs update, go there direct 58 { 59 Header('Location: manageheader.php'); 60 } 61 else // run check-install first 62 { 63 Header('Location: check_install.php?intro=1'); 64 } 65 exit; 66 } 67 elseif(!$GLOBALS['egw_setup']->auth('Config')) 68 { 69 $GLOBALS['egw_setup']->html->show_header(lang('Please login'),True); 70 $GLOBALS['egw_setup']->html->login_form(); 71 $GLOBALS['egw_setup']->html->show_footer(); 72 exit; 73 } 74 75 $GLOBALS['egw_setup']->loaddb(); 76 77 $GLOBALS['egw_setup']->html->show_header( 78 $GLOBALS['egw_info']['setup']['header_msg'], 79 False, 80 'config', 81 $GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')' 82 ); 83 /* Add cleaning of app_sessions per skeeter, but with a check for the table being there, just in case */ 84 /* $GLOBALS['egw_setup']->clear_session_cache(); */ 85 86 // Database actions 87 $setup_info = $GLOBALS['egw_setup']->detection->get_versions(); 88 $GLOBALS['egw_info']['setup']['stage']['db'] = $GLOBALS['egw_setup']->detection->check_db($setup_info); 89 if ($GLOBALS['egw_info']['setup']['stage']['db'] != 1) 90 { 91 $setup_info = $GLOBALS['egw_setup']->detection->get_versions(); 92 $setup_info = $GLOBALS['egw_setup']->detection->get_db_versions($setup_info); 93 $GLOBALS['egw_info']['setup']['stage']['db'] = $GLOBALS['egw_setup']->detection->check_db($setup_info); 94 if($GLOBALS['DEBUG']) 95 { 96 _debug_array($setup_info); 97 } 98 } 99 100 if ($GLOBALS['DEBUG']) { echo 'Stage: ' . $GLOBALS['egw_info']['setup']['stage']['db']; } 101 // begin DEBUG code 102 //$GLOBALS['egw_info']['setup']['stage']['db'] = 0; 103 //$action = 'Upgrade'; 104 // end DEBUG code 105 106 switch(@get_var('action',Array('POST'))) 107 { 108 case 'Uninstall all applications': 109 $subtitle = lang('Deleting Tables'); 110 $submsg = lang('Are you sure you want to delete your existing tables and data?') . '.'; 111 $subaction = lang('uninstall'); 112 $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'predrop'; 113 $GLOBALS['egw_info']['setup']['stage']['db'] = 5; 114 break; 115 case 'Create Database': 116 $subtitle = lang('Create Database'); 117 $submsg = lang('At your request, this script is going to attempt to create the database and assign the db user rights to it'); 118 $subaction = lang('created'); 119 $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'dbcreate'; 120 $GLOBALS['egw_info']['setup']['stage']['db'] = 6; 121 break; 122 case 'REALLY Uninstall all applications': 123 $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') . '.'; 125 $subaction = lang('uninstalled'); 126 $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'drop'; 127 $GLOBALS['egw_info']['setup']['stage']['db'] = 6; 128 break; 129 case 'Upgrade': 130 $subtitle = lang('Upgrading Tables'); 131 $submsg = lang('At your request, this script is going to attempt to upgrade your old applications to the current versions').'.'; 132 if ($_POST['backup']) 133 { 134 $submsg .= ' '.lang('After backing up your tables first.'); 135 } 136 $subaction = lang('upgraded'); 137 $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion'; 138 $GLOBALS['egw_info']['setup']['stage']['db'] = 6; 139 break; 140 case 'Install': 141 $subtitle = lang('Creating Tables'); 142 if ($_POST['upload']) 143 { 144 $submsg = lang('At your request, this script is going to attempt to install a previous backup').'.'; 145 } 146 else 147 { 148 $submsg = lang('At your request, this script is going to attempt to install the core tables and the admin and preferences applications for you').'.'; 149 } 150 $subaction = lang('installed'); 151 $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'new'; 152 $GLOBALS['egw_info']['setup']['stage']['db'] = 6; 153 break; 154 } 155 $setup_tpl->set_var('subtitle',@$subtitle); 156 $setup_tpl->set_var('submsg',@$submsg); 157 $setup_tpl->set_var('subaction',@$subaction); 158 159 // Old PHP 160 if (!function_exists('version_compare'))//version_compare() is only available in PHP4.1+ 161 { 162 $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['header_msg'],True); 163 $GLOBALS['egw_setup']->html->show_alert_msg('Error', 164 lang('You appear to be running an old version of PHP <br />It its recommend that you upgrade to a new version. <br />Older version of PHP might not run eGroupWare correctly, if at all. <br /><br />Please upgrade to at least version %1','4.1')); 165 $GLOBALS['egw_setup']->html->show_footer(); 166 exit; 167 } 168 169 // BEGIN setup page 170 171 //$GLOBALS['egw_setup']->app_status(); 172 $GLOBALS['egw_info']['server']['app_images'] = 'templates/default/images'; 173 $incomplete = $GLOBALS['egw_info']['server']['app_images'] . '/incomplete.png'; 174 $completed = $GLOBALS['egw_info']['server']['app_images'] . '/completed.png'; 175 176 $setup_tpl->set_var('img_incomplete',$incomplete); 177 $setup_tpl->set_var('img_completed',$completed); 178 179 $setup_tpl->set_var('db_step_text',lang('Step %1 - Simple Application Management',1)); 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('&','&',$GLOBALS['egw_setup']->translation->get_charsets('system_charset', 182 $GLOBALS['egw_setup']->system_charset))); 183 184 switch($GLOBALS['egw_info']['setup']['stage']['db']) 185 { 186 case 1: 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',''); 194 $info = $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]; 195 switch ($info['db_type']) 196 { 197 case 'mysql': 198 case 'mysqli': 199 case 'mysqlt': 200 $set_charset = (float) $GLOBALS['egw_setup']->db->ServerInfo['version'] >= 4.1 ? ' DEFAULT CHARSET SET utf8' : ''; 201 $setup_tpl->set_var('instr', 202 '<b>'.lang("Instructions for creating the database in %1:",'MySql').'</b>' 203 . '<br />'.lang('Login to mysql -') 204 . '<br /><i>[user@server user]# <b>mysql -u root -p</b></i><br />' 205 . lang('Create the empty database and grant user permissions -') 206 . "<br /><i>mysql> <b>CREATE DATABASE $info[db_name]$set_charset;</b></i>" 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'); 210 break; 211 case 'pgsql': 212 $ip = $info['db_host'] == 'localhost' ? '127.0.0.1' : '<ip-address webserver>'; 213 $setup_tpl->set_var('instr', 214 '<b>'.lang('Instructions for creating the database in %1:','PostgreSQL').'</b>' 215 . '<br />'.lang('Login as user postgres, eg. by using su as root') 216 . "<br /><i>[root@server /root]# <b>su - postgres</b></i><br />" 217 . lang('Create the empty database and grant user permissions -') 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 --owner " . $info['db_user'] . ' ' . $info['db_name'] . "</b></i>" 221 . '<br />'.lang('to allow password authentification add the following line to your pg_hba.conf (above all others) AND restart postgres:') 222 . '<br /><i># TYPE DATABASE USER CIDR-ADDRESS METHOD</i>' 223 .($info['db_host'] ? "<br /><i><b>host $info[db_name] $info[db_user] $ip/32 password</b></i>" : 224 "<br /><i><b>local $info[db_name] $info[db_user] password</b></i>")); 225 //$setup_tpl->parse('V_db_stage_1','B_db_stage_1'); 226 //break; 227 default: 228 $setup_tpl->parse('V_db_stage_1','B_db_stage_1a'); 229 } 230 $db_filled_block = $setup_tpl->get_var('V_db_stage_1'); 231 $setup_tpl->set_var('V_db_filled_block',$db_filled_block); 232 break; 233 case 2: 234 $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.')); 235 $setup_tpl->set_var('notcomplete',lang('not complete')); 236 $setup_tpl->parse('V_db_stage_2','B_db_stage_2'); 237 $db_filled_block = $setup_tpl->get_var('V_db_stage_2'); 238 $setup_tpl->set_var('V_db_filled_block',$db_filled_block); 239 break; 240 case 3: 241 $setup_tpl->set_var('dbexists','<b>'.lang('Your database is working, but you dont have any applications installed').'</b>'); 242 $setup_tpl->set_var('install',lang('Install')); 243 $setup_tpl->set_var('proceed',lang('We can proceed')); 244 $setup_tpl->set_var('coreapps',lang('all applications')); 245 $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); 246 $setup_tpl->set_var('lang_restore',lang('Or you can install a previous backup.')); 247 $setup_tpl->set_var('upload','<input type="file" name="uploaded" /> '. 248 '<input type="submit" name="upload" value="'.htmlspecialchars(lang('install backup')).'" title="'.htmlspecialchars(lang("uploads a backup and installs it on your DB")).'" />'); 249 $setup_tpl->set_var('convert_checkbox','<input type="checkbox" name="convert_charset" id="convert_checkbox" value="1"/>'); 250 $setup_tpl->set_var('lang_convert_charset','<label for="convert_checkbox">'. 251 lang('Convert backup to charset selected above').'</label>'); 252 $setup_tpl->parse('V_db_stage_3','B_db_stage_3'); 253 $db_filled_block = $setup_tpl->get_var('V_db_stage_3'); 254 $setup_tpl->set_var('V_db_filled_block',$db_filled_block); 255 break; 256 case 4: 257 $setup_tpl->set_var('oldver',lang('You appear to be running version %1 of eGroupWare',$setup_info['phpgwapi']['currentver'])); 258 $setup_tpl->set_var('automatic',lang('We will automatically update your tables/records to %1',$setup_info['phpgwapi']['version'])); 259 $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>')); 260 $setup_tpl->set_var('lang_backup',lang('create a backup before upgrading the DB')); 261 $setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages')); 262 $setup_tpl->set_var('upgrade',lang('Upgrade')); 263 $setup_tpl->set_var('goto',lang('Go to')); 264 $setup_tpl->set_var('configuration',lang('configuration')); 265 $setup_tpl->set_var('admin_account',lang('Create admin account')); 266 $setup_tpl->set_var('applications',lang('Manage Applications')); 267 $setup_tpl->set_var('db_backup',lang('DB backup and restore')); 268 $setup_tpl->set_var('language_management',lang('Manage Languages')); 269 $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); 270 $setup_tpl->set_var('dont_touch_my_data',lang('Dont touch my data')); 271 $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); 272 273 $setup_tpl->parse('V_db_stage_4','B_db_stage_4'); 274 $db_filled_block = $setup_tpl->get_var('V_db_stage_4'); 275 $setup_tpl->set_var('V_db_filled_block',$db_filled_block); 276 break; 277 case 5: 278 $setup_tpl->set_var('are_you_sure',lang('ARE YOU SURE?')); 279 $setup_tpl->set_var('really_uninstall_all_applications',lang('REALLY Uninstall all applications')); 280 $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); 281 $setup_tpl->set_var('cancel',lang('cancel')); 282 $setup_tpl->parse('V_db_stage_5','B_db_stage_5'); 283 $db_filled_block = $setup_tpl->get_var('V_db_stage_5'); 284 $setup_tpl->set_var('V_db_filled_block',$db_filled_block); 285 break; 286 case 6: 287 $setup_tpl->set_var('status',lang('Status')); 288 $setup_tpl->set_var('notcomplete',lang('not complete')); 289 $setup_tpl->set_var('tblchange',lang('Table Change Messages')); 290 $setup_tpl->parse('V_db_stage_6_pre','B_db_stage_6_pre'); 291 $db_filled_block = $setup_tpl->get_var('V_db_stage_6_pre'); 292 $setup_tpl->set_var('tableshave',lang('If you did not receive any errors, your applications have been')); 293 294 // FIXME : CAPTURE THIS OUTPUT 295 $GLOBALS['egw_setup']->db->Halt_On_Error = 'report'; 296 297 switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi']) 298 { 299 case 'dbcreate': 300 $GLOBALS['egw_setup']->db->create_database($_POST['db_root'], $_POST['db_pass'], $_POST['system_charset']); 301 break; 302 case 'drop': 303 $setup_info = $GLOBALS['egw_setup']->detection->get_versions($setup_info); 304 $setup_info = $GLOBALS['egw_setup']->process->droptables($setup_info); 305 break; 306 case 'new': 307 // use uploaded backup, instead installing from scratch 308 if ($_POST['upload']) 309 { 310 $db_backup = CreateObject('phpgwapi.db_backup'); 311 if (is_array($_FILES['uploaded']) && !$_FILES['uploaded']['error'] && 312 is_uploaded_file($_FILES['uploaded']['tmp_name'])) 313 { 314 if (preg_match('/\.(bz2|gz)$/i',$_FILES['uploaded']['name'],$matches)) 315 { 316 $ext = '.'.$matches[1]; 317 move_uploaded_file($_FILES['uploaded']['tmp_name'],$_FILES['uploaded']['tmp_name'].$ext); 318 $_FILES['uploaded']['tmp_name'] .= $ext; 319 } 320 if (is_resource($f = $db_backup->fopen_backup($_FILES['uploaded']['tmp_name'],true))) 321 { 322 echo '<p align="center">'.lang('restore started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); 323 $db_backup->restore($f,$_POST['convert_charset']); 324 fclose($f); 325 echo '<p align="center">'.lang('restore finished')."</p>\n"; 326 unlink($_FILES['uploaded']['tmp_name']); 327 } 328 else // backup failed ==> dont start the upgrade 329 { 330 $setup_tpl->set_var('submsg',lang('Restore failed')); 331 $setup_tpl->set_var('tableshave','<b>'.$f.'</b>'); 332 $setup_tpl->set_var('subaction',''); 333 } 334 } 335 } 336 else 337 { 338 $setup_info = $GLOBALS['egw_setup']->detection->upgrade_exclude($setup_info); 339 // Set the DB's client charset if a system-charset is set 340 if ($_REQUEST['system_charset']) 341 { 342 $GLOBALS['egw_setup']->system_charset = $_REQUEST['system_charset']; 343 $GLOBALS['egw_setup']->db->Link_ID->SetCharSet($_REQUEST['system_charset']); 344 } 345 $setup_info = $GLOBALS['egw_setup']->process->pass($setup_info,'new',$_REQUEST['debug'],True); 346 $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion'; 347 } 348 break; 349 case 'oldversion': 350 // create a backup, before upgrading the tables 351 if ($_POST['backup']) 352 { 353 $db_backup =& CreateObject('phpgwapi.db_backup'); 354 if (is_resource($f = $db_backup->fopen_backup())) 355 { 356 echo '<p align="center">'.lang('backup started, this might take a few minutes ...')."</p>\n".str_repeat(' ',4096); 357 $db_backup->backup($f); 358 fclose($f); 359 echo '<p align="center">'.lang('backup finished')."</p>\n"; 360 } 361 else // backup failed ==> dont start the upgrade 362 { 363 $setup_tpl->set_var('submsg',lang('Backup failed')); 364 $setup_tpl->set_var('tableshave','<b>'.$f.'</b>'); 365 $setup_tpl->set_var('subaction',''); 366 } 367 } 368 if (!@$_POST['backup'] || !is_string($f)) 369 { 370 $setup_info = $GLOBALS['egw_setup']->process->pass($setup_info,'upgrade',$_REQUEST['debug']); 371 $GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion'; 372 } 373 break; 374 } 375 376 $GLOBALS['egw_setup']->db->Halt_On_Error = 'no'; 377 378 $setup_tpl->set_var('re-check_my_installation',lang('Re-Check My Installation')); 379 $setup_tpl->set_var('system_charset',$GLOBALS['egw']->system_charset); 380 $setup_tpl->parse('V_db_stage_6_post','B_db_stage_6_post'); 381 $db_filled_block = $db_filled_block . $setup_tpl->get_var('V_db_stage_6_post'); 382 $setup_tpl->set_var('V_db_filled_block',$db_filled_block); 383 break; 384 case 10: 385 $setup_tpl->set_var('tablescurrent',lang('Your eGroupWare API is current')); 386 $setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications')); 387 $setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data')); 388 $setup_tpl->set_var('deletetables',lang('Uninstall all applications')); 389 $setup_tpl->parse('V_db_stage_10','B_db_stage_10'); 390 $db_filled_block = $setup_tpl->get_var('V_db_stage_10'); 391 $setup_tpl->set_var('V_db_filled_block',$db_filled_block); 392 break; 393 default: 394 $setup_tpl->set_var('dbnotexist',lang('Your database does not exist')); 395 $setup_tpl->parse('V_db_stage_default','B_db_stage_default'); 396 $db_filled_block = $setup_tpl->get_var('V_db_stage_default'); 397 $setup_tpl->set_var('V_db_filled_block',$db_filled_block); 398 break; 399 } 400 401 // Config Section 402 $setup_tpl->set_var('config_step_text',lang('Step %1 - Configuration',2)); 403 $GLOBALS['egw_info']['setup']['stage']['config'] = $GLOBALS['egw_setup']->detection->check_config(); 404 405 // begin DEBUG code 406 //$GLOBALS['egw_info']['setup']['stage']['config'] = 10; 407 // end DEBUG code 408 409 $setup_tpl->set_var('config_status_img',$incomplete); 410 $setup_tpl->set_var('config_status_alt',lang('not completed')); 411 switch($GLOBALS['egw_info']['setup']['stage']['config']) 412 { 413 case 1: 414 $btn_config_now = $GLOBALS['egw_setup']->html->make_frm_btn_simple( 415 lang('Please configure eGroupWare for your environment'), 416 'post','config.php', 417 'submit',lang('Configure Now'), 418 ''); 419 $setup_tpl->set_var('config_table_data',$btn_config_now); 420 $setup_tpl->set_var('ldap_table_data',' '); 421 break; 422 case 10: 423 $GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table,'config_name,config_value',array('config_app' => 'phpgwapi'),__LINE__,__FILE__); 424 while($GLOBALS['egw_setup']->db->next_record()) 425 { 426 $config[$GLOBALS['egw_setup']->db->f(0)] = $GLOBALS['egw_setup']->db->f(1); 427 } 428 $config_msg = ''; 429 if (!check_dir($config['temp_dir'],$error_msg)) 430 { 431 $config_msg = lang("Your temporary directory '%1' %2",$config['temp_dir'],$error_msg); 432 } 433 if ((!isset($config['file_repository']) || $config['file_repository'] == 'sql') && 434 (!isset($config['file_store_contents']) || $config['file_store_contents'] == 'filesystem') && 435 !check_dir($config['files_dir'],$error_msg,true)) 436 { 437 $config_msg .= ($config_msg?"<br />\n":'').lang("Your files directory '%1' %2",$config['files_dir'],$error_msg); 438 } 439 // set and create the default backup_dir 440 if (@is_writeable($config['files_dir']) && !$config['backup_dir'] && $config['file_store_contents'] == 'filesystem') 441 { 442 $config['backup_dir'] = $config['files_dir'].'/db_backup'; 443 if (!is_dir($config['backup_dir']) && mkdir($config['backup_dir'])) 444 { 445 $GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->config_table,array( 446 'config_value' => $config['backup_dir'], 447 ),array( 448 'config_app' => 'phpgwapi', 449 'config_name' => 'backup_dir', 450 ),__LINE__,__FILE__); 451 } 452 } 453 if (!check_dir($config['backup_dir'],$error_msg,true)) 454 { 455 $no_backup_dir = lang("Your backup directory '%1' %2",$config['backup_dir'],$error_msg); 456 $config_msg .= ($config_msg?"<br />\n":'').$no_backup_dir; 457 } 458 if (!$config['mail_server'] || !$config['mail_server_type'] || !$config['smtp_server']) 459 { 460 $config_msg .= ($config_msg?"<br />\n":'').lang('Missing or uncomplete mailserver configuration'); 461 } 462 if (!$config_msg) 463 { 464 $setup_tpl->set_var('config_status_img',$completed); 465 $setup_tpl->set_var('config_status_alt',lang('completed')); 466 $config_msg = lang('Configuration completed'); 467 } 468 $btn_edit_config = $GLOBALS['egw_setup']->html->make_frm_btn_simple( 469 $config_msg, 470 'post','config.php', 471 'submit',lang('Edit Current Configuration'), 472 '' 473 ); 474 if ($config['auth_type'] == 'ldap') 475 { 476 if ($config['ldap_host'] != '') 477 { 478 $btn_config_ldap = $GLOBALS['egw_setup']->html->make_frm_btn_simple( 479 lang('LDAP account import/export'), 480 'post','ldap.php', 481 'submit',lang('Configure Now'), 482 '' 483 ); 484 } 485 else 486 { 487 $btn_config_ldap = ''; 488 } 489 } 490 $setup_tpl->set_var('config_table_data',$btn_edit_config); 491 $setup_tpl->set_var('ldap_table_data',$btn_config_ldap); 492 break; 493 default: 494 $setup_tpl->set_var('config_status_img',$incomplete); 495 $setup_tpl->set_var('config_status_alt',lang('not completed')); 496 $setup_tpl->set_var('config_table_data',lang('Not ready for this stage yet')); 497 $setup_tpl->set_var('ldap_table_data',' '); 498 break; 499 } 500 // Admin Account Section 501 $setup_tpl->set_var('admin_step_text',lang('Step %1 - Admin Account',3)); 502 503 switch($GLOBALS['egw_info']['setup']['stage']['config']) 504 { 505 case 10: 506 // check if there is already a user account (not the anonymous account of sitemgr or a group) 507 $no_accounts = !$GLOBALS['egw_setup']->accounts_exist(); 508 $setup_tpl->set_var('admin_status_img',$no_accounts ? $incomplete : $completed); 509 $setup_tpl->set_var('admin_status_alt',$no_accounts ? lang('not completed') : lang('completed')); 510 $setup_tpl->set_var('admin_table_data',$GLOBALS['egw_setup']->html->make_frm_btn_simple( 511 $no_accounts ? lang('No accounts existing') : lang('Accounts existing'), 512 'post','admin_account.php', 513 'submit',lang('Create admin account'), 514 '' 515 )); 516 break; 517 default: 518 $setup_tpl->set_var('admin_status_img',$incomplete); 519 $setup_tpl->set_var('admin_status_alt',lang('not completed')); 520 $setup_tpl->set_var('admin_table_data',lang('Not ready for this stage yet')); 521 break; 522 } 523 524 // Lang Section 525 $setup_tpl->set_var('lang_step_text',lang('Step %1 - Language Management',4)); 526 $GLOBALS['egw_info']['setup']['stage']['lang'] = $GLOBALS['egw_setup']->detection->check_lang(); 527 528 // begin DEBUG code 529 //$GLOBALS['egw_info']['setup']['stage']['lang'] = 0; 530 // end DEBUG code 531 532 switch($GLOBALS['egw_info']['setup']['stage']['lang']) 533 { 534 case 1: 535 $setup_tpl->set_var('lang_status_img',$incomplete); 536 $setup_tpl->set_var('lang_status_alt','not completed'); 537 $btn_install_lang = $GLOBALS['egw_setup']->html->make_frm_btn_simple( 538 lang('You do not have any languages installed. Please install one now <br />'), 539 'post','lang.php', 540 'submit',lang('Install Language'), 541 ''); 542 $setup_tpl->set_var('lang_table_data',$btn_install_lang); 543 break; 544 case 10: 545 $langs_list = array(); 546 $languages = get_langs(); 547 foreach ($GLOBALS['egw_info']['setup']['installed_langs'] as $key => $value) 548 { 549 $langs_list[] = isset($languages[$key]) ? $languages[$key]['descr'] : $value; 550 } 551 $setup_tpl->set_var('lang_status_img',$completed); 552 $setup_tpl->set_var('lang_status_alt','completed'); 553 $btn_manage_lang = $GLOBALS['egw_setup']->html->make_frm_btn_simple( 554 lang('This stage is completed<br />') . lang('Currently installed languages: %1 <br />',implode(', ',$langs_list)), 555 'post','lang.php', 556 'submit',lang('Manage Languages'), 557 ''); 558 // show system-charset and offer conversation 559 $btn_manage_lang .= lang('Current system-charset is %1.',$GLOBALS['egw_setup']->system_charset ? 560 "'<b>".$GLOBALS['egw_setup']->system_charset."</b>'" : lang('not set'))."\n"; 561 $btn_manage_lang .= lang('To change the charset: back up your database, deinstall all applications and re-install the backup with "convert backup to charset selected" checked.'); 562 $setup_tpl->set_var('lang_table_data',$btn_manage_lang); 563 break; 564 default: 565 $setup_tpl->set_var('lang_status_img',$incomplete); 566 $setup_tpl->set_var('lang_status_alt',lang('not completed')); 567 $setup_tpl->set_var('lang_table_data',lang('Not ready for this stage yet')); 568 break; 569 } 570 571 $setup_tpl->set_var('apps_step_text',lang('Step %1 - Advanced Application Management',5)); 572 // $GLOBALS['egw_info']['setup']['stage']['apps'] = $GLOBALS['egw_setup']->check_apps(); 573 switch($GLOBALS['egw_info']['setup']['stage']['db']) 574 { 575 case 10: 576 $setup_tpl->set_var('apps_status_img',$completed); 577 $setup_tpl->set_var('apps_status_alt',lang('completed')); 578 // check if we have apps to upgrade 579 $to_upgrade = array(); 580 foreach($setup_info as $app => $data) 581 { 582 if ($data['currentver'] && $data['version'] && $data['version'] != $data['currentver']) 583 { 584 $to_upgrade[] = $app; 585 } 586 } 587 $btn_manage_apps = $GLOBALS['egw_setup']->html->make_frm_btn_simple( 588 count($to_upgrade) ? '<b>'.lang('The following applications need to be upgraded:').'</b> '.implode(', ',$to_upgrade) : 589 lang('This stage is completed<br />'), 590 'post','applications.php', 591 'submit',lang('Manage Applications'), 592 ''); 593 $setup_tpl->set_var('apps_table_data',$btn_manage_apps); 594 break; 595 default: 596 $setup_tpl->set_var('apps_status_img',$incomplete); 597 $setup_tpl->set_var('apps_status_alt',lang('not completed')); 598 $setup_tpl->set_var('apps_table_data',lang('Not ready for this stage yet')); 599 break; 600 } 601 // Backup and restore section 602 $setup_tpl->set_var('backup_step_text',lang('Step %1 - DB backup and restore',6)); 603 if ($GLOBALS['egw_info']['setup']['stage']['db'] == 10 && !$no_backup_dir) 604 { 605 $setup_tpl->set_var('backup_status_img',$completed); 606 $setup_tpl->set_var('backup_status_alt',lang('completed')); 607 $setup_tpl->set_var('backup_table_data',$GLOBALS['egw_setup']->html->make_frm_btn_simple( 608 ''/*lang('This stage is completed<br />')*/, 609 'post','db_backup.php', 610 'submit',lang('backup and restore'), 611 '')); 612 } 613 else 614 { 615 $setup_tpl->set_var('backup_status_img',$incomplete); 616 $setup_tpl->set_var('backup_status_alt',lang('not completed')); 617 $setup_tpl->set_var('backup_table_data',$no_backup_dir ? $no_backup_dir : lang('Not ready for this stage yet')); 618 } 619 620 $setup_tpl->pparse('out','T_setup_main'); 621 $GLOBALS['egw_setup']->html->show_footer(); 622 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |