1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 12:18:39 +01:00

Issue #5120 Return to multi-dimensional format for multisite plugin compatibility.

This commit is contained in:
camer0n 2024-04-08 16:02:44 -07:00
parent 145d1dea80
commit 8711f503a1
6 changed files with 78 additions and 34 deletions

View File

@ -135,7 +135,7 @@ else
unset($retrieve_prefs);
}
include(e_ROOT.'e107_config.php');
$config = include(e_ROOT.'e107_config.php');
if(!defined('e_POWEREDBY_DISABLE'))
{
@ -159,7 +159,7 @@ if(empty($PLUGINS_DIRECTORY))
//define("MPREFIX", $mySQLprefix); moved to $e107->set_constants()
if(empty($mySQLdefaultdb) && !class_exists('e107_config'))
if(empty($mySQLdefaultdb) && empty($config))
{
// e107_config.php is either empty, not valid or doesn't exist so redirect to installer..
header('Location: install.php');
@ -184,7 +184,7 @@ $tmp = e_ROOT.$HANDLERS_DIRECTORY;
e107_require_once($tmp.'/e107_class.php');
unset($tmp);
if(!class_exists('e107_config')) // old e107_config.php format.
if(empty($config['paths'])) // old e107_config.php format.
{
$dirNames = ['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'];
@ -211,9 +211,10 @@ if(!class_exists('e107_config')) // old e107_config.php format.
}
else // New e107_config.php format. v2.4+
{
$e107_paths = e107_config::paths();
$sql_info = e107_config::database();
$E107_CONFIG = e107_config::other() ?? [];
$e107_paths = $config['paths'];
$sql_info = $config['database'];
$E107_CONFIG = $config['other'] ?? [];
unset($config);
}

View File

@ -1228,7 +1228,9 @@ class admin_shortcodes extends e_shortcode
{
return null;
}
global $themename, $themeversion, $themeauthor, $themedate, $themeinfo, $mySQLdefaultdb;
global $themename, $themeversion, $themeauthor, $themedate, $themeinfo;
$mySQLdefaultdb = e107::getMySQLConfig('defaultdb');
$pref = e107::getPref();
$ns = e107::getRender();

View File

@ -608,9 +608,9 @@ class e_thumbnail
return null;
}
$getsize = isset($parm['size']) ? $parm['size'] : '100x100';
$getsize = $parm['size'] ?? '100x100';
header('location: https://via.placeholder.com/'.$getsize);
header('location: https://placehold.co/'.$getsize);
header('Content-Length: 0');
exit();
}

View File

@ -38,23 +38,16 @@ $E107_CONFIG = array('site_path' => '000000test');
*/
const e_MOD_REWRITE = true;
class e107_config
{
public static function database()
{
return [
return [
'database' => [
'server' => '{{ mySQLserver }}',
'user' => '{{ mySQLuser }}',
'password' => '{{ mySQLpassword }}',
'defaultdb'=> '{{ mySQLdefaultdb }}',
'prefix' => '{{ mySQLprefix }}',
'charset' => 'utf8',
];
}
public static function paths()
{
return [
],
'paths' => [ // leave empty to use default
'admin' => 'e107_admin/',
'files' => 'e107_files/',
'images' => 'e107_images/',
@ -65,14 +58,8 @@ class e107_config
'help' => 'e107_docs/help/',
'system' => 'e107_system/',
'media' => 'e107_media/',
];
}
public static function other()
{
return [
],
'other' => [
'site_path' => '000000test'
]
];
}
}

View File

@ -1531,6 +1531,59 @@ if($this->pdo == true)
}*/
// New format e107 v2.4+
$config_file = "<?php
/*
* e107 website system
*
* Copyright (C) 2008-".date('Y')." e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* e107 configuration file
*
* This file has been generated by the installation script on ".date('r').".
*/
// -- Optional --
// const e_EMAIL_CRITICAL = '{$this->previous_steps['admin']['email']}'; // email the admin (and share no details with the user) if a critical error occurs.
// const e_LOG_CRITICAL = true; // log critical errors but do not display them to user. (similar to above, but no email is sent - instead error goes into a log file)
// const e_DEBUG = true; // Enable debug mode to allow displaying of errors
// const e_HTTP_STATIC = 'https://static.mydomain.com/'; // Use a static subdomain for js/css/images etc.
// const e_MOD_REWRITE_STATIC = true; // Rewrite static image urls.
// const e_GIT = 'path-to-git'; // Path to GIT for developers
// const X_FRAME_SAMEORIGIN = false; // Option to override X-Frame-Options
return [
'database' => [
'server' => '{$this->previous_steps['mysql']['server']}',
'user' => '{$this->previous_steps['mysql']['user']}',
'password' => '{$this->previous_steps['mysql']['password']}',
'defaultdb'=> '{$this->previous_steps['mysql']['db']}',
'prefix' => '{$this->previous_steps['mysql']['prefix']}',
'charset' => 'utf8mb4',
],
'paths' => [
'admin' => '{$this->e107->e107_dirs['ADMIN_DIRECTORY']}',
'files' => '{$this->e107->e107_dirs['FILES_DIRECTORY']}',
'images' => '{$this->e107->e107_dirs['IMAGES_DIRECTORY']}',
'themes' => '{$this->e107->e107_dirs['THEMES_DIRECTORY']}',
'plugins' => '{$this->e107->e107_dirs['PLUGINS_DIRECTORY']}',
'handlers' => '{$this->e107->e107_dirs['HANDLERS_DIRECTORY']}',
'languages' => '{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}',
'help' => '{$this->e107->e107_dirs['HELP_DIRECTORY']}',
'media' => '{$this->e107->e107_dirs['MEDIA_DIRECTORY']}',
'system' => '{$this->e107->e107_dirs['SYSTEM_DIRECTORY']}',
],
'site' => [
'site_path' => '{$this->previous_steps['paths']['hash']}',
]
];
";
$config_result = $this->write_config($config_file);
if ($config_result)

View File

@ -36,6 +36,7 @@ function thumbExceptionHandler(Throwable $e)
$e->getLine(),
$e->getTraceAsString()
);
var_dump($message);
error_log($message);
}
@ -97,7 +98,7 @@ class e_thumbpage
// Config
include($self.DIRECTORY_SEPARATOR.'e107_config.php');
$config = include($self.DIRECTORY_SEPARATOR.'e107_config.php');
// support early include feature
if(!empty($CLASS2_INCLUDE))
@ -120,7 +121,7 @@ class e_thumbpage
//e107 class
require($tmp.DIRECTORY_SEPARATOR.'e107_class.php');
if(!class_exists('e107_config')) // old e107_config.php format.
if(empty($config['paths'])) // old e107_config.php format.
{
$dirNames = ['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'];
@ -142,9 +143,9 @@ class e_thumbpage
}
else // New e107_config.php format. v2.4+
{
$e107_paths = e107_config::paths();
$sql_info = e107_config::database();
$E107_CONFIG = e107_config::other() ?? [];
$e107_paths = $config['paths'];
$sql_info = $config['database'];
$E107_CONFIG = $config['other'] ?? [];
}
$e107 = e107::getInstance()->initCore($e107_paths, e_ROOT, $sql_info, varset($E107_CONFIG, array()));