-
+ function generateFile($language_key,$token){
+ //GET TRANSLATION RECORDS
+ $api_url = '/v2/translations/generatefile='.$language_key;
+ $responses = ioAPIv2($api_url,'',$token);
+
+ if (!empty($responses)){
+ //define translation variable
+ $translation = '
-
-
-
-
-
-
-
+ //decode the API response
+ $responses = json_decode($responses,true);
+
+ //loop through translation records and create variables
+ foreach ($responses as $response){
+ $text = str_replace(
+ ['\\', "'", "\r", "\n", "\0", "\t"],
+ ['\\\\', "\\'", '\\r', '\\n', '\\0', '\\t'],
+ $response['translation']
+ );
+
+ //create variable_name = translation per item
+ $translation .= '$'.$response['variable'].' = \''.$text.'\';'.PHP_EOL;
+ }
+ //ADD closure tag for PHP
+ $translation .= '?>';
+ //Target dir
+ $target_dir = '../custom/translations/';
+ //Filename
+ $input_file = $target_dir.'translations_'.strtoupper($language_key).'.php';
+ //store translation to the file
+ file_put_contents($input_file, $translation);
+ }
+ }
+
+ if ($language_key != ''){
+ generateFile($language_key,$clientsecret);
+ } else {
+
+ foreach ($supportedLanguages as $language){
+ generateFile($language,$clientsecret);
+ }
+ }
+
+}
+
+
+template_admin_header('Language', 'language');
+
+$view .='
+
-
+$view .= '';
-=template_admin_footer()?>
\ No newline at end of file
+//Output
+echo $view;
+
+template_admin_footer();
\ No newline at end of file
diff --git a/admin/settings.php b/admin/settings.php
new file mode 100644
index 0000000..47ad9db
--- /dev/null
+++ b/admin/settings.php
@@ -0,0 +1,111 @@
+' . format_key($key) . '';
+ if ($type == 'checkbox') {
+ $html .= '
';
+ }
+ $html .= '
';
+ return $html;
+}
+// Format tabs
+function format_tabs($contents) {
+ $rows = explode("\n", $contents);
+ echo '
';
+ echo '
General';
+ for ($i = 0; $i < count($rows); $i++) {
+ preg_match('/\/\*(.*?)\*\//', $rows[$i], $match);
+ if ($match) {
+ echo '
' . $match[1] . '';
+ }
+ }
+ echo '
';
+}
+// Format form
+function format_form($contents) {
+ $rows = explode("\n", $contents);
+ echo '
';
+ for ($i = 0; $i < count($rows); $i++) {
+ preg_match('/\/\*(.*?)\*\//', $rows[$i], $match);
+ if ($match) {
+ echo '
';
+ }
+ preg_match('/define\(\'(.*?)\', ?(.*?)\)/', $rows[$i], $match);
+ if ($match) {
+ echo format_var_html($match[1], $match[2]);
+ }
+ }
+ echo '
';
+}
+if (!empty($_POST)) {
+ // Update the configuration file with the new keys and values
+ foreach ($_POST as $k => $v) {
+ $v = in_array(strtolower($v), ['true', 'false']) ? strtolower($v) : '\'' . $v . '\'';
+ $contents = preg_replace('/define\(\'' . $k . '\'\, ?(.*?)\)/s', 'define(\'' . $k . '\',' . $v . ')', $contents);
+ }
+ file_put_contents('../custom/settings/config.php', $contents);
+ header('Location: index.php?page=settings&success_msg=1');
+ exit;
+}
+// Handle success messages
+if (isset($_GET['success_msg'])) {
+ if ($_GET['success_msg'] == 1) {
+ $success_msg = 'Settings updated successfully!';
+ }
+}
+?>
+=template_admin_header('Settings', 'settings')?>
+
+
+
+
+
+=template_admin_footer()?>
\ No newline at end of file
diff --git a/custom/email/email_template_register.php b/custom/email/email_template_register.php
new file mode 100644
index 0000000..dfb8ee1
--- /dev/null
+++ b/custom/email/email_template_register.php
@@ -0,0 +1,102 @@
+
+
+
+
+
+
' . $subject . '
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ' . $newuser_header . ',
+
+
+ '.$newuser_text.' '.$newuser_credential_text_1.''.$post_content['username'].'
+
+
+ '.$newuser_credential_text_2.'
+ |
+
+
+
+
+ |
+
+
+ |
+
+
+
+ ' . $newuser_closure . '
+
+
+ Kind regards,
+
+
+ Service team
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+
+
+';
\ No newline at end of file
diff --git a/custom/email/email_template_reset.php b/custom/email/email_template_reset.php
new file mode 100644
index 0000000..d727c07
--- /dev/null
+++ b/custom/email/email_template_reset.php
@@ -0,0 +1,99 @@
+
+
+
+
+
+
' . $subject . '
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ' . $changeuser_header . ',
+
+
+ '.$changeuser_text.'
+
+
+ '.$changeuser_credential_text_1 .'
+ |
+
+
+
+
+ |
+
+
+ |
+
+
+
+ ' . $changeuser_closure . '
+
+
+ Kind regards,
+
+
+ Service team
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+
+
+';
\ No newline at end of file
diff --git a/custom/settings/config.php b/custom/settings/config.php
index b71a4a8..cd8dcd6 100644
--- a/custom/settings/config.php
+++ b/custom/settings/config.php
@@ -64,6 +64,8 @@ define('default_product_sort','sort3');
define('invoice_bookkeeping',false);
// Email of bookkeeping software
define('email_bookkeeping','');
+// Rewrite URL?
+define('rewrite_url',true);
/* Images */
// Featured image URL
@@ -131,8 +133,8 @@ define('mail_enabled',true);
define('email','info@gewoonlekkerspaans.nl');
// Receive email notifications?
define('email_notifications',false);
-// Rewrite URL?
-define('rewrite_url',true);
+//EMAIL LOGO
+define('emaillogo','custom/assets/MORVALFavicon.svg');
//Additional phpmailer-settings
define('email_host_name','gewoonlekkerspaans.nl');
define('email_reply_to','info@gewoonlekkerspaans.nl');
diff --git a/functions.php b/functions.php
index 1e64af5..30def2e 100644
--- a/functions.php
+++ b/functions.php
@@ -176,7 +176,6 @@ function template_admin_header($title, $selected = 'orders', $selected_child = '
$site_name = site_name;
$icon_image = icon_image;
$admin_links = '
-
Dashboard
Settings
◼Settings
diff --git a/home.php b/home.php
index ab02724..057bf90 100644
--- a/home.php
+++ b/home.php
@@ -29,7 +29,7 @@ $view = '
if(show_offer_home_page){
$view .='
-
'.show_offer_home_text.'
+
'.${show_offer_home_text} ?? show_offer_home_text .'
';
}
$view .='
diff --git a/myaccount.php b/myaccount.php
index 668a669..1336257 100644
--- a/myaccount.php
+++ b/myaccount.php
@@ -3,18 +3,22 @@
defined(security_key) or exit;
// User clicked the "Login" button, proceed with the login process... check POST data and validate email
if (isset($_POST['login'], $_POST['email'], $_POST['password']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
- // Check if the account exists
- $stmt = $pdo->prepare('SELECT * FROM accounts WHERE email = ?');
- $stmt->execute([ $_POST['email'] ]);
- $account = $stmt->fetch(PDO::FETCH_ASSOC);
- // If account exists verify password
- if ($account && password_verify($_POST['password'], $account['password'])) {
+
+ //+++++++++++++++++++++++++++++++++++++++++++++++++++++
+ // LOGIN CONSUMER
+ //+++++++++++++++++++++++++++++++++++++++++++++++++++++
+ $payload = json_encode(array("login" => "consumer", "email" => $_POST['email'], "password" => $_POST['password']), JSON_UNESCAPED_UNICODE);
+ $account = ioAPIv2('/v2/identity/',$payload,$clientsecret);
+ $account= json_decode($account,true);
+
+ if ($account && isset($account['accountID'])) {
// User has logged in, create session data
session_regenerate_id();
$_SESSION['account_loggedin'] = TRUE;
- $_SESSION['account_id'] = $account['id'];
- $_SESSION['account_role'] = $account['role'];
+ $_SESSION['account_id'] = $account['accountID'];
+ $_SESSION['account_role'] = $account['profile'];
$products_in_cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : [];
+
if ($products_in_cart) {
// user has products in cart, redirect them to the checkout page
header('Location: ' . url('index.php?page=checkout'));
@@ -32,9 +36,10 @@ $register_error = '';
// User clicked the "Register" button, proceed with the registration process... check POST data and validate email
if (isset($_POST['register'], $_POST['email'], $_POST['password'], $_POST['cpassword']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
// Check if the account exists
- $stmt = $pdo->prepare('SELECT * FROM accounts WHERE email = ?');
- $stmt->execute([ $_POST['email'] ]);
- $account = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ $account = ioAPIv2('/v2/identity/email='.$_POST['email'],'',$clientsecret);
+ $account = json_decode($account,true);
+
if ($account) {
// Account exists!
$register_error = $error_myaccount_exists;
@@ -46,25 +51,19 @@ if (isset($_POST['register'], $_POST['email'], $_POST['password'], $_POST['cpass
$register_error = $error_account_password_rules;
} else {
// Account doesnt exist, create new account
- $stmt = $pdo->prepare('INSERT INTO accounts (email, password, first_name, last_name, address_street, address_city, address_state, address_zip, address_country, address_phone) VALUES (?,?,"","","","","","","","")');
- // Hash the password
- $password = password_hash($_POST['password'], PASSWORD_DEFAULT);
- $stmt->execute([ $_POST['email'], $password ]);
- $account_id = $pdo->lastInsertId();
- // Automatically login the user
- session_regenerate_id();
- $_SESSION['account_loggedin'] = TRUE;
- $_SESSION['account_id'] = $account_id;
- $_SESSION['account_role'] = 'Member';
- $products_in_cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : [];
- if ($products_in_cart) {
- // User has products in cart, redirect them to the checkout page
- header('Location: ' . url('index.php?page=checkout'));
- } else {
- // Redirect the user back to the same page, they can then see their order history
- header('Location: ' . url('index.php?page=myaccount'));
+ $payload = json_encode(array("login" => "consumer", "email" => $_POST['email'], "password" => $_POST['password'], "language" => $_SESSION['country_code']), JSON_UNESCAPED_UNICODE);
+ $account = ioAPIv2('/v2/identity/',$payload,$clientsecret);
+ $account= json_decode($account,true);
+
+ if ($account && isset($account['accountID'])) {
+ //SEND VERIFICATION EMAIL
+ ob_start();
+ include dirname(__FILE__).'/custom/email/email_template_register.php';
+ $register_mail= ob_get_clean();
+
+ send_mail_by_PHPMailer($_POST['email'], $subject, $register_mail,'', '');
+ exit;
}
- exit;
}
}
// Determine the current tab page
diff --git a/products.php b/products.php
index 4f24e3a..0a6a435 100644
--- a/products.php
+++ b/products.php
@@ -61,7 +61,7 @@ $view .='
'.$h1_content_top.'
if(show_offer_product_page){
$view .= '
-
'.show_offer_product_text.'
+
'.${show_offer_product_text} ?? show_offer_product_text.'
';
}