CMXX - Multisite setup
This commit is contained in:
@@ -46,7 +46,7 @@ require dirname(__FILE__).'/mail/Exception.php';
|
||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
function send_mail($to, $subject, $message, $attachment, $attachment_name){
|
||||
|
||||
include_once dirname(__FILE__,2).'/settings/config.php';
|
||||
include_once dirname(__FILE__,2).'/settings/config_redirector.php';
|
||||
|
||||
$mail = new PHPMailer();
|
||||
$mail->CharSet = 'UTF-8';
|
||||
@@ -250,6 +250,9 @@ function template_header($title, $selected = 'assets', $selected_child = 'view')
|
||||
$icon_image = icon_image;
|
||||
$admin_links = menu($selected,$selected_child);
|
||||
|
||||
$domain = getDomainName($_SERVER['SERVER_NAME']);
|
||||
$custom_css = (file_exists(dirname(__FILE__,2).'/style/'.$domain.'/'.$domain.'.css') ? './style/'.$domain.'/'.$domain.'.css' : './style/admin.css');
|
||||
|
||||
$user = ucfirst($_SESSION['username']);
|
||||
if (filter_var($user, FILTER_VALIDATE_EMAIL)){
|
||||
$user = substr($user, 0, strpos($user, "@"));
|
||||
@@ -286,7 +289,7 @@ echo <<<EOT
|
||||
<meta name="viewport" content="width=device-width,minimum-scale=1">
|
||||
<title>$title</title>
|
||||
<link rel="icon" type="image/png" href="$icon_image">
|
||||
<link href="./style/admin.css" rel="stylesheet" type="text/css">
|
||||
<link href="$custom_css" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" href="./style/leaflet.css" />
|
||||
<link href="./assets/fontawesome/css/fontawesome.css" rel="stylesheet" />
|
||||
<link href="./assets/fontawesome/css/brands.css" rel="stylesheet" />
|
||||
@@ -891,7 +894,7 @@ function getWhereclauselvl2($table_name,$permission,$partner,$method){
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
function getProfile($profile, $permission){
|
||||
|
||||
include_once dirname(__FILE__,2).'/settings/config.php';
|
||||
include_once dirname(__FILE__,2).'/settings/config_redirector.php';
|
||||
|
||||
if ($profile != ''){
|
||||
$profile = (defined($profile)) ? constant($profile) : standard_profile;
|
||||
@@ -2124,7 +2127,7 @@ function uploadrequest($key){
|
||||
// debuglog
|
||||
//------------------------------------------
|
||||
function debuglog($error){
|
||||
include_once dirname(__FILE__,2).'/settings/config.php';
|
||||
include_once dirname(__FILE__,2).'/settings/config_redirector.php';
|
||||
$test = $error.PHP_EOL;
|
||||
$filelocation = dirname(__FILE__,2).'/log/log_'.date('d').'.txt';
|
||||
error_log($test, 3, $filelocation);
|
||||
@@ -3871,7 +3874,6 @@ function createGiftCart($pdo, $orderID, $giftcard_categoryID,$accounthierarchy){
|
||||
//=======================================
|
||||
// findGitCommitHash
|
||||
//=======================================
|
||||
|
||||
function findShortGitCommitHash($string) {
|
||||
// Step 1: Find all hexadecimal sequences
|
||||
preg_match_all('/[0-9a-f]+/i', $string, $matches);
|
||||
@@ -3909,4 +3911,47 @@ function compareCommitCodes($stringA, $stringB) {
|
||||
|
||||
// Case 4: Neither has commit code
|
||||
return "";
|
||||
}
|
||||
//=======================================
|
||||
// Function to find the first existing view
|
||||
//=======================================
|
||||
|
||||
function findExistingView($viewsArray, $defaultView, $ignoreViews) {
|
||||
foreach ($viewsArray as $view) {
|
||||
|
||||
$file_to_check = $view.'.php';
|
||||
|
||||
if (in_array($view, $ignoreViews)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file_exists($file_to_check)) {
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
// If no view exists, return the default
|
||||
return $defaultView;
|
||||
}
|
||||
//=======================================
|
||||
// Function to find the domain
|
||||
//=======================================
|
||||
function getDomainName($hostname) {
|
||||
// Extract the domain parts
|
||||
$parts = explode('.', $hostname);
|
||||
$count = count($parts);
|
||||
|
||||
// For hostnames with enough parts to have a subdomain (at least 3 parts)
|
||||
if ($count >= 3) {
|
||||
// Return the second-to-last and third-to-last parts
|
||||
return $parts[$count - 2];
|
||||
}
|
||||
// For hostnames with just domain and TLD (2 parts)
|
||||
else if ($count == 2) {
|
||||
// Return just the domain part (without the TLD)
|
||||
return $parts[0];
|
||||
}
|
||||
// If it's a single part hostname
|
||||
else {
|
||||
return $hostname;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user