Run php-cs-fixer on the code base
This commit is contained in:
@@ -67,7 +67,6 @@ class TaskEmail extends Base
|
|||||||
$user = $this->user->getById($this->getParam('user_id'));
|
$user = $this->user->getById($this->getParam('user_id'));
|
||||||
|
|
||||||
if (! empty($user['email'])) {
|
if (! empty($user['email'])) {
|
||||||
|
|
||||||
$task = $this->taskFinder->getDetails($data['task_id']);
|
$task = $this->taskFinder->getDetails($data['task_id']);
|
||||||
|
|
||||||
$this->emailClient->send(
|
$this->emailClient->send(
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ class Action extends \Kanboard\Core\Base
|
|||||||
$actions = $this->action->getAllByProject($project_id);
|
$actions = $this->action->getAllByProject($project_id);
|
||||||
|
|
||||||
foreach ($actions as $index => $action) {
|
foreach ($actions as $index => $action) {
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|
||||||
foreach ($action['params'] as $param) {
|
foreach ($action['params'] as $param) {
|
||||||
|
|||||||
@@ -29,11 +29,9 @@ class Auth extends Base
|
|||||||
if ($username !== 'jsonrpc' && ! $this->authentication->hasCaptcha($username) && $this->authentication->authenticate($username, $password)) {
|
if ($username !== 'jsonrpc' && ! $this->authentication->hasCaptcha($username) && $this->authentication->authenticate($username, $password)) {
|
||||||
$this->checkProcedurePermission(true, $method);
|
$this->checkProcedurePermission(true, $method);
|
||||||
$this->userSession->refresh($this->user->getByUsername($username));
|
$this->userSession->refresh($this->user->getByUsername($username));
|
||||||
}
|
} elseif ($username === 'jsonrpc' && $password === $this->config->get('api_token')) {
|
||||||
else if ($username === 'jsonrpc' && $password === $this->config->get('api_token')) {
|
|
||||||
$this->checkProcedurePermission(false, $method);
|
$this->checkProcedurePermission(false, $method);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw new AuthenticationFailure('Wrong credentials');
|
throw new AuthenticationFailure('Wrong credentials');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,7 @@ abstract class Base extends \Kanboard\Core\Base
|
|||||||
|
|
||||||
if ($is_user && ! $is_both_procedure && ! $is_user_procedure) {
|
if ($is_user && ! $is_both_procedure && ! $is_user_procedure) {
|
||||||
throw new AccessDeniedException('Permission denied');
|
throw new AccessDeniedException('Permission denied');
|
||||||
}
|
} elseif (! $is_user && ! $is_both_procedure && $is_user_procedure) {
|
||||||
else if (! $is_user && ! $is_both_procedure && $is_user_procedure) {
|
|
||||||
throw new AccessDeniedException('Permission denied');
|
throw new AccessDeniedException('Permission denied');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,14 +25,12 @@ class File extends \Kanboard\Core\Base
|
|||||||
public function downloadFile($file_id)
|
public function downloadFile($file_id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$file = $this->file->getById($file_id);
|
$file = $this->file->getById($file_id);
|
||||||
|
|
||||||
if (! empty($file)) {
|
if (! empty($file)) {
|
||||||
return base64_encode($this->objectStorage->get($file['path']));
|
return base64_encode($this->objectStorage->get($file['path']));
|
||||||
}
|
}
|
||||||
}
|
} catch (ObjectStorageException $e) {
|
||||||
catch (ObjectStorageException $e) {
|
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,6 @@ class Ldap extends Base
|
|||||||
$result = $this->findUser($username, $password);
|
$result = $this->findUser($username, $password);
|
||||||
|
|
||||||
if (is_array($result)) {
|
if (is_array($result)) {
|
||||||
|
|
||||||
$user = $this->user->getByUsername($username);
|
$user = $this->user->getByUsername($username);
|
||||||
|
|
||||||
if (! empty($user)) {
|
if (! empty($user)) {
|
||||||
@@ -226,14 +225,12 @@ class Ldap extends Base
|
|||||||
if ($user['is_ldap_user'] == 0) {
|
if ($user['is_ldap_user'] == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
// We create automatically a new user
|
// We create automatically a new user
|
||||||
if ($this->isLdapAccountCreationEnabled() && $this->user->create($result) !== false) {
|
if ($this->isLdapAccountCreationEnabled() && $this->user->create($result) !== false) {
|
||||||
$user = $this->user->getByUsername($username);
|
$user = $this->user->getByUsername($username);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,12 +316,10 @@ class Ldap extends Base
|
|||||||
if ($this->getLdapBindType() === 'user') {
|
if ($this->getLdapBindType() === 'user') {
|
||||||
$ldap_username = sprintf($this->getLdapUsername(), $username);
|
$ldap_username = sprintf($this->getLdapUsername(), $username);
|
||||||
$ldap_password = $password;
|
$ldap_password = $password;
|
||||||
}
|
} elseif ($this->getLdapBindType() === 'proxy') {
|
||||||
else if ($this->getLdapBindType() === 'proxy') {
|
|
||||||
$ldap_username = $this->getLdapUsername();
|
$ldap_username = $this->getLdapUsername();
|
||||||
$ldap_password = $this->getLdapPassword();
|
$ldap_password = $this->getLdapPassword();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$ldap_username = null;
|
$ldap_username = null;
|
||||||
$ldap_password = null;
|
$ldap_password = null;
|
||||||
}
|
}
|
||||||
@@ -486,11 +481,9 @@ class Ldap extends Base
|
|||||||
{
|
{
|
||||||
if (! empty($username) && ! empty($email)) {
|
if (! empty($username) && ! empty($email)) {
|
||||||
return '(&('.$this->getLdapUserPattern($username).')('.$this->getLdapAccountEmail().'='.$email.'))';
|
return '(&('.$this->getLdapUserPattern($username).')('.$this->getLdapAccountEmail().'='.$email.'))';
|
||||||
}
|
} elseif (! empty($username)) {
|
||||||
else if (! empty($username)) {
|
|
||||||
return $this->getLdapUserPattern($username);
|
return $this->getLdapUserPattern($username);
|
||||||
}
|
} elseif (! empty($email)) {
|
||||||
else if (! empty($email)) {
|
|
||||||
return '('.$this->getLdapAccountEmail().'='.$email.')';
|
return '('.$this->getLdapAccountEmail().'='.$email.')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ class RememberMe extends Base
|
|||||||
$credentials = $this->readCookie();
|
$credentials = $this->readCookie();
|
||||||
|
|
||||||
if ($credentials !== false) {
|
if ($credentials !== false) {
|
||||||
|
|
||||||
$record = $this->find($credentials['token'], $credentials['sequence']);
|
$record = $this->find($credentials['token'], $credentials['sequence']);
|
||||||
|
|
||||||
if ($record) {
|
if ($record) {
|
||||||
@@ -144,7 +143,6 @@ class RememberMe extends Base
|
|||||||
$credentials = $this->readCookie();
|
$credentials = $this->readCookie();
|
||||||
|
|
||||||
if ($credentials !== false) {
|
if ($credentials !== false) {
|
||||||
|
|
||||||
$this->deleteCookie();
|
$this->deleteCookie();
|
||||||
|
|
||||||
$this->db
|
$this->db
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ class LocaleComparator extends Base
|
|||||||
$it->rewind();
|
$it->rewind();
|
||||||
|
|
||||||
while ($it->valid()) {
|
while ($it->valid()) {
|
||||||
|
|
||||||
if (! $it->isDot() && substr($it->key(), -4) === '.php') {
|
if (! $it->isDot() && substr($it->key(), -4) === '.php') {
|
||||||
$strings = array_merge($strings, $this->search($it->key()));
|
$strings = array_merge($strings, $this->search($it->key()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ class LocaleSync extends Base
|
|||||||
$reference = include $reference_file;
|
$reference = include $reference_file;
|
||||||
|
|
||||||
foreach (new DirectoryIterator('app/Locale') as $fileInfo) {
|
foreach (new DirectoryIterator('app/Locale') as $fileInfo) {
|
||||||
|
|
||||||
if (! $fileInfo->isDot() && $fileInfo->isDir() && $fileInfo->getFilename() !== self::REF_LOCALE) {
|
if (! $fileInfo->isDot() && $fileInfo->isDir() && $fileInfo->getFilename() !== self::REF_LOCALE) {
|
||||||
|
|
||||||
$filename = 'app/Locale/'.$fileInfo->getFilename().'/translations.php';
|
$filename = 'app/Locale/'.$fileInfo->getFilename().'/translations.php';
|
||||||
echo $fileInfo->getFilename().' ('.$filename.')'.PHP_EOL;
|
echo $fileInfo->getFilename().' ('.$filename.')'.PHP_EOL;
|
||||||
|
|
||||||
@@ -42,11 +40,9 @@ class LocaleSync extends Base
|
|||||||
$output .= 'return array('.PHP_EOL;
|
$output .= 'return array('.PHP_EOL;
|
||||||
|
|
||||||
foreach ($reference as $key => $value) {
|
foreach ($reference as $key => $value) {
|
||||||
|
|
||||||
if (! empty($outdated[$key])) {
|
if (! empty($outdated[$key])) {
|
||||||
$output .= " '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $outdated[$key])."',\n";
|
$output .= " '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $outdated[$key])."',\n";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$output .= " // '".str_replace("'", "\'", $key)."' => '',\n";
|
$output .= " // '".str_replace("'", "\'", $key)."' => '',\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,11 +118,9 @@ class Action extends Base
|
|||||||
list($valid, ) = $this->action->validateCreation($values);
|
list($valid, ) = $this->action->validateCreation($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->action->create($values) !== false) {
|
if ($this->action->create($values) !== false) {
|
||||||
$this->session->flash(t('Your automatic action have been created successfully.'));
|
$this->session->flash(t('Your automatic action have been created successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to create your automatic action.'));
|
$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
|
// Search by task id or by title
|
||||||
if (ctype_digit($search)) {
|
if (ctype_digit($search)) {
|
||||||
$filter->filterById($search);
|
$filter->filterById($search);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$filter->filterByTitle($search);
|
$filter->filterByTitle($search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ class Auth extends Base
|
|||||||
list($valid, $errors) = $this->authentication->validateForm($values);
|
list($valid, $errors) = $this->authentication->validateForm($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if (! empty($this->session['login_redirect']) && ! filter_var($this->session['login_redirect'], FILTER_VALIDATE_URL)) {
|
if (! empty($this->session['login_redirect']) && ! filter_var($this->session['login_redirect'], FILTER_VALIDATE_URL)) {
|
||||||
$redirect = $this->session['login_redirect'];
|
$redirect = $this->session['login_redirect'];
|
||||||
unset($this->session['login_redirect']);
|
unset($this->session['login_redirect']);
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ abstract class Base extends \Kanboard\Core\Base
|
|||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
|
||||||
foreach ($this->container['db']->getLogMessages() as $message) {
|
foreach ($this->container['db']->getLogMessages() as $message) {
|
||||||
$this->container['logger']->debug($message);
|
$this->container['logger']->debug($message);
|
||||||
}
|
}
|
||||||
@@ -123,7 +122,6 @@ abstract class Base extends \Kanboard\Core\Base
|
|||||||
public function handleAuthentication()
|
public function handleAuthentication()
|
||||||
{
|
{
|
||||||
if (! $this->authentication->isAuthenticated()) {
|
if (! $this->authentication->isAuthenticated()) {
|
||||||
|
|
||||||
if ($this->request->isAjax()) {
|
if ($this->request->isAjax()) {
|
||||||
$this->response->text('Not Authorized', 401);
|
$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');
|
$ignore = ($controller === 'twofactor' && in_array($action, array('code', 'check'))) || ($controller === 'auth' && $action === 'logout');
|
||||||
|
|
||||||
if ($ignore === false && $this->userSession->has2FA() && ! $this->userSession->check2FA()) {
|
if ($ignore === false && $this->userSession->has2FA() && ! $this->userSession->check2FA()) {
|
||||||
|
|
||||||
if ($this->request->isAjax()) {
|
if ($this->request->isAjax()) {
|
||||||
$this->response->text('Not Authorized', 401);
|
$this->response->text('Not Authorized', 401);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,8 +243,7 @@ class Board extends Base
|
|||||||
|
|
||||||
if ($valid && $this->taskModification->update($values)) {
|
if ($valid && $this->taskModification->update($values)) {
|
||||||
$this->session->flash(t('Task updated successfully.'));
|
$this->session->flash(t('Task updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update your task.'));
|
$this->session->flashError(t('Unable to update your task.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,8 +280,7 @@ class Board extends Base
|
|||||||
|
|
||||||
if ($valid && $this->taskModification->update($values)) {
|
if ($valid && $this->taskModification->update($values)) {
|
||||||
$this->session->flash(t('Task updated successfully.'));
|
$this->session->flash(t('Task updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update your task.'));
|
$this->session->flashError(t('Unable to update your task.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,8 +363,7 @@ class Board extends Base
|
|||||||
|
|
||||||
if ($this->request->isAjax()) {
|
if ($this->request->isAjax()) {
|
||||||
$this->response->html($this->renderBoard($project_id));
|
$this->response->html($this->renderBoard($project_id));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project_id)));
|
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project_id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ class Calendar extends Base
|
|||||||
// Tasks
|
// Tasks
|
||||||
if ($this->config->get('calendar_project_tasks', 'date_started') === 'date_creation') {
|
if ($this->config->get('calendar_project_tasks', 'date_started') === 'date_creation') {
|
||||||
$events = $filter->copy()->filterByCreationDateRange($start, $end)->setColumns('date_creation', 'date_completed')->format();
|
$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();
|
$events = $filter->copy()->filterByStartDateRange($start, $end)->setColumns('date_started', 'date_completed')->format();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,8 +78,7 @@ class Calendar extends Base
|
|||||||
// Tasks
|
// Tasks
|
||||||
if ($this->config->get('calendar_user_tasks', 'date_started') === 'date_creation') {
|
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());
|
$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());
|
$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()
|
public function save()
|
||||||
{
|
{
|
||||||
if ($this->request->isAjax() && $this->request->isPost()) {
|
if ($this->request->isAjax() && $this->request->isPost()) {
|
||||||
|
|
||||||
$values = $this->request->getJson();
|
$values = $this->request->getJson();
|
||||||
|
|
||||||
$this->taskModification->update(array(
|
$this->taskModification->update(array(
|
||||||
|
|||||||
@@ -60,12 +60,10 @@ class Category extends Base
|
|||||||
list($valid, $errors) = $this->category->validateCreation($values);
|
list($valid, $errors) = $this->category->validateCreation($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->category->create($values)) {
|
if ($this->category->create($values)) {
|
||||||
$this->session->flash(t('Your category have been created successfully.'));
|
$this->session->flash(t('Your category have been created successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('category', 'index', array('project_id' => $project['id'])));
|
$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.'));
|
$this->session->flashError(t('Unable to create your category.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,12 +102,10 @@ class Category extends Base
|
|||||||
list($valid, $errors) = $this->category->validateModification($values);
|
list($valid, $errors) = $this->category->validateModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->category->update($values)) {
|
if ($this->category->update($values)) {
|
||||||
$this->session->flash(t('Your category have been updated successfully.'));
|
$this->session->flash(t('Your category have been updated successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('category', 'index', array('project_id' => $project['id'])));
|
$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.'));
|
$this->session->flashError(t('Unable to update your category.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,12 +54,10 @@ class Column extends Base
|
|||||||
list($valid, $errors) = $this->board->validateCreation($data);
|
list($valid, $errors) = $this->board->validateCreation($data);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->board->addColumn($project['id'], $data['title'], $data['task_limit'], $data['description'])) {
|
if ($this->board->addColumn($project['id'], $data['title'], $data['task_limit'], $data['description'])) {
|
||||||
$this->session->flash(t('Board updated successfully.'));
|
$this->session->flash(t('Board updated successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
|
$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.'));
|
$this->session->flashError(t('Unable to update this board.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,12 +97,10 @@ class Column extends Base
|
|||||||
list($valid, $errors) = $this->board->validateModification($values);
|
list($valid, $errors) = $this->board->validateModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->board->updateColumn($values['id'], $values['title'], $values['task_limit'], $values['description'])) {
|
if ($this->board->updateColumn($values['id'], $values['title'], $values['task_limit'], $values['description'])) {
|
||||||
$this->session->flash(t('Board updated successfully.'));
|
$this->session->flash(t('Board updated successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
|
$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.'));
|
$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'])) {
|
if (! empty($column) && $this->board->removeColumn($column['id'])) {
|
||||||
$this->session->flash(t('Column removed successfully.'));
|
$this->session->flash(t('Column removed successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to remove this column.'));
|
$this->session->flashError(t('Unable to remove this column.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,11 +81,9 @@ class Comment extends Base
|
|||||||
list($valid, $errors) = $this->comment->validateCreation($values);
|
list($valid, $errors) = $this->comment->validateCreation($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->comment->create($values)) {
|
if ($this->comment->create($values)) {
|
||||||
$this->session->flash(t('Comment added successfully.'));
|
$this->session->flash(t('Comment added successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to create your comment.'));
|
$this->session->flashError(t('Unable to create your comment.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,11 +130,9 @@ class Comment extends Base
|
|||||||
list($valid, $errors) = $this->comment->validateModification($values);
|
list($valid, $errors) = $this->comment->validateModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->comment->update($values)) {
|
if ($this->comment->update($values)) {
|
||||||
$this->session->flash(t('Comment updated successfully.'));
|
$this->session->flash(t('Comment updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update your comment.'));
|
$this->session->flashError(t('Unable to update your comment.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,8 +172,7 @@ class Comment extends Base
|
|||||||
|
|
||||||
if ($this->comment->remove($comment['id'])) {
|
if ($this->comment->remove($comment['id'])) {
|
||||||
$this->session->flash(t('Comment removed successfully.'));
|
$this->session->flash(t('Comment removed successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to remove this comment.'));
|
$this->session->flashError(t('Unable to remove this comment.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class Config extends Base
|
|||||||
private function common($redirect)
|
private function common($redirect)
|
||||||
{
|
{
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
|
|
||||||
$values = $this->request->getValues();
|
$values = $this->request->getValues();
|
||||||
|
|
||||||
switch ($redirect) {
|
switch ($redirect) {
|
||||||
@@ -55,8 +54,7 @@ class Config extends Base
|
|||||||
if ($this->config->save($values)) {
|
if ($this->config->save($values)) {
|
||||||
$this->config->reload();
|
$this->config->reload();
|
||||||
$this->session->flash(t('Settings saved successfully.'));
|
$this->session->flash(t('Settings saved successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to save your settings.'));
|
$this->session->flashError(t('Unable to save your settings.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,12 +54,10 @@ class Currency extends Base
|
|||||||
list($valid, $errors) = $this->currency->validate($values);
|
list($valid, $errors) = $this->currency->validate($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->currency->create($values['currency'], $values['rate'])) {
|
if ($this->currency->create($values['currency'], $values['rate'])) {
|
||||||
$this->session->flash(t('The currency rate have been added successfully.'));
|
$this->session->flash(t('The currency rate have been added successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('currency', 'index'));
|
$this->response->redirect($this->helper->url->to('currency', 'index'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to add this currency rate.'));
|
$this->session->flashError(t('Unable to add this currency rate.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,8 +77,7 @@ class Currency extends Base
|
|||||||
if ($this->config->save($values)) {
|
if ($this->config->save($values)) {
|
||||||
$this->config->reload();
|
$this->config->reload();
|
||||||
$this->session->flash(t('Settings saved successfully.'));
|
$this->session->flash(t('Settings saved successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to save your settings.'));
|
$this->session->flashError(t('Unable to save your settings.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ class Customfilter extends Base
|
|||||||
if ($this->customFilter->create($values)) {
|
if ($this->customFilter->create($values)) {
|
||||||
$this->session->flash(t('Your custom filter have been created successfully.'));
|
$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'])));
|
$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.'));
|
$this->session->flashError(t('Unable to create your custom filter.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,8 +125,7 @@ class Customfilter extends Base
|
|||||||
if ($this->customFilter->update($values)) {
|
if ($this->customFilter->update($values)) {
|
||||||
$this->session->flash(t('Your custom filter have been updated successfully.'));
|
$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'])));
|
$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.'));
|
$this->session->flashError(t('Unable to update custom filter.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ class File extends Base
|
|||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
|
|
||||||
if ($this->request->isPost() && $this->file->uploadScreenshot($task['project_id'], $task['id'], $this->request->getValue('screenshot')) !== false) {
|
if ($this->request->isPost() && $this->file->uploadScreenshot($task['project_id'], $task['id'], $this->request->getValue('screenshot')) !== false) {
|
||||||
|
|
||||||
$this->session->flash(t('Screenshot uploaded successfully.'));
|
$this->session->flash(t('Screenshot uploaded successfully.'));
|
||||||
|
|
||||||
if ($this->request->getStringParam('redirect') === 'board') {
|
if ($this->request->getStringParam('redirect') === 'board') {
|
||||||
@@ -77,7 +76,6 @@ class File extends Base
|
|||||||
public function download()
|
public function download()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
||||||
|
|
||||||
@@ -87,8 +85,7 @@ class File extends Base
|
|||||||
|
|
||||||
$this->response->forceDownload($file['name']);
|
$this->response->forceDownload($file['name']);
|
||||||
$this->objectStorage->output($file['path']);
|
$this->objectStorage->output($file['path']);
|
||||||
}
|
} catch (ObjectStorageException $e) {
|
||||||
catch (ObjectStorageException $e) {
|
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,7 +116,6 @@ class File extends Base
|
|||||||
public function image()
|
public function image()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
$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->response->contentType($this->file->getImageMimeType($file['name']));
|
||||||
$this->objectStorage->output($file['path']);
|
$this->objectStorage->output($file['path']);
|
||||||
}
|
} catch (ObjectStorageException $e) {
|
||||||
catch (ObjectStorageException $e) {
|
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,7 +138,6 @@ class File extends Base
|
|||||||
public function thumbnail()
|
public function thumbnail()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
||||||
|
|
||||||
@@ -153,8 +147,7 @@ class File extends Base
|
|||||||
|
|
||||||
$this->response->contentType('image/jpeg');
|
$this->response->contentType('image/jpeg');
|
||||||
$this->objectStorage->output($this->file->getThumbnailPath($file['path']));
|
$this->objectStorage->output($this->file->getThumbnailPath($file['path']));
|
||||||
}
|
} catch (ObjectStorageException $e) {
|
||||||
catch (ObjectStorageException $e) {
|
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ class Gantt extends Base
|
|||||||
{
|
{
|
||||||
if ($this->userSession->isAdmin()) {
|
if ($this->userSession->isAdmin()) {
|
||||||
$project_ids = $this->project->getAllIds();
|
$project_ids = $this->project->getAllIds();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$project_ids = $this->projectPermission->getMemberProjectIds($this->userSession->getId());
|
$project_ids = $this->projectPermission->getMemberProjectIds($this->userSession->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,8 +61,7 @@ class Gantt extends Base
|
|||||||
|
|
||||||
if ($sorting === 'date') {
|
if ($sorting === 'date') {
|
||||||
$filter->getQuery()->asc(TaskModel::TABLE.'.date_started')->asc(TaskModel::TABLE.'.date_creation');
|
$filter->getQuery()->asc(TaskModel::TABLE.'.date_started')->asc(TaskModel::TABLE.'.date_creation');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$filter->getQuery()->asc('column_position')->asc(TaskModel::TABLE.'.position');
|
$filter->getQuery()->asc('column_position')->asc(TaskModel::TABLE.'.position');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,14 +132,12 @@ class Gantt extends Base
|
|||||||
list($valid, $errors) = $this->taskValidator->validateCreation($values);
|
list($valid, $errors) = $this->taskValidator->validateCreation($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
$task_id = $this->taskCreation->create($values);
|
$task_id = $this->taskCreation->create($values);
|
||||||
|
|
||||||
if ($task_id !== false) {
|
if ($task_id !== false) {
|
||||||
$this->session->flash(t('Task created successfully.'));
|
$this->session->flash(t('Task created successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('gantt', 'project', array('project_id' => $project['id'])));
|
$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.'));
|
$this->session->flashError(t('Unable to create your task.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,8 +89,7 @@ class Ical extends Base
|
|||||||
->setColumns('date_creation', 'date_completed')
|
->setColumns('date_creation', 'date_completed')
|
||||||
->setCalendar($calendar)
|
->setCalendar($calendar)
|
||||||
->addDateTimeEvents();
|
->addDateTimeEvents();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$filter
|
$filter
|
||||||
->copy()
|
->copy()
|
||||||
->filterByStartDateRange($start, $end)
|
->filterByStartDateRange($start, $end)
|
||||||
|
|||||||
@@ -70,12 +70,10 @@ class Link extends Base
|
|||||||
list($valid, $errors) = $this->link->validateCreation($values);
|
list($valid, $errors) = $this->link->validateCreation($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->link->create($values['label'], $values['opposite_label']) !== false) {
|
if ($this->link->create($values['label'], $values['opposite_label']) !== false) {
|
||||||
$this->session->flash(t('Link added successfully.'));
|
$this->session->flash(t('Link added successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('link', 'index'));
|
$this->response->redirect($this->helper->url->to('link', 'index'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to create your link.'));
|
$this->session->flashError(t('Unable to create your link.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,8 +114,7 @@ class Link extends Base
|
|||||||
if ($this->link->update($values)) {
|
if ($this->link->update($values)) {
|
||||||
$this->session->flash(t('Link updated successfully.'));
|
$this->session->flash(t('Link updated successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('link', 'index'));
|
$this->response->redirect($this->helper->url->to('link', 'index'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update your link.'));
|
$this->session->flashError(t('Unable to update your link.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,8 +149,7 @@ class Link extends Base
|
|||||||
|
|
||||||
if ($this->link->remove($link['id'])) {
|
if ($this->link->remove($link['id'])) {
|
||||||
$this->session->flash(t('Link removed successfully.'));
|
$this->session->flash(t('Link removed successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to remove this link.'));
|
$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())) {
|
if ($this->authentication->backend($backend)->unlink($this->userSession->getId())) {
|
||||||
$this->session->flash(t('Your external account is not linked anymore to your profile.'));
|
$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.'));
|
$this->session->flashError(t('Unable to unlink your external account.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,8 +70,7 @@ class Oauth extends Base
|
|||||||
|
|
||||||
if (! empty($code)) {
|
if (! empty($code)) {
|
||||||
$this->step2($backend, $code);
|
$this->step2($backend, $code);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->response->redirect($this->authentication->backend($backend)->getService()->getAuthorizationUrl());
|
$this->response->redirect($this->authentication->backend($backend)->getService()->getAuthorizationUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,8 +100,7 @@ class Oauth extends Base
|
|||||||
{
|
{
|
||||||
if (empty($profile)) {
|
if (empty($profile)) {
|
||||||
$this->session->flashError(t('External authentication failed'));
|
$this->session->flashError(t('External authentication failed'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flash(t('Your external account is linked to your profile successfully.'));
|
$this->session->flash(t('Your external account is linked to your profile successfully.'));
|
||||||
$this->authentication->backend($backend)->updateUser($this->userSession->getId(), $profile);
|
$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'])) {
|
if (! empty($profile) && $this->authentication->backend($backend)->authenticate($profile['id'])) {
|
||||||
$this->response->redirect($this->helper->url->to('app', 'index'));
|
$this->response->redirect($this->helper->url->to('app', 'index'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->response->html($this->template->layout('auth/index', array(
|
$this->response->html($this->template->layout('auth/index', array(
|
||||||
'errors' => array('login' => t('External authentication failed')),
|
'errors' => array('login' => t('External authentication failed')),
|
||||||
'values' => array(),
|
'values' => array(),
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ class Project extends Base
|
|||||||
{
|
{
|
||||||
if ($this->userSession->isAdmin()) {
|
if ($this->userSession->isAdmin()) {
|
||||||
$project_ids = $this->project->getAllIds();
|
$project_ids = $this->project->getAllIds();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$project_ids = $this->projectPermission->getMemberProjectIds($this->userSession->getId());
|
$project_ids = $this->projectPermission->getMemberProjectIds($this->userSession->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,13 +67,11 @@ class Project extends Base
|
|||||||
$switch = $this->request->getStringParam('switch');
|
$switch = $this->request->getStringParam('switch');
|
||||||
|
|
||||||
if ($switch === 'enable' || $switch === 'disable') {
|
if ($switch === 'enable' || $switch === 'disable') {
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
|
|
||||||
if ($this->project->{$switch.'PublicAccess'}($project['id'])) {
|
if ($this->project->{$switch.'PublicAccess'}($project['id'])) {
|
||||||
$this->session->flash(t('Project updated successfully.'));
|
$this->session->flash(t('Project updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update this project.'));
|
$this->session->flashError(t('Unable to update this project.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,8 +142,7 @@ class Project extends Base
|
|||||||
if (! $this->helper->user->isProjectAdministrationAllowed($project['id'])) {
|
if (! $this->helper->user->isProjectAdministrationAllowed($project['id'])) {
|
||||||
unset($values['is_private']);
|
unset($values['is_private']);
|
||||||
}
|
}
|
||||||
}
|
} elseif ($project['is_private'] == 1 && ! isset($values['is_private'])) {
|
||||||
else if ($project['is_private'] == 1 && ! isset($values['is_private'])) {
|
|
||||||
if ($this->helper->user->isProjectAdministrationAllowed($project['id'])) {
|
if ($this->helper->user->isProjectAdministrationAllowed($project['id'])) {
|
||||||
$values += array('is_private' => 0);
|
$values += array('is_private' => 0);
|
||||||
}
|
}
|
||||||
@@ -155,12 +151,10 @@ class Project extends Base
|
|||||||
list($valid, $errors) = $this->project->validateModification($values);
|
list($valid, $errors) = $this->project->validateModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->project->update($values)) {
|
if ($this->project->update($values)) {
|
||||||
$this->session->flash(t('Project updated successfully.'));
|
$this->session->flash(t('Project updated successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('project', 'edit', array('project_id' => $project['id'])));
|
$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.'));
|
$this->session->flashError(t('Unable to update this project.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,11 +190,9 @@ class Project extends Base
|
|||||||
list($valid, ) = $this->projectPermission->validateProjectModification($values);
|
list($valid, ) = $this->projectPermission->validateProjectModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->project->update($values)) {
|
if ($this->project->update($values)) {
|
||||||
$this->session->flash(t('Project updated successfully.'));
|
$this->session->flash(t('Project updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update this project.'));
|
$this->session->flashError(t('Unable to update this project.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,11 +211,9 @@ class Project extends Base
|
|||||||
list($valid, ) = $this->projectPermission->validateUserModification($values);
|
list($valid, ) = $this->projectPermission->validateUserModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->projectPermission->addMember($values['project_id'], $values['user_id'])) {
|
if ($this->projectPermission->addMember($values['project_id'], $values['user_id'])) {
|
||||||
$this->session->flash(t('Project updated successfully.'));
|
$this->session->flash(t('Project updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update this project.'));
|
$this->session->flashError(t('Unable to update this project.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,11 +239,9 @@ class Project extends Base
|
|||||||
list($valid, ) = $this->projectPermission->validateUserModification($values);
|
list($valid, ) = $this->projectPermission->validateUserModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->projectPermission->changeRole($values['project_id'], $values['user_id'], $values['is_owner'])) {
|
if ($this->projectPermission->changeRole($values['project_id'], $values['user_id'], $values['is_owner'])) {
|
||||||
$this->session->flash(t('Project updated successfully.'));
|
$this->session->flash(t('Project updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update this project.'));
|
$this->session->flashError(t('Unable to update this project.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,11 +266,9 @@ class Project extends Base
|
|||||||
list($valid, ) = $this->projectPermission->validateUserModification($values);
|
list($valid, ) = $this->projectPermission->validateUserModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->projectPermission->revokeMember($values['project_id'], $values['user_id'])) {
|
if ($this->projectPermission->revokeMember($values['project_id'], $values['user_id'])) {
|
||||||
$this->session->flash(t('Project updated successfully.'));
|
$this->session->flash(t('Project updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update this project.'));
|
$this->session->flashError(t('Unable to update this project.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -300,7 +286,6 @@ class Project extends Base
|
|||||||
$project = $this->getProject();
|
$project = $this->getProject();
|
||||||
|
|
||||||
if ($this->request->getStringParam('remove') === 'yes') {
|
if ($this->request->getStringParam('remove') === 'yes') {
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
|
|
||||||
if ($this->project->remove($project['id'])) {
|
if ($this->project->remove($project['id'])) {
|
||||||
@@ -356,7 +341,6 @@ class Project extends Base
|
|||||||
$project = $this->getProject();
|
$project = $this->getProject();
|
||||||
|
|
||||||
if ($this->request->getStringParam('disable') === 'yes') {
|
if ($this->request->getStringParam('disable') === 'yes') {
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
|
|
||||||
if ($this->project->disable($project['id'])) {
|
if ($this->project->disable($project['id'])) {
|
||||||
@@ -384,7 +368,6 @@ class Project extends Base
|
|||||||
$project = $this->getProject();
|
$project = $this->getProject();
|
||||||
|
|
||||||
if ($this->request->getStringParam('enable') === 'yes') {
|
if ($this->request->getStringParam('enable') === 'yes') {
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
|
|
||||||
if ($this->project->enable($project['id'])) {
|
if ($this->project->enable($project['id'])) {
|
||||||
@@ -431,7 +414,6 @@ class Project extends Base
|
|||||||
list($valid, $errors) = $this->project->validateCreation($values);
|
list($valid, $errors) = $this->project->validateCreation($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
$project_id = $this->project->create($values, $this->userSession->getId(), true);
|
$project_id = $this->project->create($values, $this->userSession->getId(), true);
|
||||||
|
|
||||||
if ($project_id > 0) {
|
if ($project_id > 0) {
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ class Projectuser extends Base
|
|||||||
|
|
||||||
if ($this->userSession->isAdmin()) {
|
if ($this->userSession->isAdmin()) {
|
||||||
$project_ids = $this->project->getAllIds();
|
$project_ids = $this->project->getAllIds();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$project_ids = $this->projectPermission->getMemberProjectIds($this->userSession->getId());
|
$project_ids = $this->projectPermission->getMemberProjectIds($this->userSession->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ class Search extends Base
|
|||||||
->setDirection('DESC');
|
->setDirection('DESC');
|
||||||
|
|
||||||
if ($search !== '') {
|
if ($search !== '') {
|
||||||
|
|
||||||
$query = $this
|
$query = $this
|
||||||
->taskFilter
|
->taskFilter
|
||||||
->search($search)
|
->search($search)
|
||||||
|
|||||||
@@ -66,11 +66,9 @@ class Subtask extends Base
|
|||||||
list($valid, $errors) = $this->subtask->validateCreation($values);
|
list($valid, $errors) = $this->subtask->validateCreation($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->subtask->create($values)) {
|
if ($this->subtask->create($values)) {
|
||||||
$this->session->flash(t('Sub-task added successfully.'));
|
$this->session->flash(t('Sub-task added successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to create your sub-task.'));
|
$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);
|
list($valid, $errors) = $this->subtask->validateModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->subtask->update($values)) {
|
if ($this->subtask->update($values)) {
|
||||||
$this->session->flash(t('Sub-task updated successfully.'));
|
$this->session->flash(t('Sub-task updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update your sub-task.'));
|
$this->session->flashError(t('Unable to update your sub-task.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,8 +157,7 @@ class Subtask extends Base
|
|||||||
|
|
||||||
if ($this->subtask->remove($subtask['id'])) {
|
if ($this->subtask->remove($subtask['id'])) {
|
||||||
$this->session->flash(t('Sub-task removed successfully.'));
|
$this->session->flash(t('Sub-task removed successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to remove this sub-task.'));
|
$this->session->flashError(t('Unable to remove this sub-task.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +178,6 @@ class Subtask extends Base
|
|||||||
$this->subtask->toggleStatus($subtask['id']);
|
$this->subtask->toggleStatus($subtask['id']);
|
||||||
|
|
||||||
if ($redirect === 'board') {
|
if ($redirect === 'board') {
|
||||||
|
|
||||||
$this->session['has_subtask_inprogress'] = $this->subtask->hasSubtaskInProgress($this->userSession->getId());
|
$this->session['has_subtask_inprogress'] = $this->subtask->hasSubtaskInProgress($this->userSession->getId());
|
||||||
|
|
||||||
$this->response->html($this->template->render('board/tooltip_subtasks', array(
|
$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);
|
list($valid, $errors) = $this->swimlane->validateCreation($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->swimlane->create($values)) {
|
if ($this->swimlane->create($values)) {
|
||||||
$this->session->flash(t('Your swimlane have been created successfully.'));
|
$this->session->flash(t('Your swimlane have been created successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
|
$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.'));
|
$this->session->flashError(t('Unable to create your swimlane.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,12 +87,10 @@ class Swimlane extends Base
|
|||||||
list($valid, ) = $this->swimlane->validateDefaultModification($values);
|
list($valid, ) = $this->swimlane->validateDefaultModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->swimlane->updateDefault($values)) {
|
if ($this->swimlane->updateDefault($values)) {
|
||||||
$this->session->flash(t('The default swimlane have been updated successfully.'));
|
$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'])));
|
$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.'));
|
$this->session->flashError(t('Unable to update this swimlane.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,8 +132,7 @@ class Swimlane extends Base
|
|||||||
if ($this->swimlane->update($values)) {
|
if ($this->swimlane->update($values)) {
|
||||||
$this->session->flash(t('Swimlane updated successfully.'));
|
$this->session->flash(t('Swimlane updated successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
|
$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.'));
|
$this->session->flashError(t('Unable to update this swimlane.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ class Task extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->request->getStringParam('confirmation') === 'yes') {
|
if ($this->request->getStringParam('confirmation') === 'yes') {
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
|
|
||||||
if ($this->task->remove($task['id'])) {
|
if ($this->task->remove($task['id'])) {
|
||||||
|
|||||||
@@ -53,8 +53,7 @@ class TaskImport extends Base
|
|||||||
|
|
||||||
if ($this->taskImport->counter > 0) {
|
if ($this->taskImport->counter > 0) {
|
||||||
$this->session->flash(t('%d task(s) have been imported successfully.', $this->taskImport->counter));
|
$this->session->flash(t('%d task(s) have been imported successfully.', $this->taskImport->counter));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Nothing have been imported!'));
|
$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);
|
$swimlanes_list = $this->swimlane->getList($project['id'], false, true);
|
||||||
|
|
||||||
if (empty($values)) {
|
if (empty($values)) {
|
||||||
|
|
||||||
$values = array(
|
$values = array(
|
||||||
'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)),
|
'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)),
|
||||||
'column_id' => $this->request->getIntegerParam('column_id'),
|
'column_id' => $this->request->getIntegerParam('column_id'),
|
||||||
@@ -62,8 +61,7 @@ class Taskcreation extends Base
|
|||||||
if ($valid && $this->taskCreation->create($values)) {
|
if ($valid && $this->taskCreation->create($values)) {
|
||||||
$this->session->flash(t('Task created successfully.'));
|
$this->session->flash(t('Task created successfully.'));
|
||||||
$this->afterSave($project, $values);
|
$this->afterSave($project, $values);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to create your task.'));
|
$this->session->flashError(t('Unable to create your task.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,8 +77,7 @@ class Taskcreation extends Base
|
|||||||
if (! $this->request->isAjax()) {
|
if (! $this->request->isAjax()) {
|
||||||
$this->response->redirect($this->helper->url->to('taskcreation', 'create', $values));
|
$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'])));
|
$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();
|
$task = $this->getTask();
|
||||||
|
|
||||||
if ($this->request->getStringParam('confirmation') === 'yes') {
|
if ($this->request->getStringParam('confirmation') === 'yes') {
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
$task_id = $this->taskDuplication->duplicate($task['id']);
|
$task_id = $this->taskDuplication->duplicate($task['id']);
|
||||||
|
|
||||||
@@ -48,7 +47,6 @@ class Taskduplication extends Base
|
|||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
|
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
|
|
||||||
$values = $this->request->getValues();
|
$values = $this->request->getValues();
|
||||||
list($valid, ) = $this->taskValidator->validateProjectModification($values);
|
list($valid, ) = $this->taskValidator->validateProjectModification($values);
|
||||||
|
|
||||||
@@ -58,7 +56,6 @@ class Taskduplication extends Base
|
|||||||
$values['column_id'],
|
$values['column_id'],
|
||||||
$values['category_id'],
|
$values['category_id'],
|
||||||
$values['owner_id'])) {
|
$values['owner_id'])) {
|
||||||
|
|
||||||
$this->session->flash(t('Task updated successfully.'));
|
$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'])));
|
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $values['project_id'], 'task_id' => $task['id'])));
|
||||||
}
|
}
|
||||||
@@ -79,7 +76,6 @@ class Taskduplication extends Base
|
|||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
|
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
|
|
||||||
$values = $this->request->getValues();
|
$values = $this->request->getValues();
|
||||||
list($valid, ) = $this->taskValidator->validateProjectModification($values);
|
list($valid, ) = $this->taskValidator->validateProjectModification($values);
|
||||||
|
|
||||||
@@ -125,8 +121,7 @@ class Taskduplication extends Base
|
|||||||
|
|
||||||
$values = $this->taskDuplication->checkDestinationProjectValues($task);
|
$values = $this->taskDuplication->checkDestinationProjectValues($task);
|
||||||
$values['project_id'] = $dst_project_id;
|
$values['project_id'] = $dst_project_id;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$swimlanes_list = array();
|
$swimlanes_list = array();
|
||||||
$columns_list = array();
|
$columns_list = array();
|
||||||
$categories_list = array();
|
$categories_list = array();
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ class Tasklink extends Base
|
|||||||
list($valid, $errors) = $this->taskLink->validateCreation($values);
|
list($valid, $errors) = $this->taskLink->validateCreation($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
|
if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
|
||||||
$this->session->flash(t('Link added successfully.'));
|
$this->session->flash(t('Link added successfully.'));
|
||||||
|
|
||||||
@@ -129,7 +128,6 @@ class Tasklink extends Base
|
|||||||
list($valid, $errors) = $this->taskLink->validateModification($values);
|
list($valid, $errors) = $this->taskLink->validateModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->taskLink->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
|
if ($this->taskLink->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
|
||||||
$this->session->flash(t('Link updated successfully.'));
|
$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');
|
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links');
|
||||||
@@ -169,8 +167,7 @@ class Tasklink extends Base
|
|||||||
|
|
||||||
if ($this->taskLink->remove($this->request->getIntegerParam('link_id'))) {
|
if ($this->taskLink->remove($this->request->getIntegerParam('link_id'))) {
|
||||||
$this->session->flash(t('Link removed successfully.'));
|
$this->session->flash(t('Link removed successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to remove this link.'));
|
$this->session->flashError(t('Unable to remove this link.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ class Taskmodification extends Base
|
|||||||
|
|
||||||
if ($valid && $this->taskModification->update($values)) {
|
if ($valid && $this->taskModification->update($values)) {
|
||||||
$this->session->flash(t('Task updated successfully.'));
|
$this->session->flash(t('Task updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update your task.'));
|
$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');
|
$ajax = $this->request->isAjax() || $this->request->getIntegerParam('ajax');
|
||||||
|
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
|
|
||||||
$values = $this->request->getValues();
|
$values = $this->request->getValues();
|
||||||
|
|
||||||
list($valid, $errors) = $this->taskValidator->validateDescriptionCreation($values);
|
list($valid, $errors) = $this->taskValidator->validateDescriptionCreation($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->taskModification->update($values)) {
|
if ($this->taskModification->update($values)) {
|
||||||
$this->session->flash(t('Task updated successfully.'));
|
$this->session->flash(t('Task updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update your task.'));
|
$this->session->flashError(t('Unable to update your task.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ajax) {
|
if ($ajax) {
|
||||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
|
$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'])));
|
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$values = $task;
|
$values = $task;
|
||||||
$errors = array();
|
$errors = array();
|
||||||
}
|
}
|
||||||
@@ -91,8 +85,7 @@ class Taskmodification extends Base
|
|||||||
|
|
||||||
if ($ajax) {
|
if ($ajax) {
|
||||||
$this->response->html($this->template->render('task_modification/edit_description', $params));
|
$this->response->html($this->template->render('task_modification/edit_description', $params));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->response->html($this->taskLayout('task_modification/edit_description', $params));
|
$this->response->html($this->taskLayout('task_modification/edit_description', $params));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,8 +120,7 @@ class Taskmodification extends Base
|
|||||||
|
|
||||||
if ($ajax) {
|
if ($ajax) {
|
||||||
$html = $this->template->render('task_modification/edit_task', $params);
|
$html = $this->template->render('task_modification/edit_task', $params);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$html = $this->taskLayout('task_modification/edit_task', $params);
|
$html = $this->taskLayout('task_modification/edit_task', $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,12 +144,10 @@ class Taskmodification extends Base
|
|||||||
|
|
||||||
if ($this->request->isAjax()) {
|
if ($this->request->isAjax()) {
|
||||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
|
$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'])));
|
$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->session->flashError(t('Unable to update your task.'));
|
||||||
$this->edit($values, $errors);
|
$this->edit($values, $errors);
|
||||||
}
|
}
|
||||||
@@ -173,24 +163,20 @@ class Taskmodification extends Base
|
|||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
|
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
|
|
||||||
$values = $this->request->getValues();
|
$values = $this->request->getValues();
|
||||||
|
|
||||||
list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values);
|
list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->taskModification->update($values)) {
|
if ($this->taskModification->update($values)) {
|
||||||
$this->session->flash(t('Task updated successfully.'));
|
$this->session->flash(t('Task updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update your task.'));
|
$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'])));
|
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$values = $task;
|
$values = $task;
|
||||||
$errors = array();
|
$errors = array();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class Taskstatus extends Base
|
|||||||
private function changeStatus(array $task, $method, $success_message, $failure_message)
|
private function changeStatus(array $task, $method, $success_message, $failure_message)
|
||||||
{
|
{
|
||||||
if ($this->request->getStringParam('confirmation') === 'yes') {
|
if ($this->request->getStringParam('confirmation') === 'yes') {
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
|
|
||||||
if ($this->taskStatus->$method($task['id'])) {
|
if ($this->taskStatus->$method($task['id'])) {
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ class Timer extends Base
|
|||||||
|
|
||||||
if ($timer === 'start') {
|
if ($timer === 'start') {
|
||||||
$this->subtaskTimeTracking->logStartTime($subtask_id, $this->userSession->getId());
|
$this->subtaskTimeTracking->logStartTime($subtask_id, $this->userSession->getId());
|
||||||
}
|
} elseif ($timer === 'stop') {
|
||||||
else if ($timer === 'stop') {
|
|
||||||
$this->subtaskTimeTracking->logEndTime($subtask_id, $this->userSession->getId());
|
$this->subtaskTimeTracking->logEndTime($subtask_id, $this->userSession->getId());
|
||||||
$this->subtaskTimeTracking->updateTaskTimeTracking($task_id);
|
$this->subtaskTimeTracking->updateTaskTimeTracking($task_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,8 +63,7 @@ class Twofactor extends User
|
|||||||
'twofactor_activated' => 1,
|
'twofactor_activated' => 1,
|
||||||
'twofactor_secret' => GoogleAuthenticator::generateRandom(),
|
'twofactor_secret' => GoogleAuthenticator::generateRandom(),
|
||||||
));
|
));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->user->update(array(
|
$this->user->update(array(
|
||||||
'id' => $user['id'],
|
'id' => $user['id'],
|
||||||
'twofactor_activated' => 0,
|
'twofactor_activated' => 0,
|
||||||
@@ -94,8 +93,7 @@ class Twofactor extends User
|
|||||||
|
|
||||||
if (! empty($values['code']) && $otp->checkTotp(Base32::decode($user['twofactor_secret']), $values['code'])) {
|
if (! empty($values['code']) && $otp->checkTotp(Base32::decode($user['twofactor_secret']), $values['code'])) {
|
||||||
$this->session->flash(t('The two factor authentication code is valid.'));
|
$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.'));
|
$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['2fa_validated'] = true;
|
||||||
$this->session->flash(t('The two factor authentication code is valid.'));
|
$this->session->flash(t('The two factor authentication code is valid.'));
|
||||||
$this->response->redirect($this->helper->url->to('app', 'index'));
|
$this->response->redirect($this->helper->url->to('app', 'index'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('The two factor authentication code is not valid.'));
|
$this->session->flashError(t('The two factor authentication code is not valid.'));
|
||||||
$this->response->redirect($this->helper->url->to('twofactor', 'code'));
|
$this->response->redirect($this->helper->url->to('twofactor', 'code'));
|
||||||
}
|
}
|
||||||
@@ -148,7 +145,6 @@ class Twofactor extends User
|
|||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
if ($this->request->getStringParam('disable') === 'yes') {
|
if ($this->request->getStringParam('disable') === 'yes') {
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
|
|
||||||
$this->user->update(array(
|
$this->user->update(array(
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ class User extends Base
|
|||||||
list($valid, $errors) = $this->user->validateCreation($values);
|
list($valid, $errors) = $this->user->validateCreation($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
$project_id = empty($values['project_id']) ? 0 : $values['project_id'];
|
$project_id = empty($values['project_id']) ? 0 : $values['project_id'];
|
||||||
unset($values['project_id']);
|
unset($values['project_id']);
|
||||||
|
|
||||||
@@ -101,8 +100,7 @@ class User extends Base
|
|||||||
|
|
||||||
$this->session->flash(t('User created successfully.'));
|
$this->session->flash(t('User created successfully.'));
|
||||||
$this->response->redirect($this->helper->url->to('user', 'show', array('user_id' => $user_id)));
|
$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.'));
|
$this->session->flashError(t('Unable to create your user.'));
|
||||||
$values['project_id'] = $project_id;
|
$values['project_id'] = $project_id;
|
||||||
}
|
}
|
||||||
@@ -240,7 +238,6 @@ class User extends Base
|
|||||||
$switch = $this->request->getStringParam('switch');
|
$switch = $this->request->getStringParam('switch');
|
||||||
|
|
||||||
if ($switch === 'enable' || $switch === 'disable') {
|
if ($switch === 'enable' || $switch === 'disable') {
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
|
|
||||||
if ($this->user->{$switch.'PublicAccess'}($user['id'])) {
|
if ($this->user->{$switch.'PublicAccess'}($user['id'])) {
|
||||||
@@ -270,16 +267,13 @@ class User extends Base
|
|||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
|
|
||||||
$values = $this->request->getValues();
|
$values = $this->request->getValues();
|
||||||
list($valid, $errors) = $this->user->validatePasswordModification($values);
|
list($valid, $errors) = $this->user->validatePasswordModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->user->update($values)) {
|
if ($this->user->update($values)) {
|
||||||
$this->session->flash(t('Password modified successfully.'));
|
$this->session->flash(t('Password modified successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to change the password.'));
|
$this->session->flashError(t('Unable to change the password.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,13 +302,11 @@ class User extends Base
|
|||||||
unset($values['password']);
|
unset($values['password']);
|
||||||
|
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
|
|
||||||
$values = $this->request->getValues();
|
$values = $this->request->getValues();
|
||||||
|
|
||||||
if ($this->userSession->isAdmin()) {
|
if ($this->userSession->isAdmin()) {
|
||||||
$values += array('is_admin' => 0, 'is_project_admin' => 0);
|
$values += array('is_admin' => 0, 'is_project_admin' => 0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Regular users can't be admin
|
// Regular users can't be admin
|
||||||
if (isset($values['is_admin'])) {
|
if (isset($values['is_admin'])) {
|
||||||
unset($values['is_admin']);
|
unset($values['is_admin']);
|
||||||
@@ -328,11 +320,9 @@ class User extends Base
|
|||||||
list($valid, $errors) = $this->user->validateModification($values);
|
list($valid, $errors) = $this->user->validateModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->user->update($values)) {
|
if ($this->user->update($values)) {
|
||||||
$this->session->flash(t('User updated successfully.'));
|
$this->session->flash(t('User updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update your user.'));
|
$this->session->flashError(t('Unable to update your user.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,16 +353,13 @@ class User extends Base
|
|||||||
unset($values['password']);
|
unset($values['password']);
|
||||||
|
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
|
|
||||||
$values = $this->request->getValues() + array('disable_login_form' => 0, 'is_ldap_user' => 0);
|
$values = $this->request->getValues() + array('disable_login_form' => 0, 'is_ldap_user' => 0);
|
||||||
list($valid, $errors) = $this->user->validateModification($values);
|
list($valid, $errors) = $this->user->validateModification($values);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
if ($this->user->update($values)) {
|
if ($this->user->update($values)) {
|
||||||
$this->session->flash(t('User updated successfully.'));
|
$this->session->flash(t('User updated successfully.'));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Unable to update your user.'));
|
$this->session->flashError(t('Unable to update your user.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +384,6 @@ class User extends Base
|
|||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
if ($this->request->getStringParam('confirmation') === 'yes') {
|
if ($this->request->getStringParam('confirmation') === 'yes') {
|
||||||
|
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
|
|
||||||
if ($this->user->remove($user['id'])) {
|
if ($this->user->remove($user['id'])) {
|
||||||
|
|||||||
@@ -47,8 +47,7 @@ class UserImport extends Base
|
|||||||
|
|
||||||
if ($this->userImport->counter > 0) {
|
if ($this->userImport->counter > 0) {
|
||||||
$this->session->flash(t('%d user(s) have been imported successfully.', $this->userImport->counter));
|
$this->session->flash(t('%d user(s) have been imported successfully.', $this->userImport->counter));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->session->flashError(t('Nothing have been imported!'));
|
$this->session->flashError(t('Nothing have been imported!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ class Csv
|
|||||||
{
|
{
|
||||||
if (! empty($value)) {
|
if (! empty($value)) {
|
||||||
$value = trim(strtolower($value));
|
$value = trim(strtolower($value));
|
||||||
return $value === '1' || $value{0} === 't' ? 1 : 0;
|
return $value === '1' || $value{0}
|
||||||
|
=== 't' ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -187,8 +188,7 @@ class Csv
|
|||||||
foreach ($this->columns as $sql_name => $csv_name) {
|
foreach ($this->columns as $sql_name => $csv_name) {
|
||||||
if (isset($row[$index])) {
|
if (isset($row[$index])) {
|
||||||
$line[$sql_name] = $row[$index];
|
$line[$sql_name] = $row[$index];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$line[$sql_name] = '';
|
$line[$sql_name] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -214,8 +214,7 @@ class DateParser extends Base
|
|||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
if (! empty($values[$field])) {
|
if (! empty($values[$field])) {
|
||||||
$values[$field] = date($format, $values[$field]);
|
$values[$field] = date($format, $values[$field]);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$values[$field] = '';
|
$values[$field] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,8 +131,7 @@ class HttpClient extends Base
|
|||||||
|
|
||||||
if (is_resource($stream)) {
|
if (is_resource($stream)) {
|
||||||
$response = stream_get_contents($stream);
|
$response = stream_get_contents($stream);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->container['logger']->error('HttpClient: request failed');
|
$this->container['logger']->error('HttpClient: request failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ class Lexer
|
|||||||
$this->offset = 0;
|
$this->offset = 0;
|
||||||
|
|
||||||
while (isset($input[$this->offset])) {
|
while (isset($input[$this->offset])) {
|
||||||
|
|
||||||
$result = $this->match(substr($input, $this->offset));
|
$result = $this->match(substr($input, $this->offset));
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
@@ -84,7 +83,6 @@ class Lexer
|
|||||||
{
|
{
|
||||||
foreach ($this->tokenMap as $pattern => $name) {
|
foreach ($this->tokenMap as $pattern => $name) {
|
||||||
if (preg_match($pattern, $string, $matches)) {
|
if (preg_match($pattern, $string, $matches)) {
|
||||||
|
|
||||||
$this->offset += strlen($matches[1]);
|
$this->offset += strlen($matches[1]);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
@@ -113,7 +111,6 @@ class Lexer
|
|||||||
);
|
);
|
||||||
|
|
||||||
while (false !== ($token = current($tokens))) {
|
while (false !== ($token = current($tokens))) {
|
||||||
|
|
||||||
switch ($token['token']) {
|
switch ($token['token']) {
|
||||||
case 'T_ASSIGNEE':
|
case 'T_ASSIGNEE':
|
||||||
case 'T_COLOR':
|
case 'T_COLOR':
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ class Mail extends Base implements ClientInterface
|
|||||||
public function sendEmail($email, $name, $subject, $html, $author)
|
public function sendEmail($email, $name, $subject, $html, $author)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$message = Swift_Message::newInstance()
|
$message = Swift_Message::newInstance()
|
||||||
->setSubject($subject)
|
->setSubject($subject)
|
||||||
->setFrom(array(MAIL_FROM => $author))
|
->setFrom(array(MAIL_FROM => $author))
|
||||||
@@ -38,8 +37,7 @@ class Mail extends Base implements ClientInterface
|
|||||||
->setTo(array($email => $name));
|
->setTo(array($email => $name));
|
||||||
|
|
||||||
Swift_Mailer::newInstance($this->getTransport())->send($message);
|
Swift_Mailer::newInstance($this->getTransport())->send($message);
|
||||||
}
|
} catch (Swift_TransportException $e) {
|
||||||
catch (Swift_TransportException $e) {
|
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ class Markdown extends Parsedown
|
|||||||
{
|
{
|
||||||
// Replace task #123 by a link to the task
|
// Replace task #123 by a link to the task
|
||||||
if (! empty($this->link) && preg_match('!#(\d+)!i', $Excerpt['text'], $matches)) {
|
if (! empty($this->link) && preg_match('!#(\d+)!i', $Excerpt['text'], $matches)) {
|
||||||
|
|
||||||
$url = $this->helper->href(
|
$url = $this->helper->href(
|
||||||
$this->link['controller'],
|
$this->link['controller'],
|
||||||
$this->link['action'],
|
$this->link['action'],
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ class OAuth2 extends Base
|
|||||||
public function getAccessToken($code)
|
public function getAccessToken($code)
|
||||||
{
|
{
|
||||||
if (empty($this->accessToken) && ! empty($code)) {
|
if (empty($this->accessToken) && ! empty($code)) {
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'code' => $code,
|
'code' => $code,
|
||||||
'client_id' => $this->clientId,
|
'client_id' => $this->clientId,
|
||||||
|
|||||||
@@ -355,8 +355,7 @@ class Paginator
|
|||||||
$this->action,
|
$this->action,
|
||||||
$this->getUrlParams($this->page - 1, $this->order, $this->direction)
|
$this->getUrlParams($this->page - 1, $this->order, $this->direction)
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$html .= '← '.t('Previous');
|
$html .= '← '.t('Previous');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,8 +381,7 @@ class Paginator
|
|||||||
$this->action,
|
$this->action,
|
||||||
$this->getUrlParams($this->page + 1, $this->order, $this->direction)
|
$this->getUrlParams($this->page + 1, $this->order, $this->direction)
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$html .= t('Next').' →';
|
$html .= t('Next').' →';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ class Loader extends \Kanboard\Core\Base
|
|||||||
$current_version = $this->getSchemaVersion($plugin);
|
$current_version = $this->getSchemaVersion($plugin);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$this->db->startTransaction();
|
$this->db->startTransaction();
|
||||||
$this->db->getDriver()->disableForeignKeys();
|
$this->db->getDriver()->disableForeignKeys();
|
||||||
|
|
||||||
@@ -109,8 +108,7 @@ class Loader extends \Kanboard\Core\Base
|
|||||||
$this->db->getDriver()->enableForeignKeys();
|
$this->db->getDriver()->enableForeignKeys();
|
||||||
$this->db->closeTransaction();
|
$this->db->closeTransaction();
|
||||||
$this->setSchemaVersion($plugin, $i - 1);
|
$this->setSchemaVersion($plugin, $i - 1);
|
||||||
}
|
} catch (PDOException $e) {
|
||||||
catch (PDOException $e) {
|
|
||||||
$this->db->cancelTransaction();
|
$this->db->cancelTransaction();
|
||||||
$this->db->getDriver()->enableForeignKeys();
|
$this->db->getDriver()->enableForeignKeys();
|
||||||
die('Unable to migrate schema for the plugin: '.$plugin.' => '.$e->getMessage());
|
die('Unable to migrate schema for the plugin: '.$plugin.' => '.$e->getMessage());
|
||||||
|
|||||||
@@ -218,11 +218,8 @@ class Request
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
|
|
||||||
if (isset($_SERVER[$key])) {
|
if (isset($_SERVER[$key])) {
|
||||||
|
|
||||||
foreach (explode(',', $_SERVER[$key]) as $ip_address) {
|
foreach (explode(',', $_SERVER[$key]) as $ip_address) {
|
||||||
|
|
||||||
$ip_address = trim($ip_address);
|
$ip_address = trim($ip_address);
|
||||||
|
|
||||||
if ($only_public) {
|
if ($only_public) {
|
||||||
@@ -231,9 +228,7 @@ class Request
|
|||||||
if (filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) {
|
if (filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) {
|
||||||
return $ip_address;
|
return $ip_address;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
return $ip_address;
|
return $ip_address;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,8 +68,7 @@ class Response
|
|||||||
{
|
{
|
||||||
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') {
|
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') {
|
||||||
header('X-Ajax-Redirect: '.$url);
|
header('X-Ajax-Redirect: '.$url);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
header('Location: '.$url);
|
header('Location: '.$url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,17 +127,13 @@ class Router extends Base
|
|||||||
$count = count($parts);
|
$count = count($parts);
|
||||||
|
|
||||||
foreach ($this->paths as $route) {
|
foreach ($this->paths as $route) {
|
||||||
|
|
||||||
if ($count === $route['count']) {
|
if ($count === $route['count']) {
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
|
||||||
if ($route['pattern'][$i]{0} === ':') {
|
if ($route['pattern'][$i]{0} === ':') {
|
||||||
$params[substr($route['pattern'][$i], 1)] = $parts[$i];
|
$params[substr($route['pattern'][$i], 1)] = $parts[$i];
|
||||||
}
|
} elseif ($route['pattern'][$i] !== $parts[$i]) {
|
||||||
else if ($route['pattern'][$i] !== $parts[$i]) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,7 +164,6 @@ class Router extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->urls[$controller][$action] as $pattern) {
|
foreach ($this->urls[$controller][$action] as $pattern) {
|
||||||
|
|
||||||
if (array_diff_key($params, $pattern['params']) === array()) {
|
if (array_diff_key($params, $pattern['params']) === array()) {
|
||||||
$url = $pattern['path'];
|
$url = $pattern['path'];
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@@ -213,8 +208,7 @@ class Router extends Base
|
|||||||
$this->controller = $this->sanitize($_GET['controller'], 'app');
|
$this->controller = $this->sanitize($_GET['controller'], 'app');
|
||||||
$this->action = $this->sanitize($_GET['action'], 'index');
|
$this->action = $this->sanitize($_GET['action'], 'index');
|
||||||
$plugin = ! empty($_GET['plugin']) ? $this->sanitize($_GET['plugin'], '') : '';
|
$plugin = ! empty($_GET['plugin']) ? $this->sanitize($_GET['plugin'], '') : '';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
list($this->controller, $this->action) = $this->findRoute($this->getPath($uri, $query_string)); // TODO: add plugin for routes
|
list($this->controller, $this->action) = $this->findRoute($this->getPath($uri, $query_string)); // TODO: add plugin for routes
|
||||||
$plugin = '';
|
$plugin = '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ class Security
|
|||||||
{
|
{
|
||||||
if (function_exists('openssl_random_pseudo_bytes')) {
|
if (function_exists('openssl_random_pseudo_bytes')) {
|
||||||
return bin2hex(\openssl_random_pseudo_bytes(30));
|
return bin2hex(\openssl_random_pseudo_bytes(30));
|
||||||
}
|
} elseif (ini_get('open_basedir') === '' && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||||
else if (ini_get('open_basedir') === '' && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
|
||||||
return hash('sha256', file_get_contents('/dev/urandom', false, null, 0, 30));
|
return hash('sha256', file_get_contents('/dev/urandom', false, null, 0, 30));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,8 +85,7 @@ class Template extends Helper
|
|||||||
if (strpos($template_name, ':') !== false) {
|
if (strpos($template_name, ':') !== false) {
|
||||||
list($plugin, $template) = explode(':', $template_name);
|
list($plugin, $template) = explode(':', $template_name);
|
||||||
$path = __DIR__.'/../../plugins/'.ucfirst($plugin).'/Template/'.$template.'.php';
|
$path = __DIR__.'/../../plugins/'.ucfirst($plugin).'/Template/'.$template.'.php';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$path = __DIR__.'/../Template/'.$template_name.'.php';
|
$path = __DIR__.'/../Template/'.$template_name.'.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,14 +83,11 @@ class Tool
|
|||||||
$dst_width = $resize_width;
|
$dst_width = $resize_width;
|
||||||
$dst_height = floor($src_height * ($resize_width / $src_width));
|
$dst_height = floor($src_height * ($resize_width / $src_width));
|
||||||
$dst_image = imagecreatetruecolor($dst_width, $dst_height);
|
$dst_image = imagecreatetruecolor($dst_width, $dst_height);
|
||||||
}
|
} elseif ($resize_width == 0 && $resize_height > 0) {
|
||||||
elseif ($resize_width == 0 && $resize_height > 0) {
|
|
||||||
$dst_width = floor($src_width * ($resize_height / $src_height));
|
$dst_width = floor($src_width * ($resize_height / $src_height));
|
||||||
$dst_height = $resize_height;
|
$dst_height = $resize_height;
|
||||||
$dst_image = imagecreatetruecolor($dst_width, $dst_height);
|
$dst_image = imagecreatetruecolor($dst_width, $dst_height);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
$src_ratio = $src_width / $src_height;
|
$src_ratio = $src_width / $src_height;
|
||||||
$resize_ratio = $resize_width / $resize_height;
|
$resize_ratio = $resize_width / $resize_height;
|
||||||
|
|
||||||
@@ -99,8 +96,7 @@ class Tool
|
|||||||
$dst_height = floor($src_height * ($resize_width / $src_width));
|
$dst_height = floor($src_height * ($resize_width / $src_width));
|
||||||
|
|
||||||
$dst_y = ($dst_height - $resize_height) / 2 * (-1);
|
$dst_y = ($dst_height - $resize_height) / 2 * (-1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$dst_width = floor($src_width * ($resize_height / $src_height));
|
$dst_width = floor($src_width * ($resize_height / $src_height));
|
||||||
$dst_height = $resize_height;
|
$dst_height = $resize_height;
|
||||||
|
|
||||||
|
|||||||
@@ -184,8 +184,7 @@ class Translator
|
|||||||
{
|
{
|
||||||
if (isset(self::$locales[$identifier])) {
|
if (isset(self::$locales[$identifier])) {
|
||||||
return self::$locales[$identifier];
|
return self::$locales[$identifier];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,7 @@ class ProjectGanttFormatter extends Project implements FormatterInterface
|
|||||||
{
|
{
|
||||||
if (empty($project_ids)) {
|
if (empty($project_ids)) {
|
||||||
$this->projects = array();
|
$this->projects = array();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
$this->projects = $this->db
|
$this->projects = $this->db
|
||||||
->table(self::TABLE)
|
->table(self::TABLE)
|
||||||
->asc('start_date')
|
->asc('start_date')
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ class TaskFilterICalendarFormatter extends TaskFilterCalendarEvent implements Fo
|
|||||||
public function addDateTimeEvents()
|
public function addDateTimeEvents()
|
||||||
{
|
{
|
||||||
foreach ($this->query->findAll() as $task) {
|
foreach ($this->query->findAll() as $task) {
|
||||||
|
|
||||||
$start = new DateTime;
|
$start = new DateTime;
|
||||||
$start->setTimestamp($task[$this->startColumn]);
|
$start->setTimestamp($task[$this->startColumn]);
|
||||||
|
|
||||||
@@ -82,7 +81,6 @@ class TaskFilterICalendarFormatter extends TaskFilterCalendarEvent implements Fo
|
|||||||
public function addFullDayEvents()
|
public function addFullDayEvents()
|
||||||
{
|
{
|
||||||
foreach ($this->query->findAll() as $task) {
|
foreach ($this->query->findAll() as $task) {
|
||||||
|
|
||||||
$date = new DateTime;
|
$date = new DateTime;
|
||||||
$date->setTimestamp($task[$this->startColumn]);
|
$date->setTimestamp($task[$this->startColumn]);
|
||||||
|
|
||||||
|
|||||||
@@ -68,8 +68,7 @@ class App extends \Kanboard\Core\Base
|
|||||||
$html = '<div class="alert alert-success alert-fade-out">'.$this->helper->e($this->session['flash_message']).'</div>';
|
$html = '<div class="alert alert-success alert-fade-out">'.$this->helper->e($this->session['flash_message']).'</div>';
|
||||||
unset($this->session['flash_message']);
|
unset($this->session['flash_message']);
|
||||||
unset($this->session['flash_error_message']);
|
unset($this->session['flash_error_message']);
|
||||||
}
|
} elseif (isset($this->session['flash_error_message'])) {
|
||||||
else if (isset($this->session['flash_error_message'])) {
|
|
||||||
$html = '<div class="alert alert-error">'.$this->helper->e($this->session['flash_error_message']).'</div>';
|
$html = '<div class="alert alert-error">'.$this->helper->e($this->session['flash_error_message']).'</div>';
|
||||||
unset($this->session['flash_message']);
|
unset($this->session['flash_message']);
|
||||||
unset($this->session['flash_error_message']);
|
unset($this->session['flash_error_message']);
|
||||||
|
|||||||
@@ -52,11 +52,9 @@ class Dt extends \Kanboard\Core\Base
|
|||||||
}
|
}
|
||||||
if ($diff < 1200) {
|
if ($diff < 1200) {
|
||||||
return t('<30m');
|
return t('<30m');
|
||||||
}
|
} elseif ($diff < 3600) {
|
||||||
else if ($diff < 3600) {
|
|
||||||
return t('<1h');
|
return t('<1h');
|
||||||
}
|
} elseif ($diff < 86400) {
|
||||||
else if ($diff < 86400) {
|
|
||||||
return '~'.t('%dh', $diff / 3600);
|
return '~'.t('%dh', $diff / 3600);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ class File extends \Kanboard\Core\Base
|
|||||||
* @param string $filename Filename
|
* @param string $filename Filename
|
||||||
* @return string Font-Awesome-Icon-Name
|
* @return string Font-Awesome-Icon-Name
|
||||||
*/
|
*/
|
||||||
public function icon($filename){
|
public function icon($filename)
|
||||||
|
{
|
||||||
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||||
|
|
||||||
switch ($extension) {
|
switch ($extension) {
|
||||||
|
|||||||
@@ -52,11 +52,14 @@ class Form extends \Kanboard\Core\Base
|
|||||||
$html = '<select name="'.$name.'" id="form-'.$name.'" class="'.$class.'" '.implode(' ', $attributes).'>';
|
$html = '<select name="'.$name.'" id="form-'.$name.'" class="'.$class.'" '.implode(' ', $attributes).'>';
|
||||||
|
|
||||||
foreach ($options as $id => $value) {
|
foreach ($options as $id => $value) {
|
||||||
|
|
||||||
$html .= '<option value="'.$this->helper->e($id).'"';
|
$html .= '<option value="'.$this->helper->e($id).'"';
|
||||||
|
|
||||||
if (isset($values->$name) && $id == $values->$name) $html .= ' selected="selected"';
|
if (isset($values->$name) && $id == $values->$name) {
|
||||||
if (isset($values[$name]) && $id == $values[$name]) $html .= ' selected="selected"';
|
$html .= ' selected="selected"';
|
||||||
|
}
|
||||||
|
if (isset($values[$name]) && $id == $values[$name]) {
|
||||||
|
$html .= ' selected="selected"';
|
||||||
|
}
|
||||||
|
|
||||||
$html .= '>'.$this->helper->e($value).'</option>';
|
$html .= '>'.$this->helper->e($value).'</option>';
|
||||||
}
|
}
|
||||||
@@ -328,7 +331,6 @@ class Form extends \Kanboard\Core\Base
|
|||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
if (isset($errors[$name])) {
|
if (isset($errors[$name])) {
|
||||||
|
|
||||||
$html .= '<ul class="form-errors">';
|
$html .= '<ul class="form-errors">';
|
||||||
|
|
||||||
foreach ($errors[$name] as $error) {
|
foreach ($errors[$name] as $error) {
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class Subtask extends \Kanboard\Core\Base
|
|||||||
public function toggleStatus(array $subtask, $redirect)
|
public function toggleStatus(array $subtask, $redirect)
|
||||||
{
|
{
|
||||||
if ($subtask['status'] == 0 && isset($this->session['has_subtask_inprogress']) && $this->session['has_subtask_inprogress'] === true) {
|
if ($subtask['status'] == 0 && isset($this->session['has_subtask_inprogress']) && $this->session['has_subtask_inprogress'] === true) {
|
||||||
|
|
||||||
return $this->helper->url->link(
|
return $this->helper->url->link(
|
||||||
trim($this->template->render('subtask/icons', array('subtask' => $subtask))) . $this->helper->e($subtask['title']),
|
trim($this->template->render('subtask/icons', array('subtask' => $subtask))) . $this->helper->e($subtask['title']),
|
||||||
'subtask',
|
'subtask',
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ class BitbucketWebhook extends \Kanboard\Core\Base
|
|||||||
$task = $this->taskFinder->getByReference($this->project_id, $payload['issue']['id']);
|
$task = $this->taskFinder->getByReference($this->project_id, $payload['issue']['id']);
|
||||||
|
|
||||||
if (! empty($task)) {
|
if (! empty($task)) {
|
||||||
|
|
||||||
$user = $this->user->getByUsername($payload['actor']['username']);
|
$user = $this->user->getByUsername($payload['actor']['username']);
|
||||||
|
|
||||||
if (! empty($user) && ! $this->projectPermission->isMember($this->project_id, $user['id'])) {
|
if (! empty($user) && ! $this->projectPermission->isMember($this->project_id, $user['id'])) {
|
||||||
@@ -147,8 +146,7 @@ class BitbucketWebhook extends \Kanboard\Core\Base
|
|||||||
|
|
||||||
if (isset($payload['changes']['status'])) {
|
if (isset($payload['changes']['status'])) {
|
||||||
return $this->handleStatusChange($task, $payload);
|
return $this->handleStatusChange($task, $payload);
|
||||||
}
|
} elseif (isset($payload['changes']['assignee'])) {
|
||||||
else if (isset($payload['changes']['assignee'])) {
|
|
||||||
return $this->handleAssigneeChange($task, $payload);
|
return $this->handleAssigneeChange($task, $payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ class GithubWebhook extends \Kanboard\Core\Base
|
|||||||
public function parsePushEvent(array $payload)
|
public function parsePushEvent(array $payload)
|
||||||
{
|
{
|
||||||
foreach ($payload['commits'] as $commit) {
|
foreach ($payload['commits'] as $commit) {
|
||||||
|
|
||||||
$task_id = $this->task->getTaskIdFromText($commit['message']);
|
$task_id = $this->task->getTaskIdFromText($commit['message']);
|
||||||
|
|
||||||
if (empty($task_id)) {
|
if (empty($task_id)) {
|
||||||
@@ -149,7 +148,6 @@ class GithubWebhook extends \Kanboard\Core\Base
|
|||||||
$task = $this->taskFinder->getByReference($this->project_id, $payload['issue']['number']);
|
$task = $this->taskFinder->getByReference($this->project_id, $payload['issue']['number']);
|
||||||
|
|
||||||
if (! empty($task)) {
|
if (! empty($task)) {
|
||||||
|
|
||||||
$user = $this->user->getByUsername($payload['comment']['user']['login']);
|
$user = $this->user->getByUsername($payload['comment']['user']['login']);
|
||||||
|
|
||||||
if (! empty($user) && ! $this->projectPermission->isMember($this->project_id, $user['id'])) {
|
if (! empty($user) && ! $this->projectPermission->isMember($this->project_id, $user['id'])) {
|
||||||
@@ -270,7 +268,6 @@ class GithubWebhook extends \Kanboard\Core\Base
|
|||||||
$task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
|
$task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
|
||||||
|
|
||||||
if (! empty($user) && ! empty($task) && $this->projectPermission->isMember($this->project_id, $user['id'])) {
|
if (! empty($user) && ! empty($task) && $this->projectPermission->isMember($this->project_id, $user['id'])) {
|
||||||
|
|
||||||
$event = array(
|
$event = array(
|
||||||
'project_id' => $this->project_id,
|
'project_id' => $this->project_id,
|
||||||
'task_id' => $task['id'],
|
'task_id' => $task['id'],
|
||||||
@@ -301,7 +298,6 @@ class GithubWebhook extends \Kanboard\Core\Base
|
|||||||
$task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
|
$task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
|
||||||
|
|
||||||
if (! empty($task)) {
|
if (! empty($task)) {
|
||||||
|
|
||||||
$event = array(
|
$event = array(
|
||||||
'project_id' => $this->project_id,
|
'project_id' => $this->project_id,
|
||||||
'task_id' => $task['id'],
|
'task_id' => $task['id'],
|
||||||
@@ -333,7 +329,6 @@ class GithubWebhook extends \Kanboard\Core\Base
|
|||||||
$task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
|
$task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
|
||||||
|
|
||||||
if (! empty($task)) {
|
if (! empty($task)) {
|
||||||
|
|
||||||
$event = array(
|
$event = array(
|
||||||
'project_id' => $this->project_id,
|
'project_id' => $this->project_id,
|
||||||
'task_id' => $task['id'],
|
'task_id' => $task['id'],
|
||||||
@@ -365,7 +360,6 @@ class GithubWebhook extends \Kanboard\Core\Base
|
|||||||
$task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
|
$task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
|
||||||
|
|
||||||
if (! empty($task)) {
|
if (! empty($task)) {
|
||||||
|
|
||||||
$event = array(
|
$event = array(
|
||||||
'project_id' => $this->project_id,
|
'project_id' => $this->project_id,
|
||||||
'task_id' => $task['id'],
|
'task_id' => $task['id'],
|
||||||
|
|||||||
@@ -239,7 +239,6 @@ class GitlabWebhook extends \Kanboard\Core\Base
|
|||||||
$task = $this->taskFinder->getByReference($this->project_id, $payload['issue']['id']);
|
$task = $this->taskFinder->getByReference($this->project_id, $payload['issue']['id']);
|
||||||
|
|
||||||
if (! empty($task)) {
|
if (! empty($task)) {
|
||||||
|
|
||||||
$user = $this->user->getByUsername($payload['user']['username']);
|
$user = $this->user->getByUsername($payload['user']['username']);
|
||||||
|
|
||||||
if (! empty($user) && ! $this->projectPermission->isMember($this->project_id, $user['id'])) {
|
if (! empty($user) && ! $this->projectPermission->isMember($this->project_id, $user['id'])) {
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ class HipchatWebhook extends \Kanboard\Core\Base
|
|||||||
public function notify($project_id, $task_id, $event_name, array $event)
|
public function notify($project_id, $task_id, $event_name, array $event)
|
||||||
{
|
{
|
||||||
if ($this->isActivated($project_id)) {
|
if ($this->isActivated($project_id)) {
|
||||||
|
|
||||||
$params = $this->getParameters($project_id);
|
$params = $this->getParameters($project_id);
|
||||||
$project = $this->project->getbyId($project_id);
|
$project = $this->project->getbyId($project_id);
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ class Jabber extends \Kanboard\Core\Base
|
|||||||
public function notify($project_id, $task_id, $event_name, array $event)
|
public function notify($project_id, $task_id, $event_name, array $event)
|
||||||
{
|
{
|
||||||
if ($this->isActivated($project_id)) {
|
if ($this->isActivated($project_id)) {
|
||||||
|
|
||||||
$project = $this->project->getbyId($project_id);
|
$project = $this->project->getbyId($project_id);
|
||||||
|
|
||||||
$event['event_name'] = $event_name;
|
$event['event_name'] = $event_name;
|
||||||
@@ -98,7 +97,6 @@ class Jabber extends \Kanboard\Core\Base
|
|||||||
public function sendMessage($project_id, $payload)
|
public function sendMessage($project_id, $payload)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$params = $this->getParameters($project_id);
|
$params = $this->getParameters($project_id);
|
||||||
|
|
||||||
$options = new Options($params['server']);
|
$options = new Options($params['server']);
|
||||||
@@ -121,8 +119,7 @@ class Jabber extends \Kanboard\Core\Base
|
|||||||
$client->send($message);
|
$client->send($message);
|
||||||
|
|
||||||
$client->disconnect();
|
$client->disconnect();
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
$this->container['logger']->error('Jabber error: '.$e->getMessage());
|
$this->container['logger']->error('Jabber error: '.$e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ class SlackWebhook extends \Kanboard\Core\Base
|
|||||||
public function notify($project_id, $task_id, $event_name, array $event)
|
public function notify($project_id, $task_id, $event_name, array $event)
|
||||||
{
|
{
|
||||||
if ($this->isActivated($project_id)) {
|
if ($this->isActivated($project_id)) {
|
||||||
|
|
||||||
$project = $this->project->getbyId($project_id);
|
$project = $this->project->getbyId($project_id);
|
||||||
|
|
||||||
$event['event_name'] = $event_name;
|
$event['event_name'] = $event_name;
|
||||||
|
|||||||
@@ -8,16 +8,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('PASSWORD_BCRYPT')) {
|
if (!defined('PASSWORD_BCRYPT')) {
|
||||||
|
|
||||||
define('PASSWORD_BCRYPT', 1);
|
define('PASSWORD_BCRYPT', 1);
|
||||||
define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
|
define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
|
||||||
|
|
||||||
if (version_compare(PHP_VERSION, '5.3.7', '<')) {
|
if (version_compare(PHP_VERSION, '5.3.7', '<')) {
|
||||||
|
|
||||||
define('PASSWORD_PREFIX', '$2a$');
|
define('PASSWORD_PREFIX', '$2a$');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
define('PASSWORD_PREFIX', '$2y$');
|
define('PASSWORD_PREFIX', '$2y$');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +26,8 @@ if (!defined('PASSWORD_BCRYPT')) {
|
|||||||
*
|
*
|
||||||
* @return string|false The hashed password, or false on error.
|
* @return string|false The hashed password, or false on error.
|
||||||
*/
|
*/
|
||||||
function password_hash($password, $algo, array $options = array()) {
|
function password_hash($password, $algo, array $options = array())
|
||||||
|
{
|
||||||
if (!function_exists('crypt')) {
|
if (!function_exists('crypt')) {
|
||||||
trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
|
trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
|
||||||
return null;
|
return null;
|
||||||
@@ -126,7 +123,6 @@ if (!defined('PASSWORD_BCRYPT')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$salt = str_replace('+', '.', base64_encode($buffer));
|
$salt = str_replace('+', '.', base64_encode($buffer));
|
||||||
|
|
||||||
}
|
}
|
||||||
$salt = substr($salt, 0, $required_salt_len);
|
$salt = substr($salt, 0, $required_salt_len);
|
||||||
|
|
||||||
@@ -157,7 +153,8 @@ if (!defined('PASSWORD_BCRYPT')) {
|
|||||||
*
|
*
|
||||||
* @return array The array of information about the hash.
|
* @return array The array of information about the hash.
|
||||||
*/
|
*/
|
||||||
function password_get_info($hash) {
|
function password_get_info($hash)
|
||||||
|
{
|
||||||
$return = array(
|
$return = array(
|
||||||
'algo' => 0,
|
'algo' => 0,
|
||||||
'algoName' => 'unknown',
|
'algoName' => 'unknown',
|
||||||
@@ -183,7 +180,8 @@ if (!defined('PASSWORD_BCRYPT')) {
|
|||||||
*
|
*
|
||||||
* @return boolean True if the password needs to be rehashed.
|
* @return boolean True if the password needs to be rehashed.
|
||||||
*/
|
*/
|
||||||
function password_needs_rehash($hash, $algo, array $options = array()) {
|
function password_needs_rehash($hash, $algo, array $options = array())
|
||||||
|
{
|
||||||
$info = password_get_info($hash);
|
$info = password_get_info($hash);
|
||||||
if ($info['algo'] != $algo) {
|
if ($info['algo'] != $algo) {
|
||||||
return true;
|
return true;
|
||||||
@@ -207,7 +205,8 @@ if (!defined('PASSWORD_BCRYPT')) {
|
|||||||
*
|
*
|
||||||
* @return boolean If the password matches the hash
|
* @return boolean If the password matches the hash
|
||||||
*/
|
*/
|
||||||
function password_verify($password, $hash) {
|
function password_verify($password, $hash)
|
||||||
|
{
|
||||||
if (!function_exists('crypt')) {
|
if (!function_exists('crypt')) {
|
||||||
trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
|
trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -184,7 +184,6 @@ class Action extends Base
|
|||||||
$params = $this->db->table(self::TABLE_PARAMS)->findAll();
|
$params = $this->db->table(self::TABLE_PARAMS)->findAll();
|
||||||
|
|
||||||
foreach ($actions as &$action) {
|
foreach ($actions as &$action) {
|
||||||
|
|
||||||
$action['params'] = array();
|
$action['params'] = array();
|
||||||
|
|
||||||
foreach ($params as $param) {
|
foreach ($params as $param) {
|
||||||
@@ -270,7 +269,6 @@ class Action extends Base
|
|||||||
$action_id = $this->db->getLastId();
|
$action_id = $this->db->getLastId();
|
||||||
|
|
||||||
foreach ($values['params'] as $param_name => $param_value) {
|
foreach ($values['params'] as $param_name => $param_value) {
|
||||||
|
|
||||||
$action_param = array(
|
$action_param = array(
|
||||||
'action_id' => $action_id,
|
'action_id' => $action_id,
|
||||||
'name' => $param_name,
|
'name' => $param_name,
|
||||||
@@ -298,7 +296,6 @@ class Action extends Base
|
|||||||
$actions = $this->getAll();
|
$actions = $this->getAll();
|
||||||
|
|
||||||
foreach ($actions as $action) {
|
foreach ($actions as $action) {
|
||||||
|
|
||||||
$listener = $this->load($action['action_name'], $action['project_id'], $action['event_name']);
|
$listener = $this->load($action['action_name'], $action['project_id'], $action['event_name']);
|
||||||
|
|
||||||
foreach ($action['params'] as $param) {
|
foreach ($action['params'] as $param) {
|
||||||
@@ -320,7 +317,8 @@ class Action extends Base
|
|||||||
*/
|
*/
|
||||||
public function load($name, $project_id, $event)
|
public function load($name, $project_id, $event)
|
||||||
{
|
{
|
||||||
$className = $name{0} !== '\\' ? '\Kanboard\Action\\'.$name : $name;
|
$className = $name{0}
|
||||||
|
!== '\\' ? '\Kanboard\Action\\'.$name : $name;
|
||||||
return new $className($this->container, $project_id, $event);
|
return new $className($this->container, $project_id, $event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,7 +335,6 @@ class Action extends Base
|
|||||||
$actions = $this->action->getAllByProject($src_project_id);
|
$actions = $this->action->getAllByProject($src_project_id);
|
||||||
|
|
||||||
foreach ($actions as $action) {
|
foreach ($actions as $action) {
|
||||||
|
|
||||||
$this->db->startTransaction();
|
$this->db->startTransaction();
|
||||||
|
|
||||||
$values = array(
|
$values = array(
|
||||||
@@ -378,7 +375,6 @@ class Action extends Base
|
|||||||
public function duplicateParameters($project_id, $action_id, array $params)
|
public function duplicateParameters($project_id, $action_id, array $params)
|
||||||
{
|
{
|
||||||
foreach ($params as $param) {
|
foreach ($params as $param) {
|
||||||
|
|
||||||
$value = $this->resolveParameters($param, $project_id);
|
$value = $this->resolveParameters($param, $project_id);
|
||||||
|
|
||||||
if ($value === false) {
|
if ($value === false) {
|
||||||
|
|||||||
@@ -79,12 +79,10 @@ class Authentication extends Base
|
|||||||
if ($this->user->isLocked($username)) {
|
if ($this->user->isLocked($username)) {
|
||||||
$this->container['logger']->error('Account locked: '.$username);
|
$this->container['logger']->error('Account locked: '.$username);
|
||||||
return false;
|
return false;
|
||||||
}
|
} elseif ($this->backend('database')->authenticate($username, $password)) {
|
||||||
else if ($this->backend('database')->authenticate($username, $password)) {
|
|
||||||
$this->user->resetFailedLogin($username);
|
$this->user->resetFailedLogin($username);
|
||||||
return true;
|
return true;
|
||||||
}
|
} elseif (LDAP_AUTH && $this->backend('ldap')->authenticate($username, $password)) {
|
||||||
else if (LDAP_AUTH && $this->backend('ldap')->authenticate($username, $password)) {
|
|
||||||
$this->user->resetFailedLogin($username);
|
$this->user->resetFailedLogin($username);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -133,11 +131,9 @@ class Authentication extends Base
|
|||||||
list($result, $errors) = $this->validateFormCredentials($values);
|
list($result, $errors) = $this->validateFormCredentials($values);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
||||||
if ($this->validateFormCaptcha($values) && $this->authenticate($values['username'], $values['password'])) {
|
if ($this->validateFormCaptcha($values) && $this->authenticate($values['username'], $values['password'])) {
|
||||||
$this->createRememberMeSession($values);
|
$this->createRememberMeSession($values);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$result = false;
|
$result = false;
|
||||||
$errors['login'] = t('Bad username or password');
|
$errors['login'] = t('Bad username or password');
|
||||||
}
|
}
|
||||||
@@ -194,7 +190,6 @@ class Authentication extends Base
|
|||||||
private function createRememberMeSession(array $values)
|
private function createRememberMeSession(array $values)
|
||||||
{
|
{
|
||||||
if (REMEMBER_ME_AUTH && ! empty($values['remember_me'])) {
|
if (REMEMBER_ME_AUTH && ! empty($values['remember_me'])) {
|
||||||
|
|
||||||
$credentials = $this->backend('rememberMe')
|
$credentials = $this->backend('rememberMe')
|
||||||
->create($this->userSession->getId(), Request::getIpAddress(), Request::getUserAgent());
|
->create($this->userSession->getId(), Request::getIpAddress(), Request::getUserAgent());
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ class Board extends Base
|
|||||||
$columns = array();
|
$columns = array();
|
||||||
|
|
||||||
foreach ($column_names as $column_name) {
|
foreach ($column_names as $column_name) {
|
||||||
|
|
||||||
$column_name = trim($column_name);
|
$column_name = trim($column_name);
|
||||||
|
|
||||||
if (! empty($column_name)) {
|
if (! empty($column_name)) {
|
||||||
@@ -67,7 +66,6 @@ class Board extends Base
|
|||||||
$position = 0;
|
$position = 0;
|
||||||
|
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
|
|
||||||
$values = array(
|
$values = array(
|
||||||
'title' => $column['title'],
|
'title' => $column['title'],
|
||||||
'position' => ++$position,
|
'position' => ++$position,
|
||||||
@@ -199,7 +197,6 @@ class Board extends Base
|
|||||||
$positions = array_flip($columns);
|
$positions = array_flip($columns);
|
||||||
|
|
||||||
if (isset($columns[$column_id]) && $columns[$column_id] < count($columns)) {
|
if (isset($columns[$column_id]) && $columns[$column_id] < count($columns)) {
|
||||||
|
|
||||||
$position = ++$columns[$column_id];
|
$position = ++$columns[$column_id];
|
||||||
$columns[$positions[$position]]--;
|
$columns[$positions[$position]]--;
|
||||||
|
|
||||||
@@ -223,7 +220,6 @@ class Board extends Base
|
|||||||
$positions = array_flip($columns);
|
$positions = array_flip($columns);
|
||||||
|
|
||||||
if (isset($columns[$column_id]) && $columns[$column_id] > 1) {
|
if (isset($columns[$column_id]) && $columns[$column_id] > 1) {
|
||||||
|
|
||||||
$position = --$columns[$column_id];
|
$position = --$columns[$column_id];
|
||||||
$columns[$positions[$position]]++;
|
$columns[$positions[$position]]++;
|
||||||
|
|
||||||
@@ -248,14 +244,12 @@ class Board extends Base
|
|||||||
$nb_columns = count($columns);
|
$nb_columns = count($columns);
|
||||||
|
|
||||||
for ($i = 0, $ilen = count($swimlanes); $i < $ilen; $i++) {
|
for ($i = 0, $ilen = count($swimlanes); $i < $ilen; $i++) {
|
||||||
|
|
||||||
$swimlanes[$i]['columns'] = $columns;
|
$swimlanes[$i]['columns'] = $columns;
|
||||||
$swimlanes[$i]['nb_columns'] = $nb_columns;
|
$swimlanes[$i]['nb_columns'] = $nb_columns;
|
||||||
$swimlanes[$i]['nb_tasks'] = 0;
|
$swimlanes[$i]['nb_tasks'] = 0;
|
||||||
$swimlanes[$i]['nb_swimlanes'] = $ilen;
|
$swimlanes[$i]['nb_swimlanes'] = $ilen;
|
||||||
|
|
||||||
for ($j = 0; $j < $nb_columns; $j++) {
|
for ($j = 0; $j < $nb_columns; $j++) {
|
||||||
|
|
||||||
$column_id = $columns[$j]['id'];
|
$column_id = $columns[$j]['id'];
|
||||||
$swimlane_id = $swimlanes[$i]['id'];
|
$swimlane_id = $swimlanes[$i]['id'];
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,6 @@ class Category extends Base
|
|||||||
$categories = explode(',', $this->config->get('project_categories'));
|
$categories = explode(',', $this->config->get('project_categories'));
|
||||||
|
|
||||||
foreach ($categories as $category) {
|
foreach ($categories as $category) {
|
||||||
|
|
||||||
$category = trim($category);
|
$category = trim($category);
|
||||||
|
|
||||||
if (! empty($category)) {
|
if (! empty($category)) {
|
||||||
@@ -204,7 +203,6 @@ class Category extends Base
|
|||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
foreach ($categories as $category) {
|
foreach ($categories as $category) {
|
||||||
|
|
||||||
$category['project_id'] = $dst_project_id;
|
$category['project_id'] = $dst_project_id;
|
||||||
|
|
||||||
if (! $this->db->table(self::TABLE)->save($category)) {
|
if (! $this->db->table(self::TABLE)->save($category)) {
|
||||||
|
|||||||
@@ -113,8 +113,7 @@ class Color extends Base
|
|||||||
foreach ($this->default_colors as $color_id => $params) {
|
foreach ($this->default_colors as $color_id => $params) {
|
||||||
if ($color_id === $color) {
|
if ($color_id === $color) {
|
||||||
return $color_id;
|
return $color_id;
|
||||||
}
|
} elseif ($color === strtolower($params['name'])) {
|
||||||
else if ($color === strtolower($params['name'])) {
|
|
||||||
return $color_id;
|
return $color_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ class File extends Base
|
|||||||
public function remove($file_id)
|
public function remove($file_id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$file = $this->getbyId($file_id);
|
$file = $this->getbyId($file_id);
|
||||||
$this->objectStorage->remove($file['path']);
|
$this->objectStorage->remove($file['path']);
|
||||||
|
|
||||||
@@ -59,8 +58,7 @@ class File extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->db->table(self::TABLE)->eq('id', $file['id'])->remove();
|
return $this->db->table(self::TABLE)->eq('id', $file['id'])->remove();
|
||||||
}
|
} catch (ObjectStorageException $e) {
|
||||||
catch (ObjectStorageException $e) {
|
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -108,7 +106,6 @@ class File extends Base
|
|||||||
));
|
));
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
||||||
$this->container['dispatcher']->dispatch(
|
$this->container['dispatcher']->dispatch(
|
||||||
self::EVENT_CREATE,
|
self::EVENT_CREATE,
|
||||||
new FileEvent(array('task_id' => $task_id, 'name' => $name))
|
new FileEvent(array('task_id' => $task_id, 'name' => $name))
|
||||||
@@ -266,15 +263,12 @@ class File extends Base
|
|||||||
public function uploadFiles($project_id, $task_id, $form_name)
|
public function uploadFiles($project_id, $task_id, $form_name)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (empty($_FILES[$form_name])) {
|
if (empty($_FILES[$form_name])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($_FILES[$form_name]['error'] as $key => $error) {
|
foreach ($_FILES[$form_name]['error'] as $key => $error) {
|
||||||
|
|
||||||
if ($error == UPLOAD_ERR_OK && $_FILES[$form_name]['size'][$key] > 0) {
|
if ($error == UPLOAD_ERR_OK && $_FILES[$form_name]['size'][$key] > 0) {
|
||||||
|
|
||||||
$original_filename = $_FILES[$form_name]['name'][$key];
|
$original_filename = $_FILES[$form_name]['name'][$key];
|
||||||
$uploaded_filename = $_FILES[$form_name]['tmp_name'][$key];
|
$uploaded_filename = $_FILES[$form_name]['tmp_name'][$key];
|
||||||
$destination_filename = $this->generatePath($project_id, $task_id, $original_filename);
|
$destination_filename = $this->generatePath($project_id, $task_id, $original_filename);
|
||||||
@@ -295,8 +289,7 @@ class File extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (ObjectStorageException $e) {
|
||||||
catch (ObjectStorageException $e) {
|
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -330,7 +323,6 @@ class File extends Base
|
|||||||
public function uploadContent($project_id, $task_id, $original_filename, $blob)
|
public function uploadContent($project_id, $task_id, $original_filename, $blob)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$data = base64_decode($blob);
|
$data = base64_decode($blob);
|
||||||
|
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
@@ -350,8 +342,7 @@ class File extends Base
|
|||||||
$destination_filename,
|
$destination_filename,
|
||||||
strlen($data)
|
strlen($data)
|
||||||
);
|
);
|
||||||
}
|
} catch (ObjectStorageException $e) {
|
||||||
catch (ObjectStorageException $e) {
|
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ class LastLogin extends Base
|
|||||||
->findAllByColumn('id');
|
->findAllByColumn('id');
|
||||||
|
|
||||||
if (count($connections) >= self::NB_LOGINS) {
|
if (count($connections) >= self::NB_LOGINS) {
|
||||||
|
|
||||||
$this->db->table(self::TABLE)
|
$this->db->table(self::TABLE)
|
||||||
->eq('user_id', $user_id)
|
->eq('user_id', $user_id)
|
||||||
->notin('id', array_slice($connections, 0, self::NB_LOGINS - 1))
|
->notin('id', array_slice($connections, 0, self::NB_LOGINS - 1))
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ class Link extends Base
|
|||||||
$label_id = $this->db->getLastId();
|
$label_id = $this->db->getLastId();
|
||||||
|
|
||||||
if (! empty($opposite_label)) {
|
if (! empty($opposite_label)) {
|
||||||
|
|
||||||
$this->db
|
$this->db
|
||||||
->table(self::TABLE)
|
->table(self::TABLE)
|
||||||
->insert(array(
|
->insert(array(
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ class ProjectActivity extends Base
|
|||||||
$events = $query->findAll();
|
$events = $query->findAll();
|
||||||
|
|
||||||
foreach ($events as &$event) {
|
foreach ($events as &$event) {
|
||||||
|
|
||||||
$event += $this->decode($event['data']);
|
$event += $this->decode($event['data']);
|
||||||
unset($event['data']);
|
unset($event['data']);
|
||||||
|
|
||||||
@@ -170,7 +169,6 @@ class ProjectActivity extends Base
|
|||||||
public function cleanup($max)
|
public function cleanup($max)
|
||||||
{
|
{
|
||||||
if ($this->db->table(self::TABLE)->count() > $max) {
|
if ($this->db->table(self::TABLE)->count() > $max) {
|
||||||
|
|
||||||
$this->db->execute('
|
$this->db->execute('
|
||||||
DELETE FROM '.self::TABLE.'
|
DELETE FROM '.self::TABLE.'
|
||||||
WHERE id <= (
|
WHERE id <= (
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ class ProjectAnalytic extends Base
|
|||||||
$columns = $this->board->getColumns($project_id);
|
$columns = $this->board->getColumns($project_id);
|
||||||
|
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
|
|
||||||
$nb_tasks = $this->taskFinder->countByColumnId($project_id, $column['id']);
|
$nb_tasks = $this->taskFinder->countByColumnId($project_id, $column['id']);
|
||||||
$total += $nb_tasks;
|
$total += $nb_tasks;
|
||||||
|
|
||||||
@@ -60,7 +59,6 @@ class ProjectAnalytic extends Base
|
|||||||
$users = $this->projectPermission->getMemberList($project_id);
|
$users = $this->projectPermission->getMemberList($project_id);
|
||||||
|
|
||||||
foreach ($tasks as $task) {
|
foreach ($tasks as $task) {
|
||||||
|
|
||||||
$user = isset($users[$task['owner_id']]) ? $users[$task['owner_id']] : $users[0];
|
$user = isset($users[$task['owner_id']]) ? $users[$task['owner_id']] : $users[0];
|
||||||
$total++;
|
$total++;
|
||||||
|
|
||||||
|
|||||||
@@ -171,7 +171,6 @@ class ProjectDailyColumnStats extends Base
|
|||||||
|
|
||||||
// Aggregate by day
|
// Aggregate by day
|
||||||
foreach ($records as $record) {
|
foreach ($records as $record) {
|
||||||
|
|
||||||
if (! isset($aggregates[$record['day']])) {
|
if (! isset($aggregates[$record['day']])) {
|
||||||
$aggregates[$record['day']] = array($record['day']);
|
$aggregates[$record['day']] = array($record['day']);
|
||||||
}
|
}
|
||||||
@@ -181,7 +180,6 @@ class ProjectDailyColumnStats extends Base
|
|||||||
|
|
||||||
// Aggregate by row
|
// Aggregate by row
|
||||||
foreach ($aggregates as $aggregate) {
|
foreach ($aggregates as $aggregate) {
|
||||||
|
|
||||||
$row = array($aggregate[0]);
|
$row = array($aggregate[0]);
|
||||||
|
|
||||||
foreach ($column_ids as $column_id) {
|
foreach ($column_ids as $column_id) {
|
||||||
|
|||||||
@@ -439,7 +439,6 @@ class ProjectPermission extends Base
|
|||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
|
|
||||||
$result = $this->db
|
$result = $this->db
|
||||||
->table(self::TABLE)
|
->table(self::TABLE)
|
||||||
->save(array(
|
->save(array(
|
||||||
|
|||||||
@@ -148,7 +148,6 @@ class Subtask extends Base
|
|||||||
public function getById($subtask_id, $more = false)
|
public function getById($subtask_id, $more = false)
|
||||||
{
|
{
|
||||||
if ($more) {
|
if ($more) {
|
||||||
|
|
||||||
return $this->db
|
return $this->db
|
||||||
->table(self::TABLE)
|
->table(self::TABLE)
|
||||||
->eq(self::TABLE.'.id', $subtask_id)
|
->eq(self::TABLE.'.id', $subtask_id)
|
||||||
@@ -341,7 +340,6 @@ class Subtask extends Base
|
|||||||
$positions = array_flip($subtasks);
|
$positions = array_flip($subtasks);
|
||||||
|
|
||||||
if (isset($subtasks[$subtask_id]) && $subtasks[$subtask_id] > 1) {
|
if (isset($subtasks[$subtask_id]) && $subtasks[$subtask_id] > 1) {
|
||||||
|
|
||||||
$position = --$subtasks[$subtask_id];
|
$position = --$subtasks[$subtask_id];
|
||||||
$subtasks[$positions[$position]]++;
|
$subtasks[$positions[$position]]++;
|
||||||
|
|
||||||
@@ -446,7 +444,6 @@ class Subtask extends Base
|
|||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
foreach ($subtasks as &$subtask) {
|
foreach ($subtasks as &$subtask) {
|
||||||
|
|
||||||
$subtask['task_id'] = $dst_task_id;
|
$subtask['task_id'] = $dst_task_id;
|
||||||
|
|
||||||
if (! $db->table(Subtask::TABLE)->save($subtask)) {
|
if (! $db->table(Subtask::TABLE)->save($subtask)) {
|
||||||
|
|||||||
@@ -214,7 +214,6 @@ class SubtaskTimeTracking extends Base
|
|||||||
$events = array();
|
$events = array();
|
||||||
|
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
|
|
||||||
$user = isset($row['username']) ? ' ('.($row['user_fullname'] ?: $row['username']).')' : '';
|
$user = isset($row['username']) ? ' ('.($row['user_fullname'] ?: $row['username']).')' : '';
|
||||||
|
|
||||||
$events[] = array(
|
$events[] = array(
|
||||||
|
|||||||
@@ -142,8 +142,7 @@ class Swimlane extends Base
|
|||||||
|
|
||||||
if ($status == self::ACTIVE) {
|
if ($status == self::ACTIVE) {
|
||||||
$query->asc('position');
|
$query->asc('position');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$query->asc('name');
|
$query->asc('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +171,6 @@ class Swimlane extends Base
|
|||||||
->findOneColumn('default_swimlane');
|
->findOneColumn('default_swimlane');
|
||||||
|
|
||||||
if ($default_swimlane) {
|
if ($default_swimlane) {
|
||||||
|
|
||||||
if ($default_swimlane === 'Default swimlane') {
|
if ($default_swimlane === 'Default swimlane') {
|
||||||
$default_swimlane = t($default_swimlane);
|
$default_swimlane = t($default_swimlane);
|
||||||
}
|
}
|
||||||
@@ -396,7 +394,6 @@ class Swimlane extends Base
|
|||||||
$positions = array_flip($swimlanes);
|
$positions = array_flip($swimlanes);
|
||||||
|
|
||||||
if (isset($swimlanes[$swimlane_id]) && $swimlanes[$swimlane_id] < count($swimlanes)) {
|
if (isset($swimlanes[$swimlane_id]) && $swimlanes[$swimlane_id] < count($swimlanes)) {
|
||||||
|
|
||||||
$position = ++$swimlanes[$swimlane_id];
|
$position = ++$swimlanes[$swimlane_id];
|
||||||
$swimlanes[$positions[$position]]--;
|
$swimlanes[$positions[$position]]--;
|
||||||
|
|
||||||
@@ -430,7 +427,6 @@ class Swimlane extends Base
|
|||||||
$positions = array_flip($swimlanes);
|
$positions = array_flip($swimlanes);
|
||||||
|
|
||||||
if (isset($swimlanes[$swimlane_id]) && $swimlanes[$swimlane_id] > 1) {
|
if (isset($swimlanes[$swimlane_id]) && $swimlanes[$swimlane_id] > 1) {
|
||||||
|
|
||||||
$position = --$swimlanes[$swimlane_id];
|
$position = --$swimlanes[$swimlane_id];
|
||||||
$swimlanes[$positions[$position]]++;
|
$swimlanes[$positions[$position]]++;
|
||||||
|
|
||||||
@@ -459,7 +455,6 @@ class Swimlane extends Base
|
|||||||
$swimlanes = $this->getAll($project_from);
|
$swimlanes = $this->getAll($project_from);
|
||||||
|
|
||||||
foreach ($swimlanes as $swimlane) {
|
foreach ($swimlanes as $swimlane) {
|
||||||
|
|
||||||
unset($swimlane['id']);
|
unset($swimlane['id']);
|
||||||
$swimlane['project_id'] = $project_to;
|
$swimlane['project_id'] = $project_to;
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ class TaskAnalytic extends Base
|
|||||||
$sums = $this->transition->getTimeSpentByTask($task['id']);
|
$sums = $this->transition->getTimeSpentByTask($task['id']);
|
||||||
|
|
||||||
foreach ($columns as $column_id => $column_title) {
|
foreach ($columns as $column_id => $column_title) {
|
||||||
|
|
||||||
$time_spent = isset($sums[$column_id]) ? $sums[$column_id] : 0;
|
$time_spent = isset($sums[$column_id]) ? $sums[$column_id] : 0;
|
||||||
|
|
||||||
if ($task['column_id'] == $column_id) {
|
if ($task['column_id'] == $column_id) {
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ class TaskCreation extends Base
|
|||||||
$task_id = $this->persist(Task::TABLE, $values);
|
$task_id = $this->persist(Task::TABLE, $values);
|
||||||
|
|
||||||
if ($task_id !== false) {
|
if ($task_id !== false) {
|
||||||
|
|
||||||
if ($position > 0 && $values['position'] > 1) {
|
if ($position > 0 && $values['position'] > 1) {
|
||||||
$this->taskPosition->movePosition($values['project_id'], $task_id, $values['column_id'], $position, $values['swimlane_id'], false);
|
$this->taskPosition->movePosition($values['project_id'], $task_id, $values['column_id'], $position, $values['swimlane_id'], false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ class TaskDuplication extends Base
|
|||||||
$values = $this->copyFields($task_id);
|
$values = $this->copyFields($task_id);
|
||||||
|
|
||||||
if ($values['recurrence_status'] == Task::RECURRING_STATUS_PENDING) {
|
if ($values['recurrence_status'] == Task::RECURRING_STATUS_PENDING) {
|
||||||
|
|
||||||
$values['recurrence_parent'] = $task_id;
|
$values['recurrence_parent'] = $task_id;
|
||||||
$values['column_id'] = $this->board->getFirstColumn($values['project_id']);
|
$values['column_id'] = $this->board->getFirstColumn($values['project_id']);
|
||||||
$this->calculateRecurringTaskDueDate($values);
|
$this->calculateRecurringTaskDueDate($values);
|
||||||
@@ -71,7 +70,6 @@ class TaskDuplication extends Base
|
|||||||
$recurring_task_id = $this->save($task_id, $values);
|
$recurring_task_id = $this->save($task_id, $values);
|
||||||
|
|
||||||
if ($recurring_task_id > 0) {
|
if ($recurring_task_id > 0) {
|
||||||
|
|
||||||
$parent_update = $this->db
|
$parent_update = $this->db
|
||||||
->table(Task::TABLE)
|
->table(Task::TABLE)
|
||||||
->eq('id', $task_id)
|
->eq('id', $task_id)
|
||||||
@@ -203,7 +201,6 @@ class TaskDuplication extends Base
|
|||||||
public function calculateRecurringTaskDueDate(array &$values)
|
public function calculateRecurringTaskDueDate(array &$values)
|
||||||
{
|
{
|
||||||
if (! empty($values['date_due']) && $values['recurrence_factor'] != 0) {
|
if (! empty($values['date_due']) && $values['recurrence_factor'] != 0) {
|
||||||
|
|
||||||
if ($values['recurrence_basedate'] == Task::RECURRING_BASEDATE_TRIGGERDATE) {
|
if ($values['recurrence_basedate'] == Task::RECURRING_BASEDATE_TRIGGERDATE) {
|
||||||
$values['date_due'] = time();
|
$values['date_due'] = time();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,8 +193,7 @@ class TaskFilter extends Base
|
|||||||
$this->query->eq(Task::TABLE.'.id', str_replace('#', '', $title));
|
$this->query->eq(Task::TABLE.'.id', str_replace('#', '', $title));
|
||||||
$this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
|
$this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
|
||||||
$this->query->closeOr();
|
$this->query->closeOr();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
|
$this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,8 +243,7 @@ class TaskFilter extends Base
|
|||||||
foreach ($values as $project) {
|
foreach ($values as $project) {
|
||||||
if (ctype_digit($project)) {
|
if (ctype_digit($project)) {
|
||||||
$this->query->eq(Task::TABLE.'.project_id', $project);
|
$this->query->eq(Task::TABLE.'.project_id', $project);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->query->ilike(Project::TABLE.'.name', $project);
|
$this->query->ilike(Project::TABLE.'.name', $project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,8 +265,7 @@ class TaskFilter extends Base
|
|||||||
foreach ($values as $swimlane) {
|
foreach ($values as $swimlane) {
|
||||||
if ($swimlane === 'default') {
|
if ($swimlane === 'default') {
|
||||||
$this->query->eq(Task::TABLE.'.swimlane_id', 0);
|
$this->query->eq(Task::TABLE.'.swimlane_id', 0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->query->ilike(Swimlane::TABLE.'.name', $swimlane);
|
$this->query->ilike(Swimlane::TABLE.'.name', $swimlane);
|
||||||
$this->query->addCondition(Task::TABLE.'.swimlane_id=0 AND '.Project::TABLE.'.default_swimlane '.$this->db->getDriver()->getOperator('ILIKE')." '$swimlane'");
|
$this->query->addCondition(Task::TABLE.'.swimlane_id=0 AND '.Project::TABLE.'.default_swimlane '.$this->db->getDriver()->getOperator('ILIKE')." '$swimlane'");
|
||||||
}
|
}
|
||||||
@@ -307,8 +304,7 @@ class TaskFilter extends Base
|
|||||||
foreach ($values as $category) {
|
foreach ($values as $category) {
|
||||||
if ($category === 'none') {
|
if ($category === 'none') {
|
||||||
$this->query->eq(Task::TABLE.'.category_id', 0);
|
$this->query->eq(Task::TABLE.'.category_id', 0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->query->eq(Category::TABLE.'.name', $category);
|
$this->query->eq(Category::TABLE.'.name', $category);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -379,8 +375,7 @@ class TaskFilter extends Base
|
|||||||
foreach ($values as $assignee) {
|
foreach ($values as $assignee) {
|
||||||
if ($assignee === 'me') {
|
if ($assignee === 'me') {
|
||||||
$subtaskQuery->eq(Subtask::TABLE.'.user_id', $this->userSession->getId());
|
$subtaskQuery->eq(Subtask::TABLE.'.user_id', $this->userSession->getId());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$subtaskQuery->ilike(User::TABLE.'.username', '%'.$assignee.'%');
|
$subtaskQuery->ilike(User::TABLE.'.username', '%'.$assignee.'%');
|
||||||
$subtaskQuery->ilike(User::TABLE.'.name', '%'.$assignee.'%');
|
$subtaskQuery->ilike(User::TABLE.'.name', '%'.$assignee.'%');
|
||||||
}
|
}
|
||||||
@@ -682,8 +677,7 @@ class TaskFilter extends Base
|
|||||||
$timestamp = $this->dateParser->getTimestampFromIsoFormat($value);
|
$timestamp = $this->dateParser->getTimestampFromIsoFormat($value);
|
||||||
$this->query->gte($field, $timestamp);
|
$this->query->gte($field, $timestamp);
|
||||||
$this->query->lte($field, $timestamp + 86399);
|
$this->query->lte($field, $timestamp + 86399);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->query->eq($field, $value);
|
$this->query->eq($field, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,12 +71,10 @@ class TaskImport extends Base
|
|||||||
if ($this->taskCreation->create($row) > 0) {
|
if ($this->taskCreation->create($row) > 0) {
|
||||||
$this->logger->debug('TaskImport: imported successfully line '.$line_number);
|
$this->logger->debug('TaskImport: imported successfully line '.$line_number);
|
||||||
$this->counter++;
|
$this->counter++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->logger->error('TaskImport: creation error at line '.$line_number);
|
$this->logger->error('TaskImport: creation error at line '.$line_number);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->logger->error('TaskImport: validation error at line '.$line_number);
|
$this->logger->error('TaskImport: validation error at line '.$line_number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ class TaskLink extends Base
|
|||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
|
|
||||||
if (! isset($result[$link['label']])) {
|
if (! isset($result[$link['label']])) {
|
||||||
$result[$link['label']] = array();
|
$result[$link['label']] = array();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ class TaskModification extends Base
|
|||||||
|
|
||||||
if ($this->isFieldModified('owner_id', $event_data['changes'])) {
|
if ($this->isFieldModified('owner_id', $event_data['changes'])) {
|
||||||
$events[] = Task::EVENT_ASSIGNEE_CHANGE;
|
$events[] = Task::EVENT_ASSIGNEE_CHANGE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$events[] = Task::EVENT_CREATE_UPDATE;
|
$events[] = Task::EVENT_CREATE_UPDATE;
|
||||||
$events[] = Task::EVENT_UPDATE;
|
$events[] = Task::EVENT_UPDATE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ class TaskPermission extends Base
|
|||||||
{
|
{
|
||||||
if ($this->userSession->isAdmin() || $this->projectPermission->isManager($task['project_id'], $this->userSession->getId())) {
|
if ($this->userSession->isAdmin() || $this->projectPermission->isManager($task['project_id'], $this->userSession->getId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} elseif (isset($task['creator_id']) && $task['creator_id'] == $this->userSession->getId()) {
|
||||||
else if (isset($task['creator_id']) && $task['creator_id'] == $this->userSession->getId()) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,11 +41,9 @@ class TaskPosition extends Base
|
|||||||
|
|
||||||
if ($task['swimlane_id'] != $swimlane_id) {
|
if ($task['swimlane_id'] != $swimlane_id) {
|
||||||
$result = $this->saveSwimlaneChange($project_id, $task_id, $position, $task['column_id'], $column_id, $task['swimlane_id'], $swimlane_id);
|
$result = $this->saveSwimlaneChange($project_id, $task_id, $position, $task['column_id'], $column_id, $task['swimlane_id'], $swimlane_id);
|
||||||
}
|
} elseif ($task['column_id'] != $column_id) {
|
||||||
else if ($task['column_id'] != $column_id) {
|
|
||||||
$result = $this->saveColumnChange($project_id, $task_id, $position, $swimlane_id, $task['column_id'], $column_id);
|
$result = $this->saveColumnChange($project_id, $task_id, $position, $swimlane_id, $task['column_id'], $column_id);
|
||||||
}
|
} elseif ($task['position'] != $position) {
|
||||||
else if ($task['position'] != $position) {
|
|
||||||
$result = $this->savePositionChange($project_id, $task_id, $position, $column_id, $swimlane_id);
|
$result = $this->savePositionChange($project_id, $task_id, $position, $column_id, $swimlane_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,11 +222,9 @@ class TaskPosition extends Base
|
|||||||
|
|
||||||
if ($task['swimlane_id'] != $new_swimlane_id) {
|
if ($task['swimlane_id'] != $new_swimlane_id) {
|
||||||
$this->container['dispatcher']->dispatch(Task::EVENT_MOVE_SWIMLANE, new TaskEvent($event_data));
|
$this->container['dispatcher']->dispatch(Task::EVENT_MOVE_SWIMLANE, new TaskEvent($event_data));
|
||||||
}
|
} elseif ($task['column_id'] != $new_column_id) {
|
||||||
else if ($task['column_id'] != $new_column_id) {
|
|
||||||
$this->container['dispatcher']->dispatch(Task::EVENT_MOVE_COLUMN, new TaskEvent($event_data));
|
$this->container['dispatcher']->dispatch(Task::EVENT_MOVE_COLUMN, new TaskEvent($event_data));
|
||||||
}
|
} elseif ($task['position'] != $new_position) {
|
||||||
else if ($task['position'] != $new_position) {
|
|
||||||
$this->container['dispatcher']->dispatch(Task::EVENT_MOVE_POSITION, new TaskEvent($event_data));
|
$this->container['dispatcher']->dispatch(Task::EVENT_MOVE_POSITION, new TaskEvent($event_data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,11 +280,9 @@ class User extends Base
|
|||||||
public function prepare(array &$values)
|
public function prepare(array &$values)
|
||||||
{
|
{
|
||||||
if (isset($values['password'])) {
|
if (isset($values['password'])) {
|
||||||
|
|
||||||
if (! empty($values['password'])) {
|
if (! empty($values['password'])) {
|
||||||
$values['password'] = \password_hash($values['password'], PASSWORD_BCRYPT);
|
$values['password'] = \password_hash($values['password'], PASSWORD_BCRYPT);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
unset($values['password']);
|
unset($values['password']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -516,8 +514,7 @@ class User extends Base
|
|||||||
|
|
||||||
if (isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1) {
|
if (isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1) {
|
||||||
$v = new Validator($values, array_merge($rules, $this->commonValidationRules()));
|
$v = new Validator($values, array_merge($rules, $this->commonValidationRules()));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$v = new Validator($values, array_merge($rules, $this->commonValidationRules(), $this->commonPasswordValidationRules()));
|
$v = new Validator($values, array_merge($rules, $this->commonValidationRules(), $this->commonPasswordValidationRules()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -591,8 +588,7 @@ class User extends Base
|
|||||||
// Check password
|
// Check password
|
||||||
if ($this->authentication->authenticate($this->session['user']['username'], $values['current_password'])) {
|
if ($this->authentication->authenticate($this->session['user']['username'], $values['current_password'])) {
|
||||||
return array(true, array());
|
return array(true, array());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return array(false, array('current_password' => array(t('Wrong password'))));
|
return array(false, array('current_password' => array(t('Wrong password'))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,12 +56,10 @@ class UserImport extends Base
|
|||||||
if ($this->user->create($row)) {
|
if ($this->user->create($row)) {
|
||||||
$this->logger->debug('UserImport: imported successfully line '.$line_number);
|
$this->logger->debug('UserImport: imported successfully line '.$line_number);
|
||||||
$this->counter++;
|
$this->counter++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->logger->error('UserImport: creation error at line '.$line_number);
|
$this->logger->error('UserImport: creation error at line '.$line_number);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->logger->error('UserImport: validation error at line '.$line_number);
|
$this->logger->error('UserImport: validation error at line '.$line_number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ class UserNotification extends Base
|
|||||||
// Use the user language otherwise use the application language (do not use the session language)
|
// Use the user language otherwise use the application language (do not use the session language)
|
||||||
if (! empty($user['language'])) {
|
if (! empty($user['language'])) {
|
||||||
Translator::load($user['language']);
|
Translator::load($user['language']);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Translator::load($this->config->get('application_language', 'en_US'));
|
Translator::load($this->config->get('application_language', 'en_US'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,8 +122,7 @@ class UserNotification extends Base
|
|||||||
$this->userNotificationFilter->saveFilter($user_id, $filter);
|
$this->userNotificationFilter->saveFilter($user_id, $filter);
|
||||||
$this->userNotificationFilter->saveSelectedProjects($user_id, $projects);
|
$this->userNotificationFilter->saveSelectedProjects($user_id, $projects);
|
||||||
$this->userNotificationType->saveSelectedTypes($user_id, $types);
|
$this->userNotificationType->saveSelectedTypes($user_id, $types);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->disableNotification($user_id);
|
$this->disableNotification($user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,9 @@ class Webhook extends Base
|
|||||||
$token = $this->config->get('webhook_token');
|
$token = $this->config->get('webhook_token');
|
||||||
|
|
||||||
if (! empty($url)) {
|
if (! empty($url)) {
|
||||||
|
|
||||||
if (strpos($url, '?') !== false) {
|
if (strpos($url, '?') !== false) {
|
||||||
$url .= '&token='.$token;
|
$url .= '&token='.$token;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$url .= '?token='.$token;
|
$url .= '?token='.$token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user