Passed
Push — develop ( 1d94a2...f31b27 )
by Jens
02:50
created

CmsComponent::filesRouting()   C

Complexity

Conditions 8
Paths 6

Size

Total Lines 22
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 18
nc 6
nop 2
dl 0
loc 22
rs 6.6037
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A CmsComponent::configurationRouting() 0 13 2
1
<?php
2
namespace library\components {
3
4
    use library\components\cms\DocumentRouting;
5
	use library\components\cms\FilesRouting;
6
	use library\components\cms\ImagesRouting;
7
    use library\components\cms\SitemapRouting;
8
    use library\crypt\Crypt;
9
    use library\storage\Storage;
10
11
    class CmsComponent extends BaseComponent
12
    {
13
        /*
14
         * var \library\storage\Storage
15
         */
16
        public $storage;
17
18
        const INVALID_CREDENTIALS_MESSAGE = 'Invalid username / password combination';
19
20
        const MAIN_NAV_CLASS = 'default';
21
22
        const PARAMETER_BLACKLIST_IPS = 'blacklistIps';
23
        const PARAMETER_BODY = 'body';
24
        const PARAMETER_BRICK = 'brick';
25
        const PARAMETER_BRICKS = 'bricks';
26
        const PARAMETER_CMS_PREFIX = 'cmsPrefix';
27
        const PARAMETER_DOCUMENT = 'document';
28
        const PARAMETER_DOCUMENTS = 'documents';
29
        const PARAMETER_DOCUMENT_TYPE = 'documentType';
30
        const PARAMETER_DOCUMENT_TYPES = 'documentTypes';
31
        const PARAMETER_ERROR_MESSAGE = 'errorMsg';
32
        const PARAMETER_FILES = 'files';
33
        const PARAMETER_FOLDER = 'folder';
34
        const PARAMETER_IMAGE = 'image';
35
        const PARAMETER_IMAGES = 'images';
36
        const PARAMETER_IMAGE_SET = 'imageSet';
37
        const PARAMETER_MAIN_NAV_CLASS = 'mainNavClass';
38
        const PARAMETER_MY_BRICK_SLUG = 'myBrickSlug';
39
        const PARAMETER_SITEMAP = 'sitemap';
40
        const PARAMETER_SITEMAP_ITEM = 'sitemapItem';
41
        const PARAMETER_SMALLEST_IMAGE = 'smallestImage';
42
        const PARAMETER_STATIC = 'static';
43
        const PARAMETER_USER = 'user';
44
        const PARAMETER_USERS = 'users';
45
        const PARAMETER_USER_RIGHTS = 'userRights';
46
        const PARAMETER_WHITELIST_IPS = 'whitelistIps';
47
48
        const POST_PARAMETER_COMPONENT = 'component';
49
        const POST_PARAMETER_PASSWORD = 'password';
50
        const POST_PARAMETER_SAVE = 'save';
51
        const POST_PARAMETER_TEMPLATE = 'template';
52
        const POST_PARAMETER_TITLE = 'title';
53
        const POST_PARAMETER_USERNAME = 'username';
54
55
        const GET_PARAMETER_PATH = 'path';
56
        const GET_PARAMETER_SLUG = 'slug';
57
58
        const FILES_PARAMETER_FILE = 'file';
59
60
        const SESSION_PARAMETER_CLOUD_CONTROL = 'cloudcontrol';
61
62
        const LOGIN_TEMPLATE_PATH = 'cms/login';
63
64
        const CONTENT_TYPE_APPLICATION_JSON = 'Content-type:application/json';
65
66
        public $subTemplate = null;
67
68
69
        /**
70
         * @param \library\storage\Storage $storage
71
         *
72
         * @return void
73
         */
74
        public function run(Storage $storage)
75
        {
76
            $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = self::MAIN_NAV_CLASS;
77
            $this->storage = $storage;
78
79
            $remoteAddress = $_SERVER['REMOTE_ADDR'];
80
            $this->checkWhiteList($remoteAddress);
81
            $this->checkBlackList($remoteAddress);
82
83
            $this->checkLogin();
84
85
            $this->parameters[self::PARAMETER_USER_RIGHTS] = $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]->rights;
86
87
            $this->routing();
88
        }
89
90
        /**
91
         * See if a user is logged or wants to log in and
92
         * takes appropriate actions.
93
         *
94
         * @throws \Exception
95
         */
96
        protected function checkLogin()
97
        {
98
            $request = $this->request;
99
100
            if (!isset($_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL])) {
101
                if (isset($request::$post[self::POST_PARAMETER_USERNAME], $request::$post[self::POST_PARAMETER_PASSWORD])) {
102
                    $user = $this->storage->getUserByUsername($request::$post[self::POST_PARAMETER_USERNAME]);
103
                    $crypt = new Crypt();
104
                    if (empty($user)) {
105
                        $crypt->encrypt($request::$post[self::POST_PARAMETER_PASSWORD], 16); // Buy time, to avoid brute forcing
106
                        $this->parameters[self::PARAMETER_ERROR_MESSAGE] = self::INVALID_CREDENTIALS_MESSAGE;
107
                        $this->showLogin();
108
                    } else {
109
                        $salt = $user->salt;
110
                        $password = $user->password;
111
112
                        $passwordCorrect = $crypt->compare($request::$post[self::POST_PARAMETER_PASSWORD], $password, $salt);
113
114
                        if ($passwordCorrect) {
115
                            $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL] = $user;
116
                        } else {
117
                            $this->parameters[self::PARAMETER_ERROR_MESSAGE] = self::INVALID_CREDENTIALS_MESSAGE;
118
                            $this->showLogin();
119
                        }
120
                    }
121
                } else {
122
                    $this->showLogin();
123
                }
124
            }
