aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/include/functions_install.inc.php7
-rw-r--r--admin/themes/default/template/install.tpl4
-rw-r--r--include/config_default.inc.php2
-rw-r--r--install.php34
4 files changed, 21 insertions, 26 deletions
diff --git a/admin/include/functions_install.inc.php b/admin/include/functions_install.inc.php
index bb9acb5b3..48699cd29 100644
--- a/admin/include/functions_install.inc.php
+++ b/admin/include/functions_install.inc.php
@@ -89,7 +89,7 @@ function available_engines()
if (file_exists(sprintf($pattern, $engine_name)))
{
$engines[$engine_name]['label'] = $engine['engine'];
- $engines[$engine_name]['available'] = 'disabled';
+ $engines[$engine_name]['available'] = false;
if (isset($engine['function_available'])
&& function_exists($engine['function_available']))
@@ -104,11 +104,6 @@ function available_engines()
}
}
- if (count($engines)>1)
- {
- $engines[$GLOBALS['conf']['dbengine_select_default']]['selected'] = true;
- }
-
if ($engines['sqlite']['available'] && $engines['pdo-sqlite']['available'])
{
if ($GLOBALS['conf']['db_sqlite_default']=='native')
diff --git a/admin/themes/default/template/install.tpl b/admin/themes/default/template/install.tpl
index e7981add2..7e27e6184 100644
--- a/admin/themes/default/template/install.tpl
+++ b/admin/themes/default/template/install.tpl
@@ -112,8 +112,8 @@ TD {
<select name="dblayer" id="dblayer">
{foreach from=$F_DB_ENGINES key=k item=v}
<option value="{$k}"
- {if $k==$F_DB_LAYER or $v.selected} selected="selected"{/if}
- {if $v.available!=1} disabled="disabled"{/if}
+ {if $k==$F_DB_LAYER and $v.available} selected="selected"{/if}
+ {if !$v.available} disabled="disabled"{/if}
>{$v.label}</option>
{/foreach}
</select>
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index 6a1b217de..b6ee06e4d 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -536,7 +536,7 @@ $conf['db_sqlite_default'] = 'native';
// default database engine proposed if severals are available
// choices : sqlite, mysql, pgsql, pdo-sqlite
// see include/dblayer/dblayers.inc.php
-$conf['dbengine_select_default'] = 'sqlite';
+$conf['dbengine_select_default'] = 'mysql';
// pass_convert : function to crypt or hash the clear user password to store
// it in the database
diff --git a/install.php b/install.php
index fa5ac8aa3..6a2e4038b 100644
--- a/install.php
+++ b/install.php
@@ -98,22 +98,25 @@ if( !@get_magic_quotes_gpc() )
define('DEFAULT_PREFIX_TABLE', 'piwigo_');
-// Obtain various vars
-$dbhost = (!empty($_POST['dbhost'])) ? $_POST['dbhost'] : 'localhost';
-$dbuser = (!empty($_POST['dbuser'])) ? $_POST['dbuser'] : '';
-$dbpasswd = (!empty($_POST['dbpasswd'])) ? $_POST['dbpasswd'] : '';
-$dbname = (!empty($_POST['dbname'])) ? $_POST['dbname'] : '';
-$dblayer = (!empty($_POST['dblayer'])) ? $_POST['dblayer'] : 'mysql';
-
if (isset($_POST['install']))
{
- $table_prefix = $_POST['prefix'];
+ $prefixeTable = $_POST['prefix'];
}
else
{
- $table_prefix = DEFAULT_PREFIX_TABLE;
+ $prefixeTable = DEFAULT_PREFIX_TABLE;
}
+include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
+@include(PHPWG_ROOT_PATH. 'local/config/config.inc.php');
+
+// Obtain various vars
+$dbhost = (!empty($_POST['dbhost'])) ? $_POST['dbhost'] : 'localhost';
+$dbuser = (!empty($_POST['dbuser'])) ? $_POST['dbuser'] : '';
+$dbpasswd = (!empty($_POST['dbpasswd'])) ? $_POST['dbpasswd'] : '';
+$dbname = (!empty($_POST['dbname'])) ? $_POST['dbname'] : '';
+$dblayer = (!empty($_POST['dblayer'])) ? $_POST['dblayer'] : $conf['dbengine_select_default'];
+
$admin_name = (!empty($_POST['admin_name'])) ? $_POST['admin_name'] : '';
$admin_pass1 = (!empty($_POST['admin_pass1'])) ? $_POST['admin_pass1'] : '';
$admin_pass2 = (!empty($_POST['admin_pass2'])) ? $_POST['admin_pass2'] : '';
@@ -156,9 +159,6 @@ elseif (@file_exists($config_file))
}
}
-$prefixeTable = $table_prefix;
-include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
-@include(PHPWG_ROOT_PATH. 'local/config/config.inc.php');
include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$dblayer.'.inc.php');
include(PHPWG_ROOT_PATH . 'include/constants.php');
include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
@@ -289,7 +289,7 @@ $conf[\'db_user\'] = \''.$dbuser.'\';
$conf[\'db_password\'] = \''.$dbpasswd.'\';
$conf[\'db_host\'] = \''.$dbhost.'\';
-$prefixeTable = \''.$table_prefix.'\';
+$prefixeTable = \''.$prefixeTable.'\';
define(\'PHPWG_INSTALLED\', true);
define(\'PWG_CHARSET\', \''.$pwg_charset.'\');
@@ -316,17 +316,17 @@ define(\'DB_COLLATE\', \'\');
execute_sqlfile(
PHPWG_ROOT_PATH.'install/piwigo_structure-'.$dblayer.'.sql',
DEFAULT_PREFIX_TABLE,
- $table_prefix
+ $prefixeTable
);
// We fill the tables with basic informations
execute_sqlfile(
PHPWG_ROOT_PATH.'install/config.sql',
DEFAULT_PREFIX_TABLE,
- $table_prefix
+ $prefixeTable
);
$query = '
-INSERT INTO '.$table_prefix.'config (param,value,comment)
+INSERT INTO '.$prefixeTable.'config (param,value,comment)
VALUES (\'secret_key\',\'md5('.pwg_db_cast_to_text(DB_RANDOM_FUNCTION.'()').')\',
\'a secret key specific to the gallery for internal use\');';
pwg_query($query);
@@ -436,7 +436,7 @@ else
'F_DB_HOST' => $dbhost,
'F_DB_USER' => $dbuser,
'F_DB_NAME' => $dbname,
- 'F_DB_PREFIX' => $table_prefix,
+ 'F_DB_PREFIX' => $prefixeTable,
'F_ADMIN' => $admin_name,
'F_ADMIN_EMAIL' => $admin_mail,
'L_INSTALL_HELP' => sprintf(l10n('Need help ? Ask your question on <a href="%s">Piwigo message board</a>.'), PHPWG_URL.'/forum'),