Issues (20)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/controllers/DefaultController.php (2 issues)

Upgrade to new PHP Analysis Engine

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 zacksleo\yii2\ad\controllers;
4
5
use Yii;
6
use zacksleo\yii2\ad\models\AdPosition;
7
use yii\data\ActiveDataProvider;
8
use yii\web\Controller;
9
use yii\web\NotFoundHttpException;
10
use yii\filters\VerbFilter;
11
12
/**
13
 * AdPositionController implements the CRUD actions for AdPosition model.
14
 */
15
class DefaultController extends Controller
16
{
17
    /**
18
     * @inheritdoc
19
     */
20
    public function behaviors()
21
    {
22
        return [
23
            'verbs' => [
24
                'class' => VerbFilter::className(),
0 ignored issues
show
Deprecated Code introduced by
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.

Loading history...
25
                'actions' => [
26
                    'delete' => ['POST'],
27
                ],
28
            ],
29
        ];
30
    }
31
32
    /**
33
     * Lists all AdPosition models.
34
     * @return mixed
35
     */
36
    public function actionIndex()
37
    {
38
        $dataProvider = new ActiveDataProvider([
39
            'query' => AdPosition::find(),
40
        ]);
41
42
        return $this->render('index', [
43
            'dataProvider' => $dataProvider,
44
        ]);
45
    }
46
47
    /**
48
     * Displays a single AdPosition model.
49
     * @param integer $id
50
     * @return mixed
51
     */
52
    public function actionView($id)
53
    {
54
        return $this->render('view', [
55
            'model' => $this->findModel($id),
56
        ]);
57
    }
58
59
    /**
60
     * Creates a new AdPosition model.
61
     * If creation is successful, the browser will be redirected to the 'view' page.
62
     * @return mixed
63
     */
64
    public function actionCreate()
65
    {
66
        $model = new AdPosition();
67
68
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
69
            return $this->redirect(['view', 'id' => $model->id]);
70
        } else {
71
            return $this->render('create', [
72
                'model' => $model,
73
            ]);
74
        }
75
    }
76
77
    /**
78
     * Updates an existing AdPosition model.
79
     * If update is successful, the browser will be redirected to the 'view' page.
80
     * @param integer $id
81
     * @return mixed
82
     */
83
    public function actionUpdate($id)
84
    {
85
        $model = $this->findModel($id);
86
87
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
88
            return $this->redirect(['view', 'id' => $model->id]);
89
        } else {
90
            return $this->render('update', [
91
                'model' => $model,
92
            ]);
93
        }
94
    }
95
96
    /**
97
     * Deletes an existing AdPosition model.
98
     * If deletion is successful, the browser will be redirected to the 'index' page.
99
     * @param integer $id
100
     * @return mixed
101
     */
102
    public function actionDelete($id)
103
    {
104
        $this->findModel($id)->delete();
105
106
        return $this->redirect(['index']);
107
    }
108
109
    /**
110
     * Finds the AdPosition model based on its primary key value.
111
     * If the model is not found, a 404 HTTP exception will be thrown.
112
     * @param integer $id
113
     * @return AdPosition the loaded model
114
     * @throws NotFoundHttpException if the model cannot be found
115
     */
116
    protected function findModel($id)
117
    {
118
        if (($model = AdPosition::findOne($id)) !== null) {
0 ignored issues
show
Bug Compatibility introduced by
The expression \zacksleo\yii2\ad\models\AdPosition::findOne($id); of type yii\db\ActiveRecordInterface|array|null adds the type array to the return on line 119 which is incompatible with the return type documented by zacksleo\yii2\ad\control...ltController::findModel of type zacksleo\yii2\ad\models\AdPosition.
Loading history...
119
            return $model;
120
        } else {
121
            throw new NotFoundHttpException('The requested page does not exist.');
122
        }
123
    }
124
}
125