Skip to content

Commit 01fbfeb

Browse files
author
Alexander Akimov
authored
Merge pull request #3738 from magento-tsg/2.2.8-develop-pr78
[TSG] Backporting for 2.2 (pr78) (2.2.8-develop)
2 parents ffc69d4 + 681e7ae commit 01fbfeb

File tree

193 files changed

+1205
-758
lines changed

Some content is hidden

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

193 files changed

+1205
-758
lines changed

app/code/Magento/AdminNotification/Block/Grid/Renderer/Actions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public function render(\Magento\Framework\DataObject $row)
5555

5656
$encodedUrl = $this->_urlHelper->getEncodedUrl();
5757
return sprintf(
58-
'%s%s<a class="action-delete" href="%s" onClick="deleteConfirm(\'%s\', this.href); return false;">%s</a>',
58+
'%s%s<a class="action-delete" href="%s" onclick="deleteConfirm(\'%s\', this.href, {data: {}});' .
59+
' return false;">%s</a>',
5960
$readDetailsHtml,
6061
$markAsReadHtml,
6162
$this->getUrl(

app/code/Magento/Backend/Block/System/Design/Edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function _prepareLayout()
6666
'label' => __('Delete'),
6767
'onclick' => 'deleteConfirm(\'' . __(
6868
'Are you sure?'
69-
) . '\', \'' . $this->getDeleteUrl() . '\')',
69+
) . '\', \'' . $this->getDeleteUrl() . '\', {data: {}})',
7070
'class' => 'delete'
7171
]
7272
);

app/code/Magento/Backend/Block/Widget/Form/Container.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class Container extends \Magento\Backend\Block\Widget\Container
5757

5858
/**
5959
* @return void
60+
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
6061
*/
6162
protected function _construct()
6263
{
@@ -93,7 +94,7 @@ protected function _construct()
9394
'class' => 'delete',
9495
'onclick' => 'deleteConfirm(\'' . __(
9596
'Are you sure you want to do this?'
96-
) . '\', \'' . $this->getDeleteUrl() . '\')'
97+
) . '\', \'' . $this->getDeleteUrl() . '\', {data: {}})'
9798
]
9899
);
99100
}

app/code/Magento/Backend/Controller/Adminhtml/System/Design/Delete.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ class Delete extends \Magento\Backend\Controller\Adminhtml\System\Design
1010
{
1111
/**
1212
* @return \Magento\Backend\Model\View\Result\Redirect
13+
* @throws \Magento\Framework\Exception\NotFoundException
1314
*/
1415
public function execute()
1516
{
17+
if (!$this->getRequest()->isPost()) {
18+
throw new \Magento\Framework\Exception\NotFoundException(__('Page not found.'));
19+
}
20+
1621
$id = $this->getRequest()->getParam('id');
1722
if ($id) {
1823
$design = $this->_objectManager->create(\Magento\Framework\App\DesignInterface::class)->load($id);

app/code/Magento/Captcha/Controller/Refresh/Index.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,23 @@ public function __construct(
4040
}
4141

4242
/**
43-
* {@inheritdoc}
43+
* @inheritdoc
44+
* @throws \Magento\Framework\Exception\NotFoundException
4445
*/
4546
public function execute()
4647
{
48+
if (!$this->getRequest()->isPost()) {
49+
throw new \Magento\Framework\Exception\NotFoundException(__('Page not found.'));
50+
}
51+
4752
$formId = $this->_request->getPost('formId');
4853
if (null === $formId) {
4954
$params = [];
5055
$content = $this->_request->getContent();
5156
if ($content) {
5257
$params = $this->serializer->unserialize($content);
5358
}
54-
$formId = isset($params['formId']) ? $params['formId'] : null;
59+
$formId = $params['formId'] ?? null;
5560
}
5661
$captchaModel = $this->captchaHelper->getCaptcha($formId);
5762
$captchaModel->generate();

app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public function testExecute($formId, $callsNumber)
9595
$blockMethods = ['setFormId', 'setIsAjax', 'toHtml'];
9696
$blockMock = $this->createPartialMock(\Magento\Captcha\Block\Captcha::class, $blockMethods);
9797

98+
$this->requestMock->expects($this->once())->method('isPost')->willReturn(true);
9899
$this->requestMock->expects($this->any())->method('getPost')->with('formId')->will($this->returnValue($formId));
99100
$this->requestMock->expects($this->exactly($callsNumber))->method('getContent')
100101
->will($this->returnValue(json_encode($content)));

app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/DeleteButton.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public function getButtonData()
2727
return [
2828
'id' => 'delete',
2929
'label' => __('Delete'),
30-
'on_click' => "categoryDelete('" . $this->getDeleteUrl() . "')",
30+
'on_click' => "deleteConfirm('" .__('Are you sure you want to delete this category?') ."', '"
31+
. $this->getDeleteUrl() . "', {data: {}})",
3132
'class' => 'delete',
3233
'sort_order' => 10
3334
];

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ protected function _prepareLayout()
140140
) . '\', \'' . $this->getUrl(
141141
'catalog/*/delete',
142142
['id' => $setId]
143-
) . '\')',
143+
) . '\', {data: {}})',
144144
'class' => 'delete'
145145
]
146146
);

app/code/Magento/Catalog/Controller/Adminhtml/Category/CategoriesJson.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ public function __construct(
3737
* Get tree node (Ajax version)
3838
*
3939
* @return \Magento\Framework\Controller\ResultInterface
40+
* @throws \Magento\Framework\Exception\NotFoundException
4041
*/
4142
public function execute()
4243
{
44+
if (!$this->getRequest()->isPost()) {
45+
throw new \Magento\Framework\Exception\NotFoundException(__('Page not found.'));
46+
}
47+
4348
if ($this->getRequest()->getParam('expand_all')) {
4449
$this->_objectManager->get(\Magento\Backend\Model\Auth\Session::class)->setIsTreeWasExpanded(true);
4550
} else {

app/code/Magento/Catalog/Controller/Adminhtml/Category/Delete.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@ public function __construct(
2929
* Delete category action
3030
*
3131
* @return \Magento\Backend\Model\View\Result\Redirect
32+
* @throws \Magento\Framework\Exception\NotFoundException
3233
*/
3334
public function execute()
3435
{
36+
if (!$this->getRequest()->isPost()) {
37+
throw new \Magento\Framework\Exception\NotFoundException(__('Page not found.'));
38+
}
39+
3540
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
3641
$resultRedirect = $this->resultRedirectFactory->create();
3742

0 commit comments

Comments
 (0)