Skip to content

Commit b60f8a0

Browse files
authored
Merge pull request #1700 from abantecart/1.4.0
1.4.0
2 parents 301333b + 82fbe8b commit b60f8a0

File tree

7,089 files changed

+821813
-147395
lines changed

Some content is hidden

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

7,089 files changed

+821813
-147395
lines changed

.github/workflows/test.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Integration tests
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
integration:
8+
permissions:
9+
contents: read # to clone the repos and get release assets (shivammathur/setup-php)
10+
name: Integration tests
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
php: [ '8.1', '8.2', '8.3' ]
15+
db:
16+
- ver: mysql
17+
release: '5.7'
18+
- ver: mysql
19+
release: latest
20+
- ver: mariadb
21+
release: '10.5.25'
22+
- ver: mariadb
23+
release: latest
24+
fail-fast: false
25+
26+
steps:
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php }}
31+
extensions: mbstring, gd, soap, zip, iconv, pdo_mysql
32+
tools: phpunit
33+
34+
- name: Setup MariaDB
35+
if: ${{ matrix.db.ver == 'mariadb' }}
36+
uses: getong/mariadb-action@v1.1
37+
with:
38+
mariadb version: ${{ matrix.db.release }}
39+
mysql database: 'abantecart_test_build'
40+
mysql user: 'abantecart'
41+
mysql password: 'cartsarecool'
42+
43+
- name: Setup MySQL
44+
if: ${{ matrix.db.ver == 'mysql' }}
45+
uses: mirromutth/mysql-action@v1.1
46+
with:
47+
mysql version: ${{ matrix.db.release }}
48+
mysql database: 'abantecart_test_build'
49+
mysql user: 'abantecart'
50+
mysql password: 'cartsarecool'
51+
52+
- uses: actions/checkout@v4
53+
54+
- name: Add a pause to be sure that ${{ matrix.db.ver}} is running
55+
run: to=15; until mysql -h 127.0.0.1 -u abantecart -pcartsarecool -e 'select 1' abantecart_test_build || [ $to -eq 0 ]; do sleep 1; echo not there yet - remaining $to; to=$(( to - 1 )); done; echo "ready"
56+
57+
- name: Initialize ${{ matrix.db.ver }} Database
58+
id: db-init
59+
run: php ./public_html/install/cli_install.php install --db_host=127.0.0.1 --db_user=abantecart --db_password=cartsarecool --db_name=abantecart_test_build --db_driver=amysqli --db_prefix=abc_ --admin_path=admin --username=admin --password=admin --email=dsuprunenko@abantecart.com --http_server=https://abantecart.nowhere/public_html --with-sample-data=public_html/install/abantecart_sample_data.sql --template=novator
60+
61+
- name: Run phpunit for ${{ matrix.db.ver }}
62+
run: phpunit -c tests/phpunit/phpunit_mysql.xml

.travis.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

public_html/.htaccess.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# Example: yourdomain.com/store use RewriteBase /store/
77
# Important to have / at the end of the line.
88

9-
# 4. if htaccess and mode_rewrite still does not works - check and set apache2 webserver directive AllowOverride All for your virtual hosts
9+
# 4. if htaccess and mode_rewrite still does not work - check and set apache2 webserver directive AllowOverride All for your virtual hosts
1010

11-
# For any support issues please visit: http://forum.abantecart.com
11+
# For any support issues please visit: https://forum.abantecart.com
1212

1313
Options +FollowSymlinks
1414

@@ -28,10 +28,10 @@ RewriteEngine on
2828
# To emulate Retina mode on your NON-Retina display, add HTTP_IS_RETINA cookie in your browser
2929
RewriteCond %{HTTP_COOKIE} HTTP_IS_RETINA [NC]
3030
RewriteCond %{REQUEST_FILENAME} !@2x
31-
RewriteRule ^(.*)\.(gif|jpg|jpeg|png|webp)$ $1@2x.$2
31+
RewriteRule ^(.*)\.(gif|jpg|jpeg|png|webp|avif)$ $1@2x.$2
3232
# if @2x isn't available fulfill the original request
3333
RewriteCond %{REQUEST_FILENAME} !-f
34-
RewriteRule ^(.*)@2x\.(gif|jpg|jpeg|png|webp)$ $1.$2
34+
RewriteRule ^(.*)@2x\.(gif|jpg|jpeg|png|webp|avif)$ $1.$2
3535

