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.

application/backend/controllers/ViewController.php (1 issue)

Severity

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\traits\BackendRedirect;
6
use app\models\View;
7
use Yii;
8
use yii\filters\AccessControl;
9
use yii\helpers\Url;
10
use yii\web\Controller;
11
use yii\web\NotFoundHttpException;
12
use yii\web\Response;
13
14
class ViewController extends Controller
15
{
16
    use BackendRedirect;
17
18
    protected function getTree($path = '', $level = 0)
19
    {
20
        if (is_null($this->view->theme) || !file_exists($this->view->theme->getBaseUrl())) {
21
            return [];
22
        }
23
        $result = [];
24
        $basePath = $this->view->theme->getBaseUrl();
25
        $dir = new \DirectoryIterator($basePath . $path);
26
        /** @var \DirectoryIterator $file */
27
        foreach ($dir as $file) {
28
            if ($file->isDot()) {
29
                continue;
30
            }
31
            $id = '#' . preg_replace('#[^\w\d]#', '_', $file->getFilename()) . "_lev{$level}";
32
            if ($file->isDir()) {
33
                $result[] = [
34
                    'id' => $id,
35
                    'children' => $this->getTree($path . DIRECTORY_SEPARATOR . $file->getBasename(), $level + 1),
36
                    'text' => $file->getBasename(),
37
                    'type' => 'dir',
38
                ];
39
            } elseif ($file->isFile() && 'php' === $file->getExtension()) {
40
                $result[] = [
41
                    'id' => $id,
42
                    'text' => $file->getBasename(),
43
                    'a_attr' => [
44
                        'data-file' => '@webroot/theme/views'.str_replace($basePath, '', $file->getRealPath()),
45
                        'data-toggle' => 'tooltip',
46
                        'title' => $file->getBasename()
47
                    ],
48
                    'type' => 'file',
49
                ];
50
            }
51
        }
52
        return $result;
53
    }
54
55
    /**
56
     * @inheritdoc
57
     */
58 View Code Duplication
    public function behaviors()
59
    {
60
        return [
61
            'access' => [
62
                '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...
63
                'rules' => [
64
                    [
65
                        'allow' => true,
66
                        'roles' => ['view manage'],
67
                    ],
68
                ],
69
            ],
70
        ];
71
    }
72
73
    /**
74
     * @inheritdoc
75
     */
76
    public function actions()
77
    {
78
        return [
79
            'error' => [
80
                'class' => 'yii\web\ErrorAction',
81
            ],
82
            'autocomplete' => [
83
                'class' => 'app\backend\actions\AutocompleteAction',
84
                'modelName' => 'app\models\View',
85
                'json_attributes' => ['name', 'id', 'category', 'internal_name',],
86
                'search_attributes' => ['name', 'category', 'internal_name'],
87
            ],
88
        ];
89
    }
90
91
    /*
92
     *
93
     */
94
    public function actionIndex()
95
    {
96
        $model = new View();
97
        return $this->render(
98
            'index',
99
            [
100
                'searchModel' => $model,
101
                'dataProvider' => $model->search(Yii::$app->request->get()),
102
            ]
103
        );
104
    }
105
106
    /*
107
     *
108
     */
109
    public function actionAdd($id = null)
110
    {
111
        $model = new View();
112
        if (null !== $id) {
113
            $id = intval($id);
114
            if (null !== View::findOne(['id' => $id])) {
115
                return $this->redirect(Url::toRoute(['edit', 'id' => $id]));
116
            }
117
            $model->id = $id;
118
        }
119
120
        if ($model->load(\Yii::$app->request->post())) {
121
            if ($model->save()) {
122
                return $this->redirectUser($model->id, true, 'edit');
123
            }
124
        }
125
126
        return $this->render(
127
            'edit',
128
            [
129
                'model' => $model
130
            ]
131
        );
132
    }
133
134
    /*
135
     *
136
     */
137
    public function actionEdit($id = null)
138
    {
139
        if ((null === $id) || (null === $model = View::findOne(['id' => $id]))) {
140
            return $this->redirect(Url::toRoute(['add', 'id' => $id]));
141
        }
142
143
        /** @var View $model */
144
        if ($model->load(\Yii::$app->request->post())) {
145
            if ($model->save()) {
146
                return $this->redirectUser($model->id);
147
            }
148
        }
149
150
        return $this->render(
151
            'edit',
152
            [
153
                'model' => $model
154
            ]
155
        );
156
    }
157
158 View Code Duplication
    public function actionDelete($id = null)
159
    {
160
        if ((null === $id) || (null === $model = View::findOne($id))) {
161
            throw new NotFoundHttpException;
162
        }
163
164
        if (!$model->delete()) {
165
            Yii::$app->session->setFlash('error', Yii::t('app', 'Object not removed'));
166
        } else {
167
            Yii::$app->session->setFlash('info', Yii::t('app', 'Object removed'));
168
        }
169
170
        return $this->redirect(Url::toRoute('index'));
171
    }
172
173
    public function actionRemoveAll()
174
    {
175
        $items = Yii::$app->request->post('items', []);
176
        if (!empty($items)) {
177
            $items = View::find()->where(['in', 'id', $items])->all();
178
            foreach ($items as $item) {
179
                $item->delete();
180
            }
181
        }
182
183
        return $this->redirect(['index']);
184
    }
185
186
    public function actionGetViews()
187
    {
188
        Yii::$app->response->format = Response::FORMAT_JSON;
189
        return $this->getTree('', 0);
190
    }
191
}
192