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\Http\Controllers; |
||
| 13 | |||
| 14 | use Eluceo\iCal\Component\Calendar as iCalendar; |
||
| 15 | use Jitamin\Filter\TaskAssigneeFilter; |
||
| 16 | use Jitamin\Filter\TaskProjectFilter; |
||
| 17 | use Jitamin\Filter\TaskStatusFilter; |
||
| 18 | use Jitamin\Formatter\TaskICalFormatter; |
||
| 19 | use Jitamin\Foundation\Exceptions\AccessForbiddenException; |
||
| 20 | use Jitamin\Foundation\Filter\QueryBuilder; |
||
| 21 | use Jitamin\Model\TaskModel; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * iCalendar Controller. |
||
| 25 | */ |
||
| 26 | class ICalendarController extends Controller |
||
| 27 | { |
||
| 28 | /** |
||
| 29 | * Get user iCalendar. |
||
| 30 | */ |
||
| 31 | public function user() |
||
| 32 | { |
||
| 33 | $token = $this->request->getStringParam('token'); |
||
|
0 ignored issues
–
show
|
|||
| 34 | $user = $this->userModel->getByToken($token); |
||
|
0 ignored issues
–
show
The property
userModel does not exist on object<Jitamin\Http\Cont...rs\ICalendarController>. 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...
|
|||
| 35 | |||
| 36 | // Token verification |
||
| 37 | if (empty($user)) { |
||
| 38 | throw AccessForbiddenException::getInstance()->withoutLayout(); |
||
| 39 | } |
||
| 40 | |||
| 41 | // Common filter |
||
| 42 | $queryBuilder = new QueryBuilder(); |
||
| 43 | $queryBuilder |
||
| 44 | ->withQuery($this->taskFinderModel->getICalQuery()) |
||
|
0 ignored issues
–
show
The property
taskFinderModel does not exist on object<Jitamin\Http\Cont...rs\ICalendarController>. 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...
|
|||
| 45 | ->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN)) |
||
| 46 | ->withFilter(new TaskAssigneeFilter($user['id'])); |
||
| 47 | |||
| 48 | // Calendar properties |
||
| 49 | $calendar = new iCalendar('Jitamin'); |
||
| 50 | $calendar->setName($user['name'] ?: $user['username']); |
||
| 51 | $calendar->setDescription($user['name'] ?: $user['username']); |
||
| 52 | $calendar->setPublishedTTL('PT1H'); |
||
| 53 | |||
| 54 | $this->renderCalendar($queryBuilder, $calendar); |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Get project iCalendar. |
||
| 59 | */ |
||
| 60 | public function project() |
||
| 61 | { |
||
| 62 | $token = $this->request->getStringParam('token'); |
||
|
0 ignored issues
–
show
The property
request does not exist on object<Jitamin\Http\Cont...rs\ICalendarController>. 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...
|
|||
| 63 | $project = $this->projectModel->getByToken($token); |
||
|
0 ignored issues
–
show
The property
projectModel does not exist on object<Jitamin\Http\Cont...rs\ICalendarController>. 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 | // Token verification |
||
| 66 | if (empty($project)) { |
||
| 67 | throw AccessForbiddenException::getInstance()->withoutLayout(); |
||
| 68 | } |
||
| 69 | |||
| 70 | // Common filter |
||
| 71 | $queryBuilder = new QueryBuilder(); |
||
| 72 | $queryBuilder |
||
| 73 | ->withQuery($this->taskFinderModel->getICalQuery()) |
||
|
0 ignored issues
–
show
The property
taskFinderModel does not exist on object<Jitamin\Http\Cont...rs\ICalendarController>. 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...
|
|||
| 74 | ->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN)) |
||
| 75 | ->withFilter(new TaskProjectFilter($project['id'])); |
||
| 76 | |||
| 77 | // Calendar properties |
||
| 78 | $calendar = new iCalendar('Jitamin'); |
||
| 79 | $calendar->setName($project['name']); |
||
| 80 | $calendar->setDescription($project['name']); |
||
| 81 | $calendar->setPublishedTTL('PT1H'); |
||
| 82 | |||
| 83 | $this->renderCalendar($queryBuilder, $calendar); |
||
| 84 | } |
||
| 85 | |||
| 86 | /** |
||
| 87 | * Common method to render iCal events. |
||
| 88 | * |
||
| 89 | * @param QueryBuilder $queryBuilder |
||
| 90 | * @param iCalendar $calendar |
||
| 91 | */ |
||
| 92 | protected function renderCalendar(QueryBuilder $queryBuilder, iCalendar $calendar) |
||
| 93 | { |
||
| 94 | $start = $this->request->getStringParam('start', strtotime('-2 month')); |
||
|
0 ignored issues
–
show
The property
request does not exist on object<Jitamin\Http\Cont...rs\ICalendarController>. 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 | $end = $this->request->getStringParam('end', strtotime('+6 months')); |
||
|
0 ignored issues
–
show
The property
request does not exist on object<Jitamin\Http\Cont...rs\ICalendarController>. 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...
|
|||
| 96 | |||
| 97 | $this->helper->ical->addTaskDateDueEvents($queryBuilder, $calendar, $start, $end); |
||
|
0 ignored issues
–
show
The property
helper does not exist on object<Jitamin\Http\Cont...rs\ICalendarController>. 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...
|
|||
| 98 | |||
| 99 | $formatter = new TaskICalFormatter($this->container); |
||
| 100 | $this->response->ical($formatter->setCalendar($calendar)->format()); |
||
|
0 ignored issues
–
show
The property
response does not exist on object<Jitamin\Http\Cont...rs\ICalendarController>. 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...
|
|||
| 101 | } |
||
| 102 | } |
||
| 103 |
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.