Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1038 from gburton/1.0.7.14
Browse files Browse the repository at this point in the history
1.0.7.14
  • Loading branch information
ecartz authored Jan 26, 2021
2 parents 090c3fc + bc96513 commit 6d0b9e7
Show file tree
Hide file tree
Showing 84 changed files with 980 additions and 924 deletions.
2 changes: 1 addition & 1 deletion account.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

$OSCOM_Hooks->register_pipeline('loginRequired');

require "includes/languages/$language/account.php";
require language::map_to_translation('account.php');

require $oscTemplate->map_to_template(__FILE__, 'page');

Expand Down
4 changes: 2 additions & 2 deletions account_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

$message_stack_area = 'account_edit';
// needs to be included earlier to set the success message in the messageStack
require "includes/languages/$language/account_edit.php";
require language::map_to_translation('account_edit.php');

if (tep_validate_form_action_is('process')) {
$customer_details = $customer_data->process($customer_data->get_fields_for_page('account_edit'));
Expand All @@ -28,7 +28,7 @@

$messageStack->add_session('account', SUCCESS_ACCOUNT_UPDATED, 'success');

tep_redirect(tep_href_link('account.php', '', 'SSL'));
tep_redirect(tep_href_link('account.php'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion account_history.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

$OSCOM_Hooks->register_pipeline('loginRequired');

require "includes/languages/$language/account_history.php";
require language::map_to_translation('account_history.php');

require $oscTemplate->map_to_template(__FILE__, 'page');

Expand Down
8 changes: 4 additions & 4 deletions account_history_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$OSCOM_Hooks->register_pipeline('loginRequired');

if (!is_numeric($_GET['order_id'] ?? null)) {
tep_redirect(tep_href_link('account_history.php', '', 'SSL'));
tep_redirect(tep_href_link('account_history.php'));
}

$customer_info_query = tep_db_query(sprintf(<<<'EOSQL'
Expand All @@ -24,12 +24,12 @@
WHERE s.public_flag = 1 AND o.orders_id = %d AND s.language_id = %d
EOSQL
, (int)$_GET['order_id'], (int)$_SESSION['languages_id']));
$customer_info = tep_db_fetch_array($customer_info_query);
$customer_info = $customer_info_query->fetch_assoc();
if ($customer_info['customers_id'] != $_SESSION['customer_id']) {
tep_redirect(tep_href_link('account_history.php', '', 'SSL'));
tep_redirect(tep_href_link('account_history.php'));
}

require "includes/languages/$language/account_history_info.php";
require language::map_to_translation('account_history_info.php');

$order = new order($_GET['order_id']);

Expand Down
10 changes: 5 additions & 5 deletions account_newsletters.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
$OSCOM_Hooks->register_pipeline('loginRequired');

if (!$customer_data->has(['newsletter'])) {
tep_redirect(tep_href_link('account.php', '', 'SSL'));
tep_redirect(tep_href_link('account.php'));
}

// needs to be included earlier to set the success message in the messageStack
require "includes/languages/$language/account_newsletters.php";
require language::map_to_translation('account_newsletters.php');

$customer_data->build_read(['newsletter'], 'customers', ['id' => (int)$_SESSION['customer_id']]);
$newsletter_query = tep_db_query($customer_data->build_read(['newsletter'], 'customers', ['id' => (int)$_SESSION['customer_id']]));
$newsletter = tep_db_fetch_array($newsletter_query);
$newsletter = $newsletter_query->fetch_assoc();

if (tep_validate_form_action_is('process')) {
if (isset($_POST['newsletter_general']) && is_numeric($_POST['newsletter_general'])) {
$newsletter_general = tep_db_prepare_input($_POST['newsletter_general']);
$newsletter_general = Text::input($_POST['newsletter_general']);
} else {
$newsletter_general = 0;
}
Expand All @@ -39,7 +39,7 @@

$messageStack->add_session('account', SUCCESS_NEWSLETTER_UPDATED, 'success');

tep_redirect(tep_href_link('account.php', '', 'SSL'));
tep_redirect(tep_href_link('account.php'));
}

require $oscTemplate->map_to_template(__FILE__, 'page');
Expand Down
12 changes: 6 additions & 6 deletions account_notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
$OSCOM_Hooks->register_pipeline('loginRequired');

// needs to be included earlier to set the success message in the messageStack
require "includes/languages/$language/account_notifications.php";
require language::map_to_translation('account_notifications.php');

$global_query = tep_db_query("SELECT global_product_notifications FROM customers_info WHERE customers_info_id = " . (int)$_SESSION['customer_id']);
$global = tep_db_fetch_array($global_query);
$global = $global_query->fetch_assoc();

if (tep_validate_form_action_is('process')) {
if (isset($_POST['product_global']) && is_numeric($_POST['product_global'])) {
$product_global = tep_db_prepare_input($_POST['product_global']);
$product_global = Text::input($_POST['product_global']);
} else {
$product_global = '0';
}
Expand All @@ -41,15 +41,15 @@

if (count($products_parsed) > 0) {
$check_query = tep_db_query("SELECT COUNT(*) AS total FROM products_notifications WHERE customers_id = " . (int)$_SESSION['customer_id'] . " AND products_id NOT IN (" . implode(',', $products_parsed) . ")");
$check = tep_db_fetch_array($check_query);
$check = $check_query->fetch_assoc();

if ($check['total'] > 0) {
tep_db_query("DELETE FROM products_notifications WHERE customers_id = " . (int)$_SESSION['customer_id'] . " AND products_id NOT IN (" . implode(',', $products_parsed) . ")");
}
}
} else {
$check_query = tep_db_query("SELECT COUNT(*) AS total FROM products_notifications WHERE customers_id = " . (int)$_SESSION['customer_id']);
$check = tep_db_fetch_array($check_query);
$check = $check_query->fetch_assoc();

if ($check['total'] > 0) {
tep_db_query("DELETE FROM products_notifications WHERE customers_id = " . (int)$_SESSION['customer_id']);
Expand All @@ -58,7 +58,7 @@

$messageStack->add_session('account', SUCCESS_NOTIFICATIONS_UPDATED, 'success');

tep_redirect(tep_href_link('account.php', '', 'SSL'));
tep_redirect(tep_href_link('account.php'));
}

require $oscTemplate->map_to_template(__FILE__, 'page');
Expand Down
8 changes: 4 additions & 4 deletions account_password.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
}

// needs to be included earlier to set the success message in the messageStack
require "includes/languages/$language/account_password.php";
require language::map_to_translation('account_password.php');

$page_fields = [ 'password', 'password_confirmation' ];
$message_stack_area = 'account_password';

if (tep_validate_form_action_is('process')) {
$password_current = tep_db_prepare_input($_POST['password_current']);
$password_current = Text::input($_POST['password_current']);

$customer_details = $customer_data->process($page_fields);

if (tep_form_processing_is_valid()) {
$check_customer_query = tep_db_query($customer_data->build_read(['password'], 'customers', ['id' => (int)$_SESSION['customer_id']]));
$check_customer = tep_db_fetch_array($check_customer_query);
$check_customer = $check_customer_query->fetch_assoc();

if (tep_validate_password($password_current, $customer_data->get('password', $check_customer))) {
$customer_data->update(['password' => $customer_data->get('password', $customer_details)], ['id' => (int)$_SESSION['customer_id']]);
Expand All @@ -41,7 +41,7 @@

$messageStack->add_session('account', SUCCESS_PASSWORD_UPDATED, 'success');

tep_redirect(tep_href_link('account.php', '', 'SSL'));
tep_redirect(tep_href_link('account.php'));
} else {
$messageStack->add($message_stack_area, ERROR_CURRENT_PASSWORD_NOT_MATCHING);
}
Expand Down
2 changes: 1 addition & 1 deletion address_book.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

$OSCOM_Hooks->register_pipeline('loginRequired');

require "includes/languages/$language/address_book.php";
require language::map_to_translation('address_book.php');

require $oscTemplate->map_to_template(__FILE__, 'page');

Expand Down
28 changes: 14 additions & 14 deletions address_book_process.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
$message_stack_area = 'addressbook';

// needs to be included earlier to set the success message in the messageStack
require "includes/languages/$language/address_book_process.php";
require language::map_to_translation('address_book_process.php');

if (is_numeric($_GET['delete'] ?? null) && tep_validate_form_action_is('deleteconfirm', 2)) {
if ((int)$_GET['delete'] == $customer->get_default_address_id()) {
Expand All @@ -28,7 +28,7 @@
$messageStack->add_session($message_stack_area, SUCCESS_ADDRESS_BOOK_ENTRY_DELETED, 'success');
}

tep_redirect(tep_href_link('address_book.php', '', 'SSL'));
tep_redirect(tep_href_link('address_book.php'));
}

// error checking when updating or adding an entry
Expand All @@ -38,7 +38,7 @@
if (tep_form_processing_is_valid()) {
if ($_POST['action'] == 'update') {
$check_query = tep_db_query("SELECT * FROM address_book WHERE address_book_id = '" . (int)$_GET['edit'] . "' AND customers_id = " . (int)$_SESSION['customer_id'] . " LIMIT 1");
if (tep_db_num_rows($check_query) === 1) {
if (mysqli_num_rows($check_query) === 1) {
if ( 'on' === ($_POST['primary'] ?? null) ) {
$table = 'both';
$customer_details['default_address_id'] = (int)$_GET['edit'];
Expand All @@ -64,56 +64,56 @@
}
}

tep_redirect(tep_href_link('address_book.php', '', 'SSL'));
tep_redirect(tep_href_link('address_book.php'));
}
}

if (is_numeric($_GET['edit'] ?? null)) {
if (is_null($customer->fetch_to_address((int)$_GET['edit']))) {
$messageStack->add_session($message_stack_area, ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY);

tep_redirect(tep_href_link('address_book.php', '', 'SSL'));
tep_redirect(tep_href_link('address_book.php'));
}

$page_heading = HEADING_TITLE_MODIFY_ENTRY;
$navbar_title_3 = NAVBAR_TITLE_MODIFY_ENTRY;
$navbar_link_3 = tep_href_link('address_book_process.php', 'edit=' . $_GET['edit'], 'SSL');
$back_link = tep_href_link('address_book.php', '', 'SSL');
$navbar_link_3 = tep_href_link('address_book_process.php', 'edit=' . $_GET['edit']);
$back_link = tep_href_link('address_book.php');
} elseif (is_numeric($_GET['delete'] ?? null)) {
if ($_GET['delete'] == $customer->get_default_address_id()) {
$messageStack->add_session($message_stack_area, WARNING_PRIMARY_ADDRESS_DELETION, 'warning');

tep_redirect(tep_href_link('address_book.php', '', 'SSL'));
tep_redirect(tep_href_link('address_book.php'));
} else {
$check_query = tep_db_query("SELECT COUNT(*) AS total FROM address_book WHERE address_book_id = " . (int)$_GET['delete'] . " AND customers_id = " . (int)$_SESSION['customer_id']);
$check = tep_db_fetch_array($check_query);
$check = $check_query->fetch_assoc();

if ($check['total'] < 1) {
$messageStack->add_session($message_stack_area, ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY);

tep_redirect(tep_href_link('address_book.php', '', 'SSL'));
tep_redirect(tep_href_link('address_book.php'));
}
}

$page_heading = HEADING_TITLE_DELETE_ENTRY;
$navbar_title_3 = NAVBAR_TITLE_DELETE_ENTRY;
$navbar_link_3 = tep_href_link('address_book_process.php', 'delete=' . $_GET['delete'], 'SSL');
$navbar_link_3 = tep_href_link('address_book_process.php', 'delete=' . $_GET['delete']);
} else {
if ($customer->count_addresses() >= MAX_ADDRESS_BOOK_ENTRIES) {
$messageStack->add_session($message_stack_area, ERROR_ADDRESS_BOOK_FULL);

tep_redirect(tep_href_link('address_book.php', '', 'SSL'));
tep_redirect(tep_href_link('address_book.php'));
}

$entry = [];
$page_heading = HEADING_TITLE_ADD_ENTRY;
$navbar_title_3 = NAVBAR_TITLE_ADD_ENTRY;
$navbar_link_3 = tep_href_link('address_book_process.php', '', 'SSL');
$navbar_link_3 = tep_href_link('address_book_process.php');

if (count($navigation->snapshot) > 0) {
$back_link = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], [session_name()]), $navigation->snapshot['mode']);
} else {
$back_link = tep_href_link('address_book.php', '', 'SSL');
$back_link = tep_href_link('address_book.php');
}
}

Expand Down
Loading

0 comments on commit 6d0b9e7

Please sign in to comment.