Skip to content

Commit 566bfb6

Browse files
authored
Merge pull request #1463 from abantecart/1.3.0
1.3.0
2 parents 0ceacff + 69b7a63 commit 566bfb6

File tree

839 files changed

+188194
-49602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

839 files changed

+188194
-49602
lines changed

public_html/admin/controller/api/common/access.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
AbanteCart, Ideal OpenSource Ecommerce Solution
66
http://www.AbanteCart.com
77
8-
Copyright 2011-2020 Belavier Commerce LLC
8+
Copyright 2011-2021 Belavier Commerce LLC
99
1010
This source file is subject to Open Software License (OSL 3.0)
1111
License details is bundled with this package in the file LICENSE.txt.
@@ -65,6 +65,10 @@ public function login()
6565
//allow access to listed controllers with no login
6666
if (isset($request['rt']) && !isset($request['token'])) {
6767
$route = '';
68+
//remove controller type prefixes
69+
$request['rt'] = ltrim($request['rt'], 'a/');
70+
$request['rt'] = ltrim($request['rt'], 'r/');
71+
$request['rt'] = ltrim($request['rt'], 'p/');
6872
$part = explode('/', $request['rt']);
6973

7074
if (isset($part[0])) {
@@ -73,13 +77,13 @@ public function login()
7377
if (isset($part[1])) {
7478
$route .= '/'.$part[1];
7579
}
76-
$ignore = array(
80+
$ignore = [
7781
'api/index/login',
7882
'api/common/access',
7983
'api/error/not_found',
8084
'api/error/no_access',
8185
'api/error/no_permission',
82-
);
86+
];
8387

8488
if (!in_array($route, $ignore)) {
8589
return $this->dispatch('api/index/login');
@@ -89,6 +93,7 @@ public function login()
8993
return $this->dispatch('api/index/login');
9094
}
9195
}
96+
return null;
9297
}
9398

9499
public function permission()
@@ -101,6 +106,10 @@ public function permission()
101106

