cothema /
cmsbe-user
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 | namespace App\Presenters; |
||
| 4 | |||
| 5 | use Nette; |
||
| 6 | use Nette\Application\UI\Form; |
||
| 7 | use Cothema\Model as PModel; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * @Secured |
||
| 11 | * @Secured\User(loggedIn) |
||
| 12 | * @Secured\Role(admin) |
||
| 13 | * |
||
| 14 | * Users Presenter |
||
| 15 | */ |
||
| 16 | class UsersPresenter extends BasePresenter |
||
| 17 | { |
||
| 18 | |||
| 19 | public function renderChangePass() |
||
| 20 | { |
||
| 21 | $navbar = []; |
||
| 22 | $navbar[] = (object) ['name' => 'Uživatelé', 'link' => 'Users:list']; |
||
| 23 | $navbar[] = (object) ['name' => 'Detail']; |
||
| 24 | $navbar[] = (object) ['name' => 'Změna hesla']; |
||
| 25 | |||
| 26 | $this->template->navbar = $navbar; |
||
|
0 ignored issues
–
show
Accessing
navbar on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 27 | } |
||
| 28 | |||
| 29 | public function renderList() |
||
| 30 | { |
||
| 31 | $navbar = []; |
||
| 32 | $navbar[] = (object) ['name' => 'Uživatelé']; |
||
| 33 | |||
| 34 | $this->template->navbar = $navbar; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
navbar on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 35 | |||
| 36 | $usersDao = $this->em->getRepository(PModel\User\User::getClassName()); |
||
| 37 | $users = $usersDao->findBy(['active' => 1]); |
||
| 38 | |||
| 39 | $this->template->users = $users; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
users on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 40 | } |
||
| 41 | |||
| 42 | View Code Duplication | public function renderListUnactive() |
|
|
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. Loading history...
|
|||
| 43 | { |
||
| 44 | $navbar = []; |
||
| 45 | $navbar[] = (object) ['name' => 'Uživatelé', 'link' => 'Users:list']; |
||
| 46 | $navbar[] = (object) ['name' => 'Neaktivní']; |
||
| 47 | |||
| 48 | $this->template->navbar = $navbar; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
navbar on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 49 | |||
| 50 | $usersDao = $this->em->getRepository(PModel\User\User::getClassName()); |
||
| 51 | $users = $usersDao->findBy(['active' => 0]); |
||
| 52 | |||
| 53 | $this->template->users = $users; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
users on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @Secured |
||
| 58 | * @Secured\User(loggedIn) |
||
| 59 | * @Secured\Role(usermanager) |
||
| 60 | */ |
||
| 61 | View Code Duplication | public function renderNew() |
|
|
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. Loading history...
|
|||
| 62 | { |
||
| 63 | $navbar = []; |
||
| 64 | $navbar[] = (object) ['name' => 'Uživatelé', 'link' => 'Users:list']; |
||
| 65 | $navbar[] = (object) ['name' => 'Nový']; |
||
| 66 | |||
| 67 | $this->template->navbar = $navbar; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
navbar on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 68 | } |
||
| 69 | |||
| 70 | View Code Duplication | public function renderChange() |
|
|
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. Loading history...
|
|||
| 71 | { |
||
| 72 | $navbar = []; |
||
| 73 | $navbar[] = (object) ['name' => 'Uživatelé', 'link' => 'Users:list']; |
||
| 74 | $navbar[] = (object) ['name' => 'Úprava']; |
||
| 75 | |||
| 76 | $this->template->navbar = $navbar; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
navbar on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 77 | |||
| 78 | $this->notYetImplemented(); |
||
| 79 | } |
||
| 80 | |||
| 81 | public function renderProfile() |
||
| 82 | { |
||
| 83 | $navbar = []; |
||
| 84 | $navbar[] = (object) ['name' => 'Uživatelé', 'link' => 'Users:list']; |
||
| 85 | $navbar[] = (object) ['name' => 'Profil']; |
||
| 86 | |||
| 87 | $this->template->navbar = $navbar; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
navbar on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 88 | |||
| 89 | $id = ($this->getParameter('id') !== null) ? $this->getParameter('id') : $this->getUser()->getIdentity()->id; |
||
| 90 | |||
| 91 | $user = $this->em->getRepository(PModel\User\User::getClassName()); |
||
| 92 | $profileUser = $user->find($id); |
||
| 93 | |||
| 94 | $this->template->profileUser = $profileUser; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
profileUser on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 95 | |||
| 96 | $isActual = false; |
||
| 97 | if ($this->getUser()->isLoggedIn() && $this->getUser()->getIdentity()->id |
||
| 98 | == $profileUser->id) { |
||
| 99 | $isActual = true; |
||
| 100 | } |
||
| 101 | |||
| 102 | $this->template->isActual = $isActual; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
isActual on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 103 | } |
||
| 104 | |||
| 105 | View Code Duplication | public function renderGroups() |
|
|
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. Loading history...
|
|||
| 106 | { |
||
| 107 | $navbar = []; |
||
| 108 | $navbar[] = (object) ['name' => 'Uživatelé', 'link' => 'Users:list']; |
||
| 109 | $navbar[] = (object) ['name' => 'Skupiny']; |
||
| 110 | |||
| 111 | $this->template->navbar = $navbar; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
navbar on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 112 | |||
| 113 | $userGroupsDao = $this->em->getRepository(PModel\User\Group::getClassName()); |
||
| 114 | $userGroups = $userGroupsDao->findAll(); |
||
| 115 | |||
| 116 | $this->template->userGroups = $userGroups; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
userGroups on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 117 | } |
||
| 118 | |||
| 119 | /** |
||
| 120 | * @Secured |
||
| 121 | * @Secured\User(loggedIn) |
||
| 122 | * @Secured\Role(superadmin) |
||
| 123 | */ |
||
| 124 | View Code Duplication | public function renderLogActivity() |
|
|
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. Loading history...
|
|||
| 125 | { |
||
| 126 | $navbar = []; |
||
| 127 | $navbar[] = (object) ['link' => 'Users:list', 'name' => 'Uživatelé']; |
||
| 128 | $navbar[] = (object) ['name' => 'Sledování přihlášení']; |
||
| 129 | |||
| 130 | $this->template->navbar = $navbar; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
navbar on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 131 | |||
| 132 | $activityDao = $this->em->getRepository(PModel\User\LogActivity::getClassName()); |
||
| 133 | $activity = $activityDao->findBy([], ['id' => 'DESC'], 30); |
||
| 134 | |||
| 135 | $this->template->activity = $activity; |
||
|
0 ignored issues
–
show
The property
$template is declared private in Nette\Application\UI\Control. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
Accessing
activity on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a concrete implementation of the interface. Available Fixes
Loading history...
|
|||
| 136 | } |
||
| 137 | |||
| 138 | protected function createComponentChangePasswordForm() |
||
| 139 | { |
||
| 140 | $form = new Nette\Application\UI\Form; |
||
| 141 | $form->addPassword('oldpassw', 'Staré heslo:') |
||
| 142 | ->setRequired('Prosím, zadejte své staré heslo.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte své staré heslo.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 143 | ->getControlPrototype()->class('form-control'); |
||
| 144 | |||
| 145 | $form->addPassword('newpassw', 'Nové heslo:') |
||
| 146 | ->setRequired('Prosím, zadejte své nové heslo.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte své nové heslo.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 147 | ->getControlPrototype()->class('form-control'); |
||
| 148 | |||
| 149 | $form->addPassword('newpassw2', 'Nové heslo (znovu):') |
||
| 150 | ->setRequired('Prosím, zadejte své nové heslo pro kontrolu.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte své nové heslo pro kontrolu.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 151 | ->addRule( |
||
| 152 | Form::EQUAL, |
||
| 153 | "Zadaná nová hesla se neshodují.", |
||
| 154 | $form["newpassw"] |
||
| 155 | ) |
||
| 156 | ->getControlPrototype()->class('form-control'); |
||
| 157 | |||
| 158 | $form->addSubmit('send', 'Změnit heslo') |
||
| 159 | ->getControlPrototype()->class('btn btn-success'); |
||
| 160 | |||
| 161 | $form->onSuccess[] = [$this, 'changePasswordFormSucceeded']; |
||
| 162 | return $form; |
||
| 163 | } |
||
| 164 | |||
| 165 | protected function createComponentChangeProfileForm() |
||
| 166 | { |
||
| 167 | $userDao = $this->em->getRepository(PModel\User\User::getClassName()); |
||
| 168 | $user = $userDao->find($this->getUser()->id); |
||
| 169 | |||
| 170 | $form = new Nette\Application\UI\Form; |
||
| 171 | $form->addText('firstname', 'Jméno:') |
||
| 172 | ->setRequired('Prosím, zadejte své své jméno.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte své své jméno.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 173 | ->setDefaultValue($user->firstName) |
||
| 174 | ->getControlPrototype()->class('form-control'); |
||
| 175 | |||
| 176 | $form->addText('lastname', 'Příjmení:') |
||
| 177 | ->setRequired('Prosím, zadejte své nové příjmení.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte své nové příjmení.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 178 | ->setDefaultValue($user->lastName) |
||
| 179 | ->getControlPrototype()->class('form-control'); |
||
| 180 | |||
| 181 | $form->addText('email', 'Email:') |
||
| 182 | ->setRequired('Prosím, zadejte svou emailovou adesu.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte svou emailovou adesu.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 183 | ->setDefaultValue($user->email) |
||
| 184 | ->getControlPrototype()->class('form-control'); |
||
| 185 | |||
| 186 | $form->addSubmit('send', 'Uložit změny') |
||
| 187 | ->getControlPrototype()->class('btn btn-success'); |
||
| 188 | |||
| 189 | $form->onSuccess[] = [$this, 'changeProfileFormSucceeded']; |
||
| 190 | return $form; |
||
| 191 | } |
||
| 192 | |||
| 193 | public function createComponentUsersNewForm() |
||
| 194 | { |
||
| 195 | $form = new Form; |
||
| 196 | |||
| 197 | $form->addText('login', 'Přihlašovací jméno:') |
||
| 198 | ->setRequired('Prosím, zadejte přihlašovací jméno.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte přihlašovací jméno.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 199 | ->getControlPrototype()->class('form-control'); |
||
| 200 | |||
| 201 | $form->addText('firstname', 'Jméno:') |
||
| 202 | ->setRequired('Prosím, zadejte jméno.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte jméno.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 203 | ->getControlPrototype()->class('form-control'); |
||
| 204 | |||
| 205 | $form->addText('lastname', 'Příjmení:') |
||
| 206 | ->setRequired('Prosím, zadejte příjmení.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte příjmení.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 207 | ->getControlPrototype()->class('form-control'); |
||
| 208 | |||
| 209 | $form->addText('email', 'Email:') |
||
| 210 | ->setRequired('Prosím, zadejte emailovou adesu.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte emailovou adesu.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 211 | ->getControlPrototype()->class('form-control mediumwidth'); |
||
| 212 | |||
| 213 | $form->addPassword('password', 'Heslo:') |
||
| 214 | ->setRequired('Prosím, zadejte heslo.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte heslo.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 215 | ->getControlPrototype()->class('form-control mediumwidth'); |
||
| 216 | |||
| 217 | $form->addPassword('passwordValid', 'Heslo znovu:') |
||
| 218 | ->setRequired('Prosím, zadejte heslo pro kontrolu.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte heslo pro kontrolu.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 219 | ->getControlPrototype()->class('form-control mediumwidth'); |
||
| 220 | |||
| 221 | $form->addSubmit('send', 'Vytvořit uživatelský profil') |
||
| 222 | ->getControlPrototype()->class('btn btn-success'); |
||
| 223 | |||
| 224 | $form->onSuccess[] = [$this, 'usersNewFormSucceeded']; |
||
| 225 | return $form; |
||
| 226 | } |
||
| 227 | |||
| 228 | public function createComponentUsersChangeForm() |
||
| 229 | { |
||
| 230 | $userDao = $this->em->getRepository(PModel\User\User::getClassName()); |
||
| 231 | $user = $userDao->find($this->getUser()->id); |
||
| 232 | |||
| 233 | $form = new Form; |
||
| 234 | |||
| 235 | $form->addText('login', 'Přihlašovací jméno:') |
||
| 236 | ->setRequired('Prosím, zadejte přihlašovací jméno.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte přihlašovací jméno.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 237 | ->setDisabled() |
||
| 238 | ->setValue($user->username) |
||
| 239 | ->getControlPrototype()->class('form-control'); |
||
| 240 | |||
| 241 | $form->addText('firstname', 'Jméno:') |
||
| 242 | ->setRequired('Prosím, zadejte jméno.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte jméno.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 243 | ->setDefaultValue($user->firstName) |
||
| 244 | ->getControlPrototype()->class('form-control'); |
||
| 245 | |||
| 246 | $form->addText('lastname', 'Příjmení:') |
||
| 247 | ->setRequired('Prosím, zadejte příjmení.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte příjmení.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 248 | ->setDefaultValue($user->lastName) |
||
| 249 | ->getControlPrototype()->class('form-control'); |
||
| 250 | |||
| 251 | $form->addText('email', 'Email:') |
||
| 252 | ->setRequired('Prosím, zadejte emailovou adesu.') |
||
|
0 ignored issues
–
show
'Prosím, zadejte emailovou adesu.' is of type string, but the function expects a boolean.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 253 | ->setDefaultValue($user->email) |
||
| 254 | ->getControlPrototype()->class('form-control mediumwidth'); |
||
| 255 | |||
| 256 | $form->addSubmit('send', 'Upravit uživatelský profil') |
||
| 257 | ->getControlPrototype()->class('btn btn-warning'); |
||
| 258 | |||
| 259 | $form->onSuccess[] = [$this, 'usersNewFormSucceeded']; |
||
| 260 | return $form; |
||
| 261 | } |
||
| 262 | |||
| 263 | public function usersNewFormSucceeded() |
||
| 264 | { |
||
| 265 | } |
||
| 266 | |||
| 267 | View Code Duplication | public function handleActive($id) |
|
|
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. Loading history...
|
|||
| 268 | { |
||
| 269 | $this->setActiveStatus($id, true); |
||
| 270 | |||
| 271 | $this->flashMessage( |
||
| 272 | 'Uživatel s ID '.$id.' byl úspěšně aktivován.', |
||
| 273 | 'success' |
||
| 274 | ); |
||
| 275 | $this->redirect('this'); |
||
| 276 | } |
||
| 277 | |||
| 278 | View Code Duplication | public function handleDeactive($id) |
|
|
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. Loading history...
|
|||
| 279 | { |
||
| 280 | $this->setActiveStatus($id, false); |
||
| 281 | |||
| 282 | $this->flashMessage( |
||
| 283 | 'Uživatel s ID '.$id.' byl úspěšně deaktivován.', |
||
| 284 | 'success' |
||
| 285 | ); |
||
| 286 | $this->redirect('this'); |
||
| 287 | } |
||
| 288 | |||
| 289 | /** |
||
| 290 | * @param boolean $status |
||
| 291 | */ |
||
| 292 | private function setActiveStatus($id, $status) |
||
| 293 | { |
||
| 294 | $userDao = $this->em->getRepository(PModel\User\User::getClassName()); |
||
| 295 | $user = $userDao->find($id); |
||
| 296 | $user->active = (bool) $status; |
||
| 297 | |||
| 298 | $this->em->persist($user); |
||
| 299 | $this->em->flush(); |
||
| 300 | |||
| 301 | return true; |
||
| 302 | } |
||
| 303 | |||
| 304 | public function changeProfileFormSucceeded($form) |
||
| 305 | { |
||
| 306 | $values = $form->getValues(true); |
||
| 307 | |||
| 308 | $userDao = $this->em->getRepository(PModel\User\User::getClassName()); |
||
| 309 | $user = $userDao->find($this->getUser()->id); |
||
| 310 | $user->firstName = $values['firstname']; |
||
| 311 | $user->lastName = $values['lastname']; |
||
| 312 | $user->email = $values['email']; |
||
| 313 | |||
| 314 | $this->em->persist($user); |
||
| 315 | $this->em->flush(); |
||
| 316 | |||
| 317 | $this->flashMessage('Údaje o uživateli byly úspěšně uloženy.', 'success'); |
||
| 318 | $this->redirect('Users:profile'); |
||
| 319 | } |
||
| 320 | |||
| 321 | public function changePasswordFormSucceeded($form) |
||
| 322 | { |
||
| 323 | $values = $form->getValues(); |
||
| 324 | $userId = $this->getUser()->id; |
||
| 325 | |||
| 326 | $fOldPass = $values["oldpassw"]; |
||
| 327 | $fNewPass = $values["newpassw"]; |
||
| 328 | |||
| 329 | try { |
||
| 330 | $this->getUser()->getAuthenticator()->changePassword( |
||
| 331 | $userId, |
||
| 332 | $fOldPass, |
||
| 333 | $fNewPass |
||
| 334 | ); |
||
| 335 | |||
| 336 | $this->flashMessage('Vaše heslo bylo úspěšně změněno.', 'success'); |
||
| 337 | $this->redirect('Users:profile'); |
||
| 338 | } catch (Nette\Security\AuthenticationException $e) { |
||
| 339 | $form->addError('Zadané staré heslo není správné.'); |
||
| 340 | } |
||
| 341 | } |
||
| 342 | } |
||
| 343 |
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write 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.