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 | * Base class for all backend`s modules |
||
4 | * |
||
5 | * @author Sergey Glagolev <[email protected]>, Nikita Melnikov <[email protected]> |
||
6 | * @link https://github.com/shogodev/argilla/ |
||
7 | * @copyright Copyright © 2003-2014 Shogo |
||
8 | * @license http://argilla.ru/LICENSE |
||
9 | * @package backend.components |
||
10 | */ |
||
11 | class BModule extends CWebModule |
||
12 | { |
||
13 | public $group = 'content'; |
||
14 | |||
15 | public $name = '[Не задано]'; |
||
16 | |||
17 | public $position = 0; |
||
18 | |||
19 | public $enabled = true; |
||
20 | |||
21 | public $autoloaded; |
||
22 | |||
23 | public $defaultUploadDir = 'f/'; |
||
24 | |||
25 | public $thumbsSettings = []; |
||
26 | |||
27 | /** |
||
28 | * Список других модулей, от которых зависит текущий модуль |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | public $moduleDependencies = []; |
||
33 | |||
34 | /** |
||
35 | * Подкаталоги модуля для загрузки |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | public $defaultDirectoriesToImport = array( |
||
40 | 'controllers', |
||
41 | 'models', |
||
42 | 'components', |
||
43 | 'exceptions', |
||
44 | 'modules', |
||
45 | 'behaviors', |
||
46 | '*' |
||
47 | ); |
||
48 | |||
49 | 39 | protected function preinit() |
|
50 | { |
||
51 | 39 | $this->loadControllerMap(); |
|
52 | 39 | } |
|
53 | |||
54 | 39 | public function init() |
|
55 | { |
||
56 | 39 | $import = CMap::mergeArray($this->getAutomaticImport(), $this->loadExtraDirectoriesToImport()); |
|
57 | 39 | $this->setImport($import); |
|
58 | 39 | } |
|
59 | |||
60 | public function beforeControllerAction($controller, $action) |
||
61 | { |
||
62 | if( !$this->enabled ) |
||
63 | throw new CHttpException(404, 'The requested page does not exist.'); |
||
64 | |||
65 | return parent::beforeControllerAction($controller, $action); |
||
66 | } |
||
67 | |||
68 | 3 | public function getUploadPath() |
|
69 | { |
||
70 | 3 | return Yii::app()->getFrontendRoot().$this->defaultUploadDir.$this->id.'/'; |
|
0 ignored issues
–
show
|
|||
71 | } |
||
72 | |||
73 | 4 | public function getUploadUrl() |
|
74 | { |
||
75 | 4 | return Yii::app()->getFrontendUrl().$this->defaultUploadDir.$this->id.'/'; |
|
0 ignored issues
–
show
The method
getFrontendUrl does only exist in BApplication and BTestApplication , but not in FApplication and FTestApplication .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
76 | } |
||
77 | |||
78 | /** |
||
79 | * Возвращаем значения миниатюр для изображений |
||
80 | * Массив сортируем по убыванию, последним элементом должна быть самая маленькая миниатюра. |
||
81 | * Если в массиве присутствует ключ origin, то оригинальное изображение пережимается до указанных |
||
82 | * по этому ключу размеров. |
||
83 | * |
||
84 | * Пример: |
||
85 | * array( |
||
86 | * 'info' => array( |
||
87 | * 'pre' => array( |
||
88 | * 164, // ширина |
||
89 | * 164, // высота |
||
90 | * 'crop' => true, // обрезать края |
||
91 | * 'jpegQuality' => 97 // качество |
||
92 | * ), |
||
93 | * ) |
||
94 | * ); |
||
95 | * |
||
96 | * |
||
97 | * @return array |
||
98 | */ |
||
99 | public function getThumbsSettings() |
||
100 | { |
||
101 | return $this->thumbsSettings; |
||
102 | } |
||
103 | |||
104 | 1 | public function getWatermarkSettings() |
|
105 | { |
||
106 | 1 | return array(); |
|
107 | } |
||
108 | |||
109 | public function getHeaderCssClass() |
||
110 | { |
||
111 | return preg_replace('/(\/.*)/', '', $this->getId()); |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * @return array |
||
116 | */ |
||
117 | public function getParents() |
||
118 | { |
||
119 | $parents = array(); |
||
120 | if( $parent = $this->getParentModule() ) |
||
121 | { |
||
122 | $parents = CMap::mergeArray(array($parent->getName() => $parent), $parent->getParents($parent)); |
||
123 | } |
||
124 | |||
125 | return array_reverse($parents); |
||
126 | } |
||
127 | |||
128 | public function createUrl($route, $params=array(), $ampersand='&') |
||
129 | { |
||
130 | $parents = CMap::mergeArray(array_keys($this->getParents()), array($this->id)); |
||
131 | $route = implode('/', CMap::mergeArray($parents, array($route))); |
||
132 | |||
133 | return Yii::app()->createUrl($route, $params, $ampersand); |
||
134 | } |
||
135 | |||
136 | /** |
||
137 | * Возвращает массив контроллеров, которые нужно отображать в меню |
||
138 | * |
||
139 | * @return array |
||
140 | */ |
||
141 | public function getMenuControllers() |
||
142 | { |
||
143 | return array(); |
||
144 | } |
||
145 | |||
146 | public function getControllerId($class) |
||
147 | { |
||
148 | if( $id = array_search($class, $this->controllerMap) ) |
||
149 | return $id; |
||
150 | |||
151 | throw new CHttpException(500, $class.' не найден в controllerMap модуля '.$this->getName() ); |
||
0 ignored issues
–
show
![]() |
|||
152 | } |
||
153 | |||
154 | /** |
||
155 | * Загрузка всех контроллеров из модуля в controllerMap |
||
156 | */ |
||
157 | 39 | protected function loadControllerMap() |
|
158 | { |
||
159 | 39 | if( $this->controllerMap !== [] ) |
|
160 | 39 | return; |
|
161 | |||
162 | 39 | if( file_exists($this->getControllerPath()) ) |
|
163 | 39 | { |
|
164 | 39 | foreach( CFileHelper::findFiles($this->getControllerPath(), array('fileTypes' => array('php'))) as $controllerFilePath ) |
|
165 | { |
||
166 | 39 | $controllerFilePathParts = explode(DIRECTORY_SEPARATOR, $controllerFilePath); |
|
167 | 39 | $controllerName = str_replace('.php', '', end($controllerFilePathParts)); |
|
168 | 39 | $controllerAlias = $this->getControllerAlias($controllerName); |
|
169 | |||
170 | 39 | if( empty($this->controllerMap[$controllerAlias]) ) |
|
171 | 39 | $this->controllerMap[$controllerAlias] = $controllerName; |
|
172 | 39 | } |
|
173 | 39 | } |
|
174 | else |
||
175 | Yii::log('Невозможно загрузить директорию контроллеров '.get_class($this).' по пути '.$this->getControllerPath()); |
||
176 | 39 | } |
|
177 | |||
178 | /** |
||
179 | * Получение синонима контроллера для controllerMap |
||
180 | * |
||
181 | * @param string controller |
||
182 | * |
||
183 | * @return string |
||
184 | */ |
||
185 | 39 | protected function getControllerAlias($controller) |
|
186 | { |
||
187 | 39 | return lcfirst(str_replace('Controller', '', BApplication::cutClassPrefix($controller))); |
|
188 | } |
||
189 | |||
190 | /** |
||
191 | * Получение синонимов для автоматического импорта модуля |
||
192 | * |
||
193 | * @return array |
||
194 | */ |
||
195 | 39 | protected function getAutomaticImport() |
|
196 | { |
||
197 | 39 | $import = array(); |
|
198 | |||
199 | 39 | foreach($this->defaultDirectoriesToImport as $directory) |
|
200 | { |
||
201 | 39 | $import[] = "{$this->id}.{$directory}.*"; |
|
202 | 39 | } |
|
203 | |||
204 | 39 | return $import; |
|
205 | } |
||
206 | |||
207 | /** |
||
208 | * Загрузка дополнительный директорий для импорта |
||
209 | * Синоним пути должен быть полным (backend.modules.somemodule.models.*) |
||
210 | * |
||
211 | * @return array |
||
212 | * @throws CException |
||
213 | */ |
||
214 | 39 | final protected function loadExtraDirectoriesToImport() |
|
215 | { |
||
216 | 39 | $import = array(); |
|
217 | |||
218 | 39 | foreach( $this->getExtraDirectoriesToImport() as $directory ) |
|
219 | { |
||
220 | 6 | if( !preg_match('/backend/', $directory) ) |
|
221 | 6 | throw new CException('Неверный формат импорта для '.$directory.' в '.get_class($this)); |
|
222 | |||
223 | 6 | $import[] = $directory; |
|
224 | 39 | } |
|
225 | |||
226 | 39 | return $import; |
|
227 | } |
||
228 | |||
229 | /** |
||
230 | * Получение дополнительных поддиректорий для импорта в модуле |
||
231 | * |
||
232 | * @return array |
||
233 | */ |
||
234 | 34 | protected function getExtraDirectoriesToImport() |
|
235 | { |
||
236 | 34 | return array(); |
|
237 | } |
||
238 | } |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: