1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00

Update sources to v1.0.20

This commit is contained in:
mbugeia 2015-10-26 14:48:27 +01:00
parent 777f30b769
commit 0826b10798
340 changed files with 3500 additions and 5868 deletions

View file

@ -1,3 +1,30 @@
Version 1.0.20
--------------
Breaking changes:
- Add namespace Kanboard (update your plugins)
- Move Mailgun, Sendgrid, Postmark, Slack, Hipchat and Jabber to plugins
- ReverseProxy authentication check for each request that the username match the user session
New features:
* Add CSV import for users and tasks
* Add Task, User and Project metadata for plugin creators
Improvements:
* Allow to change comments sorting
* Add the possibility to append or not custom filters
* Make mail transports pluggable
* Do not show scroll-bars when a column is collapsed on Windows systems
* Regenerate thumbnails if missing
Bug fixes:
* People should not see any tasks during a search when they are not associated to a project
* Avoid to disable the default swimlane during renaming when there is no other activated swimlane
Version 1.0.19
--------------

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Event\GenericEvent;
use Kanboard\Event\GenericEvent;
use Pimple\Container;
/**
@ -11,7 +11,7 @@ use Pimple\Container;
* @package action
* @author Frederic Guillot
*/
abstract class Base extends \Core\Base
abstract class Base extends \Kanboard\Core\Base
{
/**
* Flag for called listener

View file

@ -1,10 +1,10 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Integration\BitbucketWebhook;
use Integration\GithubWebhook;
use Integration\GitlabWebhook;
use Kanboard\Integration\BitbucketWebhook;
use Kanboard\Integration\GithubWebhook;
use Kanboard\Integration\GitlabWebhook;
/**
* Create automatically a comment from a webhook

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Set a category automatically according to the color

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Integration\GithubWebhook;
use Kanboard\Integration\GithubWebhook;
/**
* Set a category automatically according to a label

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Assign a color to a specific category

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Assign a color to a task

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\TaskLink;
use Kanboard\Model\TaskLink;
/**
* Assign a color to a specific task link

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Assign a color to a specific user

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Assign a task to the logged user

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Assign a task to a specific user

View file

@ -1,9 +1,9 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Integration\GithubWebhook;
use Integration\BitbucketWebhook;
use Kanboard\Integration\GithubWebhook;
use Kanboard\Integration\BitbucketWebhook;
/**
* Assign a task to someone

View file

@ -1,11 +1,11 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Integration\GitlabWebhook;
use Integration\GithubWebhook;
use Integration\BitbucketWebhook;
use Model\Task;
use Kanboard\Integration\GitlabWebhook;
use Kanboard\Integration\GithubWebhook;
use Kanboard\Integration\BitbucketWebhook;
use Kanboard\Model\Task;
/**
* Close automatically a task

View file

@ -1,10 +1,10 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Integration\GithubWebhook;
use Integration\GitlabWebhook;
use Integration\BitbucketWebhook;
use Kanboard\Integration\GithubWebhook;
use Kanboard\Integration\GitlabWebhook;
use Kanboard\Integration\BitbucketWebhook;
/**
* Create automatically a task from a webhook

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Duplicate a task to another project

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Email a task to someone
@ -67,7 +67,6 @@ class TaskEmail extends Base
$user = $this->user->getById($this->getParam('user_id'));
if (! empty($user['email'])) {
$task = $this->taskFinder->getDetails($data['task_id']);
$this->emailClient->send(

View file

@ -1,9 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\GithubWebhook;
use Model\Task;
use Kanboard\Model\Task;
/**
* Add a log of the triggering event to the task description.
@ -60,7 +59,7 @@ class TaskLogMoveAnotherColumn extends Base
if (! $this->userSession->isLogged()) {
return false;
}
$column = $this->board->getColumn($data['column_id']);
return (bool) $this->comment->create(array(

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Move a task to another project

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Move a task to another column when an assignee is set

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Move a task to another column when the category is changed

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Move a task to another column when an assignee is cleared

View file

@ -1,9 +1,9 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Integration\GithubWebhook;
use Integration\BitbucketWebhook;
use Kanboard\Integration\GithubWebhook;
use Kanboard\Integration\BitbucketWebhook;
/**
* Open automatically a task

View file

@ -1,8 +1,8 @@
<?php
namespace Action;
namespace Kanboard\Action;
use Model\Task;
use Kanboard\Model\Task;
/**
* Set the start date of task

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
/**
* Action API controller
@ -8,7 +8,7 @@ namespace Api;
* @package api
* @author Frederic Guillot
*/
class Action extends \Core\Base
class Action extends \Kanboard\Core\Base
{
public function getAvailableActions()
{
@ -35,10 +35,9 @@ class Action extends \Core\Base
$actions = $this->action->getAllByProject($project_id);
foreach ($actions as $index => $action) {
$params = array();
foreach($action['params'] as $param) {
foreach ($action['params'] as $param) {
$params[$param['name']] = $param['value'];
}
@ -57,7 +56,7 @@ class Action extends \Core\Base
'params' => $params,
);
list($valid,) = $this->action->validateCreation($values);
list($valid, ) = $this->action->validateCreation($values);
if (! $valid) {
return false;
@ -80,14 +79,14 @@ class Action extends \Core\Base
$required_params = $action->getActionRequiredParameters();
// Check missing parameters
foreach($required_params as $param => $value) {
foreach ($required_params as $param => $value) {
if (! isset($params[$param])) {
return false;
}
}
// Check extra parameters
foreach($params as $param => $value) {
foreach ($params as $param => $value) {
if (! isset($required_params[$param])) {
return false;
}

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
/**
* App API controller
@ -8,7 +8,7 @@ namespace Api;
* @package api
* @author Frederic Guillot
*/
class App extends \Core\Base
class App extends \Kanboard\Core\Base
{
public function getTimezone()
{

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
use JsonRPC\AuthenticationFailure;
use Symfony\Component\EventDispatcher\Event;
@ -29,11 +29,9 @@ class Auth extends Base
if ($username !== 'jsonrpc' && ! $this->authentication->hasCaptcha($username) && $this->authentication->authenticate($username, $password)) {
$this->checkProcedurePermission(true, $method);
$this->userSession->refresh($this->user->getByUsername($username));
}
else if ($username === 'jsonrpc' && $password === $this->config->get('api_token')) {
} elseif ($username === 'jsonrpc' && $password === $this->config->get('api_token')) {
$this->checkProcedurePermission(false, $method);
}
else {
} else {
throw new AuthenticationFailure('Wrong credentials');
}
}

View file

@ -1,8 +1,7 @@
<?php
namespace Api;
namespace Kanboard\Api;
use JsonRPC\AuthenticationFailure;
use JsonRPC\AccessDeniedException;
/**
@ -11,7 +10,7 @@ use JsonRPC\AccessDeniedException;
* @package api
* @author Frederic Guillot
*/
abstract class Base extends \Core\Base
abstract class Base extends \Kanboard\Core\Base
{
private $user_allowed_procedures = array(
'getMe',
@ -50,8 +49,7 @@ abstract class Base extends \Core\Base
if ($is_user && ! $is_both_procedure && ! $is_user_procedure) {
throw new AccessDeniedException('Permission denied');
}
else if (! $is_user && ! $is_both_procedure && $is_user_procedure) {
} elseif (! $is_user && ! $is_both_procedure && $is_user_procedure) {
throw new AccessDeniedException('Permission denied');
}

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
/**
* Board API controller

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
/**
* Category API controller
@ -8,7 +8,7 @@ namespace Api;
* @package api
* @author Frederic Guillot
*/
class Category extends \Core\Base
class Category extends \Kanboard\Core\Base
{
public function getCategory($category_id)
{
@ -32,7 +32,7 @@ class Category extends \Core\Base
'name' => $name,
);
list($valid,) = $this->category->validateCreation($values);
list($valid, ) = $this->category->validateCreation($values);
return $valid ? $this->category->create($values) : false;
}
@ -43,7 +43,7 @@ class Category extends \Core\Base
'name' => $name,
);
list($valid,) = $this->category->validateModification($values);
list($valid, ) = $this->category->validateModification($values);
return $valid && $this->category->update($values);
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
/**
* Comment API controller
@ -8,7 +8,7 @@ namespace Api;
* @package api
* @author Frederic Guillot
*/
class Comment extends \Core\Base
class Comment extends \Kanboard\Core\Base
{
public function getComment($comment_id)
{
@ -33,7 +33,7 @@ class Comment extends \Core\Base
'comment' => $content,
);
list($valid,) = $this->comment->validateCreation($values);
list($valid, ) = $this->comment->validateCreation($values);
return $valid ? $this->comment->create($values) : false;
}
@ -45,7 +45,7 @@ class Comment extends \Core\Base
'comment' => $content,
);
list($valid,) = $this->comment->validateModification($values);
list($valid, ) = $this->comment->validateModification($values);
return $valid && $this->comment->update($values);
}
}

View file

@ -1,8 +1,8 @@
<?php
namespace Api;
namespace Kanboard\Api;
use Core\ObjectStorage\ObjectStorageException;
use Kanboard\Core\ObjectStorage\ObjectStorageException;
/**
* File API controller
@ -10,7 +10,7 @@ use Core\ObjectStorage\ObjectStorageException;
* @package api
* @author Frederic Guillot
*/
class File extends \Core\Base
class File extends \Kanboard\Core\Base
{
public function getFile($file_id)
{
@ -25,14 +25,12 @@ class File extends \Core\Base
public function downloadFile($file_id)
{
try {
$file = $this->file->getById($file_id);
if (! empty($file)) {
return base64_encode($this->objectStorage->get($file['path']));
}
}
catch (ObjectStorageException $e) {
} catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
}

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
/**
* Link API controller
@ -8,7 +8,7 @@ namespace Api;
* @package api
* @author Frederic Guillot
*/
class Link extends \Core\Base
class Link extends \Kanboard\Core\Base
{
/**
* Get a link by id
@ -72,7 +72,7 @@ class Link extends \Core\Base
'opposite_label' => $opposite_label,
);
list($valid,) = $this->link->validateCreation($values);
list($valid, ) = $this->link->validateCreation($values);
return $valid ? $this->link->create($label, $opposite_label) : false;
}
@ -93,7 +93,7 @@ class Link extends \Core\Base
'label' => $label,
);
list($valid,) = $this->link->validateModification($values);
list($valid, ) = $this->link->validateModification($values);
return $valid && $this->link->update($values);
}

View file

@ -1,9 +1,8 @@
<?php
namespace Api;
namespace Kanboard\Api;
use Model\Subtask as SubtaskModel;
use Model\Task as TaskModel;
use Kanboard\Model\Subtask as SubtaskModel;
/**
* Me API controller
@ -45,7 +44,7 @@ class Me extends Base
'is_private' => 1,
);
list($valid,) = $this->project->validateCreation($values);
list($valid, ) = $this->project->validateCreation($values);
return $valid ? $this->project->create($values, $this->userSession->getId(), true) : false;
}

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
/**
* Project API controller
@ -69,7 +69,7 @@ class Project extends Base
'description' => $description
);
list($valid,) = $this->project->validateCreation($values);
list($valid, ) = $this->project->validateCreation($values);
return $valid ? $this->project->create($values) : false;
}
@ -81,7 +81,7 @@ class Project extends Base
'description' => $description
);
list($valid,) = $this->project->validateModification($values);
list($valid, ) = $this->project->validateModification($values);
return $valid && $this->project->update($values);
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
/**
* ProjectPermission API controller
@ -8,7 +8,7 @@ namespace Api;
* @package api
* @author Frederic Guillot
*/
class ProjectPermission extends \Core\Base
class ProjectPermission extends \Kanboard\Core\Base
{
public function getMembers($project_id)
{

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
/**
* Subtask API controller
@ -8,7 +8,7 @@ namespace Api;
* @package api
* @author Frederic Guillot
*/
class Subtask extends \Core\Base
class Subtask extends \Kanboard\Core\Base
{
public function getSubtask($subtask_id)
{
@ -36,7 +36,7 @@ class Subtask extends \Core\Base
'status' => $status,
);
list($valid,) = $this->subtask->validateCreation($values);
list($valid, ) = $this->subtask->validateCreation($values);
return $valid ? $this->subtask->create($values) : false;
}
@ -58,7 +58,7 @@ class Subtask extends \Core\Base
}
}
list($valid,) = $this->subtask->validateApiModification($values);
list($valid, ) = $this->subtask->validateApiModification($values);
return $valid && $this->subtask->update($values);
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
/**
* Swimlane API controller
@ -8,7 +8,7 @@ namespace Api;
* @package api
* @author Frederic Guillot
*/
class Swimlane extends \Core\Base
class Swimlane extends \Kanboard\Core\Base
{
public function getActiveSwimlanes($project_id)
{

View file

@ -1,8 +1,8 @@
<?php
namespace Api;
namespace Kanboard\Api;
use Model\Task as TaskModel;
use Kanboard\Model\Task as TaskModel;
/**
* Task API controller
@ -34,7 +34,7 @@ class Task extends Base
{
return $this->taskFinder->getOverdueTasks();
}
public function getOverdueTasksByProject($project_id)
{
$this->checkProjectPermission($project_id);
@ -91,7 +91,7 @@ class Task extends Base
'reference' => $reference,
);
list($valid,) = $this->taskValidator->validateCreation($values);
list($valid, ) = $this->taskValidator->validateCreation($values);
return $valid ? $this->taskCreation->create($values) : false;
}

View file

@ -1,6 +1,6 @@
<?php
namespace Api;
namespace Kanboard\Api;
/**
* TaskLink API controller
@ -8,7 +8,7 @@ namespace Api;
* @package api
* @author Frederic Guillot
*/
class TaskLink extends \Core\Base
class TaskLink extends \Kanboard\Core\Base
{
/**
* Get a task link

View file

@ -1,8 +1,8 @@
<?php
namespace Api;
namespace Kanboard\Api;
use Auth\Ldap;
use Kanboard\Auth\Ldap;
/**
* User API controller
@ -10,7 +10,7 @@ use Auth\Ldap;
* @package api
* @author Frederic Guillot
*/
class User extends \Core\Base
class User extends \Kanboard\Core\Base
{
public function getUser($user_id)
{
@ -39,7 +39,7 @@ class User extends \Core\Base
'is_project_admin' => $is_project_admin,
);
list($valid,) = $this->user->validateCreation($values);
list($valid, ) = $this->user->validateCreation($values);
return $valid ? $this->user->create($values) : false;
}
@ -81,7 +81,7 @@ class User extends \Core\Base
}
}
list($valid,) = $this->user->validateApiModification($values);
list($valid, ) = $this->user->validateApiModification($values);
return $valid && $this->user->update($values);
}
}

View file

@ -1,34 +0,0 @@
<?php
namespace Auth;
use Pimple\Container;
/**
* Base auth class
*
* @package auth
* @author Frederic Guillot
*/
abstract class Base extends \Core\Base
{
/**
* Database instance
*
* @access protected
* @var \PicoDb\Database
*/
protected $db;
/**
* Constructor
*
* @access public
* @param \Pimple\Container $container
*/
public function __construct(Container $container)
{
$this->container = $container;
$this->db = $this->container['db'];
}
}

View file

@ -1,9 +1,10 @@
<?php
namespace Auth;
namespace Kanboard\Auth;
use Model\User;
use Event\AuthEvent;
use Kanboard\Core\Base;
use Kanboard\Model\User;
use Kanboard\Event\AuthEvent;
/**
* Database authentication

View file

@ -1,8 +1,9 @@
<?php
namespace Auth;
namespace Kanboard\Auth;
use Event\AuthEvent;
use Kanboard\Core\Base;
use Kanboard\Event\AuthEvent;
/**
* Github backend
@ -22,7 +23,7 @@ class Github extends Base
* OAuth2 instance
*
* @access private
* @var \Core\OAuth2
* @var \Kanboard\Core\OAuth2
*/
private $service;
@ -85,7 +86,7 @@ class Github extends Base
* Get OAuth2 configured service
*
* @access public
* @return \Core\OAuth2
* @return Kanboard\Core\OAuth2
*/
public function getService()
{

View file

@ -1,8 +1,9 @@
<?php
namespace Auth;
namespace Kanboard\Auth;
use Event\AuthEvent;
use Kanboard\Core\Base;
use Kanboard\Event\AuthEvent;
/**
* Gitlab backend
@ -22,7 +23,7 @@ class Gitlab extends Base
* OAuth2 instance
*
* @access private
* @var \Core\OAuth2
* @var \Kanboard\Core\OAuth2
*/
private $service;
@ -85,7 +86,7 @@ class Gitlab extends Base
* Get OAuth2 configured service
*
* @access public
* @return \Core\OAuth2
* @return Kanboard\Core\OAuth2
*/
public function getService()
{

View file

@ -1,8 +1,9 @@
<?php
namespace Auth;
namespace Kanboard\Auth;
use Event\AuthEvent;
use Kanboard\Core\Base;
use Kanboard\Event\AuthEvent;
/**
* Google backend
@ -23,7 +24,7 @@ class Google extends Base
* OAuth2 instance
*
* @access private
* @var \Core\OAuth2
* @var \Kanboard\Core\OAuth2
*/
private $service;
@ -86,7 +87,7 @@ class Google extends Base
* Get OAuth2 configured service
*
* @access public
* @return \Core\OAuth2
* @return KanboardCore\OAuth2
*/
public function getService()
{

View file

@ -1,8 +1,9 @@
<?php
namespace Auth;
namespace Kanboard\Auth;
use Event\AuthEvent;
use Kanboard\Core\Base;
use Kanboard\Event\AuthEvent;
/**
* LDAP model
@ -217,7 +218,6 @@ class Ldap extends Base
$result = $this->findUser($username, $password);
if (is_array($result)) {
$user = $this->user->getByUsername($username);
if (! empty($user)) {
@ -226,14 +226,12 @@ class Ldap extends Base
if ($user['is_ldap_user'] == 0) {
return false;
}
}
else {
} else {
// We create automatically a new user
if ($this->isLdapAccountCreationEnabled() && $this->user->create($result) !== false) {
$user = $this->user->getByUsername($username);
}
else {
} else {
return false;
}
}
@ -319,12 +317,10 @@ class Ldap extends Base
if ($this->getLdapBindType() === 'user') {
$ldap_username = sprintf($this->getLdapUsername(), $username);
$ldap_password = $password;
}
else if ($this->getLdapBindType() === 'proxy') {
} elseif ($this->getLdapBindType() === 'proxy') {
$ldap_username = $this->getLdapUsername();
$ldap_password = $this->getLdapPassword();
}
else {
} else {
$ldap_username = null;
$ldap_password = null;
}
@ -486,11 +482,9 @@ class Ldap extends Base
{
if (! empty($username) && ! empty($email)) {
return '(&('.$this->getLdapUserPattern($username).')('.$this->getLdapAccountEmail().'='.$email.'))';
}
else if (! empty($username)) {
} elseif (! empty($username)) {
return $this->getLdapUserPattern($username);
}
else if (! empty($email)) {
} elseif (! empty($email)) {
return '('.$this->getLdapAccountEmail().'='.$email.')';
}
@ -508,7 +502,7 @@ class Ldap extends Base
*/
private function getEntry(array $entries, $key, $default = '')
{
return isset($entries[0][$key][0]) ? $entries[0][$key][0] : $default;
return isset($entries[0][$key][0]) ? $entries[0][$key][0] : $default;
}
/**
@ -522,6 +516,6 @@ class Ldap extends Base
*/
private function getEntries(array $entries, $key, $default = array())
{
return isset($entries[0][$key]) ? $entries[0][$key] : $default;
return isset($entries[0][$key]) ? $entries[0][$key] : $default;
}
}

View file

@ -1,10 +1,11 @@
<?php
namespace Auth;
namespace Kanboard\Auth;
use Core\Request;
use Event\AuthEvent;
use Core\Security;
use Kanboard\Core\Base;
use Kanboard\Core\Request;
use Kanboard\Event\AuthEvent;
use Kanboard\Core\Security;
/**
* RememberMe model
@ -88,7 +89,6 @@ class RememberMe extends Base
$credentials = $this->readCookie();
if ($credentials !== false) {
$record = $this->find($credentials['token'], $credentials['sequence']);
if ($record) {
@ -144,7 +144,6 @@ class RememberMe extends Base
$credentials = $this->readCookie();
if ($credentials !== false) {
$this->deleteCookie();
$this->db

View file

@ -1,8 +1,9 @@
<?php
namespace Auth;
namespace Kanboard\Auth;
use Event\AuthEvent;
use Kanboard\Core\Base;
use Kanboard\Event\AuthEvent;
/**
* ReverseProxy backend
@ -19,6 +20,17 @@ class ReverseProxy extends Base
*/
const AUTH_NAME = 'ReverseProxy';
/**
* Get username from the reverse proxy
*
* @access public
* @return string
*/
public function getUsername()
{
return isset($_SERVER[REVERSE_PROXY_USER_HEADER]) ? $_SERVER[REVERSE_PROXY_USER_HEADER] : '';
}
/**
* Authenticate the user with the HTTP header
*

View file

@ -1,6 +1,6 @@
<?php
namespace Console;
namespace Kanboard\Console;
use Pimple\Container;
use Symfony\Component\Console\Command\Command;
@ -11,17 +11,18 @@ use Symfony\Component\Console\Command\Command;
* @package console
* @author Frederic Guillot
*
* @property \Model\Notification $notification
* @property \Model\Project $project
* @property \Model\ProjectPermission $projectPermission
* @property \Model\ProjectAnalytic $projectAnalytic
* @property \Model\ProjectDailyColumnStats $projectDailyColumnStats
* @property \Model\ProjectDailyStats $projectDailyStats
* @property \Model\SubtaskExport $subtaskExport
* @property \Model\Task $task
* @property \Model\TaskExport $taskExport
* @property \Model\TaskFinder $taskFinder
* @property \Model\Transition $transition
* @property \Kanboard\Model\Notification $notification
* @property \Kanboard\Model\Project $project
* @property \Kanboard\Model\ProjectPermission $projectPermission
* @property \Kanboard\Model\ProjectAnalytic $projectAnalytic
* @property \Kanboard\Model\ProjectDailyColumnStats $projectDailyColumnStats
* @property \Kanboard\Model\ProjectDailyStats $projectDailyStats
* @property \Kanboard\Model\SubtaskExport $subtaskExport
* @property \Kanboard\Model\OverdueNotification $overdueNotification
* @property \Kanboard\Model\Task $task
* @property \Kanboard\Model\TaskExport $taskExport
* @property \Kanboard\Model\TaskFinder $taskFinder
* @property \Kanboard\Model\Transition $transition
*/
abstract class Base extends Command
{

View file

@ -1,6 +1,6 @@
<?php
namespace Console;
namespace Kanboard\Console;
use RecursiveIteratorIterator;
use RecursiveDirectoryIterator;
@ -25,7 +25,6 @@ class LocaleComparator extends Base
$it->rewind();
while ($it->valid()) {
if (! $it->isDot() && substr($it->key(), -4) === '.php') {
$strings = array_merge($strings, $this->search($it->key()));
}
@ -72,7 +71,7 @@ class LocaleComparator extends Base
$strings = array_merge($strings, $matches[1]);
}
array_walk($strings, function(&$value) {
array_walk($strings, function (&$value) {
$value = trim($value, "'");
$value = str_replace("\'", "'", $value);
});

View file

@ -1,6 +1,6 @@
<?php
namespace Console;
namespace Kanboard\Console;
use DirectoryIterator;
use Symfony\Component\Console\Input\InputInterface;
@ -23,9 +23,7 @@ class LocaleSync extends Base
$reference = include $reference_file;
foreach (new DirectoryIterator('app/Locale') as $fileInfo) {
if (! $fileInfo->isDot() && $fileInfo->isDir() && $fileInfo->getFilename() !== self::REF_LOCALE) {
$filename = 'app/Locale/'.$fileInfo->getFilename().'/translations.php';
echo $fileInfo->getFilename().' ('.$filename.')'.PHP_EOL;
@ -42,11 +40,9 @@ class LocaleSync extends Base
$output .= 'return array('.PHP_EOL;
foreach ($reference as $key => $value) {
if (! empty($outdated[$key])) {
$output .= " '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $outdated[$key])."',\n";
}
else {
} else {
$output .= " // '".str_replace("'", "\'", $key)."' => '',\n";
}
}

View file

@ -1,8 +1,8 @@
<?php
namespace Console;
namespace Kanboard\Console;
use Core\Tool;
use Kanboard\Core\Csv;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@ -28,7 +28,7 @@ class ProjectDailyColumnStatsExport extends Base
);
if (is_array($data)) {
Tool::csv($data);
Csv::output($data);
}
}
}

View file

@ -1,8 +1,8 @@
<?php
namespace Console;
namespace Kanboard\Console;
use Model\Project;
use Kanboard\Model\Project;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

View file

@ -1,8 +1,8 @@
<?php
namespace Console;
namespace Kanboard\Console;
use Core\Tool;
use Kanboard\Core\Csv;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@ -28,7 +28,7 @@ class SubtaskExport extends Base
);
if (is_array($data)) {
Tool::csv($data);
Csv::output($data);
}
}
}

View file

@ -1,8 +1,8 @@
<?php
namespace Console;
namespace Kanboard\Console;
use Core\Tool;
use Kanboard\Core\Csv;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@ -28,7 +28,7 @@ class TaskExport extends Base
);
if (is_array($data)) {
Tool::csv($data);
Csv::output($data);
}
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Console;
namespace Kanboard\Console;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;

View file

@ -1,8 +1,8 @@
<?php
namespace Console;
namespace Kanboard\Console;
use Core\Tool;
use Kanboard\Core\Csv;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@ -28,7 +28,7 @@ class TransitionExport extends Base
);
if (is_array($data)) {
Tool::csv($data);
Csv::output($data);
}
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Automatic actions management
@ -115,14 +115,12 @@ class Action extends Base
*/
private function doCreation(array $project, array $values)
{
list($valid,) = $this->action->validateCreation($values);
list($valid, ) = $this->action->validateCreation($values);
if ($valid) {
if ($this->action->create($values) !== false) {
$this->session->flash(t('Your automatic action have been created successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to create your automatic action.'));
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Activity stream

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Project Analytic controller

View file

@ -1,8 +1,8 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Model\Subtask as SubtaskModel;
use Kanboard\Model\Subtask as SubtaskModel;
/**
* Application controller
@ -198,7 +198,7 @@ class App extends Base
$this->response->html($this->layout('app/notifications', array(
'title' => t('My notifications'),
'notifications' => $this->webNotification->getAll($user['id']),
'notifications' => $this->userUnreadNotification->getAll($user['id']),
'user' => $user,
)));
}
@ -227,17 +227,21 @@ class App extends Base
public function autocomplete()
{
$search = $this->request->getStringParam('term');
$projects = $this->projectPermission->getActiveMemberProjectIds($this->userSession->getId());
if (empty($projects)) {
$this->response->json(array());
}
$filter = $this->taskFilterAutoCompleteFormatter
->create()
->filterByProjects($this->projectPermission->getActiveMemberProjectIds($this->userSession->getId()))
->filterByProjects($projects)
->excludeTasks(array($this->request->getIntegerParam('exclude_task_id')));
// Search by task id or by title
if (ctype_digit($search)) {
$filter->filterById($search);
}
else {
} else {
$filter->filterByTitle($search);
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Gregwar\Captcha\CaptchaBuilder;
@ -43,7 +43,6 @@ class Auth extends Base
list($valid, $errors) = $this->authentication->validateForm($values);
if ($valid) {
if (! empty($this->session['login_redirect']) && ! filter_var($this->session['login_redirect'], FILTER_VALIDATE_URL)) {
$redirect = $this->session['login_redirect'];
unset($this->session['login_redirect']);

View file

@ -1,14 +1,11 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Pimple\Container;
use Core\Security;
use Core\Request;
use Core\Response;
use Core\Template;
use Core\Session;
use Model\LastLogin;
use Kanboard\Core\Security;
use Kanboard\Core\Request;
use Kanboard\Core\Response;
use Symfony\Component\EventDispatcher\Event;
/**
@ -17,13 +14,13 @@ use Symfony\Component\EventDispatcher\Event;
* @package controller
* @author Frederic Guillot
*/
abstract class Base extends \Core\Base
abstract class Base extends \Kanboard\Core\Base
{
/**
* Request instance
*
* @accesss protected
* @var \Core\Request
* @var \Kanboard\Core\Request
*/
protected $request;
@ -31,7 +28,7 @@ abstract class Base extends \Core\Base
* Response instance
*
* @accesss protected
* @var \Core\Response
* @var \Kanboard\Core\Response
*/
protected $response;
@ -60,7 +57,6 @@ abstract class Base extends \Core\Base
public function __destruct()
{
if (DEBUG) {
foreach ($this->container['db']->getLogMessages() as $message) {
$this->container['logger']->debug($message);
}
@ -123,7 +119,6 @@ abstract class Base extends \Core\Base
public function handleAuthentication()
{
if (! $this->authentication->isAuthenticated()) {
if ($this->request->isAjax()) {
$this->response->text('Not Authorized', 401);
}
@ -143,7 +138,6 @@ abstract class Base extends \Core\Base
$ignore = ($controller === 'twofactor' && in_array($action, array('code', 'check'))) || ($controller === 'auth' && $action === 'logout');
if ($ignore === false && $this->userSession->has2FA() && ! $this->userSession->check2FA()) {
if ($this->request->isAjax()) {
$this->response->text('Not Authorized', 401);
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Board controller
@ -195,7 +195,7 @@ class Board extends Base
$task = $this->getTask();
$this->response->html($this->template->render('board/tooltip_comments', array(
'comments' => $this->comment->getAll($task['id'])
'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting())
)));
}
@ -239,12 +239,11 @@ class Board extends Base
{
$values = $this->request->getValues();
list($valid,) = $this->taskValidator->validateAssigneeModification($values);
list($valid, ) = $this->taskValidator->validateAssigneeModification($values);
if ($valid && $this->taskModification->update($values)) {
$this->session->flash(t('Task updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update your task.'));
}
@ -277,12 +276,11 @@ class Board extends Base
{
$values = $this->request->getValues();
list($valid,) = $this->taskValidator->validateCategoryModification($values);
list($valid, ) = $this->taskValidator->validateCategoryModification($values);
if ($valid && $this->taskModification->update($values)) {
$this->session->flash(t('Task updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update your task.'));
}
@ -365,8 +363,7 @@ class Board extends Base
if ($this->request->isAjax()) {
$this->response->html($this->renderBoard($project_id));
}
else {
} else {
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project_id)));
}
}

View file

@ -1,8 +1,8 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Model\Task as TaskModel;
use Kanboard\Model\Task as TaskModel;
/**
* Project Calendar controller
@ -44,8 +44,7 @@ class Calendar extends Base
// Tasks
if ($this->config->get('calendar_project_tasks', 'date_started') === 'date_creation') {
$events = $filter->copy()->filterByCreationDateRange($start, $end)->setColumns('date_creation', 'date_completed')->format();
}
else {
} else {
$events = $filter->copy()->filterByStartDateRange($start, $end)->setColumns('date_started', 'date_completed')->format();
}
@ -79,8 +78,7 @@ class Calendar extends Base
// Tasks
if ($this->config->get('calendar_user_tasks', 'date_started') === 'date_creation') {
$events = array_merge($events, $filter->copy()->filterByCreationDateRange($start, $end)->setColumns('date_creation', 'date_completed')->format());
}
else {
} else {
$events = array_merge($events, $filter->copy()->filterByStartDateRange($start, $end)->setColumns('date_started', 'date_completed')->format());
}
@ -106,7 +104,6 @@ class Calendar extends Base
public function save()
{
if ($this->request->isAjax() && $this->request->isPost()) {
$values = $this->request->getJson();
$this->taskModification->update(array(

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Category management
@ -60,12 +60,10 @@ class Category extends Base
list($valid, $errors) = $this->category->validateCreation($values);
if ($valid) {
if ($this->category->create($values)) {
$this->session->flash(t('Your category have been created successfully.'));
$this->response->redirect($this->helper->url->to('category', 'index', array('project_id' => $project['id'])));
}
else {
} else {
$this->session->flashError(t('Unable to create your category.'));
}
}
@ -104,12 +102,10 @@ class Category extends Base
list($valid, $errors) = $this->category->validateModification($values);
if ($valid) {
if ($this->category->update($values)) {
$this->session->flash(t('Your category have been updated successfully.'));
$this->response->redirect($this->helper->url->to('category', 'index', array('project_id' => $project['id'])));
}
else {
} else {
$this->session->flashError(t('Unable to update your category.'));
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Column controller
@ -54,12 +54,10 @@ class Column extends Base
list($valid, $errors) = $this->board->validateCreation($data);
if ($valid) {
if ($this->board->addColumn($project['id'], $data['title'], $data['task_limit'], $data['description'])) {
$this->session->flash(t('Board updated successfully.'));
$this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
}
else {
} else {
$this->session->flashError(t('Unable to update this board.'));
}
}
@ -99,12 +97,10 @@ class Column extends Base
list($valid, $errors) = $this->board->validateModification($values);
if ($valid) {
if ($this->board->updateColumn($values['id'], $values['title'], $values['task_limit'], $values['description'])) {
$this->session->flash(t('Board updated successfully.'));
$this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
}
else {
} else {
$this->session->flashError(t('Unable to update this board.'));
}
}
@ -160,8 +156,7 @@ class Column extends Base
if (! empty($column) && $this->board->removeColumn($column['id'])) {
$this->session->flash(t('Column removed successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to remove this column.'));
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Comment controller
@ -81,11 +81,9 @@ class Comment extends Base
list($valid, $errors) = $this->comment->validateCreation($values);
if ($valid) {
if ($this->comment->create($values)) {
$this->session->flash(t('Comment added successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to create your comment.'));
}
@ -132,11 +130,9 @@ class Comment extends Base
list($valid, $errors) = $this->comment->validateModification($values);
if ($valid) {
if ($this->comment->update($values)) {
$this->session->flash(t('Comment updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update your comment.'));
}
@ -176,11 +172,25 @@ class Comment extends Base
if ($this->comment->remove($comment['id'])) {
$this->session->flash(t('Comment removed successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to remove this comment.'));
}
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'));
}
/**
* Toggle comment sorting
*
* @access public
*/
public function toggleSorting()
{
$task = $this->getTask();
$order = $this->userSession->getCommentSorting() === 'ASC' ? 'DESC' : 'ASC';
$this->userSession->setCommentSorting($order);
$this->response->redirect($this->helper->url->href('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'comments'));
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Config controller
@ -37,7 +37,6 @@ class Config extends Base
private function common($redirect)
{
if ($this->request->isPost()) {
$values = $this->request->getValues();
switch ($redirect) {
@ -45,7 +44,7 @@ class Config extends Base
$values += array('subtask_restriction' => 0, 'subtask_time_tracking' => 0, 'cfd_include_closed_tasks' => 0);
break;
case 'integrations':
$values += array('integration_slack_webhook' => 0, 'integration_hipchat' => 0, 'integration_gravatar' => 0, 'integration_jabber' => 0);
$values += array('integration_gravatar' => 0);
break;
case 'calendar':
$values += array('calendar_user_subtasks_time_tracking' => 0);
@ -55,8 +54,7 @@ class Config extends Base
if ($this->config->save($values)) {
$this->config->reload();
$this->session->flash(t('Settings saved successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to save your settings.'));
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Currency controller
@ -54,12 +54,10 @@ class Currency extends Base
list($valid, $errors) = $this->currency->validate($values);
if ($valid) {
if ($this->currency->create($values['currency'], $values['rate'])) {
$this->session->flash(t('The currency rate have been added successfully.'));
$this->response->redirect($this->helper->url->to('currency', 'index'));
}
else {
} else {
$this->session->flashError(t('Unable to add this currency rate.'));
}
}
@ -79,8 +77,7 @@ class Currency extends Base
if ($this->config->save($values)) {
$this->config->reload();
$this->session->flash(t('Settings saved successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to save your settings.'));
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Custom Filter management
@ -46,8 +46,7 @@ class Customfilter extends Base
if ($this->customFilter->create($values)) {
$this->session->flash(t('Your custom filter have been created successfully.'));
$this->response->redirect($this->helper->url->to('customfilter', 'index', array('project_id' => $project['id'])));
}
else {
} else {
$this->session->flashError(t('Unable to create your custom filter.'));
}
}
@ -116,14 +115,17 @@ class Customfilter extends Base
$values += array('is_shared' => 0);
}
if (! isset($values['append'])) {
$values += array('append' => 0);
}
list($valid, $errors) = $this->customFilter->validateModification($values);
if ($valid) {
if ($this->customFilter->update($values)) {
$this->session->flash(t('Your custom filter have been updated successfully.'));
$this->response->redirect($this->helper->url->to('customfilter', 'index', array('project_id' => $project['id'])));
}
else {
} else {
$this->session->flashError(t('Unable to update custom filter.'));
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Parsedown;
@ -16,7 +16,7 @@ class Doc extends Base
{
$url = $this->helper->url;
$data = file_get_contents($filename);
list($title,) = explode("\n", $data, 2);
list($title, ) = explode("\n", $data, 2);
$replaceUrl = function (array $matches) use ($url) {
return '('.$url->to('doc', 'show', array('file' => str_replace('.markdown', '', $matches[1]))).')';

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Export controller

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Atom/RSS Feed controller

View file

@ -1,8 +1,8 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Core\ObjectStorage\ObjectStorageException;
use Kanboard\Core\ObjectStorage\ObjectStorageException;
/**
* File controller
@ -22,7 +22,6 @@ class File extends Base
$task = $this->getTask();
if ($this->request->isPost() && $this->file->uploadScreenshot($task['project_id'], $task['id'], $this->request->getValue('screenshot')) !== false) {
$this->session->flash(t('Screenshot uploaded successfully.'));
if ($this->request->getStringParam('redirect') === 'board') {
@ -77,7 +76,6 @@ class File extends Base
public function download()
{
try {
$task = $this->getTask();
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
@ -87,8 +85,7 @@ class File extends Base
$this->response->forceDownload($file['name']);
$this->objectStorage->output($file['path']);
}
catch (ObjectStorageException $e) {
} catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
}
}
@ -112,50 +109,48 @@ class File extends Base
}
/**
* Return the file content (work only for images)
* Display image
*
* @access public
*/
public function image()
{
try {
$task = $this->getTask();
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] != $task['id']) {
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
if ($file['task_id'] == $task['id']) {
$this->response->contentType($this->file->getImageMimeType($file['name']));
$this->objectStorage->output($file['path']);
}
$this->response->contentType($this->file->getImageMimeType($file['name']));
$this->objectStorage->output($file['path']);
}
catch (ObjectStorageException $e) {
} catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
}
}
/**
* Return image thumbnails
* Display image thumbnails
*
* @access public
*/
public function thumbnail()
{
try {
$this->response->contentType('image/jpeg');
try {
$task = $this->getTask();
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] != $task['id']) {
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
if ($file['task_id'] == $task['id']) {
$this->objectStorage->output($this->file->getThumbnailPath($file['path']));
}
$this->response->contentType('image/jpeg');
$this->objectStorage->output($this->file->getThumbnailPath($file['path']));
}
catch (ObjectStorageException $e) {
} catch (ObjectStorageException $e) {
$this->logger->error($e->getMessage());
// Try to generate thumbnail on the fly for images uploaded before Kanboard < 1.0.19
$data = $this->objectStorage->get($file['path']);
$this->file->generateThumbnailFromData($file['path'], $data);
$this->objectStorage->output($this->file->getThumbnailPath($file['path']));
}
}

View file

@ -1,8 +1,8 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Model\Task as TaskModel;
use Kanboard\Model\Task as TaskModel;
/**
* Gantt controller
@ -19,8 +19,7 @@ class Gantt extends Base
{
if ($this->userSession->isAdmin()) {
$project_ids = $this->project->getAllIds();
}
else {
} else {
$project_ids = $this->projectPermission->getMemberProjectIds($this->userSession->getId());
}
@ -62,8 +61,7 @@ class Gantt extends Base
if ($sorting === 'date') {
$filter->getQuery()->asc(TaskModel::TABLE.'.date_started')->asc(TaskModel::TABLE.'.date_creation');
}
else {
} else {
$filter->getQuery()->asc('column_position')->asc(TaskModel::TABLE.'.position');
}
@ -134,14 +132,12 @@ class Gantt extends Base
list($valid, $errors) = $this->taskValidator->validateCreation($values);
if ($valid) {
$task_id = $this->taskCreation->create($values);
if ($task_id !== false) {
$this->session->flash(t('Task created successfully.'));
$this->response->redirect($this->helper->url->to('gantt', 'project', array('project_id' => $project['id'])));
}
else {
} else {
$this->session->flashError(t('Unable to create your task.'));
}
}

View file

@ -1,8 +1,8 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Model\TaskFilter;
use Kanboard\Model\TaskFilter;
use Eluceo\iCal\Component\Calendar as iCalendar;
/**
@ -89,8 +89,7 @@ class Ical extends Base
->setColumns('date_creation', 'date_completed')
->setCalendar($calendar)
->addDateTimeEvents();
}
else {
} else {
$filter
->copy()
->filterByStartDateRange($start, $end)

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Link controller
@ -70,12 +70,10 @@ class Link extends Base
list($valid, $errors) = $this->link->validateCreation($values);
if ($valid) {
if ($this->link->create($values['label'], $values['opposite_label']) !== false) {
$this->session->flash(t('Link added successfully.'));
$this->response->redirect($this->helper->url->to('link', 'index'));
}
else {
} else {
$this->session->flashError(t('Unable to create your link.'));
}
}
@ -116,8 +114,7 @@ class Link extends Base
if ($this->link->update($values)) {
$this->session->flash(t('Link updated successfully.'));
$this->response->redirect($this->helper->url->to('link', 'index'));
}
else {
} else {
$this->session->flashError(t('Unable to update your link.'));
}
}
@ -152,8 +149,7 @@ class Link extends Base
if ($this->link->remove($link['id'])) {
$this->session->flash(t('Link removed successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to remove this link.'));
}

View file

@ -1,8 +1,8 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Model\Task as TaskModel;
use Kanboard\Model\Task as TaskModel;
/**
* List view controller

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* OAuth controller
@ -52,8 +52,7 @@ class Oauth extends Base
if ($this->authentication->backend($backend)->unlink($this->userSession->getId())) {
$this->session->flash(t('Your external account is not linked anymore to your profile.'));
}
else {
} else {
$this->session->flashError(t('Unable to unlink your external account.'));
}
@ -71,8 +70,7 @@ class Oauth extends Base
if (! empty($code)) {
$this->step2($backend, $code);
}
else {
} else {
$this->response->redirect($this->authentication->backend($backend)->getService()->getAuthorizationUrl());
}
}
@ -102,8 +100,7 @@ class Oauth extends Base
{
if (empty($profile)) {
$this->session->flashError(t('External authentication failed'));
}
else {
} else {
$this->session->flash(t('Your external account is linked to your profile successfully.'));
$this->authentication->backend($backend)->updateUser($this->userSession->getId(), $profile);
}
@ -120,8 +117,7 @@ class Oauth extends Base
{
if (! empty($profile) && $this->authentication->backend($backend)->authenticate($profile['id'])) {
$this->response->redirect($this->helper->url->to('app', 'index'));
}
else {
} else {
$this->response->html($this->template->layout('auth/index', array(
'errors' => array('login' => t('External authentication failed')),
'values' => array(),

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Project controller (Settings + creation/edition)
@ -19,8 +19,7 @@ class Project extends Base
{
if ($this->userSession->isAdmin()) {
$project_ids = $this->project->getAllIds();
}
else {
} else {
$project_ids = $this->projectPermission->getMemberProjectIds($this->userSession->getId());
}
@ -68,13 +67,11 @@ class Project extends Base
$switch = $this->request->getStringParam('switch');
if ($switch === 'enable' || $switch === 'disable') {
$this->checkCSRFParam();
if ($this->project->{$switch.'PublicAccess'}($project['id'])) {
$this->session->flash(t('Project updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update this project.'));
}
@ -92,28 +89,49 @@ class Project extends Base
*
* @access public
*/
public function integration()
public function integrations()
{
$project = $this->getProject();
if ($this->request->isPost()) {
$params = $this->request->getValues();
$params += array('hipchat' => 0, 'slack' => 0, 'jabber' => 0);
$this->projectIntegration->saveParameters($project['id'], $params);
$this->projectMetadata->save($project['id'], $this->request->getValues());
$this->session->flash(t('Project updated successfully.'));
$this->response->redirect($this->helper->url->to('project', 'integrations', array('project_id' => $project['id'])));
}
$values = $this->projectIntegration->getParameters($project['id']);
$values += array('hipchat_api_url' => 'https://api.hipchat.com');
$this->response->html($this->projectLayout('project/integrations', array(
'project' => $project,
'title' => t('Integrations'),
'webhook_token' => $this->config->get('webhook_token'),
'values' => $values,
'values' => $this->projectMetadata->getAll($project['id']),
'errors' => array(),
)));
}
/**
* Display project notifications
*
* @access public
*/
public function notifications()
{
$project = $this->getProject();
if ($this->request->isPost()) {
$values = $this->request->getValues();
$this->projectNotification->saveSettings($project['id'], $values);
$this->session->flash(t('Project updated successfully.'));
$this->response->redirect($this->helper->url->to('project', 'notifications', array('project_id' => $project['id'])));
}
$this->response->html($this->projectLayout('project/notifications', array(
'notifications' => $this->projectNotification->readSettings($project['id']),
'types' => $this->projectNotificationType->getTypes(),
'project' => $project,
'title' => t('Notifications'),
)));
}
/**
* Display a form to edit a project
*
@ -145,8 +163,7 @@ class Project extends Base
if (! $this->helper->user->isProjectAdministrationAllowed($project['id'])) {
unset($values['is_private']);
}
}
else if ($project['is_private'] == 1 && ! isset($values['is_private'])) {
} elseif ($project['is_private'] == 1 && ! isset($values['is_private'])) {
if ($this->helper->user->isProjectAdministrationAllowed($project['id'])) {
$values += array('is_private' => 0);
}
@ -155,12 +172,10 @@ class Project extends Base
list($valid, $errors) = $this->project->validateModification($values);
if ($valid) {
if ($this->project->update($values)) {
$this->session->flash(t('Project updated successfully.'));
$this->response->redirect($this->helper->url->to('project', 'edit', array('project_id' => $project['id'])));
}
else {
} else {
$this->session->flashError(t('Unable to update this project.'));
}
}
@ -193,14 +208,12 @@ class Project extends Base
{
$project = $this->getProject();
$values = $this->request->getValues() + array('is_everybody_allowed' => 0);
list($valid,) = $this->projectPermission->validateProjectModification($values);
list($valid, ) = $this->projectPermission->validateProjectModification($values);
if ($valid) {
if ($this->project->update($values)) {
$this->session->flash(t('Project updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update this project.'));
}
}
@ -216,14 +229,12 @@ class Project extends Base
public function allow()
{
$values = $this->request->getValues();
list($valid,) = $this->projectPermission->validateUserModification($values);
list($valid, ) = $this->projectPermission->validateUserModification($values);
if ($valid) {
if ($this->projectPermission->addMember($values['project_id'], $values['user_id'])) {
$this->session->flash(t('Project updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update this project.'));
}
}
@ -246,14 +257,12 @@ class Project extends Base
'is_owner' => $this->request->getIntegerParam('is_owner'),
);
list($valid,) = $this->projectPermission->validateUserModification($values);
list($valid, ) = $this->projectPermission->validateUserModification($values);
if ($valid) {
if ($this->projectPermission->changeRole($values['project_id'], $values['user_id'], $values['is_owner'])) {
$this->session->flash(t('Project updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update this project.'));
}
}
@ -275,14 +284,12 @@ class Project extends Base
'user_id' => $this->request->getIntegerParam('user_id'),
);
list($valid,) = $this->projectPermission->validateUserModification($values);
list($valid, ) = $this->projectPermission->validateUserModification($values);
if ($valid) {
if ($this->projectPermission->revokeMember($values['project_id'], $values['user_id'])) {
$this->session->flash(t('Project updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update this project.'));
}
}
@ -300,7 +307,6 @@ class Project extends Base
$project = $this->getProject();
if ($this->request->getStringParam('remove') === 'yes') {
$this->checkCSRFParam();
if ($this->project->remove($project['id'])) {
@ -356,7 +362,6 @@ class Project extends Base
$project = $this->getProject();
if ($this->request->getStringParam('disable') === 'yes') {
$this->checkCSRFParam();
if ($this->project->disable($project['id'])) {
@ -384,7 +389,6 @@ class Project extends Base
$project = $this->getProject();
if ($this->request->getStringParam('enable') === 'yes') {
$this->checkCSRFParam();
if ($this->project->enable($project['id'])) {
@ -431,7 +435,6 @@ class Project extends Base
list($valid, $errors) = $this->project->validateCreation($values);
if ($valid) {
$project_id = $this->project->create($values, $this->userSession->getId(), true);
if ($project_id > 0) {

View file

@ -1,9 +1,9 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Model\User as UserModel;
use Model\Task as TaskModel;
use Kanboard\Model\User as UserModel;
use Kanboard\Model\Task as TaskModel;
/**
* Project User overview
@ -36,8 +36,7 @@ class Projectuser extends Base
if ($this->userSession->isAdmin()) {
$project_ids = $this->project->getAllIds();
}
else {
} else {
$project_ids = $this->projectPermission->getMemberProjectIds($this->userSession->getId());
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Search controller
@ -22,8 +22,7 @@ class Search extends Base
->setOrder('tasks.id')
->setDirection('DESC');
if ($search !== '') {
if ($search !== '' && ! empty($projects)) {
$query = $this
->taskFilter
->search($search)

View file

@ -1,8 +1,8 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Model\Subtask as SubtaskModel;
use Kanboard\Model\Subtask as SubtaskModel;
/**
* Subtask controller
@ -66,11 +66,9 @@ class Subtask extends Base
list($valid, $errors) = $this->subtask->validateCreation($values);
if ($valid) {
if ($this->subtask->create($values)) {
$this->session->flash(t('Sub-task added successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to create your sub-task.'));
}
@ -118,11 +116,9 @@ class Subtask extends Base
list($valid, $errors) = $this->subtask->validateModification($values);
if ($valid) {
if ($this->subtask->update($values)) {
$this->session->flash(t('Sub-task updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update your sub-task.'));
}
@ -161,8 +157,7 @@ class Subtask extends Base
if ($this->subtask->remove($subtask['id'])) {
$this->session->flash(t('Sub-task removed successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to remove this sub-task.'));
}
@ -183,7 +178,6 @@ class Subtask extends Base
$this->subtask->toggleStatus($subtask['id']);
if ($redirect === 'board') {
$this->session['has_subtask_inprogress'] = $this->subtask->hasSubtaskInProgress($this->userSession->getId());
$this->response->html($this->template->render('board/tooltip_subtasks', array(

View file

@ -1,8 +1,8 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Model\Swimlane as SwimlaneModel;
use Kanboard\Model\Swimlane as SwimlaneModel;
/**
* Swimlanes
@ -63,12 +63,10 @@ class Swimlane extends Base
list($valid, $errors) = $this->swimlane->validateCreation($values);
if ($valid) {
if ($this->swimlane->create($values)) {
$this->session->flash(t('Your swimlane have been created successfully.'));
$this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
}
else {
} else {
$this->session->flashError(t('Unable to create your swimlane.'));
}
}
@ -86,15 +84,13 @@ class Swimlane extends Base
$project = $this->getProject();
$values = $this->request->getValues() + array('show_default_swimlane' => 0);
list($valid,) = $this->swimlane->validateDefaultModification($values);
list($valid, ) = $this->swimlane->validateDefaultModification($values);
if ($valid) {
if ($this->swimlane->updateDefault($values)) {
$this->session->flash(t('The default swimlane have been updated successfully.'));
$this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
}
else {
} else {
$this->session->flashError(t('Unable to update this swimlane.'));
}
}
@ -136,8 +132,7 @@ class Swimlane extends Base
if ($this->swimlane->update($values)) {
$this->session->flash(t('Swimlane updated successfully.'));
$this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
}
else {
} else {
$this->session->flashError(t('Unable to update this swimlane.'));
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Task controller
@ -68,7 +68,7 @@ class Task extends Base
'project' => $this->project->getById($task['project_id']),
'files' => $this->file->getAllDocuments($task['id']),
'images' => $this->file->getAllImages($task['id']),
'comments' => $this->comment->getAll($task['id']),
'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting()),
'subtasks' => $subtasks,
'links' => $this->taskLink->getAllGroupedByLabel($task['id']),
'task' => $task,
@ -156,7 +156,6 @@ class Task extends Base
}
if ($this->request->getStringParam('confirmation') === 'yes') {
$this->checkCSRFParam();
if ($this->task->remove($task['id'])) {

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Task Creation controller
@ -22,7 +22,6 @@ class Taskcreation extends Base
$swimlanes_list = $this->swimlane->getList($project['id'], false, true);
if (empty($values)) {
$values = array(
'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)),
'column_id' => $this->request->getIntegerParam('column_id'),
@ -62,8 +61,7 @@ class Taskcreation extends Base
if ($valid && $this->taskCreation->create($values)) {
$this->session->flash(t('Task created successfully.'));
$this->afterSave($project, $values);
}
else {
} else {
$this->session->flashError(t('Unable to create your task.'));
}
@ -79,8 +77,7 @@ class Taskcreation extends Base
if (! $this->request->isAjax()) {
$this->response->redirect($this->helper->url->to('taskcreation', 'create', $values));
}
}
else {
} else {
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id'])));
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Task Duplication controller
@ -20,7 +20,6 @@ class Taskduplication extends Base
$task = $this->getTask();
if ($this->request->getStringParam('confirmation') === 'yes') {
$this->checkCSRFParam();
$task_id = $this->taskDuplication->duplicate($task['id']);
@ -48,9 +47,8 @@ class Taskduplication extends Base
$task = $this->getTask();
if ($this->request->isPost()) {
$values = $this->request->getValues();
list($valid,) = $this->taskValidator->validateProjectModification($values);
list($valid, ) = $this->taskValidator->validateProjectModification($values);
if ($valid && $this->taskDuplication->moveToProject($task['id'],
$values['project_id'],
@ -58,7 +56,6 @@ class Taskduplication extends Base
$values['column_id'],
$values['category_id'],
$values['owner_id'])) {
$this->session->flash(t('Task updated successfully.'));
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $values['project_id'], 'task_id' => $task['id'])));
}
@ -79,9 +76,8 @@ class Taskduplication extends Base
$task = $this->getTask();
if ($this->request->isPost()) {
$values = $this->request->getValues();
list($valid,) = $this->taskValidator->validateProjectModification($values);
list($valid, ) = $this->taskValidator->validateProjectModification($values);
if ($valid) {
$task_id = $this->taskDuplication->duplicateToProject(
@ -125,8 +121,7 @@ class Taskduplication extends Base
$values = $this->taskDuplication->checkDestinationProjectValues($task);
$values['project_id'] = $dst_project_id;
}
else {
} else {
$swimlanes_list = array();
$columns_list = array();
$categories_list = array();

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* TaskLink controller
@ -72,7 +72,6 @@ class Tasklink extends Base
list($valid, $errors) = $this->taskLink->validateCreation($values);
if ($valid) {
if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
$this->session->flash(t('Link added successfully.'));
@ -129,7 +128,6 @@ class Tasklink extends Base
list($valid, $errors) = $this->taskLink->validateModification($values);
if ($valid) {
if ($this->taskLink->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
$this->session->flash(t('Link updated successfully.'));
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links');
@ -162,15 +160,14 @@ class Tasklink extends Base
*
* @access public
*/
public function remove()
public function remove()
{
$this->checkCSRFParam();
$task = $this->getTask();
if ($this->taskLink->remove($this->request->getIntegerParam('link_id'))) {
$this->session->flash(t('Link removed successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to remove this link.'));
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Task Modification controller
@ -32,12 +32,11 @@ class Taskmodification extends Base
$task = $this->getTask();
$values = $this->request->getValues();
list($valid,) = $this->taskValidator->validateTimeModification($values);
list($valid, ) = $this->taskValidator->validateTimeModification($values);
if ($valid && $this->taskModification->update($values)) {
$this->session->flash(t('Task updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update your task.'));
}
@ -55,29 +54,24 @@ class Taskmodification extends Base
$ajax = $this->request->isAjax() || $this->request->getIntegerParam('ajax');
if ($this->request->isPost()) {
$values = $this->request->getValues();
list($valid, $errors) = $this->taskValidator->validateDescriptionCreation($values);
if ($valid) {
if ($this->taskModification->update($values)) {
$this->session->flash(t('Task updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update your task.'));
}
if ($ajax) {
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
}
else {
} else {
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])));
}
}
}
else {
} else {
$values = $task;
$errors = array();
}
@ -91,8 +85,7 @@ class Taskmodification extends Base
if ($ajax) {
$this->response->html($this->template->render('task_modification/edit_description', $params));
}
else {
} else {
$this->response->html($this->taskLayout('task_modification/edit_description', $params));
}
}
@ -127,8 +120,7 @@ class Taskmodification extends Base
if ($ajax) {
$html = $this->template->render('task_modification/edit_task', $params);
}
else {
} else {
$html = $this->taskLayout('task_modification/edit_task', $params);
}
@ -152,12 +144,10 @@ class Taskmodification extends Base
if ($this->request->isAjax()) {
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
}
else {
} else {
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])));
}
}
else {
} else {
$this->session->flashError(t('Unable to update your task.'));
$this->edit($values, $errors);
}
@ -173,24 +163,20 @@ class Taskmodification extends Base
$task = $this->getTask();
if ($this->request->isPost()) {
$values = $this->request->getValues();
list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values);
if ($valid) {
if ($this->taskModification->update($values)) {
$this->session->flash(t('Task updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update your task.'));
}
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])));
}
}
else {
} else {
$values = $task;
$errors = array();
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Task Status controller
@ -37,7 +37,6 @@ class Taskstatus extends Base
private function changeStatus(array $task, $method, $success_message, $failure_message)
{
if ($this->request->getStringParam('confirmation') === 'yes') {
$this->checkCSRFParam();
if ($this->taskStatus->$method($task['id'])) {

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Time Tracking controller
@ -24,8 +24,7 @@ class Timer extends Base
if ($timer === 'start') {
$this->subtaskTimeTracking->logStartTime($subtask_id, $this->userSession->getId());
}
else if ($timer === 'stop') {
} elseif ($timer === 'stop') {
$this->subtaskTimeTracking->logEndTime($subtask_id, $this->userSession->getId());
$this->subtaskTimeTracking->updateTaskTimeTracking($task_id);
}

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Otp\Otp;
use Otp\GoogleAuthenticator;
@ -63,8 +63,7 @@ class Twofactor extends User
'twofactor_activated' => 1,
'twofactor_secret' => GoogleAuthenticator::generateRandom(),
));
}
else {
} else {
$this->user->update(array(
'id' => $user['id'],
'twofactor_activated' => 0,
@ -94,8 +93,7 @@ class Twofactor extends User
if (! empty($values['code']) && $otp->checkTotp(Base32::decode($user['twofactor_secret']), $values['code'])) {
$this->session->flash(t('The two factor authentication code is valid.'));
}
else {
} else {
$this->session->flashError(t('The two factor authentication code is not valid.'));
}
@ -119,8 +117,7 @@ class Twofactor extends User
$this->session['2fa_validated'] = true;
$this->session->flash(t('The two factor authentication code is valid.'));
$this->response->redirect($this->helper->url->to('app', 'index'));
}
else {
} else {
$this->session->flashError(t('The two factor authentication code is not valid.'));
$this->response->redirect($this->helper->url->to('twofactor', 'code'));
}
@ -148,7 +145,6 @@ class Twofactor extends User
$user = $this->getUser();
if ($this->request->getStringParam('disable') === 'yes') {
$this->checkCSRFParam();
$this->user->update(array(

View file

@ -1,8 +1,8 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
use Model\NotificationType;
use Kanboard\Model\NotificationType;
/**
* User controller
@ -86,7 +86,6 @@ class User extends Base
list($valid, $errors) = $this->user->validateCreation($values);
if ($valid) {
$project_id = empty($values['project_id']) ? 0 : $values['project_id'];
unset($values['project_id']);
@ -96,13 +95,12 @@ class User extends Base
$this->projectPermission->addMember($project_id, $user_id);
if (! empty($values['notifications_enabled'])) {
$this->notificationType->saveUserSelectedTypes($user_id, array(NotificationType::TYPE_EMAIL));
$this->userNotificationType->saveSelectedTypes($user_id, array(NotificationType::TYPE_EMAIL));
}
$this->session->flash(t('User created successfully.'));
$this->response->redirect($this->helper->url->to('user', 'show', array('user_id' => $user_id)));
}
else {
} else {
$this->session->flashError(t('Unable to create your user.'));
$values['project_id'] = $project_id;
}
@ -201,20 +199,42 @@ class User extends Base
if ($this->request->isPost()) {
$values = $this->request->getValues();
$this->notification->saveSettings($user['id'], $values);
$this->userNotification->saveSettings($user['id'], $values);
$this->session->flash(t('User updated successfully.'));
$this->response->redirect($this->helper->url->to('user', 'notifications', array('user_id' => $user['id'])));
}
$this->response->html($this->layout('user/notifications', array(
'projects' => $this->projectPermission->getMemberProjects($user['id']),
'notifications' => $this->notification->readSettings($user['id']),
'types' => $this->notificationType->getTypes(),
'filters' => $this->notificationFilter->getFilters(),
'notifications' => $this->userNotification->readSettings($user['id']),
'types' => $this->userNotificationType->getTypes(),
'filters' => $this->userNotificationFilter->getFilters(),
'user' => $user,
)));
}
/**
* Display user integrations
*
* @access public
*/
public function integrations()
{
$user = $this->getUser();
if ($this->request->isPost()) {
$values = $this->request->getValues();
$this->userMetadata->save($user['id'], $values);
$this->session->flash(t('User updated successfully.'));
$this->response->redirect($this->helper->url->to('user', 'integrations', array('user_id' => $user['id'])));
}
$this->response->html($this->layout('user/integrations', array(
'user' => $user,
'values' => $this->userMetadata->getall($user['id']),
)));
}
/**
* Display external accounts
*
@ -240,7 +260,6 @@ class User extends Base
$switch = $this->request->getStringParam('switch');
if ($switch === 'enable' || $switch === 'disable') {
$this->checkCSRFParam();
if ($this->user->{$switch.'PublicAccess'}($user['id'])) {
@ -270,16 +289,13 @@ class User extends Base
$errors = array();
if ($this->request->isPost()) {
$values = $this->request->getValues();
list($valid, $errors) = $this->user->validatePasswordModification($values);
if ($valid) {
if ($this->user->update($values)) {
$this->session->flash(t('Password modified successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to change the password.'));
}
@ -308,13 +324,11 @@ class User extends Base
unset($values['password']);
if ($this->request->isPost()) {
$values = $this->request->getValues();
if ($this->userSession->isAdmin()) {
$values += array('is_admin' => 0, 'is_project_admin' => 0);
}
else {
} else {
// Regular users can't be admin
if (isset($values['is_admin'])) {
unset($values['is_admin']);
@ -328,11 +342,9 @@ class User extends Base
list($valid, $errors) = $this->user->validateModification($values);
if ($valid) {
if ($this->user->update($values)) {
$this->session->flash(t('User updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update your user.'));
}
@ -363,16 +375,13 @@ class User extends Base
unset($values['password']);
if ($this->request->isPost()) {
$values = $this->request->getValues() + array('disable_login_form' => 0, 'is_ldap_user' => 0);
list($valid, $errors) = $this->user->validateModification($values);
if ($valid) {
if ($this->user->update($values)) {
$this->session->flash(t('User updated successfully.'));
}
else {
} else {
$this->session->flashError(t('Unable to update your user.'));
}
@ -397,7 +406,6 @@ class User extends Base
$user = $this->getUser();
if ($this->request->getStringParam('confirmation') === 'yes') {
$this->checkCSRFParam();
if ($this->user->remove($user['id'])) {

View file

@ -1,6 +1,6 @@
<?php
namespace Controller;
namespace Kanboard\Controller;
/**
* Webhook controller
@ -31,7 +31,7 @@ class Webhook extends Base
'category_id' => $this->request->getIntegerParam('category_id'),
);
list($valid,) = $this->taskValidator->validateCreation($values);
list($valid, ) = $this->taskValidator->validateCreation($values);
if ($valid && $this->taskCreation->create($values)) {
$this->response->text('OK');
@ -92,37 +92,4 @@ class Webhook extends Base
echo $result ? 'PARSED' : 'IGNORED';
}
/**
* Handle Postmark webhooks
*
* @access public
*/
public function postmark()
{
$this->checkWebhookToken();
echo $this->postmark->receiveEmail($this->request->getJson()) ? 'PARSED' : 'IGNORED';
}
/**
* Handle Mailgun webhooks
*
* @access public
*/
public function mailgun()
{
$this->checkWebhookToken();
echo $this->mailgun->receiveEmail($_POST) ? 'PARSED' : 'IGNORED';
}
/**
* Handle Sendgrid webhooks
*
* @access public
*/
public function sendgrid()
{
$this->checkWebhookToken();
echo $this->sendgrid->receiveEmail($_POST) ? 'PARSED' : 'IGNORED';
}
}

View file

@ -1,39 +0,0 @@
<?php
namespace Controller;
/**
* Web notification controller
*
* @package controller
* @author Frederic Guillot
*/
class Webnotification extends Base
{
/**
* Mark all notifications as read
*
* @access public
*/
public function flush()
{
$user_id = $this->userSession->getId();
$this->webNotification->markAllAsRead($user_id);
$this->response->redirect($this->helper->url->to('app', 'notifications', array('user_id' => $user_id)));
}
/**
* Mark a notification as read
*
* @access public
*/
public function remove()
{
$user_id = $this->userSession->getId();
$notification_id = $this->request->getIntegerParam('notification_id');
$this->webNotification->markAsRead($user_id, $notification_id);
$this->response->redirect($this->helper->url->to('app', 'notifications', array('user_id' => $user_id)));
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Core;
namespace Kanboard\Core;
use Pimple\Container;
@ -10,86 +10,86 @@ use Pimple\Container;
* @package core
* @author Frederic Guillot
*
* @property \Core\Helper $helper
* @property \Core\EmailClient $emailClient
* @property \Core\HttpClient $httpClient
* @property \Core\Paginator $paginator
* @property \Core\Request $request
* @property \Core\Session $session
* @property \Core\Template $template
* @property \Core\OAuth2 $oauth
* @property \Core\Router $router
* @property \Core\Lexer $lexer
* @property \Core\ObjectStorage\ObjectStorageInterface $objectStorage
* @property \Core\Cache\Cache $memoryCache
* @property \Core\Plugin\Hook $hook
* @property \Core\Plugin\Loader $pluginLoader
* @property \Integration\BitbucketWebhook $bitbucketWebhook
* @property \Integration\GithubWebhook $githubWebhook
* @property \Integration\GitlabWebhook $gitlabWebhook
* @property \Integration\HipchatWebhook $hipchatWebhook
* @property \Integration\Jabber $jabber
* @property \Integration\Mailgun $mailgun
* @property \Integration\Postmark $postmark
* @property \Integration\Sendgrid $sendgrid
* @property \Integration\SlackWebhook $slackWebhook
* @property \Integration\Smtp $smtp
* @property \Formatter\ProjectGanttFormatter $projectGanttFormatter
* @property \Formatter\TaskFilterGanttFormatter $taskFilterGanttFormatter
* @property \Formatter\TaskFilterAutoCompleteFormatter $taskFilterAutoCompleteFormatter
* @property \Formatter\TaskFilterCalendarFormatter $taskFilterCalendarFormatter
* @property \Formatter\TaskFilterICalendarFormatter $taskFilterICalendarFormatter
* @property \Model\Acl $acl
* @property \Model\Action $action
* @property \Model\Authentication $authentication
* @property \Model\Board $board
* @property \Model\Category $category
* @property \Model\Color $color
* @property \Model\Comment $comment
* @property \Model\Config $config
* @property \Model\Currency $currency
* @property \Model\CustomFilter $customFilter
* @property \Model\DateParser $dateParser
* @property \Model\File $file
* @property \Model\LastLogin $lastLogin
* @property \Model\Link $link
* @property \Model\Notification $notification
* @property \Model\NotificationType $notificationType
* @property \Model\NotificationFilter $notificationFilter
* @property \Model\OverdueNotification $overdueNotification
* @property \Model\WebNotification $webNotification
* @property \Model\Project $project
* @property \Model\ProjectActivity $projectActivity
* @property \Model\ProjectAnalytic $projectAnalytic
* @property \Model\ProjectDuplication $projectDuplication
* @property \Model\ProjectDailyColumnStats $projectDailyColumnStats
* @property \Model\ProjectDailyStats $projectDailyStats
* @property \Model\ProjectIntegration $projectIntegration
* @property \Model\ProjectPermission $projectPermission
* @property \Model\Subtask $subtask
* @property \Model\SubtaskExport $subtaskExport
* @property \Model\SubtaskTimeTracking $subtaskTimeTracking
* @property \Model\Swimlane $swimlane
* @property \Model\Task $task
* @property \Model\TaskAnalytic $taskAnalytic
* @property \Model\TaskCreation $taskCreation
* @property \Model\TaskDuplication $taskDuplication
* @property \Model\TaskExport $taskExport
* @property \Model\TaskFinder $taskFinder
* @property \Model\TaskFilter $taskFilter
* @property \Model\TaskLink $taskLink
* @property \Model\TaskModification $taskModification
* @property \Model\TaskPermission $taskPermission
* @property \Model\TaskPosition $taskPosition
* @property \Model\TaskStatus $taskStatus
* @property \Model\TaskValidator $taskValidator
* @property \Model\Transition $transition
* @property \Model\User $user
* @property \Model\UserSession $userSession
* @property \Model\Webhook $webhook
* @property \Psr\Log\LoggerInterface $logger
* @property \League\HTMLToMarkdown\HtmlConverter $htmlConverter
* @property \PicoDb\Database $db
* @property \Kanboard\Core\Helper $helper
* @property \Kanboard\Core\Mail\Client $emailClient
* @property \Kanboard\Core\HttpClient $httpClient
* @property \Kanboard\Core\Paginator $paginator
* @property \Kanboard\Core\Request $request
* @property \Kanboard\Core\Session $session
* @property \Kanboard\Core\Template $template
* @property \Kanboard\Core\OAuth2 $oauth
* @property \Kanboard\Core\Router $router
* @property \Kanboard\Core\Lexer $lexer
* @property \Kanboard\Core\ObjectStorage\ObjectStorageInterface $objectStorage
* @property \Kanboard\Core\Cache\Cache $memoryCache
* @property \Kanboard\Core\Plugin\Hook $hook
* @property \Kanboard\Core\Plugin\Loader $pluginLoader
* @property \Kanboard\Integration\BitbucketWebhook $bitbucketWebhook
* @property \Kanboard\Integration\GithubWebhook $githubWebhook
* @property \Kanboard\Integration\GitlabWebhook $gitlabWebhook
* @property \Kanboard\Formatter\ProjectGanttFormatter $projectGanttFormatter
* @property \Kanboard\Formatter\TaskFilterGanttFormatter $taskFilterGanttFormatter
* @property \Kanboard\Formatter\TaskFilterAutoCompleteFormatter $taskFilterAutoCompleteFormatter
* @property \Kanboard\Formatter\TaskFilterCalendarFormatter $taskFilterCalendarFormatter
* @property \Kanboard\Formatter\TaskFilterICalendarFormatter $taskFilterICalendarFormatter
* @property \Kanboard\Model\Acl $acl
* @property \Kanboard\Model\Action $action
* @property \Kanboard\Model\Authentication $authentication
* @property \Kanboard\Model\Board $board
* @property \Kanboard\Model\Category $category
* @property \Kanboard\Model\Color $color
* @property \Kanboard\Model\Comment $comment
* @property \Kanboard\Model\Config $config
* @property \Kanboard\Model\Currency $currency
* @property \Kanboard\Model\CustomFilter $customFilter
* @property \Kanboard\Model\DateParser $dateParser
* @property \Kanboard\Model\File $file
* @property \Kanboard\Model\LastLogin $lastLogin
* @property \Kanboard\Model\Link $link
* @property \Kanboard\Model\Notification $notification
* @property \Kanboard\Model\OverdueNotification $overdueNotification
* @property \Kanboard\Model\Project $project
* @property \Kanboard\Model\ProjectActivity $projectActivity
* @property \Kanboard\Model\ProjectAnalytic $projectAnalytic
* @property \Kanboard\Model\ProjectDuplication $projectDuplication
* @property \Kanboard\Model\ProjectDailyColumnStats $projectDailyColumnStats
* @property \Kanboard\Model\ProjectDailyStats $projectDailyStats
* @property \Kanboard\Model\ProjectMetadata $projectMetadata
* @property \Kanboard\Model\ProjectPermission $projectPermission
* @property \Kanboard\Model\ProjectNotification $projectNotification
* @property \Kanboard\Model\ProjectNotificationType $projectNotificationType
* @property \Kanboard\Model\Subtask $subtask
* @property \Kanboard\Model\SubtaskExport $subtaskExport
* @property \Kanboard\Model\SubtaskTimeTracking $subtaskTimeTracking
* @property \Kanboard\Model\Swimlane $swimlane
* @property \Kanboard\Model\Task $task
* @property \Kanboard\Model\TaskAnalytic $taskAnalytic
* @property \Kanboard\Model\TaskCreation $taskCreation
* @property \Kanboard\Model\TaskDuplication $taskDuplication
* @property \Kanboard\Model\TaskExport $taskExport
* @property \Kanboard\Model\TaskImport $taskImport
* @property \Kanboard\Model\TaskFinder $taskFinder
* @property \Kanboard\Model\TaskFilter $taskFilter
* @property \Kanboard\Model\TaskLink $taskLink
* @property \Kanboard\Model\TaskModification $taskModification
* @property \Kanboard\Model\TaskPermission $taskPermission
* @property \Kanboard\Model\TaskPosition $taskPosition
* @property \Kanboard\Model\TaskStatus $taskStatus
* @property \Kanboard\Model\TaskValidator $taskValidator
* @property \Kanboard\Model\TaskMetadata $taskMetadata
* @property \Kanboard\Model\Transition $transition
* @property \Kanboard\Model\User $user
* @property \Kanboard\Model\UserImport $userImport
* @property \Kanboard\Model\UserNotification $userNotification
* @property \Kanboard\Model\UserNotificationType $userNotificationType
* @property \Kanboard\Model\UserNotificationFilter $userNotificationFilter
* @property \Kanboard\Model\UserUnreadNotification $userUnreadNotification
* @property \Kanboard\Model\UserSession $userSession
* @property \Kanboard\Model\UserMetadata $userMetadata
* @property \Kanboard\Model\Webhook $webhook
* @property \Psr\Log\LoggerInterface $logger
* @property \League\HTMLToMarkdown\HtmlConverter $htmlConverter
* @property \PicoDb\Database $db
*/
abstract class Base
{

View file

@ -1,6 +1,6 @@
<?php
namespace Core\Cache;
namespace Kanboard\Core\Cache;
/**
* Base class for cache drivers

View file

@ -1,6 +1,6 @@
<?php
namespace Core\Cache;
namespace Kanboard\Core\Cache;
/**
* Cache Interface

View file

@ -1,6 +1,6 @@
<?php
namespace Core\Cache;
namespace Kanboard\Core\Cache;
/**
* Memory Cache

Some files were not shown because too many files have changed in this diff Show more