Merge branch '138-toggle-free-look-with-hotkey' into 'main/atys-live'
[ryzomcore.git] / web / public_php / webtt / app / controllers / pages_controller.php
bloba6d2362b63991f94d7e9dfbd3b71ee0a8fd5c909
1 <?php
2 /**
3 * Static content controller.
5 * This file will render views from views/pages/
7 * PHP versions 4 and 5
9 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
10 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
12 * Licensed under The MIT License
13 * Redistributions of files must retain the above copyright notice.
15 * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
16 * @link http://cakephp.org CakePHP(tm) Project
17 * @package cake
18 * @subpackage cake.cake.libs.controller
19 * @since CakePHP(tm) v 0.2.9
20 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
23 /**
24 * Static content controller
26 * Override this controller by placing a copy in controllers directory of an application
28 * @package cake
29 * @subpackage cake.cake.libs.controller
30 * @link http://book.cakephp.org/view/958/The-Pages-Controller
32 class PagesController extends AppController {
34 /**
35 * Controller name
37 * @var string
38 * @access public
40 var $name = 'Pages';
42 /**
43 * Default helper
45 * @var array
46 * @access public
48 var $helpers = array('Html', 'Session');
50 /**
51 * This controller does not use a model
53 * @var array
54 * @access public
56 var $uses = array();
58 /**
59 * Displays a view
61 * @param mixed What page to display
62 * @access public
64 function display() {
65 $path = func_get_args();
68 $count = count($path);
69 if (!$count) {
70 $this->redirect('/');
72 $page = $subpage = $title_for_layout = null;
74 if (!empty($path[0])) {
75 $page = $path[0];
77 if (!empty($path[1])) {
78 $subpage = $path[1];
80 if (!empty($path[$count - 1])) {
81 $title_for_layout = Inflector::humanize($path[$count - 1]);
83 $this->set(compact('page', 'subpage', 'title_for_layout'));
84 $this->render(implode('/', $path));
87 function admin_display() {
88 $path = func_get_args();
90 /* if (isset($this->params['admin']))
91 array_shift($path);*/
92 if (!isset($path[0]) || $path[0] != 'admin') {
93 //This adds admin to the beginning of the path so the pages controller will look in the 'admin' folder in pages directory
94 $path = array_merge((array)'admin', $path);
96 $count = count($path);
97 if (!$count) {
98 $this->redirect('/');
100 $page = $subpage = $title_for_layout = null;
102 if (!empty($path[0])) {
103 $page = $path[0];
105 if (!empty($path[1])) {
106 $subpage = $path[1];
108 if (!empty($path[$count - 1])) {
109 $title_for_layout = Inflector::humanize($path[$count - 1]);
111 $this->set(compact('page', 'subpage', 'title_for_layout'));
112 $this->render(implode('/', $path));
115 function beforeFilter() {
116 parent::beforeFilter();
117 $this->Auth->allow(array('display'));