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 | * This file is part of Jitamin. |
||
5 | * |
||
6 | * Copyright (C) Jitamin Team |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Jitamin\Model; |
||
13 | |||
14 | use Jitamin\Foundation\Database\Model; |
||
15 | |||
16 | /** |
||
17 | * Class Skin. |
||
18 | */ |
||
19 | class SkinModel extends Model |
||
20 | { |
||
21 | /** |
||
22 | * Get available skins. |
||
23 | * |
||
24 | * @param bool $prepend Prepend a default value |
||
25 | * |
||
26 | * @return array |
||
27 | */ |
||
28 | public function getSkins($prepend = false) |
||
29 | { |
||
30 | // Sorted by value |
||
31 | $skins = [ |
||
32 | 'default' => t('Default'), |
||
33 | 'black' => t('Black'), |
||
34 | 'blue' => t('Blue'), |
||
35 | 'green' => t('Green'), |
||
36 | 'purple' => t('Purple'), |
||
37 | 'red' => t('Red'), |
||
38 | 'white' => t('White'), |
||
39 | 'yellow' => t('Yellow'), |
||
40 | ]; |
||
41 | |||
42 | if ($prepend) { |
||
43 | return ['' => t('Use system skin')] + $skins; |
||
44 | } |
||
45 | |||
46 | return $skins; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Get current skin. |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | View Code Duplication | public function getCurrentSkin() |
|
0 ignored issues
–
show
|
|||
55 | { |
||
56 | if ($this->userSession->isLogged() && !empty($this->sessionStorage->user['skin'])) { |
||
0 ignored issues
–
show
The property
userSession does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
sessionStorage does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
57 | return $this->sessionStorage->user['skin']; |
||
0 ignored issues
–
show
The property
sessionStorage does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
58 | } |
||
59 | |||
60 | return $this->settingModel->get('application_skin', 'default'); |
||
0 ignored issues
–
show
The property
settingModel does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Get available layouts. |
||
65 | * |
||
66 | * @param bool $prepend Prepend a default value |
||
67 | * |
||
68 | * @return array |
||
69 | */ |
||
70 | public function getLayouts($prepend = false) |
||
71 | { |
||
72 | // Sorted by value |
||
73 | $layouts = [ |
||
74 | 'fluid' => t('Fluid'), |
||
75 | 'fixed' => t('Fixed'), |
||
76 | ]; |
||
77 | |||
78 | if ($prepend) { |
||
79 | return ['' => t('Use system layout')] + $layouts; |
||
80 | } |
||
81 | |||
82 | return $layouts; |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Get current layout. |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | View Code Duplication | public function getCurrentLayout() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
91 | { |
||
92 | if ($this->userSession->isLogged() && !empty($this->sessionStorage->user['layout'])) { |
||
0 ignored issues
–
show
The property
userSession does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
sessionStorage does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
93 | return $this->sessionStorage->user['layout']; |
||
0 ignored issues
–
show
The property
sessionStorage does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
94 | } |
||
95 | |||
96 | return $this->settingModel->get('application_layout', ''); |
||
0 ignored issues
–
show
The property
settingModel does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
97 | } |
||
98 | |||
99 | /** |
||
100 | * Get available dashboards. |
||
101 | * |
||
102 | * @param bool $prepend Prepend a default value |
||
103 | * |
||
104 | * @return array |
||
105 | */ |
||
106 | public function getDashboards($prepend = false) |
||
107 | { |
||
108 | // Sorted by value |
||
109 | $dashboards = [ |
||
110 | 'projects' => t('My projects'), |
||
111 | 'stars' => t('Starred projects'), |
||
112 | 'calendar' => t('My calendar'), |
||
113 | 'activities' => t('My activities'), |
||
114 | 'tasks' => t('My tasks'), |
||
115 | ]; |
||
116 | |||
117 | if ($prepend) { |
||
118 | return ['' => t('Use system dashboard')] + $dashboards; |
||
119 | } |
||
120 | |||
121 | return $dashboards; |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * Get current dashboard. |
||
126 | * |
||
127 | * @return string |
||
128 | */ |
||
129 | View Code Duplication | public function getCurrentDashboard() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
130 | { |
||
131 | if ($this->userSession->isLogged() && !empty($this->sessionStorage->user['dashboard'])) { |
||
0 ignored issues
–
show
The property
userSession does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
sessionStorage does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
132 | return $this->sessionStorage->user['dashboard']; |
||
0 ignored issues
–
show
The property
sessionStorage does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
133 | } |
||
134 | |||
135 | return $this->settingModel->get('application_dashboard', ''); |
||
0 ignored issues
–
show
The property
settingModel does not exist on object<Jitamin\Model\SkinModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
136 | } |
||
137 | } |
||
138 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.