summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.scrutinizer.yml55
-rw-r--r--app/Auth/Base.php1
-rw-r--r--app/Auth/GitHub.php2
-rw-r--r--app/Auth/Google.php2
-rw-r--r--app/Auth/Ldap.php4
-rw-r--r--app/Auth/RememberMe.php3
-rw-r--r--app/Auth/ReverseProxy.php2
-rw-r--r--app/Controller/Action.php2
-rw-r--r--app/Controller/Base.php5
-rw-r--r--app/Controller/Board.php4
-rw-r--r--app/Controller/Category.php2
-rw-r--r--app/Controller/Comment.php2
-rw-r--r--app/Controller/Link.php2
-rw-r--r--app/Controller/Subtask.php2
-rw-r--r--app/Controller/Swimlane.php2
-rw-r--r--app/Controller/Task.php4
-rw-r--r--app/Controller/Tasklink.php2
-rw-r--r--app/Controller/Twofactor.php2
-rw-r--r--app/Controller/User.php2
-rw-r--r--app/Integration/Base.php1
-rw-r--r--app/Integration/BitbucketWebhook.php2
-rw-r--r--app/Integration/GithubWebhook.php16
-rw-r--r--app/Integration/GitlabWebhook.php4
-rw-r--r--app/Integration/Hipchat.php2
-rw-r--r--app/Integration/SlackWebhook.php2
-rw-r--r--app/Model/Action.php2
-rw-r--r--app/Model/Base.php4
-rw-r--r--app/Model/SubtaskForecast.php8
-rw-r--r--app/Model/Timetable.php6
-rw-r--r--app/Schema/Mysql.php1
-rw-r--r--app/Schema/Postgres.php1
-rw-r--r--app/Schema/Sqlite.php1
-rw-r--r--app/Subscriber/Base.php2
-rw-r--r--app/Subscriber/NotificationSubscriber.php2
34 files changed, 61 insertions, 93 deletions
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
index 0a235f70..c7af0d09 100644
--- a/.scrutinizer.yml
+++ b/.scrutinizer.yml
@@ -2,57 +2,6 @@ filter:
excluded_paths:
- 'vendor/*'
- 'tests/*'
+ - 'app/Schema/*'
- 'app/Template/*'
- - 'scripts/*'
- paths: { }
-tools:
- php_sim:
- enabled: true
- min_mass: 16
- filter:
- excluded_paths:
- - 'vendor/*'
- - 'tests/*'
- - 'app/Template/*'
- - 'scripts/*'
- paths: { }
- php_pdepend:
- enabled: true
- configuration_file: null
- suffixes:
- - php
- excluded_dirs: { }
- filter:
- excluded_paths:
- - 'vendor/*'
- - 'tests/*'
- - 'app/Template/*'
- - 'scripts/*'
- paths: { }
- php_analyzer:
- enabled: true
- extensions:
- - php
- dependency_paths: { }
- filter:
- excluded_paths:
- - 'vendor/*'
- - 'tests/*'
- - 'app/Template/*'
- - 'scripts/*'
- paths: { }
- path_configs: { }
- php_changetracking:
- enabled: true
- bug_patterns:
- - '\bfix(?:es|ed)?\b'
- feature_patterns:
- - '\badd(?:s|ed)?\b'
- - '\bimplement(?:s|ed)?\b'
- filter:
- excluded_paths:
- - 'vendor/*'
- - 'tests/*'
- - 'app/Template/*'
- - 'scripts/*'
- paths: { }
+ - 'scripts/*' \ No newline at end of file
diff --git a/app/Auth/Base.php b/app/Auth/Base.php
index e023e4fe..e2209e1f 100644
--- a/app/Auth/Base.php
+++ b/app/Auth/Base.php
@@ -10,6 +10,7 @@ use Pimple\Container;
* @package auth
* @author Frederic Guillot
*
+ * @property \Core\Session $session
* @property \Model\Acl $acl
* @property \Model\LastLogin $lastLogin
* @property \Model\User $user
diff --git a/app/Auth/GitHub.php b/app/Auth/GitHub.php
index 0e335fb4..816cc9c1 100644
--- a/app/Auth/GitHub.php
+++ b/app/Auth/GitHub.php
@@ -34,7 +34,7 @@ class GitHub extends Base
{
$user = $this->user->getByGitHubId($github_id);
- if ($user) {
+ if (! empty($user)) {
$this->userSession->refresh($user);
$this->container['dispatcher']->dispatch('auth.success', new AuthEvent(self::AUTH_NAME, $user['id']));
return true;
diff --git a/app/Auth/Google.php b/app/Auth/Google.php
index e7abae08..9a977037 100644
--- a/app/Auth/Google.php
+++ b/app/Auth/Google.php
@@ -35,7 +35,7 @@ class Google extends Base
{
$user = $this->user->getByGoogleId($google_id);
- if ($user) {
+ if (! empty($user)) {
$this->userSession->refresh($user);
$this->container['dispatcher']->dispatch('auth.success', new AuthEvent(self::AUTH_NAME, $user['id']));
return true;
diff --git a/app/Auth/Ldap.php b/app/Auth/Ldap.php
index ed29199f..3ee6ec9b 100644
--- a/app/Auth/Ldap.php
+++ b/app/Auth/Ldap.php
@@ -36,7 +36,7 @@ class Ldap extends Base
$user = $this->user->getByUsername($username);
- if ($user) {
+ if (! empty($user)) {
// There is already a local user with that name
if ($user['is_ldap_user'] == 0) {
@@ -241,7 +241,7 @@ class Ldap extends Base
}
// User id not retrieved: LDAP_ACCOUNT_ID not properly configured
- if (! $username && ! isset($info[0][LDAP_ACCOUNT_ID][0])) {
+ if (empty($username) && ! isset($info[0][LDAP_ACCOUNT_ID][0])) {
return false;
}
diff --git a/app/Auth/RememberMe.php b/app/Auth/RememberMe.php
index 4736442e..e8b20f37 100644
--- a/app/Auth/RememberMe.php
+++ b/app/Auth/RememberMe.php
@@ -103,6 +103,9 @@ class RememberMe extends Base
// Create the session
$this->userSession->refresh($this->user->getById($record['user_id']));
+ // Do not ask 2FA for remember me session
+ $this->session['2fa_validated'] = true;
+
$this->container['dispatcher']->dispatch(
'auth.success',
new AuthEvent(self::AUTH_NAME, $this->userSession->getId())
diff --git a/app/Auth/ReverseProxy.php b/app/Auth/ReverseProxy.php
index 6cd01b28..c8fd5eec 100644
--- a/app/Auth/ReverseProxy.php
+++ b/app/Auth/ReverseProxy.php
@@ -32,7 +32,7 @@ class ReverseProxy extends Base
$login = $_SERVER[REVERSE_PROXY_USER_HEADER];
$user = $this->user->getByUsername($login);
- if (! $user) {
+ if (empty($user)) {
$this->createUser($login);
$user = $this->user->getByUsername($login);
}
diff --git a/app/Controller/Action.php b/app/Controller/Action.php
index 2b58dca1..cd24453a 100644
--- a/app/Controller/Action.php
+++ b/app/Controller/Action.php
@@ -157,7 +157,7 @@ class Action extends Base
$project = $this->getProject();
$action = $this->action->getById($this->request->getIntegerParam('action_id'));
- if ($action && $this->action->remove($action['id'])) {
+ if (! empty($action) && $this->action->remove($action['id'])) {
$this->session->flash(t('Action removed successfully.'));
} else {
$this->session->flashError(t('Unable to remove this action.'));
diff --git a/app/Controller/Base.php b/app/Controller/Base.php
index cebecaca..10bf962f 100644
--- a/app/Controller/Base.php
+++ b/app/Controller/Base.php
@@ -44,6 +44,7 @@ use Symfony\Component\EventDispatcher\Event;
* @property \Model\ProjectActivity $projectActivity
* @property \Model\ProjectDailySummary $projectDailySummary
* @property \Model\Subtask $subtask
+ * @property \Model\SubtaskForecast $subtaskForecast
* @property \Model\Swimlane $swimlane
* @property \Model\Task $task
* @property \Model\Link $link
@@ -336,7 +337,7 @@ abstract class Base
{
$task = $this->taskFinder->getDetails($this->request->getIntegerParam('task_id'));
- if (! $task) {
+ if (empty($task)) {
$this->notfound();
}
@@ -355,7 +356,7 @@ abstract class Base
$project_id = $this->request->getIntegerParam('project_id', $project_id);
$project = $this->project->getById($project_id);
- if (! $project) {
+ if (empty($project)) {
$this->session->flashError(t('Project not found.'));
$this->response->redirect('?controller=project');
}
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index 17170317..fa22226e 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -117,7 +117,7 @@ class Board extends Base
$project = $this->project->getByToken($token);
// Token verification
- if (! $project) {
+ if (empty($project)) {
$this->forbidden(true);
}
@@ -311,7 +311,7 @@ class Board extends Base
$this->checkCSRFParam();
$column = $this->board->getColumn($this->request->getIntegerParam('column_id'));
- if ($column && $this->board->removeColumn($column['id'])) {
+ if (! empty($column) && $this->board->removeColumn($column['id'])) {
$this->session->flash(t('Column removed successfully.'));
} else {
$this->session->flashError(t('Unable to remove this column.'));
diff --git a/app/Controller/Category.php b/app/Controller/Category.php
index 68961a0e..515cc9c8 100644
--- a/app/Controller/Category.php
+++ b/app/Controller/Category.php
@@ -21,7 +21,7 @@ class Category extends Base
{
$category = $this->category->getById($this->request->getIntegerParam('category_id'));
- if (! $category) {
+ if (empty($category)) {
$this->session->flashError(t('Category not found.'));
$this->response->redirect('?controller=category&action=index&project_id='.$project_id);
}
diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php
index 50032000..a5f6b1f8 100644
--- a/app/Controller/Comment.php
+++ b/app/Controller/Comment.php
@@ -20,7 +20,7 @@ class Comment extends Base
{
$comment = $this->comment->getById($this->request->getIntegerParam('comment_id'));
- if (! $comment) {
+ if (empty($comment)) {
$this->notfound();
}
diff --git a/app/Controller/Link.php b/app/Controller/Link.php
index ec9c6195..4a29a3e2 100644
--- a/app/Controller/Link.php
+++ b/app/Controller/Link.php
@@ -37,7 +37,7 @@ class Link extends Base
{
$link = $this->link->getById($this->request->getIntegerParam('link_id'));
- if (! $link) {
+ if (empty($link)) {
$this->notfound();
}
diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php
index 385785a1..5eff1575 100644
--- a/app/Controller/Subtask.php
+++ b/app/Controller/Subtask.php
@@ -22,7 +22,7 @@ class Subtask extends Base
{
$subtask = $this->subtask->getById($this->request->getIntegerParam('subtask_id'));
- if (! $subtask) {
+ if (empty($subtask)) {
$this->notfound();
}
diff --git a/app/Controller/Swimlane.php b/app/Controller/Swimlane.php
index e10d21f1..c6862d47 100644
--- a/app/Controller/Swimlane.php
+++ b/app/Controller/Swimlane.php
@@ -23,7 +23,7 @@ class Swimlane extends Base
{
$swimlane = $this->swimlane->getById($this->request->getIntegerParam('swimlane_id'));
- if (! $swimlane) {
+ if (empty($swimlane)) {
$this->session->flashError(t('Swimlane not found.'));
$this->response->redirect('?controller=swimlane&action=index&project_id='.$project_id);
}
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index 3c5b5c39..5bca4510 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -22,13 +22,13 @@ class Task extends Base
$project = $this->project->getByToken($this->request->getStringParam('token'));
// Token verification
- if (! $project) {
+ if (empty($project)) {
$this->forbidden(true);
}
$task = $this->taskFinder->getDetails($this->request->getIntegerParam('task_id'));
- if (! $task) {
+ if (empty($task)) {
$this->notfound(true);
}
diff --git a/app/Controller/Tasklink.php b/app/Controller/Tasklink.php
index 59ce0433..8376b75b 100644
--- a/app/Controller/Tasklink.php
+++ b/app/Controller/Tasklink.php
@@ -21,7 +21,7 @@ class Tasklink extends Base
{
$link = $this->taskLink->getById($this->request->getIntegerParam('link_id'));
- if (! $link) {
+ if (empty($link)) {
$this->notfound();
}
diff --git a/app/Controller/Twofactor.php b/app/Controller/Twofactor.php
index 48954dc8..e3451d33 100644
--- a/app/Controller/Twofactor.php
+++ b/app/Controller/Twofactor.php
@@ -73,7 +73,7 @@ class Twofactor extends User
}
// Allow the user to test or disable the feature
- $this->session['user']['twofactor_activated'] = false;
+ $_SESSION['user']['twofactor_activated'] = false;
$this->session->flash(t('User updated successfully.'));
$this->response->redirect($this->helper->url('twofactor', 'index', array('user_id' => $user['id'])));
diff --git a/app/Controller/User.php b/app/Controller/User.php
index 46d0214d..5dad4ef6 100644
--- a/app/Controller/User.php
+++ b/app/Controller/User.php
@@ -97,7 +97,7 @@ class User extends Base
{
$user = $this->user->getById($this->request->getIntegerParam('user_id'));
- if (! $user) {
+ if (empty($user)) {
$this->notfound();
}
diff --git a/app/Integration/Base.php b/app/Integration/Base.php
index babf8c8f..c6387fe2 100644
--- a/app/Integration/Base.php
+++ b/app/Integration/Base.php
@@ -10,6 +10,7 @@ use Pimple\Container;
* @package integration
* @author Frederic Guillot
*
+ * @property \Model\ProjectActivity $projectActivity
* @property \Model\Task $task
* @property \Model\TaskFinder $taskFinder
* @property \Model\User $user
diff --git a/app/Integration/BitbucketWebhook.php b/app/Integration/BitbucketWebhook.php
index ccb89e13..7ff8087e 100644
--- a/app/Integration/BitbucketWebhook.php
+++ b/app/Integration/BitbucketWebhook.php
@@ -78,7 +78,7 @@ class BitbucketWebhook extends Base
$task = $this->taskFinder->getById($task_id);
- if (! $task) {
+ if (empty($task)) {
return false;
}
diff --git a/app/Integration/GithubWebhook.php b/app/Integration/GithubWebhook.php
index fd0b49f6..121fdd1b 100644
--- a/app/Integration/GithubWebhook.php
+++ b/app/Integration/GithubWebhook.php
@@ -86,7 +86,7 @@ class GithubWebhook extends Base
$task = $this->taskFinder->getById($task_id);
- if (! $task) {
+ if (empty($task)) {
continue;
}
@@ -142,7 +142,7 @@ class GithubWebhook extends Base
$task = $this->taskFinder->getByReference($payload['issue']['number']);
$user = $this->user->getByUsername($payload['comment']['user']['login']);
- if ($task && $user) {
+ if (! empty($task) && ! empty($user)) {
$event = array(
'project_id' => $this->project_id,
@@ -198,7 +198,7 @@ class GithubWebhook extends Base
{
$task = $this->taskFinder->getByReference($issue['number']);
- if ($task) {
+ if (! empty($task)) {
$event = array(
'project_id' => $this->project_id,
'task_id' => $task['id'],
@@ -227,7 +227,7 @@ class GithubWebhook extends Base
{
$task = $this->taskFinder->getByReference($issue['number']);
- if ($task) {
+ if (! empty($task)) {
$event = array(
'project_id' => $this->project_id,
'task_id' => $task['id'],
@@ -257,7 +257,7 @@ class GithubWebhook extends Base
$user = $this->user->getByUsername($issue['assignee']['login']);
$task = $this->taskFinder->getByReference($issue['number']);
- if ($user && $task) {
+ if (! empty($user) && ! empty($task)) {
$event = array(
'project_id' => $this->project_id,
@@ -288,7 +288,7 @@ class GithubWebhook extends Base
{
$task = $this->taskFinder->getByReference($issue['number']);
- if ($task) {
+ if (! empty($task)) {
$event = array(
'project_id' => $this->project_id,
@@ -320,7 +320,7 @@ class GithubWebhook extends Base
{
$task = $this->taskFinder->getByReference($issue['number']);
- if ($task) {
+ if (! empty($task)) {
$event = array(
'project_id' => $this->project_id,
@@ -352,7 +352,7 @@ class GithubWebhook extends Base
{
$task = $this->taskFinder->getByReference($issue['number']);
- if ($task) {
+ if (! empty($task)) {
$event = array(
'project_id' => $this->project_id,
diff --git a/app/Integration/GitlabWebhook.php b/app/Integration/GitlabWebhook.php
index e920f33d..dbba3663 100644
--- a/app/Integration/GitlabWebhook.php
+++ b/app/Integration/GitlabWebhook.php
@@ -122,7 +122,7 @@ class GitlabWebhook extends Base
$task = $this->taskFinder->getById($task_id);
- if (! $task) {
+ if (empty($task)) {
return false;
}
@@ -193,7 +193,7 @@ class GitlabWebhook extends Base
{
$task = $this->taskFinder->getByReference($issue['id']);
- if ($task) {
+ if (! empty($task)) {
$event = array(
'project_id' => $this->project_id,
'task_id' => $task['id'],
diff --git a/app/Integration/Hipchat.php b/app/Integration/Hipchat.php
index 036925f7..1306af6d 100644
--- a/app/Integration/Hipchat.php
+++ b/app/Integration/Hipchat.php
@@ -17,7 +17,7 @@ class Hipchat extends Base
* @param integer $project_id Project id
* @param integer $task_id Task id
* @param string $event_name Event name
- * @param array $data Event data
+ * @param array $event Event data
*/
public function notify($project_id, $task_id, $event_name, array $event)
{
diff --git a/app/Integration/SlackWebhook.php b/app/Integration/SlackWebhook.php
index fc7daeb4..1c2ea781 100644
--- a/app/Integration/SlackWebhook.php
+++ b/app/Integration/SlackWebhook.php
@@ -17,7 +17,7 @@ class SlackWebhook extends Base
* @param integer $project_id Project id
* @param integer $task_id Task id
* @param string $event_name Event name
- * @param array $data Event data
+ * @param array $event Event data
*/
public function notify($project_id, $task_id, $event_name, array $event)
{
diff --git a/app/Model/Action.php b/app/Model/Action.php
index b30d89fa..91bd9608 100644
--- a/app/Model/Action.php
+++ b/app/Model/Action.php
@@ -214,7 +214,7 @@ class Action extends Base
*
* @access public
* @param array $values Required parameters to save an action
- * @return integer
+ * @return boolean|integer
*/
public function create(array $values)
{
diff --git a/app/Model/Base.php b/app/Model/Base.php
index 0217aae3..b0d82401 100644
--- a/app/Model/Base.php
+++ b/app/Model/Base.php
@@ -44,6 +44,10 @@ use Pimple\Container;
* @property \Model\TaskPosition $taskPosition
* @property \Model\TaskValidator $taskValidator
* @property \Model\Timetable $timetable
+ * @property \Model\TimetableDay $timetableDay
+ * @property \Model\TimetableExtra $timetableExtra
+ * @property \Model\TimetableOff $timetableOfff
+ * @property \Model\TimetableWeek $timetableWeek
* @property \Model\SubtaskTimeTracking $subtaskTimeTracking
* @property \Model\User $user
* @property \Model\UserSession $userSession
diff --git a/app/Model/SubtaskForecast.php b/app/Model/SubtaskForecast.php
index cb86f6d7..0cb3175d 100644
--- a/app/Model/SubtaskForecast.php
+++ b/app/Model/SubtaskForecast.php
@@ -81,7 +81,13 @@ class SubtaskForecast extends Base
$start = $slot[0]->getTimestamp();
if ($slot[0] < $start_date) {
- continue;
+
+ if (! $this->dateParser->withinDateRange($start_date, $slot[0], $slot[1])) {
+ continue;
+ }
+
+ $interval = $this->dateParser->getHours(new DateTime, $slot[1]);
+ $start = time();
}
while ($offset < $total) {
diff --git a/app/Model/Timetable.php b/app/Model/Timetable.php
index da2ec10c..6ddf826b 100644
--- a/app/Model/Timetable.php
+++ b/app/Model/Timetable.php
@@ -62,10 +62,8 @@ class Timetable extends Base
* Get a serie of events based on the timetable and the provided event
*
* @access public
- * @param integer $user_id
- * @param array $events Time tracking data
- * @param string $start ISO8601 date
- * @param string $end ISO8601 date
+ * @param array $event
+ * @param array $timetable
* @return array
*/
public function calculateEventIntersect(array $event, array $timetable)
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php
index 2dcfd3b7..e5269d93 100644
--- a/app/Schema/Mysql.php
+++ b/app/Schema/Mysql.php
@@ -162,6 +162,7 @@ function version_49($pdo)
$pdo->exec('ALTER TABLE subtasks ADD COLUMN position INTEGER DEFAULT 1');
$task_id = 0;
+ $position = 1;
$urq = $pdo->prepare('UPDATE subtasks SET position=? WHERE id=?');
$rq = $pdo->prepare('SELECT * FROM subtasks ORDER BY task_id, id ASC');
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index 6c6ea001..2c5e0f28 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -155,6 +155,7 @@ function version_30($pdo)
$pdo->exec('ALTER TABLE subtasks ADD COLUMN position INTEGER DEFAULT 1');
$task_id = 0;
+ $position = 1;
$urq = $pdo->prepare('UPDATE subtasks SET position=? WHERE id=?');
$rq = $pdo->prepare('SELECT * FROM subtasks ORDER BY task_id, id ASC');
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index ef6523e4..b9c264bc 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -157,6 +157,7 @@ function version_48($pdo)
// Migrate all subtasks position
$task_id = 0;
+ $position = 1;
$urq = $pdo->prepare('UPDATE subtasks SET position=? WHERE id=?');
$rq = $pdo->prepare('SELECT * FROM subtasks ORDER BY task_id, id ASC');
diff --git a/app/Subscriber/Base.php b/app/Subscriber/Base.php
index f90d9604..97e230b5 100644
--- a/app/Subscriber/Base.php
+++ b/app/Subscriber/Base.php
@@ -10,6 +10,8 @@ use Pimple\Container;
* @package subscriber
* @author Frederic Guillot
*
+ * @property \Integration\SlackWebhook $slackWebhook
+ * @property \Integration\Hipchat $hipchat
* @property \Model\Board $board
* @property \Model\Config $config
* @property \Model\Comment $comment
diff --git a/app/Subscriber/NotificationSubscriber.php b/app/Subscriber/NotificationSubscriber.php
index 1b7187fe..94815b56 100644
--- a/app/Subscriber/NotificationSubscriber.php
+++ b/app/Subscriber/NotificationSubscriber.php
@@ -49,7 +49,7 @@ class NotificationSubscriber extends Base implements EventSubscriberInterface
$values = $this->getTemplateData($event);
$users = $this->notification->getUsersList($values['task']['project_id']);
- if ($users) {
+ if (! empty($users)) {
$this->notification->sendEmails($this->templates[$event_name], $users, $values);
}
}