Index: /trunk/admin/template/goto/install.tpl
===================================================================
--- /trunk/admin/template/goto/install.tpl	(revision 4422)
+++ /trunk/admin/template/goto/install.tpl	(revision 4423)
@@ -163,9 +163,9 @@
 {else}
 <p>
-  <br />
-  <input type="button" name="home" value="{'home'|@translate}" onClick="window.open('index.php');"/>
-  <input type="button" name="admin" value="{'admin'|@translate}" onClick="window.open('admin.php');"/>
+  <input type="button" name="home" value="{'home'|@translate}" onClick="window.open('index.php');">
+  <input type="button" name="admin" value="{'admin'|@translate}" onClick="window.open('admin.php');">
 </p>
 
+{if !isset($migration)}
 <div class="infos">
   <ul>
@@ -175,7 +175,7 @@
 
 <p>
-  <br />
-  <input type="button" name="subscribe" value="{'Subscribe %s'|@translate|@sprintf:$F_ADMIN_EMAIL}" onClick="window.open('{$SUBSCRIBE_BASE_URL}{$F_ADMIN_EMAIL}');"/>
+  <input type="button" name="subscribe" value="{'Subscribe %s'|@translate|@sprintf:$F_ADMIN_EMAIL}" onClick="window.open('{$SUBSCRIBE_BASE_URL}{$F_ADMIN_EMAIL}');">
 </p>
+{/if}
 {/if}
 </div> {* content *}
Index: /trunk/install.php
===================================================================
--- /trunk/install.php	(revision 4422)
+++ /trunk/install.php	(revision 4423)
@@ -123,7 +123,29 @@
 $errors = array();
 
