This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Created by PhpStorm. |
||
4 | * User: egorov |
||
5 | * Date: 08.04.2015 |
||
6 | * Time: 13:22 |
||
7 | */ |
||
8 | namespace samsoncms\template; |
||
9 | |||
10 | use samson\core\CompressableExternalModule; |
||
11 | use samsonphp\event\Event; |
||
12 | |||
13 | /** |
||
14 | * Base SamsonCMS template controller |
||
15 | * @package samsoncms\template |
||
16 | */ |
||
17 | class Template extends CompressableExternalModule |
||
0 ignored issues
–
show
|
|||
18 | { |
||
19 | /** Event when main page rendering has started */ |
||
20 | const E_MAIN_STARTED = 'template.main.started'; |
||
21 | |||
22 | /** Event when main page rendering has finished */ |
||
23 | const E_MAIN_RENDERED= 'template.main.rendered'; |
||
24 | |||
25 | /** Event when #template-menu rendering has started */ |
||
26 | const E_MENU_STARTED = 'template.menu.started'; |
||
27 | |||
28 | /** Event when #template-menu rendering has finished */ |
||
29 | const E_MENU_RENDERED = 'template.menu.rendered'; |
||
30 | |||
31 | /** Event when #e404 rendering has started */ |
||
32 | const E_E404_STARTED = 'template.e404.started'; |
||
33 | |||
34 | /** Event when #e404 rendering has finished */ |
||
35 | const E_E404_RENDERED = 'template.e404.rendered'; |
||
36 | |||
37 | |||
38 | /** @var bool Flag to show SamsonCMS logo in menu */ |
||
39 | public $menuLogo = 'www/menu/img/logo_w.png'; |
||
40 | |||
41 | |||
42 | /** @var string Module identifier */ |
||
43 | protected $id = 'template'; |
||
44 | |||
45 | /** Subscribed to e404 */ |
||
46 | //p0ublic function init(array $params = array()) |
||
47 | //{ |
||
48 | // Event::subscribe('core.e404', array($this, '__e404')); |
||
49 | //} |
||
50 | |||
51 | /** |
||
52 | * Universal controller action, this is SamsonCMS main page |
||
53 | * rendering. |
||
54 | */ |
||
55 | public function __handler() |
||
56 | { |
||
57 | // HTML main #template-container |
||
58 | $html = ''; |
||
59 | |||
60 | Event::fire('template.main.started', array(&$html)); |
||
61 | Event::fire('template.main.rendered', array(&$html)); |
||
62 | |||
63 | // Prepare view |
||
64 | $this->view('container') |
||
65 | ->title(t('Главная', true)) |
||
0 ignored issues
–
show
The function
t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
66 | ->set($html, 'template-container'); |
||
67 | } |
||
68 | |||
69 | /** #template-menu rendering controller action */ |
||
70 | public function __menu() |
||
71 | { |
||
72 | // HTML main #template-menu |
||
73 | $html = ''; |
||
74 | $submenu = ''; |
||
75 | |||
76 | $html .= $this->view('menu/item') |
||
77 | ->set('home', 'icon') |
||
78 | ->set(t('Главная', true), 'name') |
||
0 ignored issues
–
show
The function
t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
79 | ->set('homeLink', 'class') |
||
80 | ->set(url()->module == '' ? 'active' : '', 'active') |
||
81 | ->output(); |
||
82 | |||
83 | $html .= $this->view('menu/item') |
||
84 | ->set('globe', 'icon') |
||
85 | ->set('../', 'id') |
||
86 | ->set(t('На сайт', true), 'name') |
||
0 ignored issues
–
show
The function
t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
87 | ->set('_blank', 'target') |
||
88 | ->output(); |
||
89 | |||
90 | Event::fire('template.menu.started', array(&$html, &$submenu)); |
||
91 | |||
92 | $html .= $this->view('menu/item') |
||
93 | ->set('sign-out', 'icon') |
||
94 | ->set('sign-out', 'class') |
||
95 | ->set('signin/logout', 'id') |
||
96 | ->set(t('Выход', true), 'name') |
||
0 ignored issues
–
show
The function
t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
97 | ->output(); |
||
98 | |||
99 | Event::fire('template.menu.rendered', array(&$html, &$submenu)); |
||
100 | |||
101 | // Prepare view |
||
102 | $this->view('menu/index') |
||
103 | // TODO: Remove samson\core\Core dependency |
||
104 | ->set(url()->module, 'module') |
||
105 | ->set($this->menuLogo, 'logo') |
||
106 | |||
107 | ->set($html, 'template-menu') |
||
108 | ->set($submenu, 'submenu'); |
||
109 | } |
||
110 | |||
111 | /** E404 controller action */ |
||
112 | function __e404() |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
It is recommend to declare an explicit visibility for
__e404 .
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed. If you are not sure which visibility to choose, it is a good idea to start with
the most restrictive visibility, and then raise visibility as needed, i.e.
start with ![]() |
|||
113 | { |
||
114 | // HTML main #template-container |
||
115 | $html = ''; |
||
116 | |||
117 | $this->system->active($this); |
||
118 | |||
119 | Event::fire('template.e404.started', array(&$html)); |
||
120 | Event::fire('template.e404.rendered', array(&$html)); |
||
121 | |||
122 | // Render template e404 into local module |
||
123 | m('local')->html( |
||
0 ignored issues
–
show
The function
m() has been deprecated with message: Use $this->system->module() in module context
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
124 | $this->view('e404') |
||
125 | ->set($html, 'template-container') |
||
126 | ->output() |
||
127 | )->title(t('Страница не найдена', true)); |
||
0 ignored issues
–
show
The function
t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
128 | |||
129 | header("HTTP/1.0 404 Not Found"); |
||
130 | } |
||
131 | } |
||
132 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.