* [DEV] Improved account search handling

* [DEV] Fixed some UI issues
This commit is contained in:
nuxsmin
2016-11-02 03:26:21 +01:00
committed by Rubén Domínguez
parent e7adbf7f05
commit 3979d28e2d
45 changed files with 1058 additions and 1010 deletions

View File

@@ -24,14 +24,13 @@
*/
use SP\Account\Account;
use SP\Account\AccountTags;
use SP\DataModel\AccountData;
use SP\Core\ActionsInterface;
use SP\Core\Crypt;
use SP\Core\Init;
use SP\Core\Session;
use SP\Core\SessionUtil;
use SP\Core\Exceptions\SPException;
use SP\DataModel\AccountExtData;
use SP\DataModel\CustomerData;
use SP\DataModel\CustomFieldData;
use SP\Http\Request;
@@ -73,7 +72,6 @@ $accountUrl = Request::analyze('url');
$accountGroupEditEnabled = Request::analyze('geditenabled', 0, false, 1);
$accountUserEditEnabled = Request::analyze('ueditenabled', 0, false, 1);
$accountMainGroupId = Request::analyze('mainGroupId', 0);
$accountChangesHash = Request::analyze('hash');
$customFieldsHash = Request::analyze('hashcf');
$customFields = Request::analyze('customfield');
$tags = Request::analyze('tags');
@@ -115,12 +113,12 @@ if ($actionId === ActionsInterface::ACTION_ACC_NEW
if (!$accountId) {
Response::printJson(_('Id inválido'));
}
} elseif ($actionId == ActionsInterface::ACTION_ACC_EDIT_PASS) {
} elseif ($actionId === ActionsInterface::ACTION_ACC_EDIT_PASS) {
// Comprobaciones para modficación de clave
if (!$accountPassword || !$accountPasswordR) {
Response::printJson(_('Es necesaria una clave'));
}
} elseif ($actionId == ActionsInterface::ACTION_ACC_EDIT_RESTORE) {
} elseif ($actionId === ActionsInterface::ACTION_ACC_EDIT_RESTORE) {
if (!$accountId) {
Response::printJson(_('Id inválido'));
}
@@ -128,11 +126,11 @@ if ($actionId === ActionsInterface::ACTION_ACC_NEW
Response::printJson(_('Acción Inválida'));
}
if ($actionId == ActionsInterface::ACTION_ACC_NEW
|| $actionId == ActionsInterface::ACTION_ACC_COPY
if ($actionId === ActionsInterface::ACTION_ACC_NEW
|| $actionId === ActionsInterface::ACTION_ACC_COPY
|| $actionId === ActionsInterface::ACTION_ACC_EDIT_PASS
) {
if ($accountPassword != $accountPasswordR) {
if ($accountPassword !== $accountPasswordR) {
Response::printJson(_('Las claves no coinciden'));
}
@@ -144,19 +142,26 @@ if ($actionId == ActionsInterface::ACTION_ACC_NEW
}
}
$AccountData = new AccountData();
$AccountData = new AccountExtData();
$AccountData->setAccountId($accountId);
$AccountData->setAccountName($accountName);
$AccountData->setAccountCustomerId($customerId);
$AccountData->setAccountCategoryId($categoryId);
$AccountData->setAccountLogin($accountLogin);
$AccountData->setAccountUrl($accountUrl);
$AccountData->setAccountNotes($accountNotes);
$AccountData->setAccountUserEditId($currentUserId);
$AccountData->setAccountUsersId($accountOtherUsers);
$AccountData->setAccountUserGroupsId($accountOtherGroups);
$AccountData->setAccountOtherUserEdit($accountUserEditEnabled);
$AccountData->setAccountOtherGroupEdit($accountGroupEditEnabled);
if (is_array($accountOtherUsers)) {
$AccountData->setUsersId($accountOtherUsers);
}
if (is_array($accountOtherGroups)) {
$AccountData->setUserGroupsId($accountOtherGroups);
}
if (is_array($tags)) {
$AccountData->setTags($tags);
}
@@ -165,21 +170,11 @@ $Account = new Account($AccountData);
$CustomFieldData = new CustomFieldData();
$CustomFieldData->setId($accountId);
$CustomFieldData->setModule(ActionsInterface::ACTION_ACC_NEW);
$CustomFieldData->setModule(ActionsInterface::ACTION_ACC);
switch ($actionId) {
case ActionsInterface::ACTION_ACC_NEW:
case ActionsInterface::ACTION_ACC_COPY:
// Comprobar si se ha introducido un nuevo cliente
if ($customerId === 0 && $newCustomer) {
try {
$customerId = Customer::getItem(new CustomerData(null, $newCustomer))->add()->getItemData()->getCustomerId();
} catch (SPException $e) {
Response::printJson($e->getMessage());
}
}
$AccountData->setAccountCustomerId($customerId);
$AccountData->setAccountPass($accountEncPass['data']);
$AccountData->setAccountIV($accountEncPass['iv']);
$AccountData->setAccountUserId($currentUserId);
@@ -198,29 +193,11 @@ switch ($actionId) {
Response::printJson(_('Error al crear la cuenta'), 0);
break;
case ActionsInterface::ACTION_ACC_EDIT:
// Comprobar si se ha introducido un nuevo cliente
if ($customerId === 0 && $newCustomer) {
try {
$customerId = Customer::getItem(new CustomerData(null, $newCustomer))->add()->getItemData()->getCustomerId();
} catch (SPException $e) {
Response::printJson($e->getMessage());
}
}
$AccountData->setAccountCustomerId($customerId);
// Cambiar el grupo principal si el usuario es Admin
if (Session::getUserIsAdminApp() || Session::getUserIsAdminAcc()) {
$AccountData->setAccountUserGroupId($accountMainGroupId);
}
// Comprobar si han habido cambios
if ($accountChangesHash == $Account->calcChangesHash()
&& CustomFieldsUtil::checkHash($customFields, $customFieldsHash)
) {
Response::printJson(_('Sin cambios'), 0);
}
// Actualizar cuenta
if ($Account->updateAccount()) {
if (is_array($customFields)) {
@@ -237,7 +214,7 @@ switch ($actionId) {
if ($Account->deleteAccount()
&& CustomField::getItem($CustomFieldData)->delete($accountId)
) {
Response::printJson(_('Cuenta eliminada'), 0, "sysPassUtil.Common.doAction('" . ActionsInterface::ACTION_ACC_SEARCH . "');");
Response::printJson(_('Cuenta eliminada'), 0);
}
Response::printJson(_('Error al eliminar la cuenta'));

View File

@@ -26,6 +26,7 @@
namespace SP\Account;
use SP\Core\Crypt;
use SP\DataModel\AccountExtData;
use SP\DataModel\GroupAccountsData;
use SP\Mgmt\Files\FileUtil;
use SP\Mgmt\Groups\GroupAccounts;
@@ -73,7 +74,7 @@ class Account extends AccountBase implements AccountInterface
$GroupAccountsData = new GroupAccountsData();
$GroupAccountsData->setAccgroupAccountId($this->accountData->getAccountId());
$GroupAccountsData->setGroups($this->accountData->getAccountUserGroupsId());
$GroupAccountsData->setGroups($this->accountData->getUserGroupsId());
try {
GroupAccounts::getItem($GroupAccountsData)->update();
@@ -83,7 +84,7 @@ class Account extends AccountBase implements AccountInterface
$Log->resetDescription();
}
if (!UserAccounts::updateUsersForAccount($this->accountData->getAccountId(), $this->accountData->getAccountUsersId())) {
if (!UserAccounts::updateUsersForAccount($this->accountData->getAccountId(), $this->accountData->getUsersId())) {
$Log->addDescription(_('Error al actualizar los usuarios de la cuenta'));
$Log->writeLog();
$Log->resetDescription();
@@ -97,7 +98,8 @@ class Account extends AccountBase implements AccountInterface
$Data = new QueryData();
if ($this->accountData->getAccountUserGroupId()) {
$query = 'UPDATE accounts SET '
$query = /** @lang SQL */
'UPDATE accounts SET '
. 'account_customerId = :accountCustomerId,'
. 'account_categoryId = :accountCategoryId,'
. 'account_name = :accountName,'
@@ -113,7 +115,8 @@ class Account extends AccountBase implements AccountInterface
$Data->addParam($this->accountData->getAccountUserGroupId(), 'accountUserGroupId');
} else {
$query = 'UPDATE accounts SET '
$query = /** @lang SQL */
'UPDATE accounts SET '
. 'account_customerId = :accountCustomerId,'
. 'account_categoryId = :accountCategoryId,'
. 'account_name = :accountName,'
@@ -144,7 +147,7 @@ class Account extends AccountBase implements AccountInterface
return false;
}
$accountInfo = array('customer_name');
$accountInfo = ['customer_name'];
$this->getAccountInfoById($accountInfo);
$Log->addDetails(Html::strongText(_('Cliente')), $this->cacheParams['customer_name']);
@@ -184,7 +187,8 @@ class Account extends AccountBase implements AccountInterface
}
}
$query = 'SELECT ' . implode(',', $params) . ' '
$query = /** @lang SQL */
'SELECT ' . implode(',', $params) . ' '
. 'FROM accounts '
. 'LEFT JOIN usrGroups ug ON account_userGroupId = usergroup_id '
. 'LEFT JOIN usrData u1 ON account_userId = u1.user_id '
@@ -227,7 +231,8 @@ class Account extends AccountBase implements AccountInterface
return false;
}
$query = 'UPDATE accounts dst, '
$query = /** @lang SQL */
'UPDATE accounts dst, '
. '(SELECT * FROM accHistory WHERE acchistory_id = :id) src SET '
. 'dst.account_customerId = src.acchistory_customerId,'
. 'dst.account_categoryId = src.acchistory_categoryId,'
@@ -276,7 +281,8 @@ class Account extends AccountBase implements AccountInterface
*/
public function getData()
{
$query = 'SELECT account_id,'
$query = /** @lang SQL */
'SELECT account_id,'
. 'account_name,'
. 'account_categoryId,'
. 'account_userId,'
@@ -311,36 +317,22 @@ class Account extends AccountBase implements AccountInterface
$Data = new QueryData();
$Data->setQuery($query);
$Data->setMapClass($this->accountData);
$Data->addParam($this->accountData->getAccountId(), 'id');
/** @var AccountExtData $queryRes */
$queryRes = DB::getResults($Data);
if ($queryRes === false) {
throw new SPException(SPException::SP_CRITICAL, _('No se pudieron obtener los datos de la cuenta'));
}
// Obtener los usuarios y grupos secundarios
$this->accountData->setAccountUsersId(UserAccounts::getUsersForAccount($this->accountData->getAccountId()));
$this->accountData->setAccountUserGroupsId(GroupAccountsUtil::getGroupsForAccount($this->accountData->getAccountId()));
// Obtener los usuarios y grupos secundarios y las etiquetas
$this->accountData->setUsersId(UserAccounts::getUsersForAccount($queryRes->getAccountId()));
$this->accountData->setUserGroupsId(GroupAccountsUtil::getGroupsForAccount($queryRes->getAccountId()));
$this->accountData->setTags(AccountTags::getTags($queryRes));
$this->accountData->setAccountName($queryRes->account_name);
$this->accountData->setAccountCategoryId($queryRes->account_categoryId);
$this->accountData->setAccountCustomerId($queryRes->account_customerId);
$this->accountData->setAccountUserGroupId($queryRes->account_userGroupId);
$this->accountData->setAccountUserEditId($queryRes->account_userEditId);
$this->accountData->setAccountLogin($queryRes->account_login);
$this->accountData->setAccountUrl($queryRes->account_url);
$this->accountData->setAccountUrl($queryRes->account_url);
$this->accountData->setAccountNotes($queryRes->account_notes);
$this->accountData->setAccountUserId($queryRes->account_userId);
$this->accountData->setAccountUserGroupId($queryRes->account_userGroupId);
$this->accountData->setAccountOtherUserEdit($queryRes->account_otherUserEdit);
$this->accountData->setAccountOtherGroupEdit($queryRes->account_otherGroupEdit);
$this->accountData->setTags(AccountTags::getTags($this->accountData));
$this->setAccountModHash($this->calcChangesHash());
return $queryRes;
return $this->accountData;
}
/**
@@ -350,7 +342,8 @@ class Account extends AccountBase implements AccountInterface
*/
public function createAccount()
{
$query = 'INSERT INTO accounts SET '
$query = /** @lang SQL */
'INSERT INTO accounts SET '
. 'account_customerId = :accountCustomerId,'
. 'account_categoryId = :accountCategoryId,'
. 'account_name = :accountName,'
@@ -402,12 +395,12 @@ class Account extends AccountBase implements AccountInterface
$Log->resetDescription();
}
if (is_array($this->accountData->getAccountUsersId())) {
if (!UserAccounts::addUsersForAccount($this->accountData->getAccountId(), $this->accountData->getAccountUsersId())) {
$Log->addDescription(_('Error al actualizar los usuarios de la cuenta'));
$Log->writeLog();
$Log->resetDescription();
}
if (is_array($this->accountData->getAccountUsersId())
&& !UserAccounts::addUsersForAccount($this->accountData->getAccountId(), $this->accountData->getAccountUsersId())
) {
$Log->addDescription(_('Error al actualizar los usuarios de la cuenta'));
$Log->writeLog();
$Log->resetDescription();
}
if (is_array($this->accountData->getTags())) {
@@ -415,12 +408,12 @@ class Account extends AccountBase implements AccountInterface
$AccountTags->addTags($this->accountData);
}
$accountInfo = array('customer_name');
$accountInfo = ['customer_name'];
$this->getAccountInfoById($accountInfo);
$Log->setAction(_('Nueva Cuenta'));
$Log->addDetails(Html::strongText(_('Cliente')), $this->cacheParams['customer_name']);
$Log->addDetails(Html::strongText(_('Cuenta')), $this->accountData->getAccountName() . " (" . $this->accountData->getAccountId() . ")");
$Log->addDetails(Html::strongText(_('Cuenta')), sprintf('%s (%s)', $this->accountData->getAccountName(), $this->accountData->getAccountId()));
$Log->writeLog();
Email::sendEmail($Log);
@@ -444,9 +437,10 @@ class Account extends AccountBase implements AccountInterface
$Log = new Log(_('Eliminar Cuenta'));
$Log->addDetails(Html::strongText(_('Cliente')), $this->cacheParams['customer_name']);
$Log->addDetails(Html::strongText(_('Cuenta')), $this->cacheParams['account_name'] . " (" . $this->accountData->getAccountId() . ")");
$Log->addDetails(Html::strongText(_('Cuenta')), sprintf('%s (%s)', $this->accountData->getAccountName(), $this->accountData->getAccountId()));
$query = 'DELETE FROM accounts WHERE account_id = :id LIMIT 1';
$query = /** @lang SQL */
'DELETE FROM accounts WHERE account_id = :id LIMIT 1';
$Data = new QueryData();
$Data->setQuery($query);
@@ -483,7 +477,8 @@ class Account extends AccountBase implements AccountInterface
*/
public function incrementViewCounter()
{
$query = 'UPDATE accounts SET account_countView = (account_countView + 1) WHERE account_id = :id LIMIT 1';
$query = /** @lang SQL */
'UPDATE accounts SET account_countView = (account_countView + 1) WHERE account_id = :id LIMIT 1';
$Data = new QueryData();
$Data->setQuery($query);
@@ -499,7 +494,8 @@ class Account extends AccountBase implements AccountInterface
*/
public function incrementDecryptCounter()
{
$query = 'UPDATE accounts SET account_countDecrypt = (account_countDecrypt + 1) WHERE account_id = :id LIMIT 1';
$query = /** @lang SQL */
'UPDATE accounts SET account_countDecrypt = (account_countDecrypt + 1) WHERE account_id = :id LIMIT 1';
$Data = new QueryData();
$Data->setQuery($query);
@@ -555,12 +551,12 @@ class Account extends AccountBase implements AccountInterface
}
if (strlen($account->account_pass) === 0) {
$Log->addDescription(_('Clave de cuenta vacía') . ' (' . $account->account_id . ') ' . $account->account_name);
$Log->addDescription(sprintf('%s: (%s) %s', _('Clave de cuenta vacía'), $account->account_id, $account->account_name));
continue;
}
if (strlen($account->account_IV) < 32) {
$Log->addDescription(_('IV de encriptación incorrecto') . ' (' . $account->account_id . ') ' . $account->account_name);
$Log->addDescription(sprintf('%s: (%s) %s', _('IV de encriptación incorrecto'), $account->account_id, $account->account_name));
}
$decryptedPass = Crypt::getDecrypt($account->account_pass, $account->account_IV);
@@ -569,13 +565,13 @@ class Account extends AccountBase implements AccountInterface
if ($this->accountData->getAccountPass() === false) {
$errorCount++;
$Log->addDescription(_('No es posible desencriptar la clave de la cuenta') . ' (' . $account->account_id . ') ' . $account->account_name);
$Log->addDescription(sprintf('%s: (%s) %s', _('No es posible desencriptar la clave de la cuenta'), $account->account_id, $account->account_name));
continue;
}
if (!$this->updateAccountPass(true)) {
$errorCount++;
$Log->addDescription(_('Fallo al actualizar la clave de la cuenta') . ' (' . $this->getAccountId() . ') ' . $account->acchistory_name);
$Log->addDescription(sprintf('%s: (%s) %s', _('Fallo al actualizar la clave de la cuenta'), $account->account_id, $account->acchistory_name));
continue;
}
@@ -609,7 +605,8 @@ class Account extends AccountBase implements AccountInterface
*/
protected function getAccountsPassData()
{
$query = 'SELECT account_id, account_name, account_pass, account_IV FROM accounts';
$query = /** @lang SQL */
'SELECT account_id, account_name, account_pass, account_IV FROM accounts';
DB::setReturnArray();
@@ -631,16 +628,18 @@ class Account extends AccountBase implements AccountInterface
$Log = new Log(__FUNCTION__);
// No actualizar el histórico si es por cambio de clave maestra o restauración
if (!$isMassive && !$isRestore) {
if (!$isMassive
&& !$isRestore
&& !AccountHistory::addHistory($this->accountData->getAccountId(), false)
) {
// Guardamos una copia de la cuenta en el histórico
if (!AccountHistory::addHistory($this->accountData->getAccountId(), false)) {
$Log->addDescription(_('Error al actualizar el historial'));
$Log->writeLog();
return false;
}
$Log->addDescription(_('Error al actualizar el historial'));
$Log->writeLog();
return false;
}
$query = 'UPDATE accounts SET '
$query = /** @lang SQL */
'UPDATE accounts SET '
. 'account_pass = :accountPass,'
. 'account_IV = :accountIV,'
. 'account_userEditId = :accountUserEditId,'
@@ -684,7 +683,8 @@ class Account extends AccountBase implements AccountInterface
*/
public function getAccountPassData()
{
$query = 'SELECT account_name AS name,'
$query = /** @lang SQL */
'SELECT account_name AS name,'
. 'account_userId AS userId,'
. 'account_userGroupId AS groupId,'
. 'account_login AS login,'
@@ -705,11 +705,6 @@ class Account extends AccountBase implements AccountInterface
return false;
}
$this->accountData->setAccountUserId($queryRes->userId);
$this->accountData->setAccountUserGroupId($queryRes->groupId);
$this->accountData->setAccountPass($queryRes->pass);
$this->accountData->setAccountIV($queryRes->iv);
return $queryRes;
}
}

View File

@@ -26,7 +26,8 @@
namespace SP\Account;
use SP\DataModel\AccountData;
use SP\Mgmt\Groups\Group;
use SP\DataModel\AccountExtData;
use SP\DataModel\AccountHistoryData;
use SP\Mgmt\Groups\GroupAccountsUtil;
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
@@ -41,7 +42,7 @@ abstract class AccountBase
*/
const CACHE_EXPIRE_TIME = 300;
/**
* @var AccountData
* @var AccountData|AccountExtData|AccountHistoryData
*/
protected $accountData;
/**
@@ -49,21 +50,9 @@ abstract class AccountBase
*/
private $accountParentId;
/**
* @var string Hash con los datos de la cuenta para verificación de cambios.
*/
private $accountModHash;
/**
* @var int Indica si la cuenta es un registro del hitórico.
* @var int Indica si la cuenta es un registro del histórico.
*/
private $accountIsHistory = 0;
/**
* @var array Los Ids de los grupos con acceso a la cuenta
*/
private $cacheUserGroupsId;
/**
* @var array Los Ids de los usuarios con acceso a la cuenta
*/
private $cacheUsersId;
/**
* Constructor
@@ -173,81 +162,8 @@ abstract class AccountBase
return $cacheUserGroups[$accId];
}
/**
* Calcular el hash de los datos de una cuenta.
* Esta función se utiliza para verificar si los datos de un formulario han sido cambiados
* con respecto a los guardados
*
* @return string con el hash
*/
public function calcChangesHash()
{
$groups = 0;
$users = 0;
if (is_array($this->accountData->getAccountUserGroupsId())) {
$groups = implode($this->accountData->getAccountUserGroupsId());
} elseif (is_array($this->cacheUserGroupsId)) {
foreach ($this->cacheUserGroupsId as $group) {
if (is_array($group)) {
// Ordenar el array para que el hash sea igual
sort($group, SORT_NUMERIC);
$groups = implode($group);
}
}
}
if (is_array($this->accountData->getAccountUsersId())) {
$users = implode($this->accountData->getAccountUsersId());
} elseif (is_array($this->cacheUsersId)) {
foreach ($this->cacheUsersId as $user) {
if (is_array($user)) {
// Ordenar el array para que el hash sea igual
sort($user, SORT_NUMERIC);
$users = implode($user);
}
}
}
if ($this->getAccountModHash()) {
$hashItems = $this->getAccountModHash() . (int)$users . (int)$groups;
} else {
$hashItems = $this->accountData->getAccountName() .
$this->accountData->getAccountCategoryId() .
$this->accountData->getAccountCustomerId() .
$this->accountData->getAccountLogin() .
$this->accountData->getAccountUrl() .
$this->accountData->getAccountNotes() .
implode('', array_keys($this->accountData->getTags())) .
(int)$this->accountData->getAccountOtherUserEdit() .
(int)$this->accountData->getAccountOtherGroupEdit() .
(int)$users .
(int)$groups;
}
return md5($hashItems);
}
/**
* @return string
*/
public function getAccountModHash()
{
return $this->accountModHash;
}
/**
* @param string $accountModHash
*/
public function setAccountModHash($accountModHash)
{
$this->accountModHash = $accountModHash;
}
/**
* @return AccountData
* @return AccountData|AccountExtData
*/
public function getAccountData()
{

View File

@@ -49,11 +49,13 @@ class AccountHistory extends AccountBase implements AccountInterface
/**
* Obtiene el listado del histórico de una cuenta.
*
* @return false|array Con los registros con id como clave y fecha - usuario como valor
* @param $accountId
* @return array|false Con los registros con id como clave y fecha - usuario como valor
*/
public static function getAccountList($accountId)
{
$query = 'SELECT acchistory_id,'
$query = /** @lang SQL */
'SELECT acchistory_id,'
. 'acchistory_dateEdit,'
. 'u1.user_login as user_edit,'
. 'u2.user_login as user_add,'
@@ -226,7 +228,8 @@ class AccountHistory extends AccountBase implements AccountInterface
*/
protected function getAccountsPassData()
{
$query = 'SELECT acchistory_id, acchistory_name, acchistory_pass, acchistory_IV FROM accHistory';
$query = /** @lang SQL */
'SELECT acchistory_id, acchistory_name, acchistory_pass, acchistory_IV FROM accHistory';
$Data = new QueryData();
$Data->setQuery($query);
@@ -244,7 +247,8 @@ class AccountHistory extends AccountBase implements AccountInterface
*/
public function checkAccountMPass($id = null)
{
$query = 'SELECT acchistory_mPassHash ' .
$query = /** @lang SQL */
'SELECT acchistory_mPassHash ' .
'FROM accHistory ' .
'WHERE acchistory_id = :id ' .
'AND acchistory_mPassHash = :mPassHash';
@@ -265,7 +269,8 @@ class AccountHistory extends AccountBase implements AccountInterface
*/
public function getAccountPassData()
{
$query = 'SELECT acchistory_name AS name,'
$query = /** @lang SQL */
'SELECT acchistory_name AS name,'
. 'acchistory_userId AS userId,'
. 'acchistory_userGroupId AS groupId,'
. 'acchistory_login AS login,'
@@ -276,7 +281,7 @@ class AccountHistory extends AccountBase implements AccountInterface
$Data = new QueryData();
$Data->setQuery($query);
$Data->addParam($this->getAccountId(), 'id');
$Data->addParam($this->accountData->getAccountId(), 'id');
$queryRes = DB::getResults($Data);
@@ -284,10 +289,10 @@ class AccountHistory extends AccountBase implements AccountInterface
return false;
}
$this->setAccountUserId($queryRes->userId);
$this->setAccountUserGroupId($queryRes->groupId);
$this->setAccountPass($queryRes->pass);
$this->setAccountIV($queryRes->iv);
$this->accountData->setAccountUserId($queryRes->userId);
$this->accountData->setAccountUserGroupId($queryRes->groupId);
$this->accountData->setAccountPass($queryRes->pass);
$this->accountData->setAccountIV($queryRes->iv);
return $queryRes;
}
@@ -301,7 +306,8 @@ class AccountHistory extends AccountBase implements AccountInterface
*/
public function updateAccountPass($id, $newHash)
{
$query = 'UPDATE accHistory SET '
$query = /** @lang SQL */
'UPDATE accHistory SET '
. 'acchistory_pass = :accountPass,'
. 'acchistory_IV = :accountIV,'
. 'acchistory_mPassHash = :newHash '
@@ -327,7 +333,8 @@ class AccountHistory extends AccountBase implements AccountInterface
*/
public function getData()
{
$query = 'SELECT acchistory_accountId as account_id,'
$query = /** @lang SQL */
'SELECT acchistory_accountId as account_id,'
. 'acchistory_customerId as account_customerId,'
. 'acchistory_categoryId as account_categoryId,'
. 'acchistory_name as account_name,'
@@ -363,6 +370,7 @@ class AccountHistory extends AccountBase implements AccountInterface
$Data = new QueryData();
$Data->setQuery($query);
$Data->setMapClassName('SP\DataModel\AccountExtData');
$Data->addParam($this->accountData->getAccountId(), 'id');
$queryRes = DB::getResults($Data);
@@ -371,10 +379,7 @@ class AccountHistory extends AccountBase implements AccountInterface
throw new SPException(SPException::SP_CRITICAL, _('No se pudieron obtener los datos de la cuenta'));
}
$this->accountData->setAccountUserId($queryRes->account_userId);
$this->accountData->setAccountUserGroupId($queryRes->account_userGroupId);
$this->accountData->setAccountOtherUserEdit($queryRes->account_otherUserEdit);
$this->accountData->setAccountOtherGroupEdit($queryRes->account_otherGroupEdit);
$this->accountData = $queryRes;
return $queryRes;
}
@@ -386,7 +391,8 @@ class AccountHistory extends AccountBase implements AccountInterface
*/
public function createAccount()
{
$query = 'INSERT INTO accHistory SET '
$query = /** @lang SQL */
'INSERT INTO accHistory SET '
. 'acchistory_accountId = :account_id,'
. 'acchistory_customerId = :accountCustomerId,'
. 'acchistory_categoryId = :accountCategoryId,'
@@ -441,7 +447,8 @@ class AccountHistory extends AccountBase implements AccountInterface
*/
public function deleteAccount()
{
$query = 'DELETE FROM accHistory WHERE acchistory_id = :id LIMIT 1';
$query = /** @lang SQL */
'DELETE FROM accHistory WHERE acchistory_id = :id LIMIT 1';
$Data = new QueryData();
$Data->setQuery($query);
@@ -463,7 +470,8 @@ class AccountHistory extends AccountBase implements AccountInterface
*/
public static function addHistory($id, $isDelete = false)
{
$query = 'INSERT INTO accHistory '
$query = /** @lang SQL */
'INSERT INTO accHistory '
. '(acchistory_accountId,'
. 'acchistory_categoryId,'
. 'acchistory_customerId,'
@@ -527,7 +535,8 @@ class AccountHistory extends AccountBase implements AccountInterface
*/
public static function getAccountIdFromId($historyId)
{
$query = 'SELECT acchistory_accountId FROM accHistory WHERE acchistory_id = :id LIMIT 1';
$query = /** @lang SQL */
'SELECT acchistory_accountId FROM accHistory WHERE acchistory_id = :id LIMIT 1';
$Data = new QueryData();
$Data->setQuery($query);
@@ -550,7 +559,8 @@ class AccountHistory extends AccountBase implements AccountInterface
*/
public static function updateAccountsMPassHash($newHash)
{
$query = 'UPDATE accHistory SET '
$query = /** @lang SQL */
'UPDATE accHistory SET '
. 'acchistory_mPassHash = :newHash '
. 'WHERE acchistory_mPassHash = :oldHash';

View File

@@ -29,6 +29,8 @@ use SP\Config\Config;
use SP\Core\Acl;
use SP\Core\ActionsInterface;
use SP\DataModel\AccountData;
use SP\DataModel\AccountExtData;
use SP\DataModel\AccountSearchData;
use SP\Mgmt\Groups\GroupAccountsUtil;
use SP\Mgmt\Groups\GroupUtil;
use SP\Mgmt\Users\User;
@@ -66,7 +68,7 @@ class AccountSearch
*
* @var array
*/
private $colors = [
private static $colors = [
'2196F3',
'03A9F4',
'00BCD4',
@@ -85,6 +87,7 @@ class AccountSearch
'673AB7',
'3F51B5',
];
/**
* @var bool
*/
@@ -289,41 +292,6 @@ class AccountSearch
return $this;
}
/**
* Obtiene el número de cuentas que un usuario puede ver.
*
* @return false|int con el número de registros
*/
public function getAccountMax()
{
$Data = new QueryData();
if (!Session::getUserIsAdminApp() && !Session::getUserIsAdminAcc()) {
$query = 'SELECT COUNT(DISTINCT account_id) as numacc '
. 'FROM accounts '
. 'LEFT JOIN accGroups ON account_id = accgroup_accountId '
. 'WHERE account_userGroupId = :userGroupId '
. 'OR account_userId = :userId '
. 'OR accgroup_groupId = :groupId';
$Data->addParam(Session::getUserGroupId(), 'userGroupId');
$Data->addParam(Session::getUserGroupId(), 'groupId');
$Data->addParam(Session::getUserId(), 'userId');
} else {
$query = 'SELECT COUNT(*) as numacc FROM accounts';
}
$Data->setQuery($query);
$queryRes = DB::getResults($Data);
if ($queryRes === false) {
return false;
}
return $queryRes->numacc;
}
/**
* Procesar los resultados de la búsqueda y crear la variable que contiene los datos de cada cuenta
* a mostrar.
@@ -339,70 +307,29 @@ class AccountSearch
// Variables de configuración
$maxTextLength = Checks::resultsCardsIsEnabled() ? 40 : 60;
$favorites = AccountFavorites::getFavorites(Session::getUserId());
$accountsData['count'] = self::$queryNumRows;
foreach ($results as $account) {
foreach ($results as $AccountSearchData) {
// Establecer los datos de la cuenta
$Account = new Account();
$AccountData = $Account->getAccountData();
$AccountData->setAccountId($account->account_id);
$AccountData->setAccountUserId($account->account_userId);
$AccountData->setAccountUsersId($Account->getUsersAccount());
$AccountData->setAccountUserGroupId($account->account_userGroupId);
$AccountData->setAccountUserGroupsId($Account->getGroupsAccount());
$AccountData->setAccountOtherUserEdit($account->account_otherUserEdit);
$AccountData->setAccountOtherGroupEdit($account->account_otherGroupEdit);
$Account = new Account($AccountSearchData);
$AccountSearchData->setUsersId($Account->getUsersAccount());
$AccountSearchData->setUserGroupsId($Account->getGroupsAccount());
$AccountSearchData->setTags(AccountTags::getTags($Account->getAccountData()));
// Obtener la ACL de la cuenta
$AccountAcl = new AccountAcl();
$AccountAcl->getAcl($Account, Acl::ACTION_ACC_SEARCH);
$AccountSearchData = new AccountsSearchData();
$AccountSearchData->setTextMaxLength($maxTextLength);
$AccountSearchData->setId($account->account_id);
$AccountSearchData->setName($account->account_name);
$AccountSearchData->setLogin($account->account_login);
$AccountSearchData->setCategoryName($account->category_name);
$AccountSearchData->setCustomerName($account->customer_name);
$AccountSearchData->setCustomerLink(AccountsSearchData::$wikiEnabled ? Config::getConfig()->getWikiSearchurl() . $account->customer_name : '');
$AccountSearchData->setColor($this->pickAccountColor($account->account_customerId));
$AccountSearchData->setUrl($account->account_url);
$AccountSearchData->setFavorite(in_array($account->account_id, $favorites));
$AccountSearchData->setTags(AccountTags::getTags($Account->getAccountData()));
$AccountSearchData->setNumFiles(Checks::fileIsEnabled() ? $account->num_files : 0);
$AccountSearchData->setShowView($AccountAcl->isShowView());
$AccountSearchData->setShowViewPass($AccountAcl->isShowViewPass());
$AccountSearchData->setShowEdit($AccountAcl->isShowEdit());
$AccountSearchData->setShowCopy($AccountAcl->isShowCopy());
$AccountSearchData->setShowDelete($AccountAcl->isShowDelete());
$AccountSearchItems = new AccountsSearchItem($AccountSearchData);
$AccountSearchItems->setTextMaxLength($maxTextLength);
$AccountSearchItems->setColor($this->pickAccountColor($AccountSearchData->getAccountCustomerId()));
$AccountSearchItems->setShowView($AccountAcl->isShowView());
$AccountSearchItems->setShowViewPass($AccountAcl->isShowViewPass());
$AccountSearchItems->setShowEdit($AccountAcl->isShowEdit());
$AccountSearchItems->setShowCopy($AccountAcl->isShowCopy());
$AccountSearchItems->setShowDelete($AccountAcl->isShowDelete());
// Obtenemos datos si el usuario tiene acceso a los datos de la cuenta
if ($AccountSearchData->isShow()) {
$secondaryAccesses = sprintf('<em>(G) %s*</em><br>', $account->usergroup_name);
foreach (GroupAccountsUtil::getGroupsInfoForAccount($account->account_id) as $group) {
$secondaryAccesses .= sprintf('<em>(G) %s</em><br>', $group->getUsergroupName());
}
foreach (UserAccounts::getUsersInfoForAccount($account->account_id) as $user) {
$secondaryAccesses .= sprintf('<em>(U) %s</em><br>', $user->getUserLogin());
}
$AccountSearchData->setAccesses($secondaryAccesses);
$accountNotes = '';
if ($account->account_notes) {
$accountNotes = (strlen($account->account_notes) > 300) ? substr($account->account_notes, 0, 300) . "..." : $account->account_notes;
$accountNotes = nl2br(wordwrap(htmlspecialchars($accountNotes), 50, '<br>', true));
}
$AccountSearchData->setNotes($accountNotes);
}
$accountsData[] = $AccountSearchData;
$accountsData[] = $AccountSearchItems;
}
return $accountsData;
@@ -411,7 +338,7 @@ class AccountSearch
/**
* Obtener las cuentas de una búsqueda.
*
* @return mixed Resultado de la consulta
* @return AccountSearchData[] Resultado de la consulta
*/
public function getAccounts()
{
@@ -462,19 +389,16 @@ class AccountSearch
if ($this->categoryId !== 0) {
$arrFilterSelect[] = 'category_id = ?';
$Data->addParam($this->categoryId);
}
if ($this->customerId !== 0) {
$arrFilterSelect[] = 'account_customerId = ?';
$Data->addParam($this->customerId);
}
if ($this->searchFavorites === true) {
$arrFilterSelect[] = 'accFavorites.accfavorite_userId = ?';
$Data->addParam(Session::getUserId());
}
@@ -525,35 +449,11 @@ class AccountSearch
$queryWhere = '';
}
$query = 'SELECT DISTINCT account_id,
account_customerId,
category_name,
account_name,
account_login,
account_url,
account_notes,
account_userId,
account_userGroupId,
BIN(account_otherUserEdit) AS account_otherUserEdit,
BIN(account_otherGroupEdit) AS account_otherGroupEdit,
usergroup_name,
customer_name,
count(accfile_id) as num_files
FROM accounts
LEFT JOIN accFiles ON account_id = accfile_accountId
LEFT JOIN categories ON account_categoryId = category_id
LEFT JOIN usrGroups ug ON account_userGroupId = usergroup_id
LEFT JOIN customers ON customer_id = account_customerId
LEFT JOIN accUsers ON accuser_accountId = account_id
LEFT JOIN accGroups ON accgroup_accountId = account_id
LEFT JOIN accFavorites ON accfavorite_accountId = account_id
LEFT JOIN accTags ON acctag_accountId = account_id
LEFT JOIN tags ON tag_id = acctag_tagId
' . $queryWhere . '
GROUP BY account_id
' . $this->getOrderString() . ' ' . $queryLimit;
$query = /** @lang SQL */
'SELECT * FROM account_search_v ' . $queryWhere . ' GROUP BY account_id ' . $this->getOrderString() . ' ' . $queryLimit;
$Data->setQuery($query);
$Data->setMapClassName('SP\DataModel\AccountSearchData');
// Obtener el número total de cuentas visibles por el usuario
DB::setFullRowCount();
@@ -712,9 +612,9 @@ class AccountSearch
|| !isset($accountColor[$id])
) {
// Se asigna el color de forma aleatoria a cada id
$color = array_rand($this->colors);
$color = array_rand(self::$colors);
$accountColor[$id] = '#' . $this->colors[$color];
$accountColor[$id] = '#' . self::$colors[$color];
Session::setAccountColor($accountColor);
}

View File

@@ -27,6 +27,7 @@ namespace SP\Account;
use SP\Core\Exceptions\SPException;
use SP\DataModel\AccountData;
use SP\DataModel\AccountExtData;
use SP\Storage\DB;
use SP\Storage\QueryData;
@@ -47,7 +48,8 @@ class AccountTags
*/
public static function getTags(AccountData $accountData)
{
$query = 'SELECT tag_id, tag_name
$query = /** @lang SQL */
'SELECT tag_id, tag_name
FROM accTags
JOIN tags ON tag_id = acctag_tagId
WHERE acctag_accountId = :id
@@ -55,27 +57,22 @@ class AccountTags
$Data = new QueryData();
$Data->setQuery($query);
$Data->setUseKeyPair(true);
$Data->addParam($accountData->getAccountId(), 'id');
DB::setReturnArray();
$tags = [];
foreach (DB::getResults($Data) as $tag) {
$tags[$tag->tag_id] = $tag->tag_name;
}
return $tags;
return DB::getResults($Data);
}
/**
* Actualizar las etiquetas de una cuenta
*
* @param AccountData $accountData
* @param AccountExtData $accountData
* @return bool
* @throws \SP\Core\Exceptions\SPException
* @throws SPException
*/
public function addTags(AccountData $accountData)
public function addTags(AccountExtData $accountData)
{
if (!$this->deleteTags($accountData)) {
throw new SPException(SPException::SP_WARNING, _('Error al eliminar las etiquetas de la cuenta'));
@@ -96,7 +93,8 @@ class AccountTags
$values[] = '(?, ?)';
}
$query = 'INSERT INTO accTags (acctag_accountId, acctag_tagId) VALUES ' . implode(',', $values);
$query = /** @lang SQL */
'INSERT INTO accTags (acctag_accountId, acctag_tagId) VALUES ' . implode(',', $values);
$Data->setQuery($query);
@@ -111,7 +109,8 @@ class AccountTags
*/
public function deleteTags(AccountData $accountData)
{
$query = 'DELETE FROM accTags WHERE acctag_accountId = :id';
$query = /** @lang SQL */
'DELETE FROM accTags WHERE acctag_accountId = :id';
$Data = new QueryData();
$Data->setQuery($query);

View File

@@ -27,7 +27,11 @@ namespace SP\Account;
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
use SP\Config\Config;
use SP\Core\Session;
use SP\DataModel\AccountSearchData;
use SP\Html\Html;
use SP\Mgmt\Groups\GroupAccountsUtil;
use SP\Util\Checks;
/**
@@ -35,7 +39,7 @@ use SP\Util\Checks;
*
* @package SP\Controller
*/
class AccountsSearchData
class AccountsSearchItem
{
/** @var bool */
public static $accountLink = false;
@@ -52,57 +56,51 @@ class AccountsSearchData
/** @var bool */
public static $isDemoMode = false;
/** @var int */
private $id = 0;
/**
* @var AccountSearchData
*/
protected $AccountSearchData;
/** @var string */
private $name;
protected $color;
/** @var string */
private $login;
/** @var string */
private $category_name;
/** @var string */
private $customer_name;
/** @var string */
private $customer_link;
/** @var string */
private $color;
/** @var string */
private $link;
/** @var string */
private $url;
/** @var string */
private $url_short;
protected $link;
/** @var bool */
private $url_islink = false;
/** @var string */
private $notes;
/** @var string */
private $accesses;
protected $url_islink = false;
/** @var string */
private $numFiles;
protected $numFiles;
/** @var bool */
private $favorite = false;
protected $favorite = false;
/** @var bool */
private $showView = false;
protected $showView = false;
/** @var bool */
private $showViewPass = false;
protected $showViewPass = false;
/** @var bool */
private $showEdit = false;
protected $showEdit = false;
/** @var bool */
private $showCopy = false;
protected $showCopy = false;
/** @var bool */
private $showDelete = false;
protected $showDelete = false;
/** @var int */
private $textMaxLength = 60;
/** @var array */
private $tags =[];
protected $textMaxLength = 60;
/**
* AccountsSearchItem constructor.
*
* @param AccountSearchData $AccountSearchData
*/
public function __construct(AccountSearchData $AccountSearchData)
{
$this->AccountSearchData = $AccountSearchData;
}
/**
* @return boolean
*/
public function isFavorite()
{
return $this->favorite;
$favorites = AccountFavorites::getFavorites(Session::getUserId());
return in_array($this->AccountSearchData->getAccountId(), $favorites);
}
/**
@@ -119,7 +117,7 @@ class AccountsSearchData
public function isShowRequest()
{
return (!$this->isShow()
&& (AccountsSearchData::$requestEnabled || AccountsSearchData::$isDemoMode));
&& (AccountsSearchItem::$requestEnabled || AccountsSearchItem::$isDemoMode));
}
/**
@@ -159,7 +157,7 @@ class AccountsSearchData
*/
public function isShowOptional()
{
return (!AccountsSearchData::$optionalActions
return (!AccountsSearchItem::$optionalActions
&& ($this->showEdit || $this->showViewPass || $this->showCopy || $this->showDelete));
}
@@ -174,9 +172,9 @@ class AccountsSearchData
/**
* @return string
*/
public function getUrlShort()
public function getShortUrl()
{
return $this->url_short;
return Html::truncate($this->AccountSearchData->getAccountUrl(), $this->textMaxLength);
}
/**
@@ -184,87 +182,23 @@ class AccountsSearchData
*/
public function isUrlIslink()
{
return $this->url_islink;
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*/
public function setId($id)
{
$this->id = $id;
return preg_match('#^https?://#i', $this->AccountSearchData->getAccountUrl());
}
/**
* @return string
*/
public function getName()
public function getShortLogin()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
return Html::truncate($this->AccountSearchData->getAccountLogin(), $this->textMaxLength);
}
/**
* @return string
*/
public function getLogin()
public function getShortCustomerName()
{
return $this->login;
}
/**
* @param string $login
*/
public function setLogin($login)
{
$this->login = Html::truncate($login, $this->textMaxLength);
}
/**
* @return string
*/
public function getCategoryName()
{
return $this->category_name;
}
/**
* @param string $category_name
*/
public function setCategoryName($category_name)
{
$this->category_name = $category_name;
}
/**
* @return string
*/
public function getCustomerName()
{
return $this->customer_name;
}
/**
* @param string $customer_name
*/
public function setCustomerName($customer_name)
{
$this->customer_name = Html::truncate($customer_name, $this->textMaxLength);
return Html::truncate($this->AccountSearchData->getCustomerName(), $this->textMaxLength);
}
/**
@@ -272,15 +206,7 @@ class AccountsSearchData
*/
public function getCustomerLink()
{
return $this->customer_link;
}
/**
* @param string $customer_link
*/
public function setCustomerLink($customer_link)
{
$this->customer_link = $customer_link;
return self::$wikiEnabled ? Config::getConfig()->getWikiSearchurl() . $this->AccountSearchData->getCustomerName() : '';
}
/**
@@ -315,54 +241,22 @@ class AccountsSearchData
$this->link = $link;
}
/**
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* @param string $url
*/
public function setUrl($url)
{
$this->url = $url;
$this->url_short = Html::truncate($url, $this->textMaxLength);
$this->url_islink = preg_match('#^https?://#i', $url);
}
/**
* @return string
*/
public function getNotes()
{
return $this->notes;
}
/**
* @param string $notes
*/
public function setNotes($notes)
{
$this->notes = $notes;
}
/**
* @return string
*/
public function getAccesses()
{
return $this->accesses;
}
$accesses = sprintf('<em>(G) %s*</em><br>', $this->AccountSearchData->getUsergroupName());
/**
* @param string $accesses
*/
public function setAccesses($accesses)
{
$this->accesses = $accesses;
foreach (GroupAccountsUtil::getGroupsInfoForAccount($this->AccountSearchData->getAccountId()) as $group) {
$accesses .= sprintf('<em>(G) %s</em><br>', $group->getUsergroupName());
}
foreach (UserAccounts::getUsersInfoForAccount($this->AccountSearchData->getAccountId()) as $user) {
$accesses .= sprintf('<em>(U) %s</em><br>', $user->getUserLogin());
}
return $accesses;
}
/**
@@ -370,7 +264,7 @@ class AccountsSearchData
*/
public function getNumFiles()
{
return $this->numFiles;
return Checks::fileIsEnabled() ? $this->AccountSearchData->getNumFiles() : 0;
}
/**
@@ -446,18 +340,33 @@ class AccountsSearchData
}
/**
* @return array
* @return AccountSearchData
*/
public function getTags()
public function getAccountSearchData()
{
return $this->tags;
return $this->AccountSearchData;
}
/**
* @param array $tags
* @param AccountSearchData $AccountSearchData
*/
public function setTags($tags)
public function setAccountSearchData($AccountSearchData)
{
$this->tags = $tags;
$this->AccountSearchData = $AccountSearchData;
}
/**
* @return string
*/
public function getShortNotes()
{
$accountNotes = '';
if ($this->AccountSearchData->getAccountNotes()) {
$accountNotes = (strlen($this->AccountSearchData->getAccountNotes()) > 300) ? substr($this->AccountSearchData->getAccountNotes(), 0, 300) . '...' : $this->AccountSearchData->getAccountNotes();
$accountNotes = nl2br(wordwrap(htmlspecialchars($accountNotes), 50, '<br>', true));
}
return $accountNotes;
}
}

View File

@@ -66,7 +66,7 @@ class UserAccounts
$queryExcluded = '';
// Excluimos los usuarios actuales
if (is_array($usersId)) {
if ($usersId !== null && count($usersId) > 0) {
array_map('intval', $usersId);
$queryExcluded = 'AND accuser_userId NOT IN (' . implode(',', $usersId) . ')';
}

View File

@@ -37,6 +37,7 @@ use SP\Core\ActionsInterface;
use SP\Core\Crypt;
use SP\Core\Init;
use SP\Core\Template;
use SP\DataModel\AccountExtData;
use SP\DataModel\CustomFieldData;
use SP\Mgmt\Categories\Category;
use SP\Mgmt\Customers\Customer;
@@ -67,14 +68,14 @@ class AccountController extends ControllerBase implements ActionsInterface
* @var \SP\Account\Account|AccountHistory instancia para el manejo de datos de una cuenta
*/
private $Account;
/**
* @var bool indica si se han obtenido datos de la cuenta
*/
private $gotData = false;
/**
* @var int con el id de la cuenta
*/
private $id;
/**
* @var AccountExtData
*/
private $AccountData;
/**
* Constructor
@@ -110,7 +111,7 @@ class AccountController extends ControllerBase implements ActionsInterface
*/
private function isGotData()
{
return $this->gotData;
return $this->AccountData !== null;
}
/**
@@ -179,15 +180,14 @@ class AccountController extends ControllerBase implements ActionsInterface
$this->view->assign('accountOtherGroups', GroupAccountsUtil::getGroupsInfoForAccount($this->getId()));
$this->view->assign('accountTags', $this->getAccount()->getAccountData()->getTags());
$this->view->assign('accountTagsJson', Json::getJson(array_keys($this->getAccount()->getAccountData()->getTags())));
$this->view->assign('changesHash', $this->getAccount()->getAccountModHash());
$this->view->assign('chkUserEdit', $this->getAccount()->getAccountData()->getAccountOtherUserEdit() ? 'checked' : '');
$this->view->assign('chkGroupEdit', $this->getAccount()->getAccountData()->getAccountOtherGroupEdit() ? 'checked' : '');
$this->view->assign('historyData', AccountHistory::getAccountList($this->getAccount()->getAccountParentId()));
$this->view->assign('isModified', $this->view->accountData->account_dateEdit && $this->view->accountData->account_dateEdit !== '0000-00-00 00:00:00');
$this->view->assign('isModified', $this->AccountData->getAccountDateEdit() && $this->AccountData->getAccountDateEdit() !== '0000-00-00 00:00:00');
$this->view->assign('maxFileSize', round(Config::getConfig()->getFilesAllowedSize() / 1024, 1));
$this->view->assign('filesAllowedExts', implode(',', Config::getConfig()->getFilesAllowedExts()));
$publicLinkUrl = (Checks::publicLinksIsEnabled() && isset($this->view->accountData->publicLink_hash)) ? Init::$WEBURI . '/?h=' . $this->view->accountData->publicLink_hash . '&a=link' : '';
$publicLinkUrl = (Checks::publicLinksIsEnabled() && $this->AccountData->getPublicLinkHash() ? Init::$WEBURI . '/?h=' . $this->AccountData->getPublicLinkHash() . '&a=link' : '');
$this->view->assign('publicLinkUrl', $publicLinkUrl);
}
@@ -271,16 +271,13 @@ class AccountController extends ControllerBase implements ActionsInterface
private function setAccountData()
{
try {
$this->setAccount(new Account(new AccountData($this->getId())));
$this->setAccount(new Account(new AccountExtData($this->getId())));
$this->Account->setAccountParentId($this->getId());
$this->AccountData = $this->getAccount()->getData();
$this->view->assign('accountId', $this->getId());
$this->view->assign('accountData', $this->getAccount()->getData());
$this->view->assign('gotData', true);
$this->setGotData(true);
Session::setLastAcountId($this->getId());
$this->view->assign('accountData', $this->AccountData);
$this->view->assign('gotData', $this->isGotData());
} catch (SPException $e) {
return false;
}
@@ -295,14 +292,6 @@ class AccountController extends ControllerBase implements ActionsInterface
$this->Account = $account;
}
/**
* @param boolean $gotData
*/
private function setGotData($gotData)
{
$this->gotData = $gotData;
}
/**
* Obtener los datos para mostrar el interface para editar cuenta
*/
@@ -424,16 +413,13 @@ class AccountController extends ControllerBase implements ActionsInterface
private function setAccountDataHistory()
{
try {
$this->setAccount(new AccountHistory(new AccountData($this->getId())));
$this->setAccount(new AccountHistory(new AccountExtData($this->getId())));
$this->Account->setAccountParentId(Session::getAccountParentId());
$this->AccountData = $this->getAccount()->getData();
$this->view->assign('accountId', $this->getId());
$this->view->assign('accountData', $this->getAccount()->getData());
$this->view->assign('gotData', true);
$this->setGotData(true);
Session::setLastAcountId(Session::getAccountParentId());
$this->view->assign('accountData', $this->AccountData);
$this->view->assign('gotData', $this->isGotData());
} catch (SPException $e) {
return false;
}

View File

@@ -28,7 +28,7 @@ namespace SP\Controller;
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
use SP\Account\AccountSearch;
use SP\Account\AccountsSearchData;
use SP\Account\AccountsSearchItem;
use SP\Config\Config;
use SP\Core\ActionsInterface;
use SP\Core\Session;
@@ -177,15 +177,15 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
|| $this->view->searchFavorites
|| $Search->isSortViews());
AccountsSearchData::$accountLink = Session::getUserPreferences()->isAccountLink();
AccountsSearchData::$topNavbar = Session::getUserPreferences()->isTopNavbar();
AccountsSearchData::$optionalActions = Session::getUserPreferences()->isOptionalActions();
AccountsSearchData::$requestEnabled = Checks::mailrequestIsEnabled();
AccountsSearchData::$wikiEnabled = Checks::wikiIsEnabled();
AccountsSearchData::$dokuWikiEnabled = Checks::dokuWikiIsEnabled();
AccountsSearchData::$isDemoMode = Checks::demoIsEnabled();
AccountsSearchItem::$accountLink = Session::getUserPreferences()->isAccountLink();
AccountsSearchItem::$topNavbar = Session::getUserPreferences()->isTopNavbar();
AccountsSearchItem::$optionalActions = Session::getUserPreferences()->isOptionalActions();
AccountsSearchItem::$requestEnabled = Checks::mailrequestIsEnabled();
AccountsSearchItem::$wikiEnabled = Checks::wikiIsEnabled();
AccountsSearchItem::$dokuWikiEnabled = Checks::dokuWikiIsEnabled();
AccountsSearchItem::$isDemoMode = Checks::demoIsEnabled();
if (AccountsSearchData::$wikiEnabled) {
if (AccountsSearchItem::$wikiEnabled) {
$wikiFilter = array_map(function ($value) {
return preg_quote($value);
}, Config::getConfig()->getWikiFilter());
@@ -216,7 +216,7 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
$GridActionView->setName(_('Detalles de Cuenta'));
$GridActionView->setTitle(_('Detalles de Cuenta'));
$GridActionView->setIcon($this->icons->getIconView());
$GridActionView->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowView');
$GridActionView->setReflectionFilter('\\SP\\Account\\AccountsSearchItem', 'isShowView');
$GridActionView->addData('action-id', self::ACTION_ACC_VIEW);
$GridActionView->addData('action-sk', $this->sk);
$GridActionView->addData('onclick', 'account/show');
@@ -227,7 +227,7 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
$GridActionViewPass->setName(_('Ver Clave'));
$GridActionViewPass->setTitle(_('Ver Clave'));
$GridActionViewPass->setIcon($this->icons->getIconViewPass());
$GridActionViewPass->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowViewPass');
$GridActionViewPass->setReflectionFilter('\\SP\\Account\\AccountsSearchItem', 'isShowViewPass');
$GridActionViewPass->addData('action-id', self::ACTION_ACC_VIEW_PASS);
$GridActionViewPass->addData('action-sk', $this->sk);
$GridActionViewPass->addData('onclick', 'account/showpass');
@@ -241,7 +241,7 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
$GridActionCopyPass->setName(_('Copiar Clave en Portapapeles'));
$GridActionCopyPass->setTitle(_('Copiar Clave en Portapapeles'));
$GridActionCopyPass->setIcon($ClipboardIcon);
$GridActionCopyPass->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowCopyPass');
$GridActionCopyPass->setReflectionFilter('\\SP\\Account\\AccountsSearchItem', 'isShowCopyPass');
$GridActionCopyPass->addData('action-id', self::ACTION_ACC_VIEW_PASS);
$GridActionCopyPass->addData('action-sk', $this->sk);
$GridActionCopyPass->addData('useclipboard', '1');
@@ -254,7 +254,7 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
$GridActionEdit->setName(_('Editar Cuenta'));
$GridActionEdit->setTitle(_('Editar Cuenta'));
$GridActionEdit->setIcon($EditIcon);
$GridActionEdit->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowEdit');
$GridActionEdit->setReflectionFilter('\\SP\\Account\\AccountsSearchItem', 'isShowEdit');
$GridActionEdit->addData('action-id', self::ACTION_ACC_EDIT);
$GridActionEdit->addData('action-sk', $this->sk);
$GridActionEdit->addData('onclick', 'account/edit');
@@ -267,7 +267,7 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
$GridActionCopy->setName(_('Copiar Cuenta'));
$GridActionCopy->setTitle(_('Copiar Cuenta'));
$GridActionCopy->setIcon($CopyIcon);
$GridActionCopy->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowCopy');
$GridActionCopy->setReflectionFilter('\\SP\\Account\\AccountsSearchItem', 'isShowCopy');
$GridActionCopy->addData('action-id', self::ACTION_ACC_COPY);
$GridActionCopy->addData('action-sk', $this->sk);
$GridActionCopy->addData('onclick', 'account/copy');
@@ -280,7 +280,7 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
$GridActionDel->setName(_('Eliminar Cuenta'));
$GridActionDel->setTitle(_('Eliminar Cuenta'));
$GridActionDel->setIcon($DeleteIcon);
$GridActionDel->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowDelete');
$GridActionDel->setReflectionFilter('\\SP\\Account\\AccountsSearchItem', 'isShowDelete');
$GridActionDel->addData('action-id', self::ACTION_ACC_DELETE);
$GridActionDel->addData('action-sk', $this->sk);
$GridActionDel->addData('onclick', 'account/delete');
@@ -290,7 +290,7 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
$GridActionRequest->setName(_('Solicitar Modificación'));
$GridActionRequest->setTitle(_('Solicitar Modificación'));
$GridActionRequest->setIcon($this->icons->getIconEmail());
$GridActionRequest->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowRequest');
$GridActionRequest->setReflectionFilter('\\SP\\Account\\AccountsSearchItem', 'isShowRequest');
$GridActionRequest->addData('action-id', self::ACTION_ACC_REQUEST);
$GridActionRequest->addData('action-sk', $this->sk);
$GridActionRequest->addData('onclick', 'account/request');
@@ -300,7 +300,7 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
$GridActionOptional->setName(_('Más Acciones'));
$GridActionOptional->setTitle(_('Más Acciones'));
$GridActionOptional->setIcon($this->icons->getIconOptional());
$GridActionOptional->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowOptional');
$GridActionOptional->setReflectionFilter('\\SP\\Account\\AccountsSearchItem', 'isShowOptional');
$GridActionOptional->addData('onclick', 'account/menu');
$GridPager = new DataGridPager();

View File

@@ -30,10 +30,8 @@ defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'
use SP\Config\Config;
use SP\Core\ActionsInterface;
use SP\Core\Init;
use SP\Core\Installer;
use SP\Core\DiFactory;
use SP\Core\Template;
use SP\DataModel\InstallData;
use SP\Html\Html;
use SP\Mgmt\PublicLinks\PublicLink;
use SP\Http\Request;
@@ -54,41 +52,51 @@ class MainController extends ControllerBase implements ActionsInterface
/**
* Constructor
*
* @param $template Template con instancia de plantilla
* @param null $page El nombre de página para la clase del body
* @param bool $initialize Si es una inicialización completa
* @param $template Template con instancia de plantilla
* @param string $page El nombre de página para la clase del body
* @param bool $initialize Si es una inicialización completa
*/
public function __construct(Template $template = null, $page = null, $initialize = true)
public function __construct(Template $template = null, $page = '', $initialize = true)
{
parent::__construct($template);
if ($initialize) {
$this->view->assign('startTime', microtime());
$this->view->addTemplate('header');
$this->view->addTemplate('body-start');
$this->view->assign('isInstalled', Config::getConfig()->isInstalled());
$this->view->assign('sk', SessionUtil::getSessionKey(true));
$this->view->assign('appInfo', Util::getAppInfo());
$this->view->assign('appVersion', Util::getVersionString());
$this->view->assign('isDemoMode', Checks::demoIsEnabled());
$this->view->assign('loggedIn', Init::isLoggedIn());
$this->view->assign('page', $page);
$this->view->assign('icons', DiFactory::getTheme()->getIcons());
$this->view->assign('logoIcon', Init::$WEBURI . '/imgs/logo.png');
$this->view->assign('logoNoText', Init::$WEBURI . '/imgs/logo.svg');
$this->view->assign('logo', Init::$WEBURI . '/imgs/logo_full.svg');
$this->view->assign('httpsEnabled', Checks::httpsEnabled());
// Cargar la clave pública en la sesión
SessionUtil::loadPublicKey();
$this->getResourcesLinks();
$this->setResponseHeaders();
$this->initialize($page);
}
}
/**
* Inicializar las variables para la vista principal de la aplicación
*
* @param string $page Nombre de la vista
*/
protected function initialize($page = '')
{
$this->view->assign('startTime', microtime());
$this->view->addTemplate('header');
$this->view->addTemplate('body-start');
$this->view->assign('isInstalled', Config::getConfig()->isInstalled());
$this->view->assign('sk', SessionUtil::getSessionKey(true));
$this->view->assign('appInfo', Util::getAppInfo());
$this->view->assign('appVersion', Util::getVersionString());
$this->view->assign('isDemoMode', Checks::demoIsEnabled());
$this->view->assign('loggedIn', Init::isLoggedIn());
$this->view->assign('page', $page);
$this->view->assign('icons', DiFactory::getTheme()->getIcons());
$this->view->assign('logoIcon', Init::$WEBURI . '/imgs/logo.png');
$this->view->assign('logoNoText', Init::$WEBURI . '/imgs/logo.svg');
$this->view->assign('logo', Init::$WEBURI . '/imgs/logo_full.svg');
$this->view->assign('httpsEnabled', Checks::httpsEnabled());
// Cargar la clave pública en la sesión
SessionUtil::loadPublicKey();
$this->getResourcesLinks();
$this->setResponseHeaders();
}
/**
* Obtener los datos para la cabcera de la página
*/
@@ -314,7 +322,7 @@ class MainController extends ControllerBase implements ActionsInterface
$this->view->assign('hash', Request::analyze('h'));
$this->view->assign('time', Request::analyze('t'));
$this->view->assign('passReset', ($this->view->action === 'passreset' && $this->view->hash && $this->view->time));
$this->view->assign('passReset', $this->view->action === 'passreset' && $this->view->hash && $this->view->time);
} else {
$this->view->assign('showLogo', true);

View File

@@ -285,13 +285,13 @@ class Init
/**
* Devuelve un eror utilizando la plantilla de rror.
*
* @param string $str con la descripción del error
* @param string $str con la descripción del error
* @param string $hint opcional, con una ayuda sobre el error
*/
public static function initError($str, $hint = '')
{
$Tpl = new Template();
$Tpl->append('errors', array('type' => SPException::SP_CRITICAL, 'description' => $str, 'hint' => $hint));
$Tpl->append('errors', ['type' => SPException::SP_CRITICAL, 'description' => $str, 'hint' => $hint]);
$Controller = new MainController($Tpl);
$Controller->getError(true);
$Controller->view();
@@ -306,20 +306,20 @@ class Init
private static function setPaths()
{
// Calcular los directorios raíz
$dir = (defined(__DIR__)) ? __DIR__ : dirname(__FILE__);
$dir = defined(__DIR__) ? __DIR__ : dirname(__FILE__);
$dir = substr($dir, 0, strpos($dir, str_replace('\\', '/', __NAMESPACE__)) - 1);
self::$SERVERROOT = substr($dir, 0, strripos($dir, DIRECTORY_SEPARATOR));
self::$SUBURI = str_replace("\\", '/', substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen(self::$SERVERROOT)));
self::$SUBURI = str_replace("\\", '/', substr(realpath($_SERVER['SCRIPT_FILENAME']), strlen(self::$SERVERROOT)));
$scriptName = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
if (substr($scriptName, -1) == '/') {
if (substr($scriptName, -1) === '/') {
$scriptName .= 'index.php';
// Asegurar que suburi sigue las mismas reglas que scriptName
if (substr(self::$SUBURI, -9) != 'index.php') {
if (substr(self::$SUBURI, -1) != '/') {
if (substr(self::$SUBURI, -9) !== 'index.php') {
if (substr(self::$SUBURI, -1) !== '/') {
self::$SUBURI .= '/';
}
self::$SUBURI .= 'index.php';
@@ -334,11 +334,11 @@ class Init
self::$WEBROOT = substr($scriptName, 0, $pos);
if (self::$WEBROOT != '' && self::$WEBROOT[0] !== '/') {
if (self::$WEBROOT !== '' && self::$WEBROOT[0] !== '/') {
self::$WEBROOT = '/' . self::$WEBROOT;
}
$protocol = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';
$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
self::$WEBURI .= $protocol . $_SERVER['HTTP_HOST'] . self::$WEBROOT;
}
@@ -367,7 +367,7 @@ class Init
include_once CONFIG_FILE;
}
$configVersion = ($oldConfigCheck) ? (int)$CONFIG['version'] : Config::getConfig()->getConfigVersion();
$configVersion = $oldConfigCheck ? (int)$CONFIG['version'] : Config::getConfig()->getConfigVersion();
if (Config::getConfig()->isInstalled()
@@ -413,7 +413,7 @@ class Init
$configPerms = decoct(fileperms(self::$SERVERROOT . DIRECTORY_SEPARATOR . 'config') & 0777);
if (!Checks::checkIsWindows() && $configPerms != "750") {
if (!Checks::checkIsWindows() && $configPerms !== "750") {
clearstatcache();
self::initError(_('Los permisos del directorio "/config" son incorrectos'), _('Actual:') . ' ' . $configPerms . ' - ' . _('Necesario: 750'));
}
@@ -429,7 +429,7 @@ class Init
$srcScript = pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_BASENAME);
$skipInit = array('js.php', 'css.php', 'api.php', 'ajax_getEnvironment.php');
return (in_array($srcScript, $skipInit));
return in_array($srcScript, $skipInit);
}
/**
@@ -438,7 +438,7 @@ class Init
private static function checkHttps()
{
if (Checks::forceHttpsIsEnabled() && !Checks::httpsEnabled()) {
$port = ($_SERVER['SERVER_PORT'] != 443) ? ':' . $_SERVER['SERVER_PORT'] : '';
$port = ($_SERVER['SERVER_PORT'] !== 443) ? ':' . $_SERVER['SERVER_PORT'] : '';
$fullUrl = 'https://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
header('Location: ' . $fullUrl);
}
@@ -526,8 +526,8 @@ class Init
*/
private static function wrLogoutInfo()
{
$inactiveTime = round(((time() - Session::getLastActivity()) / 60), 2);
$totalTime = round(((time() - Session::getStartActivity()) / 60), 2);
$inactiveTime = round((time() - Session::getLastActivity()) / 60, 2);
$totalTime = round((time() - Session::getStartActivity()) / 60, 2);
$ulogin = Session::getUserLogin();
$Log = new Log(_('Finalizar sesión'));
@@ -553,7 +553,7 @@ class Init
*/
private static function checkDbVersion()
{
if (self::$SUBURI != '/index.php' || Request::analyze('logout', 0) === 1) {
if (self::$SUBURI !== '/index.php' || Request::analyze('logout', 0) === 1) {
return;
}
@@ -655,7 +655,7 @@ class Init
*/
private static function getSessionLifeTime()
{
if (is_null(Session::getSessionTimeout())) {
if (null === Session::getSessionTimeout()) {
Session::setSessionTimeout(Config::getConfig()->getSessionTimeout());
}
@@ -679,20 +679,19 @@ class Init
switch ($action) {
case 'passreset':
$Controller->getPassReset();
$Controller->view();
break;
case '2fa':
$Controller->get2FA();
$Controller->view();
break;
case 'link':
$Controller->getPublicLink();
$Controller->view();
break;
default:
return false;
}
$Controller->view();
exit();
}
@@ -703,13 +702,7 @@ class Init
*/
public static function isLoggedIn()
{
if (Session::getUserLogin()
&& Session::get2FApassed()
) {
return true;
}
return false;
return (Session::getUserLogin() && Session::get2FApassed());
}
/**
@@ -728,7 +721,7 @@ class Init
public static function loadClass($class)
{
// Eliminar \\ para las clases con namespace definido
$class = (strripos($class, '\\')) ? substr($class, strripos($class, '\\') + 1) : $class;
$class = strrpos($class, '\\') ? substr($class, strrpos($class, '\\') + 1) : $class;
// Buscar la clase en los directorios de include
foreach (explode(':', get_include_path()) as $includePath) {
@@ -756,8 +749,8 @@ class Init
switch ($action) {
case 'accView':
$itemId = Request::analyze('i');
$onLoad = 'doAction(' . ActionsInterface::ACTION_ACC_VIEW . ',' . ActionsInterface::ACTION_ACC_SEARCH . ',' . $itemId . ')';
$Controller->getMain($onLoad);
// $onLoad = 'doAction(' . ActionsInterface::ACTION_ACC_VIEW . ',' . ActionsInterface::ACTION_ACC_SEARCH . ',' . $itemId . ')';
$Controller->getMain();
$Controller->view();
break;
default:
@@ -774,7 +767,7 @@ class Init
*/
public static function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
}

View File

@@ -40,87 +40,75 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
/**
* @var int Id de la cuenta.
*/
private $accountId = 0;
public $account_id = 0;
/**
* @var int Id del usuario principal de la cuenta.
*/
private $accountUserId = 0;
/**
* @var array Los Ids de los usuarios secundarios de la cuenta.
*/
private $accountUsersId = [];
public $account_userId = 0;
/**
* @var int Id del grupo principal de la cuenta.
*/
private $accountUserGroupId = 0;
/**
* @var array Los Ids de los grupos secundarios de la cuenta.
*/
private $accountUserGroupsId = [];
public $account_userGroupId = 0;
/**
* @var int Id del usuario que editó la cuenta.
*/
private $accountUserEditId = 0;
public $account_userEditId = 0;
/**
* @var string El nombre de la cuenta.
*/
private $accountName = '';
public $account_name = '';
/**
* @var int Id del cliente de la cuenta.
*/
private $accountCustomerId = 0;
public $account_customerId = 0;
/**
* @var int Id de la categoría de la cuenta.
*/
private $accountCategoryId = 0;
public $account_categoryId = 0;
/**
* @var string El nombre de usuario de la cuenta.
*/
private $accountLogin = '';
public $account_login = '';
/**
* @var string La URL de la cuenta.
*/
private $accountUrl = '';
public $account_url = '';
/**
* @var string La clave de la cuenta.
*/
private $accountPass = '';
public $account_pass = '';
/**
* @var string El vector de inicialización de la cuenta.
*/
private $accountIV = '';
public $account_IV = '';
/**
* @var string Las nosta de la cuenta.
*/
private $accountNotes = '';
public $account_notes = '';
/**
* @var bool Si se permite la edición por los usuarios secundarios.
*/
private $accountOtherUserEdit = false;
public $account_otherUserEdit = false;
/**
* @var bool Si se permita la edición por los grupos secundarios.
*/
private $accountOtherGroupEdit = false;
public $account_otherGroupEdit = false;
/**
* @var int
*/
private $dateAdd = 0;
public $account_dateAdd = 0;
/**
* @var int
*/
private $dateEdit = 0;
public $account_dateEdit = 0;
/**
* @var bool
* @var int
*/
private $isModify = false;
public $account_countView = 0;
/**
* @var bool
* @var int
*/
private $isDeleted = false;
/**
* @var array
*/
private $tags = [];
public $account_countDecrypt = 0;
/**
* AccountData constructor.
@@ -129,71 +117,39 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function __construct($accountId = 0)
{
$this->accountId = (int)$accountId;
$this->account_id = (int)$accountId;
}
/**
* @return int
*/
public function getDateAdd()
public function getAccountDateAdd()
{
return $this->dateAdd;
return $this->account_dateAdd;
}
/**
* @param int $dateAdd
* @param int $account_dateAdd
*/
public function setDateAdd($dateAdd)
public function setAccountDateAdd($account_dateAdd)
{
$this->dateAdd = (int)$dateAdd;
$this->account_dateAdd = (int)$account_dateAdd;
}
/**
* @return int
*/
public function getDateEdit()
public function getAccountDateEdit()
{
return $this->dateEdit;
return $this->account_dateEdit;
}
/**
* @param int $dateEdit
* @param int $account_dateEdit
*/
public function setDateEdit($dateEdit)
public function setAccountDateEdit($account_dateEdit)
{
$this->dateEdit = (int)$dateEdit;
}
/**
* @return boolean
*/
public function isIsModify()
{
return $this->isModify;
}
/**
* @param boolean $isModify
*/
public function setIsModify($isModify)
{
$this->isModify = (int)$isModify;
}
/**
* @return boolean
*/
public function isIsDeleted()
{
return $this->isDeleted;
}
/**
* @param boolean $isDeleted
*/
public function setIsDeleted($isDeleted)
{
$this->isDeleted = (int)$isDeleted;
$this->account_dateEdit = (int)$account_dateEdit;
}
/**
@@ -201,15 +157,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountUserEditId()
{
return $this->accountUserEditId;
return $this->account_userEditId;
}
/**
* @param int $accountUserEditId
* @param int $account_userEditId
*/
public function setAccountUserEditId($accountUserEditId)
public function setAccountUserEditId($account_userEditId)
{
$this->accountUserEditId = (int)$accountUserEditId;
$this->account_userEditId = (int)$account_userEditId;
}
/**
@@ -217,15 +173,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountPass()
{
return $this->accountPass;
return $this->account_pass;
}
/**
* @param string $accountPass
* @param string $account_pass
*/
public function setAccountPass($accountPass)
public function setAccountPass($account_pass)
{
$this->accountPass = $accountPass;
$this->account_pass = $account_pass;
}
/**
@@ -233,15 +189,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountIV()
{
return $this->accountIV;
return $this->account_IV;
}
/**
* @param string $accountIV
* @param string $account_IV
*/
public function setAccountIV($accountIV)
public function setAccountIV($account_IV)
{
$this->accountIV = $accountIV;
$this->account_IV = $account_IV;
}
/**
@@ -249,15 +205,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountId()
{
return $this->accountId;
return $this->account_id;
}
/**
* @param int $accountId
* @param int $account_id
*/
public function setAccountId($accountId)
public function setAccountId($account_id)
{
$this->accountId = (int)$accountId;
$this->account_id = (int)$account_id;
}
/**
@@ -265,15 +221,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountUserId()
{
return $this->accountUserId;
return $this->account_userId;
}
/**
* @param int $accountUserId
* @param int $account_userId
*/
public function setAccountUserId($accountUserId)
public function setAccountUserId($account_userId)
{
$this->accountUserId = (int)$accountUserId;
$this->account_userId = (int)$account_userId;
}
/**
@@ -281,15 +237,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountUserGroupId()
{
return $this->accountUserGroupId;
return $this->account_userGroupId;
}
/**
* @param int $accountUserGroupId
* @param int $account_userGroupId
*/
public function setAccountUserGroupId($accountUserGroupId)
public function setAccountUserGroupId($account_userGroupId)
{
$this->accountUserGroupId = (int)$accountUserGroupId;
$this->account_userGroupId = (int)$account_userGroupId;
}
/**
@@ -297,15 +253,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountOtherUserEdit()
{
return $this->accountOtherUserEdit;
return $this->account_otherUserEdit;
}
/**
* @param bool $accountOtherUserEdit
* @param bool $account_otherUserEdit
*/
public function setAccountOtherUserEdit($accountOtherUserEdit)
public function setAccountOtherUserEdit($account_otherUserEdit)
{
$this->accountOtherUserEdit = (int)$accountOtherUserEdit;
$this->account_otherUserEdit = (int)$account_otherUserEdit;
}
/**
@@ -313,47 +269,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountOtherGroupEdit()
{
return $this->accountOtherGroupEdit;
return $this->account_otherGroupEdit;
}
/**
* @param bool $accountOtherGroupEdit
* @param bool $account_otherGroupEdit
*/
public function setAccountOtherGroupEdit($accountOtherGroupEdit)
public function setAccountOtherGroupEdit($account_otherGroupEdit)
{
$this->accountOtherGroupEdit = (int)$accountOtherGroupEdit;
}
/**
* @return array
*/
public function getAccountUserGroupsId()
{
return is_array($this->accountUserGroupsId) ? $this->accountUserGroupsId : [];
}
/**
* @param array $accountUserGroupsId
*/
public function setAccountUserGroupsId($accountUserGroupsId)
{
$this->accountUserGroupsId = $accountUserGroupsId;
}
/**
* @return array
*/
public function getAccountUsersId()
{
return $this->accountUsersId;
}
/**
* @param array $accountUsersId
*/
public function setAccountUsersId($accountUsersId)
{
$this->accountUsersId = $accountUsersId;
$this->account_otherGroupEdit = (int)$account_otherGroupEdit;
}
/**
@@ -361,15 +285,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountName()
{
return $this->accountName;
return $this->account_name;
}
/**
* @param string $accountName
* @param string $account_name
*/
public function setAccountName($accountName)
public function setAccountName($account_name)
{
$this->accountName = $accountName;
$this->account_name = $account_name;
}
/**
@@ -377,15 +301,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountCategoryId()
{
return $this->accountCategoryId;
return $this->account_categoryId;
}
/**
* @param int $accountCategoryId
* @param int $account_categoryId
*/
public function setAccountCategoryId($accountCategoryId)
public function setAccountCategoryId($account_categoryId)
{
$this->accountCategoryId = (int)$accountCategoryId;
$this->account_categoryId = (int)$account_categoryId;
}
/**
@@ -393,15 +317,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountCustomerId()
{
return $this->accountCustomerId;
return $this->account_customerId;
}
/**
* @param int $accountCustomerId
* @param int $account_customerId
*/
public function setAccountCustomerId($accountCustomerId)
public function setAccountCustomerId($account_customerId)
{
$this->accountCustomerId = (int)$accountCustomerId;
$this->account_customerId = (int)$account_customerId;
}
/**
@@ -409,15 +333,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountLogin()
{
return $this->accountLogin;
return $this->account_login;
}
/**
* @param string $accountLogin
* @param string $account_login
*/
public function setAccountLogin($accountLogin)
public function setAccountLogin($account_login)
{
$this->accountLogin = $accountLogin;
$this->account_login = $account_login;
}
/**
@@ -425,15 +349,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountUrl()
{
return $this->accountUrl;
return $this->account_url;
}
/**
* @param string $accountUrl
* @param string $account_url
*/
public function setAccountUrl($accountUrl)
public function setAccountUrl($account_url)
{
$this->accountUrl = $accountUrl;
$this->account_url = $account_url;
}
/**
@@ -441,15 +365,15 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getAccountNotes()
{
return $this->accountNotes;
return $this->account_notes;
}
/**
* @param string $accountNotes
* @param string $account_notes
*/
public function setAccountNotes($accountNotes)
public function setAccountNotes($account_notes)
{
$this->accountNotes = $accountNotes;
$this->account_notes = $account_notes;
}
/**
@@ -469,28 +393,12 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
return Json::safeJson($data);
}
/**
* @return array
*/
public function getTags()
{
return $this->tags;
}
/**
* @param array $tags
*/
public function setTags(array $tags)
{
$this->tags = $tags;
}
/**
* @return int
*/
public function getId()
{
return $this->accountId;
return $this->account_id;
}
/**
@@ -498,6 +406,38 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn
*/
public function getName()
{
return $this->accountName;
return $this->account_name;
}
/**
* @return int
*/
public function getAccountCountView()
{
return $this->account_countView;
}
/**
* @param int $account_countView
*/
public function setAccountCountView($account_countView)
{
$this->account_countView = (int)$account_countView;
}
/**
* @return int
*/
public function getAccountCountDecrypt()
{
return $this->account_countDecrypt;
}
/**
* @param int $account_countDecrypt
*/
public function setAccountCountDecrypt($account_countDecrypt)
{
$this->account_countDecrypt = (int)$account_countDecrypt;
}
}

View File

@@ -0,0 +1,206 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2016, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
namespace SP\DataModel;
/**
* Class AccountExtData
*
* @package SP\DataModel
*/
class AccountExtData extends AccountData
{
/**
* @var array Los Ids de los usuarios secundarios de la cuenta.
*/
public $usersId = [];
/**
* @var array Los Ids de los grupos secundarios de la cuenta.
*/
public $userGroupsId = [];
/**
* @var array
*/
public $tags = [];
/**
* @var string
*/
public $category_name = '';
/**
* @var string
*/
public $customer_name = '';
/**
* @var string
*/
public $usergroup_name = '';
/**
* @var string
*/
public $user_name = '';
/**
* @var string
*/
public $user_login = '';
/**
* @var string
*/
public $user_editName = '';
/**
* @var string
*/
public $user_editLogin = '';
/**
* @var string
*/
public $publicLink_hash = '';
/**
* @return string
*/
public function getUserEditName()
{
return $this->user_editName;
}
/**
* @return string
*/
public function getUserEditLogin()
{
return $this->user_editLogin;
}
/**
* @return string
*/
public function getPublicLinkHash()
{
return $this->publicLink_hash;
}
/**
* @return array
*/
public function getAccountUsersId()
{
return $this->usersId;
}
/**
* @return array
*/
public function getAccountUserGroupsId()
{
return $this->userGroupsId;
}
/**
* @return array
*/
public function getTags()
{
return $this->tags;
}
/**
* @param array $tags
*/
public function setTags(array $tags)
{
$this->tags = $tags;
}
/**
* @return string
*/
public function getCategoryName()
{
return $this->category_name;
}
/**
* @return string
*/
public function getCustomerName()
{
return $this->customer_name;
}
/**
* @return string
*/
public function getUsergroupName()
{
return $this->usergroup_name;
}
/**
* @return string
*/
public function getUserName()
{
return $this->user_name;
}
/**
* @return string
*/
public function getUserLogin()
{
return $this->user_login;
}
/**
* @return array
*/
public function getUsersId()
{
return $this->usersId;
}
/**
* @param array $usersId
*/
public function setUsersId(array $usersId)
{
$this->usersId = $usersId;
}
/**
* @return array
*/
public function getUserGroupsId()
{
return $this->userGroupsId;
}
/**
* @param array $userGroupsId
*/
public function setUserGroupsId(array $userGroupsId)
{
$this->userGroupsId = $userGroupsId;
}
}

View File

@@ -0,0 +1,74 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2016, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
namespace SP\DataModel;
/**
* Class AccountHistoryData
*
* @package SP\DataModel
*/
class AccountHistoryData extends AccountData
{
/**
* @var bool
*/
public $isModify = false;
/**
* @var bool
*/
public $isDeleted = false;
/**
* @return boolean
*/
public function isIsModify()
{
return $this->isModify;
}
/**
* @param boolean $isModify
*/
public function setIsModify($isModify)
{
$this->isModify = (int)$isModify;
}
/**
* @return boolean
*/
public function isIsDeleted()
{
return $this->isDeleted;
}
/**
* @param boolean $isDeleted
*/
public function setIsDeleted($isDeleted)
{
$this->isDeleted = (int)$isDeleted;
}
}

View File

@@ -0,0 +1,54 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2016, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
namespace SP\DataModel;
/**
* Class AccountSearchData
*
* @package SP\DataModel
*/
class AccountSearchData extends AccountExtData
{
/**
* @var int
*/
public $num_files = 0;
/**
* @return int
*/
public function getNumFiles()
{
return $this->num_files;
}
/**
* @param int $num_files
*/
public function setNumFiles($num_files)
{
$this->num_files = (int)$num_files;
}
}

View File

@@ -236,11 +236,11 @@ class CustomFieldBaseData extends DataModelBase
* @return void
* @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep
*/
function __wakeup()
public function __wakeup()
{
// Para realizar la conversión de nombre de propiedades que empiezan por _
foreach (get_object_vars($this) as $name => $value) {
if (substr($name, 0, 1) === '_') {
if ($name[0] === '_') {
$newName = substr($name, 1);
$this->$newName = $value;
}

View File

@@ -172,7 +172,7 @@ class CustomFieldDefData extends CustomFieldBaseData
* @return void
* @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep
*/
function __wakeup()
public function __wakeup()
{
parent::__wakeup();

View File

@@ -66,6 +66,10 @@ class ProfileData extends ProfileBaseData
* @var bool
*/
protected $accFiles = false;
/**
* @var bool
*/
protected $accPrivate = false;
/**
* @var bool
*/
@@ -494,4 +498,20 @@ class ProfileData extends ProfileBaseData
}
}
}
/**
* @return boolean
*/
public function isAccPrivate()
{
return $this->accPrivate;
}
/**
* @param boolean $accPrivate
*/
public function setAccPrivate($accPrivate)
{
$this->accPrivate = $accPrivate;
}
}

View File

@@ -70,7 +70,7 @@ class CustomFieldTypes
self::TYPE_COLOR => array('color', _('Color'))
);
if (!is_null($typeId)) {
if (null !== $typeId) {
return ($nice === false) ? $types[$typeId][0] : $types[$typeId][1];
}
@@ -94,10 +94,6 @@ class CustomFieldTypes
);
if (!is_null($moduleId)) {
return $modules[$moduleId];
}
return $modules;
return (null !== $moduleId) ? $modules[$moduleId] : $modules;
}
}

View File

@@ -123,7 +123,7 @@ class DB
) {
return $doQuery;
} elseif ($db->numRows === 0) {
if (self::$retArray){
if (self::$retArray) {
self::resetVars();
return [];
} else {
@@ -173,11 +173,7 @@ class DB
if ($isSelect) {
if (!$getRawData) {
$this->numFields = $queryRes->columnCount();
if ($queryData->getMapClassName()) {
$this->lastResult = $queryRes->fetchAll(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, $queryData->getMapClassName());
} else {
$this->lastResult = $queryRes->fetchAll(PDO::FETCH_OBJ);
}
$this->lastResult = $queryRes->fetchAll();
} else {
return $queryRes;
}
@@ -211,7 +207,7 @@ class DB
$db = DiFactory::getDBStorage()->getConnection();
if (is_array($queryData->getParams())) {
$sth = $db->prepare($queryData->getQuery());
$stmt = $db->prepare($queryData->getQuery());
$paramIndex = 0;
foreach ($queryData->getParams() as $param => $value) {
@@ -221,31 +217,42 @@ class DB
if ($isCount === true
&& count($count) > 0
&& $paramIndex >= $paramMaxIndex) {
&& $paramIndex >= $paramMaxIndex
) {
continue;
}
if ($param === 'blobcontent') {
$sth->bindValue($param, $value, PDO::PARAM_LOB);
$stmt->bindValue($param, $value, PDO::PARAM_LOB);
} elseif (is_int($value)) {
// error_log("INT: " . $param . " -> " . $value);
$sth->bindValue($param, $value, PDO::PARAM_INT);
$stmt->bindValue($param, $value, PDO::PARAM_INT);
} else {
// error_log("STR: " . $param . " -> " . print_r($value, true));
$sth->bindValue($param, $value, PDO::PARAM_STR);
$stmt->bindValue($param, $value, PDO::PARAM_STR);
}
$paramIndex++;
}
$sth->execute();
$stmt->execute();
} else {
$sth = $db->query($queryData->getQuery());
$stmt = $db->query($queryData->getQuery());
}
if ($queryData->isUseKeyPair() === true) {
$stmt->setFetchMode(PDO::FETCH_KEY_PAIR);
} elseif (null !== $queryData->getMapClass()) {
$stmt->setFetchMode(PDO::FETCH_INTO, $queryData->getMapClass());
} elseif ($queryData->getMapClassName()) {
$stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, $queryData->getMapClassName());
} else {
$stmt->setFetchMode(PDO::FETCH_OBJ);
}
DB::$lastId = $db->lastInsertId();
return $sth;
return $stmt;
} catch (\Exception $e) {
ob_start();
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
@@ -269,12 +276,13 @@ class DB
return 0;
}
$patterns = array(
$patterns = [
'/(LIMIT|ORDER BY|GROUP BY).*/i',
'/\(SELECT .*\)/',
'/SELECT DISTINCT\s([\w_]+),[\s\S]*? FROM/i',
'/SELECT [\w_]+,[\s\S]*? FROM/i',
);
$replace = array('', 'SELECT COUNT(DISTINCT \1) FROM', 'SELECT COUNT(*) FROM', '');
];
$replace = ['', '','SELECT COUNT(DISTINCT \1) FROM', 'SELECT COUNT(*) FROM', ''];
// preg_match('/SELECT DISTINCT\s([\w_]*),.*\sFROM\s([\w_]*)\s(LEFT|RIGHT|WHERE).*/iU', $queryData->getQuery(), $match);

View File

@@ -25,6 +25,8 @@
namespace SP\Storage;
use SP\DataModel\DataModelBase;
/**
* Class QueryData
*
@@ -44,6 +46,14 @@ class QueryData
* @var string
*/
protected $mapClassName = '';
/**
* @var DataModelBase
*/
protected $mapClass;
/**
* @var bool
*/
protected $useKeyPair = false;
/**
* @param $value
@@ -51,7 +61,7 @@ class QueryData
*/
public function addParam($value, $name = null)
{
if (!is_null($name)) {
if (null !== $name) {
$this->data[$name] = $value;
} else {
$this->data[] = $value;
@@ -97,4 +107,36 @@ class QueryData
{
$this->mapClassName = $mapClassName;
}
/**
* @return DataModelBase
*/
public function getMapClass()
{
return $this->mapClass;
}
/**
* @param DataModelBase $mapClass
*/
public function setMapClass(DataModelBase $mapClass)
{
$this->mapClass = $mapClass;
}
/**
* @return boolean
*/
public function isUseKeyPair()
{
return $this->useKeyPair;
}
/**
* @param boolean $useKeyPair
*/
public function setUseKeyPair($useKeyPair)
{
$this->useKeyPair = (bool)$useKeyPair;
}
}

View File

@@ -1,5 +1,5 @@
-- To 1.3.16100601
ALTER TABLE `syspass-dev`.`accHistory`
ALTER TABLE `accHistory`
CHANGE COLUMN `acchistory_userId` `acchistory_userId` SMALLINT(5) UNSIGNED NOT NULL ,
CHANGE COLUMN `acchistory_userEditId` `acchistory_userEditId` SMALLINT(5) UNSIGNED NOT NULL ,
CHANGE COLUMN `acchistory_customerId` `acchistory_customerId` INT(10) UNSIGNED NOT NULL ,
@@ -9,26 +9,26 @@ ADD INDEX `fk_accHistory_users_id_idx` (`acchistory_userId` ASC, `acchistory_use
ADD INDEX `fk_accHistory_categories_id_idx` (`acchistory_categoryId` ASC),
ADD INDEX `fk_accHistory_customers_id_idx` (`acchistory_customerId` ASC);
ALTER TABLE `syspass-dev`.`accTags`
ALTER TABLE `accTags`
CHANGE COLUMN `acctag_accountId` `acctag_accountId` SMALLINT(10) UNSIGNED NOT NULL ,
DROP INDEX `IDX_id` ,
ADD INDEX `IDX_id` (`acctag_accountId` ASC),
ADD INDEX `fk_accTags_tags_id_idx` (`acctag_tagId` ASC);
ALTER TABLE `syspass-dev`.`accUsers`
ALTER TABLE `accUsers`
DROP COLUMN `accuser_id`,
CHANGE COLUMN `accuser_accountId` `accuser_accountId` SMALLINT(5) UNSIGNED NOT NULL ,
CHANGE COLUMN `accuser_userId` `accuser_userId` SMALLINT(5) UNSIGNED NOT NULL ,
ADD INDEX `fk_accUsers_users_id_idx` (`accuser_userId` ASC),
DROP PRIMARY KEY;
ALTER TABLE `syspass-dev`.`accViewLinks`
ALTER TABLE `accViewLinks`
CHANGE COLUMN `accviewlinks_accountId` `accviewlinks_accountId` SMALLINT(5) UNSIGNED NULL DEFAULT NULL ,
CHANGE COLUMN `accviewlinks_userId` `accviewlinks_userId` SMALLINT(5) UNSIGNED NULL DEFAULT NULL ,
ADD INDEX `fk_accViewLinks_account_idx` (`accviewlinks_accountId` ASC),
ADD INDEX `fk_accViewLinks_user_id_idx` (`accviewlinks_userId` ASC);
ALTER TABLE `syspass-dev`.`accounts`
ALTER TABLE `accounts`
CHANGE COLUMN `account_id` `account_id` SMALLINT(5) UNSIGNED NOT NULL ,
CHANGE COLUMN `account_userId` `account_userId` SMALLINT(5) UNSIGNED NOT NULL ,
CHANGE COLUMN `account_userEditId` `account_userEditId` SMALLINT(5) UNSIGNED NOT NULL ,
@@ -36,16 +36,16 @@ CHANGE COLUMN `account_categoryId` `account_categoryId` SMALLINT(3) UNSIGNED NOT
CHANGE COLUMN `account_dateEdit` `account_dateEdit` DATETIME NULL DEFAULT NULL ,
ADD INDEX `fk_accounts_user_id_idx` (`account_userId` ASC, `account_userEditId` ASC);
ALTER TABLE `syspass-dev`.`authTokens`
ALTER TABLE `authTokens`
CHANGE COLUMN `authtoken_userId` `authtoken_userId` SMALLINT(5) UNSIGNED NOT NULL ,
ADD INDEX `fk_authTokens_users_id_idx` (`authtoken_userId` ASC, `authtoken_createdBy` ASC);
ALTER TABLE `syspass-dev`.`log`
ALTER TABLE `log`
CHANGE COLUMN `log_userId` `log_userId` SMALLINT(5) UNSIGNED NOT NULL ,
CHANGE COLUMN `log_description` `log_description` TEXT NULL DEFAULT NULL ,
ADD INDEX `fk_log_users_id_idx` (`log_userId` ASC);
ALTER TABLE `syspass-dev`.`usrData`
ALTER TABLE `usrData`
CHANGE COLUMN `user_groupId` `user_groupId` SMALLINT(3) UNSIGNED NOT NULL ,
CHANGE COLUMN `user_secGroupId` `user_secGroupId` SMALLINT(3) UNSIGNED NULL DEFAULT NULL ,
CHANGE COLUMN `user_profileId` `user_profileId` SMALLINT(5) UNSIGNED NOT NULL ,
@@ -56,165 +56,167 @@ CHANGE COLUMN `user_isDisabled` `user_isDisabled` BIT(1) NULL DEFAULT b'0' ,
ADD INDEX `fk_usrData_groups_id_idx` (`user_groupId` ASC),
ADD INDEX `fk_usrData_profiles_id_idx` (`user_profileId` ASC);
ALTER TABLE `syspass-dev`.`usrPassRecover`
ALTER TABLE `usrPassRecover`
CHANGE COLUMN `userpassr_used` `userpassr_used` BIT(1) NULL DEFAULT b'0' ;
ALTER TABLE `syspass-dev`.`usrToGroups`
ALTER TABLE `usrToGroups`
DROP COLUMN `usertogroup_id`,
CHANGE COLUMN `usertogroup_userId` `usertogroup_userId` SMALLINT(5) UNSIGNED NOT NULL ,
CHANGE COLUMN `usertogroup_groupId` `usertogroup_groupId` SMALLINT(5) UNSIGNED NOT NULL ,
ADD INDEX `fk_usrToGroups_groups_id_idx` (`usertogroup_groupId` ASC),
DROP PRIMARY KEY;
ALTER TABLE `syspass-dev`.`accFavorites`
ALTER TABLE `accFavorites`
ADD CONSTRAINT `fk_accFavorites_accounts_id`
FOREIGN KEY (`accfavorite_accountId`)
REFERENCES `syspass-dev`.`accounts` (`account_id`)
REFERENCES `accounts` (`account_id`)
ON DELETE CASCADE
ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_accFavorites_users_id`
FOREIGN KEY (`accfavorite_userId`)
REFERENCES `syspass-dev`.`usrData` (`user_id`)
REFERENCES `usrData` (`user_id`)
ON DELETE CASCADE
ON UPDATE NO ACTION;
ALTER TABLE `syspass-dev`.`accFiles`
ALTER TABLE `accFiles`
ADD CONSTRAINT `fk_accFiles_accounts_id`
FOREIGN KEY (`accfile_accountId`)
REFERENCES `syspass-dev`.`accounts` (`account_id`)
REFERENCES `accounts` (`account_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
ALTER TABLE `syspass-dev`.`accGroups`
ALTER TABLE `accGroups`
ADD CONSTRAINT `fk_accGroups_accounts_id`
FOREIGN KEY (`accgroup_accountId`)
REFERENCES `syspass-dev`.`accounts` (`account_id`)
REFERENCES `accounts` (`account_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `fk_accGroups_groups_id`
FOREIGN KEY (`accgroup_groupId`)
REFERENCES `syspass-dev`.`usrGroups` (`usergroup_id`)
REFERENCES `usrGroups` (`usergroup_id`)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE `syspass-dev`.`accHistory`
ALTER TABLE `accHistory`
ADD CONSTRAINT `fk_accHistory_users_id`
FOREIGN KEY (`acchistory_userId` , `acchistory_userEditId`)
REFERENCES `syspass-dev`.`usrData` (`user_id` , `user_id`)
REFERENCES `usrData` (`user_id` , `user_id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT,
ADD CONSTRAINT `fk_accHistory_categories_id`
FOREIGN KEY (`acchistory_categoryId`)
REFERENCES `syspass-dev`.`categories` (`category_id`)
REFERENCES `categories` (`category_id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT,
ADD CONSTRAINT `fk_accHistory_customers_id`
FOREIGN KEY (`acchistory_customerId`)
REFERENCES `syspass-dev`.`customers` (`customer_id`)
REFERENCES `customers` (`customer_id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
ALTER TABLE `syspass-dev`.`accTags`
ALTER TABLE `accTags`
ADD CONSTRAINT `fk_accTags_accounts_id`
FOREIGN KEY (`acctag_accountId`)
REFERENCES `syspass-dev`.`accounts` (`account_id`)
REFERENCES `accounts` (`account_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `fk_accTags_tags_id`
FOREIGN KEY (`acctag_tagId`)
REFERENCES `syspass-dev`.`tags` (`tag_id`)
REFERENCES `tags` (`tag_id`)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE `syspass-dev`.`accUsers`
ALTER TABLE `accUsers`
ADD CONSTRAINT `fk_accUsers_accounts_id`
FOREIGN KEY (`accuser_accountId`)
REFERENCES `syspass-dev`.`accounts` (`account_id`)
REFERENCES `accounts` (`account_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `fk_accUsers_users_id`
FOREIGN KEY (`accuser_userId`)
REFERENCES `syspass-dev`.`usrData` (`user_id`)
REFERENCES `usrData` (`user_id`)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE `syspass-dev`.`accViewLinks`
ALTER TABLE `accViewLinks`
ADD CONSTRAINT `fk_accViewLinks_account_id`
FOREIGN KEY (`accviewlinks_accountId`)
REFERENCES `syspass-dev`.`accounts` (`account_id`)
REFERENCES `accounts` (`account_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `fk_accViewLinks_user_id`
FOREIGN KEY (`accviewlinks_userId`)
REFERENCES `syspass-dev`.`usrData` (`user_id`)
REFERENCES `usrData` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
ALTER TABLE `syspass-dev`.`accounts`
ALTER TABLE `accounts`
ADD CONSTRAINT `fk_accounts_categories_id`
FOREIGN KEY (`account_categoryId`)
REFERENCES `syspass-dev`.`categories` (`category_id`)
REFERENCES `categories` (`category_id`)
ON DELETE RESTRICT
ON UPDATE CASCADE,
ADD CONSTRAINT `fk_accounts_user_id`
FOREIGN KEY (`account_userId` , `account_userEditId`)
REFERENCES `syspass-dev`.`usrData` (`user_id` , `user_id`)
REFERENCES `usrData` (`user_id` , `user_id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT,
ADD CONSTRAINT `fk_accounts_customer_id`
FOREIGN KEY (`account_customerId`)
REFERENCES `syspass-dev`.`customers` (`customer_id`)
REFERENCES `customers` (`customer_id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
ALTER TABLE `syspass-dev`.`authTokens`
ALTER TABLE `authTokens`
ADD CONSTRAINT `fk_authTokens_users_id`
FOREIGN KEY (`authtoken_userId` , `authtoken_createdBy`)
REFERENCES `syspass-dev`.`usrData` (`user_id` , `user_id`)
REFERENCES `usrData` (`user_id` , `user_id`)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE `syspass-dev`.`customFieldsData`
ALTER TABLE `customFieldsData`
ADD CONSTRAINT `fk_customFieldsData_def_id`
FOREIGN KEY (`customfielddata_defId`)
REFERENCES `syspass-dev`.`customFieldsDef` (`customfielddef_id`)
REFERENCES `customFieldsDef` (`customfielddef_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
ALTER TABLE `syspass-dev`.`log`
ALTER TABLE `log`
ADD CONSTRAINT `fk_log_users_id`
FOREIGN KEY (`log_userId`)
REFERENCES `syspass-dev`.`usrData` (`user_id`)
REFERENCES `usrData` (`user_id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
ALTER TABLE `syspass-dev`.`usrData`
ALTER TABLE `usrData`
ADD CONSTRAINT `fk_usrData_groups_id`
FOREIGN KEY (`user_groupId`)
REFERENCES `syspass-dev`.`usrGroups` (`usergroup_id`)
REFERENCES `usrGroups` (`usergroup_id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT,
ADD CONSTRAINT `fk_usrData_profiles_id`
FOREIGN KEY (`user_profileId`)
REFERENCES `syspass-dev`.`usrProfiles` (`userprofile_id`)
REFERENCES `usrProfiles` (`userprofile_id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
ALTER TABLE `syspass-dev`.`usrPassRecover`
ALTER TABLE `usrPassRecover`
ADD CONSTRAINT `fk_usrPassRecover_users`
FOREIGN KEY (`userpassr_userId`)
REFERENCES `syspass-dev`.`usrData` (`user_id`)
REFERENCES `usrData` (`user_id`)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE `syspass-dev`.`usrToGroups`
ALTER TABLE `usrToGroups`
ADD CONSTRAINT `fk_usrToGroups_users_id`
FOREIGN KEY (`usertogroup_userId`)
REFERENCES `syspass-dev`.`usrData` (`user_id`)
REFERENCES `usrData` (`user_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `fk_usrToGroups_groups_id`
FOREIGN KEY (`usertogroup_groupId`)
REFERENCES `syspass-dev`.`usrGroups` (`usergroup_id`)
REFERENCES `usrGroups` (`usergroup_id`)
ON DELETE CASCADE
ON UPDATE CASCADE;
ON UPDATE CASCADE;
CREATE ALGORITHM=UNDEFINED DEFINER = CURRENT_USER SQL SECURITY DEFINER VIEW `account_search_v` AS select distinct `accounts`.`account_id` AS `account_id`,`accounts`.`account_customerId` AS `account_customerId`,`accounts`.`account_name` AS `account_name`,`accounts`.`account_login` AS `account_login`,`accounts`.`account_url` AS `account_url`,`accounts`.`account_notes` AS `account_notes`,`accounts`.`account_userId` AS `account_userId`,`accounts`.`account_userGroupId` AS `account_userGroupId`,conv(`accounts`.`account_otherUserEdit`,10,2) AS `account_otherUserEdit`,conv(`accounts`.`account_otherGroupEdit`,10,2) AS `account_otherGroupEdit`,`ug`.`usergroup_name` AS `usergroup_name`,`categories`.`category_name` AS `category_name`,`customers`.`customer_name` AS `customer_name`,(select count(0) from `accFiles` where (`accFiles`.`accfile_accountId` = `accounts`.`account_id`)) AS `num_files` from ((((((((`accounts` left join `categories` on((`accounts`.`account_categoryId` = `categories`.`category_id`))) left join `usrGroups` `ug` on((`accounts`.`account_userGroupId` = `ug`.`usergroup_id`))) left join `customers` on((`customers`.`customer_id` = `accounts`.`account_customerId`))) left join `accUsers` on((`accUsers`.`accuser_accountId` = `accounts`.`account_id`))) left join `accGroups` on((`accGroups`.`accgroup_accountId` = `accounts`.`account_id`))) left join `accFavorites` on((`accFavorites`.`accfavorite_accountId` = `accounts`.`account_id`))) left join `accTags` on((`accTags`.`acctag_accountId` = `accounts`.`account_id`))) left join `tags` on((`tags`.`tag_id` = `accTags`.`acctag_tagId`)));

View File

@@ -1,7 +1,7 @@
<?php
/**
* @var $data SP\Html\DataGrid\DataGridTab
* @var $account SP\Account\AccountsSearchData
* @var $account SP\Account\AccountsSearchItem
* @var $this SP\Core\Template
*/
?>
@@ -14,7 +14,7 @@
<!-- Data Header-->
<?php include $data->getDataHeaderTemplate(); ?>
<?php if (\SP\Account\AccountsSearchData::$topNavbar): ?>
<?php if (\SP\Account\AccountsSearchItem::$topNavbar): ?>
<!-- Data Pager -->
<?php include $data->getDataPagerTemplate(); ?>
<?php endif; ?>

View File

@@ -1,7 +1,7 @@
<?php
/**
* @var $data SP\Html\DataGrid\DataGridTab
* @var $account SP\Account\AccountsSearchData
* @var $account SP\Account\AccountsSearchItem
* @var $this SP\Core\Template
*/
?>

View File

@@ -1,7 +1,7 @@
<?php
/**
* @var $data SP\Html\DataGrid\DataGridTab
* @var $account SP\Account\AccountsSearchData
* @var $account SP\Account\AccountsSearchItem
* @var $this SP\Core\Template
*/
?>
@@ -50,9 +50,9 @@
<div class="field-name"><?php echo _('URL / IP'); ?></div>
<?php if ($account->isUrlIslink()): ?>
<a href="<?php echo $account->getUrl(); ?>" target="_blank"
title="<?php echo _('Abrir enlace a'), ': ', $account->getUrl(); ?>"><?php echo $account->getUrlShort(); ?></a>
title="<?php echo _('Abrir enlace a'), ': ', $account->getUrl(); ?>"><?php echo $account->getShortUrl(); ?></a>
<?php else: ?>
<div class="field-text"><?php echo $account->getUrlShort(); ?></div>
<div class="field-text"><?php echo $account->getShortUrl(); ?></div>
<?php endif; ?>
</div>
@@ -80,7 +80,7 @@
<?php if (isset($wikiFilter)): ?>
<?php if (preg_match('/^(' . preg_quote($wikiFilter) . ').*/i', $account->getName())): ?>
<?php if (\SP\Account\AccountsSearchData::$dokuWikiEnabled): ?>
<?php if (\SP\Account\AccountsSearchItem::$dokuWikiEnabled): ?>
<a href="<?php echo $wikiPageUrl, $account->getName(); ?>" target="_blank">
<img src="imgs/wiki.png" title="<?php echo _('Enlace a Wiki'); ?>"/>
</a>

View File

@@ -21,7 +21,7 @@
min-height: 8em;
height: auto;
text-align: left;
margin: 0 auto 0.2em;
margin: 0 auto 0.5em;
color: #696969;
background-color: #fcfcfc;
padding: 0 .5em;

View File

@@ -1 +1 @@
#content #data-search .account-info img,#content #data-search .account-actions img{width:24px;height:24px;margin:0 .5em}#content #data-search{text-align:center;padding:.5em 0;width:100%;margin:0 auto}#content #data-search .account-label{display:flex;justify-content:space-between;flex-wrap:wrap;width:100%;min-height:8em;height:auto;text-align:left;margin:0 auto .2em;color:#696969;background-color:#fcfcfc;padding:0 .5em}#content #data-search .account-label .label-row-up,#content #data-search .account-label .label-row-down{display:flex;flex-wrap:wrap;min-height:3em;height:auto;width:100%;padding:.5em 0}#content #data-search .account-label .label-row-down{height:3em}#content #data-search .account-label .label-left{display:flex;flex-wrap:wrap;align-items:center}#content #data-search .account-label .label-right{display:flex;flex-wrap:wrap;width:15em}#content #data-search .account-label .label-right>div{width:15em}#content #data-search .account-label .label-field{width:15em;min-height:3em;height:auto}#content #data-search .account-label .field-customer{width:20em}#content #data-search .account-label .field-name{padding:.3em .2em;color:#b9b9b9;display:none}#content #data-search .account-label .field-text{width:14em;padding:.3em .3em;word-wrap:break-word}#content #data-search .account-label .header .field-name{color:white;font-weight:bold}#content #data-search .account-label .field-text a{color:#4895fa}#content #data-search .account-label .no-link,#content #data-search .account-label .no-link a{color:white;font-weight:bold}#content #data-search .account-info{padding:.5em 0 .5em 0;text-align:left}#content #data-search .account-actions{align-self:baseline;padding:.5em 0;text-align:right;border-top:1px solid #c9c9c9}#content .actions-optional{display:none}#content #data-search .account-spacer{float:left;clear:left;height:2em;width:20%}#content #data-search .tags-box{display:inline-block}#content #data-search .tags-box span.tag{cursor:pointer}@media screen and (max-width:1000px){#content #data-search .account-label .label-field{width:100%}#content #data-search .account-label .field-name{display:block;text-align:left;border-bottom:1px solid #d9d9d9}#content #data-search .account-label .label-right,#content #data-search .account-label .label-right>div{width:100%}}
#content #data-search .account-info img,#content #data-search .account-actions img{width:24px;height:24px;margin:0 .5em}#content #data-search{text-align:center;padding:.5em 0;width:100%;margin:0 auto}#content #data-search .account-label{display:flex;justify-content:space-between;flex-wrap:wrap;width:100%;min-height:8em;height:auto;text-align:left;margin:0 auto .5em;color:#696969;background-color:#fcfcfc;padding:0 .5em}#content #data-search .account-label .label-row-up,#content #data-search .account-label .label-row-down{display:flex;flex-wrap:wrap;min-height:3em;height:auto;width:100%;padding:.5em 0}#content #data-search .account-label .label-row-down{height:3em}#content #data-search .account-label .label-left{display:flex;flex-wrap:wrap;align-items:center}#content #data-search .account-label .label-right{display:flex;flex-wrap:wrap;width:15em}#content #data-search .account-label .label-right>div{width:15em}#content #data-search .account-label .label-field{width:15em;min-height:3em;height:auto}#content #data-search .account-label .field-customer{width:20em}#content #data-search .account-label .field-name{padding:.3em .2em;color:#b9b9b9;display:none}#content #data-search .account-label .field-text{width:14em;padding:.3em .3em;word-wrap:break-word}#content #data-search .account-label .header .field-name{color:white;font-weight:bold}#content #data-search .account-label .field-text a{color:#4895fa}#content #data-search .account-label .no-link,#content #data-search .account-label .no-link a{color:white;font-weight:bold}#content #data-search .account-info{padding:.5em 0 .5em 0;text-align:left}#content #data-search .account-actions{align-self:baseline;padding:.5em 0;text-align:right;border-top:1px solid #c9c9c9}#content .actions-optional{display:none}#content #data-search .account-spacer{float:left;clear:left;height:2em;width:20%}#content #data-search .tags-box{display:inline-block}#content #data-search .tags-box span.tag{cursor:pointer}@media screen and (max-width:1000px){#content #data-search .account-label .label-field{width:100%}#content #data-search .account-label .field-name{display:block;text-align:left;border-bottom:1px solid #d9d9d9}#content #data-search .account-label .label-right,#content #data-search .account-label .label-right>div{width:100%}}

View File

@@ -217,6 +217,7 @@ pre, code, samp, kbd {
/* Action bar */
#container #actions-bar {
z-index: 100;
display: flex;
justify-content: space-between;
position: fixed;
@@ -555,9 +556,6 @@ pre, code, samp, kbd {
}
#content .data-header ul {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
list-style: none;
width: 100%;
margin: 0 0 10px 0;
@@ -565,12 +563,12 @@ pre, code, samp, kbd {
}
#content .data-header li {
display: inline-flex;
min-width: 10em;
padding: .5em;
display: inline-block;
padding: .2em .5em;
font-weight: bold;
letter-spacing: .2em;
color: #fff
color: #fff;
text-align: center;
}
#content .data-header li a {
@@ -585,14 +583,19 @@ pre, code, samp, kbd {
}
#content .data-header-minimal {
border-bottom: 1px solid #dfdfdf
border-bottom: 1px solid #dfdfdf;
}
#content .data-header-minimal ul {
margin: 0
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
margin: 0;
}
#content .data-header-minimal li {
display: inline-flex;
min-width: 10em;
font-weight: normal;
letter-spacing: normal
}
@@ -613,22 +616,22 @@ pre, code, samp, kbd {
#content .data-rows li {
float: left;
display: block;
padding: 1.5em .5em;
padding: 1em;
color: #696969;
text-align: center;
background-color: #fcfcfc;
height: 1em
min-height: 2em;
}
#content .data-rows li.cell-nodata {
padding: 1em 0;
height: 2em;
text-align: left
min-height: 2em;
text-align: left;
}
#content .data-rows li.cell-actions {
float: right;
height: 2em;
min-height: 2em;
padding: 1em 0;
text-align: center;
background-color: #fcfcfc;
@@ -1148,8 +1151,7 @@ footer img {
.header-grey {
background-color: #607d8b;
color: #fff;
height: 30px;
text-align: center
height: 2em;
}
.no-background {

File diff suppressed because one or more lines are too long

View File

@@ -92,6 +92,13 @@
<span class="mdl-switch__label"
title="<?php echo _('Publicar enlace a cuenta'); ?>"><?php echo _('Publicar Enlace'); ?></span>
</label>
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="profile_accprivate">
<input type="checkbox" id="profile_accprivate"
class="mdl-switch__input mdl-color-text--indigo-400"
name="profile_accprivate" <?php echo $profile->isAccPrivate() ? 'CHECKED' : ''; ?> <?php echo $isDisabled; ?>/>
<span class="mdl-switch__label"
title="<?php echo _('Crear cuenta privada'); ?>"><?php echo _('Privada'); ?></span>
</label>
</div>
</td>
</tr>

View File

@@ -9,7 +9,7 @@
<table class="data round">
<tr>
<td class="descField"><?php echo _('Nombre'); ?></td>
<td class="valField"><?php echo $accountData->account_name; ?></td>
<td class="valField"><?php echo $accountData->getAccountName(); ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Cliente'); ?></td>
@@ -17,12 +17,12 @@
</tr>
<tr>
<td class="descField"><?php echo _('URL / IP'); ?></td>
<td class="valField"><A href="<?php echo $accountData->account_url; ?>"
target="_blank"><?php echo $accountData->account_url; ?></td>
<td class="valField"><A href="<?php echo $accountData->getAccountUrl(); ?>"
target="_blank"><?php echo $accountData->getAccountUrl(); ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Usuario'); ?></td>
<td class="valField"><?php echo $accountData->account_login; ?></td>
<td class="valField"><?php echo $accountData->getAccountLogin(); ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Clave'); ?></td>

View File

@@ -11,7 +11,7 @@
<tr>
<td class="descField"><?php echo _('Nombre'); ?></td>
<td class="valField">
<?php echo $accountData->account_name; ?>
<?php echo $accountData->getAccountName(); ?>
</td>
</tr>
<tr>
@@ -29,19 +29,19 @@
<tr>
<td class="descField"><?php echo _('URL / IP'); ?></td>
<td class="valField">
<?php echo $accountData->account_url; ?>
<?php echo $accountData->getAccountUrl(); ?>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Usuario'); ?></td>
<td class="valField">
<?php echo $accountData->account_login; ?>
<?php echo $accountData->getAccountLogin(); ?>
</td>
</tr>
<tr>
<td class="descField"><?php echo _('Notas'); ?></td>
<td class="valField">
<?php echo $accountData->account_notes; ?>
<?php echo $accountData->getAccountNotes(); ?>
</tr>
<tr>
<td class="descField"><?php echo _('Clave'); ?></td>

View File

@@ -57,7 +57,7 @@
<option value=""><?php echo _('Seleccionar Grupo'); ?></option>
<?php foreach ($otherGroups as $group): ?>
<option
value="<?php echo $group->id; ?>" <?php echo ($gotData && $group->id == $accountData->account_userGroupId) ? 'selected' : ''; ?>><?php echo $group->name; ?></option>
value="<?php echo $group->id; ?>" <?php echo ($gotData && $group->id == $accountData->getAccountUserGroupId()) ? 'selected' : ''; ?>><?php echo $group->name; ?></option>
<?php endforeach; ?>
</select>
</td>

View File

@@ -1,4 +1,7 @@
<?php /** @var \SP\Account\AccountAcl $AccountAcl */ ?>
<?php
/** @var \SP\Account\AccountAcl $AccountAcl */
/** @var \SP\DataModel\AccountExtData $accountData */
?>
<div id="title" class="midroundup titleNormal">
<?php echo $title['name']; ?>
@@ -28,11 +31,11 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="name" name="name" type="text" required
class="mdl-textfield__input mdl-color-text--indigo-400"
maxlength="50" value="<?php echo $gotData ? $accountData->account_name : ''; ?>">
maxlength="50" value="<?php echo $gotData ? $accountData->getAccountName() : ''; ?>">
<label class="mdl-textfield__label" for="name"><?php echo _('Nombre de cuenta'); ?></label>
</div>
<?php else: ?>
<?php echo $accountData->account_name; ?>
<?php echo $accountData->getAccountName(); ?>
<?php endif; ?>
</td>
</tr>
@@ -44,7 +47,7 @@
<option value=""><?php echo _('Seleccionar Cliente'); ?></option>
<?php foreach ($customers as $customer): ?>
<option
value="<?php echo $customer->id; ?>" <?php echo ($gotData && $customer->id == $accountData->account_customerId) ? 'selected' : ''; ?>><?php echo $customer->name; ?></option>
value="<?php echo $customer->id; ?>" <?php echo ($gotData && $customer->id == $accountData->getAccountCustomerId()) ? 'selected' : ''; ?>><?php echo $customer->name; ?></option>
<?php endforeach; ?>
</select>
<i class="material-icons btn-action" title="<?php echo _('Nuevo Cliente'); ?>"
@@ -54,7 +57,7 @@
data-item-dst="selCustomer"
data-onclick="appMgmt/show"><?php echo $icons->getIconAdd()->getIcon(); ?></i>
<?php else: ?>
<?php echo $accountData->customer_name; ?>
<?php echo $accountData->getCustomerName(); ?>
<?php endif; ?>
</td>
</tr>
@@ -66,7 +69,7 @@
<option value=""><?php echo _('Seleccionar Categoría'); ?></option>
<?php foreach ($categories as $category): ?>
<option
value="<?php echo $category->id; ?>" <?php echo ($gotData && $category->id == $accountData->account_categoryId) ? 'selected' : ''; ?>><?php echo $category->name; ?></option>
value="<?php echo $category->id; ?>" <?php echo ($gotData && $category->id == $accountData->getAccountCategoryId()) ? 'selected' : ''; ?>><?php echo $category->name; ?></option>
<?php endforeach; ?>
</select>
<?php if (\SP\Core\Acl::checkUserAccess(\SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES)): ?>
@@ -78,7 +81,7 @@
data-onclick="appMgmt/show"><?php echo $icons->getIconAdd()->getIcon(); ?></i>
<?php endif; ?>
<?php else: ?>
<?php echo $accountData->category_name; ?>
<?php echo $accountData->getCategoryName(); ?>
<?php endif; ?>
</td>
</tr>
@@ -88,11 +91,11 @@
<?php if (!$isView): ?>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="url" name="url" type="text" class="mdl-textfield__input mdl-color-text--indigo-400"
maxlength="255" value="<?php echo $gotData ? $accountData->account_url : ''; ?>">
maxlength="255" value="<?php echo $gotData ? $accountData->getAccountUrl() : ''; ?>">
<label class="mdl-textfield__label" for="name"><?php echo _('URL o IP de acceso'); ?></label>
</div>
<?php else: ?>
<?php echo $accountData->account_url; ?>
<?php echo $accountData->getAccountUrl(); ?>
<?php endif; ?>
</td>
</tr>
@@ -103,11 +106,11 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="login" name="login" type="text" required
class="mdl-textfield__input mdl-color-text--indigo-400"
maxlength="50" value="<?php echo $gotData ? $accountData->account_login : ''; ?>">
maxlength="50" value="<?php echo $gotData ? $accountData->getAccountLogin() : ''; ?>">
<label class="mdl-textfield__label" for="name"><?php echo _('Usuario de acceso'); ?></label>
</div>
<?php else: ?>
<?php echo $accountData->account_login; ?>
<?php echo $accountData->getAccountLogin(); ?>
<?php endif; ?>
</td>
</tr>
@@ -144,12 +147,12 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<textarea class="mdl-textfield__input mdl-color-text--indigo-400" rows="3" id="notes"
name="notes"
maxlength="1000"><?php echo $gotData ? $accountData->account_notes : ''; ?></textarea>
maxlength="1000"><?php echo $gotData ? $accountData->getAccountNotes() : ''; ?></textarea>
<label class="mdl-textfield__label"
for="notes"><?php echo _('Notas sobre la cuenta'); ?></label>
</div>
<?php else: ?>
<?php echo $accountData->account_notes; ?>
<?php echo $accountData->getAccountNotes(); ?>
<?php endif; ?>
</tr>
@@ -184,11 +187,11 @@
</tr>
<?php endif; ?>
<?php if ($actionId === \SP\Core\ActionsInterface::ACTION_ACC_EDIT && $accountData->user_editName): ?>
<?php if ($actionId === \SP\Core\ActionsInterface::ACTION_ACC_EDIT && $accountData->getUserEditName()): ?>
<tr>
<td class="descField"><?php echo _('Última Modificación'); ?></td>
<?php if ($accountData->user_editName): ?>
<td class="valField"><?php echo $accountData->account_dateEdit, ' ', _('por'), ' ', $accountData->user_editName; ?></td>
<?php if ($accountData->getUserEditName()): ?>
<td class="valField"><?php echo $accountData->getAccountDateEdit(), ' ', _('por'), ' ', $accountData->getUserEditName(); ?></td>
<?php endif; ?>
</tr>
<?php endif; ?>
@@ -262,7 +265,7 @@
plugins: ['remove_button'],
options: otherUsers,
onInitialize: function () {
var userId = <?php echo $gotData ? $accountData->account_userId : 0; ?>;
var userId = <?php echo $gotData ? $accountData->getAccountUserId() : 0; ?>;
if (userId > 0) {
this.removeOption(userId);
@@ -280,7 +283,7 @@
plugins: ['remove_button'],
options: otherGroups,
onInitialize: function () {
var userGroupId = <?php echo $gotData ? $accountData->account_userGroupId : 0; ?>;
var userGroupId = <?php echo $gotData ? $accountData->getAccountUserGroupId() : 0; ?>;
if (userGroupId > 0) {
this.removeOption(userGroupId);

View File

@@ -1,22 +1,23 @@
<?php
/** @var \SP\Account\AccountAcl $AccountAcl */
/** @var \SP\Account\AccountAcl $AccountAcl */
/** @var \SP\DataModel\AccountExtData $accountData */
?>
<table class="data round extra-info">
<tr>
<td class="descField"><?php echo _('Visitas'); ?></td>
<td class="valField"><?php echo $accountData->account_countView . '(' . $accountData->account_countDecrypt . ')'; ?></td>
<td class="valField"><?php echo $accountData->getAccountCountView() . '(' . $accountData->getAccountCountDecrypt() . ')'; ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Fecha Alta'); ?></td>
<td class="valField"><?php echo $accountData->account_dateAdd ?></td>
<td class="valField"><?php echo $accountData->getAccountDateAdd() ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Creador'); ?></td>
<td class="valField"><?php echo $accountData->user_name ?: $accountData->user_login; ?></td>
<td class="valField"><?php echo $accountData->getUserName() ?: $accountData->getUserLogin(); ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Grupo Principal'); ?></td>
<td class="valField"><?php echo $accountData->usergroup_name; ?></td>
<td class="valField"><?php echo $accountData->getUsergroupName(); ?></td>
</tr>
<?php if (is_array($accountOtherUsers) && count($accountOtherUsers) > 0): ?>
<tr>
@@ -27,12 +28,12 @@
foreach ($accountOtherUsers as $otherUser) {
/** @var $otherUser \SP\DataModel\UserData */
if ($otherUser->getUserId() !== $accountData->account_userId){
if ($otherUser->getUserId() !== $accountData->getAccountUserId()) {
$users[] = $otherUser->getUserName();
}
}
$usersEdit = ($accountData->account_otherUserEdit) ? '(+)' : '';
$usersEdit = $accountData->getAccountOtherUserEdit() ? '(+)' : '';
echo $usersEdit . ' ' . implode(' | ', $users);
?>
</td>
@@ -47,14 +48,14 @@
foreach ($accountOtherGroups as $otherGroup) {
/** @var $otherGroup \SP\DataModel\GroupData */
if ($otherGroup->getUsergroupId() !== $accountData->account_userGroupId) {
if ($otherGroup->getUsergroupId() !== $accountData->getAccountUserGroupId()) {
$groups[] = $otherGroup->getUsergroupName();
}
}
$groupsEdit = $accountData->account_otherGroupEdit ? '(+)' : '';
$groupsEdit = $accountData->getAccountOtherGroupEdit() ? '(+)' : '';
echo $groupsEdit . ' ' . implode(" | ", $groups);
echo $groupsEdit . ' ' . implode(' | ', $groups);
?>
</td>
</tr>
@@ -62,14 +63,14 @@
<?php if ($AccountAcl->isModified()): ?>
<tr>
<td class="descField"><?php echo _('Fecha Edición'); ?></td>
<td class="valField"><?php echo $accountData->account_dateEdit; ?></td>
<td class="valField"><?php echo $accountData->getAccountDateEdit(); ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Editor'); ?></td>
<td class="valField"><?php echo $accountData->user_editName ?: $accountData->user_editLogin; ?></td>
<td class="valField"><?php echo $accountData->getUserEditName() ?: $accountData->getUserEditLogin(); ?></td>
</tr>
<?php endif; ?>
<?php if ($AccountAcl->isShowLink() && $accountData->publicLink_hash): ?>
<?php if ($AccountAcl->isShowLink() && $accountData->getPublicLinkHash()): ?>
<tr>
<td class="descField"><?php echo _('Enlace Público'); ?></td>
<td class="valField">

View File

@@ -9,7 +9,7 @@
<table class="data round">
<tr>
<td class="descField"><?php echo _('Nombre'); ?></td>
<td class="valField"><?php echo $accountData->account_name; ?></td>
<td class="valField"><?php echo $accountData->getAccountName(); ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Cliente'); ?></td>
@@ -18,12 +18,12 @@
<?php if ($lastAction === \SP\Core\ActionsInterface::ACTION_ACC_SEARCH): ?>
<tr>
<td class="descField"><?php echo _('URL / IP'); ?></td>
<td class="valField"><A href="<?php echo $accountData->account_url; ?>"
target="_blank"><?php echo $accountData->account_url; ?></td>
<td class="valField"><A href="<?php echo $accountData->getAccountUrl(); ?>"
target="_blank"><?php echo $accountData->getAccountUrl(); ?></td>
</tr>
<tr>
<td class="descField"><?php echo _('Usuario'); ?></td>
<td class="valField"><?php echo $accountData->account_login; ?></td>
<td class="valField"><?php echo $accountData->getAccountLogin(); ?></td>
</tr>
<?php endif; ?>
<tr>

View File

@@ -1,7 +1,7 @@
<?php
/**
* @var $data SP\Html\DataGrid\DataGridTab
* @var $account SP\Account\AccountsSearchData
* @var $account SP\Account\AccountsSearchItem
* @var $this SP\Core\Template
*/
?>

View File

@@ -1,7 +1,7 @@
<?php
/**
* @var $data SP\Html\DataGrid\DataGridTab
* @var $account SP\Account\AccountsSearchData
* @var $account SP\Account\AccountsSearchItem
* @var $this SP\Core\Template
*/
?>
@@ -14,7 +14,7 @@
<?php include $data->getDataHeaderTemplate(); ?>
</div>
<?php if (\SP\Account\AccountsSearchData::$topNavbar): ?>
<?php if (\SP\Account\AccountsSearchItem::$topNavbar): ?>
<!-- Data Pager -->
<div id="search-pager-top">
<?php include $data->getDataPagerTemplate(); ?>

View File

@@ -1,77 +1,79 @@
<?php
/**
* @var $data SP\Html\DataGrid\DataGridTab
* @var $Account SP\Account\AccountsSearchData
* @var $AccountSearchItem SP\Account\AccountsSearchItem
* @var $this SP\Core\Template
*/
?>
<div id="data-search">
<?php foreach ($data->getData()->getData() as $index => $Account): ?>
<?php foreach ($data->getData()->getData() as $index => $AccountSearchItem): ?>
<?php if ($index === 'count'): continue; endif; ?>
<?php $AccountSearchData = $AccountSearchItem->getAccountSearchData(); ?>
<div class="account-label round shadow">
<div class="label-left">
<div class="label-row-up">
<div class="field-customer label-field">
<div class="field-name"><?php echo _('Cliente'); ?></div>
<?php if (!empty($Account->getCustomerLink())): ?>
<a href="<?php echo $Account->getCustomerLink(); ?>" target="blank"
title="<?php echo _('Buscar en Wiki'); ?>&nbsp;<?php echo $Account->getCustomerName(); ?>">
<?php if (!empty($AccountSearchItem->getCustomerLink())): ?>
<a href="<?php echo $AccountSearchItem->getCustomerLink(); ?>" target="blank"
title="<?php echo _('Buscar en Wiki'); ?>&nbsp;<?php echo $AccountSearchData->getCustomerName(); ?>">
<span class="mdl-chip mdl-chip--contact">
<span style="background-color: <?php echo $Account->getColor(); ?>;"
<span style="background-color: <?php echo $AccountSearchItem->getColor(); ?>;"
class="mdl-chip__contact mdl-color-text--white">
<?php echo $Account->getCustomerName()[0]; ?></span>
<span class="mdl-chip__text"><?php echo $Account->getCustomerName(); ?></span>
<?php echo $AccountSearchData->getCustomerName()[0]; ?></span>
<span class="mdl-chip__text"><?php echo $AccountSearchData->getCustomerName(); ?></span>
</span>
</a>
<?php else: ?>
<span class="mdl-chip mdl-chip--contact">
<span style="background-color: <?php echo $Account->getColor(); ?>;"
<span style="background-color: <?php echo $AccountSearchItem->getColor(); ?>;"
class="mdl-chip__contact mdl-color-text--white">
<?php echo $Account->getCustomerName()[0]; ?></span>
<span class="mdl-chip__text"><?php echo $Account->getCustomerName(); ?></span>
<?php echo $AccountSearchData->getCustomerName()[0]; ?></span>
<span class="mdl-chip__text"><?php echo $AccountSearchData->getCustomerName(); ?></span>
</span>
<?php endif; ?>
</div>
<div class="field-account label-field">
<div class="field-name"><?php echo _('Nombre'); ?></div>
<?php if ($Account->isShow() && $Account->getLink()): ?>
<?php if ($AccountSearchItem->isShow() && $AccountSearchItem->getLink()): ?>
<a title="<?php echo _('Detalles de Cuenta'); ?>" class="btn-action"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_VIEW; ?>"
data-item-id="<?php echo $Account->getId(); ?>"
data-onclick="account/view"><?php echo $Account->getName(); ?></a>
data-item-id="<?php echo $AccountSearchData->getAccountId(); ?>"
data-onclick="account/view"><?php echo $AccountSearchData->getAccountName(); ?></a>
<?php else: ?>
<div class="field-text">
<?php echo $Account->getName(); ?>
<?php echo $AccountSearchData->getAccountName(); ?>
</div>
<?php endif; ?>
</div>
<div class="field-category label-field">
<div class="field-name"><?php echo _('Categoría'); ?></div>
<div class="field-text"><?php echo $Account->getCategoryName(); ?></div>
<div class="field-text"><?php echo $AccountSearchData->getCategoryName(); ?></div>
</div>
<?php if ($Account->isShow()): ?>
<?php if ($AccountSearchItem->isShow()): ?>
<div class="field-user label-field">
<div class="field-name"><?php echo _('Usuario'); ?></div>
<div class="field-text"><?php echo $Account->getLogin(); ?></div>
<div class="field-text"><?php echo $AccountSearchItem->getShortLogin(); ?></div>
</div>
<div class="field-url label-field">
<div class="field-name"><?php echo _('URL / IP'); ?></div>
<?php if ($Account->isUrlIslink()): ?>
<a href="<?php echo $Account->getUrl(); ?>" target="_blank"
title="<?php echo _('Abrir enlace a'), ': ', $Account->getUrl(); ?>"><?php echo $Account->getUrlShort(); ?></a>
<?php if ($AccountSearchItem->isUrlIslink()): ?>
<a href="<?php echo $AccountSearchData->getAccountUrl(); ?>" target="_blank"
title="<?php echo _('Abrir enlace a'), ': ', $AccountSearchData->getAccountUrl(); ?>"><?php echo $AccountSearchItem->getShortUrl(); ?></a>
<?php else: ?>
<div class="field-text"><?php echo $Account->getUrlShort(); ?></div>
<div class="field-text"><?php echo $AccountSearchItem->getShortUrl(); ?></div>
<?php endif; ?>
</div>
</div>
<div class="label-row-down">
<div class="tags-box">
<?php foreach ($Account->getTags() as $tag): ?>
<?php foreach ($AccountSearchData->getTags() as $tag): ?>
<span class="tag"><?php echo $tag; ?></span>
<?php endforeach; ?>
</div>
@@ -79,58 +81,58 @@
</div>
<div class="label-right">
<div class="account-info">
<?php if ($Account->isShow()): ?>
<i id="accesses-<?php echo $Account->getId(); ?>" class="material-icons">face</i>
<?php if ($AccountSearchItem->isShow()): ?>
<i id="accesses-<?php echo $AccountSearchData->getAccountId(); ?>" class="material-icons">face</i>
<div class="mdl-tooltip" for="accesses-<?php echo $Account->getId(); ?>">
<?php echo _('Permisos'), '<br>', $Account->getAccesses(); ?>
<div class="mdl-tooltip" for="accesses-<?php echo $AccountSearchData->getAccountId(); ?>">
<?php echo _('Permisos'), '<br>', $AccountSearchItem->getAccesses(); ?>
</div>
<?php if ($Account->isFavorite()): ?>
<?php if ($AccountSearchItem->isFavorite()): ?>
<i class="material-icons icon-favorite mdl-color-text--amber-A100"
title="<?php echo _('Eliminar Favorito'); ?>"
data-action-id-on="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_ADD; ?>"
data-action-id-off="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_DELETE; ?>"
data-item-id="<?php echo $Account->getId(); ?>"
data-item-id="<?php echo $AccountSearchData->getAccountId(); ?>"
data-status="<?php echo 'on'; ?>">star</i>
<?php else: ?>
<i class="material-icons icon-favorite"
title="<?php echo _('Marcar Favorito'); ?>"
data-action-id-on="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_ADD; ?>"
data-action-id-off="<?php echo \SP\Core\ActionsInterface::ACTION_ACC_FAVORITES_DELETE; ?>"
data-item-id="<?php echo $Account->getId(); ?>"
data-item-id="<?php echo $AccountSearchData->getAccountId(); ?>"
data-status="<?php echo 'off'; ?>">star_border</i>
<?php endif; ?>
<?php if ($Account->getNotes() !== ''): ?>
<i id="notes-<?php echo $Account->getId(); ?>" class="material-icons">speaker_notes</i>
<div class="mdl-tooltip" for="notes-<?php echo $Account->getId(); ?>">
<?php echo _('Notas'), '<br>', $Account->getNotes(); ?>
<?php if ($AccountSearchData->getAccountNotes() !== ''): ?>
<i id="notes-<?php echo $AccountSearchData->getAccountId(); ?>" class="material-icons">speaker_notes</i>
<div class="mdl-tooltip" for="notes-<?php echo $AccountSearchData->getAccountId(); ?>">
<?php echo _('Notas'), '<br>', $AccountSearchItem->getShortNotes(); ?>
</div>
<?php endif; ?>
<?php if ($Account->getNumFiles() > 0): ?>
<i id="attachments-<?php echo $Account->getId(); ?>"
<?php if ($AccountSearchItem->getNumFiles() > 0): ?>
<i id="attachments-<?php echo $AccountSearchData->getAccountId(); ?>"
class="material-icons">attach_file</i>
<div class="mdl-tooltip" for="attachments-<?php echo $Account->getId(); ?>">
<?php echo _('Archivos adjuntos'), ': ', $Account->getNumFiles(); ?>
<div class="mdl-tooltip" for="attachments-<?php echo $AccountSearchData->getAccountId(); ?>">
<?php echo _('Archivos adjuntos'), ': ', $AccountSearchItem->getNumFiles(); ?>
</div>
<?php endif; ?>
<?php if (isset($wikiFilter)): ?>
<?php if (preg_match('/^(' . $wikiFilter . ').*/i', $Account->getName())): ?>
<?php if (\SP\Account\AccountsSearchData::$dokuWikiEnabled): ?>
<a href="<?php echo $wikiPageUrl, $Account->getName(); ?>" target="_blank">
<?php if (preg_match('/^(' . $wikiFilter . ').*/i', $AccountSearchData->getAccountName())): ?>
<?php if (\SP\Account\AccountsSearchItem::$dokuWikiEnabled): ?>
<a href="<?php echo $wikiPageUrl, $AccountSearchData->getAccountName(); ?>" target="_blank">
<i class="material-icons"
title="<?php echo _('Enlace a Wiki'); ?>">library_books</i>
</a>
<i class="btn-action material-icons fg-green100"
title="<?php echo _('Ver en Wiki'); ?>"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_WIKI_VIEW; ?>"
data-item-id="<?php echo $Account->getName() ?>"
data-item-id="<?php echo $AccountSearchData->getAccountName(); ?>"
data-onclick="wiki/show">library_books</i>
<?php else: ?>
<a href="<?php echo $wikiPageUrl, $Account->getName(); ?>" target="_blank">
<a href="<?php echo $wikiPageUrl, $AccountSearchData->getAccountName(); ?>" target="_blank">
<i class="material-icons"
title="<?php echo _('Enlace a Wiki'); ?>">library_books</i>
</a>
@@ -142,10 +144,10 @@
<div class="account-actions">
<?php foreach ($data->getDataActions() as $action): ?>
<?php if ($action->getReflectionFilter()->invoke($Account)): ?>
<?php if ($action->getReflectionFilter()->invoke($AccountSearchItem)): ?>
<i class="btn-action material-icons <?php echo $action->getIcon()->getClass(); ?>"
title="<?php echo $action->getTitle(); ?>"
data-item-id="<?php echo $Account->getId(); ?>"
data-item-id="<?php echo $AccountSearchData->getAccountId(); ?>"
<?php foreach ($action->getData() as $name => $actionData): ?>
<?php echo 'data-', $name, '=', '"', $actionData, '"'; ?>
<?php endforeach; ?>><?php echo $action->getIcon()->getIcon(); ?></i>
@@ -153,17 +155,17 @@
<?php endforeach; ?>
<?php if (count($data->getDataActionsMenu()) > 0): ?>
<button id="actions-menu-lower-right-<?php echo $Account->getId(); ?>"
<button id="actions-menu-lower-right-<?php echo $AccountSearchData->getAccountId(); ?>"
class="mdl-button mdl-js-button mdl-button--icon">
<i class="material-icons">more_vert</i>
</button>
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect"
for="actions-menu-lower-right-<?php echo $Account->getId(); ?>">
for="actions-menu-lower-right-<?php echo $AccountSearchData->getAccountId(); ?>">
<?php foreach ($data->getDataActionsMenu() as $actionMenu): ?>
<?php if ($actionMenu->getReflectionFilter()->invoke($Account)): ?>
<?php if ($actionMenu->getReflectionFilter()->invoke($AccountSearchItem)): ?>
<li class="btn-action mdl-menu__item"
data-item-id="<?php echo $Account->getId(); ?>"
data-item-id="<?php echo $AccountSearchData->getAccountId(); ?>"
<?php foreach ($actionMenu->getData() as $name => $actionData): ?>
<?php echo 'data-', $name, '=', '"', $actionData, '"'; ?>
<?php endforeach; ?>>

View File

@@ -1,7 +1,7 @@
<?php
/**
* @var $data SP\Html\DataGrid\DataGridTab
* @var $account SP\Account\AccountsSearchData
* @var $account SP\Account\AccountsSearchItem
* @var $this SP\Core\Template
* @var $icons \SP\Core\UI\ThemeIconsBase
*/

View File

@@ -13,9 +13,7 @@
<?php if($dataIndex === 'count'): continue; endif; ?>
<ul>
<?php foreach ($data->getData()->getDataRowSources() as $rowSrc): ?>
<li class="cell-data" style="width: <?php echo $data->getHeader()->getWidth(); ?>%;">
<?php echo (null !== $dataItem->{$rowSrc}) ? $dataItem->{$rowSrc} : '&nbsp;'; // Fix height ?>
</li>
<li class="cell-data" style="width: <?php echo $data->getHeader()->getWidth(); ?>%;"><?php echo ($dataItem->{$rowSrc} !== '') ? $dataItem->{$rowSrc} : '&nbsp;'; // Fix height ?></li>
<?php endforeach; ?>
<?php if (count($data->getData()->getDataRowSourcesWithIcon()) > 0): ?>

View File

@@ -1,7 +1,7 @@
</div> <!-- Close container -->
<footer>
<div id="footer-left" class="footer-parts">
<?php if ($loggedIn): ?>
<?php if ($loggedIn === true): ?>
<div id="session">
<i id="btnLogout" class="material-icons" title="<?php echo _('Salir'); ?>">exit_to_app</i>
<?php if ($showPassIcon): ?>

View File

@@ -94,7 +94,7 @@ sysPass.Requests = function (Common) {
cache: false,
processData: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
timeout: 5000,
timeout: 0,
addHistory: false,
hash: "",
useLoading: true

View File

@@ -3,5 +3,5 @@ $jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineP
$jscomp.polyfill=function(b,c,a,d){if(c){a=$jscomp.global;b=b.split(".");for(d=0;d<b.length-1;d++){var e=b[d];e in a||(a[e]={});a=a[e]}b=b[b.length-1];d=a[b];c=c(d);c!=d&&null!=c&&$jscomp.defineProperty(a,b,{configurable:!0,writable:!0,value:c})}};
$jscomp.polyfill("String.prototype.startsWith",function(b){return b?b:function(b,a){var c=$jscomp.checkStringArgs(this,b,"startsWith");b+="";for(var e=c.length,f=b.length,g=Math.max(0,Math.min(a|0,c.length)),h=0;h<f&&g<e;)if(c[g++]!=b[h++])return!1;return h>=f}},"es6-impl","es3");
sysPass.Requests=function(b){var c=b.log,a=[],d={get:function(){return a},add:function(b){var e=""===b.hash?SparkMD5.hash(JSON.stringify(b),!1):b.hash;if(0<a.length&&a[a.length-1].hash===e)return a;c.info("history:add");b.hash=e;a.push(b);15<=a.length&&a.splice(0,10);return a},del:function(){c.info("history:del");if("undefined"!==typeof a.pop())return a[a.length-1]},reset:function(){c.info("history:reset");a=[]},length:function(){return a.length}};return{getRequestOpts:function(){return Object.create({type:"json",
url:"",method:"post",callback:"",async:!0,data:"",cache:!1,processData:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",timeout:5E3,addHistory:!1,hash:"",useLoading:!0})},getActionCall:function(a,f,g){c.info("getActionCall");var e=a.url.startsWith("http",0)?a.url:b.config().APP_ROOT+a.url;return $.ajax({dataType:a.type,url:e,method:a.method,async:a.async,data:a.data,cache:a.cache,processData:a.processData,contentType:a.contentType,timeout:a.timeout,beforeSend:function(){!0===a.useLoading&&
url:"",method:"post",callback:"",async:!0,data:"",cache:!1,processData:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",timeout:0,addHistory:!1,hash:"",useLoading:!0})},getActionCall:function(a,f,g){c.info("getActionCall");var e=a.url.startsWith("http",0)?a.url:b.config().APP_ROOT+a.url;return $.ajax({dataType:a.type,url:e,method:a.method,async:a.async,data:a.data,cache:a.cache,processData:a.processData,contentType:a.contentType,timeout:a.timeout,beforeSend:function(){!0===a.useLoading&&
b.appTheme().loading.show()},success:function(b){if("function"!==typeof f)return!0;!0===a.addHistory&&(a.callback=f,d.add(a));f(b)},error:function(d,e,f){"function"!==typeof g?(d=b.config().LANG[1]+"<p>"+f+e+"</p>",c.error(d),"html"===a.type&&$("#content").html(b.msg.html.error(f)),b.msg.error(d)):g()},complete:function(){!0===a.useLoading&&b.appTheme().loading.hide();b.appTheme().ajax.complete()}})},history:d}};