Refactor RBAC migration scripts and update configuration handling

- Removed old migration scripts for profiles and users to RBAC.
- Updated config redirector to utilize environment variables for configuration loading.
- Added .gitignore files to firmware, log, and marketing directories to prevent unnecessary file tracking.
- Introduced new configuration files for acceptance, development, and production environments with relevant settings.
- Enhanced settings files to include exception lists, security keys, and database settings.
This commit is contained in:
“VeLiTi”
2026-02-06 13:34:54 +01:00
parent 4564a4a04b
commit 4b83f596f1
15 changed files with 575 additions and 545 deletions

View File

@@ -0,0 +1,83 @@
<?php
require 'settingsprofiles.php';
// This will change the title on the website
define('site_name','Customer Portal - TEST');
define('site_name_footer','Total Safety Solutions - TEST');
// This will change the title on browser TAB
define('site_title','Total Safety Solutions - TEST');
//Scriptversion
define('script_version','v5');
//Enable VeLiTi-issue mgt
define('veliti_cim',false);
//Enable VeLiTi-analytics
define('veliti_analytics',false);
//Rewrite rule
define('rewrite_url',true);
define('news','');
//maintenance_mode
define('maintenance_mode_communication',true);
define('maintenance_mode_notification','Notice: This is a test instance and can go on and offline without notice.');
define('maintenance_mode',false);
define('maintenance_mode_user','veliti_admin');
define('maintenance_mode_text','System in maintenance.');
define('debug',false);
define('debug_id','114');
/*Business_Rules*/
//Business rules
define('WARRANTY_MONTHS','12');
define('WARRANTY_ELIGIBILITY_WINDOW','3');
define('WARRANTY_EXTENDED_MONTH','24');
define('SERVICE_MONTHS','12');
//Prevent downgrade from paid to free software versions
define('PREVENT_PAID_VERSION_DOWNGRADE',true);
/*Security*/
// Page security
define('page_security_key','secure_admin_342642');
define('cronjob_number','25');
define('header_security',false);
/* Email */
// The from email that will appear on the customer's order details email
define('mail_from','CustomerPortal');
// Your email
define('email','CustomerPortal@veliti.nl');
//Additional phpmailer-settings
define('email_host_name','veliti.nl');
define('email_reply_to','info@gewoonlekkerspaans.nl');
define('email_outgoing_pw','306yc%X5f');
define('email_outgoing_port','465');
define('email_outgoing_security','ssl');
// Enable automatice invoice forward to bookkeeping software
define('invoice_bookkeeping',true);
// Email of bookkeeping software
define('email_bookkeeping','finance@totalsafetysolutions.nl');
/* Payment options */
// Mollie
define('mollie_enabled',true);
define('mollie_api_key','test_jFHqrt9KCSvaBwb4En9ttAM9MTrp9W'); //live_WhsBD8qv3ygR9WVKF3KnCvz9zzNaxh
// PayPal
define('paypal_enabled',true);
define('PAYPAL_URL','https://api-m.sandbox.paypal.com');
define('PAYPAL_WEBHOOK_ID','0SA327855M129725W');
define('PAYPAL_WEBHOOK','https://acc.veliti.nl/webhook_paypal.php');
define('PAYPAL_CLIENT_ID','ASz3ae7Fx3kFxTe6dCfMP1KkLN2YnfjkuifHT9Lan4nlRjUuUeqlLtYN4qrwUCCGTIRUCAyJ78e2m4Wx');
define('PAYPAL_CLIENT_SECRET','EHLzDaAMMpRUgD0FNL6vMfktaYww-tuhafQwVGV0P-gBIZ9Wb0_VcBiGyRpp0mhYBVx6hULUW5vxc5Ub');
define('pay_on_delivery_enabled',false);
/*Appearance*/
//Icon
define('icon_image','/assets/images/TSS-logo3.png');
define('color','#005655c2');
define('color_accent','#2FAC66');
define('emaillogo','/assets/images/TSSemail.png');
/*Default Users*/
define('software_update_user','EMP-updater');
define('software_update_pw','EMP-updater');
define('interface_user','interface@test.nl');
define('interface_pw','test1234');

View File

@@ -0,0 +1,111 @@
<?php
//------------------------------------------
//EXCEPTION LIST
//------------------------------------------
$serialnumber_exceptions = array("221100XX");
//------------------------------------------
// Security
//------------------------------------------
$security_key = 'secure_34563$52';
//------------------------------------------
// Base color
//------------------------------------------
$color = '#005655';//'#0b1054';
$color_accent = '#2FAC66'; //'#ececec';
//------------------------------------------
// Database settings
//------------------------------------------
require '/var/www/vhosts/veliti.nl/settings/portalsettings-test.php';
//------------------------------------------
// Menusetup & settings
//------------------------------------------
require 'settingsmenu.php';
//------------------------------------------
// API BaseUrl
//------------------------------------------
$baseurl = 'https://'.$_SERVER['SERVER_NAME'].'/api.php'; //URL of API
$portalURL = $_SERVER['SERVER_NAME'];
//------------------------------------------
// Equipmentdetails
//------------------------------------------
$servicedate = date("Y-m-d", strtotime("-365 days"));
$warrantydate = date("Y-m-d", strtotime("-365 days"));
$warranty_extended = date("Y-m-d", strtotime("+365 days"));
$date = date('Y-m-d H:i:s');
$curYear = date("Y", time());
$curMonth = date("m", time());
$curQuarter = (int)ceil($curMonth / 3);
$curdateObj = DateTime::createFromFormat('!m', $curMonth);
$curMonth_name = $curdateObj->format('F');
//------------------------------------------
//History Type
//------------------------------------------
$type1 = 'General';
$type2 = 'Customer';
$type3 = 'Service';
$type4 = 'Testing';
$type5 = 'Data';
$type6 = 'Other';
$type7 = 'Internal';
$type8 = 'Ignore';
$type9 = 'Warranty';
$type10 = 'Contract';
$type11 = 'Warranty-Expired';
$type12 = 'Contract-Expired';
$type13 = "Order";
$type14 = "ServiceReport";
$type15 = "SRIncluded";
$type16 = "Notes";
$type17 = "Visual";
$HistoryType_1 = 'Bootloader';
$HistoryType_2 = 'Firmware';
$HistoryType_3 = 'SerialNumber';
$HistoryType_4 = 'Visual_Test';
$HistoryType_5 = 'Maintenance_Test';
$HistoryType_6 = 'Assembly_Test';
$HistoryType_7 = 'ProductNumber';
$HistoryType_8 = 'Visual';
$HistoryType_9 = 'ServiceReport';
//------------------------------------------
//Permissions CRUD
//------------------------------------------
$permission_4 = 'CRUD'; //Admin+
$permission_3 = 'CRUD'; //Admin
$permission_2 = 'CRU'; //SuperUser
$permission_1 = 'CRU'; //CreateUpdate
$permission_0 = 'R'; //Readonly
$permissionlabel1 = 'Permission';
$permission1 = 'Superuser'; #1
$permission2 = 'Create & Update'; #2
$permission3 = 'read-only'; // #3
$permission4 = 'Admin'; //#4
$permission5 = 'Admin+'; // #5
$settingslabel1 = 'profile';
$setting1 = 'firmware'; //Fix
$setting2 = 'service';
$setting3 = 'build'; //Fix
$setting4 = 'distribution';
$setting5 = '';
$setting6 = '';
$setting7 = ''; //Fix
$setting8 = 'interface';
//------------------------------------------
//Partners
//------------------------------------------
$partnertype1 = 'SalesID';
$partnertype2 = 'SoldTo';
$partnertype3 = 'ShipTo';
$partnertype4 = 'Location';
$partnertype5 = 'Section';

View File

@@ -1,31 +1,11 @@
<?php
//=========================================
//REDIRECTOR TO CONFIG FILE BASED ON DOMAIN
//=========================================
function getDomain($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;
}
}
//======================================================================
//REDIRECTOR TO CONFIG FILE BASED ON .htacces - SetEnv APP_ENV development
//======================================================================
$env = getenv('APP_ENV') ?: 'development';
$domain = getDomain($_SERVER['SERVER_NAME']);
$config_location = ((file_exists(dirname(__FILE__,2).'/custom/'.$domain.'/settings/'.$domain.'_config.php')) ? dirname(__FILE__,2).'/custom/'.$domain.'/settings/'.$domain.'_config.php' : dirname(__FILE__).'/config.php');
$config_location = ((file_exists(dirname(__FILE__,2).'/custom/'.$env.'/settings/'.$env.'_config.php')) ? dirname(__FILE__,2).'/custom/'.$env.'/settings/'.$env.'_config.php' : dirname(__FILE__).'/'.$env.'_config.php');
include $config_location;
?>

View File

