Skip to content

Commit 56908d5

Browse files
committed
Merge branch 'tinymce6' of github.com:fballiano/openmage into tinymce6
2 parents 938aff0 + 15c441e commit 56908d5

File tree

31 files changed

+105
-135
lines changed

31 files changed

+105
-135
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
operating-system: [ubuntu-latest]
13-
php-versions: ['7.4']
13+
php-versions: ['8.1']
1414
steps:
1515
- name: Checkout repository
1616
uses: actions/checkout@master

.github/workflows/sonar.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
max-parallel: 5
1717
matrix:
1818
os: [ubuntu-latest]
19-
php: ['7.4', '8.1']
19+
php: ['8.1', '8.2']
2020
steps:
2121
- uses: actions/checkout@v3
2222
- name: Setup PHP

.github/workflows/syntax-php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
strategy:
1616
matrix:
17-
php: ['7.4', '8.1', '8.2']
17+
php: ['8.1', '8.2']
1818

1919
name: PHP Syntax ${{ matrix.php }}
2020

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ If you see SQL errors after upgrading please remember to check for this specific
272272
- `catalog/product_image/progressive_threshold`
273273
- `catalog/search/search_separator`
274274
- `dev/log/max_level`
275-
- `newsletter/security/enable_form_key`
276275
- `sitemap/category/lastmod`
277276
- `sitemap/page/lastmod`
278277
- `sitemap/product/lastmod`

app/Mage.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@
4242

4343
Varien_Autoload::register();
4444

45+
/** AUTOLOADER PATCH **/
46+
$autoloaderPath = getenv('COMPOSER_VENDOR_PATH');
47+
if (!$autoloaderPath) {
48+
$autoloaderPath = dirname(BP) . DS . 'vendor';
49+
if (!is_dir($autoloaderPath)) {
50+
$autoloaderPath = BP . DS . 'vendor';
51+
}
52+
}
53+
require $autoloaderPath . DS . 'autoload.php';
54+
/** AUTOLOADER PATCH **/
55+
4556
/* Support additional includes, such as composer's vendor/autoload.php files */
4657
foreach (glob(BP . DS . 'app' . DS . 'etc' . DS . 'includes' . DS . '*.php') as $path) {
4758
include_once $path;

app/code/core/Mage/Adminhtml/Block/Checkout/Formkey.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,25 @@ class Mage_Adminhtml_Block_Checkout_Formkey extends Mage_Adminhtml_Block_Templat
2929
*/
3030
public function canShow()
3131
{
32-
return !Mage::getStoreConfigFlag('admin/security/validate_formkey_checkout');
32+
return !Mage::helper('core')->isFormKeyEnabled();
3333
}
3434

3535
/**
3636
* Get url for edit Advanced -> Admin section
3737
*
3838
* @return string
39+
* @deprecated
3940
*/
4041
public function getSecurityAdminUrl()
4142
{
4243
return Mage::helper("adminhtml")->getUrl('adminhtml/system_config/edit/section/admin');
4344
}
45+
46+
/**
47+
* @return string
48+
*/
49+
public function getEnableCSRFUrl()
50+
{
51+
return Mage::helper("adminhtml")->getUrl('adminhtml/system_config/edit/section/system');
52+
}
4453
}

app/code/core/Mage/Captcha/Model/Zend.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Mage_Captcha_Model_Zend extends Zend_Captcha_Image implements Mage_Captcha
6464
/**
6565
* Generated word
6666
*
67-
* @var string|null
67+
* @var string
6868
*/
6969
protected $_word;
7070

@@ -483,7 +483,7 @@ protected function _setWord($word)
483483
protected function _clearWord()
484484
{
485485
$this->getSession()->unsetData($this->_getFormIdKey(self::SESSION_WORD));
486-
$this->_word = null;
486+
$this->_word = '';
487487
return $this;
488488
}
489489

app/code/core/Mage/Catalog/Helper/Image.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,13 +564,18 @@ protected function getImageFile()
564564
*/
565565
protected function parseSize($string)
566566
{
567+
if ($string === null) {
568+
return false;
569+
}
570+
567571
$size = explode('x', strtolower($string));
568572
if (count($size) === 2) {
569573
return [
570574
'width' => ($size[0] > 0) ? $size[0] : null,
571575
'heigth' => ($size[1] > 0) ? $size[1] : null,
572576
];
573577
}
578+
574579
return false;
575580
}
576581

