CMXX - First testing

This commit is contained in:
“VeLiTi”
2025-03-07 15:07:15 +01:00
parent 5dd2973a26
commit cd0e04981c
81 changed files with 697 additions and 325 deletions

View File

@@ -35,7 +35,7 @@ function template_header($title, $head = '') {
$default_country = isset($_SESSION['country_code']) ? strtolower($_SESSION['country_code']) : language_code;
//build up settings
$admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 'Admin' ? '<a href="' . base_url . 'admin/index.php" title="Settings" target="_blank"><i class="fa-solid fa-sliders"></i></a> ': '';
$admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 1 ? '<a href="' . base_url . 'admin/index.php" title="Settings" target="_blank"><i class="fa-solid fa-sliders"></i></a> ': '';
//check for age_consent
if (age_verification_enabled){
@@ -69,10 +69,113 @@ if (veliti_analytics){
<link href="{$base_url}custom/css/style.css" rel="stylesheet" type="text/css">
<link href="{$base_url}custom/css/custom.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.0.0/css/all.css">
<script>
// Wait for DOM to be ready before accessing elements
document.addEventListener('DOMContentLoaded', function() {
// Get loading screen element
const loadingScreen = document.getElementById('loadingScreen');
// Only proceed if the element exists
if (!loadingScreen) {
console.error('Loading screen element not found!');
return;
}
// Show loading screen
function showLoading() {
loadingScreen.classList.add('active');
}
// Hide loading screen
function hideLoading() {
loadingScreen.classList.remove('active');
}
// Show loading when page initially loads
showLoading();
// Hide loading when everything is loaded
window.addEventListener('load', hideLoading);
// In case the page loads very quickly
setTimeout(hideLoading, 500);
// Intercept form submissions
setupFormInterception();
// Intercept fetch and XMLHttpRequest
interceptNetworkRequests();
// Intercept all form submissions
function setupFormInterception() {
const forms = document.querySelectorAll('form');
forms.forEach(form => {
form.addEventListener('submit', function(e) {
// Show loading screen before form submission
showLoading();
});
});
}
// Intercept all network requests (fetch and XMLHttpRequest)
function interceptNetworkRequests() {
// Track active requests
let activeRequests = 0;
// Intercept fetch API
const originalFetch = window.fetch;
window.fetch = function() {
showLoading();
activeRequests++;
return originalFetch.apply(this, arguments)
.then(response => {
activeRequests--;
if (activeRequests === 0) hideLoading();
return response;
})
.catch(error => {
activeRequests--;
if (activeRequests === 0) hideLoading();
throw error;
});
};
// Intercept XMLHttpRequest
const originalXHROpen = XMLHttpRequest.prototype.open;
const originalXHRSend = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.open = function() {
return originalXHROpen.apply(this, arguments);
};
XMLHttpRequest.prototype.send = function() {
showLoading();
activeRequests++;
this.addEventListener('loadend', function() {
activeRequests--;
if (activeRequests === 0) hideLoading();
});
return originalXHRSend.apply(this, arguments);
};
}
});
</script>
$veliti_analytics
$head
</head>
<body $style>
<!-- Loading Bar -->
<div class="loading-container" id="loadingScreen">
<div class="loading-bar">
<div class="progress"></div>
</div>
<div class="loading-text">Loading, please wait...</div>
</div>
<header>
<div class="content-wrapper">
<h1>
@@ -145,7 +248,7 @@ function template_header_top($title, $head = '') {
$about_link = url('index.php?page=about');
$myaccount_link = url('index.php?page=myaccount');
$cart_link = url('index.php?page=cart');
$admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 'Admin' ? '<a href="' . base_url . 'admin/index.php" target="_blank">Admin</a>' : '';
$admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 1 ? '<a href="' . base_url . 'admin/index.php" target="_blank">Admin</a>' : '';
$logout_link = isset($_SESSION['account_loggedin']) ? '<a title="Logout" href="' . url('index.php?page=logout') . '"><i class="fas fa-sign-out-alt"></i></a>' : '';
$site_name = site_name;
$site_title = site_title;
@@ -186,10 +289,113 @@ function template_header_top($title, $head = '') {
<link href="{$base_url}custom/css/style.css" rel="stylesheet" type="text/css">
<link href="{$base_url}custom/css/custom.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.0.0/css/all.css">
<script>
// Wait for DOM to be ready before accessing elements
document.addEventListener('DOMContentLoaded', function() {
// Get loading screen element
const loadingScreen = document.getElementById('loadingScreen');
// Only proceed if the element exists
if (!loadingScreen) {
console.error('Loading screen element not found!');
return;
}
// Show loading screen
function showLoading() {
loadingScreen.classList.add('active');
}
// Hide loading screen
function hideLoading() {
loadingScreen.classList.remove('active');
}
// Show loading when page initially loads
showLoading();
// Hide loading when everything is loaded
window.addEventListener('load', hideLoading);
// In case the page loads very quickly
setTimeout(hideLoading, 500);
// Intercept form submissions
setupFormInterception();
// Intercept fetch and XMLHttpRequest
interceptNetworkRequests();
// Intercept all form submissions
function setupFormInterception() {
const forms = document.querySelectorAll('form');
forms.forEach(form => {
form.addEventListener('submit', function(e) {
// Show loading screen before form submission
showLoading();
});
});
}
// Intercept all network requests (fetch and XMLHttpRequest)
function interceptNetworkRequests() {
// Track active requests
let activeRequests = 0;
// Intercept fetch API
const originalFetch = window.fetch;
window.fetch = function() {
showLoading();
activeRequests++;
return originalFetch.apply(this, arguments)
.then(response => {
activeRequests--;
if (activeRequests === 0) hideLoading();
return response;
})
.catch(error => {
activeRequests--;
if (activeRequests === 0) hideLoading();
throw error;
});
};
// Intercept XMLHttpRequest
const originalXHROpen = XMLHttpRequest.prototype.open;
const originalXHRSend = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.open = function() {
return originalXHROpen.apply(this, arguments);
};
XMLHttpRequest.prototype.send = function() {
showLoading();
activeRequests++;
this.addEventListener('loadend', function() {
activeRequests--;
if (activeRequests === 0) hideLoading();
});
return originalXHRSend.apply(this, arguments);
};
}
});
</script>
$veliti_analytics
$head
</head>
<body>
<!-- Loading Bar -->
<div class="loading-container" id="loadingScreen">
<div class="loading-bar">
<div class="progress"></div>
</div>
<div class="loading-text">Loading, please wait...</div>
</div>
<main>
$banner
$age_consent
@@ -215,7 +421,7 @@ function template_menu(){
$default_country = isset($_SESSION['country_code']) ? strtolower($_SESSION['country_code']) : language_code;
//build up settings
$admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 'Admin' ? '<a href="' . base_url . 'admin/index.php" title="Settings" target="_blank"><i class="fa-solid fa-sliders"></i></a> ': '';
$admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 1 ? '<a href="' . base_url . 'admin/index.php" title="Settings" target="_blank"><i class="fa-solid fa-sliders"></i></a> ': '';
// DO NOT INDENT THE BELOW CODE
@@ -346,8 +552,11 @@ function template_footer() {
// Order email
//++++++++++++++++++++++++++++++++++++++++++++++++++++
//Template header order email
function template_order_email_header() {
include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php';
function template_order_email_header($user_language) {
$user_language = ((isset($_SESSION['country_code']))? $_SESSION['country_code'] :$user_language);
include './custom/translations/translations_'.strtoupper($user_language).'.php';
$home_link = url('index.php');
$myaccount_link = url('index.php?page=myaccount');