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 | namespace app\backend\models; |
||
4 | |||
5 | use app; |
||
6 | use app\modules\config\models\BaseConfigurationModel; |
||
7 | use Yii; |
||
8 | |||
9 | /** |
||
10 | * Class ConfigConfigurationModel represents configuration model for retrieving user input |
||
11 | * in backend configuration subsystem. |
||
12 | * |
||
13 | * @package app\backend\models |
||
14 | */ |
||
15 | class ConfigConfigurationModel extends BaseConfigurationModel |
||
16 | { |
||
17 | /** |
||
18 | * @var boolean Should we show backend floating panel on bottom? |
||
19 | */ |
||
20 | public $floatingPanelBottom = false; |
||
21 | |||
22 | public $wysiwygUploadDir = '/upload/images'; |
||
23 | |||
24 | public $backendEditGrids = []; |
||
25 | |||
26 | /** |
||
27 | * @inheritdoc |
||
28 | */ |
||
29 | public function rules() |
||
30 | { |
||
31 | return [ |
||
32 | [ |
||
33 | [ |
||
34 | 'floatingPanelBottom', |
||
35 | ], |
||
36 | 'boolean', |
||
37 | ], |
||
38 | [ |
||
39 | [ |
||
40 | 'floatingPanelBottom', |
||
41 | ], |
||
42 | 'filter', |
||
43 | 'filter' => 'boolval', |
||
44 | ], |
||
45 | [ |
||
46 | [ |
||
47 | 'wysiwygUploadDir', |
||
48 | ], |
||
49 | 'required', |
||
50 | ], |
||
51 | [ |
||
52 | ['backendEditGrids'], 'each', 'rule' => ['each', 'rule' => ['string']], |
||
53 | ], |
||
54 | ]; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @inheritdoc |
||
59 | */ |
||
60 | public function attributeLabels() |
||
61 | { |
||
62 | return [ |
||
63 | 'floatingPanelBottom' => Yii::t('app', 'Display backend floating panel on bottom'), |
||
64 | ]; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @inheritdoc |
||
69 | */ |
||
70 | public function defaultValues() |
||
71 | { |
||
72 | /** @var app\backend\BackendModule $module */ |
||
73 | $module = Yii::$app->modules['backend']; |
||
74 | |||
75 | $attributes = array_keys($this->getAttributes()); |
||
76 | foreach ($attributes as $attribute) { |
||
77 | if ($module->hasProperty($attribute)) { |
||
78 | $this->{$attribute} = $module->{$attribute}; |
||
79 | } |
||
80 | } |
||
81 | $this->floatingPanelBottom = false; |
||
82 | if (is_array($module->floatingPanel)) { |
||
83 | if (isset($module->floatingPanel['bottom'])) { |
||
84 | $this->floatingPanelBottom = $module->floatingPanel['bottom']; |
||
85 | } |
||
86 | } |
||
87 | } |
||
88 | |||
89 | /** |
||
90 | * Returns array of module configuration that should be stored in application config. |
||
91 | * Array should be ready to merge in app config. |
||
92 | * Used both for web only. |
||
93 | * |
||
94 | * @return array |
||
0 ignored issues
–
show
|
|||
95 | */ |
||
96 | public function webApplicationAttributes() |
||
97 | { |
||
98 | $attributes = $this->getAttributes(null, ['floatingPanelBottom']); |
||
99 | $attributes['floatingPanel'] = [ |
||
100 | 'bottom' => $this->floatingPanelBottom, |
||
101 | ]; |
||
102 | |||
103 | return [ |
||
104 | 'modules' => [ |
||
105 | 'backend' => $attributes, |
||
106 | ], |
||
107 | ]; |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * Returns array of module configuration that should be stored in application config. |
||
112 | * Array should be ready to merge in app config. |
||
113 | * Used both for console only. |
||
114 | * |
||
115 | * @return array |
||
116 | */ |
||
117 | public function consoleApplicationAttributes() |
||
118 | { |
||
119 | return []; |
||
120 | } |
||
121 | |||
122 | /** |
||
123 | * Returns array of module configuration that should be stored in application config. |
||
124 | * Array should be ready to merge in app config. |
||
125 | * Used both for web and console. |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | public function commonApplicationAttributes() |
||
130 | { |
||
131 | return []; |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * Returns array of key=>values for configuration. |
||
136 | * |
||
137 | * @return mixed |
||
138 | */ |
||
139 | public function keyValueAttributes() |
||
140 | { |
||
141 | return []; |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * Returns array of aliases that should be set in common config |
||
146 | * @return array |
||
147 | */ |
||
148 | public function aliases() |
||
149 | { |
||
150 | return []; |
||
151 | } |
||
152 | |||
153 | public function getAllBackendEditGrids() |
||
154 | { |
||
155 | $grids = []; |
||
156 | foreach (Yii::$app->getModules(true) as $module) { |
||
157 | /** @var app\backend\BackendModule $module */ |
||
158 | $moduleGrids = $module->hasMethod('getBackendGrids') ? $module->getBackendGrids() : null; |
||
0 ignored issues
–
show
The method
getBackendGrids does not exist on object<app\backend\BackendModule> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
![]() |
|||
159 | if (!empty($moduleGrids)) { |
||
160 | $grids[$module->id] = $moduleGrids; |
||
161 | if (!isset($this->backendEditGrids[$module->id])) { |
||
162 | $this->backendEditGrids[$module->id] = []; |
||
163 | } |
||
164 | foreach ($moduleGrids as $grid) { |
||
165 | if (!isset($this->backendEditGrids[$module->id][$grid['key']])) { |
||
166 | $this->backendEditGrids[$module->id][$grid['key']] = $grid['defaultValue']; |
||
167 | } |
||
168 | } |
||
169 | } |
||
170 | } |
||
171 | return $grids; |
||
172 | } |
||
173 | } |
||
174 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.