Helpers refactoring
This commit is contained in:
@@ -90,7 +90,7 @@ class App extends Base
|
||||
$this->response->html('<p>'.t('Nothing to preview...').'</p>');
|
||||
}
|
||||
|
||||
$this->response->html($this->template->markdown($payload['text']));
|
||||
$this->response->html($this->helper->text->markdown($payload['text']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ class Auth extends Base
|
||||
public function login(array $values = array(), array $errors = array())
|
||||
{
|
||||
if ($this->userSession->isLogged()) {
|
||||
$this->response->redirect($this->helper->url('app', 'index'));
|
||||
$this->response->redirect($this->helper->url->to('app', 'index'));
|
||||
}
|
||||
|
||||
$this->response->html($this->template->layout('auth/index', array(
|
||||
@@ -47,7 +47,7 @@ class Auth extends Base
|
||||
$this->response->redirect('?'.urldecode($redirect_query));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('app', 'index'));
|
||||
$this->response->redirect($this->helper->url->to('app', 'index'));
|
||||
}
|
||||
|
||||
$this->login($values, $errors);
|
||||
@@ -62,6 +62,6 @@ class Auth extends Base
|
||||
{
|
||||
$this->authentication->backend('rememberMe')->destroy($this->userSession->getId());
|
||||
$this->session->close();
|
||||
$this->response->redirect($this->helper->url('auth', 'login'));
|
||||
$this->response->redirect($this->helper->url->to('auth', 'login'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,67 +16,8 @@ use Symfony\Component\EventDispatcher\Event;
|
||||
*
|
||||
* @package controller
|
||||
* @author Frederic Guillot
|
||||
*
|
||||
* @property \Core\Helper $helper
|
||||
* @property \Core\Session $session
|
||||
* @property \Core\Template $template
|
||||
* @property \Core\Paginator $paginator
|
||||
* @property \Integration\GithubWebhook $githubWebhook
|
||||
* @property \Integration\GitlabWebhook $gitlabWebhook
|
||||
* @property \Integration\BitbucketWebhook $bitbucketWebhook
|
||||
* @property \Integration\PostmarkWebhook $postmarkWebhook
|
||||
* @property \Integration\SendgridWebhook $sendgridWebhook
|
||||
* @property \Integration\MailgunWebhook $mailgunWebhook
|
||||
* @property \Model\Acl $acl
|
||||
* @property \Model\Authentication $authentication
|
||||
* @property \Model\Action $action
|
||||
* @property \Model\Board $board
|
||||
* @property \Model\Category $category
|
||||
* @property \Model\Color $color
|
||||
* @property \Model\Comment $comment
|
||||
* @property \Model\Config $config
|
||||
* @property \Model\DateParser $dateParser
|
||||
* @property \Model\File $file
|
||||
* @property \Model\HourlyRate $hourlyRate
|
||||
* @property \Model\LastLogin $lastLogin
|
||||
* @property \Model\Notification $notification
|
||||
* @property \Model\Project $project
|
||||
* @property \Model\ProjectPermission $projectPermission
|
||||
* @property \Model\ProjectDuplication $projectDuplication
|
||||
* @property \Model\ProjectAnalytic $projectAnalytic
|
||||
* @property \Model\ProjectActivity $projectActivity
|
||||
* @property \Model\ProjectDailySummary $projectDailySummary
|
||||
* @property \Model\ProjectIntegration $projectIntegration
|
||||
* @property \Model\Subtask $subtask
|
||||
* @property \Model\SubtaskForecast $subtaskForecast
|
||||
* @property \Model\Swimlane $swimlane
|
||||
* @property \Model\Task $task
|
||||
* @property \Model\Link $link
|
||||
* @property \Model\TaskCreation $taskCreation
|
||||
* @property \Model\TaskModification $taskModification
|
||||
* @property \Model\TaskDuplication $taskDuplication
|
||||
* @property \Model\TaskHistory $taskHistory
|
||||
* @property \Model\TaskExport $taskExport
|
||||
* @property \Model\TaskFinder $taskFinder
|
||||
* @property \Model\TaskFilter $taskFilter
|
||||
* @property \Model\TaskPosition $taskPosition
|
||||
* @property \Model\TaskPermission $taskPermission
|
||||
* @property \Model\TaskStatus $taskStatus
|
||||
* @property \Model\Timetable $timetable
|
||||
* @property \Model\TimetableDay $timetableDay
|
||||
* @property \Model\TimetableWeek $timetableWeek
|
||||
* @property \Model\TimetableExtra $timetableExtra
|
||||
* @property \Model\TimetableOff $timetableOff
|
||||
* @property \Model\TaskValidator $taskValidator
|
||||
* @property \Model\TaskLink $taskLink
|
||||
* @property \Model\CommentHistory $commentHistory
|
||||
* @property \Model\SubtaskHistory $subtaskHistory
|
||||
* @property \Model\SubtaskTimeTracking $subtaskTimeTracking
|
||||
* @property \Model\User $user
|
||||
* @property \Model\UserSession $userSession
|
||||
* @property \Model\Webhook $webhook
|
||||
*/
|
||||
abstract class Base
|
||||
abstract class Base extends \Core\Base
|
||||
{
|
||||
/**
|
||||
* Request instance
|
||||
@@ -94,14 +35,6 @@ abstract class Base
|
||||
*/
|
||||
protected $response;
|
||||
|
||||
/**
|
||||
* Container instance
|
||||
*
|
||||
* @access private
|
||||
* @var \Pimple\Container
|
||||
*/
|
||||
private $container;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -133,18 +66,6 @@ abstract class Base
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load automatically models
|
||||
*
|
||||
* @access public
|
||||
* @param string $name Model name
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
return $this->container[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send HTTP headers
|
||||
*
|
||||
@@ -201,7 +122,7 @@ abstract class Base
|
||||
$this->response->text('Not Authorized', 401);
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('auth', 'login', array('redirect_query' => urlencode($this->request->getQueryString()))));
|
||||
$this->response->redirect($this->helper->url->to('auth', 'login', array('redirect_query' => urlencode($this->request->getQueryString()))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +141,7 @@ abstract class Base
|
||||
$this->response->text('Not Authorized', 401);
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('twofactor', 'code'));
|
||||
$this->response->redirect($this->helper->url->to('twofactor', 'code'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ class Board extends Base
|
||||
$this->session->flashError(t('Unable to update your task.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('board', 'show', array('project_id' => $values['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id'])));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -333,7 +333,7 @@ class Board extends Base
|
||||
$this->session->flashError(t('Unable to update your task.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('board', 'show', array('project_id' => $values['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id'])));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -88,7 +88,7 @@ class Budget extends Base
|
||||
|
||||
if ($this->budget->create($values['project_id'], $values['amount'], $values['comment'], $values['date'])) {
|
||||
$this->session->flash(t('The budget line have been created successfully.'));
|
||||
$this->response->redirect($this->helper->url('budget', 'create', array('project_id' => $project['id'])));
|
||||
$this->response->redirect($this->helper->url->to('budget', 'create', array('project_id' => $project['id'])));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to create the budget line.'));
|
||||
@@ -130,6 +130,6 @@ class Budget extends Base
|
||||
$this->session->flashError(t('Unable to remove this budget line.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('budget', 'create', array('project_id' => $project['id'])));
|
||||
$this->response->redirect($this->helper->url->to('budget', 'create', array('project_id' => $project['id'])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class Column extends Base
|
||||
|
||||
if ($this->board->addColumn($project['id'], $data['title'], $data['task_limit'], $data['description'])) {
|
||||
$this->session->flash(t('Board updated successfully.'));
|
||||
$this->response->redirect($this->helper->url('column', 'index', array('project_id' => $project['id'])));
|
||||
$this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to update this board.'));
|
||||
@@ -102,7 +102,7 @@ class Column extends Base
|
||||
|
||||
if ($this->board->updateColumn($values['id'], $values['title'], $values['task_limit'], $values['description'])) {
|
||||
$this->session->flash(t('Board updated successfully.'));
|
||||
$this->response->redirect($this->helper->url('column', 'index', array('project_id' => $project['id'])));
|
||||
$this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to update this board.'));
|
||||
@@ -128,7 +128,7 @@ class Column extends Base
|
||||
$this->board->{'move'.$direction}($project['id'], $column_id);
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('column', 'index', array('project_id' => $project['id'])));
|
||||
$this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,6 +165,6 @@ class Column extends Base
|
||||
$this->session->flashError(t('Unable to remove this column.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('column', 'index', array('project_id' => $project['id'])));
|
||||
$this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class Currency extends Base
|
||||
|
||||
if ($this->currency->create($values['currency'], $values['rate'])) {
|
||||
$this->session->flash(t('The currency rate have been added successfully.'));
|
||||
$this->response->redirect($this->helper->url('currency', 'index'));
|
||||
$this->response->redirect($this->helper->url->to('currency', 'index'));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to add this currency rate.'));
|
||||
@@ -84,6 +84,6 @@ class Currency extends Base
|
||||
$this->session->flashError(t('Unable to save your settings.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('currency', 'index'));
|
||||
$this->response->redirect($this->helper->url->to('currency', 'index'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ class File extends Base
|
||||
$this->session->flash(t('Screenshot uploaded successfully.'));
|
||||
|
||||
if ($this->request->getStringParam('redirect') === 'board') {
|
||||
$this->response->redirect($this->helper->url('board', 'show', array('project_id' => $task['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
}
|
||||
|
||||
$this->response->html($this->taskLayout('file/screenshot', array(
|
||||
@@ -64,7 +64,7 @@ class File extends Base
|
||||
$this->session->flashError(t('Unable to upload the file.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +83,7 @@ class File extends Base
|
||||
$this->response->binary(file_get_contents($filename));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,7 +164,7 @@ class File extends Base
|
||||
$this->session->flashError(t('Unable to remove this file.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,7 +42,7 @@ class Hourlyrate extends User
|
||||
|
||||
if ($this->hourlyRate->create($values['user_id'], $values['rate'], $values['currency'], $values['date_effective'])) {
|
||||
$this->session->flash(t('Hourly rate created successfully.'));
|
||||
$this->response->redirect($this->helper->url('hourlyrate', 'index', array('user_id' => $values['user_id'])));
|
||||
$this->response->redirect($this->helper->url->to('hourlyrate', 'index', array('user_id' => $values['user_id'])));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to save the hourly rate.'));
|
||||
@@ -84,6 +84,6 @@ class Hourlyrate extends User
|
||||
$this->session->flash(t('Unable to remove this rate.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('hourlyrate', 'index', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('hourlyrate', 'index', array('user_id' => $user['id'])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class Link extends Base
|
||||
|
||||
if ($this->link->create($values['label'], $values['opposite_label'])) {
|
||||
$this->session->flash(t('Link added successfully.'));
|
||||
$this->response->redirect($this->helper->url('link', 'index'));
|
||||
$this->response->redirect($this->helper->url->to('link', 'index'));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to create your link.'));
|
||||
@@ -115,7 +115,7 @@ class Link extends Base
|
||||
if ($valid) {
|
||||
if ($this->link->update($values)) {
|
||||
$this->session->flash(t('Link updated successfully.'));
|
||||
$this->response->redirect($this->helper->url('link', 'index'));
|
||||
$this->response->redirect($this->helper->url->to('link', 'index'));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to update your link.'));
|
||||
@@ -157,6 +157,6 @@ class Link extends Base
|
||||
$this->session->flashError(t('Unable to remove this link.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('link', 'index'));
|
||||
$this->response->redirect($this->helper->url->to('link', 'index'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,11 +252,11 @@ class Subtask extends Base
|
||||
{
|
||||
switch ($redirect) {
|
||||
case 'board':
|
||||
$this->response->redirect($this->helper->url('board', 'show', array('project_id' => $task['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
|
||||
case 'dashboard':
|
||||
$this->response->redirect($this->helper->url('app', 'index'));
|
||||
$this->response->redirect($this->helper->url->to('app', 'index'));
|
||||
default:
|
||||
$this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,6 +275,6 @@ class Subtask extends Base
|
||||
$method = $direction === 'up' ? 'moveUp' : 'moveDown';
|
||||
|
||||
$this->subtask->$method($task_id, $subtask_id);
|
||||
$this->response->redirect($this->helper->url('task', 'show', array('project_id' => $project_id, 'task_id' => $task_id)).'#subtasks');
|
||||
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $project_id, 'task_id' => $task_id)).'#subtasks');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,10 +288,10 @@ class Task extends Base
|
||||
}
|
||||
|
||||
if ($redirect === 'board') {
|
||||
$this->response->redirect($this->helper->url('board', 'show', array('project_id' => $task['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||
}
|
||||
|
||||
if ($this->request->isAjax()) {
|
||||
|
||||
@@ -77,10 +77,10 @@ class Tasklink extends Base
|
||||
$this->session->flash(t('Link added successfully.'));
|
||||
|
||||
if ($ajax) {
|
||||
$this->response->redirect($this->helper->url('board', 'show', array('project_id' => $task['project_id'])));
|
||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('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');
|
||||
}
|
||||
|
||||
$errors = array('title' => array(t('The exact same link already exists')));
|
||||
@@ -132,7 +132,7 @@ class Tasklink extends Base
|
||||
|
||||
if ($this->taskLink->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
|
||||
$this->session->flash(t('Link updated successfully.'));
|
||||
$this->response->redirect($this->helper->url('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');
|
||||
}
|
||||
|
||||
$this->session->flashError(t('Unable to update your link.'));
|
||||
@@ -174,6 +174,6 @@ class Tasklink extends Base
|
||||
$this->session->flashError(t('Unable to remove this link.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class Timetableday extends User
|
||||
|
||||
if ($this->timetableDay->create($values['user_id'], $values['start'], $values['end'])) {
|
||||
$this->session->flash(t('Time slot created successfully.'));
|
||||
$this->response->redirect($this->helper->url('timetableday', 'index', array('user_id' => $values['user_id'])));
|
||||
$this->response->redirect($this->helper->url->to('timetableday', 'index', array('user_id' => $values['user_id'])));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to save this time slot.'));
|
||||
@@ -83,6 +83,6 @@ class Timetableday extends User
|
||||
$this->session->flash(t('Unable to remove this time slot.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('timetableday', 'index', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('timetableday', 'index', array('user_id' => $user['id'])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class Timetableoff extends User
|
||||
$values['comment'])) {
|
||||
|
||||
$this->session->flash(t('Time slot created successfully.'));
|
||||
$this->response->redirect($this->helper->url($this->controller_url, 'index', array('user_id' => $values['user_id'])));
|
||||
$this->response->redirect($this->helper->url->to($this->controller_url, 'index', array('user_id' => $values['user_id'])));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to save this time slot.'));
|
||||
@@ -102,6 +102,6 @@ class Timetableoff extends User
|
||||
$this->session->flash(t('Unable to remove this time slot.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url($this->controller_url, 'index', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to($this->controller_url, 'index', array('user_id' => $user['id'])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class Timetableweek extends User
|
||||
|
||||
if ($this->timetableWeek->create($values['user_id'], $values['day'], $values['start'], $values['end'])) {
|
||||
$this->session->flash(t('Time slot created successfully.'));
|
||||
$this->response->redirect($this->helper->url('timetableweek', 'index', array('user_id' => $values['user_id'])));
|
||||
$this->response->redirect($this->helper->url->to('timetableweek', 'index', array('user_id' => $values['user_id'])));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to save this time slot.'));
|
||||
@@ -94,6 +94,6 @@ class Timetableweek extends User
|
||||
$this->session->flash(t('Unable to remove this time slot.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('timetableweek', 'index', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('timetableweek', 'index', array('user_id' => $user['id'])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class Twofactor extends User
|
||||
$_SESSION['user']['twofactor_activated'] = false;
|
||||
|
||||
$this->session->flash(t('User updated successfully.'));
|
||||
$this->response->redirect($this->helper->url('twofactor', 'index', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id'])));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +99,7 @@ class Twofactor extends User
|
||||
$this->session->flashError(t('The two factor authentication code is not valid.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('twofactor', 'index', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('twofactor', 'index', array('user_id' => $user['id'])));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,11 +118,11 @@ class Twofactor extends User
|
||||
if (! empty($values['code']) && $otp->checkTotp(Base32::decode($user['twofactor_secret']), $values['code'])) {
|
||||
$this->session['2fa_validated'] = true;
|
||||
$this->session->flash(t('The two factor authentication code is valid.'));
|
||||
$this->response->redirect($this->helper->url('app', 'index'));
|
||||
$this->response->redirect($this->helper->url->to('app', 'index'));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('The two factor authentication code is not valid.'));
|
||||
$this->response->redirect($this->helper->url('twofactor', 'code'));
|
||||
$this->response->redirect($this->helper->url->to('twofactor', 'code'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ class Twofactor extends User
|
||||
'twofactor_secret' => '',
|
||||
));
|
||||
|
||||
$this->response->redirect($this->helper->url('user', 'show', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('user', 'show', array('user_id' => $user['id'])));
|
||||
}
|
||||
|
||||
$this->response->html($this->layout('twofactor/disable', array(
|
||||
|
||||
@@ -268,7 +268,7 @@ class User extends Base
|
||||
$this->session->flashError(t('Unable to update this user.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url('user', 'share', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('user', 'share', array('user_id' => $user['id'])));
|
||||
}
|
||||
|
||||
$this->response->html($this->layout('user/share', array(
|
||||
|
||||
@@ -96,7 +96,7 @@ class Webhook extends Base
|
||||
|
||||
$this->bitbucketWebhook->setProjectId($this->request->getIntegerParam('project_id'));
|
||||
|
||||
$result = $this->bitbucketWebhook->parsePayload(json_decode(@$_POST['payload'], true));
|
||||
$result = $this->bitbucketWebhook->parsePayload(json_decode(@$_POST['payload'], true) ?: array());
|
||||
|
||||
echo $result ? 'PARSED' : 'IGNORED';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user