[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This is the main install menu 4 * 5 * IF YOU ARE READING THIS IN YOUR WEB BROWSER, IT MEANS THAT PHP IS NOT PROPERLY INSTALLED 6 * ON YOUR WEB SERVER. IF YOU DON'T KNOW WHAT THIS MEANS, CONTACT YOUR SERVER ADMINISTRATOR 7 * OR YOUR HOSTING COMPANY. 8 * 9 * b2evolution - {@link http://b2evolution.net/} 10 * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html} 11 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/} 12 * 13 * @package install 14 */ 15 16 /** 17 * include config and default functions: 18 */ 19 require_once dirname(__FILE__).'/../conf/_config.php'; 20 21 // Make the includes believe they are being called in the right place... 22 define( 'EVO_MAIN_INIT', true ); 23 24 /** 25 * Define that we're in the install process. 26 */ 27 define( 'EVO_IS_INSTALLING', true ); 28 29 $script_start_time = time(); 30 31 if( ! $config_is_done ) 32 { // Base config is not done yet, try to guess some values needed for correct display: 33 $rsc_url = '../rsc/'; 34 } 35 36 require_once $inc_path.'_core/_class4.funcs.php'; 37 38 load_class('_core/model/_log.class.php'); 39 $Debuglog = & new Log( 'note' ); 40 $Messages = & new Log('error'); 41 load_funcs('_core/_misc.funcs.php'); 42 require_once $conf_path.'_upgrade.php'; 43 require_once $inc_path.'_vars.inc.php'; 44 load_class('/_core/model/db/_db.class.php'); 45 load_funcs('collections/model/_blog.funcs.php'); 46 load_funcs('collections/model/_category.funcs.php'); 47 load_class('items/model/_item.class.php'); 48 load_funcs('items/model/_item.funcs.php'); 49 load_funcs('users/model/_user.funcs.php'); 50 load_funcs( '_core/ui/forms/_form.funcs.php' ); 51 load_class('_core/model/_timer.class.php'); 52 load_class('plugins/model/_plugins.class.php'); 53 require_once dirname(__FILE__).'/_functions_install.php'; 54 55 $Timer = & new Timer('main'); 56 57 load_class('_core/_param.funcs.php'); 58 param( 'action', 'string', 'default' ); 59 param( 'locale', 'string' ); 60 61 if( preg_match('/[a-z]{2}-[A-Z]{2}(-.{1,14})?/', $locale) ) 62 { 63 $default_locale = $locale; 64 } 65 else 66 { // detect language 67 $default_locale = locale_from_httpaccept(); 68 // echo 'detected locale: ' . $default_locale. '<br />'; 69 } 70 // Activate default locale: 71 locale_activate( $default_locale ); 72 73 init_charsets($current_charset); 74 75 $timestamp = time() - 120; // We start dates 2 minutes ago because their dates increase 1 second at a time and we want everything to be visible when the user watches the blogs right after install :P 76 77 78 switch( $action ) { 79 case 'evoupgrade': 80 $title = T_('Upgrade from a previous version'); 81 break; 82 83 case 'newdb': 84 $title = T_('New Install'); 85 break; 86 87 case 'cafelogupgrade': 88 $title = T_('Upgrade from Cafelog/b2'); 89 break; 90 91 case 'deletedb': 92 $title = T_('Delete b2evolution tables'); 93 break; 94 95 case 'start': 96 $title = T_('Base configuration'); 97 break; 98 99 default: 100 $title = ''; 101 102 } 103 104 header('Content-Type: text/html; charset='.$io_charset); 105 ?> 106 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 107 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php locale_lang() ?>" lang="<?php locale_lang() ?>"><!-- InstanceBegin template="/Templates/evo_distrib_2.dwt" codeOutsideHTMLIsLocked="false" --> 108 <head> 109 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 110 <!-- InstanceBeginEditable name="doctitle" --> 111 <title><?php echo T_('b2evo installer').( $title ? ': '.$title : '' ) ?></title> 112 <!-- InstanceEndEditable --> 113 <link href="../rsc/css/evo_distrib_2.css" rel="stylesheet" type="text/css" /> 114 <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> 115 <!-- InstanceParam name="lang" type="text" value="<?php locale_lang() ?>" --> 116 </head> 117 118 <body> 119 <!-- InstanceBeginEditable name="BodyHead" --><!-- InstanceEndEditable --> 120 121 <div class="wrapper1"> 122 <div class="wrapper2"> 123 <span class="version_top"><!-- InstanceBeginEditable name="Version" --><?php echo T_('Installer for version ').' '. $app_version ?><!-- InstanceEndEditable --></span> 124 125 <a href="http://b2evolution.net/" target="_blank"><img src="../rsc/img/distrib/b2evolution-logo.gif" alt="b2evolution" width="237" height="92" /></a> 126 127 <div class="menu_top"><!-- InstanceBeginEditable name="MenuTop" --> 128 <span class="floatright"><?php echo T_('After install') ?>: <a href="../index.php"><?php echo T_('Blogs') ?></a> · 129 <a href="../admin.php"><?php echo T_('Admin') ?></a> 130 </span> 131 <?php echo T_('Current installation') ?>: 132 <a href="index.php?locale=<?php echo $default_locale ?>"><?php echo T_('Install menu') ?></a> · 133 <a href="phpinfo.php"><?php echo T_('PHP info') ?></a> 134 <!-- InstanceEndEditable --></div> 135 136 <!-- InstanceBeginEditable name="Main" --> 137 <div class="block1"> 138 <div class="block2"> 139 <div class="block3"> 140 <?php 141 142 if( $config_is_done || (($action != 'start') && ($action != 'default') && ($action != 'conf')) ) 143 { // Connect to DB: 144 $tmp_evoconf_db = $db_config; 145 // We want a friendly message if we can't connect: 146 $tmp_evoconf_db['halt_on_error'] = false; 147 $tmp_evoconf_db['show_errors'] = false; 148 $DB = new DB( $tmp_evoconf_db ); 149 unset($tmp_evoconf_db); 150 151 if( $DB->error ) 152 { // restart conf 153 echo '<p class="error">'.T_('Check your database config settings below and update them if necessary...').'</p>'; 154 $action = 'start'; 155 } 156 else 157 { 158 $DB->halt_on_error = true; // From now on, halt on errors. 159 $DB->show_errors = true; // From now on, show errors (they're helpful in case of errors!). 160 161 // Check MySQL version 162 $mysql_version = $DB->get_var( 'SELECT VERSION()' ); 163 list( $mysl_version_main, $mysl_version_minor ) = explode( '.', $mysql_version ); 164 if( ($mysl_version_main * 100 + $mysl_version_minor) < 323 ) 165 { 166 die( '<div class="error"><p class="error"><strong>'.sprintf(T_('The minimum requirement for this version of b2evolution is %s version %s but you are trying to use version %s!'), 'MySQL', '3.23', $mysql_version ).'</strong></p></div>'); 167 } 168 } 169 } 170 171 // Check PHP version 172 list( $version_main, $version_minor ) = explode( '.', phpversion() ); 173 if( ($version_main * 100 + $version_minor) < 401 ) 174 { 175 die( '<div class="error"><p class="error"><strong>'.sprintf(T_('The minimum requirement for this version of b2evolution is %s version %s but you are trying to use version %s!'), 'PHP', '4.1.0', phpversion() ).'</strong></p></div>'); 176 } 177 178 // Check other dependencies: 179 // TODO: Non-install/upgrade-actions should be allowed (e.g. "deletedb") 180 if( $req_errors = install_validate_requirements() ) 181 { 182 echo '<div class="error">'; 183 echo '<p class="error"><strong>'.'b2evolution cannot be installed, because of the following errors:'.'</strong></p>'; 184 echo '<ul class="error"><li>'.implode( '</li><li>', $req_errors ).'</li></ul>'; 185 echo '</div>'; 186 die; 187 } 188 189 190 switch( $action ) 191 { 192 case 'conf': 193 /* 194 * ----------------------------------------------------------------------------------- 195 * Write conf file: 196 * ----------------------------------------------------------------------------------- 197 */ 198 param( 'conf_db_user', 'string', true ); 199 param( 'conf_db_password', 'string', true ); 200 param( 'conf_db_name', 'string', true ); 201 param( 'conf_db_host', 'string', true ); 202 param( 'conf_db_tableprefix', 'string', true ); 203 param( 'conf_baseurl', 'string', true ); 204 $conf_baseurl = preg_replace( '#(/)?$#', '', $conf_baseurl ).'/'; // force trailing slash 205 param( 'conf_admin_email', 'string', true ); 206 207 // Connect to DB: 208 $DB = new DB( array( 209 'user' => $conf_db_user, 210 'password' => $conf_db_password, 211 'name' => $conf_db_name, 212 'host' => $conf_db_host, 213 'aliases' => $db_config['aliases'], 214 'use_transactions' => $db_config['use_transactions'], 215 'table_options' => $db_config['table_options'], 216 'connection_charset' => $db_config['connection_charset'], 217 'halt_on_error' => false ) ); 218 if( $DB->error ) 219 { // restart conf 220 echo '<p class="error">'.T_('It seems that the database config settings you entered don\'t work. Please check them carefully and try again...').'</p>'; 221 $action = 'start'; 222 } 223 else 224 { 225 $conf_filepath = $conf_path.'_basic_config.php'; 226 // Read original: 227 $conf = implode( '', file( $conf_filepath ) ); 228 229 if( empty( $conf ) ) 230 { // This should actually never happen, just in case... 231 printf( '<p class="error">Could not load original conf file [%s]. Is it missing?</p>', $conf_filepath ); 232 break; 233 } 234 235 // File loaded... 236 // Update conf: 237 $conf = preg_replace( 238 array( 239 '#\$db_config\s*=\s*array\( 240 \s*[\'"]user[\'"]\s*=>\s*[\'"].*?[\'"], ([^\n\r]*\r?\n) 241 \s*[\'"]password[\'"]\s*=>\s*[\'"].*?[\'"], ([^\n\r]*\r?\n) 242 \s*[\'"]name[\'"]\s*=>\s*[\'"].*?[\'"], ([^\n\r]*\r?\n) 243 \s*[\'"]host[\'"]\s*=>\s*[\'"].*?[\'"], ([^\n\r]*\r?\n) 244 #ixs', 245 "#tableprefix\s*=\s*'.*?';#", 246 "#baseurl\s*=\s*'.*?';#", 247 "#admin_email\s*=\s*'.*?';#", 248 "#config_is_done\s*=.*?;#", 249 ), 250 array( 251 "\$db_config = array(\n" 252 ."\t'user' => '$conf_db_user',\$1" 253 ."\t'password' => '$conf_db_password',\$2" 254 ."\t'name' => '$conf_db_name',\$3" 255 ."\t'host' => '$conf_db_host',\$4", 256 "tableprefix = '$conf_db_tableprefix';", 257 "baseurl = '$conf_baseurl';", 258 "admin_email = '$conf_admin_email';", 259 'config_is_done = 1;', 260 ), $conf ); 261 262 $f = @fopen( $conf_filepath , 'w' ); 263 if( $f == false ) 264 { 265 ?> 266 <h1><?php echo T_('Config file update') ?></h1> 267 <p><strong><?php printf( T_('We cannot automatically update your config file [%s]!'), $conf_filepath ); ?></strong></p> 268 <p><?php echo T_('There are two ways to deal with this:') ?></p> 269 <ul> 270 <li><strong><?php echo T_('You can allow the installer to update the config file by changing its permissions:') ?></strong> 271 <ol> 272 <li><?php printf( T_('<code>chmod 666 %s</code>. If needed, see the <a %s>online manual about permissions</a>.'), $conf_filepath, 'href="http://manual.b2evolution.net/Directory_and_file_permissions" target="_blank"' ); ?></li> 273 <li><?php echo T_('Come back to this page and refresh/reload.') ?></li> 274 </ol> 275 <br /> 276 </li> 277 <li><strong><?php echo T_('Alternatively, you can update the config file manually:') ?></strong> 278 <ol> 279 <li><?php echo T_('Open the _basic_config.php file locally with a text editor.') ?></li> 280 <li><?php echo T_('Delete all contents!') ?></li> 281 <li><?php echo T_('Copy the contents from the box below.') ?></li> 282 <li><?php echo T_('Paste them into your local text editor. <strong>ATTENTION: make sure there is ABSOLUTELY NO WHITESPACE after the final <code>?></code> in the file.</strong> Any space, tab, newline or blank line at the end of the conf file may prevent cookies from being set when you try to log in later.') ?></li> 283 <li><?php echo T_('Save the new _basic_config.php file locally.') ?></li> 284 <li><?php echo T_('Upload the file to your server, into the /_conf folder.') ?></li> 285 <li><?php printf( T_('<a %s>Call the installer from scratch</a>.'), 'href="index.php?locale='.$default_locale.'"') ?></li> 286 </ol> 287 </li> 288 </ul> 289 <p><?php echo T_('This is how your _basic_config.php should look like:') ?></p> 290 <blockquote> 291 <pre><?php 292 echo htmlspecialchars( $conf ); 293 ?></pre> 294 </blockquote> 295 <?php 296 break; 297 } 298 else 299 { // Write new contents: 300 fwrite( $f, $conf ); 301 fclose($f); 302 303 printf( '<p>'.T_('Your configuration file [%s] has been successfully updated.').'</p>', $conf_filepath ); 304 305 $tableprefix = $conf_db_tableprefix; 306 $baseurl = $conf_baseurl; 307 $admin_email = $conf_admin_email; 308 $config_is_done = 1; 309 $action = 'menu'; 310 } 311 } 312 // ATTENTION: we continue here... 313 314 case 'start': 315 case 'default': 316 /* 317 * ----------------------------------------------------------------------------------- 318 * Start of install procedure: 319 * ----------------------------------------------------------------------------------- 320 */ 321 if( (($action == 'start') && ($allow_evodb_reset == 1)) || (!$config_is_done) ) 322 { 323 // Set default params if not provided otherwise: 324 param( 'conf_db_user', 'string', $db_config['user'] ); 325 param( 'conf_db_password', 'string', $db_config['password'] ); 326 param( 'conf_db_name', 'string', $db_config['name'] ); 327 param( 'conf_db_host', 'string', $db_config['host'] ); 328 param( 'conf_db_tableprefix', 'string', $tableprefix ); 329 // Guess baseurl: 330 // TODO: dh> IMHO HTTP_HOST would be a better default, because it's what the user accesses for install. 331 // fp, please change it, if it's ok. SERVER_NAME might get used if HTTP_HOST is not given, but that shouldn't be the case normally. 332 $baseurl = 'http://'.( isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : 'yourserver.com' ); 333 if( isset( $_SERVER['SERVER_PORT'] ) && ( $_SERVER['SERVER_PORT'] != '80' ) ) 334 $baseurl .= ':'.$_SERVER['SERVER_PORT']; 335 $baseurl .= preg_replace( '#/install(/(index.php)?)?$#', '', $ReqPath ).'/'; 336 param( 'conf_baseurl', 'string', $baseurl ); 337 param( 'conf_admin_email', 'string', $admin_email ); 338 339 ?> 340 <h1><?php echo T_('Base configuration') ?></h1> 341 342 <p><?php echo T_('Your base config file has not been edited yet. You can do this by filling in the form below.') ?></p> 343 344 <p><?php echo T_('This is the minimum info we need to set up b2evolution on this server:') ?></p> 345 346 <form class="fform" name="form" action="index.php" method="post"> 347 <input type="hidden" name="action" value="conf" /> 348 <input type="hidden" name="locale" value="<?php echo $default_locale; ?>" /> 349 350 <fieldset> 351 <legend><?php echo T_('Database you want to install into') ?></legend> 352 <?php 353 form_text( 'conf_db_user', $conf_db_user, 16, T_('MySQL Username'), sprintf( T_('Your username to access the database' ) ), 100 ); 354 form_text( 'conf_db_password', $conf_db_password, 16, T_('MySQL Password'), sprintf( T_('Your password to access the database' ) ), 100, '', 'password' ); 355 form_text( 'conf_db_name', $conf_db_name, 16, T_('MySQL Database'), sprintf( T_('Name of the database you want to use' ) ), 100); 356 form_text( 'conf_db_host', $conf_db_host, 16, T_('MySQL Host'), sprintf( T_('You probably won\'t have to change this' ) ), 120 ); 357 form_text( 'conf_db_tableprefix', $conf_db_tableprefix, 16, T_('MySQL tables prefix'), sprintf( T_('All DB tables will be prefixed with this. You need to change this only if you want to have multiple b2evo installations in the same DB.' ) ), 30 ); 358 ?> 359 </fieldset> 360 361 <fieldset> 362 <legend><?php echo T_('Additional settings') ?></legend> 363 <?php 364 form_text( 'conf_baseurl', $conf_baseurl, 50, T_('Base URL'), sprintf( T_('This is where b2evo and your blogs reside by default. CHECK THIS CAREFULLY or not much will work. If you want to test b2evolution on your local machine, in order for login cookies to work, you MUST use http://<strong>localhost</strong>/path... Do NOT use your machine\'s name!' ) ), 120 ); 365 366 form_text( 'conf_admin_email', $conf_admin_email, 50, T_('Your email'), sprintf( T_('Will be used in severe error messages so that users can contact you. You will also receive notifications for new user registrations.' ) ), 80 ); 367 ?> 368 </fieldset> 369 370 <fieldset> 371 <fieldset> 372 <div class="input"> 373 <input type="submit" name="submit" value="<?php echo T_('Update config file') ?>" class="search" /> 374 <input type="reset" value="<?php echo T_('Reset') ?>" class="search" /> 375 </div> 376 </fieldset> 377 </fieldset> 378 379 </form> 380 381 <?php 382 break; 383 } 384 // if config was already done, move on to main menu: 385 386 case 'menu': 387 /* 388 * ----------------------------------------------------------------------------------- 389 * Menu 390 * ----------------------------------------------------------------------------------- 391 */ 392 ?> 393 <h1><?php echo T_('How do you want to install b2evolution?') ?></h1> 394 395 <form action="index.php" method="get"> 396 <input type="hidden" name="locale" value="<?php echo $default_locale ?>" /> 397 <input type="hidden" name="confirmed" value="0" /> 398 399 <p><?php echo T_('The installation can be done in different ways. Choose one:')?></p> 400 401 <p><input type="radio" name="action" id="newdb" value="newdb" checked="checked" /> 402 <label for="newdb"><?php echo T_('<strong>New Install</strong>: Install b2evolution database tables.')?></label></p> 403 <p style="margin-left: 2em;"> 404 <input type="checkbox" name="create_sample_contents" id="create_sample_contents" value="1" checked="checked" /> 405 <label for="create_sample_contents"><?php echo T_('Also install sample blogs & sample contents. The sample posts explain several features of b2evolution. This is highly recommended for new users.')?></label> 406 </p> 407 408 <p><input type="radio" name="action" id="evoupgrade" value="evoupgrade" /> 409 <label for="evoupgrade"><?php echo T_('<strong>Upgrade from a previous version of b2evolution</strong>: Upgrade your b2evolution database tables in order to make them compatible with the current version. <strong>WARNING:</strong> If you have modified your database, this operation may fail. Make sure you have a backup.') ?></label></p> 410 411 <?php 412 if( $allow_evodb_reset == 1 ) 413 { 414 ?> 415 <p><input type="radio" name="action" id="deletedb" value="deletedb" /> 416 <label for="deletedb"><strong><?php echo T_('Delete b2evolution tables')?></strong>: 417 <?php echo T_('If you have installed b2evolution tables before and wish to start anew, you must delete the b2evolution tables before you can start a new installation. <strong>WARNING: All your b2evolution tables and data will be lost!!!</strong> Any non-b2evolution tables will remain untouched though.')?></label></p> 418 419 <p><input type="radio" name="action" id="start" value="start" /> 420 <label for="start"><?php echo T_('<strong>Change your base configuration</strong> (see recap below): You only want to do this in rare occasions where you may have moved your b2evolution files or database to a different location...')?></label></p> 421 <?php 422 } 423 ?> 424 425 <p> 426 <input type="submit" value=" <?php echo T_('GO!')?> " 427 onclick="var dc = document.getElementById( 'deletedb' ); if( dc && dc.checked ) { if ( confirm( '<?php 428 printf( /* TRANS: %s gets replaced by app name, usually "b2evolution" */ TS_( 'Are you sure you want to delete your existing %s tables?\nDo you have a backup?' ), $app_name ); 429 ?>' ) ) { this.form.confirmed.value = 1; return true; } else return false; }" /> 430 </p> 431 </form> 432 <?php 433 if( $allow_evodb_reset != 1 ) 434 { 435 ?> 436 <br /> 437 <h2><?php echo T_('Need to start anew?') ?></h2> 438 <p><?php echo T_('If you have installed b2evolution tables before and wish to start anew, you must delete the b2evolution tables before you can start a new installation. b2evolution can delete its own tables for you, but for obvious security reasons, this feature is disabled by default.'); 439 echo '</p>'; 440 echo( '<p>To enable it, please go to the /conf/_basic_config.php file and change:</p> 441 <pre>$allow_evodb_reset = 0;</pre> 442 to 443 <pre>$allow_evodb_reset = 1;</pre> 444 <p>Then reload this page and a reset option will appear.</p> 445 <p>This will also allow you to change your base configuration.</p>'); 446 } 447 ?> 448 449 </div> 450 </div> 451 </div> 452 453 <div class="block1"> 454 <div class="block2"> 455 <div class="block3"> 456 457 <h2><?php echo T_('Base config recap...')?></h2> 458 459 <p><?php printf( T_('If you don\'t see correct settings here, STOP before going any further, and <a %s>update your base configuration</a>.'), 'href="index.php?action=start&locale='.$default_locale.'"' ) ?></p> 460 461 <?php 462 if( !isset($conf_db_user) ) $conf_db_user = $db_config['user']; 463 if( !isset($conf_db_password) ) $conf_db_password = $db_config['password']; 464 if( !isset($conf_db_name) ) $conf_db_name = $db_config['name']; 465 if( !isset($conf_db_host) ) $conf_db_host = $db_config['host']; 466 467 echo '<pre>', 468 T_('MySQL Username').': '.$conf_db_user."\n". 469 T_('MySQL Password').': '.(($conf_db_password != 'demopass' ? T_('(Set, but not shown for security reasons)') : 'demopass') )."\n". 470 T_('MySQL Database').': '.$conf_db_name."\n". 471 T_('MySQL Host').': '.$conf_db_host."\n". 472 T_('MySQL tables prefix').': '.$tableprefix."\n\n". 473 T_('Base URL').': '.$baseurl."\n\n". 474 T_('Admin email').': '.$admin_email. 475 '</pre>'; 476 break; 477 478 479 case 'newdb': 480 /* 481 * ----------------------------------------------------------------------------------- 482 * NEW DB: Create a plain new db structure + sample contents 483 * ----------------------------------------------------------------------------------- 484 */ 485 require_once dirname(__FILE__).'/_functions_create.php'; 486 487 param( 'create_sample_contents', 'integer', 0 ); 488 489 echo '<h2>'.T_('Creating b2evolution tables...').'</h2>'; 490 flush(); 491 create_tables(); 492 493 echo '<h2>'.T_('Creating minimum default data...').'</h2>'; 494 flush(); 495 create_default_data(); 496 497 if( $create_sample_contents ) 498 { 499 echo '<h2>'.T_('Installing sample contents...').'</h2>'; 500 flush(); 501 create_demo_contents(); 502 } 503 504 echo '<h2>'.T_('Installation successful!').'</h2>'; 505 506 echo '<p><strong>'; 507 printf( T_('Now you can <a %s>log in</a> with the login "admin" and password "<evo:password>%s</evo:password>".'), 'href="'.$admin_url.'"', $random_password ); 508 echo '</strong></p>'; 509 510 echo '<p>'.T_('Note that password carefully! It is a <em>random</em> password that is given to you when you install b2evolution. If you lose it, you will have to delete the database tables and re-install anew.').'</p>'; 511 512 break; 513 514 515 case 'evoupgrade': 516 /* 517 * ----------------------------------------------------------------------------------- 518 * EVO UPGRADE: Upgrade data from existing b2evolution database 519 * ----------------------------------------------------------------------------------- 520 */ 521 require_once( dirname(__FILE__). '/_functions_evoupgrade.php' ); 522 523 echo '<h2>'.T_('Upgrading data in existing b2evolution database...').'</h2>'; 524 flush(); 525 if( upgrade_b2evo_tables() ) 526 { 527 ?> 528 <p><?php echo T_('Upgrade completed successfully!')?></p> 529 <p><?php printf( T_('Now you can <a %s>log in</a> with your usual %s username and password.'), 'href="'.$admin_url.'"', 'b2evolution')?></p> 530 <?php 531 } 532 break; 533 534 535 case 'deletedb': 536 /* 537 * ----------------------------------------------------------------------------------- 538 * DELETE DB: Delete the db structure!!! (Everything will be lost) 539 * ----------------------------------------------------------------------------------- 540 */ 541 require_once( dirname(__FILE__). '/_functions_delete.php' ); 542 543 echo '<h2>'.T_('Deleting b2evolution tables from the datatase...').'</h2>'; 544 flush(); 545 546 if( $allow_evodb_reset != 1 ) 547 { 548 echo '<p>'.T_('For security reasons, the reset feature is disabled by default.' ).'</p>'; 549 echo( '<p>To enable it, please go to the /conf/_basic_config.php file and change:</p> 550 <pre>$allow_evodb_reset = 0;</pre> 551 to 552 <pre>$allow_evodb_reset = 1;</pre> 553 <p>Then reload this page and a reset option will appear.</p>'); 554 break; 555 } 556 if( ! param('confirmed', 'integer', 1) ) 557 { 558 ?> 559 <p> 560 <?php 561 echo nl2br( htmlspecialchars( sprintf( /* TRANS: %s gets replaced by app name, usually "b2evolution" */ T_( "Are you sure you want to delete your existing %s tables?\nDo you have a backup?" ), $app_name ) ) ); 562 ?> 563 </p> 564 <p> 565 <form class="inline" name="form" action="index.php" method="post"> 566 <input type="hidden" name="action" value="deletedb" /> 567 <input type="hidden" name="confirmed" value="1" /> 568 <input type="hidden" name="locale" value="<?php echo $default_locale; ?>" /> 569 <input type="submit" value=" <?php echo T_('I am sure!')?> " /> 570 </form> 571 572 <form class="inline" name="form" action="index.php" method="get"> 573 <input type="hidden" name="locale" value="<?php echo $default_locale; ?>" /> 574 <input type="submit" value=" <?php echo T_('CANCEL')?> " /> 575 </form> 576 </p> 577 <?php 578 break; 579 } 580 581 // Uninstall Plugins 582 // TODO: fp>> I don't trust the plugins to uninstall themselves correctly. There will be tons of lousy poorly written plugins. All I trust them to do is to crash the uninstall procedure. We want a hardcore brute force uninsall! and most users "may NOT want" to even think about "ma-nu-al-ly" removing something from their DB. 583 /* 584 $DB->show_errors = $DB->halt_on_error = false; 585 $Plugins = new Plugins(); 586 $DB->show_errors = $DB->halt_on_error = true; 587 $at_least_one_failed = false; 588 foreach( $Plugins->get_list_by_event( 'Uninstall' ) as $l_Plugin ) 589 { 590 $success = $Plugins->call_method( $l_Plugin->ID, 'Uninstall', $params = array( 'unattended' => true ) ); 591 if( $success === false ) 592 { 593 echo "Failed un-installing plugin $l_Plugin->classname (ID $l_Plugin->ID)...<br />\n"; 594 $at_least_one_failed = false; 595 } 596 else 597 { 598 echo "Uninstalled plugin $l_Plugin->classname (ID $l_Plugin->ID)...<br />\n"; 599 } 600 } 601 if( $at_least_one_failed ) 602 { 603 echo "You may want to manually remove left files or DB tables from the failed plugin(s).<br />\n"; 604 } 605 $DB->show_errors = $DB->halt_on_error = true; 606 */ 607 db_delete(); 608 ?> 609 <p><?php echo T_('Reset done!')?></p> 610 <p><a href="index.php?locale=<?php echo $default_locale ?>"><?php echo T_('Back to menu')?></a>.</p> 611 <?php 612 break; 613 } 614 615 ?> 616 617 </div> 618 </div> 619 </div> 620 621 <?php 622 // Locales selector: 623 if( ($action == 'start') || ($action == 'default') || ($action == 'conf') || ($action == 'menu') ) 624 { 625 ?> 626 <div class="block1"> 627 <div class="block2"> 628 <div class="block3"> 629 <h2><?php echo T_('Language / Locale')?> - Temporarily misplaced</h2> 630 <p><?php echo T_('Choose a default language/locale for your b2evo installation.')?></p> 631 632 <?php 633 // present available locales on first screen 634 foreach( $locales as $lkey => $lvalue ) 635 { 636 if( $default_locale == $lkey ) echo '<strong>'; 637 echo ' <a href="index.php?action='.$action.'&locale='.$lkey.'">'; 638 locale_flag( $lkey, 'w16px', 'flag', '', true, $rsc_url.'flags' ); 639 echo T_( $lvalue['name'] ); 640 echo '</a>'; 641 if( $default_locale == $lkey ) echo '</strong>'; 642 echo ' · '; 643 644 } 645 ?> 646 </div> 647 </div> 648 </div> 649 <?php 650 } 651 ?> 652 <!-- InstanceEndEditable --> 653 </div> 654 655 <div class="body_fade_out"> 656 657 <div class="menu_bottom"><!-- InstanceBeginEditable name="MenuBottom" --> 658 <?php echo T_('Online resources') ?>: <a href="http://b2evolution.net/" target="_blank"><?php echo T_('Official website') ?></a> • <a href="http://b2evolution.net/about/recommended-hosting-lamp-best-choices.php" target="_blank"><?php echo T_('Find a host') ?></a> • <a href="http://manual.b2evolution.net/" target="_blank"><?php echo T_('Manual') ?></a> • <a href="http://forums.b2evolution.net/" target="_blank"><?php echo T_('Forums') ?></a> 659 <!-- InstanceEndEditable --></div> 660 661 <div class="copyright"><!-- InstanceBeginEditable name="CopyrightTail" -->Copyright © 2003-2007 by François Planque & others · <a href="http://b2evolution.net/about/license.html" target="_blank">GNU GPL license</a> · <a href="http://b2evolution.net/contact/" target="_blank">Contact</a> 662 <!-- InstanceEndEditable --></div> 663 664 </div> 665 </div> 666 667 <!-- InstanceBeginEditable name="BodyFoot" --> 668 <?php 669 debug_info(); // output debug info if requested 670 // the following comment gets checked in the automatic install script of demo.b2evolution.net: 671 ?> 672 <!-- b2evo-install-end --> 673 <!-- InstanceEndEditable --> 674 </body> 675 <!-- InstanceEnd --></html> 676 677 678 <?php 679 /* 680 * $Log: index.php,v $ 681 * Revision 1.139 2007/10/08 21:31:23 fplanque 682 * auto install doc 683 * 684 * Revision 1.138 2007/09/23 18:55:17 fplanque 685 * attempting to debloat. The Log class is insane. 686 * 687 * Revision 1.137 2007/09/19 02:54:16 fplanque 688 * bullet proof upgrade 689 * 690 * Revision 1.136 2007/07/14 02:44:22 fplanque 691 * New default page design. 692 * 693 * Revision 1.135 2007/07/14 00:24:53 fplanque 694 * New installer design. 695 * 696 * Revision 1.134 2007/07/01 18:47:11 fplanque 697 * fixes 698 * 699 * Revision 1.133 2007/06/25 11:02:31 fplanque 700 * MODULES (refactored MVC) 701 * 702 * Revision 1.132 2007/06/24 18:28:55 fplanque 703 * refactored skin install 704 * 705 * Revision 1.129 2007/06/12 21:00:02 blueyed 706 * Added non-JS handling of deletedb confirmation 707 * 708 * Revision 1.128 2007/04/26 00:11:10 fplanque 709 * (c) 2007 710 * 711 * Revision 1.127 2007/01/20 01:44:22 blueyed 712 * typo 713 * 714 * Revision 1.126 2007/01/15 19:10:29 fplanque 715 * install refactoring 716 * 717 * Revision 1.125 2007/01/15 18:48:44 fplanque 718 * allow blank install. 719 * 720 * Revision 1.124 2007/01/15 03:53:24 fplanque 721 * refactoring / simplified installer 722 * 723 * Revision 1.123 2007/01/14 03:47:53 fplanque 724 * killed upgrade from b2/cafelog 725 * (if people haven't upgraded yet, there's little chance they ever will, 726 * no need to maintain this. We also provide an upgrade path with 1.x) 727 * 728 * Revision 1.122 2007/01/12 02:40:26 fplanque 729 * widget default params proof of concept 730 * (param customization to be done) 731 * 732 * Revision 1.121 2007/01/08 02:11:56 fplanque 733 * Blogs now make use of installed skins 734 * next step: make use of widgets inside of skins 735 * 736 * Revision 1.120 2006/11/30 06:13:23 blueyed 737 * Moved Plugins::install() and sort() galore to Plugins_admin 738 * 739 * Revision 1.119 2006/11/30 05:43:40 blueyed 740 * Moved Plugins::discover() to Plugins_admin::discover(); Renamed Plugins_no_DB to Plugins_admin_no_DB (and deriving from Plugins_admin) 741 * 742 * Revision 1.118 2006/11/14 00:47:32 fplanque 743 * doc 744 * 745 * Revision 1.117 2006/10/31 04:44:00 blueyed 746 * Fixed cafelogupgrade 747 * 748 * Revision 1.116 2006/10/27 20:11:24 blueyed 749 * TODO 750 * 751 * Revision 1.115 2006/10/14 20:50:29 blueyed 752 * Define EVO_IS_INSTALLING for /install/ and use it in Plugins to skip "dangerous" but unnecessary instantiating of other Plugins 753 * 754 * Revision 1.114 2006/10/01 15:23:28 blueyed 755 * Fixed install 756 */ 757 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |