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 | namespace App\Controller; |
||
3 | |||
4 | use App\I18n\Language; |
||
5 | use Cake\Controller\Controller; |
||
6 | use Cake\Core\Configure; |
||
7 | use Cake\Event\Event; |
||
8 | |||
9 | class AppController extends Controller |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * Initialization hook method. |
||
14 | * |
||
15 | * @return void |
||
16 | */ |
||
17 | public function initialize() |
||
18 | { |
||
19 | parent::initialize(); |
||
20 | |||
21 | //Components. |
||
22 | $this->loadComponent('Flash'); |
||
23 | $this->loadComponent('Cookie'); |
||
24 | $this->loadComponent('Acl.Acl'); |
||
25 | $this->loadComponent('Maintenance'); |
||
26 | $this->loadComponent('CookieLogin'); |
||
27 | $this->loadComponent('SessionsActivity'); |
||
28 | $this->loadComponent('Auth', [ |
||
29 | 'className' => 'AclAuth', |
||
30 | 'allowedActionsForBanned' => [ |
||
31 | 'Pages' => [ |
||
32 | 'home' |
||
33 | ] |
||
34 | ], |
||
35 | 'authenticate' => [ |
||
36 | 'Form', |
||
37 | 'Xety/Cake3CookieAuth.Cookie' |
||
38 | ], |
||
39 | 'flash' => [ |
||
40 | 'element' => 'error', |
||
41 | 'key' => 'flash', |
||
42 | 'params' => [ |
||
43 | 'class' => 'error' |
||
44 | ] |
||
45 | ], |
||
46 | 'authorize' => [ |
||
47 | 'Acl.Actions' => [ |
||
48 | 'actionPath' => 'app/' |
||
49 | ] |
||
50 | ], |
||
51 | 'loginAction' => [ |
||
52 | 'controller' => 'users', |
||
53 | 'action' => 'login', |
||
54 | 'prefix' => false |
||
55 | ], |
||
56 | 'unauthorizedRedirect' => [ |
||
57 | 'controller' => 'pages', |
||
58 | 'action' => 'home', |
||
59 | 'prefix' => false |
||
60 | ], |
||
61 | 'loginRedirect' => [ |
||
62 | 'controller' => 'pages', |
||
63 | 'action' => 'home' |
||
64 | ], |
||
65 | 'logoutRedirect' => [ |
||
66 | 'controller' => 'pages', |
||
67 | 'action' => 'home' |
||
68 | ] |
||
69 | ]); |
||
70 | |||
71 | $this->loadComponent('Csrf', [ |
||
72 | 'secure' => env('HTTPS') ? true : false |
||
73 | ]); |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * beforeFilter handle. |
||
78 | * |
||
79 | * @param Event $event The beforeFilter event that was fired. |
||
80 | * |
||
81 | * @return void |
||
82 | */ |
||
83 | public function beforeFilter(Event $event) |
||
84 | { |
||
85 | $this->loadModel('Settings'); |
||
86 | $this->Settings->setSettings(); |
||
0 ignored issues
–
show
|
|||
87 | |||
88 | $this->Auth->config('authError', __('You need to be logged in or you are not authorized to access that location !')); |
||
0 ignored issues
–
show
The method
Cake\Core\InstanceConfigTrait::config() has been deprecated with message: 3.4.0 use setConfig()/getConfig() 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. ![]() |
|||
89 | |||
90 | // Define the language |
||
91 | $language = new Language($this); |
||
92 | $language->setLanguage(); |
||
93 | |||
94 | // Set trustProxy to get the original visitor IP |
||
95 | $this->request->trustProxy = true; |
||
96 | |||
97 | // Cookie Login (Automatically Login) |
||
98 | $this->CookieLogin->handle(); |
||
0 ignored issues
–
show
The property
CookieLogin does not seem to exist. Did you mean Cookie ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
99 | |||
100 | // Layouts |
||
101 | if (!is_null($this->request->getParam('prefix'))) { |
||
102 | $prefix = explode('/', $this->request->getParam('prefix'))[0]; |
||
103 | |||
104 | switch ($prefix) { |
||
105 | case 'admin': |
||
106 | $this->viewBuilder()->layout('admin'); |
||
0 ignored issues
–
show
The method
Cake\View\ViewBuilder::layout() has been deprecated with message: 3.4.0 Use setLayout()/getLayout() 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. ![]() |
|||
107 | break; |
||
108 | } |
||
109 | } |
||
110 | |||
111 | // Cookies |
||
112 | $allowCookies = $this->Cookie->check('allowCookies'); |
||
113 | $this->set(compact('allowCookies')); |
||
114 | |||
115 | // Maintenance |
||
116 | $this->Maintenance->handle(); |
||
0 ignored issues
–
show
The property
Maintenance does not exist on object<App\Controller\AppController> . 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. ![]() |
|||
117 | |||
118 | // JavaScript Notifications |
||
119 | if ($this->request->session()->read('Notification') && !empty($this->request->session()->read('Notification'))) { |
||
0 ignored issues
–
show
The expression
$this->request->session()->read('Notification') of type string|null is loosely compared to true ; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.
In PHP, under loose comparison (like For '' == false // true
'' == null // true
'ab' == false // false
'ab' == null // false
// It is often better to use strict comparison
'' === false // false
'' === null // false
![]() |
|||
120 | $notification = $this->request->session()->read('Notification'); |
||
121 | $this->request->session()->delete('Notification'); |
||
122 | |||
123 | $this->set(compact('notification')); |
||
124 | } |
||
125 | } |
||
126 | |||
127 | /** |
||
128 | * beforeRender hook method. |
||
129 | * |
||
130 | * @param Event $event The beforeRender event that was fired. |
||
131 | * |
||
132 | * @return void |
||
133 | */ |
||
134 | public function beforeRender(Event $event) |
||
135 | { |
||
136 | parent::beforeRender($event); |
||
137 | |||
138 | if ($this->components()->has('Auth')) { |
||
139 | $builder = $this->viewBuilder(); |
||
140 | $builder->helpers([ |
||
0 ignored issues
–
show
The method
Cake\View\ViewBuilder::helpers() has been deprecated with message: 3.4.0 Use setHelpers()/getHelpers() 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. ![]() |
|||
141 | 'Acl' => $this->Auth->config('authorize')['Acl.Actions'] |
||
0 ignored issues
–
show
The method
Cake\Core\InstanceConfigTrait::config() has been deprecated with message: 3.4.0 use setConfig()/getConfig() 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. ![]() |
|||
142 | ]); |
||
143 | } |
||
144 | } |
||
145 | } |
||
146 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.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.