125
        }
126
127
        /**
128
         * Overrides normal behaviour and only renders the
129
         * login screen
130
         *
131
         * @throws \Exception
132
         */
133
        protected function showLogin()
134
        {
135
            $loginTemplatePath = self::LOGIN_TEMPLATE_PATH;
136
            $this->renderTemplate($loginTemplatePath);
137
            ob_end_flush();
138
            exit;
139
        }
140
141
        /**
142
         * As an exception, to keep the initial file structure simple
143
         * the cms implements it's own routing, apart from the regular sitemap functionality
144
         *
145
         * @throws \Exception
146
         */
147
        protected function routing()
148
        {
149
            $relativeCmsUri = $this->getRelativeCmsUri($this->request);
150
151
            $userRights = $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]->rights;
152
153
            if ($relativeCmsUri == '' || $relativeCmsUri == '/') {
154
                $this->subTemplate = 'cms/dashboard';
155
            }
156
157
            $this->logOffRouting($this->request, $relativeCmsUri);
158
159
            $this->apiRouting($relativeCmsUri);
160
161
            if (in_array(self::PARAMETER_DOCUMENTS, $userRights)) {
162
                new DocumentRouting($this->request, $relativeCmsUri, $this);
163
            }
164
165
            if (in_array(self::PARAMETER_SITEMAP, $userRights)) {
166
                new SitemapRouting($this->request, $relativeCmsUri, $this);
167
            }
168
169
            if (in_array(self::PARAMETER_IMAGES, $userRights)) {
170
                new ImagesRouting($this->request, $relativeCmsUri, $this);
171
            }
172
173
            if (in_array(self::PARAMETER_FILES, $userRights)) {
174
                new FilesRouting($this->request, $relativeCmsUri, $this);
175
            }
176
177
            if (in_array('configuration', $userRights)) {
178
                $this->configurationRouting($this->request, $relativeCmsUri);
179
            }
180
181
            if ($this->subTemplate !== null) {
182
                $this->parameters[self::PARAMETER_BODY] = $this->renderTemplate($this->subTemplate);
183
            }
184
        }
185
186
        /**
187
         * @param $remoteAddress
188
         * @throws \Exception
189
         */
190 View Code Duplication
        private function checkWhiteList($remoteAddress)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
191
        {
192
            if (isset($this->parameters[self::PARAMETER_WHITELIST_IPS])) {
193
                $whitelistIps = explode(',', $this->parameters[self::PARAMETER_WHITELIST_IPS]);
194
                $whitelistIps = array_map("trim", $whitelistIps);
195
                if (!in_array($remoteAddress, $whitelistIps)) {
196
                    throw new \Exception('Ip address ' . $remoteAddress . ' is not on whitelist');
197
                }
198
            }
199
        }