3636
# SEO URL Settings
3737
RewriteBase /
@@ -85,6 +85,7 @@ RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]
8585
ExpiresByType image/gif "access 1 year"
8686
ExpiresByType image/png "access 1 year"
8787
ExpiresByType image/webp "access 1 year"
88+
ExpiresByType image/avif "access 1 year"
8889
ExpiresByType text/css "access 1 month"
8990
ExpiresByType text/html "access 1 month"
9091
ExpiresByType application/pdf "access 1 month"
@@ -95,7 +96,7 @@ RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]
9596
</IfModule>
9697
<IfModule mod_headers.c>
9798
Header set Connection keep-alive
98-
<filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf|webp)$">
99+
<filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf|webp|avif)$">
99100
Header set Cache-Control "max-age=2678400, public"
100101
</filesmatch>
101102
<filesmatch "\.(html|htm)$">

public_html/admin/controller/common/ant.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,31 @@ public function main()
5050
//init controller data
5151
$this->extensions->hk_InitData($this, __FUNCTION__);
5252

53-
$url = "/index.php?option=com_antresponses&format=raw";
54-
$url .= "&store_id=".UNIQUE_ID;
55-
$url .= "&store_ip=".$_SERVER ['SERVER_ADDR'];
56-
$url .= "&store_url=".HTTP_SERVER;
57-
$url .= "&software_name=AbanteCart";
58-
$url .= "&store_version=".VERSION;
59-
$url .= "&language_code=".$this->request->cookie ['language'];
60-
//check if user login first time
53+
$httpQuery['option'] = 'com_antresponses';
54+
$httpQuery['format'] = 'raw';
55+
$httpQuery['software_name'] = 'AbanteCart';
56+
$httpQuery['store_id'] = UNIQUE_ID;
57+
$httpQuery['store_ip'] = $_SERVER ['SERVER_ADDR'];
58+
$httpQuery['store_url'] = HTTP_SERVER;
59+
$httpQuery['store_version'] = VERSION;
60+
$httpQuery['language_code'] = $this->request->cookie ['language'];
61+
62+
//check if user login first time
6163
if (!$this->user->getLastLogin()) {
62-
$url .= "&new_cart=1";
64+
$httpQuery['new_cart'] = 1;
6365
}
6466

6567
//send extension info
6668
$extensions_list = $this->extensions->getExtensionsList();
6769
if ($extensions_list) {
6870
foreach ($extensions_list->rows as $ext) {
69-
$url .= "&extension[]=".$ext ['key']."~".$ext ['version'];
71+
$httpQuery['extension'][] = $ext ['key'] . "~" . $ext ['version'];
7072
}
7173
}
7274

7375
//do connect without any http-redirects
7476
$connect = new AConnect (true);
75-
$result = $connect->getResponseSecure($url);
77+
$result = $connect->getResponseSecure("/index.php?".http_build_query($httpQuery));
7678
$this->session->data ['ant_messages'] = []; // prevent requests in future at this session
7779
// insert new messages in database
7880
if ($result && is_array($result)) {

public_html/admin/controller/common/head.php

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
<?php
2-
/** @noinspection PhpUndefinedClassInspection */
2+
/*
3+
* $Id$
4+
*
5+
* AbanteCart, Ideal OpenSource Ecommerce Solution
6+
* http://www.AbanteCart.com
7+
*
8+
* Copyright © 2011-2024 Belavier Commerce LLC
9+
*
10+
* This source file is subject to Open Software License (OSL 3.0)
11+
* License details is bundled with this package in the file LICENSE.txt.
12+
* It is also available at this URL:
13+
* <http://www.opensource.org/licenses/OSL-3.0>
14+
*
15+
* UPGRADE NOTE:
16+
* Do not edit or add to this file if you wish to upgrade AbanteCart to newer
17+
* versions in the future. If you wish to customize AbanteCart for your
18+
* needs please refer to http://www.AbanteCart.com for more information.
19+
*/
320

4-
/*------------------------------------------------------------------------------
5-
$Id$
6-
7-
AbanteCart, Ideal OpenSource Ecommerce Solution
8-
http://www.AbanteCart.com
9-
10-
Copyright © 2011-2021 Belavier Commerce LLC
11-
12-
This source file is subject to Open Software License (OSL 3.0)
13-
License details is bundled with this package in the file LICENSE.txt.
14-
It is also available at this URL:
15-
<http://www.opensource.org/licenses/OSL-3.0>
16-
17-
UPGRADE NOTE:
18-
Do not edit or add to this file if you wish to upgrade AbanteCart to newer
19-
versions in the future. If you wish to customize AbanteCart for your
20-
needs please refer to http://www.AbanteCart.com for more information.
21-
------------------------------------------------------------------------------*/
2221
if (!defined('DIR_CORE') || !IS_ADMIN) {
2322
header('Location: static_pages/');
2423
}
2524

2625
class ControllerCommonHead extends AController
2726
{
28-
public $data = [];
29-
3027
public function main()
3128
{
3229
//use to init controller data
@@ -74,6 +71,14 @@ public function main()
7471
if (HTTPS === true) {
7572
$this->data['ssl'] = 1;
7673
}
74+
/** @var ModelToolMPAPI $mdl */
75+
$mdl = $this->loadModel('tool/mp_api');
76+
$return_url = base64_encode($this->html->getSecureURL('tool/extensions_store/connect'));
77+
$mp_params = '?rt=account/authenticate&return_url='.$return_url;
78+
$mp_params .= '&store_id='.UNIQUE_ID;
79+
$mp_params .= '&store_url='.HTTP_SERVER;
80+
$mp_params .= '&store_version='.VERSION;
81+
$this->data['amp_connect_url'] = $mdl->getMPURL().$mp_params;
7782

7883
$this->view->batchAssign($this->data);
7984
$this->processTemplate('common/head.tpl');

public_html/admin/controller/common/page_layout.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class ControllerCommonPageLayout extends AController
2626

2727
private $installed_blocks = [];
2828

29+
/**
30+
* @param ALayoutManager $layout
31+
* @void
32+
* @throws AException
33+
*/
2934
public function main($layout)
3035
{
3136

@@ -141,7 +146,7 @@ private function _buildBlocks($section_id, $section_blocks)
141146
'validate_url' => $this->html->getSecureURL(
142147
'design/blocks_manager/validate_block',
143148
'&block_id='.$block['block_id']
144-
),
149+
)
145150
]
146151
);
147152

public_html/admin/controller/pages/catalog/attribute.php

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<?php
2-
/*------------------------------------------------------------------------------
3-
$Id$
4-
5-
AbanteCart, Ideal OpenSource Ecommerce Solution
6-
http://www.AbanteCart.com
7-
8-
Copyright © 2011-2022 Belavier Commerce LLC
9-
10-
This source file is subject to Open Software License (OSL 3.0)
11-
License details is bundled with this package in the file LICENSE.txt.
12-
It is also available at this URL:
13-
<http://www.opensource.org/licenses/OSL-3.0>
14-
15-
UPGRADE NOTE:
16-
Do not edit or add to this file if you wish to upgrade AbanteCart to newer
17-
versions in the future. If you wish to customize AbanteCart for your
18-
needs please refer to http://www.AbanteCart.com for more information.
19-
------------------------------------------------------------------------------*/
2+
/*
3+
* $Id$
4+
*
5+
* AbanteCart, Ideal OpenSource Ecommerce Solution
6+
* http://www.AbanteCart.com
7+
*
8+
* Copyright © 2011-2024 Belavier Commerce LLC
9+
*
10+
* This source file is subject to Open Software License (OSL 3.0)
11+
* License details is bundled with this package in the file LICENSE.txt.
12+
* It is also available at this URL:
13+
* <http://www.opensource.org/licenses/OSL-3.0>
14+
*
15+
* UPGRADE NOTE:
16+
* Do not edit or add to this file if you wish to upgrade AbanteCart to newer
17+
* versions in the future. If you wish to customize AbanteCart for your
18+
* needs please refer to http://www.AbanteCart.com for more information.
19+
*/
2020

2121
class ControllerPagesCatalogAttribute extends AController
2222
{
@@ -193,9 +193,9 @@ public function update()
193193

194194
protected function _getForm()
195195
{
196-
197196
$this->data = $attribute_type_info = [];
198-
$this->data['error'] = $this->error;
197+
$this->data['error_warning'] = implode("\n", $this->error);
198+
199199
$this->data['cancel'] = $this->html->getSecureURL('catalog/attribute');
200200
$this->data['get_attribute_type'] = $this->html->getSecureURL('r/catalog/attribute/get_attribute_type');
201201

@@ -297,13 +297,6 @@ protected function _getForm()
297297

298298
$this->_initTabs($attribute_type_id);
299299

300-
//NOTE: Future implementation ???????????
301-
/*$attribute_groups = array( '' => $this->language->get('text_select'));
302-
$results = $this->attribute_manager->getAttributeGroups(array('language_id' => $this->session->data['content_language_id']));
303-
foreach ($results as $type) {
304-
$attribute_groups[$type['attribute_group_id']] = $type['name'];
305-
}*/
306-
307300
if (!$attribute_id) {
308301
$this->data['action'] = $this->html->getSecureURL('catalog/attribute/insert', '&attribute_type_id=' . $attribute_type_id);
309302
$this->data['heading_title'] = $this->language->get('text_insert') . $this->language->get('text_attribute');
@@ -380,13 +373,6 @@ protected function _getForm()
380373
'options' => $parent_attributes,
381374
]);
382375
}
383-
//NOTE: Future implementation ????
384-
/*$this->data['form']['fields']['attribute_group'] = $form->getFieldHtml(array(
385-
'type' => 'selectbox',
386-
'name' => 'attribute_group_id',
387-
'value' => $this->data['attribute_group_id'],
388-
'options' => $attribute_groups,
389-
));*/
390376

391377
if ($this->data['attribute_types'][$attribute_type_id]['controller']) {
392378
$subform = $this->dispatch($this->data['attribute_types'][$attribute_type_id]['controller'],
@@ -407,12 +393,10 @@ protected function _getForm()
407393
$this->data['text_parent_note'] = $this->language->get('text_parent_note');
408394
$this->data['help_url'] = $this->gen_help_url('global_attributes_edit');
409395

410-
$saved_list_data = json_decode(html_entity_decode($this->request->cookie['grid_params']));
411-
if ($saved_list_data->table_id == 'attribute_grid') {
412-
$this->data['list_url'] = $this->html->getSecureURL('catalog/attribute', '&saved_list=attribute_grid');
413-
}
396+
$this->data['list_url'] = $this->html->getSecureURL('catalog/attribute', '&saved_list=attribute_grid');
414397

415398
$this->view->batchAssign($this->data);
399+
/** @see public_html/admin/view/default/template/pages/catalog/attribute_form.tpl */
416400
$this->processTemplate('pages/catalog/attribute_form.tpl');
417401
}
418402

@@ -437,8 +421,6 @@ public function validateAttributeForm()
437421
}
438422

439423
if (has_value($this->request->post['regexp_pattern'])) {
440-
//value encoded because of xss (see ARequest::clean() for details)
441-
$this->request->post['regexp_pattern'] = base64_decode($this->request->post['regexp_pattern']);
442424
$this->request->post['regexp_pattern'] = trim($this->request->post['regexp_pattern']);
443425
}
444426
if (has_value($this->request->post['placeholder'])) {
@@ -447,7 +429,11 @@ public function validateAttributeForm()
447429

448430
$this->error = array_merge(
449431
$this->error,
450-
$this->attribute_manager->validateAttributeCommonData($this->request->post)
432+
$this->attribute_manager->validateAttributeCommonData($this->request->post),
433+
$this->attribute_manager->validateAttributeValues(
434+
(int)$this->request->get_or_post('attribute_id'),
435+
(array)$this->request->post['values']
436+
)
451437
);
452438

453439
//update controller data

0 commit comments

Comments
 (0)