@@ -0,0 +1,83 @@
<?php
require 'settingsprofiles.php';
// This will change the title on the website
define('site_name','Customer Portal - TEST');
define('site_name_footer','Total Safety Solutions - TEST');
// This will change the title on browser TAB
define('site_title','Total Safety Solutions - TEST');
//Scriptversion
define('script_version','v3');
//Enable VeLiTi-issue mgt
define('veliti_cim',true);
//Enable VeLiTi-analytics
define('veliti_analytics',false);
//Rewrite rule
define('rewrite_url',true);
define('news','');
//maintenance_mode
define('maintenance_mode_communication',false);
define('maintenance_mode_notification','Notice: Portal not accessible due to maintenance on May 15th between 12.00 - 13.00 CET.');
define('maintenance_mode',false);
define('maintenance_mode_user','veliti_admin');
define('maintenance_mode_text','System in maintenance');
define('debug',true);
define('debug_id','114');
/*Business_Rules*/
//Business rules
define('WARRANTY_MONTHS','12');
define('WARRANTY_ELIGIBILITY_WINDOW','3');
define('WARRANTY_EXTENDED_MONTH','24');
define('SERVICE_MONTHS','12');
//Prevent downgrade from paid to free software versions
define('PREVENT_PAID_VERSION_DOWNGRADE',false);
/*Security*/
// Page security
define('page_security_key','secure_admin_342642');
define('cronjob_number','25');
define('header_security',false);
/* Email */
// The from email that will appear on the customer's order details email
define('mail_from','CustomerPortal');
// Your email
define('email','CustomerPortal@veliti.nl');
//Additional phpmailer-settings
define('email_host_name','veliti.nl');
define('email_reply_to','info@gewoonlekkerspaans.nl');
define('email_outgoing_pw','306yc%X5f');
define('email_outgoing_port','465');
define('email_outgoing_security','ssl');
// Enable automatice invoice forward to bookkeeping software
define('invoice_bookkeeping',false);
// Email of bookkeeping software
define('email_bookkeeping','');
/* Payment options */
// Mollie
define('mollie_enabled',true);
define('mollie_api_key','test_jFHqrt9KCSvaBwb4En9ttAM9MTrp9W'); //live_WhsBD8qv3ygR9WVKF3KnCvz9zzNaxh
// PayPal
define('paypal_enabled',true);
define('PAYPAL_URL','https://api-m.sandbox.paypal.com');
define('PAYPAL_WEBHOOK_ID','3UU05694H1382772B');
define('PAYPAL_WEBHOOK','https://acc.veliti.nl/webhook_paypal.php');
define('PAYPAL_CLIENT_ID','AYI8iqzBSD2rNrPStfC0xd3jNR3WzwrSIbPw7qgrEs_sOIvORJMZp3j2QjG7SOCOyI5OQ1s42IcZAJI-');
define('PAYPAL_CLIENT_SECRET','EEwnnw8adeHicjXSCv9abiQG6_0rCTqDWQAqn3TyMMyz7FURZChL3_ywlHF4BTwqUQtJZsQ4Q_WSwB9R');
define('pay_on_delivery_enabled',false);
/*Appearance*/
//Icon
define('icon_image','/assets/images/TSS-logo3.png');
define('color','#005655c2');
define('color_accent','#2FAC66');
define('emaillogo','/assets/images/TSSemail.png');
/*Default Users*/
define('software_update_user','EMP-updater');
define('software_update_pw','EMP-updater');
define('interface_user','interface@test.nl');
define('interface_pw','test1234');

View File

@@ -0,0 +1,112 @@
<?php
//------------------------------------------
//EXCEPTION LIST
//------------------------------------------
$serialnumber_exceptions = array("22050695","22110095");
//------------------------------------------
// Security
//------------------------------------------
$security_key = 'secure_34563$52';
//------------------------------------------
// Base color
//------------------------------------------
$color = '#005655';//'#0b1054';
$color_accent = '#2FAC66'; //'#ececec';
//------------------------------------------
// Database settings
//------------------------------------------
require '/var/www/vhosts/veliti.nl/settings/portalsettings-acc.php';
//------------------------------------------
// Menusetup & settings
//------------------------------------------
require 'settingsmenu.php';
//------------------------------------------
// API BaseUrl
//------------------------------------------
$baseurl = 'https://'.$_SERVER['SERVER_NAME'].'/api.php'; //URL of API
$portalURL = $_SERVER['SERVER_NAME'];
//------------------------------------------
// Equipmentdetails
//------------------------------------------
$servicedate = date("Y-m-d", strtotime("-365 days"));
$warrantydate = date("Y-m-d", strtotime("-365 days"));
$warranty_extended = date("Y-m-d", strtotime("+365 days"));
$date = date('Y-m-d H:i:s');
$curYear = date("Y", time());
$curMonth = date("m", time());
$curQuarter = (int)ceil($curMonth / 3);
$curdateObj = DateTime::createFromFormat('!m', $curMonth);
$curMonth_name = $curdateObj->format('F');
//------------------------------------------
//History Type
//------------------------------------------
$type1 = 'General';
$type2 = 'Customer';
$type3 = 'Service';
$type4 = 'Testing';
$type5 = 'Data';
$type6 = 'Other';
$type7 = 'Internal';
$type8 = 'Ignore';
$type9 = 'Warranty';
$type10 = 'Contract';
$type11 = 'Warranty-Expired';
$type12 = 'Contract-Expired';
$type13 = "Order";
$type14 = "ServiceReport";
$type15 = "SRIncluded";
$type16 = "Notes";
$type17 = "Visual";
$HistoryType_1 = 'Bootloader';
$HistoryType_2 = 'Firmware';
$HistoryType_3 = 'SerialNumber';
$HistoryType_4 = 'Visual_Test';
$HistoryType_5 = 'Maintenance_Test';
$HistoryType_6 = 'Assembly_Test';
$HistoryType_7 = 'ProductNumber';
$HistoryType_8 = 'Visual';
$HistoryType_9 = 'ServiceReport';
//------------------------------------------
//Permissions CRUD
//------------------------------------------
$permission_4 = 'CRUD'; //Admin+
$permission_3 = 'CRUD'; //Admin
$permission_2 = 'CRU'; //SuperUser
$permission_1 = 'CRU'; //CreateUpdate
$permission_0 = 'R'; //Readonly
$permissionlabel1 = 'Permission';
$permission1 = 'Superuser'; #1
$permission2 = 'Create & Update'; #2
$permission3 = 'read-only'; // #3
$permission4 = 'Admin'; //#4
$permission5 = 'Admin+'; // #5
$settingslabel1 = 'profile';
$setting1 = 'firmware'; //Fix
$setting2 = 'service';
$setting3 = 'build'; //Fix
$setting4 = 'distribution';
$setting5 = '';
$setting6 = '';
$setting7 = ''; //Fix
$setting8 = 'interface';
//------------------------------------------
//Partners
//------------------------------------------
$partnertype1 = 'SalesID';
$partnertype2 = 'SoldTo';
$partnertype3 = 'ShipTo';
$partnertype4 = 'Location';
$partnertype5 = 'Section';

View File

@@ -0,0 +1,56 @@
<?php
require 'settingsprofiles.php';
// This will change the title on the website
define('site_name','Customer Portal');
define('site_name_footer','Total Safety Solutions');
// This will change the title on browser TAB
define('site_title','Total Safety Solutions');
//Scriptversion
define('script_version','v12');
//Enable VeLiTi-issue mgt
define('veliti_cim',false);
//Enable VeLiTi-analytics
define('veliti_analytics',true);
//Rewrite rule
define('rewrite_url',false);
define('news','');
//maintenance_mode
define('maintenance_mode_communication',false);
define('maintenance_mode_notification','Notice: The Portal is offline due to infrastructure services issues');
define('maintenance_mode',false);
define('maintenance_mode_text','Portal not accessible due to infrastructure services issues.');
define('debug',false);
define('debug_id','114');
/*Security*/
// Page security
define('page_security_key','secure_admin_342642');
define('cronjob_number','43256');
define('header_security',false);
/* Email */
// The from email that will appear on the customer's order details email
define('mail_from','CustomerPortal');
// Your email
define('email','portal@totalsafetysolutions.nl');
//Additional phpmailer-settings
define('email_host_name','');
define('email_reply_to','service@totalsafetysolutions.nl');
define('email_outgoing_pw','test1234');
define('email_outgoing_port','587');
define('email_outgoing_security','tls');
/*Appearance*/
//Icon
define('icon_image','/assets/images/TSS-logo3.png');
define('color','#005655c2');
define('color_accent','#2FAC66');
define('emaillogo','/assets/images/tss-green.png');
/*Default Users*/
define('software_update_user','EMP-updater');
define('software_update_pw','EMP-updater');
define('interface_user','interface@test.nl');
define('interface_pw','test1234');

View File

