Initial rewiring
This commit is contained in:
@@ -3,15 +3,15 @@ defined('admin') or exit;
|
|||||||
// Capture post data
|
// Capture post data
|
||||||
if (isset($_POST['language_US'], $_POST['language_NL'])) {
|
if (isset($_POST['language_US'], $_POST['language_NL'])) {
|
||||||
// Save templates
|
// Save templates
|
||||||
file_put_contents('../custom/translations_US.php', $_POST['language_US']);
|
file_put_contents('../custom/translations/translations_US.php', $_POST['language_US']);
|
||||||
file_put_contents('../custom/translations_NL.php', $_POST['language_NL']);
|
file_put_contents('../custom/translations/translations_NL.php', $_POST['language_NL']);
|
||||||
header('Location: index.php?page=language&success_msg=1');
|
header('Location: index.php?page=language&success_msg=1');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// Read language_US template PHP file
|
// 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
|
// 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
|
// Handle success messages
|
||||||
if (isset($_GET['success_msg'])) {
|
if (isset($_GET['success_msg'])) {
|
||||||
if ($_GET['success_msg'] == 1) {
|
if ($_GET['success_msg'] == 1) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function get_countries() {
|
|||||||
// Template Header default including MENU
|
// Template Header default including MENU
|
||||||
function template_header($title, $head = '') {
|
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.
|
// 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;
|
$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">
|
<meta name="viewport" content="width=device-width,minimum-scale=1">
|
||||||
<title>$site_title - $title</title>
|
<title>$site_title - $title</title>
|
||||||
<link rel="icon" type="image/png" href="{$base_url}$icon_image">
|
<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/style.css" rel="stylesheet" type="text/css">
|
||||||
<link href="{$base_url}custom.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">
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.0.0/css/all.css">
|
||||||
$veliti_analytics
|
$veliti_analytics
|
||||||
$head
|
$head
|
||||||
@@ -110,7 +110,7 @@ if (veliti_analytics){
|
|||||||
// Template Header (related to MENU function)
|
// Template Header (related to MENU function)
|
||||||
function template_header_top($title, $head = '') {
|
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.
|
// 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;
|
$num_items_in_cart = isset($_SESSION['cart']) ? array_sum(array_column($_SESSION['cart'], 'quantity')) : 0;
|
||||||
$home_link = url('index.php');
|
$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">
|
<meta name="viewport" content="width=device-width,minimum-scale=1">
|
||||||
<title>$site_title - $title</title>
|
<title>$site_title - $title</title>
|
||||||
<link rel="icon" type="image/png" href="{$base_url}$icon_image">
|
<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/style.css" rel="stylesheet" type="text/css">
|
||||||
<link href="{$base_url}custom.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">
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.0.0/css/all.css">
|
||||||
$veliti_analytics
|
$veliti_analytics
|
||||||
$head
|
$head
|
||||||
@@ -171,7 +171,7 @@ function template_header_top($title, $head = '') {
|
|||||||
}
|
}
|
||||||
// Template Menu
|
// Template Menu
|
||||||
function 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.
|
// 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;
|
$num_items_in_cart = isset($_SESSION['cart']) ? array_sum(array_column($_SESSION['cart'], 'quantity')) : 0;
|
||||||
$home_link = url('index.php');
|
$home_link = url('index.php');
|
||||||
@@ -225,7 +225,7 @@ function template_menu(){
|
|||||||
|
|
||||||
// Template footer
|
// Template footer
|
||||||
function template_footer() {
|
function template_footer() {
|
||||||
include 'translations_'.strtoupper(language_code).'.php';
|
include './custom/translations/translations_'.strtoupper(language_code).'.php';
|
||||||
$base_url = base_url;
|
$base_url = base_url;
|
||||||
$rewrite_url = rewrite_url ? 'true' : 'false';
|
$rewrite_url = rewrite_url ? 'true' : 'false';
|
||||||
$year = date('Y');
|
$year = date('Y');
|
||||||
@@ -291,7 +291,7 @@ function template_footer() {
|
|||||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
//Template header order email
|
//Template header order email
|
||||||
function template_order_email_header() {
|
function template_order_email_header() {
|
||||||
include 'translations_'.strtoupper(language_code).'.php';
|
include './custom/translations/translations_'.strtoupper(language_code).'.php';
|
||||||
|
|
||||||
$home_link = url('index.php');
|
$home_link = url('index.php');
|
||||||
$myaccount_link = url('index.php?page=myaccount');
|
$myaccount_link = url('index.php?page=myaccount');
|
||||||
@@ -501,7 +501,7 @@ EOT;
|
|||||||
}
|
}
|
||||||
// Template order footer
|
// Template order footer
|
||||||
function template_order_email_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');
|
$home_link = url('index.php');
|
||||||
$products_link = url(link_to_collection);
|
$products_link = url(link_to_collection);
|
||||||
$about_link = url('index.php?page=about');
|
$about_link = url('index.php?page=about');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php defined(security_key) or exit; ?>
|
<?php defined(security_key) or exit; ?>
|
||||||
|
|
||||||
<?=template_order_email_header()?>
|
<?=template_order_email_header()?>
|
||||||
<?php include 'translations_'.strtoupper(language_code).'.php';?>
|
<?php include './custom/translations/translations_'.strtoupper(language_code).'.php';?>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td><br></td></tr>
|
<tr><td><br></td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
//(defined(security_key) or defined('admin')) or exit; ?>
|
//(defined(security_key) or defined('admin')) or exit; ?>
|
||||||
|
|
||||||
<?=template_order_email_header()?>
|
<?=template_order_email_header()?>
|
||||||
<?php include 'translations_'.strtoupper(language_code).'.php';?>
|
<?php include './custom/translations/translations_'.strtoupper(language_code).'.php';?>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td><br></td></tr>
|
<tr><td><br></td></tr>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php defined(security_key) or exit; ?>
|
<?php defined(security_key) or exit; ?>
|
||||||
|
|
||||||
<?=template_order_email_header()?>
|
<?=template_order_email_header()?>
|
||||||
<?php include 'translations_'.strtoupper(language_code).'.php';?>
|
<?php include './custom/translations/translations_'.strtoupper(language_code).'.php';?>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td><br></td></tr>
|
<tr><td><br></td></tr>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ define('age_verification_enabled',false);
|
|||||||
//Enable VeLiTi-analytics
|
//Enable VeLiTi-analytics
|
||||||
define('veliti_analytics',false);
|
define('veliti_analytics',false);
|
||||||
// Default logtraffic
|
// Default logtraffic
|
||||||
define('log_usage',true);
|
define('log_usage',false);
|
||||||
/* Banners */
|
/* Banners */
|
||||||
// Show offer at home page
|
// Show offer at home page
|
||||||
define('show_offer_home_page',true);
|
define('show_offer_home_page',true);
|
||||||
@@ -155,7 +155,7 @@ define('db_user','morvalwatches');//morvalwatches_prod
|
|||||||
// Database password
|
// Database password
|
||||||
define('db_pass','4~gv71bM6');
|
define('db_pass','4~gv71bM6');
|
||||||
// Database name
|
// Database name
|
||||||
define('db_name','advanced_shoppingcart'); //morvalwatches
|
define('db_name','shoppingcart_advanced'); //morvalwatches
|
||||||
|
|
||||||
/* Payment options */
|
/* Payment options */
|
||||||
//Pay on Delivery
|
//Pay on Delivery
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ function populate_categories($categories, $selected = 0, $parent_id = 0, $n = 0)
|
|||||||
|
|
||||||
// Send order details email function
|
// 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) {
|
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
|
// Send payment notification to webmaster
|
||||||
$address_name = htmlspecialchars($first_name ?? '', ENT_QUOTES).' '.htmlspecialchars($last_name ?? '', ENT_QUOTES);
|
$address_name = htmlspecialchars($first_name ?? '', ENT_QUOTES).' '.htmlspecialchars($last_name ?? '', ENT_QUOTES);
|
||||||
if (email_notifications) {
|
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
|
//Send email to administrator for out of stock notification // only for registered users
|
||||||
function send_product_notification_email($email,$product_details){
|
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;
|
$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";
|
$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){
|
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 = $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);
|
$stmt->bindValue(':category_id', $categoryID, PDO::PARAM_INT);
|
||||||
@@ -364,7 +364,7 @@ function getAccessoiries($pdo, $categoryID){
|
|||||||
|
|
||||||
function getSamples($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 = $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);
|
$stmt->bindValue(':category_id', $categoryID, PDO::PARAM_INT);
|
||||||
@@ -550,7 +550,7 @@ function generateInvoice($pdo, $orderID){
|
|||||||
|
|
||||||
function freeShipment($price, $type){
|
function freeShipment($price, $type){
|
||||||
|
|
||||||
include './custom/translations_'.strtoupper(language_code).'.php';
|
include './custom/translations/translations_'.strtoupper(language_code).'.php';
|
||||||
|
|
||||||
//Free delivery indicator
|
//Free delivery indicator
|
||||||
$delivery_status = ($price >= free_shipment_price) ? $free_delivery : $non_free_delivery.currency_code.free_shipment_price.',-';
|
$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()
|
function consent()
|
||||||
{
|
{
|
||||||
include './custom/translations_'.strtoupper(language_code).'.php';
|
include './custom/translations/translations_'.strtoupper(language_code).'.php';
|
||||||
|
|
||||||
$age_consent = '
|
$age_consent = '
|
||||||
<div id="simple-cookie-consent">
|
<div id="simple-cookie-consent">
|
||||||
@@ -590,7 +590,7 @@ function consent()
|
|||||||
|
|
||||||
function banner()
|
function banner()
|
||||||
{
|
{
|
||||||
include './custom/translations_'.strtoupper(language_code).'.php';
|
include './custom/translations/translations_'.strtoupper(language_code).'.php';
|
||||||
|
|
||||||
$banner = '
|
$banner = '
|
||||||
<div id="banner">
|
<div id="banner">
|
||||||
@@ -615,7 +615,7 @@ function consent()
|
|||||||
|
|
||||||
function maintenanceMode()
|
function maintenanceMode()
|
||||||
{
|
{
|
||||||
include './custom/translations_'.strtoupper(language_code).'.php';
|
include './custom/translations/translations_'.strtoupper(language_code).'.php';
|
||||||
|
|
||||||
$maintenanceMode = '
|
$maintenanceMode = '
|
||||||
<div id="simple-cookie-consent">
|
<div id="simple-cookie-consent">
|
||||||
@@ -661,7 +661,7 @@ function getPictureID($pdo,$id,$config){
|
|||||||
//++++++++++++++++++++++++++++++++++++++++
|
//++++++++++++++++++++++++++++++++++++++++
|
||||||
function highlightedProducts($pdo,$categoryID,$range){
|
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 = $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);
|
$stmt->bindValue(':category_id', $categoryID, PDO::PARAM_INT);
|
||||||
|
|||||||
20
index.php
20
index.php
@@ -12,11 +12,11 @@ define('base_url', rtrim($base_url, '/') . '/');
|
|||||||
// Initialize a new session
|
// Initialize a new session
|
||||||
session_start();
|
session_start();
|
||||||
// Include the configuration file, this contains settings you can change.
|
// 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 and connect to the database using PDO MySQL
|
||||||
include 'functions.php';
|
include 'functions.php';
|
||||||
// Include translation file
|
// Include translation file
|
||||||
include './custom/translations_'.strtoupper(language_code).'.php';
|
include './custom/translations/translations/translations_'.strtoupper(language_code).'.php';
|
||||||
// Connect to MySQL database
|
// Connect to MySQL database
|
||||||
$pdo = pdo_connect_mysql();
|
$pdo = pdo_connect_mysql();
|
||||||
// Output error variable
|
// Output error variable
|
||||||
@@ -42,8 +42,8 @@ if (isset($_POST['banner_move'])){
|
|||||||
// Define all the routes for all pages
|
// Define all the routes for all pages
|
||||||
$url = routes([
|
$url = routes([
|
||||||
'/' => 'home.php',
|
'/' => 'home.php',
|
||||||
'/about' => 'about.php',
|
'/about' => '/custom/pages/about.php',
|
||||||
'/about_morval' => 'about_morval.php',
|
'/about_morval' => '/custom/pages/about_morval.php',
|
||||||
'/product/{id}' => 'product.php',
|
'/product/{id}' => 'product.php',
|
||||||
'/product/{id}/{option_id}' => 'product.php',
|
'/product/{id}/{option_id}' => 'product.php',
|
||||||
'/products' => 'products.php',
|
'/products' => 'products.php',
|
||||||
@@ -60,12 +60,12 @@ $url = routes([
|
|||||||
'/placeorder/{order_id}' => 'placeorder.php',
|
'/placeorder/{order_id}' => 'placeorder.php',
|
||||||
'/search/{query}' => 'search.php',
|
'/search/{query}' => 'search.php',
|
||||||
'/logout' => 'logout.php',
|
'/logout' => 'logout.php',
|
||||||
'/termsandconditions'=> 'termsandconditions.php',
|
'/termsandconditions'=> '/custom/pages/termsandconditions.php',
|
||||||
'/termsandconditions/{download}'=> 'termsandconditions.php',
|
'/termsandconditions/{download}'=> '/custom/pages/termsandconditions.php',
|
||||||
'/faq'=> 'faq.php',
|
'/faq'=> '/custom/pages/faq.php',
|
||||||
'/privacy'=> 'privacy.php',
|
'/privacy'=> '/custom/pages/privacy.php',
|
||||||
'/privacy/{download}'=> 'privacy.php',
|
'/privacy/{download}'=> '/custom/pages/privacy.php',
|
||||||
'instructions-for-use' => 'faq.php'
|
'/instructions-for-use' => '/custom/pages/faq.php'
|
||||||
]);
|
]);
|
||||||
// Check if route exists
|
// Check if route exists
|
||||||
if ($url) {
|
if ($url) {
|
||||||
|
|||||||
Reference in New Issue
Block a user