Initial rewiring

This commit is contained in:
“VeLiTi”
2025-01-30 13:43:02 +01:00
parent 6f1cc27ec4
commit 390a6e9f4f
14 changed files with 38 additions and 38 deletions

View File

@@ -3,15 +3,15 @@ defined('admin') or exit;
// Capture post data
if (isset($_POST['language_US'], $_POST['language_NL'])) {
// Save templates
file_put_contents('../custom/translations_US.php', $_POST['language_US']);
file_put_contents('../custom/translations_NL.php', $_POST['language_NL']);
file_put_contents('../custom/translations/translations_US.php', $_POST['language_US']);
file_put_contents('../custom/translations/translations_NL.php', $_POST['language_NL']);
header('Location: index.php?page=language&success_msg=1');
exit;
}
// Read language_US template PHP file
$contents = file_get_contents('../custom/translations_US.php');
$contents = file_get_contents('../custom/translations/translations_US.php');
// Read language template PHP file
$contents2 = file_get_contents('../custom/translations_NL.php');
$contents2 = file_get_contents('../custom/translations/translations_NL.php');
// Handle success messages
if (isset($_GET['success_msg'])) {
if ($_GET['success_msg'] == 1) {

View File

@@ -17,7 +17,7 @@ function get_countries() {
// Template Header default including MENU
function template_header($title, $head = '') {
include 'translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
// Get the amount of items in the shopping cart, this will be displayed in the header.
$num_items_in_cart = isset($_SESSION['cart']) ? array_sum(array_column($_SESSION['cart'], 'quantity')) : 0;
@@ -62,8 +62,8 @@ if (veliti_analytics){
<meta name="viewport" content="width=device-width,minimum-scale=1">
<title>$site_title - $title</title>
<link rel="icon" type="image/png" href="{$base_url}$icon_image">
<link href="{$base_url}style.css" rel="stylesheet" type="text/css">
<link href="{$base_url}custom.css" rel="stylesheet" type="text/css">
<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">
$veliti_analytics
$head
@@ -110,7 +110,7 @@ if (veliti_analytics){
// Template Header (related to MENU function)
function template_header_top($title, $head = '') {
include 'translations_'.strtoupper(language_code).'.php';
include './custom/translations/'.strtoupper(language_code).'.php';
// Get the amount of items in the shopping cart, this will be displayed in the header.
$num_items_in_cart = isset($_SESSION['cart']) ? array_sum(array_column($_SESSION['cart'], 'quantity')) : 0;
$home_link = url('index.php');
@@ -156,8 +156,8 @@ function template_header_top($title, $head = '') {
<meta name="viewport" content="width=device-width,minimum-scale=1">
<title>$site_title - $title</title>
<link rel="icon" type="image/png" href="{$base_url}$icon_image">
<link href="{$base_url}style.css" rel="stylesheet" type="text/css">
<link href="{$base_url}custom.css" rel="stylesheet" type="text/css">
<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">
$veliti_analytics
$head
@@ -171,7 +171,7 @@ function template_header_top($title, $head = '') {
}
// Template Menu
function template_menu(){
include 'translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
// Get the amount of items in the shopping cart, this will be displayed in the header.
$num_items_in_cart = isset($_SESSION['cart']) ? array_sum(array_column($_SESSION['cart'], 'quantity')) : 0;
$home_link = url('index.php');
@@ -225,7 +225,7 @@ function template_menu(){
// Template footer
function template_footer() {
include 'translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
$base_url = base_url;
$rewrite_url = rewrite_url ? 'true' : 'false';
$year = date('Y');
@@ -291,7 +291,7 @@ function template_footer() {
//++++++++++++++++++++++++++++++++++++++++++++++++++++
//Template header order email
function template_order_email_header() {
include 'translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
$home_link = url('index.php');
$myaccount_link = url('index.php?page=myaccount');
@@ -501,7 +501,7 @@ EOT;
}
// Template order footer
function template_order_email_footer() {
include 'translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
$home_link = url('index.php');
$products_link = url(link_to_collection);
$about_link = url('index.php?page=about');

View File

@@ -1,7 +1,7 @@
<?php defined(security_key) or exit; ?>
<?=template_order_email_header()?>
<?php include 'translations_'.strtoupper(language_code).'.php';?>
<?php include './custom/translations/translations_'.strtoupper(language_code).'.php';?>
</tr>
<tr><td><br></td></tr>
<tr>

View File

@@ -3,7 +3,7 @@
//(defined(security_key) or defined('admin')) or exit; ?>
<?=template_order_email_header()?>
<?php include 'translations_'.strtoupper(language_code).'.php';?>
<?php include './custom/translations/translations_'.strtoupper(language_code).'.php';?>
</tr>
<tr><td><br></td></tr>

View File

@@ -1,7 +1,7 @@
<?php defined(security_key) or exit; ?>
<?=template_order_email_header()?>
<?php include 'translations_'.strtoupper(language_code).'.php';?>
<?php include './custom/translations/translations_'.strtoupper(language_code).'.php';?>
</tr>
<tr><td><br></td></tr>

View File

@@ -16,7 +16,7 @@ define('age_verification_enabled',false);
//Enable VeLiTi-analytics
define('veliti_analytics',false);
// Default logtraffic
define('log_usage',true);
define('log_usage',false);
/* Banners */
// Show offer at home page
define('show_offer_home_page',true);
@@ -155,7 +155,7 @@ define('db_user','morvalwatches');//morvalwatches_prod
// Database password
define('db_pass','4~gv71bM6');
// Database name
define('db_name','advanced_shoppingcart'); //morvalwatches
define('db_name','shoppingcart_advanced'); //morvalwatches
/* Payment options */
//Pay on Delivery

View File

@@ -134,7 +134,7 @@ function populate_categories($categories, $selected = 0, $parent_id = 0, $n = 0)
// Send order details email function
function send_order_details_email($email, $products, $first_name, $last_name, $address_street, $address_city, $address_state, $address_zip, $address_country, $subtotal, $discounttotal,$shippingtotal,$taxtotal,$total, $order_id) {
include './custom/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
// Send payment notification to webmaster
$address_name = htmlspecialchars($first_name ?? '', ENT_QUOTES).' '.htmlspecialchars($last_name ?? '', ENT_QUOTES);
if (email_notifications) {
@@ -159,7 +159,7 @@ function send_order_details_email($email, $products, $first_name, $last_name, $a
//Send email to administrator for out of stock notification // only for registered users
function send_product_notification_email($email,$product_details){
include './custom/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
$subject = $subject_out_of_stock.' - '.$product_details;
$headers = 'From: ' . mail_from . "\r\n" . 'Reply-To: ' . $email . "\r\n" . 'Return-Path: ' . mail_from . "\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: text/html; charset=UTF-8' . "\r\n";
@@ -315,7 +315,7 @@ function format_bytes($bytes) {
function getAccessoiries($pdo, $categoryID){
include './custom/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
$stmt = $pdo->prepare('SELECT p.*, (SELECT m.full_path FROM products_media pm JOIN media m ON m.id = pm.media_id WHERE pm.product_id = p.id ORDER BY pm.position ASC LIMIT 1) AS img FROM products p JOIN products_categories pc ON pc.category_id = :category_id AND pc.product_id = p.id JOIN categories c ON c.id = pc.category_id WHERE p.status = 1');
$stmt->bindValue(':category_id', $categoryID, PDO::PARAM_INT);
@@ -364,7 +364,7 @@ function getAccessoiries($pdo, $categoryID){
function getSamples($pdo, $categoryID){
include './custom/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
$stmt = $pdo->prepare('SELECT p.*, (SELECT m.full_path FROM products_media pm JOIN media m ON m.id = pm.media_id WHERE pm.product_id = p.id ORDER BY pm.position ASC LIMIT 1) AS img FROM products p JOIN products_categories pc ON pc.category_id = :category_id AND pc.product_id = p.id JOIN categories c ON c.id = pc.category_id WHERE p.status = 1');
$stmt->bindValue(':category_id', $categoryID, PDO::PARAM_INT);
@@ -550,7 +550,7 @@ function generateInvoice($pdo, $orderID){
function freeShipment($price, $type){
include './custom/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
//Free delivery indicator
$delivery_status = ($price >= free_shipment_price) ? $free_delivery : $non_free_delivery.currency_code.free_shipment_price.',-';
@@ -564,7 +564,7 @@ function freeShipment($price, $type){
function consent()
{
include './custom/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
$age_consent = '
<div id="simple-cookie-consent">
@@ -590,7 +590,7 @@ function consent()
function banner()
{
include './custom/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
$banner = '
<div id="banner">
@@ -615,7 +615,7 @@ function consent()
function maintenanceMode()
{
include './custom/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
$maintenanceMode = '
<div id="simple-cookie-consent">
@@ -661,7 +661,7 @@ function getPictureID($pdo,$id,$config){
//++++++++++++++++++++++++++++++++++++++++
function highlightedProducts($pdo,$categoryID,$range){
include './custom/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations_'.strtoupper(language_code).'.php';
$stmt = $pdo->prepare('SELECT p.*, (SELECT m.full_path FROM products_media pm JOIN media m ON m.id = pm.media_id WHERE pm.product_id = p.id ORDER BY pm.position ASC LIMIT 1) AS img FROM products p JOIN products_categories pc ON pc.category_id = :category_id AND pc.product_id = p.id JOIN categories c ON c.id = pc.category_id WHERE p.status = 1');
$stmt->bindValue(':category_id', $categoryID, PDO::PARAM_INT);

View File

@@ -12,11 +12,11 @@ define('base_url', rtrim($base_url, '/') . '/');
// Initialize a new session
session_start();
// Include the configuration file, this contains settings you can change.
include 'config.php';
include './custom/settings/config.php';
// Include functions and connect to the database using PDO MySQL
include 'functions.php';
// Include translation file
include './custom/translations_'.strtoupper(language_code).'.php';
include './custom/translations/translations/translations_'.strtoupper(language_code).'.php';
// Connect to MySQL database
$pdo = pdo_connect_mysql();
// Output error variable
@@ -42,8 +42,8 @@ if (isset($_POST['banner_move'])){
// Define all the routes for all pages
$url = routes([
'/' => 'home.php',
'/about' => 'about.php',
'/about_morval' => 'about_morval.php',
'/about' => '/custom/pages/about.php',
'/about_morval' => '/custom/pages/about_morval.php',
'/product/{id}' => 'product.php',
'/product/{id}/{option_id}' => 'product.php',
'/products' => 'products.php',
@@ -60,12 +60,12 @@ $url = routes([
'/placeorder/{order_id}' => 'placeorder.php',
'/search/{query}' => 'search.php',
'/logout' => 'logout.php',
'/termsandconditions'=> 'termsandconditions.php',
'/termsandconditions/{download}'=> 'termsandconditions.php',
'/faq'=> 'faq.php',
'/privacy'=> 'privacy.php',
'/privacy/{download}'=> 'privacy.php',
'instructions-for-use' => 'faq.php'
'/termsandconditions'=> '/custom/pages/termsandconditions.php',
'/termsandconditions/{download}'=> '/custom/pages/termsandconditions.php',
'/faq'=> '/custom/pages/faq.php',
'/privacy'=> '/custom/pages/privacy.php',
'/privacy/{download}'=> '/custom/pages/privacy.php',
'/instructions-for-use' => '/custom/pages/faq.php'
]);
// Check if route exists
if ($url) {