|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license GPLv3, http://www.gnu.org/copyleft/gpl.html |
|
5
|
|
|
* @copyright Metaways Infosystems GmbH, 2012 |
|
6
|
|
|
* @copyright Aimeos (aimeos.org), 2014-2016 |
|
7
|
|
|
* @package TYPO3 |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
namespace Aimeos\Aimeos\Controller; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
use Aimeos\Aimeos\Base; |
|
15
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Aimeos catalog controller. |
|
20
|
|
|
* |
|
21
|
|
|
* @package TYPO3 |
|
22
|
|
|
*/ |
|
23
|
|
|
class CatalogController extends AbstractController |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* Renders the catalog attribute section. |
|
27
|
|
|
*/ |
|
28
|
|
|
public function attributeAction() |
|
29
|
|
|
{ |
|
30
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/attribute'); |
|
31
|
|
|
return $this->getClientOutput($client); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Renders the catalog counts. |
|
37
|
|
|
*/ |
|
38
|
|
|
public function countAction() |
|
39
|
|
|
{ |
|
40
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/count'); |
|
41
|
|
|
|
|
42
|
|
|
if (!isset($this->responseFactory)) { // TYPO3 10 |
|
43
|
|
|
return $this->getClientOutput($client); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
$client->setView($this->context()->view())->init(); |
|
47
|
|
|
|
|
48
|
|
|
return $this->responseFactory->createResponse() |
|
49
|
|
|
->withAddedHeader('Content-Type', 'application/javascript') |
|
50
|
|
|
->withAddedHeader('Cache-Control', 'public, max-age=300') |
|
51
|
|
|
->withBody($this->streamFactory->createStream((string) $client->body())); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Renders the catalog detail section. |
|
57
|
|
|
*/ |
|
58
|
|
|
public function detailAction() |
|
59
|
|
|
{ |
|
60
|
|
|
try { |
|
61
|
|
|
$this->removeMetatags(); |
|
62
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/detail'); |
|
63
|
|
|
return $this->getClientOutput($client); |
|
64
|
|
|
} catch(\Exception $e) { |
|
65
|
|
|
$this->exception($e); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Renders the catalog filter section. |
|
72
|
|
|
*/ |
|
73
|
|
|
public function filterAction() |
|
74
|
|
|
{ |
|
75
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/filter'); |
|
76
|
|
|
return $this->getClientOutput($client); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Renders the catalog home. |
|
82
|
|
|
*/ |
|
83
|
|
|
public function homeAction() |
|
84
|
|
|
{ |
|
85
|
|
|
$this->removeMetatags(); |
|
86
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/home'); |
|
87
|
|
|
return $this->getClientOutput($client); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* Renders the catalog list section. |
|
93
|
|
|
*/ |
|
94
|
|
|
public function listAction() |
|
95
|
|
|
{ |
|
96
|
|
|
$this->removeMetatags(); |
|
97
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/lists'); |
|
98
|
|
|
return $this->getClientOutput($client); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Renders the catalog price section. |
|
104
|
|
|
*/ |
|
105
|
|
|
public function priceAction() |
|
106
|
|
|
{ |
|
107
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/price'); |
|
108
|
|
|
return $this->getClientOutput($client); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Renders the catalog search section. |
|
114
|
|
|
*/ |
|
115
|
|
|
public function searchAction() |
|
116
|
|
|
{ |
|
117
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/search'); |
|
118
|
|
|
return $this->getClientOutput($client); |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* Renders the user session related catalog section. |
|
124
|
|
|
*/ |
|
125
|
|
|
public function sessionAction() |
|
126
|
|
|
{ |
|
127
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/session'); |
|
128
|
|
|
return $this->getClientOutput($client); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* Renders the catalog stage section. |
|
134
|
|
|
*/ |
|
135
|
|
|
public function stageAction() |
|
136
|
|
|
{ |
|
137
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/stage'); |
|
138
|
|
|
return $this->getClientOutput($client); |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* Renders the catalog stock section. |
|
144
|
|
|
*/ |
|
145
|
|
|
public function stockAction() |
|
146
|
|
|
{ |
|
147
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/stock'); |
|
148
|
|
|
|
|
149
|
|
|
if (!isset($this->responseFactory)) { // TYPO3 10 |
|
150
|
|
|
return $this->getClientOutput($client); |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
$client->setView($this->context()->view())->init(); |
|
154
|
|
|
|
|
155
|
|
|
return $this->responseFactory->createResponse() |
|
156
|
|
|
->withAddedHeader('Content-Type', 'application/javascript') |
|
157
|
|
|
->withAddedHeader('Cache-Control', 'public, max-age=300') |
|
158
|
|
|
->withBody($this->streamFactory->createStream((string) $client->body())); |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* Renders a list of product names in JSON format. |
|
164
|
|
|
*/ |
|
165
|
|
|
public function suggestAction() |
|
166
|
|
|
{ |
|
167
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/suggest'); |
|
168
|
|
|
|
|
169
|
|
|
if (!isset($this->responseFactory)) { // TYPO3 10 |
|
170
|
|
|
return $this->getClientOutput($client); |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
$client->setView($this->context()->view())->init(); |
|
174
|
|
|
|
|
175
|
|
|
return $this->responseFactory->createResponse() |
|
176
|
|
|
->withAddedHeader('Content-Type', 'application/json') |
|
177
|
|
|
->withAddedHeader('Cache-Control', 'public, max-age=300') |
|
178
|
|
|
->withBody($this->streamFactory->createStream((string) $client->body())); |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* Renders the catalog supplier section. |
|
184
|
|
|
*/ |
|
185
|
|
|
public function supplierAction() |
|
186
|
|
|
{ |
|
187
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/supplier'); |
|
188
|
|
|
return $this->getClientOutput($client); |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* Renders the catalog tree section. |
|
194
|
|
|
*/ |
|
195
|
|
|
public function treeAction() |
|
196
|
|
|
{ |
|
197
|
|
|
try { |
|
198
|
|
|
$client = \Aimeos\Client\Html::create($this->context(), 'catalog/tree'); |
|
199
|
|
|
return $this->getClientOutput($client); |
|
200
|
|
|
} catch(\Exception $e) { |
|
201
|
|
|
$this->exception($e); |
|
202
|
|
|
} |
|
203
|
|
|
} |
|
204
|
|
|
|
|
205
|
|
|
|
|
206
|
|
|
/** |
|
207
|
|
|
* Handles exceptions |
|
208
|
|
|
* |
|
209
|
|
|
* @param \Exception $e Caught exception |
|
210
|
|
|
* @throws \Exception Thrown exception |
|
211
|
|
|
*/ |
|
212
|
|
|
protected function exception(\Exception $e) |
|
213
|
|
|
{ |
|
214
|
|
|
if ($e->getCode() > 400) { |
|
215
|
|
|
$name = \TYPO3\CMS\Frontend\Controller\ErrorController::class; |
|
|
|
|
|
|
216
|
|
|
|
|
217
|
|
|
$response = GeneralUtility::makeInstance($name)->pageNotFoundAction( |
|
218
|
|
|
$this->request, $e->getMessage(), ['code' => $e->getCode()] |
|
219
|
|
|
); |
|
220
|
|
|
throw new \TYPO3\CMS\Core\Http\ImmediateResponseException($response); |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
throw $e; |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
|
|
227
|
|
|
/** |
|
228
|
|
|
* Removes the meta tags if available |
|
229
|
|
|
*/ |
|
230
|
|
|
protected function removeMetatags() |
|
231
|
|
|
{ |
|
232
|
|
|
if (is_object($GLOBALS['TSFE']) && isset($GLOBALS['TSFE']->config['config'])) { |
|
233
|
|
|
$GLOBALS['TSFE']->config['config']['disableCanonical'] = true; |
|
234
|
|
|
$GLOBALS['TSFE']->config['config']['noPageTitle'] = 2; |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
if (class_exists('\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry') |
|
238
|
|
|
&& !\Aimeos\Aimeos\Base::getExtConfig('typo3Metatags', true) |
|
239
|
|
|
) { |
|
240
|
|
|
$registry = GeneralUtility::makeInstance('TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry'); |
|
241
|
|
|
|
|
242
|
|
|
$registry->getManagerForProperty('keywords')->removeProperty('keywords'); |
|
243
|
|
|
$registry->getManagerForProperty('description')->removeProperty('description'); |
|
244
|
|
|
$registry->getManagerForProperty('og:type')->removeProperty('og:type'); |
|
245
|
|
|
$registry->getManagerForProperty('og:title')->removeProperty('og:title'); |
|
246
|
|
|
$registry->getManagerForProperty('og:url')->removeProperty('og:url'); |
|
247
|
|
|
$registry->getManagerForProperty('og:description')->removeProperty('og:description'); |
|
248
|
|
|
$registry->getManagerForProperty('og:image')->removeProperty('og:image'); |
|
249
|
|
|
$registry->getManagerForProperty('twitter:card')->removeProperty('twitter:card'); |
|
250
|
|
|
} |
|
251
|
|
|
} |
|
252
|
|
|
} |
|
253
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths