. */ namespace SP\Modules\Web\Controllers; use SP\Http\Response; use SP\Modules\Web\Controllers\Helpers\LayoutHelper; use SP\Util\Util; /** * Class IndexController * * @package SP\Modules\Web\Controllers */ class IndexController extends ControllerBase { /** * Index action * * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface * @throws \SP\Core\Dic\ContainerException */ public function indexAction() { if (!$this->session->isLoggedIn()) { Response::redirect('index.php?r=login'); } else { $LayoutHelper = $this->dic->get(LayoutHelper::class); $LayoutHelper->getFullLayout('main', $this->acl); $this->view(); } } /** * Updates checking action * * @throws \Psr\Container\ContainerExceptionInterface */ public function checkUpdatesAction() { $this->checkLoggedIn(); $this->view->addTemplate('update'); $this->view->assign('hasUpdates', false); $this->view->assign('updateStatus', null); if ($this->configData->isCheckUpdates()) { $updates = Util::checkUpdates(); if (is_array($updates)) { $description = nl2br($updates['description']); $version = $updates['version']; $this->view->assign('hasUpdates', true); $this->view->assign('title', $updates['title']); $this->view->assign('url', $updates['url']); $this->view->assign('description', sprintf('%s - %s

%s', __('Descargar nueva versión'), $version, $description)); } else { $this->view->assign('updateStatus', $updates); } } if ($this->configData->isChecknotices()) { $notices = Util::checkNotices(); $numNotices = count($notices); $noticesTitle = ''; if ($notices !== false && $numNotices > 0) { $noticesTitle = __('Avisos de sysPass') . '
'; foreach ($notices as $notice) { $noticesTitle .= '
' . $notice[0]; } } $this->view->assign('numNotices', $numNotices); $this->view->assign('noticesTitle', $noticesTitle); } } }