200
201
        /**
202
         * @param $remoteAddress
203
         * @throws \Exception
204
         */
205 View Code Duplication
        private function checkBlackList($remoteAddress)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
206
        {
207
            if (isset($this->parameters[self::PARAMETER_BLACKLIST_IPS])) {
208
                $blacklistIps = explode(',', $this->parameters[self::PARAMETER_BLACKLIST_IPS]);
209
                $blacklistIps = array_map("trim", $blacklistIps);
210
                if (in_array($remoteAddress, $blacklistIps)) {
211
                    throw new \Exception('Ip address ' . $remoteAddress . ' is on blacklist');
212
                }
213
            }
214
        }
215
216
        /**
217
         * @param $request
218
         * @return mixed|string
219
         */
220
        private function getRelativeCmsUri($request)
221
        {
222
            // TODO Use regex match parameter instead of calculating relative uri
223
            $pos = strpos($request::$relativeUri, $this->parameters[self::PARAMETER_CMS_PREFIX]);
224
            $relativeCmsUri = '/';
225
            if ($pos !== false) {
226
                $relativeCmsUri = substr_replace($request::$relativeUri, '', $pos, strlen($this->parameters[self::PARAMETER_CMS_PREFIX]));
227
            }
228
            return $relativeCmsUri;
229
        }
230
231
        /**
232
         * @param $relativeCmsUri
233
         */
234
        private function apiRouting($relativeCmsUri)
235
        {
236
            if ($relativeCmsUri == '/images.json') {
237
                header(self::CONTENT_TYPE_APPLICATION_JSON);
238
                die(json_encode($this->storage->getImages()));
239
            } elseif ($relativeCmsUri == '/files.json') {
240
                header(self::CONTENT_TYPE_APPLICATION_JSON);
241
                die(json_encode($this->storage->getFiles()));
242
            } elseif ($relativeCmsUri == '/documents.json') {
243
                header(self::CONTENT_TYPE_APPLICATION_JSON);
244
                die(json_encode($this->storage->getDocuments()));
245
            }
246
        }
247
248
        /**
249
         * @param $request
250
         * @param $relativeCmsUri
251
         */
252
        private function configurationRouting($request, $relativeCmsUri)
253
        {
254
            if ($relativeCmsUri == '/configuration') {
255
                $this->subTemplate = 'cms/configuration';
256
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
257
            }
258
259
            $this->usersRouting($request, $relativeCmsUri);
260
            $this->documentTypesRouting($request, $relativeCmsUri);
261
            $this->bricksRouting($request, $relativeCmsUri);
262
            $this->imageSetRouting($request, $relativeCmsUri);
263
            $this->applicationComponentRouting($request, $relativeCmsUri);
264
        }
265
266
267
        /**
268
         * @param $request
269
         * @param $relativeCmsUri
270
         */
271 View Code Duplication
        private function usersRouting($request, $relativeCmsUri)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
272
        {
273
            if ($relativeCmsUri == '/configuration/users') {
274
                $this->subTemplate = 'cms/configuration/users';
275
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
276
                $this->parameters[self::PARAMETER_USERS] = $this->storage->getUsers();
277
            } elseif ($relativeCmsUri == '/configuration/users/new') {
278
                $this->subTemplate = 'cms/configuration/users-form';
279
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
280
                if (isset($_POST[self::POST_PARAMETER_USERNAME])) {
281
                    $this->storage->addUser($request::$post);
282
                    header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/users');
283
                    exit;
284
                }
285
            } elseif ($relativeCmsUri == '/configuration/users/delete' && isset($request::$get[self::GET_PARAMETER_SLUG])) {
286
                $this->storage->deleteUserBySlug($request::$get[self::GET_PARAMETER_SLUG]);
287
                header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/users');
288
                exit;
289
            } elseif ($relativeCmsUri == '/configuration/users/edit' && isset($request::$get[self::GET_PARAMETER_SLUG])) {
290
                $this->subTemplate = 'cms/configuration/users-form';
291
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
292
                $this->parameters[self::PARAMETER_USER] = $this->storage->getUserBySlug($request::$get[self::GET_PARAMETER_SLUG]);
293
                if (isset($_POST[self::POST_PARAMETER_USERNAME])) {
294
                    $this->storage->saveUser($request::$get[self::GET_PARAMETER_SLUG], $request::$post);
295
                    header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/users');
296
                    exit;
297
                }
298
            }
299
        }
