CMXX - Multisite config

This commit is contained in:
“VeLiTi”
2025-03-13 12:25:59 +01:00
parent 0d6f75704b
commit 116cdcd745
5 changed files with 42 additions and 60 deletions

View File

@@ -1,7 +1,11 @@
<?php
defined(page_security_key) or exit;
//=============================
// Configuration file
$file = './settings/config_redirector.php';
//=============================
$domain = getDomainName($_SERVER['SERVER_NAME']);
$file = ((file_exists(dirname(__FILE__).'/settings/'.$domain.'/'.$domain.'_config.php')) ? dirname(__FILE__).'/settings/'.$domain.'/'.$domain.'_config.php' : dirname(__FILE__).'/settings/config.php');
//Check if allowed
if (isAllowed('settings',$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
@@ -93,7 +97,7 @@ if (isset($_POST['submit']) && !empty($_POST)) {
$v = in_array(strtolower($v), ['true', 'false']) ? strtolower($v) : '\'' . $v . '\'';
$contents = preg_replace('/define\(\'' . $k . '\'\, ?(.*?)\)/s', 'define(\'' . $k . '\',' . $v . ')', $contents);
}
file_put_contents('./settings/config_redirector.php', $contents);
file_put_contents($file, $contents);