Jitamin /
jitamin
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 | * Task External Link Model. |
||
| 18 | */ |
||
| 19 | class TaskExternalLinkModel extends Model |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * SQL table name. |
||
| 23 | * |
||
| 24 | * @var string |
||
| 25 | */ |
||
| 26 | const TABLE = 'task_has_external_links'; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Get all links. |
||
| 30 | * |
||
| 31 | * @param int $task_id |
||
| 32 | * |
||
| 33 | * @return array |
||
| 34 | */ |
||
| 35 | public function getAll($task_id) |
||
| 36 | { |
||
| 37 | $types = $this->externalLinkManager->getTypes(); |
||
|
0 ignored issues
–
show
|
|||
| 38 | |||
| 39 | $links = $this->db->table(self::TABLE) |
||
|
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\TaskExternalLinkModel>. 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. Loading history...
|
|||
| 40 | ->columns(self::TABLE.'.*', UserModel::TABLE.'.name AS creator_name', UserModel::TABLE.'.username AS creator_username') |
||
| 41 | ->eq('task_id', $task_id) |
||
| 42 | ->asc('title') |
||
| 43 | ->join(UserModel::TABLE, 'id', 'creator_id') |
||
| 44 | ->findAll(); |
||
| 45 | |||
| 46 | foreach ($links as &$link) { |
||
| 47 | $link['dependency_label'] = $this->externalLinkManager->getDependencyLabel($link['link_type'], $link['dependency']); |
||
|
0 ignored issues
–
show
The property
externalLinkManager does not exist on object<Jitamin\Model\TaskExternalLinkModel>. 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. Loading history...
|
|||
| 48 | $link['type'] = isset($types[$link['link_type']]) ? $types[$link['link_type']] : t('Unknown'); |
||
| 49 | } |
||
| 50 | |||
| 51 | return $links; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Get link. |
||
| 56 | * |
||
| 57 | * @param int $link_id |
||
| 58 | * |
||
| 59 | * @return array |
||
| 60 | */ |
||
| 61 | public function getById($link_id) |
||
| 62 | { |
||
| 63 | return $this->db->table(self::TABLE)->eq('id', $link_id)->findOne(); |
||
|
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\TaskExternalLinkModel>. 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. Loading history...
|
|||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Add a new link in the database. |
||
| 68 | * |
||
| 69 | * @param array $values Form values |
||
| 70 | * |
||
| 71 | * @return bool|int |
||
| 72 | */ |
||
| 73 | public function create(array $values) |
||
| 74 | { |
||
| 75 | unset($values['id']); |
||
| 76 | $values['creator_id'] = $this->userSession->getId(); |
||
|
0 ignored issues
–
show
The property
userSession does not exist on object<Jitamin\Model\TaskExternalLinkModel>. 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. Loading history...
|
|||
| 77 | $values['date_creation'] = time(); |
||
| 78 | $values['date_modification'] = $values['date_creation']; |
||
| 79 | |||
| 80 | return $this->db->table(self::TABLE)->persist($values); |
||
|
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\TaskExternalLinkModel>. 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. Loading history...
|
|||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * Modify external link. |
||
| 85 | * |
||
| 86 | * @param array $values Form values |
||
| 87 | * |
||
| 88 | * @return bool |
||
| 89 | */ |
||
| 90 | public function update(array $values) |
||
| 91 | { |
||
| 92 | $values['date_modification'] = time(); |
||
| 93 | |||
| 94 | return $this->db->table(self::TABLE)->eq('id', $values['id'])->update($values); |
||
|
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\TaskExternalLinkModel>. 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. Loading history...
|
|||
| 95 | } |
||
| 96 | |||
| 97 | /** |
||
| 98 | * Remove a link. |
||
| 99 | * |
||
| 100 | * @param int $link_id |
||
| 101 | * |
||
| 102 | * @return bool |
||
| 103 | */ |
||
| 104 | public function remove($link_id) |
||
| 105 | { |
||
| 106 | return $this->db->table(self::TABLE)->eq('id', $link_id)->remove(); |
||
|
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\TaskExternalLinkModel>. 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. Loading history...
|
|||
| 107 | } |
||
| 108 | } |
||
| 109 |
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@propertyannotation 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.