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 | * YiiDebugToolbar class file. |
||
4 | * |
||
5 | * @author Sergey Malyshev <[email protected]> |
||
6 | */ |
||
7 | |||
8 | Yii::import('yii-debug-toolbar.panels.*'); |
||
9 | Yii::import('yii-debug-toolbar.widgets.*'); |
||
10 | |||
11 | /** |
||
12 | * YiiDebugToolbar represents an ... |
||
13 | * |
||
14 | * Description of YiiDebugToolbar |
||
15 | * |
||
16 | * @author Sergey Malyshev <[email protected]> |
||
17 | * @author Igor Golovanov <[email protected]> |
||
18 | * @version $Id$ |
||
19 | * @package YiiDebugToolbar |
||
20 | * @since 1.1.7 |
||
21 | */ |
||
22 | class YiiDebugToolbar extends CWidget |
||
23 | { |
||
24 | /** |
||
25 | * CSS File. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | public $cssFile; |
||
30 | |||
31 | /** |
||
32 | * The URL of assets. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | private $_assetsUrl; |
||
37 | |||
38 | /** |
||
39 | * Panels. |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | private $_panels; |
||
44 | |||
45 | /** |
||
46 | * Setup toolbar panels. |
||
47 | * |
||
48 | * @param array $panels Panels. |
||
49 | * @return YiiDebugToolbar |
||
50 | */ |
||
51 | public function setPanels(array $panels = array()) |
||
52 | { |
||
53 | $this->_panels = $panels; |
||
54 | return $this; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Get toolbar panels. |
||
59 | * |
||
60 | * @return array |
||
61 | */ |
||
62 | public function getPanels() |
||
63 | { |
||
64 | if(null === $this->_panels) |
||
65 | { |
||
66 | $this->_panels = array(); |
||
67 | } |
||
68 | return $this->_panels; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * Get the URL of assets. |
||
73 | * The base URL that contains all published asset files of yii-debug-toolbar. |
||
74 | * @return string |
||
75 | */ |
||
76 | public function getAssetsUrl() |
||
77 | { |
||
78 | if (null === $this->_assetsUrl && 'cli' !== php_sapi_name()) |
||
79 | $this->_assetsUrl = Yii::app() |
||
80 | ->getAssetManager() |
||
81 | ->publish(dirname(__FILE__) . '/assets', false, -1, YII_DEBUG); |
||
82 | return $this->_assetsUrl; |
||
83 | } |
||
84 | |||
85 | public function getLogs() |
||
86 | { |
||
87 | return $this->owner->logs; |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * Set the URL of assets. |
||
92 | * The base URL that contains all published asset files of yii-debug-toolbar. |
||
93 | * |
||
94 | * @param string $value |
||
95 | */ |
||
96 | public function setAssetsUrl($value) |
||
97 | { |
||
98 | $this->_assetsUrl = $value; |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * Initialization. |
||
103 | */ |
||
104 | public function init() |
||
105 | { |
||
106 | if (false === ($this->owner instanceof CLogRoute)) |
||
0 ignored issues
–
show
|
|||
107 | { |
||
108 | throw new CException(YiiDebug::t('YiiDebugToolbar owner must be instance of CLogRoute')); |
||
109 | } |
||
110 | |||
111 | $this->createPanels() |
||
112 | ->registerClientScripts(); |
||
113 | } |
||
114 | |||
115 | /** |
||
116 | * Run. |
||
117 | */ |
||
118 | public function run() |
||
119 | { |
||
120 | $this->render('yii_debug_toolbar', array( |
||
121 | 'panels' => $this->getPanels() |
||
122 | )); |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * Register client scripts. |
||
127 | * |
||
128 | * @return YiiDebugToolbar |
||
129 | */ |
||
130 | private function registerClientScripts() |
||
131 | { |
||
132 | $cs = Yii::app()->getClientScript(); |
||
133 | $cs->registerCoreScript('jquery'); |
||
134 | $cs->registerCoreScript('cookie'); |
||
135 | |||
136 | if (false !== $this->cssFile) |
||
137 | { |
||
138 | if (null === $this->cssFile) |
||
139 | $this->cssFile = $this->assetsUrl . '/yii.debugtoolbar.css'; |
||
140 | $cs->registerCssFile($this->cssFile); |
||
141 | } |
||
142 | |||
143 | $cs->registerScriptFile($this->assetsUrl . '/yii.debugtoolbar.js', |
||
144 | CClientScript::POS_END); |
||
145 | |||
146 | return $this; |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * Create panels. |
||
151 | * |
||
152 | * @return YiiDebugToolbar |
||
153 | */ |
||
154 | private function createPanels() |
||
155 | { |
||
156 | foreach ($this->getPanels() as $id => $config) |
||
157 | { |
||
158 | if (!is_object($config)) |
||
159 | { |
||
160 | if(is_array($config)) |
||
161 | { |
||
162 | isset($config['class']) || $config['class'] = $id; |
||
163 | if (isset($config['enabled']) && false === $config['enabled']) |
||
164 | { |
||
165 | unset($this->_panels[$id]); |
||
166 | continue; |
||
167 | } |
||
168 | else if (isset($config['enabled']) && true === $config['enabled']) |
||
169 | { |
||
170 | unset($config['enabled']); |
||
171 | } |
||
172 | } |
||
173 | $panel = Yii::createComponent($config, $this); |
||
174 | |||
175 | if (false === ($panel instanceof YiiDebugToolbarPanelInterface)) |
||
176 | { |
||
177 | throw new CException(Yii::t('yii-debug-toolbar', |
||
178 | 'The %class% class must be compatible with YiiDebugToolbarPanelInterface', array( |
||
179 | '%class%' => get_class($panel) |
||
180 | ))); |
||
181 | } |
||
182 | $panel->init(); |
||
183 | $this->_panels[$id] = $panel; |
||
184 | } |
||
185 | } |
||
186 | return $this; |
||
187 | } |
||
188 | } |
||
189 | |||
190 | /** |
||
191 | * YiiDebugToolbarPanelInterface |
||
192 | * |
||
193 | * @author Sergey Malyshev <[email protected]> |
||
194 | * @author Igor Golovanov <[email protected]> |
||
195 | * @version $Id$ |
||
196 | * @package YiiDebugToolbar |
||
197 | * @since 1.1.7 |
||
198 | */ |
||
199 | interface YiiDebugToolbarPanelInterface |
||
200 | { |
||
201 | /** |
||
202 | * Get the title of menu. |
||
203 | * |
||
204 | * @return string |
||
205 | */ |
||
206 | function getMenuTitle(); |
||
207 | |||
208 | /** |
||
209 | * Get the subtitle of menu. |
||
210 | * |
||
211 | * @return string |
||
212 | */ |
||
213 | function getMenuSubTitle(); |
||
214 | |||
215 | /** |
||
216 | * Get the title. |
||
217 | * |
||
218 | * @return string |
||
219 | */ |
||
220 | function getTitle(); |
||
221 | |||
222 | /** |
||
223 | * Get the subtitle. |
||
224 | * |
||
225 | * @return string |
||
226 | */ |
||
227 | function getSubTitle(); |
||
228 | } |
||
229 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.