300
301
        /**
302
         * @param $request
303
         * @param $relativeCmsUri
304
         */
305
        private function documentTypesRouting($request, $relativeCmsUri)
306
        {
307
            if ($relativeCmsUri == '/configuration/document-types') {
308
                $this->subTemplate = 'cms/configuration/document-types';
309
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
310
                $this->parameters[self::PARAMETER_DOCUMENT_TYPES] = $this->storage->getDocumentTypes();
311
            } elseif ($relativeCmsUri == '/configuration/document-types/new') {
312
                $this->subTemplate = 'cms/configuration/document-types-form';
313
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
314
                $bricks = $this->storage->getBricks();
315
                if (isset($request::$post[self::POST_PARAMETER_TITLE])) {
316
                    $this->storage->addDocumentType($request::$post);
317
                    header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/document-types');
318
                    exit;
319
                }
320
                $this->parameters[self::PARAMETER_BRICKS] = $bricks;
321
            } elseif ($relativeCmsUri == '/configuration/document-types/edit' && isset($request::$get[self::GET_PARAMETER_SLUG])) {
322
                $this->subTemplate = 'cms/configuration/document-types-form';
323
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
324
                $documentType = $this->storage->getDocumentTypeBySlug($request::$get[self::GET_PARAMETER_SLUG], false);
325
                $bricks = $this->storage->getBricks();
326
                if (isset($request::$post[self::POST_PARAMETER_TITLE])) {
327
                    $this->storage->saveDocumentType($request::$get[self::GET_PARAMETER_SLUG], $request::$post);
328
                    header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/document-types');
329
                    exit;
330
                }
331
                $this->parameters[self::PARAMETER_DOCUMENT_TYPE] = $documentType;
332
                $this->parameters[self::PARAMETER_BRICKS] = $bricks;
333
            } elseif ($relativeCmsUri == '/configuration/document-types/delete' && isset($request::$get[self::GET_PARAMETER_SLUG])) {
334
                $this->storage->deleteDocumentTypeBySlug($request::$get[self::GET_PARAMETER_SLUG]);
335
                header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/document-types');
336
                exit;
337
            }
338
        }
339
340
        /**
341
         * @param $request
342
         * @param $relativeCmsUri
343
         */
344
        private function bricksRouting($request, $relativeCmsUri)
345
        {
346
            if ($relativeCmsUri == '/configuration/bricks') {
347
                $this->subTemplate = 'cms/configuration/bricks';
348
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
349
                $this->parameters[self::PARAMETER_BRICKS] = $this->storage->getBricks();
350
            } elseif ($relativeCmsUri == '/configuration/bricks/new') {
351
                $this->subTemplate = 'cms/configuration/bricks-form';
352
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
353
                if (isset($request::$post[self::POST_PARAMETER_TITLE])) {
354
                    $this->storage->addBrick($request::$post);
355
                    header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/bricks');
356
                    exit;
357
                }
358
            } elseif ($relativeCmsUri == '/configuration/bricks/edit' && isset($request::$get[self::GET_PARAMETER_SLUG])) {
359
                $this->subTemplate = 'cms/configuration/bricks-form';
360
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
361
                $brick = $this->storage->getBrickBySlug($request::$get[self::GET_PARAMETER_SLUG]);
362
                if (isset($request::$post[self::POST_PARAMETER_TITLE])) {
363
                    $this->storage->saveBrick($request::$get[self::GET_PARAMETER_SLUG], $request::$post);
364
                    header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/bricks');
365
                    exit;
366
                }
367
                $this->parameters[self::PARAMETER_BRICK] = $brick;
368
            } elseif ($relativeCmsUri == '/configuration/bricks/delete' && isset($request::$get[self::GET_PARAMETER_SLUG])) {
369
                $this->storage->deleteBrickBySlug($request::$get[self::GET_PARAMETER_SLUG]);
370
                header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/bricks');
371
                exit;
372
            } elseif ($relativeCmsUri == '/configuration/image-set') {
373
                $this->subTemplate = 'cms/configuration/image-set';
374
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
375
                $this->parameters[self::PARAMETER_IMAGE_SET] = $this->storage->getImageSet();
376
            }
377
        }
