|
@@ -29,33 +29,33 @@ discard block |
|
|
block discarded – undo |
|
29
|
29
|
* @param \Aimeos\Base\Config\Iface Configuration object |
|
30
|
30
|
* @return \Aimeos\MShop\ContextIface Context object |
|
31
|
31
|
*/ |
|
32
|
|
- public static function get(\Aimeos\Base\Config\Iface $config) : \Aimeos\MShop\ContextIface |
|
|
32
|
+ public static function get( \Aimeos\Base\Config\Iface $config ) : \Aimeos\MShop\ContextIface |
|
33
|
33
|
{ |
|
34
|
|
- if (self::$context === null) { |
|
|
34
|
+ if( self::$context === null ) { |
|
35
|
35
|
// TYPO3 specifc context with password hasher |
|
36
|
36
|
$context = new \Aimeos\MShop\Context\Item\Typo3(); |
|
37
|
|
- $context->setConfig($config); |
|
38
|
|
- |
|
39
|
|
- self::addDataBaseManager($context); |
|
40
|
|
- self::addFilesystemManager($context); |
|
41
|
|
- self::addMessageQueueManager($context); |
|
42
|
|
- self::addLogger($context); |
|
43
|
|
- self::addCache($context); |
|
44
|
|
- self::addMailer($context); |
|
45
|
|
- self::addNonce($context); |
|
46
|
|
- self::addProcess($context); |
|
47
|
|
- self::addSession($context); |
|
48
|
|
- self::addHasher($context); |
|
49
|
|
- self::addToken($context); |
|
50
|
|
- self::addUser($context); |
|
51
|
|
- self::addGroups($context); |
|
52
|
|
- self::addDateTime($context); |
|
|
37
|
+ $context->setConfig( $config ); |
|
|
38
|
+ |
|
|
39
|
+ self::addDataBaseManager( $context ); |
|
|
40
|
+ self::addFilesystemManager( $context ); |
|
|
41
|
+ self::addMessageQueueManager( $context ); |
|
|
42
|
+ self::addLogger( $context ); |
|
|
43
|
+ self::addCache( $context ); |
|
|
44
|
+ self::addMailer( $context ); |
|
|
45
|
+ self::addNonce( $context ); |
|
|
46
|
+ self::addProcess( $context ); |
|
|
47
|
+ self::addSession( $context ); |
|
|
48
|
+ self::addHasher( $context ); |
|
|
49
|
+ self::addToken( $context ); |
|
|
50
|
+ self::addUser( $context ); |
|
|
51
|
+ self::addGroups( $context ); |
|
|
52
|
+ self::addDateTime( $context ); |
|
53
|
53
|
|
|
54
|
54
|
self::$context = $context; |
|
55
|
55
|
} |
|
56
|
56
|
|
|
57
|
57
|
// Use local TS configuration from plugins |
|
58
|
|
- self::$context->setConfig($config); |
|
|
58
|
+ self::$context->setConfig( $config ); |
|
59
|
59
|
|
|
60
|
60
|
return self::$context; |
|
61
|
61
|
} |
|
@@ -67,35 +67,35 @@ discard block |
|
|
block discarded – undo |
|
67
|
67
|
* @param \Aimeos\MShop\ContextIface $context Context object including config |
|
68
|
68
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
69
|
69
|
*/ |
|
70
|
|
- protected static function addCache(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
70
|
+ protected static function addCache( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
71
|
71
|
{ |
|
72
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache']) |
|
73
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache'])) |
|
|
72
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache'] ) |
|
|
73
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache'] ) ) |
|
74
|
74
|
) { |
|
75
|
|
- return $fcn($context); |
|
|
75
|
+ return $fcn( $context ); |
|
76
|
76
|
} |
|
77
|
77
|
|
|
78
|
|
- $cacheName = \Aimeos\Aimeos\Base::getExtConfig('cacheName', 'Typo3'); |
|
79
|
|
- if (isset($GLOBALS['TSFE']) && $GLOBALS['TSFE']->headerNoCache()) { |
|
|
78
|
+ $cacheName = \Aimeos\Aimeos\Base::getExtConfig( 'cacheName', 'Typo3' ); |
|
|
79
|
+ if( isset( $GLOBALS['TSFE'] ) && $GLOBALS['TSFE']->headerNoCache() ) { |
|
80
|
80
|
$cacheName = 'None'; |
|
81
|
81
|
} |
|
82
|
82
|
|
|
83
|
|
- switch ($cacheName) { |
|
|
83
|
+ switch( $cacheName ) { |
|
84
|
84
|
case 'None': |
|
85
|
|
- $context->config()->set('client/html/basket/cache/enable', false); |
|
86
|
|
- $cache = \Aimeos\Base\Cache\Factory::create('None', [], null); |
|
|
85
|
+ $context->config()->set( 'client/html/basket/cache/enable', false ); |
|
|
86
|
+ $cache = \Aimeos\Base\Cache\Factory::create( 'None', [], null ); |
|
87
|
87
|
break; |
|
88
|
88
|
|
|
89
|
89
|
case 'Typo3': |
|
90
|
|
- $manager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class); |
|
91
|
|
- $cache = (new \Aimeos\MAdmin\Cache\Manager\Typo3($context, $manager->getCache('aimeos')))->getCache(); |
|
|
90
|
+ $manager = GeneralUtility::makeInstance( \TYPO3\CMS\Core\Cache\CacheManager::class ); |
|
|
91
|
+ $cache = ( new \Aimeos\MAdmin\Cache\Manager\Typo3( $context, $manager->getCache( 'aimeos' ) ) )->getCache(); |
|
92
|
92
|
break; |
|
93
|
93
|
|
|
94
|
94
|
default: |
|
95
|
|
- $cache = (new \Aimeos\MAdmin\Cache\Manager\Standard($context))->getCache(); |
|
|
95
|
+ $cache = ( new \Aimeos\MAdmin\Cache\Manager\Standard( $context ) )->getCache(); |
|
96
|
96
|
} |
|
97
|
97
|
|
|
98
|
|
- return $context->setCache($cache); |
|
|
98
|
+ return $context->setCache( $cache ); |
|
99
|
99
|
} |
|
100
|
100
|
|
|
101
|
101
|
|
|
@@ -105,16 +105,16 @@ discard block |
|
|
block discarded – undo |
|
105
|
105
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
106
|
106
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
107
|
107
|
*/ |
|
108
|
|
- protected static function addDatabaseManager(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
108
|
+ protected static function addDatabaseManager( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
109
|
109
|
{ |
|
110
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_dbm']) |
|
111
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_dbm'])) |
|
|
110
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_dbm'] ) |
|
|
111
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_dbm'] ) ) |
|
112
|
112
|
) { |
|
113
|
|
- return $fcn($context); |
|
|
113
|
+ return $fcn( $context ); |
|
114
|
114
|
} |
|
115
|
115
|
|
|
116
|
|
- $dbm = new \Aimeos\Base\DB\Manager\Standard($context->config()->get('resource', []), 'DBAL'); |
|
117
|
|
- return $context->setDatabaseManager($dbm); |
|
|
116
|
+ $dbm = new \Aimeos\Base\DB\Manager\Standard( $context->config()->get( 'resource', [] ), 'DBAL' ); |
|
|
117
|
+ return $context->setDatabaseManager( $dbm ); |
|
118
|
118
|
} |
|
119
|
119
|
|
|
120
|
120
|
|
|
@@ -124,16 +124,16 @@ discard block |
|
|
block discarded – undo |
|
124
|
124
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
125
|
125
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
126
|
126
|
*/ |
|
127
|
|
- protected static function addFilesystemManager(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
127
|
+ protected static function addFilesystemManager( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
128
|
128
|
{ |
|
129
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_fsm']) |
|
130
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_fsm'])) |
|
|
129
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_fsm'] ) |
|
|
130
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_fsm'] ) ) |
|
131
|
131
|
) { |
|
132
|
|
- return $fcn($context); |
|
|
132
|
+ return $fcn( $context ); |
|
133
|
133
|
} |
|
134
|
134
|
|
|
135
|
|
- $fsm = new \Aimeos\Base\Filesystem\Manager\Standard($context->config()->get('resource', [])); |
|
136
|
|
- return $context->setFilesystemManager($fsm); |
|
|
135
|
+ $fsm = new \Aimeos\Base\Filesystem\Manager\Standard( $context->config()->get( 'resource', [] ) ); |
|
|
136
|
+ return $context->setFilesystemManager( $fsm ); |
|
137
|
137
|
} |
|
138
|
138
|
|
|
139
|
139
|
|
|
@@ -143,16 +143,16 @@ discard block |
|
|
block discarded – undo |
|
143
|
143
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
144
|
144
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
145
|
145
|
*/ |
|
146
|
|
- protected static function addHasher(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
146
|
+ protected static function addHasher( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
147
|
147
|
{ |
|
148
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher']) |
|
149
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher'])) |
|
|
148
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher'] ) |
|
|
149
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher'] ) ) |
|
150
|
150
|
) { |
|
151
|
|
- return $fcn($context); |
|
|
151
|
+ return $fcn( $context ); |
|
152
|
152
|
} |
|
153
|
153
|
|
|
154
|
|
- $factory = GeneralUtility::makeInstance('TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory'); |
|
155
|
|
- return $context->setPassword(new \Aimeos\Base\Password\Typo3($factory->getDefaultHashInstance('FE'))); |
|
|
154
|
+ $factory = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory' ); |
|
|
155
|
+ return $context->setPassword( new \Aimeos\Base\Password\Typo3( $factory->getDefaultHashInstance( 'FE' ) ) ); |
|
156
|
156
|
} |
|
157
|
157
|
|
|
158
|
158
|
|
|
@@ -162,15 +162,15 @@ discard block |
|
|
block discarded – undo |
|
162
|
162
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
163
|
163
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
164
|
164
|
*/ |
|
165
|
|
- protected static function addLogger(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
165
|
+ protected static function addLogger( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
166
|
166
|
{ |
|
167
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_logger']) |
|
168
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_logger'])) |
|
|
167
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_logger'] ) |
|
|
168
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_logger'] ) ) |
|
169
|
169
|
) { |
|
170
|
|
- return $fcn($context); |
|
|
170
|
+ return $fcn( $context ); |
|
171
|
171
|
} |
|
172
|
172
|
|
|
173
|
|
- return $context->setLogger(\Aimeos\MAdmin::create($context, 'log')); |
|
|
173
|
+ return $context->setLogger( \Aimeos\MAdmin::create( $context, 'log' ) ); |
|
174
|
174
|
} |
|
175
|
175
|
|
|
176
|
176
|
|
|
@@ -180,17 +180,17 @@ discard block |
|
|
block discarded – undo |
|
180
|
180
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
181
|
181
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
182
|
182
|
*/ |
|
183
|
|
- protected static function addMailer(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
183
|
+ protected static function addMailer( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
184
|
184
|
{ |
|
185
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mailer']) |
|
186
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mailer'])) |
|
|
185
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mailer'] ) |
|
|
186
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mailer'] ) ) |
|
187
|
187
|
) { |
|
188
|
|
- return $fcn($context); |
|
|
188
|
+ return $fcn( $context ); |
|
189
|
189
|
} |
|
190
|
190
|
|
|
191
|
|
- return $context->setMail(new \Aimeos\Base\Mail\Typo3(function() { |
|
192
|
|
- return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class); |
|
193
|
|
- })); |
|
|
191
|
+ return $context->setMail( new \Aimeos\Base\Mail\Typo3( function() { |
|
|
192
|
+ return GeneralUtility::makeInstance( \TYPO3\CMS\Core\Mail\MailMessage::class ); |
|
|
193
|
+ }) ); |
|
194
|
194
|
} |
|
195
|
195
|
|
|
196
|
196
|
|
|
@@ -200,16 +200,16 @@ discard block |
|
|
block discarded – undo |
|
200
|
200
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
201
|
201
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
202
|
202
|
*/ |
|
203
|
|
- protected static function addMessageQueueManager(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
203
|
+ protected static function addMessageQueueManager( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
204
|
204
|
{ |
|
205
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mqueue']) |
|
206
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mqueue'])) |
|
|
205
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mqueue'] ) |
|
|
206
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mqueue'] ) ) |
|
207
|
207
|
) { |
|
208
|
|
- return $fcn($context); |
|
|
208
|
+ return $fcn( $context ); |
|
209
|
209
|
} |
|
210
|
210
|
|
|
211
|
|
- $mqm = new \Aimeos\Base\MQueue\Manager\Standard($context->config()->get('resource', [])); |
|
212
|
|
- return $context->setMessageQueueManager($mqm); |
|
|
211
|
+ $mqm = new \Aimeos\Base\MQueue\Manager\Standard( $context->config()->get( 'resource', [] ) ); |
|
|
212
|
+ return $context->setMessageQueueManager( $mqm ); |
|
213
|
213
|
} |
|
214
|
214
|
|
|
215
|
215
|
|
|
@@ -219,15 +219,15 @@ discard block |
|
|
block discarded – undo |
|
219
|
219
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
220
|
220
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
221
|
221
|
*/ |
|
222
|
|
- protected static function addNonce(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
222
|
+ protected static function addNonce( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
223
|
223
|
{ |
|
224
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_nounce']) |
|
225
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_nounce'])) |
|
|
224
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_nounce'] ) |
|
|
225
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_nounce'] ) ) |
|
226
|
226
|
) { |
|
227
|
|
- return $fcn($context); |
|
|
227
|
+ return $fcn( $context ); |
|
228
|
228
|
} |
|
229
|
229
|
|
|
230
|
|
- return $context->setNonce(base64_encode(random_bytes(16))); |
|
|
230
|
+ return $context->setNonce( base64_encode( random_bytes( 16 ) ) ); |
|
231
|
231
|
} |
|
232
|
232
|
|
|
233
|
233
|
|
|
@@ -237,24 +237,24 @@ discard block |
|
|
block discarded – undo |
|
237
|
237
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
238
|
238
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
239
|
239
|
*/ |
|
240
|
|
- protected static function addProcess(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
240
|
+ protected static function addProcess( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
241
|
241
|
{ |
|
242
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_process']) |
|
243
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_process'])) |
|
|
242
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_process'] ) |
|
|
243
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_process'] ) ) |
|
244
|
244
|
) { |
|
245
|
|
- return $fcn($context); |
|
|
245
|
+ return $fcn( $context ); |
|
246
|
246
|
} |
|
247
|
247
|
|
|
248
|
|
- $process = new \Aimeos\Base\Process\Pcntl(\Aimeos\Aimeos\Base::getExtConfig('pcntlMax', 4)); |
|
|
248
|
+ $process = new \Aimeos\Base\Process\Pcntl( \Aimeos\Aimeos\Base::getExtConfig( 'pcntlMax', 4 ) ); |
|
249
|
249
|
|
|
250
|
250
|
// Reset before child processes are spawned to avoid lost DB connections afterwards |
|
251
|
|
- if (method_exists('\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections') === false |
|
|
251
|
+ if( method_exists( '\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections' ) === false |
|
252
|
252
|
|| $process->isAvailable() === false |
|
253
|
253
|
) { |
|
254
|
254
|
$process = new \Aimeos\Base\Process\None(); |
|
255
|
255
|
} |
|
256
|
256
|
|
|
257
|
|
- return $context->setProcess($process); |
|
|
257
|
+ return $context->setProcess( $process ); |
|
258
|
258
|
} |
|
259
|
259
|
|
|
260
|
260
|
|
|
@@ -264,25 +264,25 @@ discard block |
|
|
block discarded – undo |
|
264
|
264
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
265
|
265
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
266
|
266
|
*/ |
|
267
|
|
- protected static function addSession(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
267
|
+ protected static function addSession( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
268
|
268
|
{ |
|
269
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_session']) |
|
270
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_session'])) |
|
|
269
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_session'] ) |
|
|
270
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_session'] ) ) |
|
271
|
271
|
) { |
|
272
|
|
- return $fcn($context); |
|
|
272
|
+ return $fcn( $context ); |
|
273
|
273
|
} |
|
274
|
274
|
|
|
275
|
275
|
$class = \TYPO3\CMS\Core\Authentication\CommandLineUserAuthentication::class; |
|
276
|
276
|
|
|
277
|
|
- if (isset($GLOBALS['TSFE']->fe_user)) { |
|
278
|
|
- $session = new \Aimeos\Base\Session\Typo3($GLOBALS['TSFE']->fe_user); |
|
279
|
|
- } elseif (isset($GLOBALS['BE_USER']) && !($GLOBALS['BE_USER'] instanceof $class)) { |
|
280
|
|
- $session = new \Aimeos\Base\Session\Typo3($GLOBALS['BE_USER']); |
|
|
277
|
+ if( isset( $GLOBALS['TSFE']->fe_user ) ) { |
|
|
278
|
+ $session = new \Aimeos\Base\Session\Typo3( $GLOBALS['TSFE']->fe_user ); |
|
|
279
|
+ } elseif( isset( $GLOBALS['BE_USER'] ) && !( $GLOBALS['BE_USER'] instanceof $class ) ) { |
|
|
280
|
+ $session = new \Aimeos\Base\Session\Typo3( $GLOBALS['BE_USER'] ); |
|
281
|
281
|
} else { |
|
282
|
282
|
$session = new \Aimeos\Base\Session\None(); |
|
283
|
283
|
} |
|
284
|
284
|
|
|
285
|
|
- return $context->setSession($session); |
|
|
285
|
+ return $context->setSession( $session ); |
|
286
|
286
|
} |
|
287
|
287
|
|
|
288
|
288
|
|
|
@@ -292,22 +292,22 @@ discard block |
|
|
block discarded – undo |
|
292
|
292
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
293
|
293
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
294
|
294
|
*/ |
|
295
|
|
- protected static function addToken(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
295
|
+ protected static function addToken( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
296
|
296
|
{ |
|
297
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_token']) |
|
298
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_token'])) |
|
|
297
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_token'] ) |
|
|
298
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_token'] ) ) |
|
299
|
299
|
) { |
|
300
|
|
- return $fcn($context); |
|
|
300
|
+ return $fcn( $context ); |
|
301
|
301
|
} |
|
302
|
302
|
|
|
303
|
303
|
$session = $context->session(); |
|
304
|
304
|
|
|
305
|
|
- if (($token = $session->get('token')) === null) { |
|
306
|
|
- $token = isset($GLOBALS['TSFE']->fe_user) ? $GLOBALS['TSFE']->fe_user->id : md5(microtime(true) . getmypid()); |
|
307
|
|
- $session->set('token', $token); |
|
|
305
|
+ if( ( $token = $session->get( 'token' ) ) === null ) { |
|
|
306
|
+ $token = isset( $GLOBALS['TSFE']->fe_user ) ? $GLOBALS['TSFE']->fe_user->id : md5( microtime( true ) . getmypid() ); |
|
|
307
|
+ $session->set( 'token', $token ); |
|
308
|
308
|
} |
|
309
|
309
|
|
|
310
|
|
- return $context->setToken($token); |
|
|
310
|
+ return $context->setToken( $token ); |
|
311
|
311
|
} |
|
312
|
312
|
|
|
313
|
313
|
|
|
@@ -317,28 +317,28 @@ discard block |
|
|
block discarded – undo |
|
317
|
317
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
318
|
318
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
319
|
319
|
*/ |
|
320
|
|
- protected static function addUser(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
320
|
+ protected static function addUser( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
321
|
321
|
{ |
|
322
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_user']) |
|
323
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_user'])) |
|
|
322
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_user'] ) |
|
|
323
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_user'] ) ) |
|
324
|
324
|
) { |
|
325
|
|
- return $fcn($context); |
|
|
325
|
+ return $fcn( $context ); |
|
326
|
326
|
} |
|
327
|
327
|
|
|
328
|
328
|
$appType = null; |
|
329
|
|
- $t3context = GeneralUtility::makeInstance('TYPO3\CMS\Core\Context\Context'); |
|
|
329
|
+ $t3context = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Context\Context' ); |
|
330
|
330
|
|
|
331
|
|
- if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface) { |
|
332
|
|
- $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST']); |
|
|
331
|
+ if( ( $GLOBALS['TYPO3_REQUEST'] ?? null ) instanceof ServerRequestInterface ) { |
|
|
332
|
+ $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest( $GLOBALS['TYPO3_REQUEST'] ); |
|
333
|
333
|
} |
|
334
|
334
|
|
|
335
|
|
- if ($appType && $appType->isFrontend() && $t3context->getPropertyFromAspect('frontend.user', 'isLoggedIn')) { |
|
336
|
|
- $context->setUserId($GLOBALS['TSFE']->fe_user->user[$GLOBALS['TSFE']->fe_user->userid_column]); |
|
337
|
|
- $context->setEditor((string) $GLOBALS['TSFE']->fe_user->user['username']); |
|
338
|
|
- } elseif ($appType && $appType->isBackend() && isset($GLOBALS['BE_USER']->user['username'])) { |
|
339
|
|
- $context->setEditor((string) $GLOBALS['BE_USER']->user['username']); |
|
|
335
|
+ if( $appType && $appType->isFrontend() && $t3context->getPropertyFromAspect( 'frontend.user', 'isLoggedIn' ) ) { |
|
|
336
|
+ $context->setUserId( $GLOBALS['TSFE']->fe_user->user[$GLOBALS['TSFE']->fe_user->userid_column] ); |
|
|
337
|
+ $context->setEditor( (string) $GLOBALS['TSFE']->fe_user->user['username'] ); |
|
|
338
|
+ } elseif( $appType && $appType->isBackend() && isset( $GLOBALS['BE_USER']->user['username'] ) ) { |
|
|
339
|
+ $context->setEditor( (string) $GLOBALS['BE_USER']->user['username'] ); |
|
340
|
340
|
} else { |
|
341
|
|
- $context->setEditor((string) GeneralUtility::getIndpEnv('REMOTE_ADDR')); |
|
|
341
|
+ $context->setEditor( (string) GeneralUtility::getIndpEnv( 'REMOTE_ADDR' ) ); |
|
342
|
342
|
} |
|
343
|
343
|
|
|
344
|
344
|
return $context; |
|
@@ -351,27 +351,27 @@ discard block |
|
|
block discarded – undo |
|
351
|
351
|
* @param \Aimeos\MShop\ContextIface $context Context object |
|
352
|
352
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
353
|
353
|
*/ |
|
354
|
|
- protected static function addGroups(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
354
|
+ protected static function addGroups( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
355
|
355
|
{ |
|
356
|
|
- if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_groups']) |
|
357
|
|
- && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_groups'])) |
|
|
356
|
+ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_groups'] ) |
|
|
357
|
+ && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_groups'] ) ) |
|
358
|
358
|
) { |
|
359
|
|
- return $fcn($context); |
|
|
359
|
+ return $fcn( $context ); |
|
360
|
360
|
} |
|
361
|
361
|
|
|
362
|
|
- $t3context = GeneralUtility::makeInstance('TYPO3\CMS\Core\Context\Context'); |
|
|
362
|
+ $t3context = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Context\Context' ); |
|
363
|
363
|
|
|
364
|
364
|
$appType = null; |
|
365
|
|
- if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface) { |
|
366
|
|
- $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST']); |
|
|
365
|
+ if( ( $GLOBALS['TYPO3_REQUEST'] ?? null ) instanceof ServerRequestInterface ) { |
|
|
366
|
+ $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest( $GLOBALS['TYPO3_REQUEST'] ); |
|
367
|
367
|
} |
|
368
|
368
|
|
|
369
|
|
- if ($appType && $appType->isFrontend() && $t3context->getPropertyFromAspect('frontend.user', 'isLoggedIn')) { |
|
370
|
|
- $ids = GeneralUtility::trimExplode(',', $GLOBALS['TSFE']->fe_user->user['usergroup']); |
|
371
|
|
- $context->setGroupIds($ids); |
|
372
|
|
- } elseif ($appType && $appType->isBackend() && $GLOBALS['BE_USER']->userGroups) { |
|
373
|
|
- $ids = array_keys($GLOBALS['BE_USER']->userGroups); |
|
374
|
|
- $context->setGroupIds($ids); |
|
|
369
|
+ if( $appType && $appType->isFrontend() && $t3context->getPropertyFromAspect( 'frontend.user', 'isLoggedIn' ) ) { |
|
|
370
|
+ $ids = GeneralUtility::trimExplode( ',', $GLOBALS['TSFE']->fe_user->user['usergroup'] ); |
|
|
371
|
+ $context->setGroupIds( $ids ); |
|
|
372
|
+ } elseif( $appType && $appType->isBackend() && $GLOBALS['BE_USER']->userGroups ) { |
|
|
373
|
+ $ids = array_keys( $GLOBALS['BE_USER']->userGroups ); |
|
|
374
|
+ $context->setGroupIds( $ids ); |
|
375
|
375
|
} |
|
376
|
376
|
|
|
377
|
377
|
return $context; |
|
@@ -384,20 +384,20 @@ discard block |
|
|
block discarded – undo |
|
384
|
384
|
* @param \Aimeos\MShop\ContextIface $context Context object including config |
|
385
|
385
|
* @return \Aimeos\MShop\ContextIface Modified context object |
|
386
|
386
|
*/ |
|
387
|
|
- protected static function addDateTime(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
|
387
|
+ protected static function addDateTime( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
388
|
388
|
{ |
|
389
|
389
|
$appType = null; |
|
390
|
|
- if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface) { |
|
391
|
|
- $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST']); |
|
|
390
|
+ if( ( $GLOBALS['TYPO3_REQUEST'] ?? null ) instanceof ServerRequestInterface ) { |
|
|
391
|
+ $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest( $GLOBALS['TYPO3_REQUEST'] ); |
|
392
|
392
|
} |
|
393
|
393
|
|
|
394
|
|
- if ($appType && $appType->isFrontend() && isset($GLOBALS['BE_USER']->adminPanel) |
|
395
|
|
- && class_exists('TYPO3\\CMS\\Adminpanel\\Service\\ConfigurationService')) { |
|
396
|
|
- $service = GeneralUtility::makeInstance('TYPO3\\CMS\\Adminpanel\\Service\\ConfigurationService'); |
|
397
|
|
- $tstamp = strtotime($service->getConfigurationOption('preview', 'simulateDate')); |
|
|
394
|
+ if( $appType && $appType->isFrontend() && isset( $GLOBALS['BE_USER']->adminPanel ) |
|
|
395
|
+ && class_exists( 'TYPO3\\CMS\\Adminpanel\\Service\\ConfigurationService' ) ) { |
|
|
396
|
+ $service = GeneralUtility::makeInstance( 'TYPO3\\CMS\\Adminpanel\\Service\\ConfigurationService' ); |
|
|
397
|
+ $tstamp = strtotime( $service->getConfigurationOption( 'preview', 'simulateDate' ) ); |
|
398
|
398
|
|
|
399
|
|
- if (!empty($tstamp)) { |
|
400
|
|
- $context->setDateTime(date('Y-m-d H:i:s', $tstamp)); |
|
|
399
|
+ if( !empty( $tstamp ) ) { |
|
|
400
|
+ $context->setDateTime( date( 'Y-m-d H:i:s', $tstamp ) ); |
|
401
|
401
|
} |
|
402
|
402
|
} |
|
403
|
403
|
|