app/code/core/Mage/Checkout/controllers/MultishippingController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function addressesPostAction()
227227
return;
228228
}
229229

230-
if ($this->isFormkeyValidationOnCheckoutEnabled() && !$this->_validateFormKey()) {
230+
if (!$this->_validateFormKey()) {
231231
$this->_redirect('*/*/addresses');
232232
return;
233233
}
@@ -348,7 +348,7 @@ public function backToShippingAction()
348348
*/
349349
public function shippingPostAction()
350350
{
351-
if ($this->isFormkeyValidationOnCheckoutEnabled() && !$this->_validateFormKey()) {
351+
if (!$this->_validateFormKey()) {
352352
$this->_redirect('*/*/shipping');
353353
return;
354354
}
@@ -461,7 +461,7 @@ public function overviewAction()
461461
return $this;
462462
}
463463

464-
if ($this->isFormkeyValidationOnCheckoutEnabled() && !$this->_validateFormKey()) {
464+
if (!$this->_validateFormKey()) {
465465
$this->_redirect('*/*/billing');
466466
return;
467467
}

app/code/core/Mage/Checkout/controllers/OnepageController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public function saveBillingAction()
354354
return;
355355
}
356356

357-
if ($this->isFormkeyValidationOnCheckoutEnabled() && !$this->_validateFormKey()) {
357+
if (!$this->_validateFormKey()) {
358358
return;
359359
}
360360

@@ -401,7 +401,7 @@ public function saveShippingAction()
401401
return;
402402
}
403403

404-
if ($this->isFormkeyValidationOnCheckoutEnabled() && !$this->_validateFormKey()) {
404+
if (!$this->_validateFormKey()) {
405405
return;
406406
}
407407

@@ -430,7 +430,7 @@ public function saveShippingMethodAction()
430430
return;
431431
}
432432

433-
if ($this->isFormkeyValidationOnCheckoutEnabled() && !$this->_validateFormKey()) {
433+
if (!$this->_validateFormKey()) {
434434
return;
435435
}
436436

@@ -470,7 +470,7 @@ public function savePaymentAction()
470470
return;
471471
}
472472

473-
if ($this->isFormkeyValidationOnCheckoutEnabled() && !$this->_validateFormKey()) {
473+
if (!$this->_validateFormKey()) {
474474
return;
475475
}
476476

@@ -553,7 +553,7 @@ protected function _initInvoice()
553553
*/
554554
public function saveOrderAction()
555555
{
556-
if ($this->isFormkeyValidationOnCheckoutEnabled() && !$this->_validateFormKey()) {
556+
if (!$this->_validateFormKey()) {
557557
$this->_redirect('*/*');
558558
return;
559559
}

app/code/core/Mage/Checkout/etc/system.xml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -215,23 +215,5 @@
215215
</payment_failed>
216216
</groups>
217217
</checkout>
218-
<admin>
219-
<groups>
220-
<security>
221-
<fields>
222-
<validate_formkey_checkout translate="label">
223-
<label>Enable Form Key Validation On Checkout</label>
224-
<frontend_type>select</frontend_type>
225-
<source_model>adminhtml/system_config_source_yesno</source_model>
226-
<sort_order>4</sort_order>
227-
<comment><![CDATA[<strong style="color:red">Important!</strong> Enabling this option means
228-
that your custom templates used in checkout process contain form_key output.
229-
Otherwise checkout may not work.]]></comment>
230-
<show_in_default>1</show_in_default>
231-
</validate_formkey_checkout>
232-
</fields>
233-
</security>
234-
</groups>
235-
</admin>
236218
</sections>
237219
</config>

app/code/core/Mage/Checkout/sql/checkout_setup/install-1.6.0.0.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -779,12 +779,4 @@
779779
}
780780
}
781781

782-
$setup->insert(
783-
$this->getTable('core_config_data'),
784-
[
785-
'path' => 'admin/security/validate_formkey_checkout',
786-
'value' => '1'
787-
]
788-
);
789-
790782
$installer->endSetup();

app/code/core/Mage/Core/Controller/Front/Action.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,18 @@ protected function _validateFormKey()
177177
*/
178178
protected function _isFormKeyEnabled()
179179
{
180-
return Mage::getStoreConfigFlag(self::XML_CSRF_USE_FLAG_CONFIG_PATH);
180+
return Mage::helper('core')->isFormKeyEnabled();
181181
}
182182

183183
/**
184184
* Check if form_key validation enabled on checkout process
185185
*
186+
* @deprecated
187+
* @see _isFormKeyEnabled
186188
* @return bool
187189
*/
188190
protected function isFormkeyValidationOnCheckoutEnabled()
189191
{
190-
return Mage::getStoreConfigFlag('admin/security/validate_formkey_checkout');
192+
return $this->_isFormKeyEnabled();
191193
}
192194
}

app/code/core/Mage/Core/Controller/Varien/Action.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ protected function _filterDates($array, $dateFields)
994994
]);
995995

996996
foreach ($dateFields as $dateField) {
997-
if (array_key_exists($dateField, $array) && !empty($dateField)) {
997+
if ($dateField && !empty($array[$dateField])) {
998998
$array[$dateField] = $filterInput->filter($array[$dateField]);
999999
$array[$dateField] = $filterInternal->filter($array[$dateField]);
10001000
}

app/code/core/Mage/Core/Helper/Data.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,4 +1000,12 @@ public function unEscapeCSVData($data)
10001000
}
10011001
return $data;
10021002
}
1003+
1004+
/**
1005+
* @return bool
1006+
*/
1007+
public function isFormKeyEnabled(): bool
1008+
{
1009+
return Mage::getStoreConfigFlag(Mage_Core_Controller_Front_Action::XML_CSRF_USE_FLAG_CONFIG_PATH);
1010+
}
10031011
}

app/code/core/Mage/Eav/Model/Adminhtml/System/Config/Source/Inputtype/Validator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class Mage_Eav_Model_Adminhtml_System_Config_Source_Inputtype_Validator extends Zend_Validate_InArray
2323
{
2424
/**
25-
* @var array<string, string>|null
25+
* @inheritdoc
2626
*/
2727
protected $_messageTemplates;
2828

@@ -34,7 +34,7 @@ public function __construct()
3434
$haystack = $helper->getInputTypesValidatorData();
3535

3636
//reset message template and set custom
37-
$this->_messageTemplates = null;
37+
$this->_messageTemplates = [];
3838
$this->_initMessageTemplates();
3939

4040
//parent construct with options

app/code/core/Mage/Newsletter/controllers/SubscriberController.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
*/
2222
class Mage_Newsletter_SubscriberController extends Mage_Core_Controller_Front_Action
2323
{
24-
/**
25-
* Use CSRF validation flag from newsletter config
26-
*/
27-
public const XML_CSRF_USE_FLAG_CONFIG_PATH = 'newsletter/security/enable_form_key';
28-
2924
/**
3025
* New subscription action
3126
*/
@@ -127,14 +122,4 @@ public function unsubscribeAction()
127122
}
128123
$this->_redirectReferer();
129124
}
130-
131-
/**
132-
* Check if form key validation is enabled in newsletter config.
133-
*
134-
* @return bool
135-
*/
136-
protected function _isFormKeyEnabled()
137-
{
138-
return Mage::getStoreConfigFlag(self::XML_CSRF_USE_FLAG_CONFIG_PATH);
139-
}
140125
}

app/code/core/Mage/Newsletter/etc/config.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,6 @@
185185
<sending>
186186
<set_return_path>0</set_return_path>
187187
</sending>
188-
<security>
189-
<enable_form_key>0</enable_form_key>
190-
</security>
191188
</newsletter>
192189
</default>
193190
<crontab>

app/code/core/Mage/Newsletter/etc/system.xml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,6 @@
105105
</un_email_template>
106106
</fields>
107107
</subscription>
108-
<security translate="label">
109-
<label>Security</label>
110-
<sort_order>1</sort_order>
111-
<show_in_default>1</show_in_default>
112-
<show_in_website>1</show_in_website>
113-
<show_in_store>1</show_in_store>
114-
<fields>
115-
<enable_form_key translate="label comment">
116-
<label>Enable Form Key Validation</label>
117-
<frontend_type>select</frontend_type>
118-
<source_model>adminhtml/system_config_source_yesno</source_model>
119-
<sort_order>1</sort_order>
120-
<show_in_default>1</show_in_default>
121-
<show_in_website>1</show_in_website>
122-
<show_in_store>1</show_in_store>
123-
<comment><![CDATA[<strong style="color:red">Important!</strong> Enabling this option means that your custom templates used for newsletter subscription must contain <code>form_key</code> block output. Otherwise newsletter subscription will not work.]]></comment>
124-
</enable_form_key>
125-
</fields>
126-
</security>
127108
</groups>
128109
</newsletter>
129110
</sections>

0 commit comments

Comments
 (0)