Issues (9)

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/models/Settings.php (3 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
 * AdminLte Theme for Yii2 projects
4
 *
5
 * @link      https://github.com/hiqdev/yii2-theme-adminlte
6
 * @package   yii2-theme-adminlte
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\themes\adminlte\models;
12
13
use Yii;
14
15
class Settings extends \hiqdev\thememanager\models\Settings
16
{
17
    protected $_defaults = [
18
        'skin' => 'skin-blue',
19
    ];
20
21
    /**
22
     * Can have values: fixed, layout-boxed.
23
     *
24
     * @var string
25
     */
26
    public $layout;
27
28
    /**
29
     * Can have values: skin-blue, skin-yellow, skin-purple, skin-green, skin-red, skin-black, skin-ebony.
30
     *
31
     * @var string
32
     */
33
    public $skin;
34
35
    /**
36
     * Can have value: table-condensed, blank.
37
     *
38
     * @var bool
39
     */
40
    public $table_condensed;
41
42
    /**
43
     * @var bool
44
     */
45
    public $collapsed_sidebar;
46
47
    /**
48
     * @var string
49
     */
50
    public $filterOrientation;
51
52
    /**
53
     * @return array
54
     */
55
    public function rules()
56
    {
57
        return [
0 ignored issues
show
Bug Best Practice introduced by
The return type of return array(array(array...ENTATION_HORIZONTAL))); (array<*,string|string[]>[]) is incompatible with the return type of the parent method hiqdev\thememanager\models\Settings::rules of type array<string[]|string>[].

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
58
            [['layout', 'skin', 'table_condensed', 'collapsed_sidebar'], 'safe'],
59
            [['filterOrientation'], 'in', 'range' => [self::ORIENTATION_VERTICAL, self::ORIENTATION_HORIZONTAL]],
60
        ];
61
    }
62
63
    /**
64
     * @return array
65
     */
66
    public function orientationOptions()
67
    {
68
        return [
69
            self::ORIENTATION_HORIZONTAL => Yii::t('adminlte', '"Advanced search" on the left'),
70
            self::ORIENTATION_VERTICAL   => Yii::t('adminlte', '"Advanced Search" on top'),
71
        ];
72
    }
73
74
    /**
75
     * @return array
76
     */
77
    public function formLayoutData()
78
    {
79
        return [
80
            'none'         => Yii::t('adminlte', 'Default layout'),
81
            'fixed'        => Yii::t('adminlte', 'Fixed layout'),
82
            // working incorectly temporary disabled
83
            // 'layout-boxed' => Yii::t('adminlte', 'Boxed layout'),
84
        ];
85
    }
86
87
    /**
88
     * @return array
89
     */
90
    public function attributeLabels()
91
    {
92
        return [
93
            'verifyCode'        => 'Verification Code',
94
            'table_condensed'   => Yii::t('adminlte', 'Table Condensed'),
95
            'collapsed_sidebar' => Yii::t('adminlte', 'Collapsed Sidebar'),
96
            'filterOrientation' => Yii::t('adminlte', 'Search position'),
97
        ];
98
    }
99
100
    /**
101
     * @return array
102
     */
103
    public function skinSampleArray()
104
    {
105
        return [
106
            [
107
                'attribute' => 'skin-red',
108
                'label'     => Yii::t('adminlte', 'Red'),
109
                'color'     => '#dd4b39',
110
                'bg'        => 'bg-red',
111
            ],
112
            [
113
                'attribute' => 'skin-green',
114
                'label'     => Yii::t('adminlte', 'Green'),
115
                'color'     => '#00a65a',
116
                'bg'        => 'bg-green',
117
            ],
118
            [
119
                'attribute' => 'skin-blue',
120
                'label'     => Yii::t('adminlte', 'Blue'),
121
                'color'     => '#3c8dbc',
122
                'bg'        => 'bg-light-blue',
123
            ],
124
            [
125
                'attribute' => 'skin-purple',
126
                'label'     => Yii::t('adminlte', 'Purple'),
127
                'color'     => '#605ca8',
128
                'bg'        => 'bg-purple',
129
            ],
130
            [
131
                'attribute' => 'skin-yellow',
132
                'label'     => Yii::t('adminlte', 'Yellow'),
133
                'color'     => '#f39c12',
134
                'bg'        => 'bg-yellow',
135
            ],
136
            /*[
137
                'attribute' => 'skin-black',
138
                'label'     => Yii::t('adminlte', 'Black'),
139
                'color'     => '#fff',
140
                'bg'        => 'bg-black',
141
            ],
142
            [
143
                'attribute' => 'skin-ebony',
144
                'label'     => Yii::t('adminlte', 'Ebony'),
145
                'color'     => '#fff',
146
                'bg'        => 'bg-black',
147
            ],*/
148
        ];
149
    }
150
151
    /**
152
     * Provides css class by given attribute name and value.
153
     *
154
     * @param $name  string         attribute name
155
     * @param $value boolean|string attribute value
156
     *
157
     * @return string css class
158
     */
159
    public static function cssClassProvider($name, $value)
160
    {
161
        switch ($name) {
162
            case 'table_condensed':
163
                return $value ? 'table-ultra-condensed' : '';
164
                break;
0 ignored issues
show
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
165
            case 'collapsed_sidebar':
166
                return $value ? 'sidebar-collapse' : '';
167
                break;
0 ignored issues
show
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
168
            default:
169
                return parent::cssClassProvider($name, $value);
170
        }
171
    }
172
173
    public function getBodyClasses()
174
    {
175
        return $this->getCssClasses(['layout', 'skin', 'table_condensed', 'collapsed_sidebar']);
176
    }
177
}
178