Merge branch 'master' into devel

Conflicts:
	inc/locales/en_US/LC_MESSAGES/messages.mo
	inc/locales/en_US/LC_MESSAGES/messages.po
This commit is contained in:
nuxsmin
2015-10-12 12:46:21 +02:00
25 changed files with 4833 additions and 4260 deletions

View File

@@ -57,6 +57,7 @@ if ($actionId === SP\Controller\ActionsInterface::ACTION_USR_PREFERENCES_GENERAL
$resultsPerPage = SP\Request::analyze('resultsperpage', 12);
$accountLink = SP\Request::analyze('account_link', false, false, true);
$sortViews = SP\Request::analyze('sort_views', false, false, true);
$topNavbar = SP\Request::analyze('top_navbar', false, false, true);
// No se instancia la clase ya que es necesario guardar los atributos ya guardados
$UserPrefs = \SP\UserPreferences::getPreferences($itemId);
@@ -66,6 +67,7 @@ if ($actionId === SP\Controller\ActionsInterface::ACTION_USR_PREFERENCES_GENERAL
$UserPrefs->setResultsPerPage($resultsPerPage);
$UserPrefs->setAccountLink($accountLink);
$UserPrefs->setSortViews($sortViews);
$UserPrefs->setTopNavbar($topNavbar);
if (!$UserPrefs->updatePreferences()) {
SP\Response::printJSON(_('Error al actualizar preferencias'));

View File

@@ -38,15 +38,15 @@ class Crypt
* Generar un hash de una clave utilizando un salt.
*
* @param string $pwd con la clave a 'hashear'
* @param bool $appendSalt Añidor el salt al hash
* @param bool $prefixSalt Añadir el salt al hash
* @return string con el hash de la clave
*/
public static function mkHashPassword($pwd, $appendSalt = true)
public static function mkHashPassword($pwd, $prefixSalt = true)
{
$salt = self::makeHashSalt();
$hash = crypt($pwd, $salt);
return ($appendSalt === true) ? $salt . $hash : $hash;
return ($prefixSalt === true) ? $salt . $hash : $hash;
}
/**
@@ -100,25 +100,29 @@ class Crypt
* Comprobar el hash de una clave.
*
* @param string $pwd con la clave a comprobar
* @param string $originalHash con el hash a comprobar
* @param string $checkedHash con el hash a comprobar
* @param bool $isMPass si es la clave maestra
* @return bool
*/
public static function checkHashPass($pwd, $originalHash, $isMPass = false)
public static function checkHashPass($pwd, $checkedHash, $isMPass = false)
{
// Obtenemos el salt de la clave
$salt = substr($originalHash, 0, 72);
$salt = substr($checkedHash, 0, 72);
// Obtenemos el hash SHA256
$validHash = substr($originalHash, 72);
$validHash = substr($checkedHash, 72);
// Re-hash de la clave a comprobar
$testHash = crypt($pwd, $salt);
// Comprobar si el hash está en formato anterior a 12002
if ($isMPass && strlen($originalHash) === 128) {
ConfigDB::setValue('masterPwd', self::mkHashPassword($pwd));
Log::writeNewLog(_('Aviso'), _('Se ha regenerado el HASH de clave maestra. No es necesaria ninguna acción.'));
if ($isMPass && strlen($checkedHash) === 128) {
$check = (hash("sha256", substr($checkedHash, 0, 64) . $pwd) == substr($checkedHash, 64, 64));
return (hash("sha256", substr($originalHash, 0, 64) . $pwd) == substr($originalHash, 64, 64));
if ($check) {
ConfigDB::setValue('masterPwd', self::mkHashPassword($pwd));
Log::writeNewLog(_('Aviso'), _('Se ha regenerado el HASH de clave maestra. No es necesaria ninguna acción.'));
}
return $check;
}
// Si los hashes son idénticos, la clave es válida

View File

@@ -220,6 +220,11 @@ class Init
}
}
// Volver a cargar la configuración si se recarga la página
if (Request::checkReload()){
Config::readConfig();
}
if (self::isLoggedIn() || Request::analyze('isAjax', false, true)) {
return;
}

View File

@@ -254,12 +254,18 @@ class Installer
// Comprobar si el usuario sumistrado existe
$query = "SELECT COUNT(*) FROM mysql.user WHERE user='" . self::$_username . "' AND host='" . self::$_dbhost . "'";
// Si no existe el usuario, se intenta crear
if (intval(self::$_dbc->query($query)->fetchColumn()) === 0) {
// Se comprueba si el nuevo usuario es distinto del creado en otra instalación
if (self::$_dbuser != Config::getValue('dbuser')) {
self::createDBUser();
try {
// Si no existe el usuario, se intenta crear
if (intval(self::$_dbc->query($query)->fetchColumn()) === 0) {
// Se comprueba si el nuevo usuario es distinto del creado en otra instalación
if (self::$_dbuser != Config::getValue('dbuser')) {
self::createDBUser();
}
}
} catch (\PDOException $e) {
throw new SPException(SPException::SP_CRITICAL
, _('No es posible comprobar el usuario de sysPass') . ' (' . self::$_username . ')'
, _('Compruebe los permisos del usuario de conexión a la BD'));
}
}

View File

@@ -145,7 +145,7 @@ class Request
*/
public static function getRequestHeaders($header = '')
{
if (!function_exists('apache_request_headers')) {
if (!function_exists('\apache_request_headers')) {
function apache_request_headers()
{
foreach ($_SERVER as $key => $value) {
@@ -169,4 +169,14 @@ class Request
return $headers;
}
/**
* Comprobar si se realiza una recarga de la página
*
* @return bool
*/
public static function checkReload()
{
return (self::getRequestHeaders('Cache-Control') == 'max-age=0');
}
}

View File

@@ -42,16 +42,21 @@ class User extends UserBase
*/
public function updateUserMPass($masterPwd)
{
$configMPass = ConfigDB::getValue('masterPwd');
$configHashMPass = ConfigDB::getValue('masterPwd');
if (!$configMPass) {
if ($configHashMPass === false) {
return false;
}
if (Crypt::checkHashPass($masterPwd, $configMPass, true)) {
$strUserMPwd = Crypt::mkCustomMPassEncrypt(self::getCypherPass(), $masterPwd);
if (is_null($configHashMPass)){
$configHashMPass = Crypt::mkHashPassword($masterPwd);
ConfigDB::setValue('masterPwd', $configHashMPass);
}
if (!$strUserMPwd) {
if (Crypt::checkHashPass($masterPwd, $configHashMPass, true)) {
$cryptMPass = Crypt::mkCustomMPassEncrypt(self::getCypherPass(), $masterPwd);
if (!$cryptMPass) {
return false;
}
} else {
@@ -64,8 +69,8 @@ class User extends UserBase
. 'user_lastUpdateMPass = UNIX_TIMESTAMP() '
. 'WHERE user_id = :id LIMIT 1';
$data['mPass'] = $strUserMPwd[0];
$data['mIV'] = $strUserMPwd[1];
$data['mPass'] = $cryptMPass[0];
$data['mIV'] = $cryptMPass[1];
$data['id'] = $this->_userId;
return DB::getQuery($query, __FUNCTION__, $data);
@@ -106,7 +111,7 @@ class User extends UserBase
return false;
}
return ($showPass == true) ? $clearMasterPass : SessionUtil::saveSessionMPass($clearMasterPass);
return ($showPass === true) ? $clearMasterPass : SessionUtil::saveSessionMPass($clearMasterPass);
}
return false;

View File

@@ -55,7 +55,7 @@ class UserPass
$configHashMPass = ConfigDB::getValue('masterPwd');
if ($configHashMPass === false) {
if ($configHashMPass === false || is_null($configHashMPass)) {
return false;
}

View File

@@ -68,6 +68,10 @@ class UserPreferences
* @var bool
*/
private $_sortViews = false;
/**
* @var bool
*/
private $_topNavbar = false;
/**
* Obtener las preferencas de un usuario
@@ -98,6 +102,22 @@ class UserPreferences
return $preferences;
}
/**
* @return boolean
*/
public function isTopNavbar()
{
return $this->_topNavbar;
}
/**
* @param boolean $topNavbar
*/
public function setTopNavbar($topNavbar)
{
$this->_topNavbar = $topNavbar;
}
/**
* @return boolean
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -86,6 +86,23 @@
</label>
</td>
</tr>
<tr>
<td class="descField">
<?php echo _('Barra de navegación superior'); ?>
<div id="help-top_navbar" class="icon material-icons fg-blue80">help_outline</div>
<div class="mdl-tooltip mdl-tooltip--large" for="help-top_navbar">
<p>
<?php echo _('Mostrar una barra de navegación superior en las búsquedas.'); ?>
</p>
</div>
</td>
<td class="valField">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="top_navbar">
<input type="checkbox" id="top_navbar" class="mdl-switch__input fg-blue100"
name="top_navbar" <?php echo ($chkTopNavbar) ? 'checked' : ''; ?>/>
</label>
</td>
</tr>
</table>
<input type="hidden" name="itemId" value="<?php echo $userId; ?>"/>

View File

@@ -2,6 +2,36 @@
<?php if (!$accounts): ?>
<div class="noRes round"><?php echo _('No se encontraron registros'); ?></div>
<?php else: ?>
<?php if ($topNavbar): ?>
<div id="pageNav" class="round shadow">
<div id="pageNavLeft">
<?php echo $totalRows; ?> @ <?php echo round(microtime() - $queryTimeStart, 5); ?>s
<?php if ($filterOn): ?>
<span class="filterOn round"><?php echo _('Filtro ON'); ?></span>
<?php endif; ?>
&nbsp;
<?php if ($searchGlobal): ?>
<span class="globalOn round"><?php echo _('Global ON'); ?></span>
<?php endif; ?>
</div>
<div id="pageNavRight">
<?php if ($limitStart >= 1): ?>
<img src="imgs/arrow_first.png" onClick="<?php echo $pagerOnnClick['first']; ?>"
title="<?php echo _('Primera página'); ?>"/>
<img src="imgs/arrow_left.png" onClick="<?php echo $pagerOnnClick['prev']; ?>"
title="<?php echo _('Página anterior'); ?>"/>
<?php endif; ?>
&nbsp;<?php echo $firstPage, '/', $lastPage; ?>&nbsp;
<?php if ($limitStart < $totalRows && $firstPage != $lastPage): ?>
<img src="imgs/arrow_right.png" onClick="<?php echo $pagerOnnClick['next']; ?>"
title="<?php echo _('Página siguiente'); ?>"/>
<img src="imgs/arrow_last.png" onClick="<?php echo $pagerOnnClick['last']; ?>"
title="<?php echo _('Última página'); ?>"/>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<div id="data-search-header" class="data-header data-header-minimal">
<ul>
<?php foreach ($sortFields as $field): ?>
@@ -11,8 +41,14 @@
<?php echo $field['name']; ?>
</a>
<div class="icon material-icons sort-down cursor-pointer <?php echo ($searchKey == $field['key'] && $searchOrder === 0) ? 'fg-orange80' : 'md-dark md-inactive'; ?>">arrow_drop_down</div>
<div class="icon material-icons sort-up cursor-pointer <?php echo ($searchKey == $field['key'] && $searchOrder === 1) ? 'fg-orange80' : 'md-dark md-inactive'; ?>">arrow_drop_up</div>
<div
class="icon material-icons sort-down cursor-pointer <?php echo ($searchKey == $field['key'] && $searchOrder === 0) ? 'fg-orange80' : 'md-dark md-inactive'; ?>">
arrow_drop_down
</div>
<div
class="icon material-icons sort-up cursor-pointer <?php echo ($searchKey == $field['key'] && $searchOrder === 1) ? 'fg-orange80' : 'md-dark md-inactive'; ?>">
arrow_drop_up
</div>
</li>
<?php endforeach; ?>
</ul>
@@ -112,15 +148,17 @@
<?php if ($account['showViewPass']): ?>
<i id="viewpass" class="material-icons fg-blue80" title="<?php echo _('Ver Clave'); ?>"
onClick="sysPassUtil.Common.viewPass(<?php echo $account['id']; ?>, 1)">lock_open</i>
<?php if(!\SP\Util::accountPassToImageIsEnabled()): ?>
<i class="material-icons fg-blue80 actions-optional clip-pass-button" data-account-id="<?php echo $account['id']; ?>"
title="<?php echo _('Copiar Clave en Portapapeles'); ?>">content_paste</i>
<?php if (!\SP\Util::accountPassToImageIsEnabled()): ?>
<i class="material-icons fg-blue80 actions-optional clip-pass-button"
data-account-id="<?php echo $account['id']; ?>"
title="<?php echo _('Copiar Clave en Portapapeles'); ?>">content_paste</i>
<?php endif ?>
<?php endif ?>
<?php if ($account['showEdit'] || $account['showCopy'] || $account['showDel'] || $account['showViewPass']): ?>
<i class="material-icons"
title="<?php echo _('Más Acciones'); ?>" OnClick="sysPassUtil.Common.showOptional(this)">settings</i>
title="<?php echo _('Más Acciones'); ?>"
OnClick="sysPassUtil.Common.showOptional(this)">settings</i>
<?php endif ?>
<?php if ($account['showEdit']): ?>

View File

@@ -1,41 +1,106 @@
-- To 1.1
ALTER TABLE `accFiles` CHANGE COLUMN `accfile_name` `accfile_name` VARCHAR(100) NOT NULL
ALTER TABLE `accounts` ADD COLUMN `account_otherGroupEdit` BIT(1) NULL DEFAULT 0 AFTER `account_dateEdit`, ADD COLUMN `account_otherUserEdit` BIT(1) NULL DEFAULT 0 AFTER `account_otherGroupEdit`;
CREATE TABLE `accUsers` (`accuser_id` INT NOT NULL AUTO_INCREMENT,`accuser_accountId` INT(10) UNSIGNED NOT NULL,`accuser_userId` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`accuser_id`), INDEX `idx_account` (`accuser_accountId` ASC));
ALTER TABLE `accHistory` ADD COLUMN `accHistory_otherUserEdit` BIT NULL AFTER `acchistory_mPassHash`, ADD COLUMN `accHistory_otherGroupEdit` VARCHAR(45) NULL AFTER `accHistory_otherUserEdit`;
ALTER TABLE `accFiles` CHANGE COLUMN `accfile_type` `accfile_type` VARCHAR(100) NOT NULL ;
ALTER TABLE `accounts` ADD COLUMN `account_otherGroupEdit` BIT(1) NULL DEFAULT 0
AFTER `account_dateEdit`, ADD COLUMN `account_otherUserEdit` BIT(1) NULL DEFAULT 0
AFTER `account_otherGroupEdit`;
CREATE TABLE `accUsers` (
`accuser_id` INT NOT NULL AUTO_INCREMENT,
`accuser_accountId` INT(10) UNSIGNED NOT NULL,
`accuser_userId` INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (`accuser_id`),
INDEX `idx_account` (`accuser_accountId` ASC)
);
ALTER TABLE `accHistory` ADD COLUMN `accHistory_otherUserEdit` BIT NULL
AFTER `acchistory_mPassHash`, ADD COLUMN `accHistory_otherGroupEdit` VARCHAR(45) NULL
AFTER `accHistory_otherUserEdit`;
ALTER TABLE `accFiles` CHANGE COLUMN `accfile_type` `accfile_type` VARCHAR(100) NOT NULL;
-- To 1.1.2.1
ALTER TABLE `categories` ADD COLUMN `category_description` VARCHAR(255) NULL AFTER `category_name`;
ALTER TABLE `usrProfiles` ADD COLUMN `userProfile_pAppMgmtMenu` BIT(1) NULL DEFAULT b'0' AFTER `userProfile_pUsersMenu`,CHANGE COLUMN `userProfile_pConfigCategories` `userProfile_pAppMgmtCategories` BIT(1) NULL DEFAULT b'0' AFTER `userProfile_pAppMgmtMenu`,ADD COLUMN `userProfile_pAppMgmtCustomers` BIT(1) NULL DEFAULT b'0' AFTER `userProfile_pAppMgmtCategories`;
ALTER TABLE `categories` ADD COLUMN `category_description` VARCHAR(255) NULL
AFTER `category_name`;
ALTER TABLE `usrProfiles` ADD COLUMN `userProfile_pAppMgmtMenu` BIT(1) NULL DEFAULT b'0'
AFTER `userProfile_pUsersMenu`, CHANGE COLUMN `userProfile_pConfigCategories` `userProfile_pAppMgmtCategories` BIT(1) NULL DEFAULT b'0'
AFTER `userProfile_pAppMgmtMenu`, ADD COLUMN `userProfile_pAppMgmtCustomers` BIT(1) NULL DEFAULT b'0'
AFTER `userProfile_pAppMgmtCategories`;
-- To 1.1.2.2
ALTER TABLE `usrData` CHANGE COLUMN `user_login` `user_login` VARCHAR(50) NOT NULL ,CHANGE COLUMN `user_email` `user_email` VARCHAR(80) NULL DEFAULT NULL ;
ALTER TABLE `usrData` CHANGE COLUMN `user_login` `user_login` VARCHAR(50) NOT NULL, CHANGE COLUMN `user_email` `user_email` VARCHAR(80) NULL DEFAULT NULL;
-- To 1.1.2.3
CREATE TABLE `usrPassRecover` (`userpassr_id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `userpassr_userId` SMALLINT UNSIGNED NOT NULL,`userpassr_hash` VARBINARY(40) NOT NULL,`userpassr_date` INT UNSIGNED NOT NULL,`userpassr_used` BIT(1) NOT NULL DEFAULT b\'0\', PRIMARY KEY (`userpassr_id`),INDEX `IDX_userId` (`userpassr_userId` ASC, `userpassr_date` ASC)) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci;
ALTER TABLE `log` ADD COLUMN `log_ipAddress` VARCHAR(45) NOT NULL AFTER `log_userId`;
ALTER TABLE `usrData` ADD COLUMN `user_isChangePass` BIT(1) NULL DEFAULT b'0' AFTER `user_isMigrate`;
CREATE TABLE `usrPassRecover` (
`userpassr_id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`userpassr_userId` SMALLINT UNSIGNED NOT NULL,
`userpassr_hash` VARBINARY(40) NOT NULL,
`userpassr_date` INT UNSIGNED NOT NULL,
`userpassr_used` BIT(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`userpassr_id`),
INDEX `IDX_userId` (`userpassr_userId` ASC, `userpassr_date` ASC)
)
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
ALTER TABLE `log` ADD COLUMN `log_ipAddress` VARCHAR(45) NOT NULL
AFTER `log_userId`;
ALTER TABLE `usrData` ADD COLUMN `user_isChangePass` BIT(1) NULL DEFAULT b'0'
AFTER `user_isMigrate`;
-- To 1.1.2.12
ALTER TABLE `usrData` CHANGE COLUMN `user_mPass` `user_mPass` VARBINARY(32) NULL DEFAULT NULL ,CHANGE COLUMN `user_lastLogin` `user_lastLogin` DATETIME NULL DEFAULT NULL ,CHANGE COLUMN `user_lastUpdate` `user_lastUpdate` DATETIME NULL DEFAULT NULL, CHANGE COLUMN `user_mIV` `user_mIV` VARBINARY(32) NULL ;
ALTER TABLE `accounts` CHANGE COLUMN `account_login` `account_login` VARCHAR(50) NULL DEFAULT NULL ;
ALTER TABLE `usrData` CHANGE COLUMN `user_mPass` `user_mPass` VARBINARY(32) NULL DEFAULT NULL, CHANGE COLUMN `user_lastLogin` `user_lastLogin` DATETIME NULL DEFAULT NULL, CHANGE COLUMN `user_lastUpdate` `user_lastUpdate` DATETIME NULL DEFAULT NULL, CHANGE COLUMN `user_mIV` `user_mIV` VARBINARY(32) NULL;
ALTER TABLE `accounts` CHANGE COLUMN `account_login` `account_login` VARCHAR(50) NULL DEFAULT NULL;
-- To 1.1.2.13
ALTER TABLE `usrData` CHANGE COLUMN `user_mPass` `user_mPass` VARBINARY(32) NULL DEFAULT NULL ,CHANGE COLUMN `user_lastLogin` `user_lastLogin` DATETIME NULL DEFAULT NULL ,CHANGE COLUMN `user_lastUpdate` `user_lastUpdate` DATETIME NULL DEFAULT NULL, CHANGE COLUMN `user_mIV` `user_mIV` VARBINARY(32) NULL ;';
ALTER TABLE `usrData` CHANGE COLUMN `user_mPass` `user_mPass` VARBINARY(32) NULL DEFAULT NULL, CHANGE COLUMN `user_lastLogin` `user_lastLogin` DATETIME NULL DEFAULT NULL, CHANGE COLUMN `user_lastUpdate` `user_lastUpdate` DATETIME NULL DEFAULT NULL, CHANGE COLUMN `user_mIV` `user_mIV` VARBINARY(32) NULL;
ALTER TABLE `accounts` CHANGE COLUMN `account_login` `account_login` VARCHAR(50) NULL DEFAULT NULL;
-- To 1.1.2.19
ALTER TABLE `accounts` CHANGE COLUMN `account_pass` `account_pass` VARBINARY(255) NOT NULL ;
ALTER TABLE `accHistory` CHANGE COLUMN `acchistory_pass` `acchistory_pass` VARBINARY(255) NOT NULL ;
ALTER TABLE `accounts` CHANGE COLUMN `account_pass` `account_pass` VARBINARY(255) NOT NULL;
ALTER TABLE `accHistory` CHANGE COLUMN `acchistory_pass` `acchistory_pass` VARBINARY(255) NOT NULL;
-- To 1.1.2.20
ALTER TABLE `usrData` CHANGE COLUMN `user_pass` `user_pass` VARBINARY(255) NOT NULL,CHANGE COLUMN `user_mPass` `acchistory_pass` VARBINARY(255) DEFAULT NULL ;
ALTER TABLE `usrData` CHANGE COLUMN `user_pass` `user_pass` VARBINARY(255) NOT NULL, CHANGE COLUMN `user_mPass` `acchistory_pass` VARBINARY(255) DEFAULT NULL;
-- To 1.2.0.1
ALTER TABLE `accounts` CHANGE COLUMN `account_userEditId` `account_userEditId` TINYINT(3) UNSIGNED NULL DEFAULT NULL, CHANGE COLUMN `account_dateEdit` `account_dateEdit` DATETIME NULL DEFAULT NULL;
ALTER TABLE `accHistory` CHANGE COLUMN `acchistory_userEditId` `acchistory_userEditId` TINYINT(3) UNSIGNED NULL DEFAULT NULL, CHANGE COLUMN `acchistory_dateEdit` `acchistory_dateEdit` DATETIME NULL DEFAULT NULL;
ALTER TABLE `accHistory` CHANGE COLUMN `accHistory_otherGroupEdit` `accHistory_otherGroupEdit` BIT NULL DEFAULT b\'0\';
ALTER TABLE `accHistory` CHANGE COLUMN `accHistory_otherGroupEdit` `accHistory_otherGroupEdit` BIT NULL DEFAULT b'0';
ALTER TABLE `usrProfiles` ADD COLUMN `userProfile_profile` BLOB NOT NULL;
ALTER TABLE `usrData` ADD `user_preferences` BLOB NULL;
CREATE TABLE usrToGroups (usertogroup_id INT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,usertogroup_userId INT UNSIGNED NOT NULL,usertogroup_groupId INT UNSIGNED NOT NULL) DEFAULT CHARSET=utf8;
CREATE INDEX IDX_accountId ON usrToGroups (usertogroup_userId)
CREATE TABLE usrToGroups (
usertogroup_id INT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
usertogroup_userId INT UNSIGNED NOT NULL,
usertogroup_groupId INT UNSIGNED NOT NULL
)
DEFAULT CHARSET = utf8;
CREATE INDEX IDX_accountId ON usrToGroups (usertogroup_userId);
ALTER TABLE `accFiles` ADD `accFile_thumb` BLOB NULL;
CREATE TABLE `authTokens` (`authtoken_id` int(11) NOT NULL AUTO_INCREMENT,`authtoken_userId` int(11) NOT NULL,`authtoken_token` varbinary(100) NOT NULL,`authtoken_actionId` smallint(5) unsigned NOT NULL,`authtoken_createdBy` smallint(5) unsigned NOT NULL,`authtoken_startDate` int(10) unsigned NOT NULL,PRIMARY KEY (`authtoken_id`),UNIQUE KEY `unique_authtoken_id` (`authtoken_id`),KEY `IDX_checkToken` (`authtoken_userId`,`authtoken_actionId`,`authtoken_token`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `customFieldsDef` (`customfielddef_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `customfielddef_module` smallint(5) unsigned NOT NULL, `customfielddef_field` blob NOT NULL, PRIMARY KEY (`customfielddef_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `customFieldsData` (`customfielddata_id` int(10) unsigned NOT NULL AUTO_INCREMENT,`customfielddata_moduleId` smallint(5) unsigned NOT NULL,`customfielddata_itemId` int(10) unsigned NOT NULL,`customfielddata_defId` int(10) unsigned NOT NULL,`customfielddata_data` longblob,`customfielddata_iv` varbinary(128) DEFAULT NULL, PRIMARY KEY (`customfielddata_id`), KEY `IDX_DEFID` (`customfielddata_defId`), KEY `IDX_DELETE` (`customfielddata_itemId`,`customfielddata_moduleId`), KEY `IDX_UPDATE` (`customfielddata_moduleId`,`customfielddata_itemId`,`customfielddata_defId`), KEY `IDX_ITEM` (`customfielddata_itemId`), KEY `IDX_MODULE` (`customfielddata_moduleId`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `authTokens` (
`authtoken_id` INT(11) NOT NULL AUTO_INCREMENT,
`authtoken_userId` INT(11) NOT NULL,
`authtoken_token` VARBINARY(100) NOT NULL,
`authtoken_actionId` SMALLINT(5) UNSIGNED NOT NULL,
`authtoken_createdBy` SMALLINT(5) UNSIGNED NOT NULL,
`authtoken_startDate` INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (`authtoken_id`),
UNIQUE KEY `unique_authtoken_id` (`authtoken_id`),
KEY `IDX_checkToken` (`authtoken_userId`, `authtoken_actionId`, `authtoken_token`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE `customFieldsDef` (
`customfielddef_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`customfielddef_module` SMALLINT(5) UNSIGNED NOT NULL,
`customfielddef_field` BLOB NOT NULL,
PRIMARY KEY (`customfielddef_id`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE `customFieldsData` (
`customfielddata_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`customfielddata_moduleId` SMALLINT(5) UNSIGNED NOT NULL,
`customfielddata_itemId` INT(10) UNSIGNED NOT NULL,
`customfielddata_defId` INT(10) UNSIGNED NOT NULL,
`customfielddata_data` LONGBLOB,
`customfielddata_iv` VARBINARY(128) DEFAULT NULL,
PRIMARY KEY (`customfielddata_id`),
KEY `IDX_DEFID` (`customfielddata_defId`),
KEY `IDX_DELETE` (`customfielddata_itemId`, `customfielddata_moduleId`),
KEY `IDX_UPDATE` (`customfielddata_moduleId`, `customfielddata_itemId`, `customfielddata_defId`),
KEY `IDX_ITEM` (`customfielddata_itemId`),
KEY `IDX_MODULE` (`customfielddata_moduleId`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
-- To 1.2.0.2
ALTER TABLE config CHANGE config_value config_value VARCHAR(255);
ALTER TABLE usrData CHANGE user_pass user_pass VARBINARY(255);

View File

@@ -181,9 +181,11 @@ class SearchC extends Controller implements ActionsInterface
));
$accountLink = Session::getUserPreferences()->isAccountLink();
$topNavbar = Session::getUserPreferences()->isTopNavbar();
// Variables de configuración
$this->view->assign('accountLink', (is_null($accountLink) ? \SP\Config::getValue('account_link', 0) : $accountLink));
$this->view->assign('topNavbar', $topNavbar);
$this->view->assign('requestEnabled', \SP\Util::mailrequestIsEnabled());
$this->view->assign('isDemoMode', \SP\Util::demoIsEnabled());
$maxTextLength = (\SP\Util::resultsCardsIsEnabled()) ? 40 : 60;

View File

@@ -112,6 +112,7 @@ class UsersPrefsC extends Controller implements ActionsInterface
$this->view->assign('chkAccountLink', ($this->_userPrefs->isAccountLink()) ? 'checked="checked"' : '');
$this->view->assign('resultsPerPage', ($this->_userPrefs->getResultsPerPage()) ? $this->_userPrefs->getResultsPerPage() : \SP\Config::getValue('account_count'));
$this->view->assign('chkSortViews', ($this->_userPrefs->isSortViews()) ? 'checked="checked"' : '');
$this->view->assign('chkTopNavbar', ($this->_userPrefs->isTopNavbar()) ? 'checked="checked"' : '');
$this->view->append('tabs', array('title' => _('Preferencias')));
$this->view->assign('tabIndex', $this->getTabIndex(), 'preferences');