Changeset 5983


Ignore:
Timestamp:
Apr 28, 2010, 5:36:29 PM (14 years ago)
Author:
plg
Message:

remove useless check of mysql.inc.php

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/install.php

    r5982 r5983  
    147147$errors = array();
    148148
    149 // database config file migration : mysql.inc.php et database.inc.php
    150 $old_config_file = PHPWG_ROOT_PATH . 'include/mysql.inc.php';
    151149$config_file = PHPWG_ROOT_PATH . 'local/config/database.inc.php';
    152 if (!file_exists($config_file) && file_exists($old_config_file))
    153 {
    154   $step = 3;
    155   include $old_config_file;
    156   $file_content = '<?php
    157 $conf[\'dblayer\'] = \'mysql\';
    158 $conf[\'db_base\'] = \''.$cfgBase.'\';
    159 $conf[\'db_user\'] = \''.$cfgUser.'\';
    160 $conf[\'db_password\'] = \''.$cfgPassword.'\';
    161 $conf[\'db_host\'] = \''.$cfgHote.'\';
    162 
    163 $prefixeTable = \''.$prefixeTable.'\';
    164 
    165 define(\'PHPWG_INSTALLED\', true);
    166 define(\'PWG_CHARSET\', \''.PWG_CHARSET.'\');
    167 define(\'DB_CHARSET\', \''.DB_CHARSET.'\');
    168 define(\'DB_COLLATE\', \''.DB_COLLATE.'\');
    169 
    170 ?'.'>';
    171 }
    172 // Open config.php ... if it exists
    173 elseif (@file_exists($config_file))
     150if (@file_exists($config_file))
    174151{
    175152  include($config_file);
     
    235212define('PHPWG_URL', 'http://'.PHPWG_DOMAIN);
    236213
    237 if (empty($step) || ($step != 3))
    238 {
    239   load_language('common.lang', '', array('language' => $language, 'target_charset'=>'utf-8'));
    240   load_language('admin.lang', '', array('language' => $language, 'target_charset'=>'utf-8'));
    241   load_language('install.lang', '', array('language' => $language, 'target_charset'=>'utf-8'));
    242 }
     214load_language('common.lang', '', array('language' => $language, 'target_charset'=>'utf-8'));
     215load_language('admin.lang', '', array('language' => $language, 'target_charset'=>'utf-8'));
     216load_language('install.lang', '', array('language' => $language, 'target_charset'=>'utf-8'));
     217
    243218header('Content-Type: text/html; charset=UTF-8');
    244219//------------------------------------------------- check php version
     
    408383
    409384//------------------------------------------------------ start template output
    410 if ($step == 3)
    411 {
    412   @umask(0111);
    413   // writing the new configuration file
    414   if ( !($fp = @fopen( $config_file, 'w' )))
    415   {
    416     $html_content = htmlentities( $file_content, ENT_QUOTES );
    417     $html_content = nl2br( $html_content );
    418    
    419     $error_copy = l10n('An alternate solution is to copy the text in the box above and paste it into the file "local/config/database.inc.php" (Warning : database.inc.php must only contain what is in the textarea, no line return or space character)');
    420     $error_copy .= '<br><br>';
    421     $error_copy .= '<textarea rows="15" cols="70">'.$html_content.'</textarea>';
    422   }
    423   else
    424   {
    425     @fputs($fp, $file_content, strlen($file_content));
    426     @fclose($fp);
    427 
    428     @unlink($old_config_file);
    429     header("Location: index.php");
    430     exit();
    431   }
    432 
    433   $template->assign(
    434     array(
    435       'T_CONTENT_ENCODING' => 'utf-8',
    436       'migration' => true
    437       )
    438     );
    439 }
    440 else
    441 {
    442   $dbengines = available_engines();
    443 
    444   foreach ($languages->fs_languages as $language_code => $language_name)
    445   {
    446     if ($language == $language_code)
    447     {
    448       $template->assign('language_selection', $language_code);
    449     }
    450     $languages_options[$language_code] = $language_name;
    451   }
    452   $template->assign('language_options', $languages_options);
    453 
    454   $template->assign(
    455     array(
    456       'T_CONTENT_ENCODING' => 'utf-8',
    457       'RELEASE' => PHPWG_VERSION,
    458       'F_ACTION' => 'install.php?language=' . $language,
    459       'F_DB_ENGINES' => $dbengines,
    460       'F_DB_LAYER' => $dblayer,
    461       'F_DB_HOST' => $dbhost,
    462       'F_DB_USER' => $dbuser,
    463       'F_DB_NAME' => $dbname,
    464       'F_DB_PREFIX' => $prefixeTable,
    465       'F_ADMIN' => $admin_name,
    466       'F_ADMIN_EMAIL' => $admin_mail,
    467       'L_INSTALL_HELP' => sprintf(l10n('Need help ? Ask your question on <a href="%s">Piwigo message board</a>.'), PHPWG_URL.'/forum'),
    468       ));
    469 }
     385$dbengines = available_engines();
     386
     387foreach ($languages->fs_languages as $language_code => $language_name)
     388{
     389  if ($language == $language_code)
     390  {
     391    $template->assign('language_selection', $language_code);
     392  }
     393  $languages_options[$language_code] = $language_name;
     394}
     395$template->assign('language_options', $languages_options);
     396
     397$template->assign(
     398  array(
     399    'T_CONTENT_ENCODING' => 'utf-8',
     400    'RELEASE' => PHPWG_VERSION,
     401    'F_ACTION' => 'install.php?language=' . $language,
     402    'F_DB_ENGINES' => $dbengines,
     403    'F_DB_LAYER' => $dblayer,
     404    'F_DB_HOST' => $dbhost,
     405    'F_DB_USER' => $dbuser,
     406    'F_DB_NAME' => $dbname,
     407    'F_DB_PREFIX' => $prefixeTable,
     408    'F_ADMIN' => $admin_name,
     409    'F_ADMIN_EMAIL' => $admin_mail,
     410    'L_INSTALL_HELP' => sprintf(l10n('Need help ? Ask your question on <a href="%s">Piwigo message board</a>.'), PHPWG_URL.'/forum'),
     411    ));
    470412
    471413//------------------------------------------------------ errors & infos display
     
    473415{
    474416  $template->assign('install', true);
    475 }
    476 elseif ($step == 3)
    477 {
    478   if (isset($error_copy))
    479   {
    480     array_push($errors, $error_copy);
    481   }
    482417}
    483418else
Note: See TracChangeset for help on using the changeset viewer.