3 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
4 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
6 * Licensed under The MIT License
7 * For full copyright and license information, please see the LICENSE.txt
8 * Redistributions of files must retain the above copyright notice.
10 * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
11 * @link http://cakephp.org CakePHP(tm) Project
13 * @license http://www.opensource.org/licenses/mit-license.php MIT License
15 namespace App\Controller;
17 use Cake\Core\Configure;
18 use Cake\Network\Exception\ForbiddenException;
19 use Cake\Network\Exception\NotFoundException;
20 use Cake\View\Exception\MissingTemplateException;
23 * Static content controller
25 * This controller will render views from Template/Pages/
27 * @link http://book.cakephp.org/3.0/en/controllers/pages-controller.html
29 class PagesController extends AppController
35 * @param string ...$path Path segments.
36 * @return void|\Cake\Network\Response
37 * @throws \Cake\Network\Exception\ForbiddenException When a directory traversal attempt.
38 * @throws \Cake\Network\Exception\NotFoundException When the view file could not
39 * be found or \Cake\View\Exception\MissingTemplateException in debug mode.
41 public function display(...$path)
43 $count = count($path);
45 return $this->redirect('/');
47 if (in_array('..', $path, true) || in_array('.', $path, true)) {
48 throw new ForbiddenException();
50 $page = $subpage = null;
52 if (!empty($path[0])) {
55 if (!empty($path[1])) {
58 $this->set(compact('page', 'subpage'));
61 $this->render(implode('/', $path));
62 } catch (MissingTemplateException $e) {
63 if (Configure::read('debug')) {
66 throw new NotFoundException();