CMXX - Myaccount
This commit is contained in:
@@ -1,129 +0,0 @@
|
|||||||
<?php
|
|
||||||
defined('admin') or exit;
|
|
||||||
// SQL query that will get all orders and sort by the date created
|
|
||||||
$stmt = $pdo->prepare('SELECT t.*, COUNT(ti.id) AS total_products FROM transactions t JOIN transactions_items ti ON ti.txn_id = t.txn_id WHERE cast(t.created as DATE) = cast(now() as DATE) GROUP BY t.id, t.txn_id, t.payment_amount, t.payment_status, t.created, t.payer_email, t.first_name, t.last_name, t.address_street, t.address_city, t.address_state, t.address_zip, t.address_country, t.account_id, t.payment_method, t.discount_code, t.shipping_method, t.shipping_amount ORDER BY t.created DESC');
|
|
||||||
$stmt->execute();
|
|
||||||
$orders = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
// Get the orders statistics
|
|
||||||
$stmt = $pdo->prepare('SELECT SUM(payment_amount) AS earnings FROM transactions WHERE payment_status = "Completed" AND cast(created as DATE) = cast(now() as DATE)');
|
|
||||||
$stmt->execute();
|
|
||||||
$order_stats = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
||||||
// Get the total number of accounts
|
|
||||||
$stmt = $pdo->prepare('SELECT COUNT(*) AS total FROM accounts');
|
|
||||||
$stmt->execute();
|
|
||||||
$accounts = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
||||||
// Get the total number of products
|
|
||||||
$stmt = $pdo->prepare('SELECT COUNT(*) AS total FROM products');
|
|
||||||
$stmt->execute();
|
|
||||||
$products = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
||||||
?>
|
|
||||||
<?=template_admin_header('Dashboard', 'dashboard')?>
|
|
||||||
|
|
||||||
<div class="content-title">
|
|
||||||
<div class="title">
|
|
||||||
<i class="fa-solid fa-gauge-high"></i>
|
|
||||||
<div class="txt">
|
|
||||||
<h2>Dashboard</h2>
|
|
||||||
<p>View statistics, today's transactions, and more.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dashboard">
|
|
||||||
<div class="content-block stat">
|
|
||||||
<div class="data">
|
|
||||||
<h3>New Orders</h3>
|
|
||||||
<p><?=number_format(count($orders))?></p>
|
|
||||||
</div>
|
|
||||||
<i class="fas fa-shopping-cart"></i>
|
|
||||||
<div class="footer">
|
|
||||||
<i class="fa-solid fa-rotate fa-xs"></i>Total orders for today
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="content-block stat">
|
|
||||||
<div class="data">
|
|
||||||
<h3>New Sales</h3>
|
|
||||||
<p><?=currency_code?><?=number_format($order_stats['earnings'] ?? 0, 2)?></p>
|
|
||||||
</div>
|
|
||||||
<i class="fas fa-coins"></i>
|
|
||||||
<div class="footer">
|
|
||||||
<i class="fa-solid fa-rotate fa-xs"></i>Total earnings for today
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="content-block stat">
|
|
||||||
<div class="data">
|
|
||||||
<h3>Total Accounts</h3>
|
|
||||||
<p><?=number_format($accounts['total'])?></p>
|
|
||||||
</div>
|
|
||||||
<i class="fas fa-users"></i>
|
|
||||||
<div class="footer">
|
|
||||||
<i class="fa-solid fa-rotate fa-xs"></i>Total accounts
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="content-block stat">
|
|
||||||
<div class="data">
|
|
||||||
<h3>Total Products</h3>
|
|
||||||
<p><?=number_format($products['total'])?></p>
|
|
||||||
</div>
|
|
||||||
<i class="fas fa-boxes"></i>
|
|
||||||
<div class="footer">
|
|
||||||
<i class="fa-solid fa-rotate fa-xs"></i>Total products
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="content-title">
|
|
||||||
<div class="title">
|
|
||||||
<i class="fa-regular fa-rectangle-list alt"></i>
|
|
||||||
<div class="txt">
|
|
||||||
<h2>Today's Transactions</h2>
|
|
||||||
<p>List of transactions for today.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="content-block">
|
|
||||||
<div class="table">
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>#</td>
|
|
||||||
<td>Customer</td>
|
|
||||||
<td class="responsive-hidden">Email</td>
|
|
||||||
<td class="responsive-hidden">Products</td>
|
|
||||||
<td>Total</td>
|
|
||||||
<td class="responsive-hidden">Method</td>
|
|
||||||
<td class="responsive-hidden">Status</td>
|
|
||||||
<td class="responsive-hidden">Date</td>
|
|
||||||
<td>Actions</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php if (empty($orders)): ?>
|
|
||||||
<tr>
|
|
||||||
<td colspan="9" style="text-align:center;">There are no recent orders</td>
|
|
||||||
</tr>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php foreach ($orders as $order): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?=$order['id']?></td>
|
|
||||||
<td><?=htmlspecialchars($order['first_name'], ENT_QUOTES)?> <?=htmlspecialchars($order['last_name'], ENT_QUOTES)?></td>
|
|
||||||
<td class="responsive-hidden"><?=htmlspecialchars($order['payer_email'], ENT_QUOTES)?></td>
|
|
||||||
<td class="responsive-hidden"><?=$order['total_products']?></td>
|
|
||||||
<td><?=currency_code?><?=number_format($order['payment_amount'], 2)?></td>
|
|
||||||
<td class="responsive-hidden"><?=$order['payment_method']?></td>
|
|
||||||
<td class="responsive-hidden"><span class="status <?=strtolower($order['payment_status'])?>"><?=$order['payment_status']?></span></td>
|
|
||||||
<td class="responsive-hidden"><?=date('F j, Y', strtotime($order['created']))?></td>
|
|
||||||
<td><a href="index.php?page=order&id=<?=$order['id']?>" class="link1">View</a> <a href="index.php?page=order_manage&id=<?=$order['id']?>" class="link1">Edit</a></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?=template_admin_footer()?>
|
|
||||||
@@ -3,15 +3,15 @@ defined('admin') or exit;
|
|||||||
// Capture post data
|
// Capture post data
|
||||||
if (isset($_POST['emailtemplate'], $_POST['emailtemplate2'])) {
|
if (isset($_POST['emailtemplate'], $_POST['emailtemplate2'])) {
|
||||||
// Save templates
|
// Save templates
|
||||||
file_put_contents(dirname(__FILE__,-1).'/custom/mail/order-details-template.php', $_POST['emailtemplate']);
|
file_put_contents('../custom/email/order-details-template.php', $_POST['emailtemplate']);
|
||||||
file_put_contents(dirname(__FILE__,-1).'/custom/mail/order-notification-template.php', $_POST['emailtemplate2']);
|
file_put_contents('../custom/email/order-notification-template.php', $_POST['emailtemplate2']);
|
||||||
header('Location: index.php?page=emailtemplates&success_msg=1');
|
header('Location: index.php?page=emailtemplates&success_msg=1');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// Read the order details template PHP file
|
// Read the order details template PHP file
|
||||||
$contents = file_get_contents(dirname(__FILE__,-1).'/custom/mail/order-details-template.php');
|
$contents = file_get_contents('../custom/email/order-details-template.php');
|
||||||
// Read the order notification template PHP file
|
// Read the order notification template PHP file
|
||||||
$contents2 = file_get_contents(dirname(__FILE__,-1).'/custom/mail/order-notification-template.php');
|
$contents2 = file_get_contents('../custom/email/order-notification-template.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) {
|
||||||
|
|||||||
@@ -15,6 +15,16 @@ include '../custom/settings/config.php';
|
|||||||
include '../functions.php';
|
include '../functions.php';
|
||||||
// Connect to MySQL database
|
// Connect to MySQL database
|
||||||
$pdo = pdo_connect_mysql();
|
$pdo = pdo_connect_mysql();
|
||||||
|
|
||||||
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
//LOGIN TO API
|
||||||
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
$data = json_encode(array("clientID" => clientID, "clientsecret" => clientsecret), JSON_UNESCAPED_UNICODE);
|
||||||
|
$responses = ioAPIv2('/v2/authorization', $data,'');
|
||||||
|
//Decode Payload
|
||||||
|
if (!empty($responses)){$responses = json_decode($responses,true);}else{$responses = '400';}
|
||||||
|
$clientsecret = $responses['token'];
|
||||||
|
|
||||||
// If the user is not logged-in redirect them to the login page
|
// If the user is not logged-in redirect them to the login page
|
||||||
if (!isset($_SESSION['account_loggedin'])) {
|
if (!isset($_SESSION['account_loggedin'])) {
|
||||||
header('Location: ' . url('../index.php?page=myaccount'));
|
header('Location: ' . url('../index.php?page=myaccount'));
|
||||||
@@ -29,7 +39,7 @@ if (!$account || $account['role'] != 'Admin') {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// Page is set to home (home.php) by default, so when the visitor visits that will be the page they see.
|
// Page is set to home (home.php) by default, so when the visitor visits that will be the page they see.
|
||||||
$page = isset($_GET['page']) && file_exists($_GET['page'] . '.php') ? $_GET['page'] : 'dashboard';
|
$page = isset($_GET['page']) && file_exists($_GET['page'] . '.php') ? $_GET['page'] : 'settings';
|
||||||
if (isset($_GET['page']) && $_GET['page'] == 'logout') {
|
if (isset($_GET['page']) && $_GET['page'] == 'logout') {
|
||||||
session_destroy();
|
session_destroy();
|
||||||
header('Location: ' . url('../index.php'));
|
header('Location: ' . url('../index.php'));
|
||||||
|
|||||||
@@ -1,66 +1,90 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('admin') or exit;
|
defined('admin') or exit;
|
||||||
// Capture post data
|
|
||||||
if (isset($_POST['language_US'], $_POST['language_NL'])) {
|
|
||||||
// Save templates
|
|
||||||
file_put_contents(dirname(__FILE__,-1).'/custom/translations/translations_US.php', $_POST['language_US']);
|
|
||||||
file_put_contents(dirname(__FILE__,-1).'/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(dirname(__FILE__,-1).'/custom/translations/translations_US.php');
|
|
||||||
// Read language template PHP file
|
|
||||||
$contents2 = file_get_contents(dirname(__FILE__,-1).'/custom/translations/translations_NL.php');
|
|
||||||
// Handle success messages
|
|
||||||
if (isset($_GET['success_msg'])) {
|
|
||||||
if ($_GET['success_msg'] == 1) {
|
|
||||||
$success_msg = 'Settings updated successfully!';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
//------------------------------------------
|
||||||
|
// Languages supported
|
||||||
|
//------------------------------------------
|
||||||
|
$supportedLanguages = ['US', 'NL', 'DE', 'ES','FR', 'IT'];
|
||||||
|
|
||||||
|
if(isset($_POST['generatefile'])){
|
||||||
|
|
||||||
<?=template_admin_header('Language', 'language')?>
|
$language_key = (isset($_POST['language'])) ? $_POST['language'] : '';
|
||||||
|
|
||||||
<form action="" method="post">
|
function generateFile($language_key,$token){
|
||||||
|
//GET TRANSLATION RECORDS
|
||||||
<div class="content-title responsive-flex-wrap responsive-pad-bot-3">
|
$api_url = '/v2/translations/generatefile='.$language_key;
|
||||||
<h2 class="responsive-width-100">Translations</h2>
|
$responses = ioAPIv2($api_url,'',$token);
|
||||||
<input type="submit" name="submit" value="Save" class="btn">
|
|
||||||
</div>
|
if (!empty($responses)){
|
||||||
|
//define translation variable
|
||||||
<?php if (isset($success_msg)): ?>
|
$translation = '<?php'.PHP_EOL;
|
||||||
<div class="msg success">
|
|
||||||
<i class="fas fa-check-circle"></i>
|
|
||||||
<p><?=$success_msg?></p>
|
|
||||||
<i class="fas fa-times"></i>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="tabs">
|
|
||||||
<a href="#" class="active">US</a>
|
|
||||||
<a href="#" class="">NL</a>
|
|
||||||
</div>
|
|
||||||
<div class="content-block">
|
|
||||||
<div class="form responsive-width-100">
|
|
||||||
|
|
||||||
<div class="tab-content active">
|
//decode the API response
|
||||||
<label for="language_US">Language_US:</label>
|
$responses = json_decode($responses,true);
|
||||||
<textarea name="language_US" id="language_US" style="min-height: 100vh;"><?=$contents?></textarea>
|
|
||||||
</div>
|
//loop through translation records and create variables
|
||||||
<div class="tab-content">
|
foreach ($responses as $response){
|
||||||
<label for="language_NL">Language_NL:</label>
|
$text = str_replace(
|
||||||
<textarea name="language_NL" id="language_NL" style="min-height: 100vh;"><?=$contents2?></textarea>
|
['\\', "'", "\r", "\n", "\0", "\t"],
|
||||||
</div>
|
['\\\\', "\\'", '\\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 .='
|
||||||
|
<form action="" method="post">
|
||||||
|
<div class="content-title responsive-flex-wrap responsive-pad-bot-3">
|
||||||
|
<h2 class="responsive-width-100">Maintenance</h2>
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
$view .= '<div class="tabs">
|
||||||
|
<a href="#" class="active">'.($general_actions ?? 'Actions' ).'</a>
|
||||||
</div>
|
</div>
|
||||||
|
';
|
||||||
|
|
||||||
|
$view .= '<div class="content-block tab-content active">
|
||||||
|
<div class="form responsive-width-100">
|
||||||
|
<label for="">Language</label>
|
||||||
|
<select id="language" name="language">';
|
||||||
|
$view .='<option value=""></option>';
|
||||||
|
foreach ($supportedLanguages as $language){
|
||||||
|
$view .='<option value="'.$language.'">'.$language.'</option>';
|
||||||
|
}
|
||||||
|
$view .=' </select>
|
||||||
|
<input type="submit" name="generatefile" style="width: 15%;" value="Generate language" class="btn">
|
||||||
</div>
|
</div>
|
||||||
|
</div>';
|
||||||
|
|
||||||
</form>
|
$view .= '</form>';
|
||||||
<script>
|
|
||||||
document.querySelectorAll("input[type='checkbox']").forEach(checkbox => {
|
|
||||||
checkbox.onclick = () => checkbox.value = checkbox.checked ? 'true' : 'false';
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?=template_admin_footer()?>
|
//Output
|
||||||
|
echo $view;
|
||||||
|
|
||||||
|
template_admin_footer();
|
||||||
111
admin/settings.php
Normal file
111
admin/settings.php
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
defined('admin') or exit;
|
||||||
|
// Configuration file
|
||||||
|
$file = '../custom/settings/config.php';
|
||||||
|
// Open the configuration file for reading
|
||||||
|
$contents = file_get_contents($file);
|
||||||
|
// Format key function
|
||||||
|
function format_key($key) {
|
||||||
|
$key = str_replace(
|
||||||
|
['_', 'url', 'db ', ' pass', ' user', 'ipn', 'paypal'],
|
||||||
|
[' ', 'URL', 'Database ', ' Password', ' Username', 'IPN', 'PayPal'],
|
||||||
|
strtolower($key)
|
||||||
|
);
|
||||||
|
return ucwords($key);
|
||||||
|
}
|
||||||
|
// Format HTML output function
|
||||||
|
function format_var_html($key, $value) {
|
||||||
|
$html = '';
|
||||||
|
$type = 'text';
|
||||||
|
$value = htmlspecialchars(trim($value, '\''), ENT_QUOTES);
|
||||||
|
$type = strpos($key, 'secret') !== false ? 'password' : $type;
|
||||||
|
$type = strpos($key, 'pass') !== false ? 'password' : $type;
|
||||||
|
$type = strpos($key, 'Pw') !== false ? 'password' : $type;
|
||||||
|
$type = in_array(strtolower($value), ['true', 'false']) ? 'checkbox' : $type;
|
||||||
|
$checked = strtolower($value) == 'true' ? ' checked' : '';
|
||||||
|
$html .= '<label for="' . $key . '">' . format_key($key) . '</label>';
|
||||||
|
if ($type == 'checkbox') {
|
||||||
|
$html .= '<input type="hidden" name="' . $key . '" value="false">';
|
||||||
|
}
|
||||||
|
$html .= '<input type="' . $type . '" name="' . $key . '" id="' . $key . '" value="' . $value . '" placeholder="' . format_key($key) . '"' . $checked . '>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
// Format tabs
|
||||||
|
function format_tabs($contents) {
|
||||||
|
$rows = explode("\n", $contents);
|
||||||
|
echo '<div class="tabs">';
|
||||||
|
echo '<a href="#" class="active">General</a>';
|
||||||
|
for ($i = 0; $i < count($rows); $i++) {
|
||||||
|
preg_match('/\/\*(.*?)\*\//', $rows[$i], $match);
|
||||||
|
if ($match) {
|
||||||
|
echo '<a href="#">' . $match[1] . '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
// Format form
|
||||||
|
function format_form($contents) {
|
||||||
|
$rows = explode("\n", $contents);
|
||||||
|
echo '<div class="tab-content active">';
|
||||||
|
for ($i = 0; $i < count($rows); $i++) {
|
||||||
|
preg_match('/\/\*(.*?)\*\//', $rows[$i], $match);
|
||||||
|
if ($match) {
|
||||||
|
echo '</div><div class="tab-content">';
|
||||||
|
}
|
||||||
|
preg_match('/define\(\'(.*?)\', ?(.*?)\)/', $rows[$i], $match);
|
||||||
|
if ($match) {
|
||||||
|
echo format_var_html($match[1], $match[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
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')?>
|
||||||
|
|
||||||
|
<form action="" method="post">
|
||||||
|
|
||||||
|
<div class="content-title responsive-flex-wrap responsive-pad-bot-3">
|
||||||
|
<h2 class="responsive-width-100">Settings</h2>
|
||||||
|
<input type="submit" name="submit" value="Save" class="btn">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (isset($success_msg)): ?>
|
||||||
|
<div class="msg success">
|
||||||
|
<i class="fas fa-check-circle"></i>
|
||||||
|
<p><?=$success_msg?></p>
|
||||||
|
<i class="fas fa-times"></i>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?=format_tabs($contents)?>
|
||||||
|
<div class="content-block">
|
||||||
|
<div class="form responsive-width-100">
|
||||||
|
<?=format_form($contents)?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.querySelectorAll("input[type='checkbox']").forEach(checkbox => {
|
||||||
|
checkbox.onclick = () => checkbox.value = checkbox.checked ? 'true' : 'false';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?=template_admin_footer()?>
|
||||||
102
custom/email/email_template_register.php
Normal file
102
custom/email/email_template_register.php
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
defined($security_key) or exit;
|
||||||
|
//------------------------------------------
|
||||||
|
// Content Reset Email
|
||||||
|
//------------------------------------------
|
||||||
|
$newuser_subject = 'CustomerPortal user created';
|
||||||
|
$newuser_header = 'Dear CustomerPortal user';
|
||||||
|
|
||||||
|
$newuser_text = 'Your administrator has provided access to the CustomerPortal.';
|
||||||
|
$newuser_credential_text_1 = 'Your account has been created with username ';
|
||||||
|
$newuser_credential_text_2 = 'Please click the button below to complete your registration.';
|
||||||
|
|
||||||
|
$newuser_closure = 'For security reasons this link is only active for 10 minutes.';
|
||||||
|
|
||||||
|
//------------------------------------------
|
||||||
|
// Content Reset Email
|
||||||
|
//------------------------------------------
|
||||||
|
$subject = $newuser_subject;
|
||||||
|
|
||||||
|
$message = '
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>' . $subject . '</title>
|
||||||
|
<style>
|
||||||
|
@media screen and (max-width: 600px) {
|
||||||
|
.content {
|
||||||
|
width: 100% !important;
|
||||||
|
display: block !important;
|
||||||
|
padding: 10px !important;
|
||||||
|
}
|
||||||
|
.header, .body, .footer {
|
||||||
|
padding: 20px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body style="font-family: Arial, sans-serif">
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||||
|
<tr>
|
||||||
|
<td align="center" style="padding: 20px;">
|
||||||
|
<table class="content" width="600" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #cccccc;">
|
||||||
|
<!-- Header -->
|
||||||
|
<tr>
|
||||||
|
<td class="header" style="background-color:#005655; padding: 40px; text-align: center; color: white; font-size: 24px;">
|
||||||
|
CustomerPortal
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- Body -->
|
||||||
|
<tr>
|
||||||
|
<td class="body" style="padding: 40px; text-align: left; font-size: 16px; line-height: 1.6;">
|
||||||
|
' . $newuser_header . ',
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
'.$newuser_text.' '.$newuser_credential_text_1.'<b>'.$post_content['username'].'</b>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
'.$newuser_credential_text_2.'
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- Call to action Button -->
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 0px 40px 0px 40px; text-align: center;">
|
||||||
|
<!-- CTA Button -->
|
||||||
|
<table cellspacing="0" cellpadding="0" style="margin: auto;">
|
||||||
|
<tr>
|
||||||
|
<td align="center" style="background-color: #008685; padding: 10px 20px; border-radius: 5px;">
|
||||||
|
<a href="https://' . base_url . '/page=myaccount?activation_key='.$resetkey.'" target="_blank" style="color: #ffffff; text-decoration: none; font-weight: bold;">Reset Password</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="body" style="padding: 40px; text-align: left; font-size: 16px; line-height: 1.6;">
|
||||||
|
' . $newuser_closure . '
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
Kind regards,
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
Service team
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- Footer -->
|
||||||
|
<tr>
|
||||||
|
<td class="footer" style="background: url(\'https://'.base_url.emaillogo.'\');background-position: center center;background-repeat:no-repeat;background-size:contain;background-color: #005655; padding: 40px;">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
';
|
||||||
99
custom/email/email_template_reset.php
Normal file
99
custom/email/email_template_reset.php
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
defined($security_key) or exit;
|
||||||
|
//------------------------------------------
|
||||||
|
// Content Reset Email
|
||||||
|
//------------------------------------------
|
||||||
|
$changeuser_subject = 'CustomerPortal - password reset requested';
|
||||||
|
$changeuser_header = 'Dear CustomerPortal user';
|
||||||
|
$changeuser_text = 'A password reset has been requested for your account.';
|
||||||
|
$changeuser_credential_text_1 = 'Please click the button below to reset the password of your CustomerPortal account.';
|
||||||
|
$changeuser_closure = 'For security reasons this link is only active for 10 minutes.';
|
||||||
|
|
||||||
|
//------------------------------------------
|
||||||
|
// Content Reset Email
|
||||||
|
//------------------------------------------
|
||||||
|
$subject = $changeuser_subject;
|
||||||
|
|
||||||
|
$message = '
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>' . $subject . '</title>
|
||||||
|
<style>
|
||||||
|
@media screen and (max-width: 600px) {
|
||||||
|
.content {
|
||||||
|
width: 100% !important;
|
||||||
|
display: block !important;
|
||||||
|
padding: 10px !important;
|
||||||
|
}
|
||||||
|
.header, .body, .footer {
|
||||||
|
padding: 20px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body style="font-family: Arial, sans-serif">
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||||
|
<tr>
|
||||||
|
<td align="center" style="padding: 20px;">
|
||||||
|
<table class="content" width="600" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #cccccc;">
|
||||||
|
<!-- Header -->
|
||||||
|
<tr>
|
||||||
|
<td class="header" style="background-color:#005655; padding: 40px; text-align: center; color: white; font-size: 24px;">
|
||||||
|
CustomerPortal
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- Body -->
|
||||||
|
<tr>
|
||||||
|
<td class="body" style="padding: 40px; text-align: left; font-size: 16px; line-height: 1.6;">
|
||||||
|
' . $changeuser_header . ',
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
'.$changeuser_text.'
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
'.$changeuser_credential_text_1 .'
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- Call to action Button -->
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 0px 40px 0px 40px; text-align: center;">
|
||||||
|
<!-- CTA Button -->
|
||||||
|
<table cellspacing="0" cellpadding="0" style="margin: auto;">
|
||||||
|
<tr>
|
||||||
|
<td align="center" style="background-color: #008685; padding: 10px 20px; border-radius: 5px;">
|
||||||
|
<a href="https://' . $portalURL . '/reset.php?resetkey='.$resetkey.'" target="_blank" style="color: #ffffff; text-decoration: none; font-weight: bold;">Reset Password</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="body" style="padding: 40px; text-align: left; font-size: 16px; line-height: 1.6;">
|
||||||
|
' . $changeuser_closure . '
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
Kind regards,
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
Service team
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- Footer -->
|
||||||
|
<tr>
|
||||||
|
<td class="footer" style="background: url(\'https://'.$portalURL.emaillogo.'\');background-position: center center;background-repeat:no-repeat;background-size:contain;background-color: #005655; padding: 40px;">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
';
|
||||||
@@ -64,6 +64,8 @@ define('default_product_sort','sort3');
|
|||||||
define('invoice_bookkeeping',false);
|
define('invoice_bookkeeping',false);
|
||||||
// Email of bookkeeping software
|
// Email of bookkeeping software
|
||||||
define('email_bookkeeping','');
|
define('email_bookkeeping','');
|
||||||
|
// Rewrite URL?
|
||||||
|
define('rewrite_url',true);
|
||||||
|
|
||||||
/* Images */
|
/* Images */
|
||||||
// Featured image URL
|
// Featured image URL
|
||||||
@@ -131,8 +133,8 @@ define('mail_enabled',true);
|
|||||||
define('email','info@gewoonlekkerspaans.nl');
|
define('email','info@gewoonlekkerspaans.nl');
|
||||||
// Receive email notifications?
|
// Receive email notifications?
|
||||||
define('email_notifications',false);
|
define('email_notifications',false);
|
||||||
// Rewrite URL?
|
//EMAIL LOGO
|
||||||
define('rewrite_url',true);
|
define('emaillogo','custom/assets/MORVALFavicon.svg');
|
||||||
//Additional phpmailer-settings
|
//Additional phpmailer-settings
|
||||||
define('email_host_name','gewoonlekkerspaans.nl');
|
define('email_host_name','gewoonlekkerspaans.nl');
|
||||||
define('email_reply_to','info@gewoonlekkerspaans.nl');
|
define('email_reply_to','info@gewoonlekkerspaans.nl');
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ function template_admin_header($title, $selected = 'orders', $selected_child = '
|
|||||||
$site_name = site_name;
|
$site_name = site_name;
|
||||||
$icon_image = icon_image;
|
$icon_image = icon_image;
|
||||||
$admin_links = '
|
$admin_links = '
|
||||||
<a href="index.php?page=dashboard"' . ($selected == 'dashboard' ? ' class="selected"' : '') . '><i class="fas fa-tachometer-alt"></i>Dashboard</a>
|
|
||||||
<a href="index.php?page=settings"' . ($selected == 'settings' ? ' class="selected"' : '') . '><i class="fas fa-tools"></i>Settings</a>
|
<a href="index.php?page=settings"' . ($selected == 'settings' ? ' class="selected"' : '') . '><i class="fas fa-tools"></i>Settings</a>
|
||||||
<div class="sub">
|
<div class="sub">
|
||||||
<a href="index.php?page=settings"' . ($selected == 'settings' && $selected_child == '' ? ' class="selected"' : '') . '><span>◼</span>Settings</a>
|
<a href="index.php?page=settings"' . ($selected == 'settings' && $selected_child == '' ? ' class="selected"' : '') . '><span>◼</span>Settings</a>
|
||||||
|
|||||||
2
home.php
2
home.php
@@ -29,7 +29,7 @@ $view = '
|
|||||||
if(show_offer_home_page){
|
if(show_offer_home_page){
|
||||||
$view .='
|
$view .='
|
||||||
<div class="" style="text-align: center;">
|
<div class="" style="text-align: center;">
|
||||||
<p class="p.paragraph.neutral-paragraph-text-1" style="font-family:\'gerb\';font-size: 15px;">'.show_offer_home_text.'</p>
|
<p class="p.paragraph.neutral-paragraph-text-1" style="font-family:\'gerb\';font-size: 15px;">'.${show_offer_home_text} ?? show_offer_home_text .'</p>
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
$view .='
|
$view .='
|
||||||
|
|||||||
@@ -3,18 +3,22 @@
|
|||||||
defined(security_key) or exit;
|
defined(security_key) or exit;
|
||||||
// User clicked the "Login" button, proceed with the login process... check POST data and validate email
|
// 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)) {
|
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'] ]);
|
// LOGIN CONSUMER
|
||||||
$account = $stmt->fetch(PDO::FETCH_ASSOC);
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
// If account exists verify password
|
$payload = json_encode(array("login" => "consumer", "email" => $_POST['email'], "password" => $_POST['password']), JSON_UNESCAPED_UNICODE);
|
||||||
if ($account && password_verify($_POST['password'], $account['password'])) {
|
$account = ioAPIv2('/v2/identity/',$payload,$clientsecret);
|
||||||
|
$account= json_decode($account,true);
|
||||||
|
|
||||||
|
if ($account && isset($account['accountID'])) {
|
||||||
// User has logged in, create session data
|
// User has logged in, create session data
|
||||||
session_regenerate_id();
|
session_regenerate_id();
|
||||||
$_SESSION['account_loggedin'] = TRUE;
|
$_SESSION['account_loggedin'] = TRUE;
|
||||||
$_SESSION['account_id'] = $account['id'];
|
$_SESSION['account_id'] = $account['accountID'];
|
||||||
$_SESSION['account_role'] = $account['role'];
|
$_SESSION['account_role'] = $account['profile'];
|
||||||
$products_in_cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : [];
|
$products_in_cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : [];
|
||||||
|
|
||||||
if ($products_in_cart) {
|
if ($products_in_cart) {
|
||||||
// user has products in cart, redirect them to the checkout page
|
// user has products in cart, redirect them to the checkout page
|
||||||
header('Location: ' . url('index.php?page=checkout'));
|
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
|
// 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)) {
|
if (isset($_POST['register'], $_POST['email'], $_POST['password'], $_POST['cpassword']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
|
||||||
// Check if the account exists
|
// Check if the account exists
|
||||||
$stmt = $pdo->prepare('SELECT * FROM accounts WHERE email = ?');
|
|
||||||
$stmt->execute([ $_POST['email'] ]);
|
$account = ioAPIv2('/v2/identity/email='.$_POST['email'],'',$clientsecret);
|
||||||
$account = $stmt->fetch(PDO::FETCH_ASSOC);
|
$account = json_decode($account,true);
|
||||||
|
|
||||||
if ($account) {
|
if ($account) {
|
||||||
// Account exists!
|
// Account exists!
|
||||||
$register_error = $error_myaccount_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;
|
$register_error = $error_account_password_rules;
|
||||||
} else {
|
} else {
|
||||||
// Account doesnt exist, create new account
|
// 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 (?,?,"","","","","","","","")');
|
$payload = json_encode(array("login" => "consumer", "email" => $_POST['email'], "password" => $_POST['password'], "language" => $_SESSION['country_code']), JSON_UNESCAPED_UNICODE);
|
||||||
// Hash the password
|
$account = ioAPIv2('/v2/identity/',$payload,$clientsecret);
|
||||||
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
|
$account= json_decode($account,true);
|
||||||
$stmt->execute([ $_POST['email'], $password ]);
|
|
||||||
$account_id = $pdo->lastInsertId();
|
if ($account && isset($account['accountID'])) {
|
||||||
// Automatically login the user
|
//SEND VERIFICATION EMAIL
|
||||||
session_regenerate_id();
|
ob_start();
|
||||||
$_SESSION['account_loggedin'] = TRUE;
|
include dirname(__FILE__).'/custom/email/email_template_register.php';
|
||||||
$_SESSION['account_id'] = $account_id;
|
$register_mail= ob_get_clean();
|
||||||
$_SESSION['account_role'] = 'Member';
|
|
||||||
$products_in_cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : [];
|
send_mail_by_PHPMailer($_POST['email'], $subject, $register_mail,'', '');
|
||||||
if ($products_in_cart) {
|
exit;
|
||||||
// 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'));
|
|
||||||
}
|
}
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Determine the current tab page
|
// Determine the current tab page
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ $view .=' <h2>'.$h1_content_top.'</h2>
|
|||||||
if(show_offer_product_page){
|
if(show_offer_product_page){
|
||||||
$view .= '
|
$view .= '
|
||||||
<div class="" style="text-align: center;">
|
<div class="" style="text-align: center;">
|
||||||
<p class="p.paragraph.neutral-paragraph-text-1" style="font-family:\'gerb\';font-size: 15px;">'.show_offer_product_text.'</p>
|
<p class="p.paragraph.neutral-paragraph-text-1" style="font-family:\'gerb\';font-size: 15px;">'.${show_offer_product_text} ?? show_offer_product_text.'</p>
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user