mirror of
https://github.com/e107inc/e107.git
synced 2025-01-16 20:28:28 +01:00
Issue #5120 - Reworked as object for increased flexibility. Some tweaking still to be done.
This commit is contained in:
parent
93132395b8
commit
dbcc26544a
14
class2.php
14
class2.php
@ -143,7 +143,7 @@ $error_handler = new error_handler();
|
||||
//
|
||||
// E: Setup other essential PHP parameters
|
||||
//
|
||||
define('e107_INIT', true);
|
||||
const e107_INIT = true;
|
||||
|
||||
|
||||
// DEPRECATED, use e107::getConfig() and e107::getPlugConfig()
|
||||
@ -208,7 +208,7 @@ $tmp = e_ROOT.$HANDLERS_DIRECTORY;
|
||||
e107_require_once($tmp.'/e107_class.php');
|
||||
unset($tmp);
|
||||
|
||||
if(empty($config['directories'])) // old e107_config.php format.
|
||||
if(!class_exists('e107_config')) // old e107_config.php format.
|
||||
{
|
||||
$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');
|
||||
@ -225,10 +225,10 @@ if(empty($config['directories'])) // old e107_config.php format.
|
||||
}
|
||||
else // New e107_config.php format. v2.4+
|
||||
{
|
||||
$e107_paths = $config['directories'];
|
||||
$sql_info = $config['mySQL'];
|
||||
$E107_CONFIG = $config['other'] ?? [];
|
||||
unset($config);
|
||||
$e107_paths = $config->paths();
|
||||
$sql_info = $config->database();
|
||||
$E107_CONFIG = $config->other() ?? [];
|
||||
//unset($config);
|
||||
}
|
||||
|
||||
|
||||
@ -1369,7 +1369,7 @@ function getperms($arg, $ap = null, $path = null)
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($arg === 'P' && preg_match('#(.*?)/' .e107::getInstance()->getFolder('plugins'). '(.*?)/(.*?)#', $path, $matches))
|
||||
if ($arg === 'P' && preg_match('#(.*?)/' .e107::getFolder('plugins'). '(.*?)/(.*?)#', $path, $matches))
|
||||
{
|
||||
$sql = e107::getDb('psql');
|
||||
|
||||
|
@ -36,30 +36,44 @@ $SYSTEM_DIRECTORY = 'e107_system/';
|
||||
|
||||
$E107_CONFIG = array('site_path' => '000000test');
|
||||
*/
|
||||
define('e_MOD_REWRITE',true);
|
||||
const 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'
|
||||
]
|
||||
];
|
||||
class e107_config
|
||||
{
|
||||
public function database()
|
||||
{
|
||||
return [
|
||||
'server' => '{{ mySQLserver }}',
|
||||
'user' => '{{ mySQLuser }}',
|
||||
'password' => '{{ mySQLpassword }}',
|
||||
'defaultdb'=> '{{ mySQLdefaultdb }}',
|
||||
'prefix' => '{{ mySQLprefix }}',
|
||||
'charset' => 'utf8',
|
||||
];
|
||||
}
|
||||
|
||||
public function paths()
|
||||
{
|
||||
return [
|
||||
'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/',
|
||||
];
|
||||
}
|
||||
|
||||
public function other()
|
||||
{
|
||||
return [
|
||||
'site_path' => '000000test'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return new e107_config;
|
Loading…
x
Reference in New Issue
Block a user