102107
if (isset($request['rt'])) {
103108
$route = '';
109+
//remove controller type prefixes
110+
$request['rt'] = ltrim($request['rt'], 'a/');
111+
$request['rt'] = ltrim($request['rt'], 'r/');
112+
$request['rt'] = ltrim($request['rt'], 'p/');
104113
$part = explode('/', $request['rt']);
105114

106115
if (isset($part[0])) {
@@ -109,13 +118,13 @@ public function permission()
109118
if (isset($part[1])) {
110119
$route .= '/'.$part[1];
111120
}
112-
$ignore = array(
121+
$ignore = [
113122
'api/index/login',
114123
'api/common/access',
115124
'api/error/not_found',
116125
'api/error/no_access',
117126
'api/error/no_permission',
118-
);
127+
];
119128

120129
if (!in_array($route, $ignore)) {
121130
if (!$this->user->canAccess($route)) {

public_html/admin/controller/common/ant.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?php
2+
23
/*------------------------------------------------------------------------------
34
$Id$
45
56
AbanteCart, Ideal OpenSource Ecommerce Solution
67
http://www.AbanteCart.com
78
8-
Copyright © 2011-2020 Belavier Commerce LLC
9+
Copyright © 2011-2021 Belavier Commerce LLC
910
1011
This source file is subject to Open Software License (OSL 3.0)
1112
License details is bundled with this package in the file LICENSE.txt.
@@ -30,9 +31,8 @@ class ControllerCommonANT extends AController
3031

3132
public function main()
3233
{
33-
3434
// disable for login-logout pages
35-
if (in_array($this->request->get['rt'], array('index/logout', 'index/login'))) {
35+
if (in_array($this->request->get['rt'], ['index/logout', 'index/login'])) {
3636
unset($this->session->data['ant_messages']);
3737
return null;
3838
}
@@ -42,8 +42,9 @@ public function main()
4242
}
4343

4444
// prevent repeats of requests or if last update older then 24hours
45-
if (has_value($this->session->data['ant_messages']) && (time() - $this->session->data['ant_messages']['date_modified'] < 86400)) {
46-
return null;
45+
if (has_value($this->session->data['ant_messages'])
46+
&& (time() - $this->session->data['ant_messages']['date_modified'] < 86400)) {
47+
return null;
4748
}
4849

4950
//init controller data
@@ -70,13 +71,13 @@ public function main()
7071
}
7172

7273
//do connect without any http-redirects
73-
$connect = new AConnect (true, true);
74+
$connect = new AConnect (true);
7475
$result = $connect->getResponseSecure($url);
75-
$this->session->data ['ant_messages'] = array(); // prevent requests in future at this session
76+
$this->session->data ['ant_messages'] = []; // prevent requests in future at this session
7677
// insert new messages in database
7778
if ($result && is_array($result)) {
7879
//set array for check response
79-
$check_array = array(
80+
$check_array = [
8081
'message_id',
8182
'type',
8283
'date_added',
@@ -92,10 +93,10 @@ public function main()
9293
'url',
9394
'published',
9495
'language_code',
95-
);
96-
$banners = array();
96+
];
97+
$banners = [];
9798
foreach ($result as $notify) {
98-
$tmp = array();
99+
$tmp = [];
99100
foreach ($notify as $key => $value) {
100101
if (!in_array($key, $check_array)) {
101102
continue;
@@ -128,6 +129,6 @@ public function main()
128129

129130
// check for extensions updates
130131
$this->loadModel('tool/updater');
131-
$this->model_tool_updater->check4updates();
132+
$this->model_tool_updater->check4updates(true);
132133
}
133134
}

public_html/admin/controller/common/footer.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?php
2+
23
/*------------------------------------------------------------------------------
34
$Id$
45
56
AbanteCart, Ideal OpenSource Ecommerce Solution
67
http://www.AbanteCart.com
78
8-
Copyright © 2011-2020 Belavier Commerce LLC
9+
Copyright © 2011-2021 Belavier Commerce LLC
910
1011
This source file is subject to Open Software License (OSL 3.0)
1112
License details is bundled with this package in the file LICENSE.txt.
@@ -25,12 +26,11 @@ class ControllerCommonFooter extends AController
2526
{
2627
public function main()
2728
{
28-
2929
//init controller data
3030
$this->extensions->hk_InitData($this, __FUNCTION__);
3131
$this->loadLanguage('common/header');
3232

33-
$menu = new AMenu('admin', 'menu');
33+
$menu = new AMenu('admin');
3434
$documentation = $menu->getMenuItem('documentation');
3535
$support = $menu->getMenuItem('support');
3636
$mp = $menu->getMenuItem('marketplace');
@@ -46,17 +46,27 @@ public function main()
4646
$this->view->assign('text_footer_left', sprintf($this->language->get('text_footer_left'), date('Y')));
4747
$this->view->assign('text_footer', sprintf($this->language->get('text_footer'), date('Y')).' '.VERSION);
4848

49-
if (!$this->user->isLogged() || !isset($this->request->get['token']) || !isset($this->session->data['token']) || ($this->request->get['token'] != $this->session->data['token'])) {
49+
if (!$this->user->isLogged()
50+
|| !isset($this->request->get['token'])
51+
|| !isset($this->session->data['token'])
52+
|| ($this->request->get['token'] != $this->session->data['token'])
53+
) {
5054
$this->view->assign('logged', '');
5155
$this->view->assign('home', $this->html->getSecureURL('index/login', '', true));
5256
} else {
5357
$this->view->assign('logged', sprintf($this->language->get('text_logged'), $this->user->getUserName()));
5458
$this->view->assign('avatar', $this->user->getAvatar());
5559
$this->view->assign('username', $this->user->getUserName());
5660
if ($this->user->getLastLogin()) {
57-
$this->view->assign('last_login', sprintf($this->language->get('text_last_login'), $this->user->getLastLogin()));
61+
$this->view->assign(
62+
'last_login',
63+
sprintf($this->language->get('text_last_login'), $this->user->getLastLogin())
64+
);
5865
} else {
59-
$this->view->assign('last_login', sprintf($this->language->get('text_welcome'), $this->user->getUserName()));
66+
$this->view->assign(
67+
'last_login',
68+
sprintf($this->language->get('text_welcome'), $this->user->getUserName())
69+
);
6070
}
6171
$this->view->assign('account_edit', $this->html->getSecureURL('index/edit_details', '', true));
6272
}

public_html/admin/controller/common/head.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
2+
/** @noinspection PhpUndefinedClassInspection */
3+
24
/*------------------------------------------------------------------------------
35
$Id$
46
57
AbanteCart, Ideal OpenSource Ecommerce Solution
68
http://www.AbanteCart.com
79
8-
Copyright © 2011-2020 Belavier Commerce LLC
10+
Copyright © 2011-2021 Belavier Commerce LLC
911
1012
This source file is subject to Open Software License (OSL 3.0)
1113
License details is bundled with this package in the file LICENSE.txt.
@@ -21,13 +23,12 @@
2123
header('Location: static_pages/');
2224
}
2325

24-
class ControllerCommonHead extends AController
26+
class ControllerCommonHead extends AController
2527
{
26-
public $data = array();
28+
public $data = [];
2729

2830
public function main()
2931
{
30-
3132
//use to init controller data
3233
$this->extensions->hk_InitData($this, __FUNCTION__);
3334

@@ -51,21 +52,26 @@ public function main()
5152
$retina = $this->config->get('config_retina_enable');
5253
$this->data['retina'] = $retina;
5354
//remove cookie for retina
54-
if (!$retina) {
55+
if (!$retina && isset($this->request->cookie['HTTP_IS_RETINA'])) {
5556
$this->request->deleteCookie('HTTP_IS_RETINA');
5657
}
5758

5859
$this->data['message_manager_url'] = $message_link;
5960

60-
if ($this->session->data['checkupdates']) {
61+
if ($this->session->data['checkupdates'] ?? false) {
6162
$this->data['check_updates_url'] = $this->html->getSecureURL('r/common/common/checkUpdates');
6263
}
64+
if (is_numeric($this->config->get('config_icon'))) {
65+
$r = new AResource('image');
66+
$resourceInfo = $r->getResource($this->config->get('config_icon'), $this->language->getLanguageID());
67+
if ($resourceInfo) {
68+
$this->data['icon'] = $resourceInfo['type_dir'].$resourceInfo['resource_path'];
69+
}
70+
} else {
71+
$this->data['icon'] = $this->config->get('config_icon');
72+
}
6373

64-
$this->data['icon'] = $this->config->get('config_icon');
65-
66-
if (isset($this->request->server['HTTPS'])
67-
&& (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))
68-
) {
74+
if (HTTPS === true) {
6975
$this->data['ssl'] = 1;
7076
}
7177

0 commit comments

Comments
 (0)