[ 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 12 /* $Id: manageheader.php 21983 2006-06-28 16:51:49Z nelius_weiss $ */ 13 14 $GLOBALS['egw_info'] = array( 15 'flags' => array( 16 'nocachecontrol' => True, 17 'noheader' => True, 18 'nonavbar' => True, 19 'currentapp' => 'home', 20 'noapi' => True 21 )); 22 include ('./inc/functions.inc.php'); 23 24 // some constanst for pre php4.3 25 if (!defined('PHP_SHLIB_SUFFIX')) 26 { 27 define('PHP_SHLIB_SUFFIX',strtoupper(substr(PHP_OS, 0,3)) == 'WIN' ? 'dll' : 'so'); 28 } 29 if (!defined('PHP_SHLIB_PREFIX')) 30 { 31 define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : ''); 32 } 33 /** 34 * checks if a named extension is loaded or loadable 35 */ 36 function check_load_extension($extension) 37 { 38 return extension_loaded($extension) || 39 function_exists('dl') && @dl(PHP_SHLIB_PREFIX.$extension.'.'.PHP_SHLIB_SUFFIX); 40 } 41 42 $GLOBALS['egw_info']['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header']; 43 $GLOBALS['egw_info']['server']['versions']['phpgwapi'] = $setup_info['phpgwapi']['version']; 44 unset($setup_info); 45 46 /* Fetch the current real path. 47 * If this is in the server document root, then it is probably ok. 48 * Otherwise, don't guess, just show the usual instructive default. 49 */ 50 $realpath = realpath('..'); 51 if(!ereg('^' . $_SERVER['DOCUMENT_ROOT'],$realpath)) 52 { 53 if(strtoupper(substr(PHP_OS, 0,3)) == 'WIN') 54 { 55 $realpath = 'Drive:/Path/to/egroupware'; 56 } 57 else 58 { 59 $realpath = '/path/to/egroupware'; 60 } 61 } 62 63 $adddomain = get_var('adddomain',Array('POST')); 64 65 $db_fullnames = array( 66 'pgsql' => 'PostgreSQL', 67 'mysql' => 'MySQL', 68 'mysqli' => 'MySQLi (php5)', 69 'mssql' => 'MS SQL Server', 70 'odbc_mssql' => 'MS SQL Server via ODBC', 71 'oracle' => 'Oracle', 72 'odbc_oracle' => 'Oracle via ODBC', 73 'sapdb' => 'SAP/Max DB via ODBC', 74 ); 75 76 $default_db_ports = array( 77 'pgsql' => 5432, 78 'mysql' => 3306, 79 'mysqli' => 3306, 80 'mssql' => 1433, 81 'odbc_mssql' => '', 82 'oracle' => 1521, 83 'odbc_oracle' => '', 84 'sapdb' => '', 85 ); 86 87 function check_form_values() 88 { 89 // PHP will automatically replace any dots in incoming 90 // variable names with underscores. 91 92 $errors = ''; 93 $domains = get_var('domains',Array('POST')); 94 @reset($domains); 95 while(list($k,$v) = @each($domains)) 96 { 97 $variableName = str_replace('.','_',$k); 98 $deletedomain = get_var('deletedomain',Array('POST')); 99 if(isset($deletedomain[$variableName])) 100 { 101 continue; 102 } 103 $dom = get_var('setting_'.$variableName,Array('POST')); 104 if(!$dom['config_pass'] && !$dom['config_password']) 105 { 106 $errors .= '<br />' . lang("You didn't enter a config password for domain %1",$v); 107 } 108 if(!$dom['config_user']) 109 { 110 $errors .= '<br />' . lang("You didn't enter a config username for domain %1",$v); 111 } 112 } 113 114 $setting = get_var('setting',Array('POST')); 115 if(!$setting['HEADER_ADMIN_PASSWORD'] && !$setting['HEADER_ADMIN_PASS']) 116 { 117 $errors .= '<br />' . lang("You didn't enter a header admin password"); 118 } 119 if(!$setting['HEADER_ADMIN_USER']) 120 { 121 $errors .= '<br />' . lang("You didn't enter a header admin username"); 122 } 123 124 if($errors) 125 { 126 $GLOBALS['egw_setup']->html->show_header('Error',True); 127 echo $errors; 128 echo '<p><input type="submit" value="'.lang('Back to the previous screen').'" onclick="history.back()" /></p>'; 129 $GLOBALS['egw_setup']->html->show_footer(); 130 exit; 131 } 132 } 133 134 /* authentication phase */ 135 $GLOBALS['egw_info']['setup']['stage']['header'] = $GLOBALS['egw_setup']->detection->check_header(); 136 137 // added these to let the app work, need to templatize still 138 $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); 139 $setup_tpl = CreateObject('setup.Template',$tpl_root); 140 $setup_tpl->set_file(array( 141 'T_head' => 'head.tpl', 142 'T_footer' => 'footer.tpl', 143 'T_alert_msg' => 'msg_alert_msg.tpl', 144 'T_login_main' => 'login_main.tpl', 145 'T_login_stage_header' => 'login_stage_header.tpl', 146 'T_setup_manage' => 'manageheader.tpl' 147 )); 148 $setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); 149 $setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); 150 $setup_tpl->set_block('T_setup_manage','manageheader','manageheader'); 151 $setup_tpl->set_block('T_setup_manage','domain','domain'); 152 153 /* Detect current mode */ 154 switch($GLOBALS['egw_info']['setup']['stage']['header']) 155 { 156 case '1': 157 $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Create your header.inc.php'); 158 $GLOBALS['egw_info']['setup']['PageMSG'] = lang('You have not created your header.inc.php yet!<br /> You can create it now.'); 159 break; 160 case '2': 161 $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Your header admin password is NOT set. Please set it now!'); 162 $GLOBALS['egw_info']['setup']['PageMSG'] = lang('Your header admin password is NOT set. Please set it now!'); 163 break; 164 case '3': 165 $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('You need to add some domains to your header.inc.php.'); 166 $GLOBALS['egw_info']['setup']['PageMSG'] = lang('You need to add some domains to your header.inc.php.'); 167 $GLOBALS['egw_info']['setup']['HeaderLoginMSG'] = lang('You need to add some domains to your header.inc.php.'); 168 if(!$GLOBALS['egw_setup']->auth('Header')) 169 { 170 $GLOBALS['egw_setup']->html->show_header('Please login',True); 171 $GLOBALS['egw_setup']->html->login_form(); 172 $GLOBALS['egw_setup']->html->show_footer(); 173 exit; 174 } 175 break; 176 case '4': 177 $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Your header.inc.php needs upgrading.'); 178 $GLOBALS['egw_info']['setup']['PageMSG'] = lang('Your header.inc.php needs upgrading.<br /><blink><b class="msg">WARNING!</b></blink><br /><b>MAKE BACKUPS!</b>'); 179 $GLOBALS['egw_info']['setup']['HeaderLoginMSG'] = lang('Your header.inc.php needs upgrading.'); 180 if(!$GLOBALS['egw_setup']->auth('Header')) 181 { 182 $GLOBALS['egw_setup']->html->show_header('Please login',True); 183 $GLOBALS['egw_setup']->html->login_form(); 184 $GLOBALS['egw_setup']->html->show_footer(); 185 exit; 186 } 187 break; 188 case '10': 189 if(!$GLOBALS['egw_setup']->auth('Header')) 190 { 191 $GLOBALS['egw_setup']->html->show_header('Please login',True); 192 $GLOBALS['egw_setup']->html->login_form(); 193 $GLOBALS['egw_setup']->html->show_footer(); 194 exit; 195 } 196 $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Edit your header.inc.php'); 197 $GLOBALS['egw_info']['setup']['PageMSG'] = lang('Edit your existing header.inc.php'); 198 break; 199 } 200 201 $action = @get_var('action',Array('POST')); 202 list($action) = @each($action); 203 switch($action) 204 { 205 case 'download': 206 check_form_values(); 207 $header_template = CreateObject('setup.Template','../'); 208 $b = CreateObject('phpgwapi.browser'); 209 $b->content_header('header.inc.php','application/octet-stream'); 210 /* 211 header('Content-disposition: attachment; filename="header.inc.php"'); 212 header('Content-type: application/octet-stream'); 213 header('Pragma: no-cache'); 214 header('Expires: 0'); 215 */ 216 $newheader = $GLOBALS['egw_setup']->html->generate_header(); 217 echo $newheader; 218 break; 219 case 'view': 220 check_form_values(); 221 $header_template = CreateObject('setup.Template','../'); 222 $GLOBALS['egw_setup']->html->show_header('Generated header.inc.php', False, 'header'); 223 echo '<table width="90%"><tr><td>'; 224 echo '<br />' . lang('Save this text as contents of your header.inc.php') . '<br /><hr />'; 225 $newheader = $GLOBALS['egw_setup']->html->generate_header(); 226 echo '<pre>'; 227 echo htmlentities($newheader); 228 echo '</pre><hr />'; 229 echo '<form action="index.php" method="post">'; 230 echo '<br />' . lang('After retrieving the file, put it into place as the header.inc.php. Then, click "continue".') . '<br />'; 231 echo '<input type="hidden" name="FormLogout" value="header" />'; 232 echo '<input type="submit" name="junk" value="'.lang('Continue').'" />'; 233 echo '</form>'; 234 echo '</td></tr></table>'; 235 $GLOBALS['egw_setup']->html->show_footer(); 236 break; 237 case 'write': 238 check_form_values(); 239 $header_template = CreateObject('setup.Template','../'); 240 if(is_writeable('../header.inc.php') || (!file_exists('../header.inc.php') && is_writeable('../'))) 241 { 242 $newheader = $GLOBALS['egw_setup']->html->generate_header(); 243 $fsetup = fopen('../header.inc.php','wb'); 244 fwrite($fsetup,$newheader); 245 fclose($fsetup); 246 $GLOBALS['egw_setup']->html->show_header('Saved header.inc.php', False, 'header'); 247 echo '<form action="index.php" method="post">'; 248 echo '<br />' . lang('Created header.inc.php!'); 249 echo '<input type="hidden" name="FormLogout" value="header" />'; 250 echo '<input type="submit" name="junk" value="'.lang('Continue').'" />'; 251 echo '</form>'; 252 $GLOBALS['egw_setup']->html->show_footer(); 253 break; 254 } 255 else 256 { 257 $GLOBALS['egw_setup']->html->show_header('Error generating header.inc.php', False, 'header'); 258 echo lang('Could not open header.inc.php for writing!') . '<br />' . "\n"; 259 echo lang('Please check read/write permissions on directories, or back up and use another option.') . '<br />'; 260 $GLOBALS['egw_setup']->html->show_footer(); 261 } 262 break; 263 default: 264 $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['HeaderFormMSG'], False, 'header'); 265 266 if(!get_var('ConfigLang',array('POST','COOKIE'))) 267 { 268 $setup_tpl->set_var('lang_select','<tr><td colspan="2"><form action="manageheader.php" method="post">Please Select your language '.lang_select(True,'en')."</form></td></tr>"); 269 } 270 271 $detected = ''; 272 $detected .= '<tr><td colspan="2"><p>' . $GLOBALS['egw_info']['setup']['PageMSG'] . '<br /> </p></td></tr>'; 273 274 $detected .= '<tr class="th"><td colspan="2">' . lang('Analysis') . '</td></tr>'."\n".'<tr><td colspan="2">'. "\n"; 275 276 $supported_db = array(); 277 foreach(array( 278 // short => array(extension,func_to_check,supported_db(s)) 279 'mysql' => array('mysql','mysql_connect','mysql'), 280 'mysqli' => array('mysql','mysqli_connect','mysqli'), 281 'pgsql' => array('pgsql','pg_connect','pgsql'), 282 'mssql' => array('mssql','mssql_connect','mssql'), 283 'odbc' => array('odbc',false,'sapdb','odbc_mssql','odbc_oracle'), 284 'oracle' => array('oci8',false,'oracle'), 285 ) as $db => $data) 286 { 287 $ext = array_shift($data); 288 $func_to_check = array_shift($data); 289 $name = isset($db_fullnames[$db]) ? $db_fullnames[$db] : strtoupper($db); 290 if (check_load_extension($ext) || $func_to_check && function_exists($func_to_check)) 291 { 292 $detected .= lang('You appear to have %1 support.',$name) . "<br />\n"; 293 $supported_db = array_merge($supported_db,$data); 294 } 295 else 296 { 297 $detected .= lang('No %1 support found. Disabling',$name) . "<br />\n"; 298 } 299 } 300 if(!count($supported_db)) 301 { 302 $detected .= '<b><p align="center" class="msg">' 303 . lang('Did not find any valid DB support!') 304 . "<br />\n" 305 . lang('Try to configure your php to support one of the above mentioned DBMS, or install eGroupWare by hand.') 306 . '</p></b>'; 307 echo $detected; 308 $GLOBALS['egw_setup']->html->show_footer(); 309 exit; 310 } 311 312 if(!function_exists('version_compare')) 313 { 314 $detected .= '<b><p align="center" class="msg">' 315 . lang('You appear to be using PHP earlier than 4.1.0. eGroupWare now requires 4.1.0 or later'). "\n" 316 . '</p></b>'; 317 echo $detected; 318 $GLOBALS['egw_setup']->html->show_footer(); 319 exit; 320 } 321 if (check_load_extension('session')) 322 { 323 $detected .= lang('You appear to have PHP session support. Enabling PHP sessions.') . '<br />' . "\n"; 324 $supported_sessions_type['php4'] = 'PHP'; // makeing php sessions the default 325 $supported_sessions_type['php4-restore'] = lang('PHP plus restore'); // php-sessions with restore of egw_info array and egw object from the session 326 } 327 $supported_sessions_type['db'] = lang('Datebase'); 328 329 @reset($default_db_ports); 330 $js_default_db_ports = 'var default_db_ports = new Array();'."\n"; 331 while(list($k,$v) = @each($default_db_ports)) 332 { 333 $js_default_db_ports .= ' default_db_ports["'.$k.'"]="'.$v.'";'."\n"; 334 } 335 $setup_tpl->set_var('js_default_db_ports',$js_default_db_ports); 336 337 /* 338 if(check_load_extension('xml') || function_exists('xml_parser_create')) 339 { 340 $detected .= lang('You appear to have XML support enabled') . '<br />' . "\n"; 341 $xml_enabled = 'True'; 342 } 343 else 344 { 345 $detected .= lang('No XML support found. Disabling') . '<br />' . "\n"; 346 } 347 */ 348 349 $no_guess = False; 350 if(file_exists('../header.inc.php') && is_file('../header.inc.php') && is_readable('../header.inc.php')) 351 { 352 $detected .= lang('Found existing configuration file. Loading settings from the file...') . '<br />' . "\n"; 353 $GLOBALS['egw_info']['flags']['noapi'] = True; 354 $no_guess = true; 355 /* This code makes sure the newer multi-domain supporting header.inc.php is being used */ 356 if(!isset($GLOBALS['egw_domain'])) 357 { 358 $detected .= lang('You need to add some domains to your header.inc.php.') . '<br />' . "\n"; 359 $GLOBALS['egw_domain']['default'] = array(); 360 $setup_tpl->set_var('lang_domain',lang('Database instance (eGW domain)')); 361 $setup_tpl->set_var('lang_delete',lang('Delete')); 362 $setup_tpl->set_var('db_domain','default'); 363 $setup_tpl->set_var('db_host','localhost'); 364 $setup_tpl->set_var('db_name','egroupware'); 365 $setup_tpl->set_var('db_user','egroupware'); 366 $setup_tpl->set_var('db_pass',''); 367 $setup_tpl->set_var('config_user','changeme'); 368 $setup_tpl->set_var('config_pass',''); 369 while(list($k,$v) = @each($supported_db)) 370 { 371 $dbtype_options .= '<option value="' . $v . '">' . $db_fullnames[$v] . "</option>\n"; 372 if (!isset($default_port)) 373 $default_port = $default_db_ports[$v]; 374 } 375 $setup_tpl->set_var('dbtype_options',$dbtype_options); 376 $setup_tpl->set_var('db_port',$default_port); 377 $setup_tpl->parse('domains','domain',True); 378 } 379 else 380 { 381 if(@$GLOBALS['egw_info']['server']['header_version'] != @$GLOBALS['egw_info']['server']['current_header_version']) 382 { 383 $detected .= lang("You're using an old header.inc.php version...") . '<br />' . "\n"; 384 $detected .= lang('Importing old settings into the new format....') . '<br />' . "\n"; 385 } 386 reset($GLOBALS['egw_domain']); 387 list($default_domain) = each($GLOBALS['egw_domain']); 388 $GLOBALS['egw_info']['server']['default_domain'] = $default_domain; 389 unset($default_domain); // we kill this for security reasons 390 $GLOBALS['egw_info']['server']['config_passwd'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']]['config_passwd']; 391 $GLOBALS['egw_info']['server']['config_user'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']]['config_user']; 392 393 if(@$adddomain) 394 { 395 $GLOBALS['egw_domain'][lang('new')] = array(); 396 } 397 398 foreach($GLOBALS['egw_domain'] as $key => $val) 399 { 400 $setup_tpl->set_var('lang_domain',lang('Database instance (eGW domain)')); 401 $setup_tpl->set_var('lang_delete',lang('Delete')); 402 $setup_tpl->set_var('db_domain',$key); 403 $setup_tpl->set_var('db_host',$GLOBALS['egw_domain'][$key]['db_host']); 404 /* Set default here if the admin didn't set a port yet */ 405 $setup_tpl->set_var('db_port',$GLOBALS['egw_domain'][$key]['db_port'] 406 ? $GLOBALS['egw_domain'][$key]['db_port'] 407 : @$default_db_ports[$GLOBALS['egw_domain'][$key]['db_type']] 408 ); 409 $setup_tpl->set_var('db_name',$GLOBALS['egw_domain'][$key]['db_name']); 410 $setup_tpl->set_var('db_user',$GLOBALS['egw_domain'][$key]['db_user']); 411 $setup_tpl->set_var('db_pass',$GLOBALS['egw_domain'][$key]['db_pass']); 412 $setup_tpl->set_var('db_type',$GLOBALS['egw_domain'][$key]['db_type']); 413 if(!@isset($GLOBALS['egw_domain'][$key]['config_user'])) 414 { 415 $setup_tpl->set_var('config_user','admin'); 416 } 417 else 418 { 419 $setup_tpl->set_var('config_user',$GLOBALS['egw_domain'][$key]['config_user']); 420 } 421 $setup_tpl->set_var('config_pass',''); 422 $setup_tpl->set_var('config_password',$GLOBALS['egw_domain'][$key]['config_passwd']); 423 424 $selected = ''; 425 $dbtype_options = ''; 426 $found_dbtype = False; 427 @reset($supported_db); 428 while(list($k,$v) = @each($supported_db)) 429 { 430 if($v == $GLOBALS['egw_domain'][$key]['db_type']) 431 { 432 $selected = ' selected="selected" '; 433 $found_dbtype = true; 434 } 435 else 436 { 437 $selected = ''; 438 } 439 $dbtype_options .= '<option ' . $selected . 'value="' . $v . '">' . $db_fullnames[$v] . "</option>\n"; 440 } 441 $setup_tpl->set_var('dbtype_options',$dbtype_options); 442 443 $setup_tpl->parse('domains','domain',True); 444 } 445 $setup_tpl->set_var('domain',''); 446 } 447 if(defined('PHPGW_SERVER_ROOT')) 448 { 449 $GLOBALS['egw_info']['server']['server_root'] = (PHPGW_SERVER_ROOT == '..') ? $realpath : PHPGW_SERVER_ROOT; 450 $GLOBALS['egw_info']['server']['include_root'] = (PHPGW_INCLUDE_ROOT == '..') ? $realpath : PHPGW_SERVER_ROOT; 451 } 452 elseif(!@isset($GLOBALS['egw_info']['server']['include_root']) && @$GLOBALS['egw_info']['server']['header_version'] <= 1.6) 453 { 454 $GLOBALS['egw_info']['server']['include_root'] = @$GLOBALS['egw_info']['server']['server_root']; 455 } 456 elseif(!@isset($GLOBALS['egw_info']['server']['header_version']) && @$GLOBALS['egw_info']['server']['header_version'] <= 1.6) 457 { 458 $GLOBALS['egw_info']['server']['include_root'] = @$GLOBALS['egw_info']['server']['server_root']; 459 } 460 } 461 else 462 { 463 $detected .= lang('Sample configuration not found. using built in defaults') . '<br />' . "\n"; 464 $GLOBALS['egw_info']['server']['server_root'] = $realpath; 465 $GLOBALS['egw_info']['server']['include_root'] = $realpath; 466 /* This is the basic include needed on each page for eGroupWare application compliance */ 467 $GLOBALS['egw_info']['flags']['htmlcompliant'] = True; 468 469 /* These are the settings for the database system */ 470 $setup_tpl->set_var('lang_domain',lang('Domain')); 471 $setup_tpl->set_var('lang_delete',lang('Delete')); 472 $setup_tpl->set_var('db_domain','default'); 473 $setup_tpl->set_var('db_host','localhost'); 474 $setup_tpl->set_var('db_name','egroupware'); 475 $setup_tpl->set_var('db_user','egroupware'); 476 $setup_tpl->set_var('db_pass',''); 477 $setup_tpl->set_var('config_user','changeme'); 478 $setup_tpl->set_var('config_pass',''); 479 480 while(list($k,$v) = each($supported_db)) 481 { 482 $dbtype_options .= '<option value="' . $v . '">' . $db_fullnames[$v] . "</option>\n"; 483 if (!isset($default_port)) 484 $default_port = $default_db_ports[$v]; 485 } 486 $setup_tpl->set_var('db_port',$default_port); 487 $setup_tpl->set_var('dbtype_options',$dbtype_options); 488 489 $setup_tpl->parse('domains','domain',True); 490 $setup_tpl->set_var('domain',''); 491 492 $setup_tpl->set_var('comment_l','<!-- '); 493 $setup_tpl->set_var('comment_r',' -->'); 494 495 /* These are a few of the advanced settings */ 496 $GLOBALS['egw_info']['server']['db_persistent'] = True; 497 $GLOBALS['egw_info']['server']['mcrypt_enabled'] = false; // default off, as there are too many problems with buggy mcrypt implementations (was check_load_extension('mcrypt');) 498 $GLOBALS['egw_info']['server']['versions']['mcrypt'] = ''; 499 500 srand((double)microtime()*1000000); 501 $random_char = array( 502 '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f', 503 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 504 'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L', 505 'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' 506 ); 507 508 for($i=0; $i<30; $i++) 509 { 510 $GLOBALS['egw_info']['server']['mcrypt_iv'] .= $random_char[rand(1,count($random_char))]; 511 } 512 } 513 514 // now guessing better settings then the default ones 515 if(!$no_guess) 516 { 517 $detected .= lang('Now guessing better values for defaults...') . '<br />' . "\n"; 518 $this_dir = dirname($_SERVER['SCRIPT_FILENAME']); 519 $updir = str_replace('/setup','',$this_dir); 520 $GLOBALS['egw_info']['server']['server_root'] = $updir; 521 $GLOBALS['egw_info']['server']['include_root'] = $updir; 522 } 523 524 $detected .= "</td></tr>\n"; 525 $setup_tpl->set_var('detected',$detected); 526 /* End of detected settings, now display the form with the detected or prior values */ 527 528 $setup_tpl->set_var('server_root',@$GLOBALS['egw_info']['server']['server_root']); 529 $setup_tpl->set_var('include_root',@$GLOBALS['egw_info']['server']['include_root']); 530 if(!@isset($GLOBALS['egw_info']['server']['header_admin_user'])) 531 { 532 $setup_tpl->set_var('header_admin_user','admin'); 533 } 534 else 535 { 536 $setup_tpl->set_var('header_admin_user',@$GLOBALS['egw_info']['server']['header_admin_user']); 537 } 538 $setup_tpl->set_var('header_admin_pass',@$GLOBALS['egw_info']['server']['header_admin_password']); 539 $setup_tpl->set_var('header_admin_password',''); 540 541 542 if(@$GLOBALS['egw_info']['server']['db_persistent']) 543 { 544 $setup_tpl->set_var('db_persistent_yes',' selected="selected"'); 545 } 546 else 547 { 548 $setup_tpl->set_var('db_persistent_no',' selected="selected"'); 549 } 550 551 $selected = ''; 552 $session_options = ''; 553 foreach($supported_sessions_type as $k => $v) 554 { 555 if($k == @$GLOBALS['egw_info']['server']['sessions_type']) 556 { 557 $selected = ' selected="selected" '; 558 } 559 else 560 { 561 $selected = ''; 562 } 563 $session_options .= '<option ' . $selected . 'value="' . $k . '">' . $v . "</option>\n"; 564 } 565 $setup_tpl->set_var('session_options',$session_options); 566 567 if(@$GLOBALS['egw_info']['server']['mcrypt_enabled']) 568 { 569 $setup_tpl->set_var('mcrypt_enabled_yes',' selected="selected"'); 570 } 571 else 572 { 573 $setup_tpl->set_var('mcrypt_enabled_no',' selected="selected"'); 574 } 575 576 $setup_tpl->set_var('mcrypt',$GLOBALS['egw_info']['server']['versions']['mcrypt']); 577 $setup_tpl->set_var('mcrypt_iv',$GLOBALS['egw_info']['server']['mcrypt_iv']); 578 579 $setup_tpl->set_var('lang_setup_acl',lang('Limit access to setup to the following addresses, networks or hostnames (e.g. 127.0.0.1,10.1.1,myhost.dnydns.org)')); 580 $setup_tpl->set_var('setup_acl',$GLOBALS['egw_info']['server']['setup_acl']); 581 582 if(@$GLOBALS['egw_info']['server']['show_domain_selectbox']) 583 { 584 $setup_tpl->set_var('domain_selectbox_yes',' selected="selected"'); 585 } 586 else 587 { 588 $setup_tpl->set_var('domain_selectbox_no',' selected="selected"'); 589 } 590 591 $errors = ''; 592 if(!$found_dbtype) 593 { 594 /* 595 $errors .= '<br /><font color="red">' . lang('Warning!') . '<br />' 596 . lang('The db_type in defaults (%1) is not supported on this server. using first supported type.',$GLOBALS['egw_info']['server']['db_type']) 597 . '</font>'; 598 */ 599 } 600 601 if(is_writeable('../header.inc.php') || 602 (!file_exists('../header.inc.php') && is_writeable('../'))) 603 { 604 $errors .= '<br /><input type="submit" name="action[write]" value="'.lang('Write config').'" /> ' 605 . lang('or') . ' <input type="submit" name="action[download]" value="'.lang('Download').'" /> ' 606 . lang('or') . ' <input type="submit" name="action[view]" value="'.lang('View').'" /> '.lang('the file').'.'; 607 } 608 else 609 { 610 $errors .= '<br />' 611 . lang('Cannot create the header.inc.php due to file permission restrictions.<br /> Instead you can %1 the file.', 612 '<input type="submit" name="action[download]" value="'.lang('Download').'" />' . lang('or') . ' <input type="submit" name="action[view]" value="'.lang('View').'" />'); 613 } 614 // set domain and password for the continue button 615 @reset($GLOBALS['egw_domain']); 616 list($firstDomain) = @each($GLOBALS['egw_domain']); 617 $setup_tpl->set_var(array( 618 'FormDomain' => $firstDomain, 619 'FormUser' => $GLOBALS['egw_domain'][$firstDomain]['config_user'], 620 'FormPW' => $GLOBALS['egw_domain'][$firstDomain]['config_passwd'] 621 )); 622 $setup_tpl->set_var('errors',$errors); 623 624 $setup_tpl->set_var('lang_settings',lang('Settings')); 625 $setup_tpl->set_var('lang_adddomain',lang('Add new database instance (eGW domain)')); 626 $setup_tpl->set_var('lang_serverroot',lang('Server Root')); 627 $setup_tpl->set_var('lang_includeroot',lang('Include Root (this should be the same as Server Root unless you know what you are doing)')); 628 $setup_tpl->set_var('lang_adminuser',lang('Admin user for header manager')); 629 $setup_tpl->set_var('lang_adminpass',lang('Admin password to header manager')); 630 $setup_tpl->set_var('lang_dbhost',lang('DB Host')); 631 $setup_tpl->set_var('lang_dbhostdescr',lang('Hostname/IP of database server').'<br />'. 632 lang('Postgres: Leave it empty to use the prefered unix domain sockets instead of a tcp/ip connection').'<br />'. 633 lang('ODBC / MaxDB: DSN (data source name) to use')); 634 $setup_tpl->set_var('lang_dbport',lang('DB Port')); 635 $setup_tpl->set_var('lang_dbportdescr',lang('TCP port number of database server')); 636 $setup_tpl->set_var('lang_dbname',lang('DB Name')); 637 $setup_tpl->set_var('lang_dbnamedescr',lang('Name of database')); 638 $setup_tpl->set_var('lang_dbuser',lang('DB User')); 639 $setup_tpl->set_var('lang_dbuserdescr',lang('Name of db user eGroupWare uses to connect')); 640 $setup_tpl->set_var('lang_dbpass',lang('DB Password')); 641 $setup_tpl->set_var('lang_dbpassdescr',lang('Password of db user')); 642 $setup_tpl->set_var('lang_dbtype',lang('DB Type')); 643 $setup_tpl->set_var('lang_whichdb',lang('Which database type do you want to use with eGroupWare?')); 644 $setup_tpl->set_var('lang_configuser',lang('Configuration User')); 645 $setup_tpl->set_var('lang_configpass',lang('Configuration Password')); 646 $setup_tpl->set_var('lang_passforconfig',lang('Password needed for configuration')); 647 $setup_tpl->set_var('lang_persist',lang('Persistent connections')); 648 $setup_tpl->set_var('lang_persistdescr',lang('Do you want persistent connections (higher performance, but consumes more resources)')); 649 $setup_tpl->set_var('lang_sesstype',lang('Sessions Type')); 650 $setup_tpl->set_var('lang_sesstypedescr',lang('What type of sessions management do you want to use (PHP session management may perform better)?'). 651 ' '.lang('PHP plus restore gives by far the best performance, as it stores the eGW enviroment completly in the session.'). 652 ' '.lang('Unfortunally some PHP/Apache packages have problems with it (Apache dies and you cant login anymore).')); 653 $setup_tpl->set_var('lang_enablemcrypt',lang('Enable MCrypt')); 654 $setup_tpl->set_var('lang_mcrypt_warning',lang('Not all mcrypt algorithms and modes work with eGroupWare. If you experience problems try switching it off.')); 655 $setup_tpl->set_var('lang_mcryptversion',lang('MCrypt version')); 656 $setup_tpl->set_var('lang_mcryptversiondescr',lang('Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use.')); 657 $setup_tpl->set_var('lang_mcryptiv',lang('MCrypt initialization vector')); 658 $setup_tpl->set_var('lang_mcryptivdescr',lang('This should be around 30 bytes in length.<br />Note: The default has been randomly generated.')); 659 $setup_tpl->set_var('lang_domselect',lang('Domain select box on login')); 660 $setup_tpl->set_var('lang_finaldescr',lang('After retrieving the file, put it into place as the header.inc.php. Then, click "continue".')); 661 $setup_tpl->set_var('lang_continue',lang('Continue')); 662 $setup_tpl->set_var('lang_Yes',lang('Yes')); 663 $setup_tpl->set_var('lang_No',lang('No')); 664 665 666 $setup_tpl->pfp('out','manageheader'); 667 668 $GLOBALS['egw_setup']->html->show_footer(); 669 670 break; // ending the switch default 671 } 672 ?>
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 |