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 | /** |
||
4 | * @link http://phe.me |
||
5 | * @copyright Copyright (c) 2014 Pheme |
||
6 | * @license MIT http://opensource.org/licenses/MIT |
||
7 | */ |
||
8 | |||
9 | namespace pheme\settings\controllers; |
||
10 | |||
11 | use Yii; |
||
12 | use pheme\settings\models\Setting; |
||
13 | use pheme\settings\models\SettingSearch; |
||
14 | use pheme\grid\actions\ToggleAction; |
||
15 | use yii\filters\AccessControl; |
||
16 | use yii\web\Controller; |
||
17 | use yii\web\NotFoundHttpException; |
||
18 | use yii\filters\VerbFilter; |
||
19 | |||
20 | /** |
||
21 | * SettingsController implements the CRUD actions for Setting model. |
||
22 | * |
||
23 | * @author Aris Karageorgos <[email protected]> |
||
24 | */ |
||
25 | class DefaultController extends Controller |
||
26 | { |
||
27 | /** |
||
28 | * Defines the controller behaviors |
||
29 | * @return array |
||
30 | */ |
||
31 | public function behaviors() |
||
32 | { |
||
33 | return [ |
||
34 | 'verbs' => [ |
||
35 | 'class' => VerbFilter::className(), |
||
0 ignored issues
–
show
|
|||
36 | 'actions' => [ |
||
37 | 'delete' => ['post'], |
||
38 | ], |
||
39 | ], |
||
40 | 'access' => [ |
||
41 | 'class' => AccessControl::className(), |
||
0 ignored issues
–
show
The method
yii\base\BaseObject::className() has been deprecated with message: since 2.0.14. On PHP >=5.5, use `::class` instead.
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
42 | 'rules' => [ |
||
43 | [ |
||
44 | 'allow' => true, |
||
45 | 'roles' => $this->module->accessRoles, |
||
46 | ], |
||
47 | ], |
||
48 | ], |
||
49 | ]; |
||
50 | } |
||
51 | |||
52 | public function actions() |
||
53 | { |
||
54 | return [ |
||
55 | 'toggle' => [ |
||
56 | 'class' => ToggleAction::className(), |
||
0 ignored issues
–
show
The method
yii\base\BaseObject::className() has been deprecated with message: since 2.0.14. On PHP >=5.5, use `::class` instead.
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
57 | 'modelClass' => 'pheme\settings\models\Setting', |
||
58 | //'setFlash' => true, |
||
59 | ] |
||
60 | ]; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Lists all Settings. |
||
65 | * @return mixed |
||
66 | */ |
||
67 | public function actionIndex() |
||
68 | { |
||
69 | $searchModel = new SettingSearch(); |
||
70 | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); |
||
71 | |||
72 | return $this->render( |
||
73 | 'index', |
||
74 | [ |
||
75 | 'searchModel' => $searchModel, |
||
76 | 'dataProvider' => $dataProvider, |
||
77 | ] |
||
78 | ); |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * Displays the details of a single Setting. |
||
83 | * @param integer $id |
||
84 | * @return mixed |
||
85 | */ |
||
86 | public function actionView($id) |
||
87 | { |
||
88 | return $this->render( |
||
89 | 'view', |
||
90 | [ |
||
91 | 'model' => $this->findModel($id), |
||
92 | ] |
||
93 | ); |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * Creates a new Setting. |
||
98 | * If creation is successful, the browser will be redirected to the 'view' page. |
||
99 | * @return mixed |
||
100 | */ |
||
101 | public function actionCreate() |
||
102 | { |
||
103 | $model = new Setting(['active' => 1]); |
||
104 | |||
105 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
||
106 | return $this->redirect(['view', 'id' => $model->id]); |
||
107 | } else { |
||
108 | return $this->render( |
||
109 | 'create', |
||
110 | [ |
||
111 | 'model' => $model, |
||
112 | ] |
||
113 | ); |
||
114 | } |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * Updates an existing Setting. |
||
119 | * If update is successful, the browser will be redirected to the 'view' page. |
||
120 | * @param integer $id |
||
121 | * @return mixed |
||
122 | */ |
||
123 | public function actionUpdate($id) |
||
124 | { |
||
125 | $model = $this->findModel($id); |
||
126 | |||
127 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
||
128 | return $this->redirect(['view', 'id' => $model->id]); |
||
129 | } else { |
||
130 | return $this->render( |
||
131 | 'update', |
||
132 | [ |
||
133 | 'model' => $model, |
||
134 | ] |
||
135 | ); |
||
136 | } |
||
137 | } |
||
138 | |||
139 | /** |
||
140 | * Deletes an existing Setting. |
||
141 | * If deletion is successful, the browser will be redirected to the 'index' page. |
||
142 | * @param integer $id |
||
143 | * @return mixed |
||
144 | */ |
||
145 | public function actionDelete($id) |
||
146 | { |
||
147 | if (Yii::$app->request->isPost) { |
||
148 | $this->findModel($id)->delete(); |
||
149 | } |
||
150 | return $this->redirect(['index']); |
||
151 | } |
||
152 | |||
153 | /** |
||
154 | * Finds a Setting model based on its primary key value. |
||
155 | * If the model is not found, a 404 HTTP exception will be thrown. |
||
156 | * @param integer $id |
||
157 | * @return Setting the loaded model |
||
158 | * @throws NotFoundHttpException if the model cannot be found |
||
159 | */ |
||
160 | protected function findModel($id) |
||
161 | { |
||
162 | if (($model = Setting::findOne($id)) !== null) { |
||
0 ignored issues
–
show
The expression
\pheme\settings\models\Setting::findOne($id); of type yii\db\ActiveRecordInterface|array|null adds the type array to the return on line 163 which is incompatible with the return type documented by pheme\settings\controlle...ltController::findModel of type pheme\settings\models\Setting .
![]() |
|||
163 | return $model; |
||
164 | } else { |
||
165 | throw new NotFoundHttpException('The requested page does not exist.'); |
||
166 | } |
||
167 | } |
||
168 | } |
||
169 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.