aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/include/functions_install.inc.php2
-rw-r--r--admin/include/functions_upgrade.php17
-rw-r--r--install.php4
-rw-r--r--upgrade.php34
4 files changed, 36 insertions, 21 deletions
diff --git a/admin/include/functions_install.inc.php b/admin/include/functions_install.inc.php
index d55f4e057..9aab979c6 100644
--- a/admin/include/functions_install.inc.php
+++ b/admin/include/functions_install.inc.php
@@ -139,7 +139,7 @@ function activate_all_themes()
}
}
-function try_db_connection(&$infos, &$errors)
+function install_db_connect(&$infos, &$errors)
{
try
{
diff --git a/admin/include/functions_upgrade.php b/admin/include/functions_upgrade.php
index b35b4c8e6..644e5ffd7 100644
--- a/admin/include/functions_upgrade.php
+++ b/admin/include/functions_upgrade.php
@@ -66,6 +66,8 @@ function prepare_conf_upgrade()
define('IMAGE_TAG_TABLE', $prefixeTable.'image_tag');
define('PLUGINS_TABLE', $prefixeTable.'plugins');
define('OLD_PERMALINKS_TABLE', $prefixeTable.'old_permalinks');
+ define('THEMES_TABLE', $prefixeTable.'themes');
+ define('LANGUAGES_TABLE', $prefixeTable.'languages');
}
// Deactivate all non-standard plugins
@@ -213,4 +215,19 @@ SELECT id
return (count(array_diff($existing, $applied)) > 0);
}
+function upgrade_db_connect()
+{
+ global $conf;
+
+ try
+ {
+ $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'],
+ $conf['db_password'], $conf['db_base']);
+ }
+ catch (Exception $e)
+ {
+ my_error(l10n($e->getMessage()), true);
+ }
+}
+
?> \ No newline at end of file
diff --git a/install.php b/install.php
index 9314253ef..2742a16ce 100644
--- a/install.php
+++ b/install.php
@@ -183,7 +183,6 @@ elseif (@file_exists($config_file))
include(PHPWG_ROOT_PATH . 'include/constants.php');
include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
include(PHPWG_ROOT_PATH . 'admin/include/functions.php');
-include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php');
include(PHPWG_ROOT_PATH . 'admin/include/languages.class.php');
$languages = new languages('utf-8');
@@ -259,10 +258,11 @@ if (!isset($step))
//---------------------------------------------------------------- form analyze
include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$dblayer.'.inc.php');
include(PHPWG_ROOT_PATH . 'admin/include/functions_install.inc.php');
+include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php');
if ( isset( $_POST['install'] ))
{
- if (try_db_connection($infos, $errors))
+ if (install_db_connect($infos, $errors))
{
$required_version = constant('REQUIRED_'.strtoupper($dblayer).'_VERSION');
if ( version_compare(pwg_get_db_version(), $required_version, '>=') )
diff --git a/upgrade.php b/upgrade.php
index 9bb6add8b..fb7bc15e7 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -38,31 +38,16 @@ if ($php_end_tag === false)
include_once(PHPWG_ROOT_PATH.'include/functions.inc.php');
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
-include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php');
include(PHPWG_ROOT_PATH.'local/config/database.inc.php');
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_'.$conf['dblayer'].'.inc.php');
-
-prepare_conf_upgrade();
+// $conf is not used for users tables - define cannot be re-defined
+define('USERS_TABLE', $prefixeTable.'users');
include_once(PHPWG_ROOT_PATH.'include/constants.php');
define('PREFIX_TABLE', $prefixeTable);
-// Database connection
-try
-{
- $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'],
- $conf['db_password'], $conf['db_base']);
-}
-catch (Exception $e)
-{
- my_error(l10n($e->getMessage(), true));
-}
-
-pwg_db_check_charset();
-
// +-----------------------------------------------------------------------+
// | functions |
// +-----------------------------------------------------------------------+
@@ -148,6 +133,9 @@ function print_time($message)
// +-----------------------------------------------------------------------+
// | language |
// +-----------------------------------------------------------------------+
+include(PHPWG_ROOT_PATH . 'admin/include/languages.class.php');
+$languages = new languages('utf-8');
+
if (isset($_GET['language']))
{
$language = strip_tags($_GET['language']);
@@ -156,7 +144,7 @@ else
{
$language = 'en_UK';
// Try to get browser language
- foreach (get_languages('utf-8') as $language_code => $language_name)
+ foreach ($languages->fs_languages as $language_code => $language_name)
{
if (substr($language_code,0,2) == @substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2))
{
@@ -207,6 +195,16 @@ if (version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<'))
}
// +-----------------------------------------------------------------------+
+// | database connection |
+// +-----------------------------------------------------------------------+
+include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php');
+include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php');
+
+upgrade_db_connect();
+
+pwg_db_check_charset();
+
+// +-----------------------------------------------------------------------+
// | template initialization |
// +-----------------------------------------------------------------------+