diff --git a/ajax/ajax_getContent.php b/ajax/ajax_getContent.php
index fb26eef8..b1e3341d 100644
--- a/ajax/ajax_getContent.php
+++ b/ajax/ajax_getContent.php
@@ -31,7 +31,7 @@ use SP\Controller\NoticesController;
use SP\Controller\UserPreferencesController;
use SP\Core\Acl\ActionsInterface;
use SP\Core\SessionFactory;
-use SP\Core\Template;
+use SP\Mvc\View\Template;
use SP\Http\Request;
use SP\Http\Response;
use SP\Util\Util;
diff --git a/app/modules/web/Controllers/AccountController.php b/app/modules/web/Controllers/AccountController.php
index 403abeaf..392e568b 100644
--- a/app/modules/web/Controllers/AccountController.php
+++ b/app/modules/web/Controllers/AccountController.php
@@ -28,6 +28,7 @@ use SP\Controller\ControllerBase;
use SP\Core\Acl\Acl;
use SP\Core\Acl\ActionsInterface;
use SP\Core\Crypt\Crypt;
+use SP\Core\Crypt\Vault;
use SP\Core\Exceptions\SPException;
use SP\Core\Exceptions\ValidationException;
use SP\Core\SessionUtil;
@@ -162,8 +163,8 @@ class AccountController extends ControllerBase implements CrudControllerInterfac
$publicLinkService = new PublicLinkService();
$publicLinkData = $publicLinkService->getByHash($hash);
- if (time() < $publicLinkData->getDateExpire()
- && $publicLinkData->getCountViews() < $publicLinkData->getMaxCountViews()
+ if (time() < $publicLinkData->getPublicLinkDateExpire()
+ && $publicLinkData->getPublicLinkCountViews() < $publicLinkData->getPublicLinkMaxCountViews()
) {
$publicLinkService->addLinkView($publicLinkData);
@@ -180,20 +181,20 @@ class AccountController extends ControllerBase implements CrudControllerInterfac
// $NoticeData->setNoticeComponent(__('Cuentas'));
// $NoticeData->setNoticeDescription($Message);
// $NoticeData->setNoticeType(__('Información'));
-// $NoticeData->setNoticeUserId($PublicLink->getUserId());
+// $NoticeData->setNoticeUserId($PublicLink->getPublicLinkUserId());
//
// Notice::getItem($NoticeData)->add();
// }
$accountService = new AccountService();
- $accountService->incrementViewCounter($publicLinkData->getItemId());
- $accountService->incrementDecryptCounter($publicLinkData->getItemId());
+ $accountService->incrementViewCounter($publicLinkData->getPublicLinkItemId());
+ $accountService->incrementDecryptCounter($publicLinkData->getPublicLinkItemId());
- $key = $this->configData->getPasswordSalt() . $publicLinkData->getLinkHash();
- $securedKey = Crypt::unlockSecuredKey($publicLinkData->getPassIV(), $key);
+ /** @var Vault $vault */
+ $vault = unserialize($publicLinkData->getPublicLinkData());
/** @var AccountExtData $accountData */
- $accountData = Util::unserialize(AccountExtData::class, Crypt::decrypt($publicLinkData->getData(), $securedKey, $key));
+ $accountData = Util::unserialize(AccountExtData::class, $vault->getData(PublicLinkService::getKeyForHash($this->config, $publicLinkData)));
$this->view->assign('title',
[
@@ -221,7 +222,7 @@ class AccountController extends ControllerBase implements CrudControllerInterfac
} catch (\Exception $e) {
debugLog($e->getMessage(), true);
- ErrorUtil::showErrorInView($this->view, ErrorUtil::ERR_EXCEPTION);
+ ErrorUtil::showErrorFull($this->view, ErrorUtil::ERR_PAGE_NO_PERMISSION, 'account-link');
}
$this->view();
diff --git a/app/modules/web/Controllers/Helpers/HelperBase.php b/app/modules/web/Controllers/Helpers/HelperBase.php
index ecdd5798..c930aa2c 100644
--- a/app/modules/web/Controllers/Helpers/HelperBase.php
+++ b/app/modules/web/Controllers/Helpers/HelperBase.php
@@ -28,8 +28,8 @@ use SP\Config\Config;
use SP\Config\ConfigData;
use SP\Core\Events\EventDispatcher;
use SP\Core\Session\Session;
-use SP\Core\Template;
use SP\Core\Traits\InjectableTrait;
+use SP\Mvc\View\Template;
/**
* Class HelperBase
@@ -41,7 +41,7 @@ abstract class HelperBase
use InjectableTrait;
/**
- * @var Template
+ * @var \SP\Mvc\View\Template
*/
protected $view;
/**
@@ -64,10 +64,10 @@ abstract class HelperBase
/**
* Constructor
*
- * @param Template $template
- * @param Config $config
- * @param Session $session
- * @param EventDispatcher $eventDispatcher
+ * @param \SP\Mvc\View\Template $template
+ * @param Config $config
+ * @param Session $session
+ * @param EventDispatcher $eventDispatcher
*/
final public function __construct(Template $template, Config $config, Session $session, EventDispatcher $eventDispatcher)
{
diff --git a/app/modules/web/Controllers/Helpers/ItemsGridHelper.php b/app/modules/web/Controllers/Helpers/ItemsGridHelper.php
index 4092046e..8bb7eb8b 100644
--- a/app/modules/web/Controllers/Helpers/ItemsGridHelper.php
+++ b/app/modules/web/Controllers/Helpers/ItemsGridHelper.php
@@ -940,12 +940,12 @@ class ItemsGridHelper extends HelperBase
// Grid Data
$GridData = new DataGridData();
$GridData->setDataRowSourceId('publicLink_id');
- $GridData->addDataRowSource('accountName');
- $GridData->addDataRowSource('dateAdd');
- $GridData->addDataRowSource('dateExpire');
- $GridData->addDataRowSource('userLogin');
- $GridData->addDataRowSource('notify');
- $GridData->addDataRowSource('countViews');
+ $GridData->addDataRowSource('account_name');
+ $GridData->addDataRowSource('getDateAddFormat', true);
+ $GridData->addDataRowSource('getDateExpireFormat', true);
+ $GridData->addDataRowSource('user_login');
+ $GridData->addDataRowSource('getNotifyString', true);
+ $GridData->addDataRowSource('getCountViewsString', true);
$GridData->setData($data);
// Grid
diff --git a/app/modules/web/Controllers/MainController.php b/app/modules/web/Controllers/MainController.php
index ac1f1b6e..a9b23c42 100644
--- a/app/modules/web/Controllers/MainController.php
+++ b/app/modules/web/Controllers/MainController.php
@@ -39,7 +39,7 @@ use SP\Core\Plugin\PluginUtil;
use SP\Core\SessionFactory;
use SP\Core\SessionUtil;
use SP\Core\Task;
-use SP\Core\Template;
+use SP\Mvc\View\Template;
use SP\Core\Upgrade\Check;
use SP\DataModel\NoticeData;
use SP\Html\DataGrid\DataGridAction;
@@ -620,14 +620,14 @@ class MainController extends ControllerBase implements ActionsInterface
$PublicLink = PublicLink::getItem()->getByHash($hash);
if (!$PublicLink
- || time() > $PublicLink->getDateExpire()
- || $PublicLink->getCountViews() >= $PublicLink->getMaxCountViews()
+ || time() > $PublicLink->getPublicLinkDateExpire()
+ || $PublicLink->getPublicLinkCountViews() >= $PublicLink->getPublicLinkMaxCountViews()
) {
$this->showError(self::ERR_PAGE_NO_PERMISSION, false);
} else {
PublicLink::getItem($PublicLink)->addLinkView();
- if ($PublicLink->isNotify()) {
+ if ($PublicLink->isPublicLinkNotify()) {
$Message = new NoticeMessage();
$Message->setTitle(__('Enlace visualizado'));
$Message->addDescription(sprintf('%s : %s', __('Cuenta'), $PublicLink->getItemId()));
@@ -640,7 +640,7 @@ class MainController extends ControllerBase implements ActionsInterface
$NoticeData->setNoticeComponent(__('Cuentas'));
$NoticeData->setNoticeDescription($Message);
$NoticeData->setNoticeType(__('Información'));
- $NoticeData->setNoticeUserId($PublicLink->getUserId());
+ $NoticeData->setNoticeUserId($PublicLink->getPublicLinkUserId());
Notice::getItem($NoticeData)->add();
}
diff --git a/app/modules/web/Controllers/PublicLinkController.php b/app/modules/web/Controllers/PublicLinkController.php
index 68362c4c..3d49325a 100644
--- a/app/modules/web/Controllers/PublicLinkController.php
+++ b/app/modules/web/Controllers/PublicLinkController.php
@@ -36,6 +36,7 @@ use SP\DataModel\PublicLinkListData;
use SP\Forms\PublicLinkForm;
use SP\Http\JsonResponse;
use SP\Http\Request;
+use SP\Mgmt\PublicLinks\PublicLink;
use SP\Modules\Web\Controllers\Helpers\ItemsGridHelper;
use SP\Modules\Web\Controllers\Traits\ItemTrait;
use SP\Modules\Web\Controllers\Traits\JsonTrait;
@@ -59,8 +60,6 @@ class PublicLinkController extends ControllerBase implements CrudControllerInter
/**
* Search action
- *
- * @throws \SP\Core\Exceptions\InvalidClassException
*/
public function searchAction()
{
@@ -116,16 +115,16 @@ class PublicLinkController extends ControllerBase implements CrudControllerInter
{
$this->view->addTemplate('publiclink', 'itemshow');
- $publicLink = $publicLinkId ? PublicLinkService::mapItemsForList([$this->publicLinkService->getById($publicLinkId)]) : new PublicLinkListData();
+ $publicLink = $publicLinkId ? $this->publicLinkService->getById($publicLinkId) : new PublicLinkListData();
- $this->view->assign('publicLink', is_array($publicLink) ? $publicLink[0] : $publicLink);
+ $this->view->assign('publicLink', $publicLink);
$this->view->assign('accounts', AccountUtil::getAccountsForUser($this->session));
$this->view->assign('sk', SessionUtil::getSessionKey(true));
$this->view->assign('nextAction', Acl::getActionRoute(ActionsInterface::ACCESS_MANAGE));
if ($this->view->isView === true) {
- $this->view->assign('publicLinkURL', PublicLinkService::getLinkForHash($publicLink[0]->getPublicLinkHash()));
+ $this->view->assign('publicLinkURL', PublicLinkService::getLinkForHash($publicLink->getPublicLinkHash()));
$this->view->assign('disabled', 'disabled');
$this->view->assign('readonly', 'readonly');
} else {
diff --git a/app/modules/web/themes/material-blue/views/_partials/error-full.inc b/app/modules/web/themes/material-blue/views/_partials/error-full.inc
index 1919440c..91e277da 100644
--- a/app/modules/web/themes/material-blue/views/_partials/error-full.inc
+++ b/app/modules/web/themes/material-blue/views/_partials/error-full.inc
@@ -1,6 +1,6 @@