diff --git a/account.php b/account.php index 511b75796..2449540ce 100644 --- a/account.php +++ b/account.php @@ -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'); diff --git a/account_edit.php b/account_edit.php index 68681bc6a..b4351c4a0 100644 --- a/account_edit.php +++ b/account_edit.php @@ -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')); @@ -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')); } } diff --git a/account_history.php b/account_history.php index f2e04d6c5..3052b5bfd 100644 --- a/account_history.php +++ b/account_history.php @@ -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'); diff --git a/account_history_info.php b/account_history_info.php index 52b23ad95..c1536633d 100644 --- a/account_history_info.php +++ b/account_history_info.php @@ -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' @@ -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']); diff --git a/account_newsletters.php b/account_newsletters.php index dc596d658..978dc0601 100644 --- a/account_newsletters.php +++ b/account_newsletters.php @@ -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; } @@ -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'); diff --git a/account_notifications.php b/account_notifications.php index 847ca6a48..fa632fbe5 100644 --- a/account_notifications.php +++ b/account_notifications.php @@ -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'; } @@ -41,7 +41,7 @@ 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) . ")"); @@ -49,7 +49,7 @@ } } 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']); @@ -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'); diff --git a/account_password.php b/account_password.php index e39fb4822..3b05ec3c6 100644 --- a/account_password.php +++ b/account_password.php @@ -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']]); @@ -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); } diff --git a/address_book.php b/address_book.php index 103ff8d33..161afe3d9 100644 --- a/address_book.php +++ b/address_book.php @@ -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'); diff --git a/address_book_process.php b/address_book_process.php index 038ccd4bc..c637f16e0 100644 --- a/address_book_process.php +++ b/address_book_process.php @@ -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()) { @@ -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 @@ -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']; @@ -64,7 +64,7 @@ } } - tep_redirect(tep_href_link('address_book.php', '', 'SSL')); + tep_redirect(tep_href_link('address_book.php')); } } @@ -72,48 +72,48 @@ 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'); } } diff --git a/admin/administrators.php b/admin/administrators.php index e32f15f40..138803ada 100644 --- a/admin/administrators.php +++ b/admin/administrators.php @@ -10,7 +10,7 @@ Released under the GNU General Public License */ - require('includes/application_top.php'); + require 'includes/application_top.php'; $htaccess_array = null; $htpasswd_array = null; @@ -48,18 +48,18 @@ $OSCOM_Hooks->call('administrators', 'preAction'); - if (tep_not_null($action)) { + if (!Text::is_empty($action)) { switch ($action) { case 'insert': require('includes/functions/password_funcs.php'); - $username = tep_db_prepare_input($_POST['username']); - $password = tep_db_prepare_input($_POST['password']); + $username = Text::prepare($_POST['username']); + $password = Text::prepare($_POST['password']); - $check_query = tep_db_query("select id from administrators where user_name = '" . tep_db_input($username) . "' limit 1"); + $check_query = tep_db_query("SELECT id FROM administrators WHERE user_name = '" . tep_db_input($username) . "' LIMIT 1"); - if (tep_db_num_rows($check_query) < 1) { - tep_db_query("insert into administrators (user_name, user_password) values ('" . tep_db_input($username) . "', '" . tep_db_input(tep_encrypt_password($password)) . "')"); + if (mysqli_num_rows($check_query) < 1) { + tep_db_query("INSERT INTO administrators (user_name, user_password) VALUES ('" . tep_db_input($username) . "', '" . tep_db_input(tep_encrypt_password($password)) . "')"); if (is_array($htpasswd_array)) { for ($i=0, $n=count($htpasswd_array); $i<$n; $i++) { @@ -103,11 +103,11 @@ case 'save': require('includes/functions/password_funcs.php'); - $username = tep_db_prepare_input($_POST['username']); - $password = tep_db_prepare_input($_POST['password']); + $username = Text::prepare($_POST['username']); + $password = Text::prepare($_POST['password']); - $check_query = tep_db_query("select id, user_name from administrators where id = '" . (int)$_GET['aID'] . "'"); - $check = tep_db_fetch_array($check_query); + $check_query = tep_db_query("SELECT id, user_name FROM administrators WHERE id = " . (int)$_GET['aID']); + $check = $check_query->fetch_assoc(); // update username in current session if changed if ( ($check['id'] == $admin['id']) && ($check['user_name'] != $admin['username']) ) { @@ -129,9 +129,9 @@ } } - tep_db_query("update administrators set user_name = '" . tep_db_input($username) . "' where id = '" . (int)$_GET['aID'] . "'"); + tep_db_query("UPDATE administrators SET user_name = '" . tep_db_input($username) . "' WHERE id = " . (int)$_GET['aID']); - if (tep_not_null($password)) { + if (!Text::is_empty($password)) { // update password in htpasswd if (is_array($htpasswd_array)) { for ($i=0, $n=count($htpasswd_array); $i<$n; $i++) { @@ -147,7 +147,7 @@ } } - tep_db_query("update administrators set user_password = '" . tep_db_input(tep_encrypt_password($password)) . "' where id = '" . (int)$_GET['aID'] . "'"); + tep_db_query("UPDATE administrators SET user_password = '" . tep_db_input(tep_encrypt_password($password)) . "' WHERE id = " . (int)$_GET['aID']); } elseif (!isset($_POST['htaccess']) || ($_POST['htaccess'] != 'true')) { if (is_array($htpasswd_array)) { for ($i=0, $n=count($htpasswd_array); $i<$n; $i++) { @@ -186,16 +186,16 @@ tep_redirect(tep_href_link('administrators.php', 'aID=' . (int)$_GET['aID'])); break; case 'deleteconfirm': - $id = tep_db_prepare_input($_GET['aID']); + $id = Text::input($_GET['aID']); - $check_query = tep_db_query("select id, user_name from administrators where id = '" . (int)$id . "'"); - $check = tep_db_fetch_array($check_query); + $check_query = tep_db_query("SELECT id, user_name FROM administrators WHERE id = " . (int)$id); + $check = $check_query->fetch_assoc(); if ($admin['id'] == $check['id']) { - tep_session_unregister('admin'); + unset($_SESSION['admin']); } - tep_db_query("delete from administrators where id = '" . (int)$id . "'"); + tep_db_query("DELETE FROM administrators WHERE id = " . (int)$id); if (is_array($htpasswd_array)) { for ($i=0, $n=count($htpasswd_array); $i<$n; $i++) { @@ -244,7 +244,7 @@ $secMessageStack->add(HTPASSWD_PERMISSIONS, 'error'); } - require('includes/template_top.php'); + require 'includes/template_top.php'; ?>
= TABLE_HEADING_CUSTOMER_ID; ?> | -= TABLE_HEADING_CUSTOMER_NAME; ?> | -= TABLE_HEADING_DATE_ADDED; ?> | -= TABLE_HEADING_STATUS; ?> | -= TABLE_HEADING_ACTION; ?> | += TABLE_HEADING_CUSTOMER_ID ?> | += TABLE_HEADING_CUSTOMER_NAME ?> | += TABLE_HEADING_DATE_ADDED ?> | += TABLE_HEADING_STATUS ?> | += TABLE_HEADING_ACTION ?> |
---|---|---|---|---|---|---|---|---|---|
= (int)$testimonials['customers_id']; ?> | -= $testimonials['customers_name']; ?> | -= tep_date_short($testimonials['date_added']); ?> | -'; - } else { - echo ' '; - } + | = (int)$testimonials['customers_id'] ?> | += $testimonials['customers_name'] ?> | += tep_date_short($testimonials['date_added']) ?> | += + ($testimonials['testimonials_status'] == '1') + ? ' ' + : ' ' ?> | = $icon ?> |