diff --git a/ajax/ajax_accFavorites.php b/ajax/ajax_accFavorites.php deleted file mode 100644 index 2eeb5972..00000000 --- a/ajax/ajax_accFavorites.php +++ /dev/null @@ -1,65 +0,0 @@ -. - * - */ - -use SP\Account\AccountFavorites; -use SP\Core\ActionsInterface; -use SP\Core\Session; -use SP\Core\SessionUtil; -use SP\Http\Request; -use SP\Http\Response; - -define('APP_ROOT', '..'); - -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('POST'); - -$sk = Request::analyze('sk', false); - -if (!$sk || !SessionUtil::checkSessionKey($sk)) { - Response::printJson(_('CONSULTA INVÁLIDA')); -} - -$actionId = Request::analyze('actionId', 0); -$accountId = Request::analyze('accountId', 0); -$userId = Session::getUserId(); - -if (!$accountId || !$actionId){ - Response::printJson(_('Acción Inválida')); -} - -if ($actionId === ActionsInterface::ACTION_ACC_FAVORITES_ADD) { - if (AccountFavorites::addFavorite($accountId, $userId)) { - Response::printJson(_('Favorito añadido'), 0); - } - - Response::printJson(_('Error al añadir favorito')); -} elseif ($actionId === ActionsInterface::ACTION_ACC_FAVORITES_DELETE) { - if (AccountFavorites::deleteFavorite($accountId, $userId)) { - Response::printJson(_('Favorito eliminado'), 0); - } - - Response::printJson(_('Error al eliminar favorito')); -} \ No newline at end of file diff --git a/ajax/ajax_accSave.php b/ajax/ajax_accSave.php deleted file mode 100644 index 28994e70..00000000 --- a/ajax/ajax_accSave.php +++ /dev/null @@ -1,189 +0,0 @@ -. - * - */ - -use SP\Account\Account; -use SP\Forms\AccountForm; -use SP\Core\ActionsInterface; -use SP\Core\Exceptions\ValidationException; -use SP\Core\Init; -use SP\Core\Session; -use SP\Core\SessionUtil; -use SP\DataModel\AccountExtData; -use SP\DataModel\CustomFieldData; -use SP\Http\Request; -use SP\Http\Response; -use SP\Mgmt\CustomFields\CustomField; -use SP\Mgmt\CustomFields\CustomFieldsUtil; - -define('APP_ROOT', '..'); - -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('POST'); - -if (!Init::isLoggedIn()) { - Response::printJson(_('La sesión no se ha iniciado o ha caducado'), 10); -} - -$sk = Request::analyze('sk', false); - -if (!$sk || !SessionUtil::checkSessionKey($sk)) { - Response::printJson(_('CONSULTA INVÁLIDA')); -} - -// Variables POST del formulario -$actionId = Request::analyze('actionId', 0); -$accountId = Request::analyze('accountId', 0); -$customerId = Request::analyze('customerId', 0); -$categoryId = Request::analyze('categoryId', 0); -$accountMainGroupId = Request::analyze('mainGroupId', 0); -$accountName = Request::analyze('name'); -$accountLogin = Request::analyze('login'); -$accountPassword = Request::analyzeEncrypted('pass'); -$accountNotes = Request::analyze('notes'); -$accountUrl = Request::analyze('url'); -$accountPassDateChange = Request::analyze('passworddatechange_unix', 0); - -// Checks -$accountGroupEditEnabled = Request::analyze('groupEditEnabled', 0, false, 1); -$accountUserEditEnabled = Request::analyze('userEditEnabled', 0, false, 1); -$accountPrivateEnabled = Request::analyze('privateEnabled', 0, false, 1); - -// Arrays -$accountOtherGroups = Request::analyze('otherGroups', 0); -$accountOtherUsers = Request::analyze('otherUsers', 0); -$accountTags = Request::analyze('tags'); -$customFields = Request::analyze('customfield'); - -if ($accountMainGroupId === 0) { - $accountMainGroupId = Session::getUserGroupId(); -} - -$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(Session::getUserId()); -$AccountData->setAccountOtherUserEdit($accountUserEditEnabled); -$AccountData->setAccountOtherGroupEdit($accountGroupEditEnabled); -$AccountData->setAccountPass($accountPassword); -$AccountData->setAccountIsPrivate($accountPrivateEnabled); -$AccountData->setAccountPassDateChange($accountPassDateChange); - -if (is_array($accountOtherUsers)) { - $AccountData->setUsersId($accountOtherUsers); -} - -if (is_array($accountOtherGroups)) { - $AccountData->setUserGroupsId($accountOtherGroups); -} - -if (is_array($accountTags)) { - $AccountData->setTags($accountTags); -} - -try { - $AccountForm = new AccountForm($AccountData); - $AccountForm->validate($actionId); -} catch (ValidationException $e) { - Response::printJson($e->getMessage()); -} - -$CustomFieldData = new CustomFieldData(); -$CustomFieldData->setId($accountId); -$CustomFieldData->setModule(ActionsInterface::ACTION_ACC); - -$Account = new Account($AccountData); - -switch ($actionId) { - case ActionsInterface::ACTION_ACC_NEW: - case ActionsInterface::ACTION_ACC_COPY: - $AccountData->setAccountUserId(Session::getUserId()); - $AccountData->setAccountUserGroupId($accountMainGroupId); - - // Crear cuenta - if ($Account->createAccount()) { - if (is_array($customFields)) { - $CustomFieldData->setId($AccountData->getAccountId()); - CustomFieldsUtil::addItemCustomFields($customFields, $CustomFieldData); - } - - Response::printJson(_('Cuenta creada'), 0); - } - - Response::printJson(_('Error al crear la cuenta'), 0); - break; - case ActionsInterface::ACTION_ACC_EDIT: - // Cambiar el grupo principal si el usuario es Admin - if (Session::getUserIsAdminApp() || Session::getUserIsAdminAcc()) { - $AccountData->setAccountUserGroupId($accountMainGroupId); - } - - // Actualizar cuenta - if ($Account->updateAccount()) { - if (is_array($customFields)) { - CustomFieldsUtil::updateItemCustomFields($customFields, $CustomFieldData); - } - - Response::printJson(_('Cuenta actualizada'), 0); - } - - Response::printJson(_('Error al modificar la cuenta')); - break; - case ActionsInterface::ACTION_ACC_DELETE: - // Eliminar cuenta - if ($Account->deleteAccount() - && CustomField::getItem($CustomFieldData)->delete($accountId) - ) { - Response::printJson(_('Cuenta eliminada'), 0); - } - - Response::printJson(_('Error al eliminar la cuenta')); - break; - case ActionsInterface::ACTION_ACC_EDIT_PASS: - // Actualizar clave de cuenta - if ($Account->updateAccountPass()) { - Response::printJson(_('Clave actualizada'), 0); - } - - Response::printJson(_('Error al actualizar la clave')); - break; - case ActionsInterface::ACTION_ACC_EDIT_RESTORE: - $AccountData->setAccountId(\SP\Account\AccountHistory::getAccountIdFromId($accountId)); - - if ($Account->restoreFromHistory($accountId)) { - Response::printJson(_('Cuenta restaurada'), 0); - } - - Response::printJson(_('Error al restaurar cuenta')); - - break; - default: - Response::printJson(_('Acción Inválida')); -} \ No newline at end of file diff --git a/ajax/ajax_appMgmtSave.php b/ajax/ajax_appMgmtSave.php index 2027521c..daf4af34 100644 --- a/ajax/ajax_appMgmtSave.php +++ b/ajax/ajax_appMgmtSave.php @@ -23,36 +23,10 @@ * */ -use SP\Account\Account; -use SP\DataModel\AccountData; -use SP\Core\ActionsInterface; -use SP\Core\Session; -use SP\Core\Exceptions\SPException; -use SP\DataModel\CategoryData; -use SP\DataModel\CustomerData; -use SP\DataModel\CustomFieldData; -use SP\DataModel\CustomFieldDefData; -use SP\DataModel\GroupData; -use SP\DataModel\ProfileData; -use SP\DataModel\PublicLinkData; -use SP\DataModel\TagData; -use SP\DataModel\UserData; +use SP\Controller\ItemActionController; use SP\Http\Request; use SP\Core\SessionUtil; use SP\Http\Response; -use SP\Mgmt\Categories\Category; -use SP\Mgmt\Customers\Customer; -use SP\Mgmt\CustomFields\CustomFieldDef; -use SP\Mgmt\CustomFields\CustomField; -use SP\Mgmt\CustomFields\CustomFieldsUtil; -use SP\Mgmt\Files\File; -use SP\Mgmt\PublicLinks\PublicLink; -use SP\Mgmt\Groups\Group; -use SP\Mgmt\Profiles\Profile; -use SP\Mgmt\Tags\Tag; -use SP\Mgmt\Users\User; -use SP\Mgmt\Users\UserUtil; -use SP\Util\Checks; define('APP_ROOT', '..'); @@ -70,551 +44,5 @@ if (!$sk || !SessionUtil::checkSessionKey($sk)) { Response::printJson(_('CONSULTA INVÁLIDA')); } -// Variables POST del formulario -$actionId = Request::analyze('actionId', 0); -$itemId = Request::analyze('itemId', 0); -$onCloseAction = Request::analyze('onCloseAction'); -$activeTab = Request::analyze('activeTab', 0); -$customFields = Request::analyze('customfield'); - -// Acción al cerrar la vista -$doActionOnClose = ''; - -$userLogin = UserUtil::getUserLoginById($itemId); - -if ($actionId === ActionsInterface::ACTION_USR_USERS_NEW - || $actionId === ActionsInterface::ACTION_USR_USERS_EDIT - || $actionId === ActionsInterface::ACTION_USR_USERS_EDITPASS - || $actionId === ActionsInterface::ACTION_USR_USERS_DELETE -) { - $isLdap = Request::analyze('isLdap', 0); - $userPassR = Request::analyzeEncrypted('passR'); - - $UserData = new UserData(); - $UserData->setUserId($itemId); - $UserData->setUserName(Request::analyze('name')); - $UserData->setUserLogin(Request::analyze('login')); - $UserData->setUserEmail(Request::analyze('email')); - $UserData->setUserNotes(Request::analyze('notes')); - $UserData->setUserGroupId(Request::analyze('groupid', 0)); - $UserData->setUserProfileId(Request::analyze('profileid', 0)); - $UserData->setUserIsAdminApp(Request::analyze('adminapp', false, false, true)); - $UserData->setUserIsAdminAcc(Request::analyze('adminacc', false, false, true)); - $UserData->setUserIsDisabled(Request::analyze('disabled', false, false, true)); - $UserData->setUserIsChangePass(Request::analyze('changepass', false, false, true)); - $UserData->setUserPass(Request::analyzeEncrypted('pass')); - - - $CustomFieldData = new CustomFieldData(); - $CustomFieldData->setId($itemId); - $CustomFieldData->setModule(ActionsInterface::ACTION_USR_USERS); - - // Nuevo usuario o editar - if ($actionId === ActionsInterface::ACTION_USR_USERS_NEW - || $actionId === ActionsInterface::ACTION_USR_USERS_EDIT - ) { - if (!$UserData->getUserName() && !$isLdap) { - Response::printJson(_('Es necesario un nombre de usuario'), 2); - } elseif (!$UserData->getUserLogin() && !$isLdap) { - Response::printJson(_('Es necesario un login'), 2); - } elseif (!$UserData->getUserProfileId()) { - Response::printJson(_('Es necesario un perfil'), 2); - } elseif (!$UserData->getUserGroupId()) { - Response::printJson(_('Es necesario un grupo'), 2); - } elseif (!$UserData->getUserEmail() && !$isLdap) { - Response::printJson(_('Es necesario un email'), 2); - } elseif (Checks::demoIsEnabled() && !Session::getUserIsAdminApp() && $UserData->getUserLogin() == 'demo') { - Response::printJson(_('Ey, esto es una DEMO!!')); - } - - if ($actionId === ActionsInterface::ACTION_USR_USERS_NEW) { - if (!$UserData->getUserPass() || !$userPassR) { - Response::printJson(_('La clave no puede estar en blanco'), 2); - } elseif ($UserData->getUserPass() != $userPassR) { - Response::printJson(_('Las claves no coinciden'), 2); - } - - try { - User::getItem($UserData)->add(); - - if (is_array($customFields)) { - $CustomFieldData->setId($UserData->getUserId()); - CustomFieldsUtil::addItemCustomFields($customFields, $CustomFieldData); - } - } catch (SPException $e){ - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Usuario creado'), 0, $doActionOnClose); - } elseif ($actionId === ActionsInterface::ACTION_USR_USERS_EDIT) { - try { - User::getItem($UserData)->update(); - - if (is_array($customFields)) { - $CustomFieldData->setId($UserData->getUserId()); - CustomFieldsUtil::addItemCustomFields($customFields, $CustomFieldData); - } - } catch (SPException $e){ - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Usuario actualizado'), 0, $doActionOnClose); - } - } elseif ($actionId === ActionsInterface::ACTION_USR_USERS_EDITPASS) { - if (Checks::demoIsEnabled() && UserUtil::getUserLoginById($itemId) == 'demo') { - Response::printJson(_('Ey, esto es una DEMO!!')); - } elseif (!$UserData->getUserPass() || !$userPassR) { - Response::printJson(_('La clave no puede estar en blanco'), 2); - } elseif ($UserData->getUserPass() != $userPassR) { - Response::printJson(_('Las claves no coinciden'), 2); - } - - try { - User::getItem($UserData)->updatePass(); - } catch (SPException $e){ - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Clave actualizada'), 0); - - // Eliminar usuario - } elseif ($actionId === ActionsInterface::ACTION_USR_USERS_DELETE) { - if (Checks::demoIsEnabled() && UserUtil::getUserLoginById($itemId) == 'demo') { - Response::printJson(_('Ey, esto es una DEMO!!')); - } elseif ($UserData->getUserId() == Session::getUserId()) { - Response::printJson(_('No es posible eliminar, usuario en uso')); - } - - try { - User::getItem()->delete($itemId); - CustomField::getItem($CustomFieldData)->delete($itemId); - } catch (SPException $e){ - Response::printJson($e->getMessage()); - } - - Response::printJson(_('Usuario eliminado'), 0, $doActionOnClose); - } -} elseif ($actionId === ActionsInterface::ACTION_USR_GROUPS_NEW - || $actionId === ActionsInterface::ACTION_USR_GROUPS_EDIT - || $actionId === ActionsInterface::ACTION_USR_GROUPS_DELETE -) { - $GroupData = new GroupData(); - $GroupData->setUsergroupId($itemId); - $GroupData->setUsergroupName(Request::analyze('name')); - $GroupData->setUsergroupDescription(Request::analyze('description')); - $GroupData->setUsers(Request::analyze('users', 0)); - - $CustomFieldData = new CustomFieldData(); - $CustomFieldData->setId($itemId); - $CustomFieldData->setModule(ActionsInterface::ACTION_USR_GROUPS); - - if ($actionId === ActionsInterface::ACTION_USR_GROUPS_NEW - || $actionId === ActionsInterface::ACTION_USR_GROUPS_EDIT - ) { - if (!$GroupData->getUsergroupName()) { - Response::printJson(_('Es necesario un nombre de grupo'), 2); - } - - if ($actionId === ActionsInterface::ACTION_USR_GROUPS_NEW) { - try { - Group::getItem($GroupData)->add(); - - if (is_array($customFields)) { - $CustomFieldData->setId($itemId); //FIXME - CustomFieldsUtil::addItemCustomFields($customFields, $CustomFieldData); - } - - Response::printJson(_('Grupo creado'), 0, $doActionOnClose); - } catch (SPException $e) { - Response::printJson($e->getMessage()); - } - } elseif ($actionId === ActionsInterface::ACTION_USR_GROUPS_EDIT) { - try { - Group::getItem($GroupData)->update(); - - if (is_array($customFields)) { - $CustomFieldData->setId($itemId); //FIXME - CustomFieldsUtil::updateItemCustomFields($customFields, $CustomFieldData); - } - - Response::printJson(_('Grupo actualizado'), 0, $doActionOnClose); - } catch (SPException $e) { - Response::printJson($e->getMessage()); - } - } - } elseif ($actionId === ActionsInterface::ACTION_USR_GROUPS_DELETE) { - try { - Group::getItem($GroupData)->delete($itemId); - CustomField::getItem($CustomFieldData)->delete($itemId); - - Response::printJson(_('Grupo eliminado'), 0, $doActionOnClose); - } catch (SPException $e) { - Response::printJson($e->getMessage()); - } - } -} elseif ($actionId === ActionsInterface::ACTION_USR_PROFILES_NEW - || $actionId === ActionsInterface::ACTION_USR_PROFILES_EDIT - || $actionId === ActionsInterface::ACTION_USR_PROFILES_DELETE -) { - if ($actionId === ActionsInterface::ACTION_USR_PROFILES_NEW - || $actionId === ActionsInterface::ACTION_USR_PROFILES_EDIT - ) { - $ProfileData = new ProfileData(); - $ProfileData->setUserprofileName(Request::analyze('profile_name')); - $ProfileData->setUserprofileId(Request::analyze('itemId', 0)); - $ProfileData->setAccAdd(Request::analyze('profile_accadd', 0, false, 1)); - $ProfileData->setAccView(Request::analyze('profile_accview', 0, false, 1)); - $ProfileData->setAccViewPass(Request::analyze('profile_accviewpass', 0, false, 1)); - $ProfileData->setAccViewHistory(Request::analyze('profile_accviewhistory', 0, false, 1)); - $ProfileData->setAccEdit(Request::analyze('profile_accedit', 0, false, 1)); - $ProfileData->setAccEditPass(Request::analyze('profile_acceditpass', 0, false, 1)); - $ProfileData->setAccDelete(Request::analyze('profile_accdel', 0, false, 1)); - $ProfileData->setAccFiles(Request::analyze('profile_accfiles', 0, false, 1)); - $ProfileData->setAccPublicLinks(Request::analyze('profile_accpublinks', 0, false, 1)); - $ProfileData->setAccPrivate(Request::analyze('profile_accprivate', 0, false, 1)); - $ProfileData->setAccPermission(Request::analyze('profile_accpermissions', 0, false, 1)); - $ProfileData->setConfigGeneral(Request::analyze('profile_config', 0, false, 1)); - $ProfileData->setConfigEncryption(Request::analyze('profile_configmpw', 0, false, 1)); - $ProfileData->setConfigBackup(Request::analyze('profile_configback', 0, false, 1)); - $ProfileData->setConfigImport(Request::analyze('profile_configimport', 0, false, 1)); - $ProfileData->setMgmCategories(Request::analyze('profile_categories', 0, false, 1)); - $ProfileData->setMgmCustomers(Request::analyze('profile_customers', 0, false, 1)); - $ProfileData->setMgmCustomFields(Request::analyze('profile_customfields', 0, false, 1)); - $ProfileData->setMgmUsers(Request::analyze('profile_users', 0, false, 1)); - $ProfileData->setMgmGroups(Request::analyze('profile_groups', 0, false, 1)); - $ProfileData->setMgmProfiles(Request::analyze('profile_profiles', 0, false, 1)); - $ProfileData->setMgmApiTokens(Request::analyze('profile_apitokens', 0, false, 1)); - $ProfileData->setMgmPublicLinks(Request::analyze('profile_publinks', 0, false, 1)); - $ProfileData->setEvl(Request::analyze('profile_eventlog', 0, false, 1)); - - if (!$ProfileData->getUserprofileName()) { - Response::printJson(_('Es necesario un nombre de perfil'), 2); - } - - try { - switch ($actionId) { - case ActionsInterface::ACTION_USR_PROFILES_NEW: - Profile::getItem($ProfileData)->add(); - Response::printJson(_('Perfil creado'), 0, $doActionOnClose); - break; - case ActionsInterface::ACTION_USR_PROFILES_EDIT: - Profile::getItem($ProfileData)->update(); - Response::printJson(_('Perfil actualizado'), 0, $doActionOnClose); - } - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - } elseif ($actionId === ActionsInterface::ACTION_USR_PROFILES_DELETE) { - try { - Profile::getItem()->delete($itemId); - Response::printJson(_('Perfil eliminado'), 0, $doActionOnClose); - } catch (SPException $e) { - Response::printJson($e->getMessage()); - } - } -} elseif ($actionId === ActionsInterface::ACTION_MGM_CUSTOMERS_NEW - || $actionId === ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT - || $actionId === ActionsInterface::ACTION_MGM_CUSTOMERS_DELETE -) { - $CustomerData = new CustomerData(); - $CustomerData->setCustomerId($itemId); - $CustomerData->setCustomerName(Request::analyze('name')); - $CustomerData->setCustomerDescription(Request::analyze('description')); - - $Customer = new Customer($CustomerData); - - $CustomFieldData = new CustomFieldData(); - $CustomFieldData->setId($itemId); - $CustomFieldData->setModule(ActionsInterface::ACTION_MGM_CUSTOMERS); - - if ($actionId === ActionsInterface::ACTION_MGM_CUSTOMERS_NEW - || $actionId === ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT - ) { - if (!$CustomerData->getCustomerName()) { - Response::printJson(_('Es necesario un nombre de cliente'), 2); - } - - if ($actionId === ActionsInterface::ACTION_MGM_CUSTOMERS_NEW) { - try { - $Customer->add(); - - if (is_array($customFields)) { - $CustomFieldData->setId($CustomerData->getCustomerId()); - CustomFieldsUtil::addItemCustomFields($customFields, $CustomFieldData); - } - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Cliente creado'), 0, $doActionOnClose); - } else if ($actionId === ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT) { - try { - $Customer->update(); - - if (is_array($customFields)) { - CustomFieldsUtil::updateItemCustomFields($customFields, $CustomFieldData); - } - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Cliente actualizado'), 0, $doActionOnClose); - } - } elseif ($actionId === ActionsInterface::ACTION_MGM_CUSTOMERS_DELETE) { - try { - $Customer->delete($itemId); - CustomField::getItem($CustomFieldData)->delete($itemId); - } catch (SPException $e) { - Response::printJson($e->getMessage()); - } - - Response::printJson(_('Cliente eliminado'), 0, $doActionOnClose); - } -} elseif ($actionId === ActionsInterface::ACTION_MGM_CATEGORIES_NEW - || $actionId === ActionsInterface::ACTION_MGM_CATEGORIES_EDIT - || $actionId === ActionsInterface::ACTION_MGM_CATEGORIES_DELETE -) { - $CategoryData = new CategoryData(); - $CategoryData->setCategoryId($itemId); - $CategoryData->setCategoryName(Request::analyze('name')); - $CategoryData->setCategoryDescription(Request::analyze('description')); - - $Category = new Category($CategoryData); - - $CustomFieldData = new CustomFieldData(); - $CustomFieldData->setId($itemId); - $CustomFieldData->setModule(ActionsInterface::ACTION_MGM_CATEGORIES); - - if ($actionId === ActionsInterface::ACTION_MGM_CATEGORIES_NEW - || $actionId === ActionsInterface::ACTION_MGM_CATEGORIES_EDIT - ) { - if (!$CategoryData->getCategoryName()) { - Response::printJson(_('Es necesario un nombre de categoría'), 2); - } - - if ($actionId === ActionsInterface::ACTION_MGM_CATEGORIES_NEW) { - try { - $Category->add(); - - if (is_array($customFields)) { - $CustomFieldData->setId($CategoryData->getCategoryId()); - CustomFieldsUtil::addItemCustomFields($customFields, $CustomFieldData); - } - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Categoría creada'), 0, $doActionOnClose); - } else if ($actionId === ActionsInterface::ACTION_MGM_CATEGORIES_EDIT) { - try { - $Category->update(); - - if (is_array($customFields)) { - CustomFieldsUtil::updateItemCustomFields($customFields, $CustomFieldData); - } - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Categoría actualizada'), 0, $doActionOnClose); - } - - } elseif ($actionId === ActionsInterface::ACTION_MGM_CATEGORIES_DELETE) { - try { - $Category->delete($itemId); - CustomField::getItem($CustomFieldData)->delete($itemId); - } catch (SPException $e) { - Response::printJson($e->getMessage()); - } - - Response::printJson(_('Categoría eliminada'), 0, $doActionOnClose); - } -} elseif ($actionId === ActionsInterface::ACTION_MGM_APITOKENS_NEW - || $actionId === ActionsInterface::ACTION_MGM_APITOKENS_EDIT - || $actionId === ActionsInterface::ACTION_MGM_APITOKENS_DELETE -) { - $ApiTokens = new \SP\Api\ApiTokens(); - $ApiTokens->setTokenId($itemId); - $ApiTokens->setUserId(Request::analyze('users', 0)); - $ApiTokens->setActionId(Request::analyze('actions', 0)); - $ApiTokens->setRefreshToken(Request::analyze('refreshtoken', false, false, true)); - - if ($actionId === ActionsInterface::ACTION_MGM_APITOKENS_NEW - || $actionId === ActionsInterface::ACTION_MGM_APITOKENS_EDIT - ) { - if ($ApiTokens->getUserId() === 0 || $ApiTokens->getActionId() === 0) { - Response::printJson(_('Usuario o acción no indicado'), 2); - } - - if ($actionId === ActionsInterface::ACTION_MGM_APITOKENS_NEW) { - try { - $ApiTokens->addToken(); - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Autorización creada'), 0, $doActionOnClose); - } elseif ($actionId === ActionsInterface::ACTION_MGM_APITOKENS_EDIT) { - try { - $ApiTokens->updateToken(); - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Autorización actualizada'), 0, $doActionOnClose); - } - - } elseif ($actionId === ActionsInterface::ACTION_MGM_APITOKENS_DELETE) { - try { - $ApiTokens->deleteToken(); - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Autorización eliminada'), 0, $doActionOnClose); - } -} elseif ($actionId === ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW - || $actionId === ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT - || $actionId === ActionsInterface::ACTION_MGM_CUSTOMFIELDS_DELETE -) { - $CustomFieldDefData = new CustomFieldDefData(); - $CustomFieldDefData->setId($itemId); - $CustomFieldDefData->setName(Request::analyze('name')); - $CustomFieldDefData->setType(Request::analyze('type', 0)); - $CustomFieldDefData->setModule(Request::analyze('module', 0)); - $CustomFieldDefData->setHelp(Request::analyze('help')); - $CustomFieldDefData->setRequired(Request::analyze('required', false, false, true)); - - $CustomFieldDef = new CustomFieldDef($CustomFieldDefData); - - if ($actionId === ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW - || $actionId === ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT - ) { - if (!$CustomFieldDefData->getName()) { - Response::printJson(_('Nombre del campo no indicado'), 2); - } elseif ($CustomFieldDefData->getType() === 0) { - Response::printJson(_('Tipo del campo no indicado'), 2); - } elseif ($CustomFieldDefData->getModule() === 0) { - Response::printJson(_('Módulo del campo no indicado'), 2); - } - - if ($actionId === ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW) { - try { - $CustomFieldDef->add(); - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Campo creado'), 0, $doActionOnClose); - } elseif ($actionId === ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT) { - try { - $CustomFieldDef->update(); - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Campo actualizado'), 0, $doActionOnClose); - } - - } elseif ($actionId === ActionsInterface::ACTION_MGM_CUSTOMFIELDS_DELETE) { - try { - $CustomFieldDef->delete($itemId); - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Campo eliminado'), 0, $doActionOnClose); - } -} elseif ($actionId === ActionsInterface::ACTION_MGM_PUBLICLINKS_NEW - || $actionId === ActionsInterface::ACTION_MGM_PUBLICLINKS_DELETE - || $actionId === ActionsInterface::ACTION_MGM_PUBLICLINKS_REFRESH -) { - $PublicLinkData = new PublicLinkData(); - $PublicLinkData->setItemId($itemId); - $PublicLinkData->setTypeId(PublicLink::TYPE_ACCOUNT); - - if ($actionId === ActionsInterface::ACTION_MGM_PUBLICLINKS_NEW) { - $doActionOnClose = "sysPassUtil.Common.doAction(" . ActionsInterface::ACTION_ACC_VIEW . ",'',$itemId);"; - - $PublicLinkData->setNotify(Request::analyze('notify', false, false, true)); - - try { - PublicLink::getItem($PublicLinkData)->add(); - } catch (SPException $e) { - Response::printJson($e->getMessage()); - } - - Response::printJson(_('Enlace creado'), 0, $doActionOnClose); - } elseif ($actionId === ActionsInterface::ACTION_MGM_PUBLICLINKS_DELETE) { - try { - PublicLink::getItem()->delete($itemId); - } catch (SPException $e) { - Response::printJson($e->getMessage()); - } - - Response::printJson(_('Enlace eliminado'), 0, $doActionOnClose); - } elseif ($actionId === ActionsInterface::ACTION_MGM_PUBLICLINKS_REFRESH) { - try { - PublicLink::getItem($PublicLinkData)->update(); - } catch (SPException $e) { - Response::printJson($e->getMessage()); - } - - Response::printJson(_('Enlace actualizado'), 0, $doActionOnClose); - } -} elseif ($actionId === ActionsInterface::ACTION_MGM_TAGS_NEW - || $actionId === ActionsInterface::ACTION_MGM_TAGS_EDIT - || $actionId === ActionsInterface::ACTION_MGM_TAGS_DELETE -) { - $TagData = new TagData(); - $TagData->setTagId($itemId); - $TagData->setTagName(Request::analyze('name')); - - if ($actionId === ActionsInterface::ACTION_MGM_TAGS_NEW) { - try { - Tag::getItem($TagData)->add(); - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Etiqueta creada'), 0, $doActionOnClose); - } elseif ($actionId === ActionsInterface::ACTION_MGM_TAGS_DELETE) { - try { - Tag::getItem()->delete($itemId); - } catch (SPException $e) { - Response::printJson($e->getMessage()); - } - - Response::printJson(_('Etiqueta eliminada'), 0, $doActionOnClose); - } elseif ($actionId === ActionsInterface::ACTION_MGM_TAGS_EDIT) { - try { - Tag::getItem($TagData)->update(); - } catch (SPException $e) { - Response::printJson($e->getMessage(), 2); - } - - Response::printJson(_('Etiqueta actualizada'), 0, $doActionOnClose); - } -} elseif ($actionId === ActionsInterface::ACTION_MGM_FILES_DELETE) { - // Verificamos que el ID sea numérico - if ($itemId === 0) { - Response::printJson(_('No es un ID de archivo válido')); - } elseif (File::getItem()->delete($itemId)) { - Response::printJson(_('Archivo eliminado'), 0, $doActionOnClose); - } - - Response::printJson(_('Error al eliminar el archivo')); -} elseif ($actionId === ActionsInterface::ACTION_MGM_ACCOUNTS_DELETE) { - $Account = new Account(new AccountData($itemId)); - - // Eliminar cuenta - if ($Account->deleteAccount() - && CustomField::getItem(new CustomFieldData(ActionsInterface::ACTION_ACC_NEW))->delete($itemId) - ) { - Response::printJson(_('Cuenta eliminada'), 0, $doActionOnClose); - } - - Response::printJson(_('Error al eliminar la cuenta')); -} else { - Response::printJson(_('Acción Inválida')); -} \ No newline at end of file +$ItemAction = new ItemActionController(); +$ItemAction->doAction(); \ No newline at end of file diff --git a/inc/SP/Account/Account.class.php b/inc/SP/Account/Account.class.php index e66429d3..3baaa41c 100644 --- a/inc/SP/Account/Account.class.php +++ b/inc/SP/Account/Account.class.php @@ -64,16 +64,15 @@ class Account extends AccountBase implements AccountInterface */ public function updateAccount() { - $Log = new Log(__FUNCTION__); + $Log = new Log(_('Actualizar Cuenta')); // 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->setAction(_('Actualizar Cuenta')); + throw new SPException(SPException::SP_ERROR, _('Error al modificar la cuenta')); + } $GroupAccountsData = new GroupAccountsData(); $GroupAccountsData->setAccgroupAccountId($this->accountData->getAccountId()); @@ -150,7 +149,7 @@ class Account extends AccountBase implements AccountInterface $Data->addParam($this->accountData->getAccountId(), 'accountId'); if (DB::getQuery($Data) === false) { - return false; + throw new SPException(SPException::SP_ERROR, _('Error al modificar la cuenta')); } $accountInfo = ['customer_name']; @@ -224,17 +223,19 @@ class Account extends AccountBase implements AccountInterface * * @param $id int El Id del registro en el histórico * @return bool + * @throws \SP\Core\Exceptions\SPException */ public function restoreFromHistory($id) { - $Log = new Log(__FUNCTION__); + $Log = new Log(_('Restaurar Cuenta')); // Guardamos una copia de la cuenta en el histórico if (!AccountHistory::addHistory($this->accountData->getAccountId(), false)) { $Log->setLogLevel(Log::ERROR); $Log->addDescription(_('Error al actualizar el historial')); $Log->writeLog(); - return false; + + throw new SPException(SPException::SP_ERROR, _('Error al restaurar cuenta')); } $query = /** @lang SQL */ @@ -264,13 +265,12 @@ class Account extends AccountBase implements AccountInterface $Data->addParam($this->accountData->getAccountUserEditId(), 'accountUserEditId'); if (DB::getQuery($Data) === false) { - return false; + throw new SPException(SPException::SP_ERROR, _('Error al restaurar cuenta')); } $accountInfo = array('customer_name', 'account_name'); $this->getAccountInfoById($accountInfo); - $Log->setAction(_('Restaurar Cuenta')); $Log->addDetails(Html::strongText(_('Cliente')), $this->cacheParams['customer_name']); $Log->addDetails(Html::strongText(_('Cuenta')), sprintf('%s (%s)', $this->cacheParams['account_name'], $this->accountData->getAccountId())); @@ -352,19 +352,19 @@ class Account extends AccountBase implements AccountInterface $Data->addParam($this->accountData->getAccountIV(), 'accountIV'); $Data->addParam($this->accountData->getAccountNotes(), 'accountNotes'); $Data->addParam($this->accountData->getAccountUserId(), 'accountUserId'); - $Data->addParam($this->accountData->getAccountUserGroupId(), 'accountUserGroupId'); + $Data->addParam($this->accountData->getAccountUserGroupId() ?: Session::getUserGroupId(), 'accountUserGroupId'); $Data->addParam($this->accountData->getAccountOtherUserEdit(), 'accountOtherUserEdit'); $Data->addParam($this->accountData->getAccountOtherGroupEdit(), 'accountOtherGroupEdit'); $Data->addParam($this->accountData->getAccountIsPrivate(), 'accountIsPrivate'); $Data->addParam($this->accountData->getAccountPassDateChange(), 'accountPassDateChange'); if (DB::getQuery($Data) === false) { - return false; + throw new SPException(SPException::SP_ERROR, _('Error al crear la cuenta')); } $this->accountData->setAccountId(DB::$lastId); - $Log = new Log(__FUNCTION__); + $Log = new Log(_('Nueva Cuenta')); try { if (is_array($this->accountData->getAccountUserGroupsId())) { @@ -396,7 +396,6 @@ class Account extends AccountBase implements AccountInterface $accountInfo = ['customer_name']; $this->getAccountInfoById($accountInfo); - $Log->setAction(_('Nueva Cuenta')); $Log->addDetails(Html::strongText(_('Cliente')), $this->cacheParams['customer_name']); $Log->addDetails(Html::strongText(_('Cuenta')), sprintf('%s (%s)', $this->accountData->getAccountName(), $this->accountData->getAccountId())); $Log->writeLog(); @@ -423,17 +422,23 @@ class Account extends AccountBase implements AccountInterface * Elimina los datos de una cuenta en la BBDD. * * @return bool + * @throws \SP\Core\Exceptions\SPException */ public function deleteAccount() { - // FIXME + $Log = new Log(_('Eliminar Cuenta')); + // Guardamos una copia de la cuenta en el histórico - AccountHistory::addHistory($this->accountData->getAccountId(), true) || die (_('ERROR: Error en la operación.')); + if (!AccountHistory::addHistory($this->accountData->getAccountId(), true)) { + $Log->addDescription(_('Error al actualizar el historial')); + $Log->writeLog(); + + throw new SPException(SPException::SP_ERROR, _('Error al eliminar la cuenta')); + } $accountInfo = array('account_name,customer_name'); $this->getAccountInfoById($accountInfo); - $Log = new Log(_('Eliminar Cuenta')); $Log->addDetails(Html::strongText(_('Cliente')), $this->cacheParams['customer_name']); $Log->addDetails(Html::strongText(_('Cuenta')), sprintf('%s (%s)', $this->accountData->getAccountName(), $this->accountData->getAccountId())); @@ -445,7 +450,7 @@ class Account extends AccountBase implements AccountInterface $Data->addParam($this->accountData->getAccountId(), 'id'); if (DB::getQuery($Data) === false) { - return false; + throw new SPException(SPException::SP_ERROR, _('Error al eliminar la cuenta')); } try { @@ -625,7 +630,7 @@ class Account extends AccountBase implements AccountInterface */ public function updateAccountPass($isMassive = false, $isRestore = false) { - $Log = new Log(__FUNCTION__); + $Log = new Log(_('Modificar Clave')); // No actualizar el histórico si es por cambio de clave maestra o restauración if (!$isMassive @@ -635,7 +640,8 @@ class Account extends AccountBase implements AccountInterface // Guardamos una copia de la cuenta en el histórico $Log->addDescription(_('Error al actualizar el historial')); $Log->writeLog(); - return false; + + throw new SPException(SPException::SP_ERROR, _('Error al actualizar la clave')); } $this->setPasswordEncrypted(); @@ -660,7 +666,7 @@ class Account extends AccountBase implements AccountInterface if (DB::getQuery($Data) === false) { - return false; + throw new SPException(SPException::SP_ERROR, _('Error al actualizar la clave')); } // No escribir en el log ni enviar correos si la actualización es @@ -669,7 +675,6 @@ class Account extends AccountBase implements AccountInterface $accountInfo = array('customer_name', 'account_name'); $this->getAccountInfoById($accountInfo); - $Log->setAction(_('Modificar Clave')); $Log->addDetails(Html::strongText(_('Cliente')), $this->cacheParams['customer_name']); $Log->addDetails(Html::strongText(_('Cuenta')), sprintf('%s (%s)', $this->cacheParams['account_name'], $this->accountData->getAccountId())); $Log->writeLog(); diff --git a/inc/SP/Account/AccountFavorites.class.php b/inc/SP/Account/AccountFavorites.class.php index d4e76a72..d2155bc9 100644 --- a/inc/SP/Account/AccountFavorites.class.php +++ b/inc/SP/Account/AccountFavorites.class.php @@ -25,6 +25,7 @@ namespace SP\Account; +use SP\Core\Exceptions\SPException; use SP\Storage\DB; use SP\Storage\QueryData; @@ -70,8 +71,8 @@ class AccountFavorites * Añadir una cuenta a la lista de favoritos * * @param $accountId int El Id de la cuenta - * @param $userId int El Id del usuario - * @return bool + * @param $userId int El Id del usuario + * @throws \SP\Core\Exceptions\SPException */ public static function addFavorite($accountId, $userId) { @@ -82,15 +83,17 @@ class AccountFavorites $Data->addParam($accountId, 'accountId'); $Data->addParam($userId, 'userId'); - return DB::getQuery($Data); + if (DB::getQuery($Data) === false) { + throw new SPException(SPException::SP_ERROR, _('Error al añadir favorito')); + } } /** * Eliminar una cuenta de la lista de favoritos * * @param $accountId int El Id de la cuenta - * @param $userId int El Id del usuario - * @return bool + * @param $userId int El Id del usuario + * @throws \SP\Core\Exceptions\SPException */ public static function deleteFavorite($accountId, $userId) { @@ -101,6 +104,8 @@ class AccountFavorites $Data->addParam($accountId, 'accountId'); $Data->addParam($userId, 'userId'); - return DB::getQuery($Data); + if (DB::getQuery($Data) === false) { + throw new SPException(SPException::SP_ERROR, _('Error al eliminar favorito')); + } } } \ No newline at end of file diff --git a/inc/SP/Account/AccountHistory.class.php b/inc/SP/Account/AccountHistory.class.php index a34bcfc0..a4689e5a 100644 --- a/inc/SP/Account/AccountHistory.class.php +++ b/inc/SP/Account/AccountHistory.class.php @@ -520,7 +520,7 @@ class AccountHistory extends AccountBase implements AccountInterface $Data->setQuery($query); $Data->addParam($id, 'account_id'); $Data->addParam(($isDelete === false) ? 1 : 0, 'isModify'); - $Data->addParam(($isDelete === true) ? 1 : 1, 'isDelete'); + $Data->addParam(($isDelete === true) ? 1 : 0, 'isDelete'); $Data->addParam(ConfigDB::getValue('masterPwd'), 'masterPwd'); return DB::getQuery($Data); diff --git a/inc/SP/Controller/AccountController.class.php b/inc/SP/Controller/AccountController.class.php index c75cfdcf..a496a9ae 100644 --- a/inc/SP/Controller/AccountController.class.php +++ b/inc/SP/Controller/AccountController.class.php @@ -38,11 +38,11 @@ use SP\Core\Init; use SP\Core\Template; use SP\DataModel\AccountExtData; use SP\DataModel\CustomFieldData; +use SP\DataModel\PublicLinkData; use SP\Mgmt\Categories\Category; use SP\Mgmt\Customers\Customer; use SP\Mgmt\Groups\Group; use SP\Mgmt\Groups\GroupAccountsUtil; -use SP\Mgmt\PublicLinks\PublicLink; use SP\Mgmt\CustomFields\CustomField; use SP\Mgmt\Tags\Tag; use SP\Core\Session; @@ -466,10 +466,10 @@ class AccountController extends ControllerBase implements ActionsInterface /** * Obtener la vista de detalles de cuenta para enlaces públicos * - * @param \SP\Mgmt\PublicLinks\PublicLink $PublicLink + * @param PublicLinkData $PublicLinkData * @return bool */ - public function getAccountFromLink(PublicLink $PublicLink) + public function getAccountFromLink(PublicLinkData $PublicLinkData) { $this->setAction(self::ACTION_ACC_VIEW); @@ -491,8 +491,8 @@ class AccountController extends ControllerBase implements ActionsInterface $this->Account->getAccountPassData(); // Desencriptar la clave de la cuenta - $pass = Crypt::generateAesKey($PublicLink->getItemData()->getLinkHash()); - $masterPass = Crypt::getDecrypt($PublicLink->getItemData()->getPass(), $PublicLink->getItemData()->getPassIV(), $pass); + $pass = Crypt::generateAesKey($PublicLinkData->getLinkHash()); + $masterPass = Crypt::getDecrypt($PublicLinkData->getPass(), $PublicLinkData->getPassIV(), $pass); $accountPass = Crypt::getDecrypt($this->Account->getAccountData()->getAccountPass(), $this->Account->getAccountData()->getAccountIV(), $masterPass); if (Config::getConfig()->isPublinksImageEnabled()) { diff --git a/inc/SP/Controller/Grids.class.php b/inc/SP/Controller/Grids.class.php index b713a741..ae77429b 100644 --- a/inc/SP/Controller/Grids.class.php +++ b/inc/SP/Controller/Grids.class.php @@ -592,9 +592,6 @@ class Grids implements ActionsInterface $GridActionDel->setTitle(_('Eliminar Perfil')); $GridActionDel->setIcon($this->icons->getIconDelete()); $GridActionDel->setOnClickFunction('appMgmt/delete'); - $GridActionDel->setOnClickArgs('this'); - $GridActionDel->setOnClickArgs(self::ACTION_USR_PROFILES_DELETE); - $GridActionDel->setOnClickArgs($this->sk); $GridHeaders = new DataGridHeader(); $GridHeaders->addHeader(_('Nombre')); @@ -739,7 +736,7 @@ class Grids implements ActionsInterface $GridHeaders->addHeader(_('Visitas')); $GridData = new DataGridData(); - $GridData->setDataRowSourceId('publicLink_itemId'); + $GridData->setDataRowSourceId('publicLink_id'); $GridData->addDataRowSource('accountName'); $GridData->addDataRowSource('dateAdd'); $GridData->addDataRowSource('dateExpire'); diff --git a/inc/SP/Controller/ItemActionController.class.php b/inc/SP/Controller/ItemActionController.class.php new file mode 100644 index 00000000..845aaf87 --- /dev/null +++ b/inc/SP/Controller/ItemActionController.class.php @@ -0,0 +1,639 @@ +. + */ + +namespace SP\Controller; + +use SP\Account\Account; +use SP\Account\AccountFavorites; +use SP\Account\AccountTags; +use SP\Core\ActionsInterface; +use SP\Core\Session; +use SP\DataModel\AccountData; +use SP\DataModel\CustomFieldData; +use SP\DataModel\PublicLinkData; +use SP\Forms\AccountForm; +use SP\Forms\ApiTokenForm; +use SP\Forms\CategoryForm; +use SP\Forms\CustomerForm; +use SP\Forms\CustomFieldDefForm; +use SP\Forms\GroupForm; +use SP\Forms\ProfileForm; +use SP\Forms\TagForm; +use SP\Forms\UserForm; +use SP\Http\JsonResponse; +use SP\Http\Request; +use SP\Mgmt\Categories\Category; +use SP\Mgmt\Customers\Customer; +use SP\Mgmt\CustomFields\CustomField; +use SP\Mgmt\CustomFields\CustomFieldDef; +use SP\Mgmt\CustomFields\CustomFieldsUtil; +use SP\Mgmt\Files\File; +use SP\Mgmt\Groups\Group; +use SP\Mgmt\Profiles\Profile; +use SP\Mgmt\PublicLinks\PublicLink; +use SP\Mgmt\Tags\Tag; +use SP\Mgmt\Tags\TagSearch; +use SP\Mgmt\Users\User; +use SP\Util\Json; + +/** + * Class AjaxSaveController + * + * @package SP\Controller + */ +class ItemActionController +{ + /** + * @var int + */ + protected $actionId; + /** + * @var int + */ + protected $itemId; + /** + * @var JsonResponse + */ + protected $jsonResponse; + /** + * @var CustomFieldData + */ + protected $CustomFieldData; + + /** + * AjaxSaveController constructor. + */ + public function __construct() + { + $this->jsonResponse = new JsonResponse(); + + $this->analyzeRequest(); + } + + /** + * Analizar la petición HTTP y establecer las propiedades del elemento + */ + protected function analyzeRequest() + { + $this->itemId = Request::analyze('itemId', 0); + $this->actionId = Request::analyze('actionId', 0); + } + + /** + * Ejecutar la acción solicitada + */ + public function doAction() + { + try { + if (!$this->itemId || !$this->actionId) { + $this->invalidAction(); + } + + switch ($this->actionId) { + case ActionsInterface::ACTION_USR_USERS_NEW: + case ActionsInterface::ACTION_USR_USERS_EDIT: + case ActionsInterface::ACTION_USR_USERS_EDITPASS: + case ActionsInterface::ACTION_USR_USERS_DELETE: + $this->userAction(); + break; + case ActionsInterface::ACTION_USR_GROUPS_NEW: + case ActionsInterface::ACTION_USR_GROUPS_EDIT: + case ActionsInterface::ACTION_USR_GROUPS_DELETE: + $this->groupAction(); + break; + case ActionsInterface::ACTION_USR_PROFILES_NEW: + case ActionsInterface::ACTION_USR_PROFILES_EDIT: + case ActionsInterface::ACTION_USR_PROFILES_DELETE: + $this->profileAction(); + break; + case ActionsInterface::ACTION_MGM_CUSTOMERS_NEW: + case ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT: + case ActionsInterface::ACTION_MGM_CUSTOMERS_DELETE: + $this->customerAction(); + break; + case ActionsInterface::ACTION_MGM_CATEGORIES_NEW: + case ActionsInterface::ACTION_MGM_CATEGORIES_EDIT: + case ActionsInterface::ACTION_MGM_CATEGORIES_DELETE: + $this->categoryAction(); + break; + case ActionsInterface::ACTION_MGM_APITOKENS_NEW: + case ActionsInterface::ACTION_MGM_APITOKENS_EDIT: + case ActionsInterface::ACTION_MGM_APITOKENS_DELETE: + $this->tokenAction(); + break; + case ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW: + case ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT: + case ActionsInterface::ACTION_MGM_CUSTOMFIELDS_DELETE: + $this->customFieldAction(); + break; + case ActionsInterface::ACTION_MGM_PUBLICLINKS_NEW: + case ActionsInterface::ACTION_MGM_PUBLICLINKS_DELETE: + case ActionsInterface::ACTION_MGM_PUBLICLINKS_REFRESH: + $this->publicLinkAction(); + break; + case ActionsInterface::ACTION_MGM_TAGS_NEW: + case ActionsInterface::ACTION_MGM_TAGS_EDIT: + case ActionsInterface::ACTION_MGM_TAGS_DELETE: + $this->tagAction(); + break; + case ActionsInterface::ACTION_MGM_FILES_DELETE: + $this->fileAction(); + break; + case ActionsInterface::ACTION_ACC_NEW: + case ActionsInterface::ACTION_ACC_COPY: + case ActionsInterface::ACTION_ACC_EDIT: + case ActionsInterface::ACTION_ACC_EDIT_PASS: + case ActionsInterface::ACTION_ACC_EDIT_RESTORE: + case ActionsInterface::ACTION_ACC_DELETE: + case ActionsInterface::ACTION_MGM_ACCOUNTS_DELETE: + $this->accountAction(); + break; + case ActionsInterface::ACTION_ACC_FAVORITES_ADD: + case ActionsInterface::ACTION_ACC_FAVORITES_DELETE: + $this->favoriteAction(); + break; + default: + $this->invalidAction(); + } + } catch (\Exception $e) { + $this->jsonResponse->setDescription($e->getMessage()); + } + + Json::returnJson($this->jsonResponse); + } + + /** + * Acciones sobre usuarios + * + * @throws \SP\Core\Exceptions\SPException + * @throws \SP\Core\Exceptions\ValidationException + */ + protected function userAction() + { + $Form = new UserForm($this->itemId); + $Form->validate($this->actionId); + + $this->setCustomFieldData(ActionsInterface::ACTION_USR_USERS); + + switch ($this->actionId) { + case ActionsInterface::ACTION_USR_USERS_NEW: + User::getItem($Form->getItemData())->add(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Usuario creado')); + break; + case ActionsInterface::ACTION_USR_USERS_EDIT: + User::getItem($Form->getItemData())->update(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Usuario actualizado')); + break; + case ActionsInterface::ACTION_USR_USERS_DELETE: + User::getItem()->delete($this->itemId); + $this->deleteCustomFieldData(); + + $this->jsonResponse->setDescription(_('Usuario eliminado')); + break; + case ActionsInterface::ACTION_USR_USERS_EDITPASS: + User::getItem($Form->getItemData())->updatePass(); + + $this->jsonResponse->setDescription(_('Clave actualizada')); + break; + } + + $this->jsonResponse->setStatus(0); + } + + /** + * Guardar los datos de los campos personalizados del módulo + * + * @param $moduleId + */ + protected function setCustomFieldData($moduleId) + { + $this->CustomFieldData = new CustomFieldData(); + $this->CustomFieldData->setId($this->itemId); + $this->CustomFieldData->setModule($moduleId); + } + + /** + * Guardar los datos de los campos personalizados del módulo + */ + protected function saveCustomFieldData() + { + $customFields = Request::analyze('customfield'); + + if (is_array($customFields)) { + CustomFieldsUtil::addItemCustomFields($customFields, $this->CustomFieldData); + } + } + + /** + * Eliminar los datos de los campos personalizados del módulo + */ + protected function deleteCustomFieldData() + { + CustomField::getItem($this->CustomFieldData)->delete($this->itemId); + } + + /** + * Acciones sobre grupos + * + * @throws \SP\Core\Exceptions\ValidationException + * @throws \SP\Core\Exceptions\SPException + */ + protected function groupAction() + { + $Form = new GroupForm($this->itemId); + $Form->validate($this->actionId); + + $this->setCustomFieldData(ActionsInterface::ACTION_USR_GROUPS); + + switch ($this->actionId) { + case ActionsInterface::ACTION_USR_GROUPS_NEW: + Group::getItem($Form->getItemData())->add(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Grupo creado')); + break; + case ActionsInterface::ACTION_USR_GROUPS_EDIT: + Group::getItem($Form->getItemData())->update(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Grupo actualizado')); + break; + case ActionsInterface::ACTION_USR_GROUPS_DELETE: + Group::getItem()->delete($this->itemId); + $this->deleteCustomFieldData(); + + $this->jsonResponse->setDescription(_('Grupo eliminado')); + break; + } + + $this->jsonResponse->setStatus(0); + } + + /** + * Acciones sobre perfiles + * + * @throws \SP\Core\Exceptions\ValidationException + * @throws \SP\Core\Exceptions\SPException + */ + protected function profileAction() + { + $Form = new ProfileForm($this->itemId); + $Form->validate($this->actionId); + + $this->setCustomFieldData(ActionsInterface::ACTION_USR_PROFILES); + + switch ($this->actionId) { + case ActionsInterface::ACTION_USR_PROFILES_NEW: + Profile::getItem($Form->getItemData())->add(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Perfil creado')); + break; + case ActionsInterface::ACTION_USR_PROFILES_EDIT: + Profile::getItem($Form->getItemData())->update(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Perfil actualizado')); + break; + case ActionsInterface::ACTION_USR_PROFILES_DELETE: + Profile::getItem()->delete($this->itemId); + $this->deleteCustomFieldData(); + + $this->jsonResponse->setDescription(_('Perfil eliminado')); + break; + } + + $this->jsonResponse->setStatus(0); + } + + /** + * Acciones sobre clientes + * + * @throws \SP\Core\Exceptions\ValidationException + * @throws \SP\Core\Exceptions\SPException + */ + protected function customerAction() + { + $Form = new CustomerForm($this->itemId); + $Form->validate($this->actionId); + + $this->setCustomFieldData(ActionsInterface::ACTION_MGM_CUSTOMERS); + + switch ($this->actionId) { + case ActionsInterface::ACTION_MGM_CUSTOMERS_NEW: + Customer::getItem($Form->getItemData())->add(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Cliente creado')); + break; + case ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT: + Customer::getItem($Form->getItemData())->update(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Cliente actualizado')); + break; + case ActionsInterface::ACTION_MGM_CUSTOMERS_DELETE: + Customer::getItem()->delete($this->itemId); + $this->deleteCustomFieldData(); + + $this->jsonResponse->setDescription(_('Cliente eliminado')); + break; + } + + $this->jsonResponse->setStatus(0); + } + + /** + * Acciones sobre categorías + * + * @throws \SP\Core\Exceptions\ValidationException + * @throws \SP\Core\Exceptions\SPException + */ + protected function categoryAction() + { + $Form = new CategoryForm($this->itemId); + $Form->validate($this->actionId); + + $this->setCustomFieldData(ActionsInterface::ACTION_MGM_CATEGORIES); + + switch ($this->actionId) { + case ActionsInterface::ACTION_MGM_CATEGORIES_NEW: + Category::getItem($Form->getItemData())->add(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Categoría creada')); + break; + case ActionsInterface::ACTION_MGM_CATEGORIES_EDIT: + Category::getItem($Form->getItemData())->update(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Categoría actualizada')); + break; + case ActionsInterface::ACTION_MGM_CATEGORIES_DELETE: + Category::getItem()->delete($this->itemId); + $this->deleteCustomFieldData(); + + $this->jsonResponse->setDescription(_('Categoría eliminada')); + break; + } + + $this->jsonResponse->setStatus(0); + } + + /** + * Acciones sobre tokens API + * + * @throws \SP\Core\Exceptions\ValidationException + * @throws \SP\Core\Exceptions\SPException + */ + protected function tokenAction() + { + $Form = new ApiTokenForm($this->itemId); + $Form->validate($this->actionId); + + switch ($this->actionId) { + case ActionsInterface::ACTION_MGM_APITOKENS_NEW: + $Form->getItemData()->addToken(); + + $this->jsonResponse->setDescription(_('Autorización creada')); + break; + case ActionsInterface::ACTION_MGM_APITOKENS_EDIT: + $Form->getItemData()->updateToken(); + + $this->jsonResponse->setDescription(_('Autorización actualizada')); + break; + case ActionsInterface::ACTION_MGM_APITOKENS_DELETE: + $Form->getItemData()->deleteToken(); + + $this->jsonResponse->setDescription(_('Autorización eliminada')); + break; + } + + $this->jsonResponse->setStatus(0); + } + + /** + * Acciones sobre campos personalizados + * + * @throws \SP\Core\Exceptions\ValidationException + * @throws \SP\Core\Exceptions\SPException + */ + protected function customFieldAction() + { + $Form = new CustomFieldDefForm($this->itemId); + $Form->validate($this->actionId); + + switch ($this->actionId) { + case ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW: + CustomFieldDef::getItem($Form->getItemData())->add(); + + $this->jsonResponse->setDescription(_('Campo creado')); + break; + case ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT: + CustomFieldDef::getItem($Form->getItemData())->update(); + + $this->jsonResponse->setDescription(_('Campo actualizado')); + break; + case ActionsInterface::ACTION_MGM_CUSTOMFIELDS_DELETE: + CustomFieldDef::getItem()->delete($this->itemId); + + $this->jsonResponse->setDescription(_('Campo eliminado')); + break; + } + + $this->jsonResponse->setStatus(0); + } + + /** + * Acciones sobre enlaces públicos + * + * @throws \SP\Core\Exceptions\ValidationException + * @throws \SP\Core\Exceptions\SPException + */ + protected function publicLinkAction() + { + $PublicLinkData = new PublicLinkData(); + $PublicLinkData->setItemId($this->itemId); + $PublicLinkData->setTypeId(PublicLink::TYPE_ACCOUNT); + $PublicLinkData->setNotify(Request::analyze('notify', false, false, true)); + + switch ($this->actionId) { + case ActionsInterface::ACTION_MGM_PUBLICLINKS_NEW: + PublicLink::getItem($PublicLinkData)->add(); + + $this->jsonResponse->setDescription(_('Enlace creado')); + break; + case ActionsInterface::ACTION_MGM_PUBLICLINKS_REFRESH: + PublicLink::getItem($PublicLinkData)->update(); + + $this->jsonResponse->setDescription(_('Enlace actualizado')); + break; + case ActionsInterface::ACTION_MGM_PUBLICLINKS_DELETE: + PublicLink::getItem()->delete($PublicLinkData->getId()); + + $this->jsonResponse->setDescription(_('Enlace eliminado')); + break; + } + + $this->jsonResponse->setStatus(0); + } + + /** + * Acciones sobre etiquetas + * + * @throws \SP\Core\Exceptions\ValidationException + * @throws \SP\Core\Exceptions\SPException + */ + protected function tagAction() + { + $Form = new TagForm($this->itemId); + $Form->validate($this->actionId); + + switch ($this->actionId) { + case ActionsInterface::ACTION_MGM_TAGS_NEW: + Tag::getItem($Form->getItemData())->add(); + + $this->jsonResponse->setDescription(_('Etiqueta creada')); + break; + case ActionsInterface::ACTION_MGM_TAGS_EDIT: + Tag::getItem($Form->getItemData())->update(); + + $this->jsonResponse->setDescription(_('Etiqueta actualizada')); + break; + case ActionsInterface::ACTION_MGM_TAGS_DELETE: + Tag::getItem()->delete($this->itemId); + + $this->jsonResponse->setDescription(_('Etiqueta eliminada')); + break; + } + + $this->jsonResponse->setStatus(0); + } + + /** + * Acciones sobre archivos + * + * @throws \SP\Core\Exceptions\ValidationException + * @throws \SP\Core\Exceptions\SPException + */ + protected function fileAction() + { + File::getItem()->delete($this->itemId); + $this->jsonResponse->setDescription(_('Archivo actualizado')); + + $this->jsonResponse->setStatus(0); + } + + /** + * Acciones sobre cuentas + * + * @throws \SP\Core\Exceptions\ValidationException + * @throws \SP\Core\Exceptions\SPException + */ + protected function accountAction() + { + $Form = new AccountForm($this->itemId); + $Form->validate($this->actionId); + + $this->setCustomFieldData(ActionsInterface::ACTION_ACC); + + $Account = new Account($Form->getItemData()); + + switch ($this->actionId) { + case ActionsInterface::ACTION_ACC_NEW: + case ActionsInterface::ACTION_ACC_COPY: + $Form->getItemData()->setAccountUserId(Session::getUserId()); + + $Account->createAccount(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Cuenta creada')); + break; + case ActionsInterface::ACTION_ACC_EDIT: + $Account->updateAccount(); + $this->saveCustomFieldData(); + + $this->jsonResponse->setDescription(_('Cuenta actualizada')); + break; + case ActionsInterface::ACTION_ACC_EDIT_PASS: + $Account->updateAccountPass(); + + $this->jsonResponse->setDescription(_('Clave actualizada')); + break; + case ActionsInterface::ACTION_ACC_EDIT_RESTORE: + $Account->restoreFromHistory($this->itemId); + + $this->jsonResponse->setDescription(_('Cuenta restaurada')); + break; + case ActionsInterface::ACTION_ACC_DELETE: + $Account->deleteAccount(); + $this->deleteCustomFieldData(); + + $this->jsonResponse->setDescription(_('Cuenta eliminada')); + break; + } + + $this->jsonResponse->setStatus(0); + } + + /** + * Acciones sobre cuentas favoritas + * + * @throws \SP\Core\Exceptions\ValidationException + * @throws \SP\Core\Exceptions\SPException + */ + private function favoriteAction() + { + $accountId = Request::analyze('accountId', 0); + $userId = Session::getUserId(); + + if ($accountId === 0) { + $this->invalidAction(); + } + + switch ($this->actionId) { + case ActionsInterface::ACTION_ACC_FAVORITES_ADD: + AccountFavorites::addFavorite($accountId, $userId); + + $this->jsonResponse->setDescription(_('Favorito añadido')); + break; + case ActionsInterface::ACTION_ACC_FAVORITES_DELETE: + AccountFavorites::deleteFavorite($accountId, $userId); + + $this->jsonResponse->setDescription(_('Favorito eliminado')); + break; + } + + $this->jsonResponse->setStatus(0); + } + + protected function invalidAction() + { + $this->jsonResponse->setDescription(_('Acción Inválida')); + } +} \ No newline at end of file diff --git a/inc/SP/Controller/MainController.class.php b/inc/SP/Controller/MainController.class.php index a9a46b11..a95dccee 100644 --- a/inc/SP/Controller/MainController.class.php +++ b/inc/SP/Controller/MainController.class.php @@ -411,6 +411,7 @@ class MainController extends ControllerBase implements ActionsInterface * Obtener la vista para mostrar un enlace publicado * * @return bool + * @throws \SP\Core\Exceptions\SPException */ public function getPublicLink() { @@ -421,14 +422,14 @@ class MainController extends ControllerBase implements ActionsInterface $this->view->assign('showLogo', true); if (!$PublicLink - || time() > $PublicLink->getItemData()->getDateExpire() - || $PublicLink->getItemData()->getCountViews() >= $PublicLink->getItemData()->getMaxCountViews() + || time() > $PublicLink->getDateExpire() + || $PublicLink->getCountViews() >= $PublicLink->getMaxCountViews() ) { $this->showError(self::ERR_PAGE_NO_PERMISSION, false); } else { - $PublicLink->addLinkView(); + PublicLink::getItem($PublicLink)->addLinkView(); - $controller = new AccountController($this->view, null, $PublicLink->getItemData()->getItemId()); + $controller = new AccountController($this->view, null, $PublicLink->getItemId()); $controller->getAccountFromLink($PublicLink); } diff --git a/inc/SP/Forms/AccountForm.class.php b/inc/SP/Forms/AccountForm.class.php index 0a6355dc..2405e233 100644 --- a/inc/SP/Forms/AccountForm.class.php +++ b/inc/SP/Forms/AccountForm.class.php @@ -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. @@ -26,7 +26,9 @@ namespace SP\Forms; use SP\Core\ActionsInterface; use SP\Core\Exceptions\ValidationException; +use SP\Core\Session; use SP\DataModel\AccountData; +use SP\DataModel\AccountExtData; use SP\Http\Request; /** @@ -34,69 +36,120 @@ use SP\Http\Request; * * @package SP\Account */ -class AccountForm +class AccountForm extends FormBase implements FormInterface { /** * @var AccountData */ protected $AccountData; - /** - * AccountForm constructor. - * - * @param $AccountData - */ - public function __construct($AccountData) - { - $this->AccountData = $AccountData; - } - /** * Validar el formulario * * @param $action + * @return bool * @throws \SP\Core\Exceptions\ValidationException */ public function validate($action) { switch ($action) { case ActionsInterface::ACTION_ACC_EDIT_PASS: - if (!$this->AccountData->getAccountPass()) { - throw new ValidationException(_('Es necesaria una clave')); - } elseif (Request::analyzeEncrypted('passR') !== $this->AccountData->getAccountPass()){ - throw new ValidationException(_('Las claves no coinciden')); - } + $this->checkPass(); break; case ActionsInterface::ACTION_ACC_EDIT: - if (!$this->AccountData->getAccountName()) { - throw new ValidationException(_('Es necesario un nombre de cuenta')); - } elseif (!$this->AccountData->getAccountCustomerId()) { - throw new ValidationException(_('Es necesario un nombre de cliente')); - } elseif (!$this->AccountData->getAccountLogin()) { - throw new ValidationException(_('Es necesario un usuario')); - } elseif (!$this->AccountData->getAccountCategoryId()) { - throw new ValidationException(_('Es necesario una categoría')); - } + $this->checkCommon(); break; case ActionsInterface::ACTION_ACC_NEW: - if (!$this->AccountData->getAccountName()) { - throw new ValidationException(_('Es necesario un nombre de cuenta')); - } elseif (!$this->AccountData->getAccountCustomerId()) { - throw new ValidationException(_('Es necesario un nombre de cliente')); - } elseif (!$this->AccountData->getAccountLogin()) { - throw new ValidationException(_('Es necesario un usuario')); - } elseif (!$this->AccountData->getAccountPass()) { - throw new ValidationException(_('Es necesaria una clave')); - } elseif (Request::analyzeEncrypted('passR') !== $this->AccountData->getAccountPass()){ - throw new ValidationException(_('Las claves no coinciden')); - }elseif (!$this->AccountData->getAccountCategoryId()) { - throw new ValidationException(_('Es necesario una categoría')); - } + $this->checkCommon(); + $this->checkPass(); break; - default: - if (!$this->AccountData->getAccountId()) { - throw new ValidationException(_('Id inválido')); - } + } + + return true; + } + + /** + * @throws ValidationException + */ + protected function checkPass() + { + if (!$this->AccountData->getAccountPass()) { + throw new ValidationException(_('Es necesaria una clave')); + } elseif (Request::analyzeEncrypted('passR') !== $this->AccountData->getAccountPass()) { + throw new ValidationException(_('Las claves no coinciden')); + } + } + + /** + * @throws ValidationException + */ + protected function checkCommon() + { + if (!$this->AccountData->getAccountName()) { + throw new ValidationException(_('Es necesario un nombre de cuenta')); + } elseif (!$this->AccountData->getAccountCustomerId()) { + throw new ValidationException(_('Es necesario un nombre de cliente')); + } elseif (!$this->AccountData->getAccountLogin()) { + throw new ValidationException(_('Es necesario un usuario')); + } elseif (!$this->AccountData->getAccountCategoryId()) { + throw new ValidationException(_('Es necesario una categoría')); + } + } + + /** + * @return mixed + */ + public function getItemData() + { + return $this->AccountData; + } + + /** + * Analizar los datos de la petición HTTP + * + * @return void + */ + protected function analyzeRequestData() + { + $this->AccountData = new AccountExtData(); + $this->AccountData->setAccountId($this->itemId); + $this->AccountData->setAccountName(Request::analyze('name')); + $this->AccountData->setAccountCustomerId(Request::analyze('customerId', 0)); + $this->AccountData->setAccountCategoryId(Request::analyze('categoryId', 0)); + $this->AccountData->setAccountLogin(Request::analyze('login')); + $this->AccountData->setAccountUrl(Request::analyze('url')); + $this->AccountData->setAccountNotes(Request::analyze('notes')); + $this->AccountData->setAccountUserEditId(Session::getUserId()); + $this->AccountData->setAccountOtherUserEdit(Request::analyze('userEditEnabled', 0, false, 1)); + $this->AccountData->setAccountOtherGroupEdit(Request::analyze('groupEditEnabled', 0, false, 1)); + $this->AccountData->setAccountPass(Request::analyzeEncrypted('pass')); + $this->AccountData->setAccountIsPrivate(Request::analyze('privateEnabled', 0, false, 1)); + $this->AccountData->setAccountPassDateChange(Request::analyze('passworddatechange_unix', 0)); + + // Arrays + $accountOtherGroups = Request::analyze('otherGroups', 0); + $accountOtherUsers = Request::analyze('otherUsers', 0); + $accountTags = Request::analyze('tags'); + + if (is_array($accountOtherUsers)) { + $this->AccountData->setUsersId($accountOtherUsers); + } + + if (is_array($accountOtherGroups)) { + $this->AccountData->setUserGroupsId($accountOtherGroups); + } + + if (is_array($accountTags)) { + $this->AccountData->setTags($accountTags); + } + + $accountMainGroupId = Request::analyze('mainGroupId', 0); + + // Cambiar el grupo principal si el usuario es Admin + if ($accountMainGroupId !== 0 + && (Session::getUserIsAdminApp() || Session::getUserIsAdminAcc()) + ) { + $this->AccountData->setAccountUserGroupId($accountMainGroupId); } } } \ No newline at end of file diff --git a/inc/SP/Forms/ApiTokenForm.class.php b/inc/SP/Forms/ApiTokenForm.class.php new file mode 100644 index 00000000..34b29906 --- /dev/null +++ b/inc/SP/Forms/ApiTokenForm.class.php @@ -0,0 +1,96 @@ +. + */ + +namespace SP\Forms; + +use SP\Api\ApiTokens; +use SP\Core\ActionsInterface; +use SP\Core\Exceptions\ValidationException; +use SP\Http\Request; + +/** + * Class ApiTokenForm + * + * @package SP\Forms + */ +class ApiTokenForm extends FormBase implements FormInterface +{ + /** + * @var ApiTokens + */ + protected $ApiTokens; + + /** + * Validar el formulario + * + * @param $action + * @return bool + * @throws \SP\Core\Exceptions\ValidationException + */ + public function validate($action) + { + switch ($action) { + case ActionsInterface::ACTION_MGM_APITOKENS_NEW: + case ActionsInterface::ACTION_MGM_APITOKENS_EDIT: + $this->checkCommon(); + break; + } + + return true; + } + + /** + * @throws ValidationException + */ + protected function checkCommon() + { + if ($this->ApiTokens->getUserId() === 0) { + throw new ValidationException(_('Usuario no indicado')); + } elseif ($this->ApiTokens->getActionId() === 0) { + throw new ValidationException(_('Acción no indicada')); + } + } + + /** + * @return mixed + */ + public function getItemData() + { + return $this->ApiTokens; + } + + /** + * Analizar los datos de la petición HTTP + * + * @return void + */ + protected function analyzeRequestData() + { + $this->ApiTokens = new ApiTokens(); + $this->ApiTokens->setTokenId($this->itemId); + $this->ApiTokens->setUserId(Request::analyze('users', 0)); + $this->ApiTokens->setActionId(Request::analyze('actions', 0)); + $this->ApiTokens->setRefreshToken(Request::analyze('refreshtoken', false, false, true)); + } +} \ No newline at end of file diff --git a/inc/SP/Forms/CategoryForm.class.php b/inc/SP/Forms/CategoryForm.class.php new file mode 100644 index 00000000..9b77bf9f --- /dev/null +++ b/inc/SP/Forms/CategoryForm.class.php @@ -0,0 +1,93 @@ +. + */ + +namespace SP\Forms; + +use SP\Core\ActionsInterface; +use SP\Core\Exceptions\ValidationException; +use SP\DataModel\CategoryData; +use SP\Http\Request; + +/** + * Class CategoryForm + * + * @package SP\Forms + */ +class CategoryForm extends FormBase implements FormInterface +{ + /** + * @var CategoryData + */ + protected $CategoryData; + + /** + * Validar el formulario + * + * @param $action + * @return bool + * @throws \SP\Core\Exceptions\ValidationException + */ + public function validate($action) + { + switch ($action) { + case ActionsInterface::ACTION_MGM_CATEGORIES_NEW: + case ActionsInterface::ACTION_MGM_CATEGORIES_EDIT: + $this->checkCommon(); + break; + } + + return true; + } + + /** + * @throws ValidationException + */ + protected function checkCommon() + { + if (!$this->CategoryData->getCategoryName()) { + throw new ValidationException(_('Es necesario un nombre de categoría')); + } + } + + /** + * @return mixed + */ + public function getItemData() + { + return $this->CategoryData; + } + + /** + * Analizar los datos de la petición HTTP + * + * @return void + */ + protected function analyzeRequestData() + { + $this->CategoryData = new CategoryData(); + $this->CategoryData->setCategoryId($this->itemId); + $this->CategoryData->setCategoryName(Request::analyze('name')); + $this->CategoryData->setCategoryDescription(Request::analyze('description')); + } +} \ No newline at end of file diff --git a/inc/SP/Forms/CustomFieldDefForm.class.php b/inc/SP/Forms/CustomFieldDefForm.class.php new file mode 100644 index 00000000..93681edb --- /dev/null +++ b/inc/SP/Forms/CustomFieldDefForm.class.php @@ -0,0 +1,100 @@ +. + */ + +namespace SP\Forms; + +use SP\Core\ActionsInterface; +use SP\Core\Exceptions\ValidationException; +use SP\DataModel\CustomFieldDefData; +use SP\Http\Request; + +/** + * Class CustomFieldDefForm + * + * @package SP\Forms + */ +class CustomFieldDefForm extends FormBase implements FormInterface +{ + /** + * @var CustomFieldDefData + */ + protected $CustomFieldDefData; + + /** + * Validar el formulario + * + * @param $action + * @return bool + * @throws \SP\Core\Exceptions\ValidationException + */ + public function validate($action) + { + switch ($action) { + case ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW: + case ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT: + $this->checkCommon(); + break; + } + + return true; + } + + /** + * @throws ValidationException + */ + protected function checkCommon() + { + if (!$this->CustomFieldDefData->getName()) { + throw new ValidationException(_('Nombre del campo no indicado')); + } elseif ($this->CustomFieldDefData->getType() === 0) { + throw new ValidationException(_('Tipo del campo no indicado')); + } elseif ($this->CustomFieldDefData->getModule() === 0) { + throw new ValidationException(_('Módulo del campo no indicado')); + } + } + + /** + * Analizar los datos de la petición HTTP + * + * @return void + */ + protected function analyzeRequestData() + { + $this->CustomFieldDefData = new CustomFieldDefData(); + $this->CustomFieldDefData->setId($this->itemId); + $this->CustomFieldDefData->setName(Request::analyze('name')); + $this->CustomFieldDefData->setType(Request::analyze('type', 0)); + $this->CustomFieldDefData->setModule(Request::analyze('module', 0)); + $this->CustomFieldDefData->setHelp(Request::analyze('help')); + $this->CustomFieldDefData->setRequired(Request::analyze('required', false, false, true)); + } + + /** + * @return mixed + */ + public function getItemData() + { + return $this->CustomFieldDefData; + } +} \ No newline at end of file diff --git a/inc/SP/Forms/CustomerForm.class.php b/inc/SP/Forms/CustomerForm.class.php new file mode 100644 index 00000000..a9dbb207 --- /dev/null +++ b/inc/SP/Forms/CustomerForm.class.php @@ -0,0 +1,93 @@ +. + */ + +namespace SP\Forms; + +use SP\Core\ActionsInterface; +use SP\Core\Exceptions\ValidationException; +use SP\DataModel\CustomerData; +use SP\Http\Request; + +/** + * Class CustomerForm + * + * @package SP\Forms + */ +class CustomerForm extends FormBase implements FormInterface +{ + /** + * @var CustomerData + */ + protected $CustomerData; + + /** + * Validar el formulario + * + * @param $action + * @return bool + * @throws \SP\Core\Exceptions\ValidationException + */ + public function validate($action) + { + switch ($action) { + case ActionsInterface::ACTION_MGM_CUSTOMERS_NEW: + case ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT: + $this->checkCommon(); + break; + } + + return true; + } + + /** + * @throws ValidationException + */ + protected function checkCommon() + { + if (!$this->CustomerData->getCustomerName()) { + throw new ValidationException(_('Es necesario un nombre de cliente')); + } + } + + /** + * @return mixed + */ + public function getItemData() + { + return $this->CustomerData; + } + + /** + * Analizar los datos de la petición HTTP + * + * @return void + */ + protected function analyzeRequestData() + { + $this->CustomerData = new CustomerData(); + $this->CustomerData->setCustomerId($this->itemId); + $this->CustomerData->setCustomerName(Request::analyze('name')); + $this->CustomerData->setCustomerDescription(Request::analyze('description')); + } +} \ No newline at end of file diff --git a/inc/SP/Forms/FormBase.class.php b/inc/SP/Forms/FormBase.class.php new file mode 100644 index 00000000..6e774fe7 --- /dev/null +++ b/inc/SP/Forms/FormBase.class.php @@ -0,0 +1,57 @@ +. + */ + +namespace SP\Forms; + +/** + * Class FormBase + * + * @package SP\Forms + */ +abstract class FormBase +{ + /** + * @var int + */ + protected $itemId; + + /** + * FormBase constructor. + * + * @param $itemId + */ + public function __construct($itemId) + { + $this->itemId = $itemId; + + $this->analyzeRequestData(); + } + + /** + * Analizar los datos de la petición HTTP + * + * @return void + */ + protected abstract function analyzeRequestData(); +} \ No newline at end of file diff --git a/inc/SP/Forms/FormInterface.class.php b/inc/SP/Forms/FormInterface.class.php new file mode 100644 index 00000000..28a535e6 --- /dev/null +++ b/inc/SP/Forms/FormInterface.class.php @@ -0,0 +1,47 @@ +. + */ + +namespace SP\Forms; + +/** + * Interface FormInterface + * + * @package SP\Forms + */ +interface FormInterface +{ + /** + * Validar el formulario + * + * @param $action + * @return bool + * @throws \SP\Core\Exceptions\ValidationException + */ + public function validate($action); + + /** + * @return mixed + */ + public function getItemData(); +} \ No newline at end of file diff --git a/inc/SP/Forms/GroupForm.class.php b/inc/SP/Forms/GroupForm.class.php new file mode 100644 index 00000000..a8aec357 --- /dev/null +++ b/inc/SP/Forms/GroupForm.class.php @@ -0,0 +1,94 @@ +. + */ + +namespace SP\Forms; + +use SP\Core\ActionsInterface; +use SP\Core\Exceptions\ValidationException; +use SP\DataModel\GroupData; +use SP\Http\Request; + +/** + * Class GroupForm + * + * @package SP\Forms + */ +class GroupForm extends FormBase implements FormInterface +{ + /** + * @var GroupData + */ + protected $GroupData; + + /** + * Validar el formulario + * + * @param $action + * @return bool + * @throws \SP\Core\Exceptions\ValidationException + */ + public function validate($action) + { + switch ($action) { + case ActionsInterface::ACTION_USR_GROUPS_NEW: + case ActionsInterface::ACTION_USR_GROUPS_EDIT: + $this->checkCommon(); + break; + } + + return true; + } + + /** + * @throws ValidationException + */ + protected function checkCommon() + { + if (!$this->GroupData->getUsergroupName()) { + throw new ValidationException(_('Es necesario un nombre de grupo')); + } + } + + /** + * @return mixed + */ + public function getItemData() + { + return $this->GroupData; + } + + /** + * Analizar los datos de la petición HTTP + * + * @return void + */ + protected function analyzeRequestData() + { + $this->GroupData = new GroupData(); + $this->GroupData->setUsergroupId($this->itemId); + $this->GroupData->setUsergroupName(Request::analyze('name')); + $this->GroupData->setUsergroupDescription(Request::analyze('description')); + $this->GroupData->setUsers(Request::analyze('users', 0)); + } +} \ No newline at end of file diff --git a/inc/SP/Forms/ProfileForm.class.php b/inc/SP/Forms/ProfileForm.class.php new file mode 100644 index 00000000..814ba9cc --- /dev/null +++ b/inc/SP/Forms/ProfileForm.class.php @@ -0,0 +1,116 @@ +. + */ + +namespace SP\Forms; + +use SP\Core\ActionsInterface; +use SP\Core\Exceptions\ValidationException; +use SP\DataModel\ProfileData; +use SP\Http\Request; + +/** + * Class ProfileForm + * + * @package SP\Forms + */ +class ProfileForm extends FormBase implements FormInterface +{ + /** + * @var ProfileData + */ + protected $ProfileData; + + /** + * Validar el formulario + * + * @param $action + * @return bool + * @throws \SP\Core\Exceptions\ValidationException + */ + public function validate($action) + { + switch ($action) { + case ActionsInterface::ACTION_USR_PROFILES_NEW: + case ActionsInterface::ACTION_USR_PROFILES_EDIT: + $this->checkCommon(); + break; + } + + return true; + } + + /** + * @throws ValidationException + */ + protected function checkCommon() + { + if (!$this->ProfileData->getUserprofileName()) { + throw new ValidationException(_('Es necesario un nombre de perfil')); + } + } + + /** + * @return mixed + */ + public function getItemData() + { + return $this->ProfileData; + } + + /** + * Analizar los datos de la petición HTTP + * + * @return void + */ + protected function analyzeRequestData() + { + $this->ProfileData = new ProfileData(); + $this->ProfileData->setUserprofileName(Request::analyze('profile_name')); + $this->ProfileData->setUserprofileId(Request::analyze('itemId', 0)); + $this->ProfileData->setAccAdd(Request::analyze('profile_accadd', 0, false, 1)); + $this->ProfileData->setAccView(Request::analyze('profile_accview', 0, false, 1)); + $this->ProfileData->setAccViewPass(Request::analyze('profile_accviewpass', 0, false, 1)); + $this->ProfileData->setAccViewHistory(Request::analyze('profile_accviewhistory', 0, false, 1)); + $this->ProfileData->setAccEdit(Request::analyze('profile_accedit', 0, false, 1)); + $this->ProfileData->setAccEditPass(Request::analyze('profile_acceditpass', 0, false, 1)); + $this->ProfileData->setAccDelete(Request::analyze('profile_accdel', 0, false, 1)); + $this->ProfileData->setAccFiles(Request::analyze('profile_accfiles', 0, false, 1)); + $this->ProfileData->setAccPublicLinks(Request::analyze('profile_accpublinks', 0, false, 1)); + $this->ProfileData->setAccPrivate(Request::analyze('profile_accprivate', 0, false, 1)); + $this->ProfileData->setAccPermission(Request::analyze('profile_accpermissions', 0, false, 1)); + $this->ProfileData->setConfigGeneral(Request::analyze('profile_config', 0, false, 1)); + $this->ProfileData->setConfigEncryption(Request::analyze('profile_configmpw', 0, false, 1)); + $this->ProfileData->setConfigBackup(Request::analyze('profile_configback', 0, false, 1)); + $this->ProfileData->setConfigImport(Request::analyze('profile_configimport', 0, false, 1)); + $this->ProfileData->setMgmCategories(Request::analyze('profile_categories', 0, false, 1)); + $this->ProfileData->setMgmCustomers(Request::analyze('profile_customers', 0, false, 1)); + $this->ProfileData->setMgmCustomFields(Request::analyze('profile_customfields', 0, false, 1)); + $this->ProfileData->setMgmUsers(Request::analyze('profile_users', 0, false, 1)); + $this->ProfileData->setMgmGroups(Request::analyze('profile_groups', 0, false, 1)); + $this->ProfileData->setMgmProfiles(Request::analyze('profile_profiles', 0, false, 1)); + $this->ProfileData->setMgmApiTokens(Request::analyze('profile_apitokens', 0, false, 1)); + $this->ProfileData->setMgmPublicLinks(Request::analyze('profile_publinks', 0, false, 1)); + $this->ProfileData->setEvl(Request::analyze('profile_eventlog', 0, false, 1)); + } +} \ No newline at end of file diff --git a/inc/SP/Forms/PublicLinkForm.class.php b/inc/SP/Forms/PublicLinkForm.class.php new file mode 100644 index 00000000..59063838 --- /dev/null +++ b/inc/SP/Forms/PublicLinkForm.class.php @@ -0,0 +1,62 @@ +. + */ + +namespace SP\Forms; + +use SP\DataModel\PublicLinkData; + +/** + * Class PublicLinkForm + * + * @package SP\Forms + */ +class PublicLinkForm implements FormInterface +{ + /** + * @var PublicLinkData + */ + protected $PublicLinkData; + + /** + * CustomerForm constructor. + * + * @param PublicLinkData $PublicLinkData + */ + public function __construct(PublicLinkData $PublicLinkData) + { + $this->PublicLinkData = $PublicLinkData; + } + + /** + * Validar el formulario + * + * @param $action + * @return bool + * @throws \SP\Core\Exceptions\ValidationException + */ + public function validate($action) + { + return true; + } +} \ No newline at end of file diff --git a/inc/SP/Forms/TagForm.class.php b/inc/SP/Forms/TagForm.class.php new file mode 100644 index 00000000..c69351e9 --- /dev/null +++ b/inc/SP/Forms/TagForm.class.php @@ -0,0 +1,92 @@ +. + */ + +namespace SP\Forms; + +use SP\Core\ActionsInterface; +use SP\Core\Exceptions\ValidationException; +use SP\DataModel\TagData; +use SP\Http\Request; + +/** + * Class TagForm + * + * @package SP\Forms + */ +class TagForm extends FormBase implements FormInterface +{ + /** + * @var TagData + */ + protected $TagData; + + /** + * Validar el formulario + * + * @param $action + * @return bool + * @throws \SP\Core\Exceptions\ValidationException + */ + public function validate($action) + { + switch ($action) { + case ActionsInterface::ACTION_MGM_TAGS_NEW: + case ActionsInterface::ACTION_MGM_TAGS_EDIT: + $this->checkCommon(); + break; + } + + return true; + } + + /** + * @throws ValidationException + */ + protected function checkCommon() + { + if (!$this->TagData->getTagName()) { + throw new ValidationException(_('Es necesario un nombre de etiqueta')); + } + } + + /** + * Analizar los datos de la petición HTTP + * + * @return void + */ + protected function analyzeRequestData() + { + $this->TagData = new TagData(); + $this->TagData->setTagId($this->itemId); + $this->TagData->setTagName(Request::analyze('name')); + } + + /** + * @return mixed + */ + public function getItemData() + { + return $this->TagData; + } +} \ No newline at end of file diff --git a/inc/SP/Forms/UserForm.class.php b/inc/SP/Forms/UserForm.class.php new file mode 100644 index 00000000..07b2ff65 --- /dev/null +++ b/inc/SP/Forms/UserForm.class.php @@ -0,0 +1,154 @@ +. + */ + +namespace SP\Forms; + +use SP\Core\ActionsInterface; +use SP\Core\Exceptions\ValidationException; +use SP\Core\Session; +use SP\DataModel\UserData; +use SP\Http\Request; +use SP\Mgmt\Users\UserUtil; +use SP\Util\Checks; + +/** + * Class UserForm + * + * @package SP\Forms + */ +class UserForm extends FormBase implements FormInterface +{ + /** + * @var UserData + */ + protected $UserData; + + /** + * Validar el formulario + * + * @param $action + * @return bool + * @throws \SP\Core\Exceptions\ValidationException + */ + public function validate($action) + { + switch ($action) { + case ActionsInterface::ACTION_USR_USERS_NEW: + $this->checkCommon(); + $this->checkPass(); + break; + case ActionsInterface::ACTION_USR_USERS_EDIT: + $this->checkCommon(); + break; + case ActionsInterface::ACTION_USR_USERS_EDITPASS: + $this->checkPass(); + break; + case ActionsInterface::ACTION_USR_USERS_DELETE: + $this->checkDelete(); + break; + } + + return true; + } + + /** + * @throws ValidationException + */ + protected function checkCommon() + { + $isLdap = Request::analyze('isLdap', 0); + + if (!$isLdap && !$this->UserData->getUserName()) { + throw new ValidationException(_('Es necesario un nombre de usuario')); + } elseif (!$isLdap && !$this->UserData->getUserLogin()) { + throw new ValidationException(_('Es necesario un login')); + } elseif (!$this->UserData->getUserProfileId()) { + throw new ValidationException(_('Es necesario un perfil')); + } elseif (!$this->UserData->getUserGroupId()) { + throw new ValidationException(_('Es necesario un grupo')); + } elseif (!$isLdap && !$this->UserData->getUserEmail()) { + throw new ValidationException(_('Es necesario un email')); + } elseif (Checks::demoIsEnabled() && !Session::getUserIsAdminApp() && $this->UserData->getUserLogin() === 'demo') { + throw new ValidationException(_('Ey, esto es una DEMO!!')); + } + } + + /** + * @throws ValidationException + */ + protected function checkPass() + { + $userPassR = Request::analyzeEncrypted('passR'); + + if (Checks::demoIsEnabled() && UserUtil::getUserLoginById($this->UserData->getUserId()) === 'demo') { + throw new ValidationException(_('Ey, esto es una DEMO!!')); + } elseif (!$userPassR || !$this->UserData->getUserPass()) { + throw new ValidationException(_('La clave no puede estar en blanco')); + } elseif ($this->UserData->getUserPass() !== $userPassR) { + throw new ValidationException(_('Las claves no coinciden')); + } + } + + /** + * @throws ValidationException + */ + protected function checkDelete() + { + if (Checks::demoIsEnabled() && UserUtil::getUserLoginById($this->UserData->getUserId()) === 'demo') { + throw new ValidationException(_('Ey, esto es una DEMO!!')); + } elseif ($this->UserData->getUserId() === Session::getUserId()) { + throw new ValidationException(_('No es posible eliminar, usuario en uso')); + } + } + + /** + * Analizar los datos de la petición HTTP + * + * @return void + */ + protected function analyzeRequestData() + { + $this->UserData = new UserData(); + $this->UserData->setUserId($this->itemId); + $this->UserData->setUserName(Request::analyze('name')); + $this->UserData->setUserLogin(Request::analyze('login')); + $this->UserData->setUserEmail(Request::analyze('email')); + $this->UserData->setUserNotes(Request::analyze('notes')); + $this->UserData->setUserGroupId(Request::analyze('groupid', 0)); + $this->UserData->setUserProfileId(Request::analyze('profileid', 0)); + $this->UserData->setUserIsAdminApp(Request::analyze('adminapp', 0, false, 1)); + $this->UserData->setUserIsAdminAcc(Request::analyze('adminacc', 0, false, 1)); + $this->UserData->setUserIsDisabled(Request::analyze('disabled', 0, false, 1)); + $this->UserData->setUserIsChangePass(Request::analyze('changepass', 0, false, 1)); + $this->UserData->setUserPass(Request::analyzeEncrypted('pass')); + } + + /** + * @return UserData + */ + public function getItemData() + { + return $this->UserData; + } +} \ No newline at end of file diff --git a/inc/SP/Import/CsvImportBase.class.php b/inc/SP/Import/CsvImportBase.class.php index ed3c36b4..9cc8b9d7 100644 --- a/inc/SP/Import/CsvImportBase.class.php +++ b/inc/SP/Import/CsvImportBase.class.php @@ -28,7 +28,7 @@ namespace SP\Import; use SP\DataModel\AccountData; use SP\Core\Crypt; use SP\DataModel\CategoryData; -use SP\DataModel\CustomerData; +use SP\DataModel\CategoryData; use SP\Mgmt\Customers\Customer; use SP\Log\Log; use SP\Mgmt\Categories\Category; @@ -131,7 +131,7 @@ abstract class CsvImportBase extends ImportBase list($accountName, $customerName, $categoryName, $url, $login, $password, $notes) = $fields; // Obtener los ids de cliente, categoría y la clave encriptada - $customerId = Customer::getItem(new CustomerData(null, $customerName))->add()->getItemData()->getCustomerId(); + $customerId = Customer::getItem(new CategoryData(null, $customerName))->add()->getItemData()->getCustomerId(); $categoryId = Category::getItem(new CategoryData(null, $categoryName))->add(); $pass = Crypt::encryptData($password); diff --git a/inc/SP/Import/ImportBase.class.php b/inc/SP/Import/ImportBase.class.php index 5a4100c4..6d4b9be3 100644 --- a/inc/SP/Import/ImportBase.class.php +++ b/inc/SP/Import/ImportBase.class.php @@ -28,7 +28,7 @@ namespace SP\Import; use SP\Account\Account; use SP\DataModel\AccountData; use SP\DataModel\CategoryData; -use SP\DataModel\CustomerData; +use SP\DataModel\CategoryData; use SP\Mgmt\Customers\Customer; use SP\Mgmt\Categories\Category; use SP\Core\Session; @@ -247,7 +247,7 @@ abstract class ImportBase protected function addCustomer() { // FIXME: CustomerData en propiedad de la clase - return Customer::getItem(new CustomerData(null, $this->getCustomerName(), $this->getCustomerDescription()))->add()->getItemData()->getCustomerId(); + return Customer::getItem(new CategoryData(null, $this->getCustomerName(), $this->getCustomerDescription()))->add()->getItemData()->getCustomerId(); } /** diff --git a/inc/SP/Import/Migrate.class.php b/inc/SP/Import/Migrate.class.php index 1cf89d93..eecfbd57 100644 --- a/inc/SP/Import/Migrate.class.php +++ b/inc/SP/Import/Migrate.class.php @@ -26,7 +26,7 @@ namespace SP\Import; use SP\Config\Config; -use SP\DataModel\CustomerData; +use SP\DataModel\CategoryData; use SP\Mgmt\Customers\Customer; use SP\Log\Log; use SP\Core\Session; @@ -280,7 +280,7 @@ class Migrate foreach ($customers as $customer) { try { - Customer::getItem(new CustomerData(null, $customer))->add(); + Customer::getItem(new CategoryData(null, $customer))->add(); $num++; } catch (SPException $e) { if ($e->getType() === SPException::SP_WARNING){ diff --git a/inc/SP/Mgmt/Categories/Category.class.php b/inc/SP/Mgmt/Categories/Category.class.php index e5bdeab1..e9bf9a40 100644 --- a/inc/SP/Mgmt/Categories/Category.class.php +++ b/inc/SP/Mgmt/Categories/Category.class.php @@ -103,14 +103,10 @@ class Category extends CategoryBase implements ItemInterface, ItemSelectInterfac public function delete($id) { if ($this->checkInUse($id)) { - // FIXME - throw new SPException( - SPException::SP_WARNING, - _('No es posible eliminar') . ';;' . _('Categoría en uso por') - ); + throw new SPException(SPException::SP_WARNING, _('No es posible eliminar')); } - $oldCategory = $this->getById($this->itemData->getCategoryId()); + $oldCategory = $this->getById($id); $query = /** @lang SQL */ 'DELETE FROM categories WHERE category_id = ? LIMIT 1'; diff --git a/inc/SP/Mgmt/CustomFields/CustomFieldsUtil.class.php b/inc/SP/Mgmt/CustomFields/CustomFieldsUtil.class.php index 2e6ead5e..7ad7ec6c 100644 --- a/inc/SP/Mgmt/CustomFields/CustomFieldsUtil.class.php +++ b/inc/SP/Mgmt/CustomFields/CustomFieldsUtil.class.php @@ -136,7 +136,7 @@ class CustomFieldsUtil * @param array $customFields * @param CustomFieldData $CustomFieldData */ - public static function addItemCustomFields(array $customFields, CustomFieldData $CustomFieldData) + public static function addItemCustomFields(array &$customFields, CustomFieldData $CustomFieldData) { foreach ($customFields as $id => $value) { $CustomFieldData->setDefinitionId($id); diff --git a/inc/SP/Mgmt/Customers/Customer.class.php b/inc/SP/Mgmt/Customers/Customer.class.php index 4b89dad5..49371a12 100644 --- a/inc/SP/Mgmt/Customers/Customer.class.php +++ b/inc/SP/Mgmt/Customers/Customer.class.php @@ -124,11 +124,7 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac public function delete($id) { if ($this->checkInUse($id)) { - // FIXME - throw new SPException( - SPException::SP_WARNING, - _('No es posible eliminar') . ';;' . _('Cliente en uso por') - ); + throw new SPException(SPException::SP_WARNING, _('No es posible eliminar')); } $oldCustomer = $this->getById($id); @@ -138,7 +134,7 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data = new QueryData(); $Data->setQuery($query); - $Data->addParam($this->itemData->getCustomerId()); + $Data->addParam($id); if (DB::getQuery($Data) === false) { throw new SPException(SPException::SP_CRITICAL, _('Error al eliminar el cliente')); diff --git a/inc/SP/Mgmt/Customers/CustomerBase.class.php b/inc/SP/Mgmt/Customers/CustomerBase.class.php index 9ae28679..939a9496 100644 --- a/inc/SP/Mgmt/Customers/CustomerBase.class.php +++ b/inc/SP/Mgmt/Customers/CustomerBase.class.php @@ -57,6 +57,7 @@ abstract class CustomerBase extends ItemBase /** * Devolver los datos del elemento + * * @return CustomerData */ public function getItemData() diff --git a/inc/SP/Mgmt/Files/File.class.php b/inc/SP/Mgmt/Files/File.class.php index 3bde994b..9497d286 100644 --- a/inc/SP/Mgmt/Files/File.class.php +++ b/inc/SP/Mgmt/Files/File.class.php @@ -27,6 +27,7 @@ namespace SP\Mgmt\Files; use SP\Account\AccountUtil; +use SP\Core\Exceptions\SPException; use SP\DataModel\FileData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemSelectInterface; @@ -108,6 +109,7 @@ class File extends FileBase implements ItemInterface, ItemSelectInterface /** * @param $id int * @return mixed + * @throws \SP\Core\Exceptions\SPException */ public function delete($id) { @@ -129,18 +131,13 @@ class File extends FileBase implements ItemInterface, ItemSelectInterface $Log->addDetails(_('Tamaño'), $this->itemData->getRoundSize() . 'KB'); if (DB::getQuery($Data) === false) { - $Log->addDescription(_('Error al eliminar el archivo')); - $Log->writeLog(); - - Email::sendEmail($Log); + throw new SPException(SPException::SP_ERROR, $Log->getDescription()); } $Log->addDescription(_('Archivo eliminado')); $Log->writeLog(); Email::sendEmail($Log); - - return true; } /** diff --git a/inc/SP/Mgmt/PublicLinks/PublicLink.class.php b/inc/SP/Mgmt/PublicLinks/PublicLink.class.php index 0f49373a..d881d127 100644 --- a/inc/SP/Mgmt/PublicLinks/PublicLink.class.php +++ b/inc/SP/Mgmt/PublicLinks/PublicLink.class.php @@ -59,6 +59,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface * Incrementar el contador de visitas de un enlace * * @return bool + * @throws \SP\Core\Exceptions\SPException */ public function addLinkView() { @@ -80,7 +81,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface } /** - * @return $this + * @return bool * @throws SPException */ public function update() @@ -97,11 +98,11 @@ class PublicLink extends PublicLinkBase implements ItemInterface $Data->addParam($this->itemData->getLinkHash()); $Data->addParam($this->itemData->getItemId()); - if (DB::getQuery($Data)) { + if (DB::getQuery($Data) === false) { throw new SPException(SPException::SP_ERROR, _('Error al actualizar enlace')); } - return $this; + return true; } /** @@ -236,7 +237,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface /** * @param $id int - * @return $this + * @return PublicLinkListData * @throws SPException */ public function getById($id) @@ -268,11 +269,17 @@ class PublicLink extends PublicLinkBase implements ItemInterface $PublicLink = Util::castToClass($this->getDataModel(), $PublicLink); } - $PublicLink->setItemId($queryRes->getPublicLinkItemId()); + $PublicLinkListData = new PublicLinkListData(); + $PublicLinkListData->setPublicLinkItemId($queryRes->getPublicLinkItemId()); + $PublicLinkListData->setAccountName(AccountUtil::getAccountNameById($PublicLink->getItemId())); + $PublicLinkListData->setUserLogin(UserUtil::getUserLoginById($PublicLink->getUserId())); + $PublicLinkListData->setNotify($PublicLink->isNotify() ? _('ON') : _('OFF')); + $PublicLinkListData->setDateAdd(date('Y-m-d H:i', $PublicLink->getDateAdd())); + $PublicLinkListData->setDateExpire(date('Y-m-d H:i', $PublicLink->getDateExpire())); + $PublicLinkListData->setCountViews($PublicLink->getCountViews() . '/' . $PublicLink->getMaxCountViews()); + $PublicLinkListData->setUseInfo($PublicLink->getUseInfo()); - $this->itemData = $PublicLink; - - return $this; + return $PublicLinkListData; } /** @@ -311,9 +318,9 @@ class PublicLink extends PublicLinkBase implements ItemInterface $PublicLinkListData->setAccountName(AccountUtil::getAccountNameById($PublicLinkData->getItemId())); $PublicLinkListData->setUserLogin(UserUtil::getUserLoginById($PublicLinkData->getUserId())); - $PublicLinkListData->setNotify(($PublicLinkData->isNotify()) ? _('ON') : _('OFF')); - $PublicLinkListData->setDateAdd(date("Y-m-d H:i", $PublicLinkData->getDateAdd())); - $PublicLinkListData->setDateExpire(date("Y-m-d H:i", $PublicLinkData->getDateExpire())); + $PublicLinkListData->setNotify($PublicLinkData->isNotify() ? _('ON') : _('OFF')); + $PublicLinkListData->setDateAdd(date('Y-m-d H:i', $PublicLinkData->getDateAdd())); + $PublicLinkListData->setDateExpire(date('Y-m-d H:i', $PublicLinkData->getDateExpire())); $PublicLinkListData->setCountViews($PublicLinkData->getCountViews() . '/' . $PublicLinkData->getMaxCountViews()); $PublicLinkListData->setUseInfo($PublicLinkData->getUseInfo()); @@ -342,7 +349,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface /** * @param $hash int - * @return $this + * @return PublicLinkData * @throws \SP\Core\Exceptions\SPException */ public function getByHash($hash) @@ -376,8 +383,6 @@ class PublicLink extends PublicLinkBase implements ItemInterface $PublicLink->setItemId($queryRes->getPublicLinkItemId()); - $this->itemData = $PublicLink; - - return $this; + return $PublicLink; } } \ No newline at end of file diff --git a/inc/SP/Mgmt/Users/User.class.php b/inc/SP/Mgmt/Users/User.class.php index 86c04012..16fafd28 100644 --- a/inc/SP/Mgmt/Users/User.class.php +++ b/inc/SP/Mgmt/Users/User.class.php @@ -86,10 +86,10 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getUserNotes()); $Data->addParam($this->itemData->getUserGroupId()); $Data->addParam($this->itemData->getUserProfileId()); - $Data->addParam(intval($this->itemData->isUserIsAdminApp())); - $Data->addParam(intval($this->itemData->isUserIsAdminAcc())); - $Data->addParam(intval($this->itemData->isUserIsDisabled())); - $Data->addParam(intval($this->itemData->isUserIsChangePass())); + $Data->addParam($this->itemData->isUserIsAdminApp()); + $Data->addParam($this->itemData->isUserIsAdminAcc()); + $Data->addParam($this->itemData->isUserIsDisabled()); + $Data->addParam($this->itemData->isUserIsChangePass()); $Data->addParam($passdata['pass']); $Data->addParam($passdata['salt']); diff --git a/inc/sql/1.3.16100601.sql b/inc/sql/1.3.16100601.sql index 76ccbf26..260159bc 100644 --- a/inc/sql/1.3.16100601.sql +++ b/inc/sql/1.3.16100601.sql @@ -23,12 +23,6 @@ ALTER TABLE `accUsers` ADD INDEX `fk_accUsers_users_id_idx` (`accuser_userId` ASC), DROP PRIMARY KEY; -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 `accounts` CHANGE COLUMN `account_id` `account_id` SMALLINT(5) UNSIGNED NOT NULL, CHANGE COLUMN `account_userId` `account_userId` SMALLINT(5) UNSIGNED NOT NULL, @@ -145,18 +139,6 @@ REFERENCES `usrData` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; -ALTER TABLE `accViewLinks` - ADD CONSTRAINT `fk_accViewLinks_account_id` -FOREIGN KEY (`accviewlinks_accountId`) -REFERENCES `accounts` (`account_id`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `fk_accViewLinks_user_id` -FOREIGN KEY (`accviewlinks_userId`) -REFERENCES `usrData` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; - ALTER TABLE `accounts` ADD CONSTRAINT `fk_accounts_categories_id` FOREIGN KEY (`account_categoryId`) diff --git a/inc/sql/dbstructure.sql b/inc/sql/dbstructure.sql index bbaaf849..788fa789 100644 --- a/inc/sql/dbstructure.sql +++ b/inc/sql/dbstructure.sql @@ -232,26 +232,6 @@ CREATE TABLE `accUsers` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `accViewLinks`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `accViewLinks` ( - `accviewlinks_id` int(10) unsigned NOT NULL DEFAULT '0', - `accviewlinks_accountId` smallint(5) unsigned DEFAULT NULL, - `accviewlinks_expireTime` int(10) unsigned DEFAULT NULL, - `accviewlinks_expired` bit(1) DEFAULT b'0', - `accviewlinks_userId` smallint(5) unsigned DEFAULT NULL, - `accviewlinks_hash` varbinary(100) DEFAULT '', - `accviewlinks_actionId` smallint(5) unsigned DEFAULT NULL, - PRIMARY KEY (`accviewlinks_id`), - UNIQUE KEY `unique_accviewlinks_id` (`accviewlinks_id`), - KEY `fk_accViewLinks_account_idx` (`accviewlinks_accountId`), - KEY `fk_accViewLinks_user_id_idx` (`accviewlinks_userId`), - CONSTRAINT `fk_accViewLinks_account_id` FOREIGN KEY (`accviewlinks_accountId`) REFERENCES `accounts` (`account_id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_accViewLinks_user_id` FOREIGN KEY (`accviewlinks_userId`) REFERENCES `usrData` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - DROP TABLE IF EXISTS `authTokens`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; diff --git a/inc/themes/material-blue/css/search-grid.css b/inc/themes/material-blue/css/search-grid.css index 8c801404..a1432c71 100644 --- a/inc/themes/material-blue/css/search-grid.css +++ b/inc/themes/material-blue/css/search-grid.css @@ -97,6 +97,11 @@ #content #data-search .account-info { padding: .5em 0 .5em 0; text-align: left; + opacity: 0.3; +} + +#content #data-search .account-info:hover { + opacity: 1; } #content #data-search .account-actions { @@ -125,6 +130,11 @@ #content #data-search .tags-box span.tag { cursor: pointer; + opacity: 0.3; +} + +#content #data-search .tags-box span.tag:hover { + opacity: 1; } @media screen and (max-width: 1000px) { diff --git a/inc/themes/material-blue/css/search-grid.min.css b/inc/themes/material-blue/css/search-grid.min.css index 44d95f6b..12ec0bf2 100644 --- a/inc/themes/material-blue/css/search-grid.min.css +++ b/inc/themes/material-blue/css/search-grid.min.css @@ -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 .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%}} \ No newline at end of file +#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;opacity:.3}#content #data-search .account-info:hover{opacity:1}#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;opacity:.3}#content #data-search .tags-box span.tag:hover{opacity:1}@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%}} \ No newline at end of file diff --git a/inc/themes/material-blue/css/styles.css b/inc/themes/material-blue/css/styles.css index b4a014d9..561e00b8 100644 --- a/inc/themes/material-blue/css/styles.css +++ b/inc/themes/material-blue/css/styles.css @@ -1150,7 +1150,7 @@ footer img { .header-grey { background-color: #607d8b; color: #fff; - height: 2em; + min-height: 2em; } .no-background { diff --git a/inc/themes/material-blue/css/styles.min.css b/inc/themes/material-blue/css/styles.min.css index a4c6d24f..fdab4bbf 100644 --- a/inc/themes/material-blue/css/styles.min.css +++ b/inc/themes/material-blue/css/styles.min.css @@ -1 +1 @@ -html,body{margin:0;padding:0;text-align:left;background-color:#f5f5f5;color:#555;font-size:12px;font-weight:normal;box-sizing:border-box}*{font-family:Roboto-Regular,Verdana,Tahoma,sans-serif}*,*:before,*:after{box-sizing:inherit}table{font-size:11px;border-spacing:0}#searchbox,#tblAccion{border:1px solid #d9d9d9;background-color:#f9f9f9;background-color:rgba(249,249,249,.5);vertical-align:middle}table th{border-bottom:2px solid transparent;vertical-align:middle}table th .icon{width:24px;height:24px}table tr.odd{background-color:#f9f9f9}table tr.even>td,table tr.odd>td{border-bottom:1px solid #d9d9d9!important}table tr.even:hover{background-color:#e8ff99}table tr.odd:hover{background-color:#e8ff99}table tr{height:20px}table td{padding:3px}table td.txtCliente{font-weight:bold;text-align:center}form{font-size:11px;border:0 solid #5dd;margin:0}input.inputImg,img.inputImg{background-color:transparent!important;width:24px!important;height:24px!important;border:0;vertical-align:middle;margin:0 .5em}input.txtFile{width:200px}input.txtLong{width:300px}textarea{width:350px;resize:none}select.files{width:250px}input.spinner{width:5em}img{margin:0;padding:0;border:0;cursor:pointer}img.inputImgMini{background-color:transparent!important;width:16px!important;height:16px!important;margin:0 5px 0 5px;border:0;vertical-align:middle}i{cursor:pointer}.altTable{border:0;font-size:10px}.altTable .section{font-size:14px;font-weight:bold}a,a:visited{text-decoration:none;color:rgba(83,109,254,1)}a:hover,a:active,a:focus{text-decoration:none;color:rgba(83,109,254,.6);cursor:pointer}#nojs{width:80%;text-align:center;vertical-align:middle;margin:10px auto;padding:3px;background-color:red;color:white;font-weight:bold;font-size:14px}pre,code,samp,kbd{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;font-size:1em;direction:ltr;text-align:left;background-color:#fbfaf9;color:#333;box-shadow:inset 0 0 .3em #ccc;border-radius:2px}#wrap{height:auto!important;min-height:100%;width:100%;background-color:#f5f5f5}#wrap-loading{position:fixed;z-index:9999;top:50%;left:50%;padding:1em;background-color:rgba(255,255,255,.8);border-radius:5px;display:none}#container{margin:auto;width:100%}#container.login{padding-top:10em}#container.main{position:absolute;top:0;width:100%;height:auto;background:url("../imgs/logo_full.svg") no-repeat left top transparent;background-size:auto 150px}#container.error,#container.install,#container.passreset{width:100%}#container #header{width:100%;margin-bottom:15px}#container #actions-bar{z-index:100;display:flex;justify-content:space-between;position:fixed;border:0 none;top:0;left:0;width:100%;padding:1em 0;background-color:transparent}#container #actions-bar-icons{flex-grow:1;text-align:center}#container #actions-bar-logo{display:none;padding:0 .5em}#container #actions-bar-logo img{display:inline-block;width:50px;opacity:.75}#container #content{width:95%;margin:10em auto 5em auto}#container #content.public-link{min-height:0;margin:0}#content td.descField,#fancyContainer td.descField{text-align:right;padding-right:20px;width:25%;font-weight:bold;border-right:1px solid #d9d9d9;color:#555}#content td.valField,#fancyContainer td.valField{padding-left:20px;width:100%}#content #resBuscar{margin-bottom:50px}#content #resBuscar img{vertical-align:middle}#content #pageNav{width:100%;margin-top:15px;padding:.5em;vertical-align:middle;font-size:11px;color:#999;border:1px solid #d9d9d9;background-color:#f5f5f5}#content #pageNav img{margin-left:5px;vertical-align:middle}#content #pageNav a{margin-left:5px;font-size:12px;color:#999}#content #pageNav .current{margin-left:5px;color:darkorange}#content #pageNav>div{display:inline-block;width:49%}#content #pageNav #pageNavLeft{text-align:left}#content #pageNav #pageNavRight{text-align:right}#content #title{width:50%;padding:7px;margin:auto;background-color:#d9d9d9;color:#fff;font-size:17px;letter-spacing:.3em;text-align:center}#content #title.titleBlue{background-color:#536dfe;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#536dfe),color-stop(90%,#536dfe));background-image:-webkit-linear-gradient(#536dfe 20%,#536dfe 90%);background-image:-moz-linear-gradient(#536dfe 20%,#536dfe 90%);background-image:-o-linear-gradient(#536dfe 20%,#536dfe 90%);background-image:linear-gradient(#536dfe 20%,#536dfe 90%);background:#536dfe url("../inc/themes/material-blue/css/images/ui-bg_highlight-hard_100_536DFE_1x100.png") repeat-x scroll 50% 50%}#content #title.titleNormal{background-color:#607d8b;color:#fff}#content .data{width:75%;padding:10px;border:1px solid #c9c9c9;margin:auto;background-color:#f9f9f9}#content .data #history-icon{position:relative;top:5em;right:2em}#content .data td{text-align:left}#content .data td.descField{text-align:right;font-size:12px;font-weight:bold;color:#999}#content .data select{min-width:210px}#content .data #files-wrap{max-height:100px;width:95%;overflow-y:auto;padding:.5em;margin:1em 0}#content .data #files-list{list-style-type:none;margin:0;padding:0}#content .data #files-list li{background:#f2f2f2;padding:.5em;font-size:1em;margin-bottom:5px}#content .data #files-list li:hover{background:#fffccd;color:#000}#content .data #files-list li div{display:inline-block}#content .data #files-list li div.files-item-info{width:55%}#content .data #files-list li div.files-item-info img{margin:0 .5em}#content .data #files-list li div.files-item-actions{width:40%;text-align:right}#content .data .dropzone{width:30em;padding:1em;border:2px dashed #009688;text-align:center}#content .data .dropzone img{vertical-align:middle}#content .data .file-upload{display:none}#content .data .account-permissions{width:100%}#content .data .account-permissions fieldset{border:1px solid #c9c9c9;padding:1em}#content .data .account-permissions legend{font-weight:bold;color:#999;padding:.2em 0}#content .data .account-permissions fieldset>span{font-weight:bold;color:#999;padding:.2em 0;display:inline-block;width:100px;text-align:right}#content span.tag{margin:0 3px 3px 0;padding:.2em;background:#5c6bc0;color:#fff;border:0 solid rgba(0,0,0,0);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}#content .extra-info{margin-top:20px}#content .tblIcon{background:url("../imgs/clock.png") no-repeat transparent}#content #tabs .ui-tabs-nav{position:relative;left:12em;width:90%}#content #tabs fieldset{border:1px solid #c9c9c9}#content #tabs #frmConfig label{float:left}#content .tblConfig{margin-bottom:2em}#content .tblConfig td.descField{width:35%;font-size:11px;font-weight:bold}#content .tblConfig td.rowHeader{padding:5px 0 5px 0;background-color:#f5f5f5;text-align:center;font-weight:bold;border-top:15px solid #f9f9f9;border-bottom:3px solid #a9c1d7;letter-spacing:.5em;color:#696969}#content .tblConfig input.checkbox{width:15px;text-align:left;padding:0}#content .tblConfig .option-disabled{text-align:center;background-color:#fff2d9;color:orange;font-weight:bold}#content #tblAccion{width:100%}#content h2{width:100%;height:1.5em;font-size:18px;color:white;background-color:#a9c1d7;margin:0;padding-top:.1em}#content .section{margin-top:2.5em;border-bottom:1px solid #d9d9d9;text-align:left;font-size:14px;font-weight:bold;color:#045fb4}#content .row_even>td{background-color:#f5f5f5}#content .row_odd>td{background-color:white}#content .data-header ul{list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-header li{display:inline-block;padding:.2em .5em;font-weight:bold;letter-spacing:.2em;color:#fff;text-align:center}#content .data-header li a{color:#777}#content .data-header li img{float:right;width:24px;height:24px;vertical-align:middle}#content .data-header-minimal{border-bottom:1px solid #dfdfdf}#content .data-header-minimal ul{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}#content .data-header-minimal li a{color:#b9b9b9;padding:.3em .8em}#content .data-rows ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-rows li{float:left;display:block;padding:1em;color:#696969;text-align:center;background-color:#fcfcfc;min-height:2em}#content .data-rows li.cell-nodata{padding:1em 0;min-height:2em;text-align:left}#content .data-rows li.cell-actions{float:right;min-height:2em;padding:1em 0;text-align:center;background-color:#fcfcfc;width:15em}#content .data-rows li.cell-actions:hover{background-color:#fffef0!important}#content .data-rows li.cell-nodata img,#content .data-rows li.cell-actions img,#content #data-search .account-info img,#content #data-search .account-actions img{width:24px;height:24px;margin:0 .5em}#content .rowSpace>.cellBorder{height:10px;border-top:1px solid #d9d9d9}#content .rowSpace>.cellBlank{height:10px}#content #resEventLog .data{width:100%}#content #resEventLog thead{text-align:center}#content #resEventLog tbody{width:100%;height:500px;overflow:auto}#content #resEventLog td{border-bottom:1px solid #d9d9d9}#content #resEventLog .cell{text-align:center}#content #resEventLog .cell-description{width:60%}#content #searchbox{position:relative;left:8%;width:91%;height:auto;padding:0 1em}#content #searchbox form{display:flex;justify-content:flex-start;align-items:center;text-align:left}#content #searchbox .search-filters>*{margin:0 .5em}#content #searchbox .search-filters .filter-buttons{display:inline-block}#content #searchbox div.chosen-container{margin:0 .2em}#content #searchbox select{min-width:15em}#content .btn-clear{opacity:.35;filter:alpha(opacity=35)}#content .btn-clear:hover{opacity:1;filter:alpha(opacity=100)}#content #tabs.ui-widget-content{border:0;background-color:transparent}#content #tabs .ui-widget-header{background:0;border:0;border-bottom:1px solid #c9c9c9}#content #tabs.ui-widget-content{background:none!important}#content #tabs .tabs-spacer{float:left;height:200px}#content .tabs-bottom .ui-tabs-nav{clear:left;padding:0 .2em .2em .2em}#content .tabs-bottom .ui-tabs-nav li{top:auto;bottom:0;margin:0 .2em 1px 0;border-top:0}#content .tabs-bottom .ui-tabs-nav li.ui-tabs-active{margin-top:-1px;padding-top:1px}#datos{float:left;width:400px;text-align:left;margin-top:10px;color:#b9b9b9}#datos a{color:orange;font-weight:bold;border:0;padding:3px;margin:5px 0 5px 0;display:block;width:40px;text-align:center;background-color:transparent}#datos img{border:0}#resAccion,#resFancyAccion{height:20px;padding:5px;margin:5px;font-weight:bold;font-size:14px}#resAccion span{padding:5px;border:#a9a9a9 1px solid}#fancyView{min-width:250px;text-align:center;padding:15px;line-height:20px;border:#d9d9d9 1px solid;font-size:14px}#fancyView ul{list-style:none}#fancyView.msgError{margin:5px;background-color:#fee8e6;color:#c00;font-weight:bold;border:#fed2ce 1px solid}#fancyView.msgOk{margin:5px;background-color:#ecfde4;color:green;font-weight:bold;border:#dbfdcb 1px solid}#fancyView.msgWarn{margin:5px;background-color:#fff2d9;color:orange;font-weight:bold;border:#ffe5b3 1px solid}#fancyView.msgInfo{margin:5px;background-color:#e9e9e9;color:orange;font-weight:bold;border:#ffe5b3 1px solid}#fancyView.backGrey{background-color:#f2f2f2!important}#fancyView PRE{text-align:left}#fancyView table{border:0;width:100%;font-size:14px;text-align:left}#fancyView td{border-bottom:#d9d9d9 1px solid}#fancyMsg{min-width:250px;height:150px;background-color:#f5f5f5;font-family:Verdana,Arial;font-size:16px;text-align:center;display:table-cell;vertical-align:middle;font-weight:bold;border:0;line-height:20px;padding:0 15px;border-radius:25px;-moz-border-radius:25px;-webkit-border-radius:25px}#fancyMsg table{border:0;width:100%;font-size:14px;text-align:left}#fancyMsg td{border-bottom:#d9d9d9 1px solid}#fancyMsg.msgError{background:url('../imgs/bg_msg_error.png') white repeat-x;color:#c00}#fancyMsg.msgOk{background:url('../imgs/bg_msg_ok.png') white repeat-x;color:green}#fancyMsg.msgWarn{background:url('../imgs/bg_msg_warn.png') white repeat-x;color:orange}#fancyMsg.msgInfo{background:url('../imgs/bg_msg_info.png') white repeat-x;color:#555}#fancyView a,#fancyMsg a{color:#555}#fancyContainer{padding:0}#fancyContainer>h2{width:100%;font-size:18px;color:white;background-color:#607d8b;margin:0 0 1em 0;padding:.5em 0;line-height:1em}#fancyContainer select{width:220px}#fancyContainer.help{min-height:100px;background-color:#f5f5f5}#fancyContainer.help p{font-size:14px;text-align:justify;line-height:2em}#fancyContainer #resFancyAccion{display:none}#fancyContainer #resCheck{display:inline-block;width:80%;height:4em;padding:1em 0}#debug{float:left;text-align:left}#debuginfo{width:100%;min-height:10em;padding:1em;background-color:lightgoldenrodyellow;text-align:left;line-height:1.5em}#debuginfo H3{text-align:center}.fancyNone{background-color:transparent!important}.fancydata{min-width:400px;border:0;text-align:left;margin:0 .5em}.fancydata .descField{min-width:100px;font-weight:bold}footer{display:flex;justify-content:space-between;position:fixed;bottom:0;z-index:100;width:100%;padding:.5em 0;background-color:#f5f5f5;color:#b9b9b9;font-size:1em;box-shadow:0 -8px 6px -6px #c9c9c9;-webkit-box-shadow:0 -8px 6px -6px #c9c9c9;-moz-box-shadow:0 -8px 6px -6px #c9c9c9}footer,footer .footer-parts{display:flex;justify-content:space-between}footer #footer-left,footer #footer-right{width:50%;margin:0 1em}footer #footer-right{justify-content:flex-end;text-align:right}footer #updates{min-width:10em;text-align:center;cursor:pointer}footer #status{margin:0 1em}footer #status>div{display:inline-block}footer #status .status-info{padding:.5em}footer #session{text-align:left;color:#999;font-size:.8em}footer a,footer a:visited{color:#b9b9b9}footer #project a:hover{color:#a9c1d7;border-bottom:1px solid #a9c1d7}footer #updates a:hover{color:#a9c1d7}footer img{border:0;width:16px;height:16px;vertical-align:middle}.round{border-radius:5px!important;-moz-border-radius:5px!important;-webkit-border-radius:5px!important}.round5{border-radius:5px!important;-moz-border-radius:5px!important;-webkit-border-radius:5px!important}.midround{border-radius:0 0 10px 10px!important;-moz-border-radius:0 0 10px 10px!important;-webkit-border-radius:0 0 10px 10px!important}.midroundup{border-radius:10px 10px 0 0!important;-moz-border-radius:10px 10px 0 0!important;-webkit-border-radius:10px 10px 0 0!important}.fullround{border-radius:50%!important;-moz-border-radius:50%!important;-webkit-border-radius:50%!important}.iconMini{width:16px!important;height:16px!important;vertical-align:middle}#content .error{width:350px;margin:15px;padding:15px;background-color:#f9f9f9;color:orange;border:orange 1px solid;margin:0 auto;text-align:center;font-size:16px;line-height:1.5em}.hide{display:none!important}.btn-checks{padding:5px;margin:.2em 0;width:30em;border-bottom:1px solid #c9c9c9}.shadow{box-shadow:1px 1px 2px #d9d9d9}.noRes{width:60%;margin:15px;padding:15px;background-color:#f9f9f9;color:#a9a9a9;border:#c9c9c9 1px solid;margin:20px auto;text-align:center;font-size:16px}.header-blue{background:#536dfe url("../inc/themes/material-blue/css/images/ui-bg_highlight-hard_100_536DFE_1x100.png") repeat-x scroll 50% 50%}.header-grey{background-color:#607d8b;color:#fff;height:2em}.no-background{background:none!important}.action{max-width:75%;height:4em;margin:.7em auto;text-align:right}.action-in-box{display:inline-block;height:4em;margin:.7em 0;text-align:right}.action ul{list-style:none;margin:0;padding:0;padding-right:2em}.action-in-box ul{list-style:none;margin:0;padding:0}.action li{display:inline-block;width:2em;height:2em;margin-left:3em}.action li img,.action-in-box li img{padding:1em;border:1px solid #d9d9d9;border-radius:3em;background-color:#f9f9f9!important}.fullWidth{max-width:100%!important}.filterOn{padding:.3em 1em;background-color:#ecfde4;color:green!important;border:#dbfdcb 1px solid!important}.globalOn{padding:.3em 1em;background-color:#fff2d9;color:orange!important;border:#ffe5b3 1px solid!important}.opacity50{filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}.custom-combobox{position:relative;display:inline-block}.custom-combobox input{width:80%}.custom-combobox-toggle{position:absolute;top:0;bottom:0;margin-left:-1px;padding:0;*height:1.7em;*top:.1em}.custom-combobox-input{margin:0;padding:.3em}.ui-tooltip{background:#ffffa3;color:#555;padding:10px;border-radius:10px;box-shadow:0 0 7px #a9a9a9}.ui-autocomplete,.ui-menu-item{z-index:8050}.fancybox-inner{overflow:visible!important}.passLevel{width:20px;height:20px;display:inline-block;position:relative;top:2px}.passLevel.strongest,.passLevel.strongest:hover{background-color:#ecfde4!important;color:green;font-weight:bold;border:lightgreen 1px solid}.passLevel.strong,.passLevel.strong:hover{background-color:#e6f2ff!important;color:#64b4f4;font-weight:bold;border:#64b4f4 1px solid}.passLevel.good,.passLevel.good:hover{background-color:#fff2d9!important;color:orange;font-weight:bold;border:#ffe5b3 1px solid}.passLevel.weak,.passLevel.weak:hover{background-color:#fee8e6!important;color:#c00;font-weight:bold;border:#fed2ce 1px solid}#alert #alert-text{margin:15px auto;font-size:14px;font-weight:bold}#alert #alert-pass{width:50%;padding:10px;margin:15px auto;border:1px solid #c9c9c9;color:#555;font-weight:bold}.dialog-user-text{padding:.5em;border-bottom:#d9d9d9 1px solid;text-align:center;min-width:200px;color:#d9d9d9}.dialog-pass-text{padding:.5em;border:transparent 1px solid;text-align:center;min-width:200px}.dialog-buttons{text-align:center;padding:.5em;border-top:1px solid #c9c9c9;line-height:2.5em}.dialog-clip-pass-copy{background-color:#ecfde4;color:green;border:#dbfdcb 1px solid}.help-box{background-color:#fff!important;color:#607d8b}.help-box>*{font-weight:bold}.help-text{text-align:justify;line-height:1.5em;margin-top:1em}.tooltip{width:300px;max-width:300px;background-color:#777;color:#fff;z-index:101}.cursor-pointer{cursor:pointer}.password-actions{display:inline-block;width:12em}.password-actions>span,.password-actions i{margin-right:.6em}.custom-input-color{width:3em;height:1em;display:inline-block}.account-pass-image{height:32px;width:auto}.select-box{width:20em}#boxLogin{width:45em;min-height:150px;margin:0 auto;padding:1em;background:url("../imgs/logo_full.svg") no-repeat #fff;background-size:300px auto;background-position:.5em .5em}#boxLogin .error{float:left;width:315px;margin-top:15px;color:orange;border:1px orange solid;margin-left:auto;margin-right:auto}#boxLogin #boxData,#boxLogin #boxButton{margin-top:7em}#boxLogin #boxData{display:inline-block;width:250px;height:100%;min-height:100px;text-align:left;margin-left:13em;background-color:transparent}#boxLogin #boxButton{display:inline-block;text-align:right;margin-left:2em}#boxLogin #boxActions{width:100%;height:1em;margin-top:1em;text-align:right}#boxLogin #boxActions a{color:#c9c9c9}#boxLogout{width:250px;margin:8em auto 0 auto;font-size:14px;text-align:center;color:orange;background:#fff2d9;border:#ffe5b3 1px solid;padding:.5em}#boxUpdated{width:350px;margin:5em auto 5em auto;font-size:14px;text-align:center;color:green;background:#ecfde4;border:#dbfdcb 1px solid;padding:.5em}fieldset.warning{padding:8px;color:#b94a48;background-color:#f2dede;border:1px solid #eed3d7;border-radius:5px}fieldset.warning legend{color:#b94a48!important}fieldset.warning a{color:#b94a48!important;font-weight:bold}#actions{width:100%;margin:auto auto 50px;line-height:2em}#actions #logo{display:flex;width:100%;margin-bottom:30px;color:#607d8b;box-shadow:0 8px 6px -6px rgba(83,109,254,.3);-webkit-box-shadow:0 8px 6px -6px rgba(83,109,254,.3);-moz-box-shadow:0 8px 6px -6px rgba(83,109,254,.3);align-items:center;background:url("../imgs/logo_full.svg") left no-repeat;background-size:auto 150px;height:150px}#actions #logo #pageDesc{color:#607d8b;align-self:auto;flex:1 0 auto;text-align:center}#actions #logo #pageDesc h1{font-weight:bold;font-size:24px;letter-spacing:3px}#actions ul.errors{max-width:40%;margin:0 auto;list-style:none;font-size:14px;text-align:left}#actions ul.errors>li{margin:1.5em auto;border-radius:5px;padding:.5em}#actions ul.errors>li.err_critical{color:#b94a48;background:#fed7d7;border:1px solid red}#actions ul.errors>li.err_warning{color:orange;background:#fff2d9;border:#ffe5b3 1px solid}#actions ul.errors>li.err_ok{color:green;background:#ecfde4;border:#dbfdcb 1px solid;font-weight:bold}#actions ul.errors>li>p.hint{background-image:url('../imgs/info.png');background-repeat:no-repeat;color:#777;padding-left:25px;background-position:0 .3em;font-size:12px}#actions form{width:450px;margin:0 auto;text-align:left}#actions form fieldset legend{width:100%;margin-top:1em;color:#fff;font-size:14px;font-weight:bold;text-align:center;background-color:#607d8b;margin-bottom:1em;border-radius:5px;letter-spacing:.2em;padding:.2em 0}#actions div.buttons{margin-top:2em;text-align:center}#whatsNewIcon{text-align:center}#whatsNewIcon img{width:64px;height:64px}#whatsNewIcon h2{display:inline-block;color:#555;font-size:16px}#whatsNew{margin:0 auto;width:500px;background-color:#fffde1;padding:2em;line-height:1.5em;font-size:16px;color:#555;border:1px solid #d9d9d9;margin-bottom:3em;display:none}#whatsNew ul{padding:0;border:0}#whatsNew li{padding-left:37px;background:url("../imgs/arrow-list.png") left center no-repeat;line-height:32px;list-style:none}.no-title .ui-dialog-titlebar{display:none}.ui-dialog{z-index:9999!important}@media screen and (max-width:1000px){#content #searchbox{position:relative;left:0;width:100%}#content #searchbox form{flex-wrap:wrap}#content #searchbox form>div{width:100%}#content #searchbox input[type=text]{width:100%}footer,footer .footer-parts{justify-content:space-between;flex-wrap:wrap}footer #footer-left,footer #footer-right,footer .footer-parts>div{width:100%}footer .footer-parts>div{padding:.5em 0}} \ No newline at end of file +html,body{margin:0;padding:0;text-align:left;background-color:#f5f5f5;color:#555;font-size:12px;font-weight:normal;box-sizing:border-box}*{font-family:Roboto-Regular,Verdana,Tahoma,sans-serif}*,*:before,*:after{box-sizing:inherit}table{font-size:11px;border-spacing:0}#searchbox,#tblAccion{border:1px solid #d9d9d9;background-color:#f9f9f9;background-color:rgba(249,249,249,.5);vertical-align:middle}table th{border-bottom:2px solid transparent;vertical-align:middle}table th .icon{width:24px;height:24px}table tr.odd{background-color:#f9f9f9}table tr.even>td,table tr.odd>td{border-bottom:1px solid #d9d9d9 !important}table tr.even:hover{background-color:#e8ff99}table tr.odd:hover{background-color:#e8ff99}table tr{height:20px}table td{padding:3px}table td.txtCliente{font-weight:bold;text-align:center}form{font-size:11px;border:0 solid #5dd;margin:0}input.inputImg,img.inputImg{background-color:transparent !important;width:24px !important;height:24px !important;border:0;vertical-align:middle;margin:0 .5em}input.txtFile{width:200px}input.txtLong{width:300px}textarea{width:350px;resize:none}select.files{width:250px}input.spinner{width:5em}img{margin:0;padding:0;border:0;cursor:pointer}img.inputImgMini{background-color:transparent !important;width:16px !important;height:16px !important;margin:0 5px 0 5px;border:0;vertical-align:middle}i{cursor:pointer}.altTable{border:0;font-size:10px}.altTable .section{font-size:14px;font-weight:bold}a,a:visited{text-decoration:none;color:rgba(83,109,254,1)}a:hover,a:active,a:focus{text-decoration:none;color:rgba(83,109,254,.6);cursor:pointer}#nojs{width:80%;text-align:center;vertical-align:middle;margin:10px auto;padding:3px;background-color:red;color:white;font-weight:bold;font-size:14px}pre,code,samp,kbd{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;font-size:1em;direction:ltr;text-align:left;background-color:#fbfaf9;color:#333;box-shadow:inset 0 0 .3em #ccc;border-radius:2px}#wrap{height:auto !important;min-height:100%;width:100%;background-color:#f5f5f5}#wrap-loading{position:fixed;z-index:9999;top:50%;left:50%;padding:1em;background-color:rgba(255,255,255,.8);border-radius:5px;display:none}#container{margin:auto;width:100%}#container.login{padding-top:10em}#container.main{position:absolute;top:0;width:100%;height:auto;background:url("../imgs/logo_full.svg") no-repeat left top transparent;background-size:auto 150px}#container.error,#container.install,#container.passreset{width:100%}#container #header{width:100%;margin-bottom:15px}#container #actions-bar{z-index:100;display:flex;justify-content:space-between;position:fixed;border:0 none;top:0;left:0;width:100%;padding:1em 0;background-color:transparent}#container #actions-bar-icons{flex-grow:1;text-align:center}#container #actions-bar-logo{display:none;padding:0 .5em}#container #actions-bar-logo img{display:inline-block;width:50px;opacity:.75}#container #content{width:95%;margin:10em auto 5em auto}#container #content.public-link{min-height:0;margin:0}#content td.descField,#fancyContainer td.descField{text-align:right;padding-right:20px;width:25%;font-weight:bold;border-right:1px solid #d9d9d9;color:#555}#content td.valField,#fancyContainer td.valField{padding-left:20px;width:100%}#content #resBuscar{margin-bottom:50px}#content #resBuscar img{vertical-align:middle}#content #pageNav{width:100%;margin-top:15px;padding:.5em;vertical-align:middle;font-size:11px;color:#999;border:1px solid #d9d9d9;background-color:#f5f5f5}#content #pageNav img{margin-left:5px;vertical-align:middle}#content #pageNav a{margin-left:5px;font-size:12px;color:#999}#content #pageNav .current{margin-left:5px;color:darkorange}#content #pageNav>div{display:inline-block;width:49%}#content #pageNav #pageNavLeft{text-align:left}#content #pageNav #pageNavRight{text-align:right}#content #title{width:50%;padding:7px;margin:auto;background-color:#d9d9d9;color:#fff;font-size:17px;letter-spacing:.3em;text-align:center}#content #title.titleBlue{background-color:#536dfe;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#536dfe),color-stop(90%,#536dfe));background-image:-webkit-linear-gradient(#536dfe 20%,#536dfe 90%);background-image:-moz-linear-gradient(#536dfe 20%,#536dfe 90%);background-image:-o-linear-gradient(#536dfe 20%,#536dfe 90%);background-image:linear-gradient(#536dfe 20%,#536dfe 90%);background:#536dfe url("../inc/themes/material-blue/css/images/ui-bg_highlight-hard_100_536DFE_1x100.png") repeat-x scroll 50% 50%}#content #title.titleNormal{background-color:#607d8b;color:#fff}#content .data{width:75%;padding:10px;border:1px solid #c9c9c9;margin:auto;background-color:#f9f9f9}#content .data #history-icon{position:relative;top:5em;right:2em}#content .data td{text-align:left}#content .data td.descField{text-align:right;font-size:12px;font-weight:bold;color:#999}#content .data select{min-width:210px}#content .data #files-wrap{max-height:100px;width:95%;overflow-y:auto;padding:.5em;margin:1em 0}#content .data #files-list{list-style-type:none;margin:0;padding:0}#content .data #files-list li{background:#f2f2f2;padding:.5em;font-size:1em;margin-bottom:5px}#content .data #files-list li:hover{background:#fffccd;color:#000}#content .data #files-list li div{display:inline-block}#content .data #files-list li div.files-item-info{width:55%}#content .data #files-list li div.files-item-info img{margin:0 .5em}#content .data #files-list li div.files-item-actions{width:40%;text-align:right}#content .data .dropzone{width:30em;padding:1em;border:2px dashed #009688;text-align:center}#content .data .dropzone img{vertical-align:middle}#content .data .file-upload{display:none}#content .data .account-permissions{width:100%}#content .data .account-permissions fieldset{border:1px solid #c9c9c9;padding:1em}#content .data .account-permissions legend{font-weight:bold;color:#999;padding:.2em 0}#content .data .account-permissions fieldset>span{font-weight:bold;color:#999;padding:.2em 0;display:inline-block;width:100px;text-align:right}#content span.tag{margin:0 3px 3px 0;padding:.2em;background:#5c6bc0;color:#fff;border:0 solid rgba(0,0,0,0);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}#content .extra-info{margin-top:20px}#content .tblIcon{background:url("../imgs/clock.png") no-repeat transparent}#content #tabs .ui-tabs-nav{position:relative;left:12em;width:90%}#content #tabs fieldset{border:1px solid #c9c9c9}#content #tabs #frmConfig label{float:left}#content .tblConfig{margin-bottom:2em}#content .tblConfig td.descField{width:35%;font-size:11px;font-weight:bold}#content .tblConfig td.rowHeader{padding:5px 0 5px 0;background-color:#f5f5f5;text-align:center;font-weight:bold;border-top:15px solid #f9f9f9;border-bottom:3px solid #a9c1d7;letter-spacing:.5em;color:#696969}#content .tblConfig input.checkbox{width:15px;text-align:left;padding:0}#content .tblConfig .option-disabled{text-align:center;background-color:#fff2d9;color:orange;font-weight:bold}#content #tblAccion{width:100%}#content h2{width:100%;height:1.5em;font-size:18px;color:white;background-color:#a9c1d7;margin:0;padding-top:.1em}#content .section{margin-top:2.5em;border-bottom:1px solid #d9d9d9;text-align:left;font-size:14px;font-weight:bold;color:#045fb4}#content .row_even>td{background-color:#f5f5f5}#content .row_odd>td{background-color:white}#content .data-header ul{list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-header li{display:inline-block;padding:.2em .5em;font-weight:bold;letter-spacing:.2em;color:#fff;text-align:center}#content .data-header li a{color:#777}#content .data-header li img{float:right;width:24px;height:24px;vertical-align:middle}#content .data-header-minimal{border-bottom:1px solid #dfdfdf}#content .data-header-minimal ul{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}#content .data-header-minimal li a{color:#b9b9b9;padding:.3em .8em}#content .data-rows ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-rows li{float:left;display:block;padding:1em;color:#696969;text-align:center;background-color:#fcfcfc;min-height:2em}#content .data-rows li.cell-nodata{padding:1em 0;min-height:2em;text-align:left}#content .data-rows li.cell-actions{float:right;min-height:2em;padding:1em 0;text-align:center;background-color:#fcfcfc;width:15em}#content .data-rows li.cell-actions:hover{background-color:#fffef0 !important}#content .data-rows li.cell-nodata img,#content .data-rows li.cell-actions img,#content #data-search .account-info img,#content #data-search .account-actions img{width:24px;height:24px;margin:0 .5em}#content .rowSpace>.cellBorder{height:10px;border-top:1px solid #d9d9d9}#content .rowSpace>.cellBlank{height:10px}#content #resEventLog .data{width:100%}#content #resEventLog thead{text-align:center}#content #resEventLog tbody{width:100%;height:500px;overflow:auto}#content #resEventLog td{border-bottom:1px solid #d9d9d9}#content #resEventLog .cell{text-align:center}#content #resEventLog .cell-description{width:60%}#content #searchbox{position:relative;left:8%;width:91%;height:auto;padding:0 1em}#content #searchbox form{display:flex;justify-content:flex-start;align-items:center;text-align:left}#content #searchbox .search-filters>*{margin:0 .5em}#content #searchbox .search-filters .filter-buttons{display:inline-block}#content #searchbox div.chosen-container{margin:0 .2em}#content #searchbox select{min-width:15em}#content .btn-clear{opacity:.35;filter:alpha(opacity=35)}#content .btn-clear:hover{opacity:1;filter:alpha(opacity=100)}#content #tabs.ui-widget-content{border:0;background-color:transparent}#content #tabs .ui-widget-header{background:0;border:0;border-bottom:1px solid #c9c9c9}#content #tabs.ui-widget-content{background:none !important}#content #tabs .tabs-spacer{float:left;height:200px}#content .tabs-bottom .ui-tabs-nav{clear:left;padding:0 .2em .2em .2em}#content .tabs-bottom .ui-tabs-nav li{top:auto;bottom:0;margin:0 .2em 1px 0;border-top:0}#content .tabs-bottom .ui-tabs-nav li.ui-tabs-active{margin-top:-1px;padding-top:1px}#datos{float:left;width:400px;text-align:left;margin-top:10px;color:#b9b9b9}#datos a{color:orange;font-weight:bold;border:0;padding:3px;margin:5px 0 5px 0;display:block;width:40px;text-align:center;background-color:transparent}#datos img{border:0}#resAccion,#resFancyAccion{height:20px;padding:5px;margin:5px;font-weight:bold;font-size:14px}#resAccion span{padding:5px;border:#a9a9a9 1px solid}#fancyView{min-width:250px;text-align:center;padding:15px;line-height:20px;border:#d9d9d9 1px solid;font-size:14px}#fancyView ul{list-style:none}#fancyView.msgError{margin:5px;background-color:#fee8e6;color:#c00;font-weight:bold;border:#fed2ce 1px solid}#fancyView.msgOk{margin:5px;background-color:#ecfde4;color:green;font-weight:bold;border:#dbfdcb 1px solid}#fancyView.msgWarn{margin:5px;background-color:#fff2d9;color:orange;font-weight:bold;border:#ffe5b3 1px solid}#fancyView.msgInfo{margin:5px;background-color:#e9e9e9;color:orange;font-weight:bold;border:#ffe5b3 1px solid}#fancyView.backGrey{background-color:#f2f2f2 !important}#fancyView PRE{text-align:left}#fancyView table{border:0;width:100%;font-size:14px;text-align:left}#fancyView td{border-bottom:#d9d9d9 1px solid}#fancyMsg{min-width:250px;height:150px;background-color:#f5f5f5;font-family:Verdana,Arial;font-size:16px;text-align:center;display:table-cell;vertical-align:middle;font-weight:bold;border:0;line-height:20px;padding:0 15px;border-radius:25px;-moz-border-radius:25px;-webkit-border-radius:25px}#fancyMsg table{border:0;width:100%;font-size:14px;text-align:left}#fancyMsg td{border-bottom:#d9d9d9 1px solid}#fancyMsg.msgError{background:url('../imgs/bg_msg_error.png') white repeat-x;color:#c00}#fancyMsg.msgOk{background:url('../imgs/bg_msg_ok.png') white repeat-x;color:green}#fancyMsg.msgWarn{background:url('../imgs/bg_msg_warn.png') white repeat-x;color:orange}#fancyMsg.msgInfo{background:url('../imgs/bg_msg_info.png') white repeat-x;color:#555}#fancyView a,#fancyMsg a{color:#555}#fancyContainer{padding:0}#fancyContainer>h2{width:100%;font-size:18px;color:white;background-color:#607d8b;margin:0 0 1em 0;padding:.5em 0;line-height:1em}#fancyContainer select{width:220px}#fancyContainer.help{min-height:100px;background-color:#f5f5f5}#fancyContainer.help p{font-size:14px;text-align:justify;line-height:2em}#fancyContainer #resFancyAccion{display:none}#fancyContainer #resCheck{display:inline-block;width:80%;height:4em;padding:1em 0}#debug{float:left;text-align:left}#debuginfo{width:100%;min-height:10em;padding:1em;background-color:lightgoldenrodyellow;text-align:left;line-height:1.5em}#debuginfo H3{text-align:center}.fancyNone{background-color:transparent !important}.fancydata{min-width:400px;border:0;text-align:left;margin:0 .5em}.fancydata .descField{min-width:100px;font-weight:bold}footer{display:flex;justify-content:space-between;position:fixed;bottom:0;z-index:100;width:100%;padding:.5em 0;background-color:#f5f5f5;color:#b9b9b9;font-size:1em;box-shadow:0 -8px 6px -6px #c9c9c9;-webkit-box-shadow:0 -8px 6px -6px #c9c9c9;-moz-box-shadow:0 -8px 6px -6px #c9c9c9}footer,footer .footer-parts{display:flex;justify-content:space-between}footer #footer-left,footer #footer-right{width:50%;margin:0 1em}footer #footer-right{justify-content:flex-end;text-align:right}footer #updates{min-width:10em;text-align:center;cursor:pointer}footer #status{margin:0 1em}footer #status>div{display:inline-block}footer #status .status-info{padding:.5em}footer #session{text-align:left;color:#999;font-size:.8em}footer a,footer a:visited{color:#b9b9b9}footer #project a:hover{color:#a9c1d7;border-bottom:1px solid #a9c1d7}footer #updates a:hover{color:#a9c1d7}footer img{border:0;width:16px;height:16px;vertical-align:middle}.round{border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}.round5{border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}.midround{border-radius:0 0 10px 10px !important;-moz-border-radius:0 0 10px 10px !important;-webkit-border-radius:0 0 10px 10px !important}.midroundup{border-radius:10px 10px 0 0 !important;-moz-border-radius:10px 10px 0 0 !important;-webkit-border-radius:10px 10px 0 0 !important}.fullround{border-radius:50% !important;-moz-border-radius:50% !important;-webkit-border-radius:50% !important}.iconMini{width:16px !important;height:16px !important;vertical-align:middle}#content .error{width:350px;margin:15px;padding:15px;background-color:#f9f9f9;color:orange;border:orange 1px solid;margin:0 auto;text-align:center;font-size:16px;line-height:1.5em}.hide{display:none !important}.btn-checks{padding:5px;margin:.2em 0;width:30em;border-bottom:1px solid #c9c9c9}.shadow{box-shadow:1px 1px 2px #d9d9d9}.noRes{width:60%;margin:15px;padding:15px;background-color:#f9f9f9;color:#a9a9a9;border:#c9c9c9 1px solid;margin:20px auto;text-align:center;font-size:16px}.header-blue{background:#536dfe url("../inc/themes/material-blue/css/images/ui-bg_highlight-hard_100_536DFE_1x100.png") repeat-x scroll 50% 50%}.header-grey{background-color:#607d8b;color:#fff;min-height:2em}.no-background{background:none !important}.action{max-width:75%;height:4em;margin:.7em auto;text-align:right}.action-in-box{display:inline-block;height:4em;margin:.7em 0;text-align:right}.action ul{list-style:none;margin:0;padding:0;padding-right:2em}.action-in-box ul{list-style:none;margin:0;padding:0}.action li{display:inline-block;width:2em;height:2em;margin-left:3em}.action li img,.action-in-box li img{padding:1em;border:1px solid #d9d9d9;border-radius:3em;background-color:#f9f9f9 !important}.fullWidth{max-width:100% !important}.filterOn{padding:.3em 1em;background-color:#ecfde4;color:green !important;border:#dbfdcb 1px solid !important}.globalOn{padding:.3em 1em;background-color:#fff2d9;color:orange !important;border:#ffe5b3 1px solid !important}.opacity50{filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}.custom-combobox{position:relative;display:inline-block}.custom-combobox input{width:80%}.custom-combobox-toggle{position:absolute;top:0;bottom:0;margin-left:-1px;padding:0;*height:1.7em;*top:.1em}.custom-combobox-input{margin:0;padding:.3em}.ui-tooltip{background:#ffffa3;color:#555;padding:10px;border-radius:10px;box-shadow:0 0 7px #a9a9a9}.ui-autocomplete,.ui-menu-item{z-index:8050}.fancybox-inner{overflow:visible !important}.passLevel{width:20px;height:20px;display:inline-block;position:relative;top:2px}.passLevel.strongest,.passLevel.strongest:hover{background-color:#ecfde4 !important;color:green;font-weight:bold;border:lightgreen 1px solid}.passLevel.strong,.passLevel.strong:hover{background-color:#e6f2ff !important;color:#64b4f4;font-weight:bold;border:#64b4f4 1px solid}.passLevel.good,.passLevel.good:hover{background-color:#fff2d9 !important;color:orange;font-weight:bold;border:#ffe5b3 1px solid}.passLevel.weak,.passLevel.weak:hover{background-color:#fee8e6 !important;color:#c00;font-weight:bold;border:#fed2ce 1px solid}#alert #alert-text{margin:15px auto;font-size:14px;font-weight:bold}#alert #alert-pass{width:50%;padding:10px;margin:15px auto;border:1px solid #c9c9c9;color:#555;font-weight:bold}.dialog-user-text{padding:.5em;border-bottom:#d9d9d9 1px solid;text-align:center;min-width:200px;color:#d9d9d9}.dialog-pass-text{padding:.5em;border:transparent 1px solid;text-align:center;min-width:200px}.dialog-buttons{text-align:center;padding:.5em;border-top:1px solid #c9c9c9;line-height:2.5em}.dialog-clip-pass-copy{background-color:#ecfde4;color:green;border:#dbfdcb 1px solid}.help-box{background-color:#fff !important;color:#607d8b}.help-box>*{font-weight:bold}.help-text{text-align:justify;line-height:1.5em;margin-top:1em}.tooltip{width:300px;max-width:300px;background-color:#777;color:#fff;z-index:101}.cursor-pointer{cursor:pointer}.password-actions{display:inline-block;width:12em}.password-actions>span,.password-actions i{margin-right:.6em}.custom-input-color{width:3em;height:1em;display:inline-block}.account-pass-image{height:32px;width:auto}.select-box{width:20em}#boxLogin{width:45em;min-height:150px;margin:0 auto;padding:1em;background:url("../imgs/logo_full.svg") no-repeat #fff;background-size:300px auto;background-position:.5em .5em}#boxLogin .error{float:left;width:315px;margin-top:15px;color:orange;border:1px orange solid;margin-left:auto;margin-right:auto}#boxLogin #boxData,#boxLogin #boxButton{margin-top:7em}#boxLogin #boxData{display:inline-block;width:250px;height:100%;min-height:100px;text-align:left;margin-left:13em;background-color:transparent}#boxLogin #boxButton{display:inline-block;text-align:right;margin-left:2em}#boxLogin #boxActions{width:100%;height:1em;margin-top:1em;text-align:right}#boxLogin #boxActions a{color:#c9c9c9}#boxLogout{width:250px;margin:8em auto 0 auto;font-size:14px;text-align:center;color:orange;background:#fff2d9;border:#ffe5b3 1px solid;padding:.5em}#boxUpdated{width:350px;margin:5em auto 5em auto;font-size:14px;text-align:center;color:green;background:#ecfde4;border:#dbfdcb 1px solid;padding:.5em}fieldset.warning{padding:8px;color:#b94a48;background-color:#f2dede;border:1px solid #eed3d7;border-radius:5px}fieldset.warning legend{color:#b94a48 !important}fieldset.warning a{color:#b94a48 !important;font-weight:bold}#actions{width:100%;margin:auto auto 50px;line-height:2em}#actions #logo{display:flex;width:100%;margin-bottom:30px;color:#607d8b;box-shadow:0 8px 6px -6px rgba(83,109,254,.3);-webkit-box-shadow:0 8px 6px -6px rgba(83,109,254,.3);-moz-box-shadow:0 8px 6px -6px rgba(83,109,254,.3);align-items:center;background:url("../imgs/logo_full.svg") left no-repeat;background-size:auto 150px;height:150px}#actions #logo #pageDesc{color:#607d8b;align-self:auto;flex:1 0 auto;text-align:center}#actions #logo #pageDesc h1{font-weight:bold;font-size:24px;letter-spacing:3px}#actions ul.errors{max-width:40%;margin:0 auto;list-style:none;font-size:14px;text-align:left}#actions ul.errors>li{margin:1.5em auto;border-radius:5px;padding:.5em}#actions ul.errors>li.err_critical{color:#b94a48;background:#fed7d7;border:1px solid red}#actions ul.errors>li.err_warning{color:orange;background:#fff2d9;border:#ffe5b3 1px solid}#actions ul.errors>li.err_ok{color:green;background:#ecfde4;border:#dbfdcb 1px solid;font-weight:bold}#actions ul.errors>li>p.hint{background-image:url('../imgs/info.png');background-repeat:no-repeat;color:#777;padding-left:25px;background-position:0 .3em;font-size:12px}#actions form{width:450px;margin:0 auto;text-align:left}#actions form fieldset legend{width:100%;margin-top:1em;color:#fff;font-size:14px;font-weight:bold;text-align:center;background-color:#607d8b;margin-bottom:1em;border-radius:5px;letter-spacing:.2em;padding:.2em 0}#actions div.buttons{margin-top:2em;text-align:center}#whatsNewIcon{text-align:center}#whatsNewIcon img{width:64px;height:64px}#whatsNewIcon h2{display:inline-block;color:#555;font-size:16px}#whatsNew{margin:0 auto;width:500px;background-color:#fffde1;padding:2em;line-height:1.5em;font-size:16px;color:#555;border:1px solid #d9d9d9;margin-bottom:3em;display:none}#whatsNew ul{padding:0;border:0}#whatsNew li{padding-left:37px;background:url("../imgs/arrow-list.png") left center no-repeat;line-height:32px;list-style:none}.no-title .ui-dialog-titlebar{display:none}.ui-dialog{z-index:9999 !important}@media screen and (max-width:1000px){#content #searchbox{position:relative;left:0;width:100%}#content #searchbox form{flex-wrap:wrap}#content #searchbox form>div{width:100%}#content #searchbox input[type=text]{width:100%}footer,footer .footer-parts{justify-content:space-between;flex-wrap:wrap}footer #footer-left,footer #footer-right,footer .footer-parts>div{width:100%}footer .footer-parts>div{padding:.5em 0}} \ No newline at end of file diff --git a/inc/themes/material-blue/views/accitem/publiclinks.inc b/inc/themes/material-blue/views/accitem/publiclinks.inc index e4e9d3ff..329e2ff3 100644 --- a/inc/themes/material-blue/views/accitem/publiclinks.inc +++ b/inc/themes/material-blue/views/accitem/publiclinks.inc @@ -1,42 +1,47 @@ +
| - | publicLink_account; ?> | +getAccountName(); ?> |
| - | publicLink_dateAdd; ?> | +getDateAdd(); ?> |
| - | publicLink_dateExpire; ?> | +getDateExpire(); ?> |
| - | publicLink_user; ?> | +getUserLogin(); ?> |
| - | publicLink_notify; ?> | +getNotify(); ?> |
| - | publicLink_views; ?> | +getCountViews(); ?> |
| - publicLink_useInfo as $useInfo): ?> + getUseInfo() as $useInfo): ?> | ||
| - | publicLink_hash; ?> | +getPublicLinkHash(); ?> |