GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (2170)

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.

backend/controllers/BackendMenuController.php (5 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 app\backend\controllers;
4
5
use app\backend\models\BackendMenu;
6
use devgroup\JsTreeWidget\AdjacencyFullTreeDataAction;
7
use Yii;
8
use yii\filters\AccessControl;
9
use yii\helpers\Url;
10
use yii\web\Controller;
11
use yii\web\Cookie;
12
use yii\web\HttpException;
13
use yii\web\NotFoundHttpException;
14
use yii\web\ServerErrorHttpException;
15
16
class BackendMenuController extends Controller
17
{
18
19 View Code Duplication
    public function behaviors()
20
    {
21
        return [
22
            'access' => [
23
                'class' => AccessControl::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...
24
                'rules' => [
25
                    [
26
                        'allow' => true,
27
                        'roles' => ['setting manage'],
28
                    ],
29
                ],
30
            ],
31
        ];
32
    }
33
34 View Code Duplication
    public function actions()
35
    {
36
        return [
37
            'getTree' => [
38
                'class' => AdjacencyFullTreeDataAction::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...
39
                'class_name' => BackendMenu::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...
40
                'model_label_attribute' => 'name',
41
            ],
42
        ];
43
    }
44
45 View Code Duplication
    public function actionIndex($parent_id = 1)
46
    {
47
        $searchModel = new BackendMenu();
48
        $searchModel->parent_id = $parent_id;
49
50
        $params = Yii::$app->request->get();
51
52
        $dataProvider = $searchModel->search($params);
53
54
        $model = null;
55
        if ($parent_id > 0) {
56
            $model = BackendMenu::findOne($parent_id);
57
        }
58
59
        return $this->render(
60
            'index',
61
            [
62
                'dataProvider' => $dataProvider,
63
                'searchModel' => $searchModel,
64
                'model' => $model,
65
            ]
66
        );
67
    }
68
69
    public function actionEdit($parent_id = null, $id = null)
70
    {
71
        if (null === $parent_id) {
72
            throw new NotFoundHttpException;
73
        }
74
75
        /** @var null|BackendMenu|HasProperties $model */
76
        $model = null;
77
        if (null !== $id) {
78
            $model = BackendMenu::findById($id);
79
        } else {
80
            if (null !== $parent = BackendMenu::findById($parent_id)) {
81
                $model = new BackendMenu;
82
                $model->loadDefaultValues();
83
                $model->parent_id = $parent_id;
84
85
            } else {
86
                $model = new BackendMenu;
87
                $model->loadDefaultValues();
88
                $model->parent_id = 0;
89
            }
90
        }
91
92
        if (null === $model) {
93
            throw new ServerErrorHttpException;
94
        }
95
96
        $post = \Yii::$app->request->post();
97
        if ($model->load($post) && $model->validate()) {
98
            if ($model->save()) {
99
                Yii::$app->session->setFlash('success', Yii::t('app', 'Record has been saved'));
100
                $returnUrl = Yii::$app->request->get('returnUrl', ['/backend/backend-menu/index']);
101
                switch (Yii::$app->request->post('action', 'save')) {
102
                    case 'next':
103
                        return $this->redirect(
104
                            [
105
                                '/backend/backend-menu/edit',
106
                                'returnUrl' => $returnUrl,
107
                            ]
108
                        );
109
                    case 'back':
110
                        return $this->redirect($returnUrl);
111
                    default:
112
                        return $this->redirect(
113
                            Url::toRoute(
114
                                [
115
                                    '/backend/backend-menu/edit',
116
                                    'id' => $model->id,
117
                                    'returnUrl' => $returnUrl,
118
                                    'parent_id' => $model->parent_id
119
                                ]
120
                            )
121
                        );
122
                }
123
124
            } else {
125
                throw new ServerErrorHttpException;
126
            }
127
        }
128
129
        return $this->render(
130
            'form',
131
            [
132
                'model' => $model,
133
            ]
134
        );
135
    }
136
137
    public function actionDelete($id = null, $parent_id = null)
0 ignored issues
show
The parameter $parent_id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
138
    {
139
140
        if ((null === $id) || (null === $model = BackendMenu::findById($id))) {
141
            throw new NotFoundHttpException;
142
        }
143
144
        if (!$model->delete()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $model->delete() of type false|integer is loosely compared to false; this is ambiguous if the integer can be zero. You might want to explicitly use === null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
145
            Yii::$app->session->setFlash('success', Yii::t('app', 'The object is placed in the cart'));
146
        } else {
147
            Yii::$app->session->setFlash('success', Yii::t('app', 'Object has been removed'));
148
        }
149
150
        return $this->redirect(Url::to(['index', 'parent_id' => $model->parent_id]));
151
    }
152
153
    public function actionRemoveAll($parent_id)
154
    {
155
        $items = Yii::$app->request->post('items', []);
156
        if (!empty($items)) {
157
            $items = BackendMenu::find()->where(['in', 'id', $items])->all();
158
            foreach ($items as $item) {
159
                $item->delete();
160
            }
161
        }
162
163
        return $this->redirect(['index', 'parent_id' => $parent_id]);
164
    }
165
166
167
    public function actionAjaxToggle($status)
168
    {
169
        if (!Yii::$app->request->isAjax) {
170
             throw new HttpException(403);
171
        }
172
        $currentStatus = Yii::$app->request->cookies->getValue('backend_menu', 'normal');
173
        $cookieData =[
174
            'name' => 'backend_menu',
175
            'value' => 'normal',
176
            'expire' => time() + 86400 * 365,
177
        ];
178
        if ($status !== $currentStatus) {
179
            $cookieData['value'] = $status;
180
        }
181
        Yii::$app->response->cookies->add(new Cookie($cookieData));
182
183
    }
184
}
185