378
379
        /**
380
         * @param $request
381
         * @param $relativeCmsUri
382
         */
383 View Code Duplication
        private function imageSetRouting($request, $relativeCmsUri)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
384
        {
385
            if ($relativeCmsUri == '/configuration/image-set') {
386
                $this->subTemplate = 'cms/configuration/image-set';
387
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
388
                $this->parameters[self::PARAMETER_IMAGE_SET] = $this->storage->getImageSet();
389
            } elseif ($relativeCmsUri == '/configuration/image-set/edit' && isset($request::$get[self::GET_PARAMETER_SLUG])) {
390
                $this->subTemplate = 'cms/configuration/image-set-form';
391
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
392
                $imageSet = $this->storage->getImageSetBySlug($request::$get[self::GET_PARAMETER_SLUG]);
393
                if (isset($request::$post[self::POST_PARAMETER_TITLE])) {
394
                    $this->storage->saveImageSet($request::$get[self::GET_PARAMETER_SLUG], $request::$post);
395
                    header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/image-set');
396
                    exit;
397
                }
398
                $this->parameters[self::PARAMETER_IMAGE_SET] = $imageSet;
399
            } elseif ($relativeCmsUri == '/configuration/image-set/new') {
400
                $this->subTemplate = 'cms/configuration/image-set-form';
401
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
402
                if (isset($request::$post[self::POST_PARAMETER_TITLE])) {
403
                    $this->storage->addImageSet($request::$post);
404
                    header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/image-set');
405
                    exit;
406
                }
407
            } elseif ($relativeCmsUri == '/configuration/image-set/delete' && isset($request::$get[self::GET_PARAMETER_SLUG])) {
408
                $this->storage->deleteImageSetBySlug($request::$get[self::GET_PARAMETER_SLUG]);
409
                header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/image-set');
410
                exit;
411
            }
412
        }
413
414
        /**
415
         * @param $request
416
         * @param $relativeCmsUri
417
         */
418
        private function applicationComponentRouting($request, $relativeCmsUri)
419
        {
420
            if ($relativeCmsUri == '/configuration/application-components') {
421
                $this->subTemplate = 'cms/configuration/application-components';
422
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
423
                $this->parameters['applicationComponents'] = $this->storage->getApplicationComponents();
424
            } elseif ($relativeCmsUri == '/configuration/application-components/new') {
425
                $this->subTemplate = 'cms/configuration/application-components-form';
426
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
427
                if (isset($request::$post[self::POST_PARAMETER_TITLE])) {
428
                    $this->storage->addApplicationComponent($request::$post);
429
                    header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/application-components');
430
                    exit;
431
                }
432
            } elseif ($relativeCmsUri == '/configuration/application-components/edit' && isset($request::$get[self::GET_PARAMETER_SLUG])) {
433
                $this->subTemplate = 'cms/configuration/application-components-form';
434
                $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = 'configuration';
435
                $applicationComponent = $this->storage->getApplicationComponentBySlug($request::$get[self::GET_PARAMETER_SLUG]);
436
                if (isset($request::$post[self::POST_PARAMETER_TITLE])) {
437
                    $this->storage->saveApplicationComponent($request::$get[self::GET_PARAMETER_SLUG], $request::$post);
438
                    header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/application-components');
439
                    exit;
440
                }
441
                $this->parameters['applicationComponent'] = $applicationComponent;
442
            } elseif ($relativeCmsUri == '/configuration/application-components/delete' && isset($request::$get[self::GET_PARAMETER_SLUG])) {
443
                $this->storage->deleteApplicationComponentBySlug($request::$get[self::GET_PARAMETER_SLUG]);
444
                header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX] . '/configuration/application-components');
445
                exit;
446
            }
447
        }
448
449
        private function logOffRouting($request, $relativeCmsUri)
450
        {
451
            if ($relativeCmsUri == '/log-off') {
452
                $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL] = null;
453
                unset($_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]);
454
                header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX]);
455
                exit;
456
            }
457
        }
458
459
        public function setParameter($parameterName, $parameterValue)
460
        {
461
            $this->parameters[$parameterName] = $parameterValue;
462
        }
463
464
        public function getParameter($parameterName)
465
        {
466
            return $this->parameters[$parameterName];
467
        }
468
    }
469
}