nabble /
ajde
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 | class Ajde_Collection_View extends Ajde_Object_Standard |
||
| 4 | { |
||
| 5 | private $_tableName; |
||
| 6 | |||
| 7 | private $_rowCount; |
||
| 8 | |||
| 9 | public function __construct($tableName, $listOptions = []) |
||
| 10 | { |
||
| 11 | $this->_tableName = $tableName; |
||
| 12 | |||
| 13 | $defaultOptions = [ |
||
| 14 | 'page' => 1, |
||
| 15 | 'pageSize' => 100, |
||
| 16 | 'filter' => [], |
||
| 17 | 'search' => null, |
||
| 18 | 'orderBy' => null, |
||
| 19 | 'orderDir' => Ajde_Query::ORDER_ASC, |
||
| 20 | 'viewType' => 'list', |
||
| 21 | 'filterVisible' => false, |
||
| 22 | 'disableFilter' => false, |
||
| 23 | 'mainFilter' => '', |
||
| 24 | 'mainFilterGrouper' => '', |
||
| 25 | 'columns' => [], |
||
| 26 | ]; |
||
| 27 | $options = array_merge($defaultOptions, $listOptions); |
||
| 28 | $this->setOptions($options); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function setOptions($options) |
||
| 32 | { |
||
| 33 | foreach ($options as $key => $value) { |
||
| 34 | $this->set($key, $value); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getPage() |
||
| 39 | { |
||
| 40 | return parent::getPage(); |
||
|
0 ignored issues
–
show
|
|||
| 41 | } |
||
| 42 | |||
| 43 | public function getPageSize() |
||
| 44 | { |
||
| 45 | return parent::getPageSize(); |
||
|
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Ajde_Object_Standard as the method getPageSize() does only exist in the following sub-classes of Ajde_Object_Standard: Ajde_Collection_View, Ajde_Crud_Options_List_View. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 46 | } |
||
| 47 | |||
| 48 | public function getSearch() |
||
| 49 | { |
||
| 50 | return parent::getSearch(); |
||
|
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Ajde_Object_Standard as the method getSearch() does only exist in the following sub-classes of Ajde_Object_Standard: Ajde_Collection_View, Ajde_Crud_Options_List_View. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 51 | } |
||
| 52 | |||
| 53 | public function getOrderBy() |
||
| 54 | { |
||
| 55 | return parent::getOrderBy(); |
||
|
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Ajde_Object_Standard as the method getOrderBy() does only exist in the following sub-classes of Ajde_Object_Standard: Ajde_Collection_View, Ajde_Crud_Options_List_View. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 56 | } |
||
| 57 | |||
| 58 | public function getOrderDir() |
||
| 59 | { |
||
| 60 | return parent::getOrderDir(); |
||
|
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Ajde_Object_Standard as the method getOrderDir() does only exist in the following sub-classes of Ajde_Object_Standard: Ajde_Collection_View, Ajde_Crud_Options_List_View. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 61 | } |
||
| 62 | |||
| 63 | public function getFilter() |
||
| 64 | { |
||
| 65 | return parent::getFilter(); |
||
|
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Ajde_Object_Standard as the method getFilter() does only exist in the following sub-classes of Ajde_Object_Standard: AclCollection, Ajde_Acl_Collection, Ajde_Acl_Proxy_Collection, Ajde_Collection, Ajde_Collection_View, Ajde_Collection_With_Acl, Ajde_Collection_With_AclI18n, Ajde_Collection_With_I18n, Ajde_Crud_Options_List_View, Ajde_Lang_Proxy_Collection, Ajde_Shop_Cart_Item_Collection, CartCollection, CartItemCollection, EmailCollection, FormCollection, LogCollection, MailerlogCollection, MediaCollection, MediatypeCollection, MenuCollection, MetaCollection, NodeCollection, NodetypeCollection, ProductCollection, RevisionCollection, SettingCollection, SsoCollection, SubmissionCollection, TagCollection, TemplateCollection, TestCollection, TransactionCollection, TransactionItemCollection, UserCollection, UsergroupCollection, VatCollection. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 66 | } |
||
| 67 | |||
| 68 | public function getViewType() |
||
| 69 | { |
||
| 70 | return parent::getViewType(); |
||
|
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Ajde_Object_Standard as the method getViewType() does only exist in the following sub-classes of Ajde_Object_Standard: Ajde_Collection_View, Ajde_Crud_Options_List_View. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 71 | } |
||
| 72 | |||
| 73 | public function getFilterVisible() |
||
| 74 | { |
||
| 75 | return parent::getFilterVisible(); |
||
|
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Ajde_Object_Standard as the method getFilterVisible() does only exist in the following sub-classes of Ajde_Object_Standard: Ajde_Collection_View, Ajde_Crud_Options_List_View. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 76 | } |
||
| 77 | |||
| 78 | public function getDisableFilter() |
||
| 79 | { |
||
| 80 | return parent::getDisableFilter(); |
||
|
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Ajde_Object_Standard as the method getDisableFilter() does only exist in the following sub-classes of Ajde_Object_Standard: Ajde_Collection_View, Ajde_Crud_Options_List_View. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 81 | } |
||
| 82 | |||
| 83 | public function getMainFilter() |
||
| 84 | { |
||
| 85 | return parent::getMainFilter(); |
||
|
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Ajde_Object_Standard as the method getMainFilter() does only exist in the following sub-classes of Ajde_Object_Standard: Ajde_Collection_View, Ajde_Crud_Options_List_View. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 86 | } |
||
| 87 | |||
| 88 | public function getMainFilterGrouper() |
||
| 89 | { |
||
| 90 | return parent::getMainFilterGrouper(); |
||
|
0 ignored issues
–
show
It seems like you code against a specific sub-type and not the parent class
Ajde_Object_Standard as the method getMainFilterGrouper() does only exist in the following sub-classes of Ajde_Object_Standard: Ajde_Collection_View, Ajde_Crud_Options_List_View. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example: abstract class User
{
/** @return string */
abstract public function getPassword();
}
class MyUser extends User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 91 | } |
||
| 92 | |||
| 93 | public function getFilterForField($fieldName) |
||
| 94 | { |
||
| 95 | $filters = $this->getFilter(); |
||
| 96 | if (!array_key_exists($fieldName, $filters)) { |
||
| 97 | return; |
||
| 98 | } |
||
| 99 | |||
| 100 | return $filters[$fieldName]; |
||
| 101 | } |
||
| 102 | |||
| 103 | public function getRowCount(Ajde_Collection $collection = null) |
||
| 104 | { |
||
| 105 | if (isset($collection)) { |
||
| 106 | return $collection->count(true); |
||
| 107 | } |
||
| 108 | if (!isset($this->_rowCount)) { |
||
| 109 | $sql = 'SELECT COUNT(*) AS count FROM '.$this->_tableName; |
||
| 110 | $connection = Ajde_Db::getInstance()->getConnection(); |
||
| 111 | $statement = $connection->prepare($sql); |
||
| 112 | $statement->execute(); |
||
| 113 | $result = $statement->fetch(PDO::FETCH_ASSOC); |
||
| 114 | $this->_rowCount = $result['count']; |
||
| 115 | } |
||
| 116 | |||
| 117 | return $this->_rowCount; |
||
| 118 | } |
||
| 119 | |||
| 120 | public function setColumns($columns) |
||
| 121 | { |
||
| 122 | $this->set('columns', $columns); |
||
| 123 | } |
||
| 124 | |||
| 125 | public function getColumns() |
||
| 126 | { |
||
| 127 | return $this->get('columns'); |
||
| 128 | } |
||
| 129 | |||
| 130 | public function getPageCount(Ajde_Collection $collection = null) |
||
| 131 | { |
||
| 132 | return ceil($this->getRowCount($collection) / $this->getPageSize()); |
||
| 133 | } |
||
| 134 | |||
| 135 | public function getRowStart() |
||
| 136 | { |
||
| 137 | return ($this->getPage() - 1) * $this->getPageSize(); |
||
| 138 | } |
||
| 139 | } |
||
| 140 |
Let’s take a look at an example:
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.
Available Fixes
Change the type-hint for the parameter:
Add an additional type-check:
Add the method to the parent class: