Skip to content

Commit

Permalink
Added more fixes from Github
Browse files Browse the repository at this point in the history
  • Loading branch information
condor2 committed Jul 20, 2020
1 parent 885ec10 commit e33355b
Show file tree
Hide file tree
Showing 36 changed files with 333 additions and 393 deletions.
4 changes: 0 additions & 4 deletions upload/admin/controller/extension/module/carousel.php
Expand Up @@ -125,10 +125,6 @@ public function index() {
$data['status'] = '';
}

$this->load->model('design/banner');

$data['banners'] = $this->model_design_banner->getBanners();

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
Expand Down
Expand Up @@ -52,7 +52,7 @@ public function index() {

$this->load->model('localisation/language');

$data['payment_bank_transfer'] = array();
$data['payment_bank_transfer_bank'] = array();

$languages = $this->model_localisation_language->getLanguages();

Expand Down
2 changes: 1 addition & 1 deletion upload/admin/controller/marketing/coupon.php
Expand Up @@ -490,7 +490,7 @@ protected function validateForm() {
$this->error['name'] = $this->language->get('error_name');
}

if ((utf8_strlen($this->request->post['code']) < 3) || (utf8_strlen($this->request->post['code']) > 10)) {
if ((utf8_strlen($this->request->post['code']) < 3) || (utf8_strlen($this->request->post['code']) > 20)) {
$this->error['code'] = $this->language->get('error_code');
}

Expand Down
8 changes: 3 additions & 5 deletions upload/admin/controller/sale/order.php
Expand Up @@ -383,7 +383,7 @@ protected function getList() {

$session->start();

$this->model_user_api->deleteApiSessionBySessonId($session->getId());
$this->model_user_api->deleteApiSessionBySessionId($session->getId());

$this->model_user_api->addApiSession($api_info['api_id'], $session->getId(), $this->request->server['REMOTE_ADDR']);

Expand Down Expand Up @@ -690,7 +690,7 @@ public function getForm() {

$session->start();

$this->model_user_api->deleteApiSessionBySessonId($session->getId());
$this->model_user_api->deleteApiSessionBySessionId($session->getId());

$this->model_user_api->addApiSession($api_info['api_id'], $session->getId(), $this->request->server['REMOTE_ADDR']);

Expand Down Expand Up @@ -990,8 +990,6 @@ public function info() {

$data['commission'] = $this->currency->format($order_info['commission'], $order_info['currency_code'], $order_info['currency_value']);

$this->load->model('customer/customer');

$data['commission_total'] = $this->model_customer_customer->getTotalTransactionsByOrderId($this->request->get['order_id']);

$this->load->model('localisation/order_status');
Expand Down Expand Up @@ -1233,7 +1231,7 @@ public function info() {

$session->start();

$this->model_user_api->deleteApiSessionBySessonId($session->getId());
$this->model_user_api->deleteApiSessionBySessionId($session->getId());

$this->model_user_api->addApiSession($api_info['api_id'], $session->getId(), $this->request->server['REMOTE_ADDR']);

Expand Down
21 changes: 10 additions & 11 deletions upload/admin/controller/sale/voucher.php
Expand Up @@ -177,7 +177,7 @@ protected function getList() {
} else {
$order_href = '';
}

$data['vouchers'][] = array(
'voucher_id' => $result['voucher_id'],
'code' => $result['code'],
Expand Down Expand Up @@ -567,6 +567,9 @@ public function send() {
}

if ($vouchers) {
$this->load->model('sale/order');
$this->load->model('sale/voucher_theme');

foreach ($vouchers as $voucher_id) {
$voucher_info = $this->model_sale_voucher->getVoucher($voucher_id);

Expand All @@ -577,8 +580,6 @@ public function send() {
$order_id = 0;
}

$this->load->model('sale/order');

$order_info = $this->model_sale_order->getOrder($order_id);

// If voucher belongs to an order
Expand All @@ -598,8 +599,6 @@ public function send() {
$data['text_redeem'] = sprintf($language->get('text_redeem'), $voucher_info['code']);
$data['text_footer'] = $language->get('text_footer');

$this->load->model('sale/voucher_theme');

$voucher_theme_info = $this->model_sale_voucher_theme->getVoucherTheme($voucher_info['voucher_theme_id']);

if ($voucher_theme_info && is_file(DIR_IMAGE . $voucher_theme_info['image'])) {
Expand Down Expand Up @@ -628,25 +627,25 @@ public function send() {
$mail->send();

// If voucher does not belong to an order
} else {
} else {
$this->language->load('mail/voucher');

$data['title'] = sprintf($this->language->get('text_subject'), $voucher_info['from_name']);

$data['text_greeting'] = sprintf($this->language->get('text_greeting'), $this->currency->format($voucher_info['amount'], $this->config->get('config_currency')));
$data['text_from'] = sprintf($this->language->get('text_from'), $voucher_info['from_name']);
$data['text_message'] = $this->language->get('text_message');
$data['text_redeem'] = sprintf($this->language->get('text_redeem'), $voucher_info['code']);
$data['text_footer'] = $this->language->get('text_footer');

$this->load->model('sale/voucher_theme');
$data['text_footer'] = $this->language->get('text_footer');

$voucher_theme_info = $this->model_sale_voucher_theme->getVoucherTheme($voucher_info['voucher_theme_id']);

if ($voucher_theme_info && is_file(DIR_IMAGE . $voucher_theme_info['image'])) {
$data['image'] = HTTP_CATALOG . 'image/' . $voucher_theme_info['image'];
} else {
$data['image'] = '';
}

$data['store_name'] = $this->config->get('config_name');
$data['store_url'] = HTTP_CATALOG;
$data['message'] = nl2br($voucher_info['message']);
Expand Down
25 changes: 25 additions & 0 deletions upload/admin/controller/setting/setting.php
Expand Up @@ -317,6 +317,31 @@ public function index() {
$data['config_zone_id'] = $this->config->get('config_zone_id');
}

if (isset($this->request->post['config_timezone'])) {
$data['config_timezone'] = $this->request->post['config_timezone'];
} elseif ($this->config->has('config_timezone')) {
$data['config_timezone'] = $this->config->get('config_timezone');
} else {
$data['config_timezone'] = 'UTC';
}
// Set Time Zone
$data['timezones'] = array();

$timestamp = time();

$timezones = timezone_identifiers_list();

foreach($timezones as $timezone) {
date_default_timezone_set($timezone);
$hour = ' (' . date('P', $timestamp) . ')';
$data['timezones'][] = array(
'text' => $timezone . $hour,
'value' => $timezone
);
}

date_default_timezone_set($this->config->get('config_timezone'));

if (isset($this->request->post['config_language'])) {
$data['config_language'] = $this->request->post['config_language'];
} else {
Expand Down
8 changes: 8 additions & 0 deletions upload/admin/controller/startup/startup.php
Expand Up @@ -12,6 +12,14 @@ public function index() {
}
}

// Set time zone
if ($this->config->get('config_timezone')) {
date_default_timezone_set($this->config->get('config_timezone'));

// Sync PHP and DB time zones.
$this->db->query("SET time_zone = '" . $this->db->escape(date('P')) . "'");
}

// Theme
$this->config->set('template_cache', $this->config->get('developer_theme'));

Expand Down
3 changes: 2 additions & 1 deletion upload/admin/language/en-gb/mail/voucher.php
Expand Up @@ -6,4 +6,5 @@
$_['text_from'] = 'This Gift Certificate has been sent to you by %s';
$_['text_message'] = 'With a message saying';
$_['text_redeem'] = 'To redeem this Gift Certificate, write down the redemption code which is <b>%s</b> then click on the the link below and purchase the product you wish to use this gift certificate on. You can enter the gift certificate code on the shopping cart page before you click checkout.';
$_['text_footer'] = 'Please reply to this email if you have any questions.';
$_['text_footer'] = 'Please reply to this email if you have any questions.';
$_['text_sent'] = 'Success: Gift Voucher e-mail has been sent!';
1 change: 0 additions & 1 deletion upload/admin/language/en-gb/sale/voucher.php
Expand Up @@ -7,7 +7,6 @@
$_['text_list'] = 'Gift Voucher List';
$_['text_add'] = 'Add Gift Voucher';
$_['text_edit'] = 'Edit Gift Voucher';
$_['text_sent'] = 'Success: Gift Voucher e-mail has been sent!';

// Column
$_['column_name'] = 'Voucher Name';
Expand Down
1 change: 1 addition & 0 deletions upload/admin/language/en-gb/setting/setting.php
Expand Up @@ -52,6 +52,7 @@
$_['entry_location'] = 'Store Location';
$_['entry_country'] = 'Country';
$_['entry_zone'] = 'Region / State';
$_['entry_timezone'] = 'Time Zone';
$_['entry_language'] = 'Language';
$_['entry_admin_language'] = 'Administration Language';
$_['entry_currency'] = 'Currency';
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/model/catalog/product.php
Expand Up @@ -493,7 +493,7 @@ public function getProductAttributes($product_id) {
public function getProductOptions($product_id) {
$product_option_data = array();

$product_option_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_option` po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN `" . DB_PREFIX . "option_description` od ON (o.option_id = od.option_id) WHERE po.product_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "'");
$product_option_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_option` po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN `" . DB_PREFIX . "option_description` od ON (o.option_id = od.option_id) WHERE po.product_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.sort_order ASC");

foreach ($product_option_query->rows as $product_option) {
$product_option_value_data = array();
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/model/customer/customer.php
Expand Up @@ -231,7 +231,7 @@ public function getAddresses($customer_id) {
}

public function getTotalCustomers($data = array()) {
$sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer";
$sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer c";

$implode = array();

Expand Down
2 changes: 1 addition & 1 deletion upload/admin/model/localisation/tax_class.php
Expand Up @@ -92,7 +92,7 @@ public function getTotalTaxClasses() {
}

public function getTaxRules($tax_class_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "tax_rule WHERE tax_class_id = '" . (int)$tax_class_id . "'");
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "tax_rule WHERE tax_class_id = '" . (int)$tax_class_id . "' ORDER BY priority ASC");

return $query->rows;
}
Expand Down
68 changes: 23 additions & 45 deletions upload/admin/model/tool/backup.php
Expand Up @@ -6,63 +6,41 @@ public function getTables() {
$query = $this->db->query("SHOW TABLES FROM `" . DB_DATABASE . "`");

foreach ($query->rows as $result) {
if (utf8_substr($result['Tables_in_' . DB_DATABASE], 0, strlen(DB_PREFIX)) == DB_PREFIX) {
if (isset($result['Tables_in_' . DB_DATABASE])) {
$table_data[] = $result['Tables_in_' . DB_DATABASE];
}
$table = reset($result);
if ($table && utf8_substr($table, 0, strlen(DB_PREFIX)) == DB_PREFIX) {
$table_data[] = $table;
}
}

return $table_data;
}

public function backup($tables) {
$output = '';

foreach ($tables as $table) {
if (DB_PREFIX) {
if (strpos($table, DB_PREFIX) === false) {
$status = false;
} else {
$status = true;
}
} else {
$status = true;
}

if ($status) {
$output .= 'TRUNCATE TABLE `' . $table . '`;' . "\n\n";

$query = $this->db->query("SELECT * FROM `" . $table . "`");

foreach ($query->rows as $result) {
$fields = '';

foreach (array_keys($result) as $value) {
$fields .= '`' . $value . '`, ';
}
public function getRecords($table, $start = 0, $limit = 100) {
if ($start < 0) {
$start = 0;
}

$values = '';
if ($limit < 1) {
$limit = 10;
}

foreach (array_values($result) as $value) {
$value = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $value);
$value = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $value);
$value = str_replace('\\', '\\\\', $value);
$value = str_replace('\'', '\\\'', $value);
$value = str_replace('\\\n', '\n', $value);
$value = str_replace('\\\r', '\r', $value);
$value = str_replace('\\\t', '\t', $value);
$query = $this->db->query("SELECT * FROM `" . $table . "` LIMIT " . (int)$start . "," . (int)$limit);

$values .= '\'' . $value . '\', ';
}
if ($query->num_rows) {
return $query->rows;
} else {
return array();
}
}

$output .= 'INSERT INTO `' . $table . '` (' . preg_replace('/, $/', '', $fields) . ') VALUES (' . preg_replace('/, $/', '', $values) . ');' . "\n";
}
public function getTotalRecords($table) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . $table . "`");

$output .= "\n\n";
}
if ($query->num_rows) {
return $query->row['total'];
} else {
return 0;
}

return $output;
}
}
2 changes: 1 addition & 1 deletion upload/admin/model/user/api.php
Expand Up @@ -117,7 +117,7 @@ public function deleteApiSession($api_session_id) {
$this->db->query("DELETE FROM `" . DB_PREFIX . "api_session` WHERE api_session_id = '" . (int)$api_session_id . "'");
}

public function deleteApiSessionBySessonId($session_id) {
public function deleteApiSessionBySessionId($session_id) {
$this->db->query("DELETE FROM `" . DB_PREFIX . "api_session` WHERE session_id = '" . $this->db->escape($session_id) . "'");
}
}
12 changes: 3 additions & 9 deletions upload/admin/view/template/common/header.twig
Expand Up @@ -35,14 +35,8 @@
<div id="container">
<header id="header" class="navbar navbar-static-top">
<div class="container-fluid">


<div id="header-logo" class="navbar-header"><a href="{{ home }}" class="navbar-brand"><img src="view/image/logo.png" alt="{{ heading_title }}" title="{{ heading_title }}" /></a></div>
<a href="#" id="button-menu" class="hidden-md hidden-lg"><span class="fa fa-bars"></span></a>{% if logged %}




<ul class="nav navbar-nav navbar-right">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><img src="{{ image }}" alt="{{ firstname }} {{ lastname }}" title="{{ username }}" id="user-profile" class="img-circle" />{{ firstname }} {{ lastname }} <i class="fa fa-caret-down fa-fw"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
Expand All @@ -54,12 +48,12 @@
{% endfor %}
<li role="separator" class="divider"></li>
<li class="dropdown-header">{{ text_help }}</li>
<li><a href="http://www.opencart.com" target="_blank"><i class="fa fa-opencart fa-fw"></i> {{ text_homepage }}</a></li>
<li><a href="https://www.opencart.com" target="_blank"><i class="fa fa-opencart fa-fw"></i> {{ text_homepage }}</a></li>
<li><a href="http://docs.opencart.com" target="_blank"><i class="fa fa-file-text-o fa-fw"></i> {{ text_documentation }}</a></li>
<li><a href="http://forum.opencart.com" target="_blank"><i class="fa fa-comments-o fa-fw"></i> {{ text_support }}</a></li>
<li><a href="https://forum.opencart.com" target="_blank"><i class="fa fa-comments-o fa-fw"></i> {{ text_support }}</a></li>
</ul>
</li>
<li><a href="{{ logout }}"><i class="fa fa-sign-out"></i> <span class="hidden-xs hidden-sm hidden-md">{{ text_logout }}</span></a></li>
</ul>
{% endif %} </div>
</header>
</header>
2 changes: 0 additions & 2 deletions upload/admin/view/template/common/security.twig
Expand Up @@ -130,8 +130,6 @@ $('#modal-security select[name=\'type\']').on('change', function () {
html += '<p><strong>define(\'DIR_STORAGE\', DIR_SYSTEM . \'storage/\');</strong></p>';
html += '<p>to</p>';
html += '<p><strong>define(\'DIR_STORAGE\', \'' + $('#modal-security input[name=\'path\']').val() + $('#modal-security input[name=\'directory\']').val() + '/\');</strong></p></li>';
html += '</li>';
html += '</ol>';
$('#collapse-manual .form-control').html(html);
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/view/template/customer/customer_form.twig
Expand Up @@ -286,7 +286,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-safe">{{ entry_safe }}</label>
<label class="col-sm-2 control-label" for="input-safe"><span data-toggle="tooltip" title="{{ help_safe }}">{{ entry_safe }}</span></label>
<div class="col-sm-10">
<select name="safe" id="input-safe" class="form-control">
{% if safe %}
Expand Down
4 changes: 2 additions & 2 deletions upload/admin/view/template/customer/customer_ip.twig
Expand Up @@ -11,7 +11,7 @@
{% if ips %}
{% for ip in ips %}
<tr>
<td class="text-left"><a href="http://www.geoiptool.com/en/?IP={{ ip.ip }}" target="_blank">{{ ip.ip }}</a></td>
<td class="text-left"><a href="//whatismyipaddress.com/ip/{{ ip.ip }}" target="_blank">{{ ip.ip }}</a></td>
<td class="text-right"><a href="{{ ip.filter_ip }}" target="_blank">{{ ip.total }}</a></td>
<td class="text-left">{{ ip.date_added }}</td> </tr>
{% endfor %}
Expand All @@ -26,4 +26,4 @@
<div class="row">
<div class="col-sm-6 text-left">{{ pagination }}</div>
<div class="col-sm-6 text-right">{{ results }}</div>
</div>
</div>

0 comments on commit e33355b

Please sign in to comment.