mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-24 09:07:18 +01:00
* [DEV] Preparing for upgrade procedure
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2016, Rubén Domínguez nuxsmin@$syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
@@ -158,4 +158,12 @@ class Authenticator
|
||||
|
||||
return ($totp === $userToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getInitializationKey()
|
||||
{
|
||||
return $this->initializationKey;
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,8 @@ class AuthenticatorPlugin extends PluginBase
|
||||
*
|
||||
* @param string $event Nombre del evento
|
||||
* @param mixed $object
|
||||
* @throws \SP\Core\Exceptions\FileNotFoundException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
*/
|
||||
public function updateEvent($event, $object)
|
||||
{
|
||||
|
||||
@@ -160,7 +160,7 @@ abstract class ControllerBase
|
||||
}
|
||||
|
||||
/**
|
||||
* Renderizar los datos de la plantilla y mostrarlos
|
||||
* Mostrar los datos de la plantilla
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
|
||||
@@ -188,6 +188,7 @@ class ItemActionController implements ItemControllerInterface
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
* @throws \SP\Core\Exceptions\ValidationException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
protected function userAction()
|
||||
{
|
||||
@@ -239,6 +240,9 @@ class ItemActionController implements ItemControllerInterface
|
||||
|
||||
/**
|
||||
* Guardar los datos de los campos personalizados del módulo
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
*/
|
||||
protected function addCustomFieldData()
|
||||
{
|
||||
@@ -251,6 +255,9 @@ class ItemActionController implements ItemControllerInterface
|
||||
|
||||
/**
|
||||
* Actualizar los datos de los campos personalizados del módulo
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
*/
|
||||
protected function updateCustomFieldData()
|
||||
{
|
||||
@@ -265,6 +272,7 @@ class ItemActionController implements ItemControllerInterface
|
||||
* Eliminar los datos de los campos personalizados del módulo
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
protected function deleteCustomFieldData()
|
||||
{
|
||||
@@ -276,6 +284,7 @@ class ItemActionController implements ItemControllerInterface
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\ValidationException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
protected function groupAction()
|
||||
{
|
||||
@@ -313,6 +322,7 @@ class ItemActionController implements ItemControllerInterface
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\ValidationException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
protected function profileAction()
|
||||
{
|
||||
@@ -350,6 +360,7 @@ class ItemActionController implements ItemControllerInterface
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\ValidationException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
protected function customerAction()
|
||||
{
|
||||
@@ -386,6 +397,7 @@ class ItemActionController implements ItemControllerInterface
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\ValidationException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
protected function categoryAction()
|
||||
{
|
||||
@@ -454,6 +466,7 @@ class ItemActionController implements ItemControllerInterface
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\ValidationException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
protected function customFieldAction()
|
||||
{
|
||||
@@ -486,6 +499,7 @@ class ItemActionController implements ItemControllerInterface
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\ValidationException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
protected function publicLinkAction()
|
||||
{
|
||||
@@ -521,6 +535,7 @@ class ItemActionController implements ItemControllerInterface
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\ValidationException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
protected function tagAction()
|
||||
{
|
||||
@@ -553,6 +568,7 @@ class ItemActionController implements ItemControllerInterface
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\ValidationException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
protected function fileAction()
|
||||
{
|
||||
@@ -601,6 +617,7 @@ class ItemActionController implements ItemControllerInterface
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\ValidationException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
protected function accountAction()
|
||||
{
|
||||
|
||||
@@ -74,6 +74,7 @@ class MainController extends ControllerBase implements ActionsInterface
|
||||
* Inicializar las variables para la vista principal de la aplicación
|
||||
*
|
||||
* @param string $page Nombre de la vista
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
*/
|
||||
protected function initialize($page = '')
|
||||
{
|
||||
@@ -95,7 +96,7 @@ class MainController extends ControllerBase implements ActionsInterface
|
||||
$this->view->assign('logonobg', Init::$WEBURI . '/imgs/logo_full_nobg.png');
|
||||
$this->view->assign('httpsEnabled', Checks::httpsEnabled());
|
||||
|
||||
$this->view->assign('loadApp', Session::getAuthCompleted());
|
||||
$this->view->assign('loadApp', Session::getAuthCompleted() && !Config::getConfig()->isMaintenance());
|
||||
|
||||
$this->setLoggedIn(Init::isLoggedIn());
|
||||
|
||||
@@ -283,26 +284,9 @@ class MainController extends ControllerBase implements ActionsInterface
|
||||
$this->view->addTemplate('body-footer');
|
||||
$this->view->addTemplate('body-end');
|
||||
|
||||
$this->view->assign('demoEnabled', Checks::demoIsEnabled());
|
||||
$this->view->assign('mailEnabled', Checks::mailIsEnabled());
|
||||
$this->view->assign('isLogout', Request::analyze('logout', false, true));
|
||||
$this->view->assign('updated', Init::$UPDATED === true);
|
||||
$this->view->assign('newFeatures', array(
|
||||
_('Nuevo estilo visual basado en Material Design Lite by Google'),
|
||||
_('Usuarios en múltiples grupos'),
|
||||
_('Previsualización de imágenes'),
|
||||
_('Mostrar claves como imágenes'),
|
||||
_('Campos personalizados'),
|
||||
_('API de consultas'),
|
||||
_('Autentificación en 2 pasos'),
|
||||
_('Complejidad de generador de claves'),
|
||||
_('Consultas especiales'),
|
||||
_('Exportación a XML'),
|
||||
_('Clave maestra temporal'),
|
||||
_('Importación de cuentas desde sysPass, KeePass, KeePassX y CSV'),
|
||||
_('Optimización del código y mayor rapidez de carga'),
|
||||
_('Mejoras de seguridad en XSS e inyección SQL')
|
||||
));
|
||||
|
||||
$getParams = [];
|
||||
|
||||
@@ -353,20 +337,18 @@ class MainController extends ControllerBase implements ActionsInterface
|
||||
|
||||
/**
|
||||
* Obtener los datos para el interface de error
|
||||
*
|
||||
* @param bool $showLogo mostrar el logo de sysPass
|
||||
*/
|
||||
public function getError($showLogo = false)
|
||||
public function getError()
|
||||
{
|
||||
$this->view->addTemplate('body-header');
|
||||
$this->view->addTemplate('error');
|
||||
$this->view->addTemplate('body-footer');
|
||||
|
||||
$this->view->assign('showLogo', $showLogo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtener los datos para el interface de actualización de BD
|
||||
*
|
||||
* @throws \SP\Core\Exceptions\FileNotFoundException
|
||||
*/
|
||||
public function getUpgrade()
|
||||
{
|
||||
|
||||
@@ -290,10 +290,12 @@ class Init
|
||||
*/
|
||||
public static function initError($str, $hint = '')
|
||||
{
|
||||
debugLog(__FUNCTION__);
|
||||
|
||||
$Tpl = new Template();
|
||||
$Tpl->append('errors', ['type' => SPException::SP_CRITICAL, 'description' => $str, 'hint' => $hint]);
|
||||
$Controller = new MainController($Tpl, 'error', true);
|
||||
$Controller->getError(true);
|
||||
$Controller->getError();
|
||||
$Controller->view();
|
||||
exit();
|
||||
}
|
||||
@@ -485,7 +487,6 @@ class Init
|
||||
|| Request::analyze('upgrade', 0) === 1
|
||||
|| Request::analyze('nodbupgrade', 0) === 1
|
||||
) {
|
||||
error_log(__FUNCTION__);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ use SP\Config\ConfigData;
|
||||
use SP\Core\Exceptions\SPException;
|
||||
use SP\Log\Email;
|
||||
use SP\Log\Log;
|
||||
use SP\Mgmt\CustomFields\CustomFieldsUtil;
|
||||
use SP\Mgmt\Profiles\ProfileUtil;
|
||||
use SP\Storage\DB;
|
||||
use SP\Mgmt\Users\UserMigrate;
|
||||
@@ -43,8 +44,8 @@ defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'
|
||||
*/
|
||||
class Upgrade
|
||||
{
|
||||
private static $dbUpgrade = array(110, 1121, 1122, 1123, 11213, 11219, 11220, 12001, 12002, 1316011001, 1316020501);
|
||||
private static $cfgUpgrade = array(1124, 1316020501);
|
||||
private static $dbUpgrade = [110, 1121, 1122, 1123, 11213, 11219, 11220, 12001, 12002, 1316011001, 1316020501, 1316100601, 2017010901];
|
||||
private static $cfgUpgrade = [1124, 1316020501];
|
||||
|
||||
/**
|
||||
* Inicia el proceso de actualización de la BBDD.
|
||||
@@ -56,7 +57,7 @@ class Upgrade
|
||||
{
|
||||
foreach (self::$dbUpgrade as $upgradeVersion) {
|
||||
if ($version < $upgradeVersion) {
|
||||
if (self::upgradeTo($upgradeVersion) === false) {
|
||||
if (self::upgradeDB($upgradeVersion) === false) {
|
||||
Init::initError(
|
||||
_('Error al aplicar la actualización de la Base de Datos'),
|
||||
_('Compruebe el registro de eventos para más detalles') . '. <a href="index.php?nodbupgrade=1">' . _('Acceder') . '</a>');
|
||||
@@ -79,88 +80,54 @@ class Upgrade
|
||||
* @param int $version con la versión a actualizar
|
||||
* @returns bool
|
||||
*/
|
||||
private static function upgradeTo($version)
|
||||
private static function upgradeDB($version)
|
||||
{
|
||||
$Log = new Log(_('Actualizar BBDD'));
|
||||
|
||||
$queries = [];
|
||||
|
||||
switch ($version) {
|
||||
case 110:
|
||||
$queries[] = 'ALTER TABLE `accFiles` CHANGE COLUMN `accfile_name` `accfile_name` VARCHAR(100) NOT NULL';
|
||||
$queries[] = '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`;';
|
||||
$queries[] = '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)) DEFAULT CHARSET=utf8;';
|
||||
$queries[] = 'ALTER TABLE `accHistory` ADD COLUMN `accHistory_otherUserEdit` BIT NULL AFTER `acchistory_mPassHash`, ADD COLUMN `accHistory_otherGroupEdit` VARCHAR(45) NULL AFTER `accHistory_otherUserEdit`;';
|
||||
$queries[] = 'ALTER TABLE `accFiles` CHANGE COLUMN `accfile_type` `accfile_type` VARCHAR(100) NOT NULL ;';
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
case 1121:
|
||||
$queries[] = 'ALTER TABLE `categories` ADD COLUMN `category_description` VARCHAR(255) NULL AFTER `category_name`;';
|
||||
$queries[] = '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`;';
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
case 1122:
|
||||
$queries[] = 'ALTER TABLE `usrData` CHANGE COLUMN `user_login` `user_login` VARCHAR(50) NOT NULL ,CHANGE COLUMN `user_email` `user_email` VARCHAR(80) NULL DEFAULT NULL ;';
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
case 1123:
|
||||
$queries[] = '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 CHARSET=utf8;';
|
||||
$queries[] = 'ALTER TABLE `log` ADD COLUMN `log_ipAddress` VARCHAR(45) NOT NULL AFTER `log_userId`;';
|
||||
$queries[] = 'ALTER TABLE `usrData` ADD COLUMN `user_isChangePass` BIT(1) NULL DEFAULT b\'0\' AFTER `user_isMigrate`;';
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
case 11213:
|
||||
$queries[] = '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 ;';
|
||||
$queries[] = 'ALTER TABLE `accounts` CHANGE COLUMN `account_login` `account_login` VARCHAR(50) NULL DEFAULT NULL ;';
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
case 11219:
|
||||
$queries[] = 'ALTER TABLE `accounts` CHANGE COLUMN `account_pass` `account_pass` VARBINARY(255) NOT NULL ;';
|
||||
$queries[] = 'ALTER TABLE `accHistory` CHANGE COLUMN `acchistory_pass` `acchistory_pass` VARBINARY(255) NOT NULL ;';
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
case 11220:
|
||||
$queries[] = 'ALTER TABLE `usrData` CHANGE COLUMN `user_pass` `user_pass` VARBINARY(255) NOT NULL,CHANGE COLUMN `user_mPass` `user_mPass` VARBINARY(255) DEFAULT NULL ;';
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
case 12001:
|
||||
$queries[] = '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;';
|
||||
$queries[] = '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;';
|
||||
$queries[] = 'ALTER TABLE `accHistory` CHANGE COLUMN `accHistory_otherGroupEdit` `accHistory_otherGroupEdit` BIT NULL DEFAULT b\'0\';';
|
||||
$queries[] = 'ALTER TABLE `usrProfiles` ADD COLUMN `userProfile_profile` BLOB NOT NULL;';
|
||||
$queries[] = 'ALTER TABLE `usrData` ADD `user_preferences` BLOB NULL;';
|
||||
$queries[] = '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;';
|
||||
$queries[] = 'CREATE INDEX IDX_accountId ON usrToGroups (usertogroup_userId)';
|
||||
$queries[] = 'ALTER TABLE `accFiles` ADD `accFile_thumb` BLOB NULL;';
|
||||
$queries[] = '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;';
|
||||
$queries[] = '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;';
|
||||
$queries[] = '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;';
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
case 12002:
|
||||
$queries[] = 'ALTER TABLE config CHANGE config_value config_value VARCHAR(255);';
|
||||
$queries[] = 'ALTER TABLE usrData CHANGE user_pass user_pass VARBINARY(255);';
|
||||
$queries[] = 'ALTER TABLE usrData CHANGE user_hashSalt user_hashSalt VARBINARY(128);';
|
||||
$queries[] = 'ALTER TABLE accHistory CHANGE acchistory_mPassHash acchistory_mPassHash VARBINARY(255);';
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
case 1316011001:
|
||||
$queries[] = 'ALTER TABLE `usrData` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `accFiles` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `accGroups` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `accHistory` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `accUsers` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `categories` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `config` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `customers` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `log` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `usrGroups` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `usrPassRecover` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `usrProfiles` ENGINE = InnoDB';
|
||||
$queries[] = 'ALTER TABLE `accounts` ENGINE = InnoDB , DROP INDEX `IDX_searchTxt` , ADD INDEX `IDX_searchTxt` (`account_name` ASC, `account_login` ASC, `account_url` ASC)';
|
||||
$queries[] = 'CREATE TABLE publicLinks (publicLink_id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,publicLink_itemId INT,publicLink_hash VARBINARY(100) NOT NULL,publicLink_linkData LONGBLOB);';
|
||||
$queries[] = 'CREATE UNIQUE INDEX unique_publicLink_accountId ON publicLinks (publicLink_itemId)';
|
||||
$queries[] = 'CREATE UNIQUE INDEX unique_publicLink_hash ON publicLinks (publicLink_hash)';
|
||||
$queries[] = 'ALTER TABLE log ADD log_level VARCHAR(20) NOT NULL;';
|
||||
$queries[] = 'ALTER TABLE config CHANGE config_value config_value VARCHAR(2000);';
|
||||
$queries[] = 'CREATE TABLE `accFavorites` (`accfavorite_accountId` SMALLINT UNSIGNED NOT NULL,`accfavorite_userId` SMALLINT UNSIGNED NOT NULL,INDEX `fk_accFavorites_accounts_idx` (`accfavorite_accountId` ASC),INDEX `fk_accFavorites_users_idx` (`accfavorite_userId` ASC),INDEX `search_idx` (`accfavorite_accountId` ASC, `accfavorite_userId` ASC),CONSTRAINT `fk_accFavorites_accounts` FOREIGN KEY (`accfavorite_accountId`) REFERENCES `accounts` (`account_id`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `fk_accFavorites_users` FOREIGN KEY (`accfavorite_userId`) REFERENCES `usrData` (`user_id`) ON DELETE CASCADE ON UPDATE NO ACTION)ENGINE=InnoDB DEFAULT CHARSET=utf8';
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
case 1316020501:
|
||||
$queries[] = 'CREATE TABLE `tags` (`tag_id` INT UNSIGNED NOT NULL AUTO_INCREMENT,`tag_name` VARCHAR(45) NOT NULL,`tag_hash` BINARY(20) NOT NULL,PRIMARY KEY (`tag_id`),INDEX `IDX_name` (`tag_name` ASC),UNIQUE INDEX `tag_hash_UNIQUE` (`tag_hash` ASC)) ENGINE = InnoDB DEFAULT CHARSET = utf8';
|
||||
$queries[] = 'CREATE TABLE `accTags` (`acctag_accountId` INT UNSIGNED NOT NULL,`acctag_tagId` INT UNSIGNED NOT NULL, INDEX `IDX_id` (`acctag_accountId` ASC, `acctag_tagId` ASC)) ENGINE = InnoDB DEFAULT CHARSET = utf8';
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
default :
|
||||
$Log->addDescription(_('No es necesario actualizar la Base de Datos.'));
|
||||
return true;
|
||||
case 1316100601:
|
||||
$queries = self::getQueriesFromFile($version);
|
||||
break;
|
||||
}
|
||||
|
||||
if (count($queries) > 0) {
|
||||
$Log->addDescription(_('No es necesario actualizar la Base de Datos.'));
|
||||
return true;
|
||||
}
|
||||
|
||||
$Data = new QueryData();
|
||||
@@ -171,7 +138,8 @@ class Upgrade
|
||||
DB::getQuery($Data);
|
||||
} catch (SPException $e) {
|
||||
$Log->setLogLevel(Log::ERROR);
|
||||
$Log->addDescription(_('Error al aplicar la actualización de la Base de Datos.') . ' (v' . $version . ')');
|
||||
$Log->addDescription(_('Error al aplicar la actualización de la Base de Datos.'));
|
||||
$Log->addDetails(_('Versión'), $version);
|
||||
$Log->addDetails('ERROR', sprintf('%s (%s)', $e->getMessage(), $e->getCode()));
|
||||
$Log->writeLog();
|
||||
|
||||
@@ -180,7 +148,8 @@ class Upgrade
|
||||
}
|
||||
}
|
||||
|
||||
$Log->addDescription(_('Actualización de la Base de Datos realizada correctamente.') . ' (v' . $version . ')');
|
||||
$Log->addDescription(_('Actualización de la Base de Datos realizada correctamente.'));
|
||||
$Log->addDetails(_('Versión'), $version);
|
||||
$Log->writeLog();
|
||||
|
||||
Email::sendEmail($Log);
|
||||
@@ -188,6 +157,31 @@ class Upgrade
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtener las consultas de actualización desde un archivo
|
||||
*
|
||||
* @param $filename
|
||||
* @return array|bool
|
||||
*/
|
||||
private static function getQueriesFromFile($filename)
|
||||
{
|
||||
$file = SQL_PATH . DIRECTORY_SEPARATOR . $filename . '.sql';
|
||||
|
||||
$queries = [];
|
||||
|
||||
if (file_exists($file) && $handle = fopen($file, 'rb')) {
|
||||
while (!feof($handle)) {
|
||||
$buffer = stream_get_line($handle, 1000000, ";\n");
|
||||
|
||||
if (strlen(trim($buffer)) > 0) {
|
||||
$queries[] = str_replace("\n", '', $buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $queries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aplicar actualizaciones auxiliares.
|
||||
*
|
||||
@@ -199,13 +193,13 @@ class Upgrade
|
||||
switch ($version) {
|
||||
case 12001:
|
||||
return (ProfileUtil::migrateProfiles() && UserMigrate::migrateUsersGroup());
|
||||
break;
|
||||
case 12002:
|
||||
return (UserMigrate::setMigrateUsers());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
return UserMigrate::setMigrateUsers();
|
||||
case 2017010901:
|
||||
return CustomFieldsUtil::migrateCustomFields();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -242,6 +236,7 @@ class Upgrade
|
||||
*/
|
||||
public static function upgradeConfig($version)
|
||||
{
|
||||
$Log = new Log(_('Actualizar Configuración'));
|
||||
$Config = new ConfigData();
|
||||
|
||||
if (file_exists(CONFIG_FILE)) {
|
||||
@@ -249,27 +244,19 @@ class Upgrade
|
||||
include CONFIG_FILE;
|
||||
|
||||
if (isset($CONFIG) && is_array($CONFIG)) {
|
||||
debugLog('upgrade_old');
|
||||
|
||||
foreach (self::getConfigParams() as $mapTo => $oldParam) {
|
||||
$mapFrom = function () use ($oldParam) {
|
||||
if (is_array($oldParam)) {
|
||||
foreach ($oldParam as $param) {
|
||||
foreach (self::getConfigParams() as $mapTo => $mapFrom) {
|
||||
if (method_exists($Config, $mapTo)) {
|
||||
if (is_array($mapFrom)) {
|
||||
foreach ($mapFrom as $param) {
|
||||
if (isset($CONFIG[$param])) {
|
||||
return $param;
|
||||
$Log->addDetails(_('Parámetro'), $param);
|
||||
$Config->$mapTo($CONFIG[$param]);
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
} else {
|
||||
$Log->addDetails(_('Parámetro'), $mapFrom);
|
||||
$Config->$mapTo($CONFIG[$mapFrom]);
|
||||
}
|
||||
|
||||
return $oldParam;
|
||||
};
|
||||
|
||||
if (isset($CONFIG[$mapFrom()])
|
||||
&& method_exists($Config, $mapTo)
|
||||
) {
|
||||
$Config->$mapTo($CONFIG[$mapFrom()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,12 +266,19 @@ class Upgrade
|
||||
$Config->setConfigVersion($version);
|
||||
Config::saveConfig($Config, false);
|
||||
rename(CONFIG_FILE, CONFIG_FILE . '.old');
|
||||
} catch (\Exception $e){
|
||||
Log::writeNewLog(_('Actualizar Configuración'), _('Error al actualizar la configuración'), Log::ERROR);
|
||||
} catch (\Exception $e) {
|
||||
$Log->addDescription(_('Error al actualizar la configuración'));
|
||||
$Log->addDetails(_('Archivo'), CONFIG_FILE . '.old');
|
||||
$Log->setLogLevel(Log::ERROR);
|
||||
$Log->writeLog();
|
||||
return false;
|
||||
}
|
||||
|
||||
Log::writeNewLog(_('Actualizar Configuración'), _('Actualización de la Configuración realizada correctamente.') . ' (v' . $version . ')', Log::NOTICE);
|
||||
$Log->addDescription(_('Actualización de la Configuración realizada correctamente.'));
|
||||
$Log->addDetails(_('Versión'), $version);
|
||||
$Log->setLogLevel(Log::NOTICE);
|
||||
$Log->writeLog();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class CustomField extends CustomFieldBase implements ItemInterface
|
||||
*/
|
||||
public function __construct($itemData, $customFieldDefId = null)
|
||||
{
|
||||
$this->setDataModel('SP\DataModel\CustomFieldData');
|
||||
$this->setDataModel(CustomFieldData::class);
|
||||
|
||||
parent::__construct($itemData);
|
||||
|
||||
@@ -72,11 +72,11 @@ class CustomField extends CustomFieldBase implements ItemInterface
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$exists = $this->checkIfExists();
|
||||
$exists = $this->checkExists();
|
||||
|
||||
if ($this->itemData->getValue() !== '' && !$exists) {
|
||||
if (!$exists && $this->itemData->getValue() !== '') {
|
||||
return $this->add();
|
||||
} elseif ($this->itemData->getValue() === '' && $exists) {
|
||||
} elseif ($exists && $this->itemData->getValue() === '') {
|
||||
return $this->delete($this->itemData->getId());
|
||||
}
|
||||
|
||||
@@ -105,8 +105,9 @@ class CustomField extends CustomFieldBase implements ItemInterface
|
||||
* Comprueba si el elemento tiene campos personalizados con datos
|
||||
*
|
||||
* @return bool
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
*/
|
||||
protected function checkIfExists()
|
||||
protected function checkExists()
|
||||
{
|
||||
$query = /** @lang SQL */
|
||||
'SELECT customfielddata_id
|
||||
@@ -154,9 +155,7 @@ class CustomField extends CustomFieldBase implements ItemInterface
|
||||
$Data->addParam($cryptData['data']);
|
||||
$Data->addParam($cryptData['iv']);
|
||||
|
||||
$queryRes = DB::getQuery($Data);
|
||||
|
||||
return $queryRes;
|
||||
return DB::getQuery($Data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,9 +183,7 @@ class CustomField extends CustomFieldBase implements ItemInterface
|
||||
$Data->addParam($id);
|
||||
$Data->addParam($this->itemData->getCustomfielddataModuleId());
|
||||
|
||||
$queryRes = DB::getQuery($Data);
|
||||
|
||||
return $queryRes;
|
||||
return DB::getQuery($Data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,7 +240,7 @@ class CustomField extends CustomFieldBase implements ItemInterface
|
||||
$fieldDef = unserialize($CustomFieldData->getCustomfielddefField());
|
||||
|
||||
if (get_class($fieldDef) === '__PHP_Incomplete_Class') {
|
||||
$fieldDef = Util::castToClass('SP\DataModel\CustomFieldDefData', $fieldDef);
|
||||
$fieldDef = Util::castToClass(CustomFieldDefData::class, $fieldDef);
|
||||
}
|
||||
|
||||
$CustomFieldData->setDefinition($fieldDef);
|
||||
@@ -299,7 +296,7 @@ class CustomField extends CustomFieldBase implements ItemInterface
|
||||
WHERE customfielddef_module = ?';
|
||||
|
||||
$Data = new QueryData();
|
||||
$Data->setMapClassName('SP\DataModel\CustomFieldDefData');
|
||||
$Data->setMapClassName(CustomFieldDefData::class);
|
||||
$Data->setQuery($query);
|
||||
$Data->addParam($this->itemData->getModule());
|
||||
|
||||
@@ -318,7 +315,7 @@ class CustomField extends CustomFieldBase implements ItemInterface
|
||||
$fieldDef = unserialize($CustomFieldDef->getCustomfielddefField());
|
||||
|
||||
if (get_class($fieldDef) === '__PHP_Incomplete_Class') {
|
||||
$fieldDef = Util::castToClass('SP\DataModel\CustomFieldDefData', $fieldDef);
|
||||
$fieldDef = Util::castToClass(CustomFieldDefData::class, $fieldDef);
|
||||
}
|
||||
|
||||
$CustomFieldData = new CustomFieldData();
|
||||
|
||||
@@ -46,11 +46,12 @@ abstract class CustomFieldBase extends ItemBase
|
||||
* Category constructor.
|
||||
*
|
||||
* @param CustomFieldBaseData $itemData
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
public function __construct($itemData = null)
|
||||
{
|
||||
if (!$this->dataModel) {
|
||||
$this->setDataModel('SP\DataModel\CustomFieldBaseData');
|
||||
$this->setDataModel(CustomFieldBaseData::class);
|
||||
}
|
||||
|
||||
parent::__construct($itemData);
|
||||
|
||||
@@ -45,10 +45,11 @@ class CustomFieldDef extends CustomFieldBase implements ItemInterface
|
||||
* Category constructor.
|
||||
*
|
||||
* @param CustomFieldDefData $itemData
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
public function __construct($itemData = null)
|
||||
{
|
||||
$this->setDataModel('SP\DataModel\CustomFieldDefData');
|
||||
$this->setDataModel(CustomFieldDefData::class);
|
||||
|
||||
parent::__construct($itemData);
|
||||
}
|
||||
@@ -110,6 +111,7 @@ class CustomFieldDef extends CustomFieldBase implements ItemInterface
|
||||
*
|
||||
* @param $id
|
||||
* @return bool
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
*/
|
||||
protected function deleteItemsDataForDefinition($id)
|
||||
{
|
||||
@@ -198,6 +200,7 @@ class CustomFieldDef extends CustomFieldBase implements ItemInterface
|
||||
* Actualizar el módulo de los elementos con campos personalizados
|
||||
*
|
||||
* @return bool
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
*/
|
||||
protected function updateItemsModulesForDefinition()
|
||||
{
|
||||
|
||||
@@ -58,17 +58,17 @@ class CustomFieldTypes
|
||||
*/
|
||||
public static function getFieldsTypes($typeId = null, $nice = false)
|
||||
{
|
||||
$types = array(
|
||||
self::TYPE_TEXT => array('text', _('Texto')),
|
||||
self::TYPE_WIKI => array('text', _('Wiki')),
|
||||
self::TYPE_PASSWORD => array('password', _('Clave')),
|
||||
self::TYPE_DATE => array('date', _('Fecha')),
|
||||
self::TYPE_NUMBER => array('number', _('Número')),
|
||||
self::TYPE_EMAIL => array('email', _('Email')),
|
||||
self::TYPE_TELEPHONE => array('tel', _('Teléfono')),
|
||||
self::TYPE_URL => array('url', _('Link')),
|
||||
self::TYPE_COLOR => array('color', _('Color'))
|
||||
);
|
||||
$types = [
|
||||
self::TYPE_TEXT => ['text', _('Texto')],
|
||||
self::TYPE_WIKI => ['text', _('Wiki')],
|
||||
self::TYPE_PASSWORD => ['password', _('Clave')],
|
||||
self::TYPE_DATE => ['date', _('Fecha')],
|
||||
self::TYPE_NUMBER => ['number', _('Número')],
|
||||
self::TYPE_EMAIL => ['email', _('Email')],
|
||||
self::TYPE_TELEPHONE => ['tel', _('Teléfono')],
|
||||
self::TYPE_URL => ['url', _('Link')],
|
||||
self::TYPE_COLOR => ['color', _('Color')]
|
||||
];
|
||||
|
||||
if (null !== $typeId) {
|
||||
return ($nice === false) ? $types[$typeId][0] : $types[$typeId][1];
|
||||
@@ -85,14 +85,14 @@ class CustomFieldTypes
|
||||
*/
|
||||
public static function getFieldsModules($moduleId = null)
|
||||
{
|
||||
$modules = array(
|
||||
$modules = [
|
||||
ActionsInterface::ACTION_ACC => _('Cuentas'),
|
||||
ActionsInterface::ACTION_MGM_CATEGORIES => _('Categorías'),
|
||||
ActionsInterface::ACTION_MGM_CUSTOMERS => _('Clientes'),
|
||||
ActionsInterface::ACTION_USR_USERS => _('Usuarios'),
|
||||
ActionsInterface::ACTION_USR_GROUPS => _('Grupos')
|
||||
|
||||
);
|
||||
];
|
||||
|
||||
return (null !== $moduleId) ? $modules[$moduleId] : $modules;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace SP\Mgmt\CustomFields;
|
||||
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
|
||||
|
||||
use SP\Core\Crypt;
|
||||
use SP\Core\Exceptions\SPException;
|
||||
use SP\DataModel\CustomFieldData;
|
||||
use SP\Log\Log;
|
||||
use SP\Storage\DB;
|
||||
@@ -49,7 +50,7 @@ class CustomFieldsUtil
|
||||
*/
|
||||
public static function checkHash(&$fields, $srcHhash)
|
||||
{
|
||||
return (!is_array($fields) || $srcHhash == md5(implode('', $fields)));
|
||||
return (!is_array($fields) || $srcHhash === md5(implode('', $fields)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,7 +70,7 @@ class CustomFieldsUtil
|
||||
'SELECT customfielddata_id, customfielddata_data, customfielddata_iv FROM customFieldsData';
|
||||
|
||||
$Data = new QueryData();
|
||||
$Data->setMapClassName('SP\DataModel\CustomFieldData');
|
||||
$Data->setMapClassName(CustomFieldData::class);
|
||||
$Data->setQuery($query);
|
||||
|
||||
$queryRes = DB::getResultsArray($Data);
|
||||
@@ -84,8 +85,8 @@ class CustomFieldsUtil
|
||||
$Log->addDescription(_('Actualizando datos encriptados'));
|
||||
$Log->writeLog(true);
|
||||
|
||||
$errors = array();
|
||||
$success = array();
|
||||
$errors = [];
|
||||
$success = [];
|
||||
|
||||
foreach ($queryRes as $CustomField) {
|
||||
/** @var CustomFieldData $CustomField */
|
||||
@@ -132,6 +133,8 @@ class CustomFieldsUtil
|
||||
*
|
||||
* @param array $customFields
|
||||
* @param CustomFieldData $CustomFieldData
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
*/
|
||||
public static function addItemCustomFields(array &$customFields, CustomFieldData $CustomFieldData)
|
||||
{
|
||||
@@ -148,6 +151,8 @@ class CustomFieldsUtil
|
||||
*
|
||||
* @param array $customFields
|
||||
* @param CustomFieldData $CustomFieldData
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
*/
|
||||
public static function updateItemCustomFields(array $customFields, CustomFieldData $CustomFieldData)
|
||||
{
|
||||
@@ -158,4 +163,54 @@ class CustomFieldsUtil
|
||||
CustomField::getItem($CustomFieldData)->update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Migración de campos personalizados
|
||||
*
|
||||
* @return bool
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
public static function migrateCustomFields()
|
||||
{
|
||||
$Log = new Log(__FUNCTION__);
|
||||
|
||||
$query = /** @lang SQL */
|
||||
'SELECT customfielddata_defId FROM customFieldsData WHERE customfielddata_moduleId = 20';
|
||||
|
||||
$Data = new QueryData();
|
||||
$Data->setQuery($query);
|
||||
|
||||
$oldDefs = DB::getResultsArray($Data);
|
||||
|
||||
try {
|
||||
if (count($oldDefs) > 0) {
|
||||
$query = /** @lang SQL */
|
||||
'UPDATE customFieldsData SET customfielddata_moduleId = 10 WHERE customfielddata_moduleId = 20';
|
||||
|
||||
$Data = new QueryData();
|
||||
$Data->setQuery($query);
|
||||
|
||||
if (DB::getQuery($Data) === false) {
|
||||
throw new SPException(SPException::SP_ERROR, _('Error al migrar campos personalizados'));
|
||||
}
|
||||
|
||||
foreach ($oldDefs as $def) {
|
||||
$CustomFieldDef = CustomFieldDef::getItem()->getById($def->customfielddata_defId);
|
||||
$CustomFieldDef->setModule(10);
|
||||
|
||||
CustomFieldDef::getItem($CustomFieldDef)->update();
|
||||
|
||||
$Log->addDetails(_('Campo actualizado'), $def->customfielddata_defId);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (SPException $e) {
|
||||
$Log->setLogLevel(Log::ERROR);
|
||||
$Log->addDescription($e->getMessage());
|
||||
$Log->addDescription($e->getHint());
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ abstract class ProfileBase extends ItemBase
|
||||
public function __construct($itemData = null)
|
||||
{
|
||||
if (!$this->dataModel) {
|
||||
$this->setDataModel('SP\DataModel\ProfileData');
|
||||
$this->setDataModel(ProfileData::class);
|
||||
}
|
||||
|
||||
parent::__construct($itemData);
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
namespace SP\Mgmt\Profiles;
|
||||
|
||||
use SP\Core\Exceptions\SPException;
|
||||
use SP\DataModel\ProfileBaseData;
|
||||
use SP\DataModel\ProfileData;
|
||||
use SP\Log\Email;
|
||||
use SP\Log\Log;
|
||||
use SP\Storage\DB;
|
||||
use SP\Storage\QueryData;
|
||||
use SP\Util\Util;
|
||||
|
||||
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
|
||||
|
||||
@@ -45,6 +47,8 @@ class ProfileUtil
|
||||
* Migrar los perfiles con formato anterior a v1.2
|
||||
*
|
||||
* @return bool
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
* @throws \SP\Core\Exceptions\SPException
|
||||
*/
|
||||
public static function migrateProfiles()
|
||||
{
|
||||
|
||||
116
inc/SP/Mgmt/Users/UserPreferencesUtil.class.php
Normal file
116
inc/SP/Mgmt/Users/UserPreferencesUtil.class.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2017, 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\Mgmt\Users;
|
||||
|
||||
use Plugins\Authenticator\Authenticator;
|
||||
use Plugins\Authenticator\AuthenticatorData;
|
||||
use Plugins\Authenticator\AuthenticatorPlugin;
|
||||
use SP\Core\Exceptions\SPException;
|
||||
use SP\DataModel\PluginData;
|
||||
use SP\DataModel\UserData;
|
||||
use SP\DataModel\UserPreferencesData;
|
||||
use SP\Log\Log;
|
||||
use SP\Mgmt\Plugins\Plugin;
|
||||
use SP\Storage\DB;
|
||||
use SP\Storage\QueryData;
|
||||
use SP\Util\Util;
|
||||
|
||||
/**
|
||||
* Class UserPreferencesUtil
|
||||
*
|
||||
* @package SP\Mgmt\Users
|
||||
*/
|
||||
class UserPreferencesUtil
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws \SP\Core\Exceptions\InvalidClassException
|
||||
*/
|
||||
public static function migrateTwoFA()
|
||||
{
|
||||
$Log = new Log(__FUNCTION__);
|
||||
$Log->addDescription(_('Actualizando preferencias'));
|
||||
|
||||
$query = /** @lang SQL */
|
||||
'SELECT user_id, user_login, user_mIV, user_preferences FROM usrData';
|
||||
|
||||
$Data = new QueryData();
|
||||
$Data->setMapClassName(UserData::class);
|
||||
$Data->setQuery($query);
|
||||
|
||||
/** @var UserData[] $queryRes */
|
||||
$queryRes = DB::getResultsArray($Data);
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($queryRes as $user) {
|
||||
/** @var UserPreferencesData $UserPreferencesData */
|
||||
$UserPreferencesData = unserialize($user->getUserPreferences());
|
||||
|
||||
if ($UserPreferencesData !== false) {
|
||||
if (get_class($UserPreferencesData) === '__PHP_Incomplete_Class') {
|
||||
$UserPreferencesData = Util::castToClass(UserPreferencesData::class, $UserPreferencesData);
|
||||
}
|
||||
|
||||
if ($UserPreferencesData->isUse2Fa()) {
|
||||
$Authenticator = new Authenticator($user->user_id, $user->user_login, $user->user_mIV);
|
||||
|
||||
/** @var AuthenticatorData $AuthenticatorData */
|
||||
$AuthenticatorData = new AuthenticatorData();
|
||||
$AuthenticatorData->setUserId($user->user_id);
|
||||
$AuthenticatorData->setIV($Authenticator->getInitializationKey());
|
||||
$AuthenticatorData->setTwofaEnabled(1);
|
||||
$AuthenticatorData->setDate(time());
|
||||
|
||||
$data[$user->user_id] = $AuthenticatorData;
|
||||
|
||||
$Log->addDetails(_('Usuario'), $user->user_login);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($data) > 0) {
|
||||
try {
|
||||
$PluginData = new PluginData();
|
||||
$PluginData->setPluginName(AuthenticatorPlugin::PLUGIN_NAME);
|
||||
$PluginData->setPluginEnabled(1);
|
||||
$PluginData->setPluginData(serialize($data));
|
||||
|
||||
Plugin::getItem($PluginData)->update();
|
||||
|
||||
$Log->addDescription(_('Preferencias actualizadas'));
|
||||
$Log->writeLog();
|
||||
} catch (SPException $e) {
|
||||
$Log->addDescription(_('Error al actualizar preferencias'));
|
||||
$Log->setLogLevel(Log::ERROR);
|
||||
$Log->writeLog();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -233,15 +233,15 @@ class DB
|
||||
} catch (SPException $e) {
|
||||
ob_start();
|
||||
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
error_log(sprintf('Exception: %s - %s', $e->getMessage(), $e->getHint()));
|
||||
error_log(ob_get_clean());
|
||||
debugLog(sprintf('Exception: %s - %s', $e->getMessage(), $e->getHint()));
|
||||
debugLog(ob_get_clean());
|
||||
|
||||
throw $e;
|
||||
} catch (\Exception $e) {
|
||||
ob_start();
|
||||
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
error_log('Exception: ' . $e->getMessage());
|
||||
error_log(ob_get_clean());
|
||||
debugLog('Exception: ' . $e->getMessage());
|
||||
debugLog(ob_get_clean());
|
||||
|
||||
throw new SPException(SPException::SP_CRITICAL, $e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ class Util
|
||||
*/
|
||||
public static function getVersion($retBuild = false)
|
||||
{
|
||||
$build = '16122901';
|
||||
$build = '17010901';
|
||||
$version = [2, 0];
|
||||
|
||||
if ($retBuild) {
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
-- To 1.3.16011001
|
||||
CREATE TABLE `publicLinks` (
|
||||
publicLink_id INT UNSIGNEDPRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
publicLink_itemId INT UNSIGNED,
|
||||
publicLink_hash VARBINARY(100) NOT NULL,
|
||||
publicLink_linkData LONGBLOB
|
||||
);
|
||||
ALTER TABLE `usrData` ENGINE = InnoDB ;
|
||||
ALTER TABLE `accFiles` ENGINE = InnoDB ;
|
||||
ALTER TABLE `accGroups` ENGINE = InnoDB ;
|
||||
ALTER TABLE `accHistory` ENGINE = InnoDB ;
|
||||
ALTER TABLE `accUsers` ENGINE = InnoDB ;
|
||||
ALTER TABLE `categories` ENGINE = InnoDB ;
|
||||
ALTER TABLE `config` ENGINE = InnoDB ;
|
||||
ALTER TABLE `customers` ENGINE = InnoDB ;
|
||||
ALTER TABLE `log` ENGINE = InnoDB;
|
||||
ALTER TABLE `usrGroups` ENGINE = InnoDB ;
|
||||
ALTER TABLE `usrPassRecover` ENGINE = InnoDB ;
|
||||
ALTER TABLE `usrProfiles` ENGINE = InnoDB ;
|
||||
ALTER TABLE `accounts`
|
||||
ENGINE = InnoDB ,
|
||||
DROP INDEX `IDX_searchTxt` ,
|
||||
ADD INDEX `IDX_searchTxt` (`account_name` ASC, `account_login` ASC, `account_url` ASC);
|
||||
CREATE UNIQUE INDEX unique_publicLink_accountId ON publicLinks (publicLink_itemId);
|
||||
CREATE UNIQUE INDEX unique_publicLink_hash ON publicLinks (publicLink_hash);
|
||||
ALTER TABLE `log` ADD log_level VARCHAR(20) NOT NULL;
|
||||
ALTER TABLE `config` CHANGE config_value config_value VARCHAR(2000);
|
||||
CREATE TABLE `accFavorites` (
|
||||
`accfavorite_accountId` SMALLINT UNSIGNED NOT NULL,
|
||||
`accfavorite_userId` SMALLINT UNSIGNED NOT NULL,
|
||||
INDEX `fk_accFavorites_accounts_idx` (`accfavorite_accountId` ASC),
|
||||
INDEX `fk_accFavorites_users_idx` (`accfavorite_userId` ASC),
|
||||
INDEX `search_idx` (`accfavorite_accountId` ASC, `accfavorite_userId` ASC),
|
||||
CONSTRAINT `fk_accFavorites_accounts` FOREIGN KEY (`accfavorite_accountId`) REFERENCES `accounts` (`account_id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `fk_accFavorites_users` FOREIGN KEY (`accfavorite_userId`) REFERENCES `usrData` (`user_id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
23
inc/sql/110.sql
Normal file
23
inc/sql/110.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- To 1.1.0
|
||||
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)
|
||||
)
|
||||
DEFAULT CHARSET = utf8;
|
||||
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;
|
||||
11
inc/sql/1121.sql
Normal file
11
inc/sql/1121.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
-- To 1.1.21
|
||||
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`;
|
||||
8
inc/sql/11213.sql
Normal file
8
inc/sql/11213.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
-- 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 `accounts`
|
||||
CHANGE COLUMN `account_login` `account_login` VARCHAR(50) NULL DEFAULT NULL;
|
||||
5
inc/sql/11219.sql
Normal file
5
inc/sql/11219.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
-- 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;
|
||||
4
inc/sql/1122.sql
Normal file
4
inc/sql/1122.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
-- To 1.1.22
|
||||
ALTER TABLE `usrData`
|
||||
CHANGE COLUMN `user_login` `user_login` VARCHAR(50) NOT NULL,
|
||||
CHANGE COLUMN `user_email` `user_email` VARCHAR(80) NULL DEFAULT NULL;
|
||||
4
inc/sql/11220.sql
Normal file
4
inc/sql/11220.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
-- To 1.1.2.20
|
||||
ALTER TABLE `usrData`
|
||||
CHANGE COLUMN `user_pass` `user_pass` VARBINARY(255) NOT NULL,
|
||||
CHANGE COLUMN `user_mPass` `user_mPass` VARBINARY(255) DEFAULT NULL;
|
||||
17
inc/sql/1123.sql
Normal file
17
inc/sql/1123.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- To 1.1.23
|
||||
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 CHARSET = utf8;
|
||||
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`;
|
||||
60
inc/sql/12001.sql
Normal file
60
inc/sql/12001.sql
Normal file
@@ -0,0 +1,60 @@
|
||||
-- To 1.2.0.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 `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);
|
||||
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;
|
||||
9
inc/sql/12002.sql
Normal file
9
inc/sql/12002.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
-- To 1.2.0.0.2
|
||||
ALTER TABLE config
|
||||
CHANGE config_value config_value VARCHAR(255);
|
||||
ALTER TABLE usrData
|
||||
CHANGE user_pass user_pass VARBINARY(255);
|
||||
ALTER TABLE usrData
|
||||
CHANGE user_hashSalt user_hashSalt VARBINARY(128);
|
||||
ALTER TABLE accHistory
|
||||
CHANGE acchistory_mPassHash acchistory_mPassHash VARBINARY(255);
|
||||
58
inc/sql/1316011001.sql
Normal file
58
inc/sql/1316011001.sql
Normal file
@@ -0,0 +1,58 @@
|
||||
-- To 1.3.16011001
|
||||
CREATE TABLE `publicLinks` (
|
||||
publicLink_id INT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
publicLink_itemId INT UNSIGNED,
|
||||
publicLink_hash VARBINARY(100) NOT NULL,
|
||||
publicLink_linkData LONGBLOB
|
||||
);
|
||||
ALTER TABLE `usrData`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `accFiles`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `accGroups`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `accHistory`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `accUsers`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `categories`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `config`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `customers`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `log`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `usrGroups`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `usrPassRecover`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `usrProfiles`
|
||||
ENGINE = InnoDB;
|
||||
ALTER TABLE `accounts`
|
||||
ENGINE = InnoDB,
|
||||
DROP INDEX `IDX_searchTxt`,
|
||||
ADD INDEX `IDX_searchTxt` (`account_name` ASC, `account_login` ASC, `account_url` ASC);
|
||||
CREATE UNIQUE INDEX unique_publicLink_accountId
|
||||
ON publicLinks (publicLink_itemId);
|
||||
CREATE UNIQUE INDEX unique_publicLink_hash
|
||||
ON publicLinks (publicLink_hash);
|
||||
ALTER TABLE `log`
|
||||
ADD log_level VARCHAR(20) NOT NULL;
|
||||
ALTER TABLE `config`
|
||||
CHANGE config_value config_value VARCHAR(2000);
|
||||
CREATE TABLE `accFavorites` (
|
||||
`accfavorite_accountId` SMALLINT UNSIGNED NOT NULL,
|
||||
`accfavorite_userId` SMALLINT UNSIGNED NOT NULL,
|
||||
INDEX `fk_accFavorites_accounts_idx` (`accfavorite_accountId` ASC),
|
||||
INDEX `fk_accFavorites_users_idx` (`accfavorite_userId` ASC),
|
||||
INDEX `search_idx` (`accfavorite_accountId` ASC, `accfavorite_userId` ASC),
|
||||
CONSTRAINT `fk_accFavorites_accounts` FOREIGN KEY (`accfavorite_accountId`) REFERENCES `accounts` (`account_id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `fk_accFavorites_users` FOREIGN KEY (`accfavorite_userId`) REFERENCES `usrData` (`user_id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
18
inc/sql/1316020501.sql
Normal file
18
inc/sql/1316020501.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- To 1.3.16020501
|
||||
CREATE TABLE `tags` (
|
||||
`tag_id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`tag_name` VARCHAR(45) NOT NULL,
|
||||
`tag_hash` BINARY(20) NOT NULL,
|
||||
PRIMARY KEY (`tag_id`),
|
||||
INDEX `IDX_name` (`tag_name` ASC),
|
||||
UNIQUE INDEX `tag_hash_UNIQUE` (`tag_hash` ASC)
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
CREATE TABLE `accTags` (
|
||||
`acctag_accountId` INT UNSIGNED NOT NULL,
|
||||
`acctag_tagId` INT UNSIGNED NOT NULL,
|
||||
INDEX `IDX_id` (`acctag_accountId` ASC, `acctag_tagId` ASC)
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
@@ -82,7 +82,7 @@
|
||||
<div id="boxUpdated" class="round5"><?php echo _('Aplicación actualizada correctamente'); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($demoEnabled): ?>
|
||||
<?php if ($isDemoMode): ?>
|
||||
<div id="demo-info">
|
||||
<ul>
|
||||
<li><i class="material-icons">perm_identity</i><span>demo</span></li>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<main class="mdl-layout__content">
|
||||
<div id="actions" class="upgrade">
|
||||
<div id="pageDesc">
|
||||
<h1><?php echo _('Actualización'), ' ', $appVersion; ?></h1>
|
||||
<div id="page-title">
|
||||
<h1><?php printf(_('Actualización %s'), $appVersion); ?></h1>
|
||||
</div>
|
||||
|
||||
<form id="upgrade" action="index.php" method="get">
|
||||
<form id="upgrade" method="post" class="form-action" data-onsubmit="main/upgrade">
|
||||
<fieldset>
|
||||
<legend><?php echo _('Actualización de BBDD'); ?></legend>
|
||||
|
||||
@@ -15,13 +15,23 @@
|
||||
for="h"><?php echo _('Código de Seguridad'); ?></label>
|
||||
</div>
|
||||
|
||||
<div id="help-code"
|
||||
class="icon material-icons <?php echo $icons->getIconHelp()->getClass(); ?>">
|
||||
<?php echo $icons->getIconHelp()->getIcon(); ?>
|
||||
</div>
|
||||
<div class="mdl-tooltip" for="help-code">
|
||||
<?php echo _('Este código se encuentra en el archivo de configuración de sysPass con la etiqueta "upgradeKey"'); ?>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="a" value="<?php echo $action; ?>">
|
||||
<input type="hidden" name="t" value="<?php echo $time; ?>">
|
||||
<input type="hidden" name="isAjax" value="1">
|
||||
<input type="hidden" name="upgrade" value="1">
|
||||
</fieldset>
|
||||
|
||||
<div class="buttons">
|
||||
<button id="btnChange" class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent">
|
||||
<button id="btnChange" class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent"
|
||||
type="submit">
|
||||
<?php echo _('Actualizar'); ?>
|
||||
<i class="material-icons"
|
||||
title="<?php echo _('Iniciar Actualización'); ?>"><?php echo $icons->getIconPlay()->getIcon(); ?></i>
|
||||
|
||||
Reference in New Issue
Block a user