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 | * User controller |
||
5 | * |
||
6 | * @license http://opensource.org/licenses/MIT The MIT License (MIT) |
||
7 | * @author Omar El Gabry <[email protected]> |
||
8 | */ |
||
9 | |||
10 | class UserController extends Controller{ |
||
0 ignored issues
–
show
|
|||
11 | |||
12 | public function beforeAction(){ |
||
13 | |||
14 | parent::beforeAction(); |
||
15 | |||
16 | $action = $this->request->param('action'); |
||
17 | $actions = ['updateProfileInfo', 'updateProfilePicture', 'reportBug']; |
||
18 | $this->Security->requirePost($actions); |
||
0 ignored issues
–
show
The property
Security does not exist on object<UserController> . 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. ![]() |
|||
19 | |||
20 | switch($action){ |
||
21 | case "updateProfileInfo": |
||
22 | $this->Security->config("form", [ 'fields' => ['name', 'password', 'email', 'confirm_email']]); |
||
0 ignored issues
–
show
The property
Security does not exist on object<UserController> . 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. ![]() |
|||
23 | break; |
||
24 | case "updateProfilePicture": |
||
25 | $this->Security->config("form", [ 'fields' => ['file']]); |
||
0 ignored issues
–
show
The property
Security does not exist on object<UserController> . 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. ![]() |
|||
26 | break; |
||
27 | case "reportBug": |
||
28 | $this->Security->config("form", [ 'fields' => ['subject', 'label', 'message']]); |
||
0 ignored issues
–
show
The property
Security does not exist on object<UserController> . 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. ![]() |
|||
29 | break; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * show dashboard page |
||
35 | * |
||
36 | */ |
||
37 | public function index(){ |
||
38 | |||
39 | Config::setJsConfig('curPage', "dashboard"); |
||
40 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'dashboard/index.php'); |
||
41 | } |
||
42 | |||
43 | public function profile(){ |
||
44 | |||
45 | Config::setJsConfig('curPage', "profile"); |
||
46 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'user/profile.php'); |
||
47 | } |
||
48 | |||
49 | public function updateProfileInfo(){ |
||
50 | |||
51 | $name = $this->request->data("name"); |
||
52 | $password = $this->request->data("password"); |
||
53 | $email = $this->request->data("email"); |
||
54 | $confirmEmail = $this->request->data("confirm_email"); |
||
55 | |||
56 | $result = $this->user->updateProfileInfo(Session::getUserId(), $name, $password, $email, $confirmEmail); |
||
0 ignored issues
–
show
The property
user does not exist on object<UserController> . 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 | |||
58 | if(!$result){ |
||
59 | |||
60 | Session::set('profile-info-errors', $this->user->errors()); |
||
0 ignored issues
–
show
The property
user does not exist on object<UserController> . 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 | }else{ |
||
63 | |||
64 | $message = "Your Profile has been updated. "; |
||
65 | $message .= $result["emailUpdated"]? "Please check your new email to confirm the changes, or your current email to revoke the changes": ""; |
||
66 | |||
67 | Session::set('profile-info-success', $message); |
||
68 | } |
||
69 | |||
70 | return $this->redirector->root("User/Profile"); |
||
71 | } |
||
72 | |||
73 | public function updateProfilePicture(){ |
||
74 | |||
75 | $fileData = $this->request->data("file"); |
||
76 | $image = $this->user->updateProfilePicture(Session::getUserId(), $fileData); |
||
0 ignored issues
–
show
The property
user does not exist on object<UserController> . 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. ![]() |
|||
77 | |||
78 | if(!$image){ |
||
79 | Session::set('profile-picture-errors', $this->user->errors()); |
||
0 ignored issues
–
show
The property
user does not exist on object<UserController> . 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. ![]() |
|||
80 | } |
||
81 | |||
82 | return $this->redirector->root("User/Profile"); |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * revoke email updates |
||
87 | * |
||
88 | * You must be logged in with your current email |
||
89 | */ |
||
90 | public function revokeEmail(){ |
||
91 | |||
92 | $userId = $this->request->query("id"); |
||
93 | $userId = empty($userId)? null: Encryption::decryptId($this->request->query("id")); |
||
94 | $token = $this->request->query("token"); |
||
95 | |||
96 | $result = $this->user->revokeEmail($userId, $token); |
||
0 ignored issues
–
show
The property
user does not exist on object<UserController> . 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 | View Code Duplication | if(!$result){ |
|
0 ignored issues
–
show
This code seems to be duplicated across 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. ![]() |
|||
99 | return $this->error(404); |
||
100 | }else{ |
||
101 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'user/profile.php', ["emailUpdates" => ["success" => "Your email updates has been revoked successfully."]]); |
||
102 | } |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * confirm on email updates |
||
107 | * |
||
108 | * You must be logged in with your current email |
||
109 | */ |
||
110 | public function updateEmail(){ |
||
111 | |||
112 | $userId = $this->request->query("id"); |
||
113 | $userId = empty($userId)? null: Encryption::decryptId($this->request->query("id")); |
||
114 | $token = $this->request->query("token"); |
||
115 | |||
116 | $result = $this->user->updateEmail($userId, $token); |
||
0 ignored issues
–
show
The property
user does not exist on object<UserController> . 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 | $errors = $this->user->errors(); |
||
0 ignored issues
–
show
The property
user does not exist on object<UserController> . 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. ![]() |
|||
118 | |||
119 | if(!$result && empty($errors)){ |
||
120 | return $this->error(404); |
||
121 | }else if(!$result && !empty($errors)){ |
||
122 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'user/profile.php', ["emailUpdates" => ["errors" => $this->user->errors()]]); |
||
0 ignored issues
–
show
The property
user does not exist on object<UserController> . 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. ![]() |
|||
123 | View Code Duplication | }else{ |
|
0 ignored issues
–
show
This code seems to be duplicated across 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. ![]() |
|||
124 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'user/profile.php', |
||
125 | ["emailUpdates" => ["success" => "Your email updates has been updated successfully."]]); |
||
126 | } |
||
127 | } |
||
128 | |||
129 | /** |
||
130 | * users can report bugs, features, or enhancement |
||
131 | * - Bug is an error you encountered |
||
132 | * - Feature is a new functionality you suggest to add |
||
133 | * - Enhancement is an existing feature, but you want to improve |
||
134 | * |
||
135 | */ |
||
136 | public function bugs(){ |
||
137 | Config::setJsConfig('curPage', "bugs"); |
||
138 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'bugs/index.php'); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * send email to admin for reporting any bugs, features, or enhancement |
||
143 | * |
||
144 | */ |
||
145 | View Code Duplication | public function reportBug(){ |
|
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. ![]() |
|||
146 | |||
147 | $subject = $this->request->data("subject"); |
||
148 | $label = $this->request->data("label"); |
||
149 | $message = $this->request->data("message"); |
||
150 | |||
151 | $result = $this->user->reportBug(Session::getUserId(), $subject, $label, $message); |
||
0 ignored issues
–
show
The property
user does not exist on object<UserController> . 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. ![]() |
|||
152 | |||
153 | if(!$result){ |
||
154 | Session::set('report-bug-errors', $this->user->errors()); |
||
0 ignored issues
–
show
The property
user does not exist on object<UserController> . 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. ![]() |
|||
155 | }else{ |
||
156 | Session::set('report-bug-success', "Email has been sent successfully, We will consider your report."); |
||
157 | } |
||
158 | |||
159 | return $this->redirector->root("User/Bugs"); |
||
160 | } |
||
161 | |||
162 | public function isAuthorized(){ |
||
163 | return true; |
||
164 | } |
||
165 | } |
||
166 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.