mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 05:07:27 +02:00
Issue #5120 - Work in progress. Subject to change.
This commit is contained in:
42
class2.php
42
class2.php
@@ -159,7 +159,7 @@ else
|
|||||||
unset($retrieve_prefs);
|
unset($retrieve_prefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@include(e_ROOT.'e107_config.php');
|
$config = include(e_ROOT.'e107_config.php');
|
||||||
|
|
||||||
if(!defined('e_POWEREDBY_DISABLE'))
|
if(!defined('e_POWEREDBY_DISABLE'))
|
||||||
{
|
{
|
||||||
@@ -183,7 +183,7 @@ if(empty($PLUGINS_DIRECTORY))
|
|||||||
|
|
||||||
//define("MPREFIX", $mySQLprefix); moved to $e107->set_constants()
|
//define("MPREFIX", $mySQLprefix); moved to $e107->set_constants()
|
||||||
|
|
||||||
if(empty($mySQLdefaultdb))
|
if(empty($mySQLdefaultdb) && empty($config))
|
||||||
{
|
{
|
||||||
// e107_config.php is either empty, not valid or doesn't exist so redirect to installer..
|
// e107_config.php is either empty, not valid or doesn't exist so redirect to installer..
|
||||||
header('Location: install.php');
|
header('Location: install.php');
|
||||||
@@ -201,8 +201,6 @@ unset($tmpPlugDir);
|
|||||||
// clever stuff that figures out where the paths are on the fly.. no more need for hard-coded e_HTTP :)
|
// clever stuff that figures out where the paths are on the fly.. no more need for hard-coded e_HTTP :)
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$tmp = e_ROOT.$HANDLERS_DIRECTORY;
|
$tmp = e_ROOT.$HANDLERS_DIRECTORY;
|
||||||
|
|
||||||
//Core functions - now API independent
|
//Core functions - now API independent
|
||||||
@@ -210,24 +208,32 @@ $tmp = e_ROOT.$HANDLERS_DIRECTORY;
|
|||||||
e107_require_once($tmp.'/e107_class.php');
|
e107_require_once($tmp.'/e107_class.php');
|
||||||
unset($tmp);
|
unset($tmp);
|
||||||
|
|
||||||
/** @note compact() causes issues with PHP7.3 */
|
if(empty($config['directories'])) // old e107_config.php format.
|
||||||
$dirPaths = array('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY','UPLOADS_DIRECTORY','SYSTEM_DIRECTORY', 'MEDIA_DIRECTORY','CACHE_DIRECTORY','LOGS_DIRECTORY', 'CORE_DIRECTORY', 'WEB_DIRECTORY');
|
|
||||||
$e107_paths = array();
|
|
||||||
foreach($dirPaths as $v)
|
|
||||||
{
|
{
|
||||||
if(isset($$v))
|
$e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY','UPLOADS_DIRECTORY','SYSTEM_DIRECTORY', 'MEDIA_DIRECTORY','CACHE_DIRECTORY','LOGS_DIRECTORY', 'CORE_DIRECTORY', 'WEB_DIRECTORY');
|
||||||
{
|
$legacy_sql_info = compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix');
|
||||||
$e107_paths[$v] = $$v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// $e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY','UPLOADS_DIRECTORY','SYSTEM_DIRECTORY', 'MEDIA_DIRECTORY','CACHE_DIRECTORY','LOGS_DIRECTORY', 'CORE_DIRECTORY', 'WEB_DIRECTORY');
|
|
||||||
$sql_info = compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix');
|
|
||||||
if(isset($mySQLport))
|
if(isset($mySQLport))
|
||||||
{
|
{
|
||||||
$sql_info['mySQLport'] = $mySQLport;
|
$legacy_sql_info['mySQLport'] = $mySQLport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql_info = array_combine(array_map(function($k) {
|
||||||
|
return str_replace('mySQL', '', $k);
|
||||||
|
}, array_keys($legacy_sql_info)),
|
||||||
|
$legacy_sql_info
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else // New e107_config.php format. v2.4+
|
||||||
|
{
|
||||||
|
$e107_paths = $config['directories'];
|
||||||
|
$sql_info = $config['mySQL'];
|
||||||
|
$E107_CONFIG = $config['other'] ?? [];
|
||||||
|
unset($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$e107 = e107::getInstance()->initCore($e107_paths, e_ROOT, $sql_info, varset($E107_CONFIG, array()));
|
$e107 = e107::getInstance()->initCore($e107_paths, e_ROOT, $sql_info, varset($E107_CONFIG, array()));
|
||||||
|
|
||||||
e107::getSingleton('eIPHandler'); // This auto-handles bans etc
|
e107::getSingleton('eIPHandler'); // This auto-handles bans etc
|
||||||
unset($dirPaths,$e107_paths);
|
unset($dirPaths,$e107_paths);
|
||||||
|
|
||||||
@@ -304,7 +310,7 @@ $sql = e107::getDb(); //TODO - find & replace $sql, $e107->sql
|
|||||||
$sql->db_SetErrorReporting(false);
|
$sql->db_SetErrorReporting(false);
|
||||||
|
|
||||||
$dbg->logTime('SQL Connect');
|
$dbg->logTime('SQL Connect');
|
||||||
$merror=$sql->db_Connect($sql_info['mySQLserver'], $sql_info['mySQLuser'], $sql_info['mySQLpassword'], $mySQLdefaultdb);
|
$merror=$sql->db_Connect($sql_info['server'], $sql_info['user'], $sql_info['password'], $sql_info['defaultdb']);
|
||||||
unset($sql_info);
|
unset($sql_info);
|
||||||
// create after the initial connection.
|
// create after the initial connection.
|
||||||
//DEPRECATED, BC, call the method only when needed
|
//DEPRECATED, BC, call the method only when needed
|
||||||
|
@@ -530,8 +530,17 @@ class e107
|
|||||||
* @param array $e107_config_override
|
* @param array $e107_config_override
|
||||||
* @return e107
|
* @return e107
|
||||||
*/
|
*/
|
||||||
public function initCore($e107_paths, $e107_root_path, $e107_config_mysql_info, $e107_config_override = array())
|
public function initCore($e107_paths, $e107_root_path, $e107_config_mysql_info=array(), $e107_config_override = array())
|
||||||
{
|
{
|
||||||
|
if(!empty($e107_paths['admin'])) //v2.4
|
||||||
|
{
|
||||||
|
foreach($e107_paths as $dir => $path)
|
||||||
|
{
|
||||||
|
$newKey = strtoupper($dir).'_DIRECTORY';
|
||||||
|
$e107_paths[$newKey] = $path;
|
||||||
|
unset($e107_paths[$dir]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->_init($e107_paths, $e107_root_path, $e107_config_mysql_info, $e107_config_override);
|
return $this->_init($e107_paths, $e107_root_path, $e107_config_mysql_info, $e107_config_override);
|
||||||
}
|
}
|
||||||
@@ -599,7 +608,7 @@ class e107
|
|||||||
$this->prepare_request();
|
$this->prepare_request();
|
||||||
|
|
||||||
// mysql connection info
|
// mysql connection info
|
||||||
$this->e107_config_mysql_info = $e107_config_mysql_info;
|
$this->setMySQLConfig($e107_config_mysql_info);
|
||||||
|
|
||||||
// unique folder for e_MEDIA - support for multiple websites from single-install. Must be set before setDirs()
|
// unique folder for e_MEDIA - support for multiple websites from single-install. Must be set before setDirs()
|
||||||
/* if (!empty($e107_config_override['site_path']))
|
/* if (!empty($e107_config_override['site_path']))
|
||||||
@@ -836,7 +845,7 @@ class e107
|
|||||||
public function initInstallSql($e107_config_mysql_info)
|
public function initInstallSql($e107_config_mysql_info)
|
||||||
{
|
{
|
||||||
// mysql connection info
|
// mysql connection info
|
||||||
$this->e107_config_mysql_info = $e107_config_mysql_info;
|
$this->setMySQLConfig($e107_config_mysql_info);
|
||||||
|
|
||||||
// various constants - MAGIC_QUOTES_GPC, MPREFIX, ...
|
// various constants - MAGIC_QUOTES_GPC, MPREFIX, ...
|
||||||
$this->set_constants();
|
$this->set_constants();
|
||||||
@@ -6170,6 +6179,25 @@ class e107
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $sqlinfo
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function setMySQLConfig($sqlinfo): void
|
||||||
|
{
|
||||||
|
if(!empty($sqlinfo['server']))
|
||||||
|
{
|
||||||
|
foreach($sqlinfo as $key=>$val)
|
||||||
|
{
|
||||||
|
$newKey = 'mySQL'.$key;
|
||||||
|
$sqlinfo[$newKey] = $val;
|
||||||
|
unset($sqlinfo[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->e107_config_mysql_info = $sqlinfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
+----------------------------------------------------+
|
+----------------------------------------------------+
|
||||||
This file has been generated by the installation script.
|
This file has been generated by the installation script.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
$mySQLserver = '{{ mySQLserver }}';
|
$mySQLserver = '{{ mySQLserver }}';
|
||||||
$mySQLuser = '{{ mySQLuser }}';
|
$mySQLuser = '{{ mySQLuser }}';
|
||||||
$mySQLpassword = '{{ mySQLpassword }}';
|
$mySQLpassword = '{{ mySQLpassword }}';
|
||||||
@@ -35,5 +35,31 @@ $MEDIA_DIRECTORY = 'e107_media/';
|
|||||||
$SYSTEM_DIRECTORY = 'e107_system/';
|
$SYSTEM_DIRECTORY = 'e107_system/';
|
||||||
|
|
||||||
$E107_CONFIG = array('site_path' => '000000test');
|
$E107_CONFIG = array('site_path' => '000000test');
|
||||||
|
*/
|
||||||
define('e_MOD_REWRITE',true);
|
define('e_MOD_REWRITE',true);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'mySQL' => [
|
||||||
|
'server' => '{{ mySQLserver }}',
|
||||||
|
'user' => '{{ mySQLuser }}',
|
||||||
|
'password' => '{{ mySQLpassword }}',
|
||||||
|
'defaultdb'=> '{{ mySQLdefaultdb }}',
|
||||||
|
'prefix' => '{{ mySQLprefix }}',
|
||||||
|
'charset' => 'utf8',
|
||||||
|
],
|
||||||
|
'directories' => [ // leave empty to use default
|
||||||
|
'admin' => 'e107_admin/',
|
||||||
|
'files' => 'e107_files/',
|
||||||
|
'images' => 'e107_images/',
|
||||||
|
'themes' => 'e107_themes/',
|
||||||
|
'plugins' => 'e107_plugins/',
|
||||||
|
'handlers' => 'e107_handlers/',
|
||||||
|
'languages' => 'e107_languages/',
|
||||||
|
'help' => 'e107_docs/help/',
|
||||||
|
'system' => 'e107_system/',
|
||||||
|
'media' => 'e107_media/',
|
||||||
|
],
|
||||||
|
'other' => [
|
||||||
|
'site_path' => '000000test'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
Reference in New Issue
Block a user