1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
7
|
|
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
8
|
|
|
* |
9
|
|
|
* Licensed under The MIT License |
10
|
|
|
* For full copyright and license information, please see the LICENSE.txt |
11
|
|
|
* Redistributions of files must retain the above copyright notice. |
12
|
|
|
* |
13
|
|
|
* @copyright Copyright (c) Cake Software Foundation, Inc. |
14
|
|
|
* (http://cakefoundation.org) |
15
|
|
|
* @link http://cakephp.org CakePHP(tm) Project |
16
|
|
|
* @since 0.2.9 |
17
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License |
18
|
|
|
*/ |
19
|
|
|
namespace App\Controller; |
20
|
|
|
|
21
|
|
|
use Cake\Core\Configure; |
22
|
|
|
use Cake\Event\Event; |
23
|
|
|
use Cake\Http\Exception\NotFoundException; |
24
|
|
|
use Cake\View\Exception\MissingTemplateException; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Static content controller |
28
|
|
|
* |
29
|
|
|
* This controller will render views from Template/Pages/ |
30
|
|
|
* |
31
|
|
|
* @link http://book.cakephp.org/3.0/en/controllers/pages-controller.html |
32
|
|
|
*/ |
33
|
|
|
class PagesController extends AppController |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* {@inheritDoc} |
37
|
|
|
*/ |
38
|
|
|
public function beforeFilter(Event $event) |
39
|
|
|
{ |
40
|
|
|
parent::beforeFilter($event); |
41
|
|
|
$this->set('showDisclaimer', true); |
42
|
|
|
$this->Authentication->allowUnauthenticated(['display']); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Displays a view |
47
|
|
|
* |
48
|
|
|
* @return void|\Cake\Network\Response |
49
|
|
|
* @throws \Cake\Http\Exception\NotFoundException When the view file |
50
|
|
|
* could not be found or \Cake\View\Exception\MissingTemplateException |
51
|
|
|
* in debug mode. |
52
|
|
|
*/ |
53
|
|
|
public function display() |
54
|
|
|
{ |
55
|
|
|
$path = func_get_args(); |
56
|
|
|
|
57
|
|
|
$count = count($path); |
58
|
|
|
if (!$count) { |
59
|
|
|
return $this->redirect('/'); |
60
|
|
|
} |
61
|
|
|
$page = $subpage = null; |
62
|
|
|
|
63
|
|
|
if (!empty($path[0])) { |
64
|
|
|
$page = $path[0]; |
65
|
|
|
} |
66
|
|
|
if (!empty($path[1])) { |
67
|
|
|
$subpage = $path[1]; |
68
|
|
|
} |
69
|
|
|
$this->set(compact('page', 'subpage')); |
70
|
|
|
|
71
|
|
|
try { |
72
|
|
|
$this->render(implode('/', $path)); |
73
|
|
|
} catch (MissingTemplateException $e) { |
74
|
|
|
if (Configure::read('debug')) { |
75
|
|
|
throw $e; |
76
|
|
|
} |
77
|
|
|
throw new NotFoundException(); |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|