+// database config file migration : mysql.inc.php et config_database.inc.php
+$old_config_file = PHPWG_ROOT_PATH . 'include/mysql.inc.php';
+$config_file = PHPWG_ROOT_PATH . 'include/config_database.inc.php';
+if (!file_exists($config_file) && file_exists($old_config_file))
+{
+  $step = 3;
+  include $old_config_file;
+  $file_content = '<?php
+$conf[\'dblayer\'] = \'mysql\';
+$conf[\'db_base\'] = \''.$cfgBase.'\';
+$conf[\'db_user\'] = \''.$cfgUser.'\';
+$conf[\'db_password\'] = \''.$cfgPassword.'\';
+$conf[\'db_host\'] = \''.$cfgHote.'\';
+
+$prefixeTable = \''.$prefixeTable.'\';
+
+define(\'PHPWG_INSTALLED\', true);
+define(\'PWG_CHARSET\', \''.PWG_CHARSET.'\');
+define(\'DB_CHARSET\', \''.DB_CHARSET.'\');
+define(\'DB_COLLATE\', \''.DB_COLLATE.'\');
+
+?'.'>';
+}
 // Open config.php ... if it exists
-$config_file = PHPWG_ROOT_PATH.'include/config_database.inc.php';
-if (@file_exists($config_file))
+elseif (@file_exists($config_file))
 {
   include($config_file);
@@ -176,7 +198,10 @@
 define('PHPWG_URL', 'http://'.PHPWG_DOMAIN);
 
-load_language( 'common.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
-load_language( 'admin.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
-load_language( 'install.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
+if ($step != 3)
+{
+  load_language('common.lang', '', array('language' => $language, 'target_charset'=>'utf-8'));
+  load_language('admin.lang', '', array('language' => $language, 'target_charset'=>'utf-8'));
+  load_language('install.lang', '', array('language' => $language, 'target_charset'=>'utf-8'));
+}
 
 //------------------------------------------------- check php version
@@ -189,6 +214,9 @@
 include( PHPWG_ROOT_PATH .'include/template.class.php');
 $template = new Template(PHPWG_ROOT_PATH.'admin/template/goto', 'roma');
-$template->set_filenames( array('install'=>'install.tpl') );
-$step = 1;
+$template->set_filenames( array('install' => 'install.tpl') );
+if (!isset($step))
+{
+  $step = 1;
+}
 //---------------------------------------------------------------- form analyze
 if ( isset( $_POST['install'] ))
@@ -353,31 +381,63 @@
 
 //------------------------------------------------------ start template output
-$dbengines = available_engines();
-
-foreach (get_languages('utf-8') as $language_code => $language_name)
-{
-  if ($language == $language_code)
-  {
-    $template->assign('language_selection', $language_code);
-  }
-  $languages_options[$language_code] = $language_name;
-}
-$template->assign('language_options', $languages_options);
-
-$template->assign(
-  array(
-    'T_CONTENT_ENCODING' => 'utf-8',
-    'RELEASE' => PHPWG_VERSION,
-    'F_ACTION' => 'install.php?language=' . $language,
-    'F_DB_ENGINES' => $dbengines,
-    'F_DB_LAYER' => $dblayer,
-    'F_DB_HOST' => $dbhost,
-    'F_DB_USER' => $dbuser,
-    'F_DB_NAME' => $dbname,
-    'F_DB_PREFIX' => $table_prefix,
-    'F_ADMIN' => $admin_name,
-    'F_ADMIN_EMAIL' => $admin_mail,
-    'L_INSTALL_HELP' => sprintf(l10n('install_help'), PHPWG_URL.'/forum'),
-    ));
+if ($step == 3)
+{
+  @umask(0111);
+  // writing the new configuration file
+  if ( !($fp = @fopen( $config_file, 'w' )))
+  {
+    $html_content = htmlentities( $file_content, ENT_QUOTES );
+    $html_content = nl2br( $html_content );
+    $error_copy = l10n('Copy the text in pink between hyphens and paste it into the file "include/config_database.inc.php"(Warning : config_database.inc.php must only contain what is in pink, no line return or space character)');
+    $error_copy .= '<br>--------------------------------------------------------------------<br>';
+    $error_copy .= '<span class="sql_content">' . $html_content . '</span>';
+    $error_copy .= '<br>--------------------------------------------------------------------<br>';
+  } 
+  else 
+  {
+    @fputs($fp, $file_content, strlen($file_content));
+    @fclose($fp);
+
+    @unlink($old_config_file);
+    header("Location: index.php");
+    exit();
+  }
+
+  $template->assign(
+    array(
+      'T_CONTENT_ENCODING' => 'utf-8',
+      'migration' => true
+	  ));
+}
+else
+{
+  $dbengines = available_engines();
+
+  foreach (get_languages('utf-8') as $language_code => $language_name)
+  {
+    if ($language == $language_code)
+    {
+      $template->assign('language_selection', $language_code);
+    }
+    $languages_options[$language_code] = $language_name;
+  }
+  $template->assign('language_options', $languages_options);
+
+  $template->assign(
+    array(
+      'T_CONTENT_ENCODING' => 'utf-8',
+      'RELEASE' => PHPWG_VERSION,
+      'F_ACTION' => 'install.php?language=' . $language,
+      'F_DB_ENGINES' => $dbengines,
+      'F_DB_LAYER' => $dblayer,
+      'F_DB_HOST' => $dbhost,
+      'F_DB_USER' => $dbuser,
+      'F_DB_NAME' => $dbname,
+      'F_DB_PREFIX' => $table_prefix,
+      'F_ADMIN' => $admin_name,
+      'F_ADMIN_EMAIL' => $admin_mail,
+      'L_INSTALL_HELP' => sprintf(l10n('install_help'), PHPWG_URL.'/forum'),
+      ));
+}
 
 //------------------------------------------------------ errors & infos display
@@ -385,4 +445,11 @@
 {
   $template->assign('install', true);
+}
+elseif ($step == 3)
+{
+  if (isset($error_copy))
+  {
+    array_push($errors, $error_copy);
+  }
 }
 else
Index: /trunk/install/db/84-database.php
===================================================================
--- /trunk/install/db/84-database.php	(revision 4423)
+++ /trunk/install/db/84-database.php	(revision 4423)
@@ -0,0 +1,77 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+$upgrade_description = 'Update configuration filename for database.
+configuration variables will change too.';
+
+$old_config_file = PHPWG_ROOT_PATH .'include/mysql.inc.php';
+$new_config_file = PHPWG_ROOT_PATH .'include/config_database.inc.php';
+
+include_once $old_config_file;
+
+$file_content = '<?php
+$conf[\'dblayer\'] = \'mysql\';
+$conf[\'db_base\'] = \''.$cfgBase.'\';
+$conf[\'db_user\'] = \''.$cfgUser.'\';
+$conf[\'db_password\'] = \''.$cfgPassword.'\';
+$conf[\'db_host\'] = \''.$cfgHote.'\';
+
+$prefixeTable = \''.$prefixeTable.'\';
+
+define(\'PHPWG_INSTALLED\', true);
+define(\'PWG_CHARSET\', \''.PWG_CHARSET.'\');
+define(\'DB_CHARSET\', \''.DB_CHARSET.'\');
+define(\'DB_COLLATE\', \''.DB_COLLATE.'\');
+
+?'.'>';
+
+@umask(0111);
+// writing the configuration file
+if ( !($fp = @fopen( $config_file, 'w' )))
+{
+  $html_content = htmlentities( $file_content, ENT_QUOTES, 'utf-8' );
+  $html_content = nl2br( $html_content );
+  $error_copy = l10n('step1_err_copy');
+  $error_copy .= '<br>--------------------------------------------------------------------<br>';
+  $error_copy .= '<span class="sql_content">' . $html_content . '</span>';
+  $error_copy .= '<br>--------------------------------------------------------------------<br>';
+}
+@fputs($fp, $file_content, strlen($file_content));
+@fclose($fp);
+
+if (isset($error_copy)) 
+{
+  array_push($page['errors'], $error_copy);
+}
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
