Run php-cs-fixer on the code base
This commit is contained in:
@@ -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.'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,8 +236,7 @@ class App extends Base
|
||||
// Search by task id or by title
|
||||
if (ctype_digit($search)) {
|
||||
$filter->filterById($search);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$filter->filterByTitle($search);
|
||||
}
|
||||
|
||||
|
||||
@@ -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']);
|
||||
|
||||
@@ -60,7 +60,6 @@ abstract class Base extends \Kanboard\Core\Base
|
||||
public function __destruct()
|
||||
{
|
||||
if (DEBUG) {
|
||||
|
||||
foreach ($this->container['db']->getLogMessages() as $message) {
|
||||
$this->container['logger']->debug($message);
|
||||
}
|
||||
@@ -123,7 +122,6 @@ abstract class Base extends \Kanboard\Core\Base
|
||||
public function handleAuthentication()
|
||||
{
|
||||
if (! $this->authentication->isAuthenticated()) {
|
||||
|
||||
if ($this->request->isAjax()) {
|
||||
$this->response->text('Not Authorized', 401);
|
||||
}
|
||||
@@ -143,7 +141,6 @@ abstract class Base extends \Kanboard\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);
|
||||
}
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
|
||||
|
||||
@@ -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,8 +172,7 @@ 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.'));
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ class Config extends Base
|
||||
private function common($redirect)
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
|
||||
$values = $this->request->getValues();
|
||||
|
||||
switch ($redirect) {
|
||||
@@ -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.'));
|
||||
}
|
||||
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
}
|
||||
@@ -126,8 +125,7 @@ class Customfilter extends Base
|
||||
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.'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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]))).')';
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -119,7 +116,6 @@ class File extends Base
|
||||
public function image()
|
||||
{
|
||||
try {
|
||||
|
||||
$task = $this->getTask();
|
||||
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
||||
|
||||
@@ -129,8 +125,7 @@ class File extends Base
|
||||
|
||||
$this->response->contentType($this->file->getImageMimeType($file['name']));
|
||||
$this->objectStorage->output($file['path']);
|
||||
}
|
||||
catch (ObjectStorageException $e) {
|
||||
} catch (ObjectStorageException $e) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -143,7 +138,6 @@ class File extends Base
|
||||
public function thumbnail()
|
||||
{
|
||||
try {
|
||||
|
||||
$task = $this->getTask();
|
||||
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
||||
|
||||
@@ -153,8 +147,7 @@ class File extends Base
|
||||
|
||||
$this->response->contentType('image/jpeg');
|
||||
$this->objectStorage->output($this->file->getThumbnailPath($file['path']));
|
||||
}
|
||||
catch (ObjectStorageException $e) {
|
||||
} catch (ObjectStorageException $e) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,8 +89,7 @@ class Ical extends Base
|
||||
->setColumns('date_creation', 'date_completed')
|
||||
->setCalendar($calendar)
|
||||
->addDateTimeEvents();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$filter
|
||||
->copy()
|
||||
->filterByStartDateRange($start, $end)
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
|
||||
@@ -145,8 +142,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 +151,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 +187,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 +208,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 +236,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 +263,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 +286,6 @@ class Project extends Base
|
||||
$project = $this->getProject();
|
||||
|
||||
if ($this->request->getStringParam('remove') === 'yes') {
|
||||
|
||||
$this->checkCSRFParam();
|
||||
|
||||
if ($this->project->remove($project['id'])) {
|
||||
@@ -356,7 +341,6 @@ class Project extends Base
|
||||
$project = $this->getProject();
|
||||
|
||||
if ($this->request->getStringParam('disable') === 'yes') {
|
||||
|
||||
$this->checkCSRFParam();
|
||||
|
||||
if ($this->project->disable($project['id'])) {
|
||||
@@ -384,7 +368,6 @@ class Project extends Base
|
||||
$project = $this->getProject();
|
||||
|
||||
if ($this->request->getStringParam('enable') === 'yes') {
|
||||
|
||||
$this->checkCSRFParam();
|
||||
|
||||
if ($this->project->enable($project['id'])) {
|
||||
@@ -431,7 +414,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) {
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ class Search extends Base
|
||||
->setDirection('DESC');
|
||||
|
||||
if ($search !== '') {
|
||||
|
||||
$query = $this
|
||||
->taskFilter
|
||||
->search($search)
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,6 @@ class Task extends Base
|
||||
}
|
||||
|
||||
if ($this->request->getStringParam('confirmation') === 'yes') {
|
||||
|
||||
$this->checkCSRFParam();
|
||||
|
||||
if ($this->task->remove($task['id'])) {
|
||||
|
||||
@@ -53,8 +53,7 @@ class TaskImport extends Base
|
||||
|
||||
if ($this->taskImport->counter > 0) {
|
||||
$this->session->flash(t('%d task(s) have been imported successfully.', $this->taskImport->counter));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->session->flashError(t('Nothing have been imported!'));
|
||||
}
|
||||
|
||||
|
||||
@@ -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'])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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'])) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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']);
|
||||
|
||||
@@ -101,8 +100,7 @@ class User extends Base
|
||||
|
||||
$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;
|
||||
}
|
||||
@@ -240,7 +238,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 +267,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 +302,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 +320,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 +353,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 +384,6 @@ class User extends Base
|
||||
$user = $this->getUser();
|
||||
|
||||
if ($this->request->getStringParam('confirmation') === 'yes') {
|
||||
|
||||
$this->checkCSRFParam();
|
||||
|
||||
if ($this->user->remove($user['id'])) {
|
||||
|
||||
@@ -47,8 +47,7 @@ class UserImport extends Base
|
||||
|
||||
if ($this->userImport->counter > 0) {
|
||||
$this->session->flash(t('%d user(s) have been imported successfully.', $this->userImport->counter));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->session->flashError(t('Nothing have been imported!'));
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user