@@ -0,0 +1,112 @@
<?php
//------------------------------------------
//EXCEPTION LIST
//------------------------------------------
$serialnumber_exceptions = array("22050253","22050821","22050799","22050813","22050203","22050810","22050803","22050834","22050811","22050817","22050849","22050820","22050819","22050897","22050924","22050905","22050906","22050670","22050762","22050947","22050948","22050120","22050863","22050571","22050213","22051233","22051226");
//------------------------------------------
// Security
//------------------------------------------
$security_key = 'secure_34563$52';
//------------------------------------------
// Base color
//------------------------------------------
$color = '#005655';//'#0b1054';
$color_accent = '#2FAC66'; //'#ececec';
//------------------------------------------
// Database settings
//------------------------------------------
require '/var/www/vhosts/veliti.nl/settings/portalsettings-prod.php';
//------------------------------------------
// Menusetup & settings
//------------------------------------------
require 'settingsmenu.php';
//------------------------------------------
// API BaseUrl
//------------------------------------------
$baseurl = 'https://'.$_SERVER['SERVER_NAME'].'/api.php'; //URL of API
$portalURL = $_SERVER['SERVER_NAME'];
//------------------------------------------
// Equipmentdetails
//------------------------------------------
$servicedate = date("Y-m-d", strtotime("-365 days"));
$warrantydate = date("Y-m-d", strtotime("-365 days"));
$warranty_extended = date("Y-m-d", strtotime("+365 days"));
$date = date('Y-m-d H:i:s');
$curYear = date("Y", time());
$curMonth = date("m", time());
$curQuarter = (int)ceil($curMonth / 3);
$curdateObj = DateTime::createFromFormat('!m', $curMonth);
$curMonth_name = $curdateObj->format('F');
//------------------------------------------
//History Type
//------------------------------------------
$type1 = 'General';
$type2 = 'Customer';
$type3 = 'Service';
$type4 = 'Testing';
$type5 = 'Data';
$type6 = 'Other';
$type7 = 'Internal';
$type8 = 'Ignore';
$type9 = 'Warranty';
$type10 = 'Contract';
$type11 = 'Warranty-Expired';
$type12 = 'Contract-Expired';
$type13 = "Order";
$type14 = "ServiceReport";
$type15 = "SRIncluded";
$type16 = "Notes";
$type17 = "Visual";
$HistoryType_1 = 'Bootloader';
$HistoryType_2 = 'Firmware';
$HistoryType_3 = 'SerialNumber';
$HistoryType_4 = 'Visual_Test';
$HistoryType_5 = 'Maintenance_Test';
$HistoryType_6 = 'Assembly_Test';
$HistoryType_7 = 'ProductNumber';
$HistoryType_8 = 'Visual';
$HistoryType_9 = 'ServiceReport';
//------------------------------------------
//Permissions CRUD
//------------------------------------------
$permission_4 = 'CRUD'; //Admin+
$permission_3 = 'CRU'; //Admin
$permission_2 = 'CRU'; //SuperUser
$permission_1 = 'CRU'; //CreateUpdate
$permission_0 = 'R'; //Readonly
$permissionlabel1 = 'Permission';
$permission1 = 'Superuser'; #1
$permission2 = 'Create & Update'; #2
$permission3 = 'read-only'; // #3
$permission4 = 'Admin'; //#4
$permission5 = 'Admin+'; // #5
$settingslabel1 = 'profile';
$setting1 = 'firmware'; //Fix
$setting2 = 'service';
$setting3 = 'build'; //Fix
$setting4 = 'distribution';
$setting5 = '';
$setting6 = '';
$setting7 = ''; //Fix
$setting8 = 'interface';
//------------------------------------------
//Partners
//------------------------------------------
$partnertype1 = 'SalesID';
$partnertype2 = 'SoldTo';
$partnertype3 = 'ShipTo';
$partnertype4 = 'Location';
$partnertype5 = 'Section';

View File

@@ -1,27 +1,12 @@
<?php
//=========================================
//REDIRECTOR TO CONFIG FILE BASED ON DOMAIN
//=========================================
$parts = explode('.', $_SERVER['SERVER_NAME']);
$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
$domain = $parts[$count - 2];
}
// For hostnames with just domain and TLD (2 parts)
else if ($count == 2) {
// Return just the domain part (without the TLD)
$domain = $parts[0];
}
// If it's a single part hostname
else {
$domain = $hostname;
}
//======================================================================
//REDIRECTOR TO settings FILE BASED ON .htacces - SetEnv APP_ENV development
//======================================================================
$env = getenv('APP_ENV') ?: 'development';
$settings_location = ((file_exists(dirname(__FILE__,2).'/custom/'.$env.'/settings/'.$env.'_settings.php')) ? dirname(__FILE__,2).'/custom/'.$env.'/settings/'.$env.'_settings.php' : dirname(__FILE__).'/'.$env.'_settings.php');
$settings_location = ((file_exists(dirname(__FILE__,2).'/custom/'.$domain.'/settings/'.$domain.'_settings.php')) ? dirname(__FILE__,2).'/custom/'.$domain.'/settings/'.$domain.'_settings.php' : dirname(__FILE__).'/settings.php');
include $settings_location;
?>