diff --git a/ajax/ajax_2fa.php b/ajax/ajax_2fa.php index b5b49f4c..634e01e7 100644 --- a/ajax/ajax_2fa.php +++ b/ajax/ajax_2fa.php @@ -23,27 +23,27 @@ * */ -use SP\SessionUtil; +use SP\Core\SessionUtil; define('APP_ROOT', '..'); require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; -SP\Request::checkReferer('POST'); +\SP\Http\Request::checkReferer('POST'); -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printJSON(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printJSON(_('CONSULTA INVÁLIDA')); } -$userId = SP\Request::analyze('itemId', 0); -$pin = SP\Request::analyze('security_pin', 0); +$userId = \SP\Http\Request::analyze('itemId', 0); +$pin = \SP\Http\Request::analyze('security_pin', 0); $twoFa = new \SP\Auth\Auth2FA($userId, $userLogin); if($userId && $pin && $twoFa->verifyKey($pin)){ - \SP\Session::set2FApassed(true); + \SP\Core\Session::set2FApassed(true); // Comprobar si existen parámetros adicionales en URL via GET foreach ($_POST as $param => $value) { @@ -54,8 +54,8 @@ if($userId && $pin && $twoFa->verifyKey($pin)){ $urlParams = isset($params) ? '?' . implode('&', $params) : ''; - SP\Response::printJSON(_('Código correcto'), 0, 'redirect(\'index.php\')'); + \SP\Http\Response::printJSON(_('Código correcto'), 0, 'redirect(\'index.php\')'); } else { - \SP\Session::set2FApassed(false); - SP\Response::printJSON(_('Código incorrecto')); + \SP\Core\Session::set2FApassed(false); + \SP\Http\Response::printJSON(_('Código incorrecto')); } \ No newline at end of file diff --git a/ajax/ajax_accountSave.php b/ajax/ajax_accountSave.php index 14ac1401..55f77c48 100644 --- a/ajax/ajax_accountSave.php +++ b/ajax/ajax_accountSave.php @@ -23,8 +23,8 @@ * */ -use SP\Request; -use SP\SessionUtil; +use SP\Http\Request; +use SP\Core\SessionUtil; define('APP_ROOT', '..'); @@ -32,117 +32,117 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Http\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); } -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printJSON(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printJSON(_('CONSULTA INVÁLIDA')); } // Variables POST del formulario //$frmSaveType = SP_Request::analyze('savetyp', 0); -$actionId = SP\Request::analyze('actionId', 0); -$accountId = SP\Request::analyze('accountid', 0); -$customerId = SP\Request::analyze('customerId', 0); -$newCustomer = SP\Request::analyze('customer_new'); -$accountName = SP\Request::analyze('name'); -$accountLogin = SP\Request::analyze('login'); -$accountPassword = SP\Request::analyzeEncrypted('pass'); -$accountPasswordR = SP\Request::analyzeEncrypted('passR'); -$categoryId = SP\Request::analyze('categoryId', 0); -$accountOtherGroups = SP\Request::analyze('othergroups'); -$accountOtherUsers = SP\Request::analyze('otherusers'); -$accountNotes = SP\Request::analyze('notes'); -$accountUrl = SP\Request::analyze('url'); -$accountGroupEditEnabled = SP\Request::analyze('geditenabled', 0, false, 1); -$accountUserEditEnabled = SP\Request::analyze('ueditenabled', 0, false, 1); -$accountMainGroupId = SP\Request::analyze('mainGroupId', 0); -$accountChangesHash = SP\Request::analyze('hash'); -$customFields = SP\Request::analyze('customfield'); +$actionId = \SP\Http\Request::analyze('actionId', 0); +$accountId = \SP\Http\Request::analyze('accountid', 0); +$customerId = \SP\Http\Request::analyze('customerId', 0); +$newCustomer = \SP\Http\Request::analyze('customer_new'); +$accountName = \SP\Http\Request::analyze('name'); +$accountLogin = \SP\Http\Request::analyze('login'); +$accountPassword = \SP\Http\Request::analyzeEncrypted('pass'); +$accountPasswordR = \SP\Http\Request::analyzeEncrypted('passR'); +$categoryId = \SP\Http\Request::analyze('categoryId', 0); +$accountOtherGroups = \SP\Http\Request::analyze('othergroups'); +$accountOtherUsers = \SP\Http\Request::analyze('otherusers'); +$accountNotes = \SP\Http\Request::analyze('notes'); +$accountUrl = \SP\Http\Request::analyze('url'); +$accountGroupEditEnabled = \SP\Http\Request::analyze('geditenabled', 0, false, 1); +$accountUserEditEnabled = \SP\Http\Request::analyze('ueditenabled', 0, false, 1); +$accountMainGroupId = \SP\Http\Request::analyze('mainGroupId', 0); +$accountChangesHash = \SP\Http\Request::analyze('hash'); +$customFields = \SP\Http\Request::analyze('customfield'); // Datos del Usuario -$currentUserId = SP\Session::getUserId(); +$currentUserId = \SP\Core\Session::getUserId(); if (!$accountMainGroupId === 0) { - $accountMainGroupId = SP\Session::getUserGroupId(); + $accountMainGroupId = \SP\Core\Session::getUserGroupId(); } -if ($actionId === \SP\Controller\ActionsInterface::ACTION_ACC_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_ACC_COPY +if ($actionId === \SP\Core\ActionsInterface::ACTION_ACC_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_ACC_COPY ) { // Comprobaciones para nueva cuenta if (!$accountName) { - SP\Response::printJSON(_('Es necesario un nombre de cuenta')); + \SP\Http\Response::printJSON(_('Es necesario un nombre de cuenta')); } elseif (!$customerId && !$newCustomer) { - SP\Response::printJSON(_('Es necesario un nombre de cliente')); + \SP\Http\Response::printJSON(_('Es necesario un nombre de cliente')); } elseif (!$accountLogin) { - SP\Response::printJSON(_('Es necesario un usuario')); + \SP\Http\Response::printJSON(_('Es necesario un usuario')); } elseif (!$accountPassword || !$accountPasswordR) { - SP\Response::printJSON(_('Es necesaria una clave')); + \SP\Http\Response::printJSON(_('Es necesaria una clave')); } elseif (!$categoryId) { - SP\Response::printJSON(_('Es necesario una categoría')); + \SP\Http\Response::printJSON(_('Es necesario una categoría')); } -} elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_ACC_EDIT) { +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_ACC_EDIT) { // Comprobaciones para modificación de cuenta if (!$customerId && !$newCustomer) { - SP\Response::printJSON(_('Es necesario un nombre de cliente')); + \SP\Http\Response::printJSON(_('Es necesario un nombre de cliente')); } elseif (!$accountName) { - SP\Response::printJSON(_('Es necesario un nombre de cuenta')); + \SP\Http\Response::printJSON(_('Es necesario un nombre de cuenta')); } elseif (!$accountLogin) { - SP\Response::printJSON(_('Es necesario un usuario')); + \SP\Http\Response::printJSON(_('Es necesario un usuario')); } elseif (!$categoryId) { - SP\Response::printJSON(_('Es necesario una categoría')); + \SP\Http\Response::printJSON(_('Es necesario una categoría')); } -} elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_ACC_DELETE) { +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_ACC_DELETE) { if (!$accountId) { - SP\Response::printJSON(_('Id inválido')); + \SP\Http\Response::printJSON(_('Id inválido')); } -} elseif ($actionId == \SP\Controller\ActionsInterface::ACTION_ACC_EDIT_PASS) { +} elseif ($actionId == \SP\Core\ActionsInterface::ACTION_ACC_EDIT_PASS) { // Comprobaciones para modficación de clave if (!$accountPassword || !$accountPasswordR) { - SP\Response::printJSON(_('Es necesaria una clave')); + \SP\Http\Response::printJSON(_('Es necesaria una clave')); } -} elseif ($actionId == \SP\Controller\ActionsInterface::ACTION_ACC_EDIT_RESTORE) { +} elseif ($actionId == \SP\Core\ActionsInterface::ACTION_ACC_EDIT_RESTORE) { if (!$accountId) { - SP\Response::printJSON(_('Id inválido')); + \SP\Http\Response::printJSON(_('Id inválido')); } } else { - SP\Response::printJSON(_('Acción Inválida')); + \SP\Http\Response::printJSON(_('Acción Inválida')); } -if ($actionId == \SP\Controller\ActionsInterface::ACTION_ACC_NEW - || $actionId == \SP\Controller\ActionsInterface::ACTION_ACC_COPY - || $actionId === \SP\Controller\ActionsInterface::ACTION_ACC_EDIT_PASS +if ($actionId == \SP\Core\ActionsInterface::ACTION_ACC_NEW + || $actionId == \SP\Core\ActionsInterface::ACTION_ACC_COPY + || $actionId === \SP\Core\ActionsInterface::ACTION_ACC_EDIT_PASS ) { if ($accountPassword != $accountPasswordR) { - SP\Response::printJSON(_('Las claves no coinciden')); + \SP\Http\Response::printJSON(_('Las claves no coinciden')); } // Encriptar clave de cuenta try { - $accountEncPass = SP\Crypt::encryptData($accountPassword); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage()); + $accountEncPass = \SP\Core\Crypt::encryptData($accountPassword); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage()); } } -$Account = new SP\Account; +$Account = new \SP\Account\Account; switch ($actionId) { - case \SP\Controller\ActionsInterface::ACTION_ACC_NEW: - case \SP\Controller\ActionsInterface::ACTION_ACC_COPY: - SP\Customer::$customerName = $newCustomer; + case \SP\Core\ActionsInterface::ACTION_ACC_NEW: + case \SP\Core\ActionsInterface::ACTION_ACC_COPY: + \SP\Mgmt\Customer::$customerName = $newCustomer; // Comprobar si se ha introducido un nuevo cliente if ($newCustomer) { try { - SP\Customer::addCustomer(); - $customerId = SP\Customer::$customerLastId; - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage()); + \SP\Mgmt\Customer::addCustomer(); + $customerId = \SP\Mgmt\Customer::$customerLastId; + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage()); } } @@ -165,26 +165,26 @@ switch ($actionId) { if ($Account->createAccount()) { if (is_array($customFields)) { foreach ($customFields as $id => $value) { - $CustomFields = new \SP\CustomFields($id, $Account->getAccountId(), $value); + $CustomFields = new \SP\Mgmt\CustomFields($id, $Account->getAccountId(), $value); $CustomFields->addCustomField(); } } - SP\Response::printJSON(_('Cuenta creada'), 0); + \SP\Http\Response::printJSON(_('Cuenta creada'), 0); } - SP\Response::printJSON(_('Error al crear la cuenta'), 0); + \SP\Http\Response::printJSON(_('Error al crear la cuenta'), 0); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_EDIT: - SP\Customer::$customerName = $newCustomer; + case \SP\Core\ActionsInterface::ACTION_ACC_EDIT: + \SP\Mgmt\Customer::$customerName = $newCustomer; // Comprobar si se ha introducido un nuevo cliente if ($newCustomer) { try { - SP\Customer::addCustomer(); - $customerId = SP\Customer::$customerLastId; - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage()); + \SP\Mgmt\Customer::addCustomer(); + $customerId = \SP\Mgmt\Customer::$customerLastId; + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage()); } } @@ -202,40 +202,40 @@ switch ($actionId) { $Account->setAccountOtherGroupEdit($accountGroupEditEnabled); // Cambiar el grupo principal si el usuario es Admin - if (SP\Session::getUserIsAdminApp() || SP\Session::getUserIsAdminAcc()) { + if (\SP\Core\Session::getUserIsAdminApp() || \SP\Core\Session::getUserIsAdminAcc()) { $Account->setAccountUserGroupId($accountMainGroupId); } // Comprobar si han habido cambios if ($accountChangesHash == $Account->calcChangesHash()) { - SP\Response::printJSON(_('Sin cambios'), 0); + \SP\Http\Response::printJSON(_('Sin cambios'), 0); } // Actualizar cuenta if ($Account->updateAccount()) { if (is_array($customFields)) { foreach ($customFields as $id => $value) { - $CustomFields = new \SP\CustomFields($id, $accountId, $value); + $CustomFields = new \SP\Mgmt\CustomFields($id, $accountId, $value); $CustomFields->updateCustomField(); } } - SP\Response::printJSON(_('Cuenta actualizada'), 0); + \SP\Http\Response::printJSON(_('Cuenta actualizada'), 0); } - SP\Response::printJSON(_('Error al modificar la cuenta')); + \SP\Http\Response::printJSON(_('Error al modificar la cuenta')); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_DELETE: + case \SP\Core\ActionsInterface::ACTION_ACC_DELETE: $Account->setAccountId($accountId); // Eliminar cuenta - if ($Account->deleteAccount() && \SP\CustomFields::deleteCustomFieldForItem($accountId, \SP\Controller\ActionsInterface::ACTION_ACC_NEW)) { - SP\Response::printJSON(_('Cuenta eliminada'), 0, "sysPassUtil.Common.doAction('" . \SP\Controller\ActionsInterface::ACTION_ACC_SEARCH . "');"); + if ($Account->deleteAccount() && \SP\Mgmt\CustomFields::deleteCustomFieldForItem($accountId, \SP\Core\ActionsInterface::ACTION_ACC_NEW)) { + \SP\Http\Response::printJSON(_('Cuenta eliminada'), 0, "sysPassUtil.Common.doAction('" . \SP\Core\ActionsInterface::ACTION_ACC_SEARCH . "');"); } - SP\Response::printJSON(_('Error al eliminar la cuenta')); + \SP\Http\Response::printJSON(_('Error al eliminar la cuenta')); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_EDIT_PASS: + case \SP\Core\ActionsInterface::ACTION_ACC_EDIT_PASS: $Account->setAccountId($accountId); $Account->setAccountPass($accountEncPass['data']); $Account->setAccountIV($accountEncPass['iv']); @@ -243,22 +243,22 @@ switch ($actionId) { // Actualizar clave de cuenta if ($Account->updateAccountPass()) { - SP\Response::printJSON(_('Clave actualizada'), 0); + \SP\Http\Response::printJSON(_('Clave actualizada'), 0); } - SP\Response::printJSON(_('Error al actualizar la clave')); + \SP\Http\Response::printJSON(_('Error al actualizar la clave')); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_EDIT_RESTORE: - $Account->setAccountId(SP\AccountHistory::getAccountIdFromId($accountId)); + case \SP\Core\ActionsInterface::ACTION_ACC_EDIT_RESTORE: + $Account->setAccountId(\SP\Account\AccountHistory::getAccountIdFromId($accountId)); $Account->setAccountUserEditId($currentUserId); if ($Account->restoreFromHistory($accountId)) { - SP\Response::printJSON(_('Cuenta restaurada'), 0); + \SP\Http\Response::printJSON(_('Cuenta restaurada'), 0); } - SP\Response::printJSON(_('Error al restaurar cuenta')); + \SP\Http\Response::printJSON(_('Error al restaurar cuenta')); break; default: - SP\Response::printJSON(_('Acción Inválida')); + \SP\Http\Response::printJSON(_('Acción Inválida')); } \ No newline at end of file diff --git a/ajax/ajax_appMgmtData.php b/ajax/ajax_appMgmtData.php index 30339b89..354f6c6f 100644 --- a/ajax/ajax_appMgmtData.php +++ b/ajax/ajax_appMgmtData.php @@ -23,7 +23,7 @@ * */ -use SP\Request; +use SP\Http\Request; define('APP_ROOT', '..'); @@ -31,156 +31,156 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Util::logout(); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Util\Util::logout(); } -if (!SP\Request::analyze('itemId', false, true) - || !SP\Request::analyze('actionId', false, true) +if (!\SP\Http\Request::analyze('itemId', false, true) + || !\SP\Http\Request::analyze('actionId', false, true) ) { exit(); } -$actionId = SP\Request::analyze('actionId', 0); +$actionId = \SP\Http\Request::analyze('actionId', 0); -$tpl = new SP\Template(); -$tpl->assign('itemId', SP\Request::analyze('itemId', 0)); -$tpl->assign('activeTab', SP\Request::analyze('activeTab', 0)); +$tpl = new \SP\Core\Template(); +$tpl->assign('itemId', \SP\Http\Request::analyze('itemId', 0)); +$tpl->assign('activeTab', \SP\Http\Request::analyze('activeTab', 0)); $tpl->assign('actionId', $actionId); $tpl->assign('isView', false); switch ($actionId) { - case \SP\Controller\ActionsInterface::ACTION_USR_USERS_VIEW: + case \SP\Core\ActionsInterface::ACTION_USR_USERS_VIEW: $tpl->assign('header', _('Ver Usuario')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); $tpl->assign('isView', true); - $controller = new SP\Controller\UsersMgmtC($tpl); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getUser(); break; - case \SP\Controller\ActionsInterface::ACTION_USR_USERS_EDIT: + case \SP\Core\ActionsInterface::ACTION_USR_USERS_EDIT: $tpl->assign('header', _('Editar Usuario')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); - $controller = new SP\Controller\UsersMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getUser(); break; - case \SP\Controller\ActionsInterface::ACTION_USR_USERS_NEW: + case \SP\Core\ActionsInterface::ACTION_USR_USERS_NEW: $tpl->assign('header', _('Nuevo Usuario')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); - $controller = new SP\Controller\UsersMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getUser(); break; - case \SP\Controller\ActionsInterface::ACTION_USR_GROUPS_VIEW: + case \SP\Core\ActionsInterface::ACTION_USR_GROUPS_VIEW: $tpl->assign('header', _('Ver Grupo')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); $tpl->assign('isView', true); - $controller = new SP\Controller\UsersMgmtC($tpl); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getGroup(); break; - case \SP\Controller\ActionsInterface::ACTION_USR_GROUPS_EDIT: + case \SP\Core\ActionsInterface::ACTION_USR_GROUPS_EDIT: $tpl->assign('header', _('Editar Grupo')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); - $controller = new SP\Controller\UsersMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getGroup(); break; - case \SP\Controller\ActionsInterface::ACTION_USR_GROUPS_NEW: + case \SP\Core\ActionsInterface::ACTION_USR_GROUPS_NEW: $tpl->assign('header', _('Nuevo Grupo')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); - $controller = new SP\Controller\UsersMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getGroup(); break; - case \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_VIEW: + case \SP\Core\ActionsInterface::ACTION_USR_PROFILES_VIEW: $tpl->assign('header', _('Ver Perfil')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); $tpl->assign('isView', true); - $controller = new SP\Controller\UsersMgmtC($tpl); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getProfile(); break; - case \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_EDIT: + case \SP\Core\ActionsInterface::ACTION_USR_PROFILES_EDIT: $tpl->assign('header', _('Editar Perfil')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); - $controller = new SP\Controller\UsersMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getProfile(); break; - case \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_NEW: + case \SP\Core\ActionsInterface::ACTION_USR_PROFILES_NEW: $tpl->assign('header', _('Nuevo Perfil')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); - $controller = new SP\Controller\UsersMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getProfile(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_VIEW: + case \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS_VIEW: $tpl->assign('header', _('Ver Cliente')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_MGM); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_MGM); $tpl->assign('isView', true); - $controller = new SP\Controller\AccountsMgmtC($tpl); + $controller = new \SP\Controller\AccountsMgmtC($tpl); $controller->getCustomer(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT: + case \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT: $tpl->assign('header', _('Editar Cliente')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_MGM); - $controller = new SP\Controller\AccountsMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_MGM); + $controller = new \SP\Controller\AccountsMgmtC($tpl); $controller->getCustomer(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_NEW: + case \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS_NEW: $tpl->assign('header', _('Nuevo Cliente')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_MGM); - $controller = new SP\Controller\AccountsMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_MGM); + $controller = new \SP\Controller\AccountsMgmtC($tpl); $controller->getCustomer(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES_VIEW: + case \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES_VIEW: $tpl->assign('header', _('Ver Categoría')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_MGM); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_MGM); $tpl->assign('isView', true); - $controller = new SP\Controller\AccountsMgmtC($tpl); + $controller = new \SP\Controller\AccountsMgmtC($tpl); $controller->getCategory(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES_EDIT: + case \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES_EDIT: $tpl->assign('header', _('Editar Categoría')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_MGM); - $controller = new SP\Controller\AccountsMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_MGM); + $controller = new \SP\Controller\AccountsMgmtC($tpl); $controller->getCategory(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES_NEW: + case \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES_NEW: $tpl->assign('header', _('Nueva Categoría')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_MGM); - $controller = new SP\Controller\AccountsMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_MGM); + $controller = new \SP\Controller\AccountsMgmtC($tpl); $controller->getCategory(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS_VIEW: + case \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS_VIEW: $tpl->assign('header', _('Ver Autorización')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); $tpl->assign('isView', true); - $controller = new SP\Controller\UsersMgmtC($tpl); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getToken(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS_NEW: + case \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS_NEW: $tpl->assign('header', _('Nueva Autorización')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); - $controller = new SP\Controller\UsersMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getToken(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS_EDIT: + case \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS_EDIT: $tpl->assign('header', _('Editar Autorización')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_USR); - $controller = new SP\Controller\UsersMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_USR); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getToken(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW: + case \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW: $tpl->assign('header', _('Nuevo Campo')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_MGM); - $controller = new SP\Controller\AccountsMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_MGM); + $controller = new \SP\Controller\AccountsMgmtC($tpl); $controller->getCustomField(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT: + case \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT: $tpl->assign('header', _('Editar Campo')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_MGM); - $controller = new SP\Controller\AccountsMgmtC($tpl); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_MGM); + $controller = new \SP\Controller\AccountsMgmtC($tpl); $controller->getCustomField(); break; - case \SP\Controller\ActionsInterface::ACTION_MGM_PUBLICLINKS_VIEW: + case \SP\Core\ActionsInterface::ACTION_MGM_PUBLICLINKS_VIEW: $tpl->assign('header', _('Ver Enlace Público')); - $tpl->assign('onCloseAction', \SP\Controller\ActionsInterface::ACTION_MGM_PUBLICLINKS); + $tpl->assign('onCloseAction', \SP\Core\ActionsInterface::ACTION_MGM_PUBLICLINKS); $tpl->assign('isView', true); - $controller = new SP\Controller\UsersMgmtC($tpl); + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getPublicLink(); break; default : diff --git a/ajax/ajax_appMgmtSave.php b/ajax/ajax_appMgmtSave.php index 90ae5882..dcd48b5a 100644 --- a/ajax/ajax_appMgmtSave.php +++ b/ajax/ajax_appMgmtSave.php @@ -23,9 +23,10 @@ * */ -use SP\Request; -use SP\SessionUtil; -use SP\UserUtil; +use SP\Http\Request; +use SP\Core\SessionUtil; +use SP\Mgmt\User\UserUtil; +use SP\Util\Checks; define('APP_ROOT', '..'); @@ -33,196 +34,196 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Http\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); } -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printJSON(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printJSON(_('CONSULTA INVÁLIDA')); } // Variables POST del formulario -$actionId = SP\Request::analyze('actionId', 0); -$itemId = SP\Request::analyze('itemId', 0); -$onCloseAction = SP\Request::analyze('onCloseAction'); -$activeTab = SP\Request::analyze('activeTab', 0); -$customFields = SP\Request::analyze('customfield'); +$actionId = \SP\Http\Request::analyze('actionId', 0); +$itemId = \SP\Http\Request::analyze('itemId', 0); +$onCloseAction = \SP\Http\Request::analyze('onCloseAction'); +$activeTab = \SP\Http\Request::analyze('activeTab', 0); +$customFields = \SP\Http\Request::analyze('customfield'); // Acción al cerrar la vista $doActionOnClose = "sysPassUtil.Common.doAction('$onCloseAction','',$activeTab);"; $userLogin = UserUtil::getUserLoginById($itemId); -if ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_EDIT - || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_EDITPASS - || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_DELETE +if ($actionId === \SP\Core\ActionsInterface::ACTION_USR_USERS_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_USR_USERS_EDIT + || $actionId === \SP\Core\ActionsInterface::ACTION_USR_USERS_EDITPASS + || $actionId === \SP\Core\ActionsInterface::ACTION_USR_USERS_DELETE ) { - $isLdap = SP\Request::analyze('isLdap', 0); - $userPassR = SP\Request::analyzeEncrypted('passR'); + $isLdap = \SP\Http\Request::analyze('isLdap', 0); + $userPassR = \SP\Http\Request::analyzeEncrypted('passR'); - $User = new SP\User(); + $User = new \SP\Mgmt\User\User(); $User->setUserId($itemId); - $User->setUserName(SP\Request::analyze('name')); - $User->setUserLogin(SP\Request::analyze('login')); - $User->setUserEmail(SP\Request::analyze('email')); - $User->setUserNotes(SP\Request::analyze('notes')); - $User->setUserGroupId(SP\Request::analyze('groupid', 0)); - $User->setUserProfileId(SP\Request::analyze('profileid', 0)); - $User->setUserIsAdminApp(SP\Request::analyze('adminapp', 0, false, 1)); - $User->setUserIsAdminAcc(SP\Request::analyze('adminacc', 0, false, 1)); - $User->setUserIsDisabled(SP\Request::analyze('disabled', 0, false, 1)); - $User->setUserChangePass(SP\Request::analyze('changepass', 0, false, 1)); - $User->setUserPass(SP\Request::analyzeEncrypted('pass')); + $User->setUserName(\SP\Http\Request::analyze('name')); + $User->setUserLogin(\SP\Http\Request::analyze('login')); + $User->setUserEmail(\SP\Http\Request::analyze('email')); + $User->setUserNotes(\SP\Http\Request::analyze('notes')); + $User->setUserGroupId(\SP\Http\Request::analyze('groupid', 0)); + $User->setUserProfileId(\SP\Http\Request::analyze('profileid', 0)); + $User->setUserIsAdminApp(\SP\Http\Request::analyze('adminapp', 0, false, 1)); + $User->setUserIsAdminAcc(\SP\Http\Request::analyze('adminacc', 0, false, 1)); + $User->setUserIsDisabled(\SP\Http\Request::analyze('disabled', 0, false, 1)); + $User->setUserChangePass(\SP\Http\Request::analyze('changepass', 0, false, 1)); + $User->setUserPass(\SP\Http\Request::analyzeEncrypted('pass')); // Nuevo usuario o editar - if ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_EDIT + if ($actionId === \SP\Core\ActionsInterface::ACTION_USR_USERS_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_USR_USERS_EDIT ) { if (!$User->getUserName() && !$isLdap) { - SP\Response::printJSON(_('Es necesario un nombre de usuario'), 2); + \SP\Http\Response::printJSON(_('Es necesario un nombre de usuario'), 2); } elseif (!$User->getUserLogin() && !$isLdap) { - SP\Response::printJSON(_('Es necesario un login'), 2); + \SP\Http\Response::printJSON(_('Es necesario un login'), 2); } elseif (!$User->getUserProfileId()) { - SP\Response::printJSON(_('Es necesario un perfil'), 2); + \SP\Http\Response::printJSON(_('Es necesario un perfil'), 2); } elseif (!$User->getUserGroupId()) { - SP\Response::printJSON(_('Es necesario un grupo'), 2); + \SP\Http\Response::printJSON(_('Es necesario un grupo'), 2); } elseif (!$User->getUserEmail() && !$isLdap) { - SP\Response::printJSON(_('Es necesario un email'), 2); - } elseif (SP\Util::demoIsEnabled() && !\SP\Session::getUserIsAdminApp() && $User->getUserLogin() == 'demo') { - SP\Response::printJSON(_('Ey, esto es una DEMO!!')); + \SP\Http\Response::printJSON(_('Es necesario un email'), 2); + } elseif (Checks::demoIsEnabled() && !\SP\Core\Session::getUserIsAdminApp() && $User->getUserLogin() == 'demo') { + \SP\Http\Response::printJSON(_('Ey, esto es una DEMO!!')); } switch ($User->checkUserExist()) { case UserUtil::USER_LOGIN_EXIST: - SP\Response::printJSON(_('Login de usuario duplicado'), 2); + \SP\Http\Response::printJSON(_('Login de usuario duplicado'), 2); break; case UserUtil::USER_MAIL_EXIST: - SP\Response::printJSON(_('Email de usuario duplicado'), 2); + \SP\Http\Response::printJSON(_('Email de usuario duplicado'), 2); break; } - if ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_NEW) { + if ($actionId === \SP\Core\ActionsInterface::ACTION_USR_USERS_NEW) { if (!$User->getUserPass() || !$userPassR) { - SP\Response::printJSON(_('La clave no puede estar en blanco'), 2); + \SP\Http\Response::printJSON(_('La clave no puede estar en blanco'), 2); } elseif ($User->getUserPass() != $userPassR) { - SP\Response::printJSON(_('Las claves no coinciden'), 2); + \SP\Http\Response::printJSON(_('Las claves no coinciden'), 2); } if ($User->addUser()) { if (is_array($customFields)) { foreach ($customFields as $id => $value) { - $CustomFields = new \SP\CustomFields($id, $User->getUserId(), $value); + $CustomFields = new \SP\Mgmt\CustomFields($id, $User->getUserId(), $value); $CustomFields->addCustomField(); } } - SP\Response::printJSON(_('Usuario creado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Usuario creado'), 0, $doActionOnClose); } - SP\Response::printJSON(_('Error al crear el usuario')); - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_EDIT) { + \SP\Http\Response::printJSON(_('Error al crear el usuario')); + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_USR_USERS_EDIT) { if ($User->updateUser()) { if (is_array($customFields)) { foreach ($customFields as $id => $value) { - $CustomFields = new \SP\CustomFields($id, $User->getUserId(), $value); + $CustomFields = new \SP\Mgmt\CustomFields($id, $User->getUserId(), $value); $CustomFields->updateCustomField(); } } - SP\Response::printJSON(_('Usuario actualizado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Usuario actualizado'), 0, $doActionOnClose); } - SP\Response::printJSON(_('Error al actualizar el usuario')); + \SP\Http\Response::printJSON(_('Error al actualizar el usuario')); } - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_EDITPASS) { + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_USR_USERS_EDITPASS) { - if (SP\Util::demoIsEnabled() && UserUtil::getUserLoginById($itemId) == 'demo') { - SP\Response::printJSON(_('Ey, esto es una DEMO!!')); + if (Checks::demoIsEnabled() && UserUtil::getUserLoginById($itemId) == 'demo') { + \SP\Http\Response::printJSON(_('Ey, esto es una DEMO!!')); } elseif (!$User->getUserPass() || !$userPassR) { - SP\Response::printJSON(_('La clave no puede estar en blanco'), 2); + \SP\Http\Response::printJSON(_('La clave no puede estar en blanco'), 2); } elseif ($User->getUserPass() != $userPassR) { - SP\Response::printJSON(_('Las claves no coinciden'), 2); + \SP\Http\Response::printJSON(_('Las claves no coinciden'), 2); } if ($User->updateUserPass()) { - SP\Response::printJSON(_('Clave actualizada'), 0); + \SP\Http\Response::printJSON(_('Clave actualizada'), 0); } - SP\Response::printJSON(_('Error al modificar la clave')); + \SP\Http\Response::printJSON(_('Error al modificar la clave')); // Eliminar usuario - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_DELETE) { - if (SP\Util::demoIsEnabled() && UserUtil::getUserLoginById($itemId) == 'demo') { - SP\Response::printJSON(_('Ey, esto es una DEMO!!')); - } elseif ($User->getUserId() == SP\Session::getUserId()) { - SP\Response::printJSON(_('No es posible eliminar, usuario en uso')); + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_USR_USERS_DELETE) { + if (Checks::demoIsEnabled() && UserUtil::getUserLoginById($itemId) == 'demo') { + \SP\Http\Response::printJSON(_('Ey, esto es una DEMO!!')); + } elseif ($User->getUserId() == \SP\Core\Session::getUserId()) { + \SP\Http\Response::printJSON(_('No es posible eliminar, usuario en uso')); } - if ($User->deleteUser() && SP\CustomFields::deleteCustomFieldForItem($User->getUserId(), \SP\Controller\ActionsInterface::ACTION_USR_USERS)) { - SP\Response::printJSON(_('Usuario eliminado'), 0, $doActionOnClose); + if ($User->deleteUser() && \SP\Mgmt\CustomFields::deleteCustomFieldForItem($User->getUserId(), \SP\Core\ActionsInterface::ACTION_USR_USERS)) { + \SP\Http\Response::printJSON(_('Usuario eliminado'), 0, $doActionOnClose); } - SP\Response::printJSON(_('Error al eliminar el usuario')); + \SP\Http\Response::printJSON(_('Error al eliminar el usuario')); } -} elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_GROUPS_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_GROUPS_EDIT - || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_GROUPS_DELETE +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_USR_GROUPS_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_USR_GROUPS_EDIT + || $actionId === \SP\Core\ActionsInterface::ACTION_USR_GROUPS_DELETE ) { // Variables POST del formulario - $frmGrpName = SP\Request::analyze('name'); - $frmGrpDesc = SP\Request::analyze('description'); - $frmGrpUsers = SP\Request::analyze('users'); + $frmGrpName = \SP\Http\Request::analyze('name'); + $frmGrpDesc = \SP\Http\Request::analyze('description'); + $frmGrpUsers = \SP\Http\Request::analyze('users'); - if ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_GROUPS_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_GROUPS_EDIT + if ($actionId === \SP\Core\ActionsInterface::ACTION_USR_GROUPS_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_USR_GROUPS_EDIT ) { if (!$frmGrpName) { - SP\Response::printJSON(_('Es necesario un nombre de grupo'), 2); + \SP\Http\Response::printJSON(_('Es necesario un nombre de grupo'), 2); } - SP\Groups::$groupId = $itemId; - SP\Groups::$groupName = $frmGrpName; - SP\Groups::$groupDescription = $frmGrpDesc; + \SP\Mgmt\User\Groups::$groupId = $itemId; + \SP\Mgmt\User\Groups::$groupName = $frmGrpName; + \SP\Mgmt\User\Groups::$groupDescription = $frmGrpDesc; - if (SP\Groups::checkGroupExist()) { - SP\Response::printJSON(_('Nombre de grupo duplicado'), 2); + if (\SP\Mgmt\User\Groups::checkGroupExist()) { + \SP\Http\Response::printJSON(_('Nombre de grupo duplicado'), 2); } - if ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_GROUPS_NEW) { - if (SP\Groups::addGroup($frmGrpUsers)) { + if ($actionId === \SP\Core\ActionsInterface::ACTION_USR_GROUPS_NEW) { + if (\SP\Mgmt\User\Groups::addGroup($frmGrpUsers)) { if (is_array($customFields)) { foreach ($customFields as $id => $value) { - $CustomFields = new \SP\CustomFields($id, SP\Groups::$queryLastId, $value); + $CustomFields = new \SP\Mgmt\CustomFields($id, \SP\Mgmt\User\Groups::$queryLastId, $value); $CustomFields->addCustomField(); } } - SP\Response::printJSON(_('Grupo creado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Grupo creado'), 0, $doActionOnClose); } else { - SP\Response::printJSON(_('Error al crear el grupo')); + \SP\Http\Response::printJSON(_('Error al crear el grupo')); } - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_GROUPS_EDIT) { - if (SP\Groups::updateGroup($frmGrpUsers)) { + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_USR_GROUPS_EDIT) { + if (\SP\Mgmt\User\Groups::updateGroup($frmGrpUsers)) { if (is_array($customFields)) { foreach ($customFields as $id => $value) { - $CustomFields = new \SP\CustomFields($id, $itemId, $value); + $CustomFields = new \SP\Mgmt\CustomFields($id, $itemId, $value); $CustomFields->updateCustomField(); } } - SP\Response::printJSON(_('Grupo actualizado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Grupo actualizado'), 0, $doActionOnClose); } - SP\Response::printJSON(_('Error al actualizar el grupo')); + \SP\Http\Response::printJSON(_('Error al actualizar el grupo')); } - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_GROUPS_DELETE) { - SP\Groups::$groupId = $itemId; + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_USR_GROUPS_DELETE) { + \SP\Mgmt\User\Groups::$groupId = $itemId; - $resGroupUse = SP\Groups::checkGroupInUse(); + $resGroupUse = \SP\Mgmt\User\Groups::checkGroupInUse(); if ($resGroupUse['users'] > 0 || $resGroupUse['accounts'] > 0) { if ($resGroupUse['users'] > 0) { @@ -233,342 +234,342 @@ if ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_USERS_NEW $uses[] = _('Cuentas') . " (" . $resGroupUse['accounts'] . ")"; } - SP\Response::printJSON(_('No es posible eliminar') . ';;' . _('Grupo en uso por:') . ';;' . implode(';;', $uses)); + \SP\Http\Response::printJSON(_('No es posible eliminar') . ';;' . _('Grupo en uso por:') . ';;' . implode(';;', $uses)); } else { - $groupName = SP\Groups::getGroupNameById($itemId); + $groupName = \SP\Mgmt\User\Groups::getGroupNameById($itemId); - if (SP\Groups::deleteGroup() && SP\CustomFields::deleteCustomFieldForItem($itemId, \SP\Controller\ActionsInterface::ACTION_USR_GROUPS)) { - SP\Response::printJSON(_('Grupo eliminado'), 0, $doActionOnClose); + if (\SP\Mgmt\User\Groups::deleteGroup() && \SP\Mgmt\CustomFields::deleteCustomFieldForItem($itemId, \SP\Core\ActionsInterface::ACTION_USR_GROUPS)) { + \SP\Http\Response::printJSON(_('Grupo eliminado'), 0, $doActionOnClose); } - SP\Response::printJSON(_('Error al eliminar el grupo')); + \SP\Http\Response::printJSON(_('Error al eliminar el grupo')); } } -} elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_EDIT - || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_DELETE +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_USR_PROFILES_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_USR_PROFILES_EDIT + || $actionId === \SP\Core\ActionsInterface::ACTION_USR_PROFILES_DELETE ) { - $Profile = new \SP\Profile(); + $Profile = new \SP\Mgmt\User\Profile(); // Variables POST del formulario - $name = SP\Request::analyze('profile_name'); + $name = \SP\Http\Request::analyze('profile_name'); $Profile->setName($name); - $Profile->setId(SP\Request::analyze('itemId', 0)); - $Profile->setAccAdd(SP\Request::analyze('profile_accadd', 0, false, 1)); - $Profile->setAccView(SP\Request::analyze('profile_accview', 0, false, 1)); - $Profile->setAccViewPass(SP\Request::analyze('profile_accviewpass', 0, false, 1)); - $Profile->setAccViewHistory(SP\Request::analyze('profile_accviewhistory', 0, false, 1)); - $Profile->setAccEdit(SP\Request::analyze('profile_accedit', 0, false, 1)); - $Profile->setAccEditPass(SP\Request::analyze('profile_acceditpass', 0, false, 1)); - $Profile->setAccDelete(SP\Request::analyze('profile_accdel', 0, false, 1)); - $Profile->setAccFiles(SP\Request::analyze('profile_accfiles', 0, false, 1)); - $Profile->setAccPublicLinks(SP\Request::analyze('profile_accpublinks', 0, false, 1)); - $Profile->setConfigGeneral(SP\Request::analyze('profile_config', 0, false, 1)); - $Profile->setConfigEncryption(SP\Request::analyze('profile_configmpw', 0, false, 1)); - $Profile->setConfigBackup(SP\Request::analyze('profile_configback', 0, false, 1)); - $Profile->setConfigImport(SP\Request::analyze('profile_configimport', 0, false, 1)); - $Profile->setMgmCategories(SP\Request::analyze('profile_categories', 0, false, 1)); - $Profile->setMgmCustomers(SP\Request::analyze('profile_customers', 0, false, 1)); - $Profile->setMgmCustomFields(SP\Request::analyze('profile_customfields', 0, false, 1)); - $Profile->setMgmUsers(SP\Request::analyze('profile_users', 0, false, 1)); - $Profile->setMgmGroups(SP\Request::analyze('profile_groups', 0, false, 1)); - $Profile->setMgmProfiles(SP\Request::analyze('profile_profiles', 0, false, 1)); - $Profile->setMgmApiTokens(SP\Request::analyze('profile_apitokens', 0, false, 1)); - $Profile->setMgmPublicLinks(SP\Request::analyze('profile_publinks', 0, false, 1)); - $Profile->setEvl(SP\Request::analyze('profile_eventlog', 0, false, 1)); + $Profile->setId(\SP\Http\Request::analyze('itemId', 0)); + $Profile->setAccAdd(\SP\Http\Request::analyze('profile_accadd', 0, false, 1)); + $Profile->setAccView(\SP\Http\Request::analyze('profile_accview', 0, false, 1)); + $Profile->setAccViewPass(\SP\Http\Request::analyze('profile_accviewpass', 0, false, 1)); + $Profile->setAccViewHistory(\SP\Http\Request::analyze('profile_accviewhistory', 0, false, 1)); + $Profile->setAccEdit(\SP\Http\Request::analyze('profile_accedit', 0, false, 1)); + $Profile->setAccEditPass(\SP\Http\Request::analyze('profile_acceditpass', 0, false, 1)); + $Profile->setAccDelete(\SP\Http\Request::analyze('profile_accdel', 0, false, 1)); + $Profile->setAccFiles(\SP\Http\Request::analyze('profile_accfiles', 0, false, 1)); + $Profile->setAccPublicLinks(\SP\Http\Request::analyze('profile_accpublinks', 0, false, 1)); + $Profile->setConfigGeneral(\SP\Http\Request::analyze('profile_config', 0, false, 1)); + $Profile->setConfigEncryption(\SP\Http\Request::analyze('profile_configmpw', 0, false, 1)); + $Profile->setConfigBackup(\SP\Http\Request::analyze('profile_configback', 0, false, 1)); + $Profile->setConfigImport(\SP\Http\Request::analyze('profile_configimport', 0, false, 1)); + $Profile->setMgmCategories(\SP\Http\Request::analyze('profile_categories', 0, false, 1)); + $Profile->setMgmCustomers(\SP\Http\Request::analyze('profile_customers', 0, false, 1)); + $Profile->setMgmCustomFields(\SP\Http\Request::analyze('profile_customfields', 0, false, 1)); + $Profile->setMgmUsers(\SP\Http\Request::analyze('profile_users', 0, false, 1)); + $Profile->setMgmGroups(\SP\Http\Request::analyze('profile_groups', 0, false, 1)); + $Profile->setMgmProfiles(\SP\Http\Request::analyze('profile_profiles', 0, false, 1)); + $Profile->setMgmApiTokens(\SP\Http\Request::analyze('profile_apitokens', 0, false, 1)); + $Profile->setMgmPublicLinks(\SP\Http\Request::analyze('profile_publinks', 0, false, 1)); + $Profile->setEvl(\SP\Http\Request::analyze('profile_eventlog', 0, false, 1)); - if ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_EDIT + if ($actionId === \SP\Core\ActionsInterface::ACTION_USR_PROFILES_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_USR_PROFILES_EDIT ) { if (!$Profile->getName()) { - SP\Response::printJSON(_('Es necesario un nombre de perfil'), 2); - } elseif (SP\Profile::checkProfileExist($Profile->getId(), $Profile->getName())) { - SP\Response::printJSON(_('Nombre de perfil duplicado'), 2); + \SP\Http\Response::printJSON(_('Es necesario un nombre de perfil'), 2); + } elseif (\SP\Mgmt\User\Profile::checkProfileExist($Profile->getId(), $Profile->getName())) { + \SP\Http\Response::printJSON(_('Nombre de perfil duplicado'), 2); } - if ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_NEW) { + if ($actionId === \SP\Core\ActionsInterface::ACTION_USR_PROFILES_NEW) { if ($Profile->profileAdd()) { - SP\Response::printJSON(_('Perfil creado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Perfil creado'), 0, $doActionOnClose); } - SP\Response::printJSON(_('Error al crear el perfil')); - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_EDIT) { + \SP\Http\Response::printJSON(_('Error al crear el perfil')); + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_USR_PROFILES_EDIT) { if ($Profile->profileUpdate()) { - SP\Response::printJSON(_('Perfil actualizado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Perfil actualizado'), 0, $doActionOnClose); } - SP\Response::printJSON(_('Error al actualizar el perfil')); + \SP\Http\Response::printJSON(_('Error al actualizar el perfil')); } - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_USR_PROFILES_DELETE) { - $resProfileUse = SP\Profile::checkProfileInUse($Profile->getId()); + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_USR_PROFILES_DELETE) { + $resProfileUse = \SP\Mgmt\User\Profile::checkProfileInUse($Profile->getId()); if ($resProfileUse['users'] > 0) { $uses[] = _('Usuarios') . " (" . $resProfileUse['users'] . ")"; - SP\Response::printJSON(_('No es posible eliminar') . ';;' . _('Perfil en uso por:') . ';;' . implode(';;', $uses)); + \SP\Http\Response::printJSON(_('No es posible eliminar') . ';;' . _('Perfil en uso por:') . ';;' . implode(';;', $uses)); } else { if ($Profile->profileDelete()) { - SP\Response::printJSON(_('Perfil eliminado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Perfil eliminado'), 0, $doActionOnClose); } - SP\Response::printJSON(_('Error al eliminar el perfil')); + \SP\Http\Response::printJSON(_('Error al eliminar el perfil')); } } -} elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_DELETE +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS_DELETE ) { // Variables POST del formulario - $frmCustomerName = SP\Request::analyze('name'); - $frmCustomerDesc = SP\Request::analyze('description'); + $frmCustomerName = \SP\Http\Request::analyze('name'); + $frmCustomerDesc = \SP\Http\Request::analyze('description'); - if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT + if ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT ) { if (!$frmCustomerName) { - SP\Response::printJSON(_('Es necesario un nombre de cliente'), 2); + \SP\Http\Response::printJSON(_('Es necesario un nombre de cliente'), 2); } - SP\Customer::$customerName = $frmCustomerName; - SP\Customer::$customerDescription = $frmCustomerDesc; + \SP\Mgmt\Customer::$customerName = $frmCustomerName; + \SP\Mgmt\Customer::$customerDescription = $frmCustomerDesc; - if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_NEW) { + if ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS_NEW) { try { - SP\Customer::addCustomer($itemId); + \SP\Mgmt\Customer::addCustomer($itemId); if (is_array($customFields)) { foreach ($customFields as $id => $value) { - $CustomFields = new \SP\CustomFields($id, SP\Customer::$customerLastId, $value); + $CustomFields = new \SP\Mgmt\CustomFields($id, \SP\Mgmt\Customer::$customerLastId, $value); $CustomFields->addCustomField(); } } - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage(), 2); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage(), 2); } - SP\Response::printJSON(_('Cliente creado'), 0, $doActionOnClose); - } else if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT) { + \SP\Http\Response::printJSON(_('Cliente creado'), 0, $doActionOnClose); + } else if ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS_EDIT) { try { - SP\Customer::updateCustomer($itemId); + \SP\Mgmt\Customer::updateCustomer($itemId); if (is_array($customFields)) { foreach ($customFields as $id => $value) { - $CustomFields = new \SP\CustomFields($id, $itemId, $value); + $CustomFields = new \SP\Mgmt\CustomFields($id, $itemId, $value); $CustomFields->updateCustomField(); } } - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage(), 2); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage(), 2); } - SP\Response::printJSON(_('Cliente actualizado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Cliente actualizado'), 0, $doActionOnClose); } - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS_DELETE) { + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS_DELETE) { try { - SP\Customer::deleteCustomer($itemId); - SP\CustomFields::deleteCustomFieldForItem($itemId, \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMERS); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage()); + \SP\Mgmt\Customer::deleteCustomer($itemId); + \SP\Mgmt\CustomFields::deleteCustomFieldForItem($itemId, \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMERS); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage()); } - SP\Response::printJSON(_('Cliente eliminado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Cliente eliminado'), 0, $doActionOnClose); } -} elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES_EDIT - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES_DELETE +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES_EDIT + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES_DELETE ) { // Variables POST del formulario - $frmCategoryName = SP\Request::analyze('name'); - $frmCategoryDesc = SP\Request::analyze('description'); + $frmCategoryName = \SP\Http\Request::analyze('name'); + $frmCategoryDesc = \SP\Http\Request::analyze('description'); - if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES_EDIT + if ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES_EDIT ) { if (!$frmCategoryName) { - SP\Response::printJSON(_('Es necesario un nombre de categoría'), 2); + \SP\Http\Response::printJSON(_('Es necesario un nombre de categoría'), 2); } - SP\Category::$categoryName = $frmCategoryName; - SP\Category::$categoryDescription = $frmCategoryDesc; + \SP\Mgmt\Category::$categoryName = $frmCategoryName; + \SP\Mgmt\Category::$categoryDescription = $frmCategoryDesc; - if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES_NEW) { + if ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES_NEW) { try { - SP\Category::addCategory(); + \SP\Mgmt\Category::addCategory(); if (is_array($customFields)) { foreach ($customFields as $id => $value) { - $CustomFields = new \SP\CustomFields($id, SP\Category::$categoryLastId, $value); + $CustomFields = new \SP\Mgmt\CustomFields($id, \SP\Mgmt\Category::$categoryLastId, $value); $CustomFields->addCustomField(); } } - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage(), 2); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage(), 2); } - SP\Response::printJSON(_('Categoría creada'), 0, $doActionOnClose); - } else if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES_EDIT) { + \SP\Http\Response::printJSON(_('Categoría creada'), 0, $doActionOnClose); + } else if ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES_EDIT) { try { - SP\Category::updateCategory($itemId); + \SP\Mgmt\Category::updateCategory($itemId); if (is_array($customFields)) { foreach ($customFields as $id => $value) { - $CustomFields = new \SP\CustomFields($id, $itemId, $value); + $CustomFields = new \SP\Mgmt\CustomFields($id, $itemId, $value); $CustomFields->updateCustomField(); } } - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage(), 2); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage(), 2); } - SP\Response::printJSON(_('Categoría actualizada'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Categoría actualizada'), 0, $doActionOnClose); } - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES_DELETE) { + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES_DELETE) { try { - SP\Category::deleteCategory($itemId); - SP\CustomFields::deleteCustomFieldForItem($itemId, \SP\Controller\ActionsInterface::ACTION_MGM_CATEGORIES); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage()); + \SP\Mgmt\Category::deleteCategory($itemId); + \SP\Mgmt\CustomFields::deleteCustomFieldForItem($itemId, \SP\Core\ActionsInterface::ACTION_MGM_CATEGORIES); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage()); } - SP\Response::printJSON(_('Categoría eliminada'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Categoría eliminada'), 0, $doActionOnClose); } -} elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS_EDIT - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS_DELETE +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS_EDIT + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS_DELETE ) { - $ApiTokens = new \SP\ApiTokens(); + $ApiTokens = new \SP\Api\ApiTokens(); $ApiTokens->setTokenId($itemId); - $ApiTokens->setUserId(SP\Request::analyze('users', 0)); - $ApiTokens->setActionId(SP\Request::analyze('actions', 0)); - $ApiTokens->setRefreshToken(SP\Request::analyze('refreshtoken', false, false, true)); + $ApiTokens->setUserId(\SP\Http\Request::analyze('users', 0)); + $ApiTokens->setActionId(\SP\Http\Request::analyze('actions', 0)); + $ApiTokens->setRefreshToken(\SP\Http\Request::analyze('refreshtoken', false, false, true)); - if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS_EDIT + if ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS_EDIT ) { if ($ApiTokens->getUserId() === 0 || $ApiTokens->getActionId() === 0) { - SP\Response::printJSON(_('Usuario o acción no indicado'), 2); + \SP\Http\Response::printJSON(_('Usuario o acción no indicado'), 2); } - if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS_NEW) { + if ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS_NEW) { try { $ApiTokens->addToken(); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage(), 2); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage(), 2); } - SP\Response::printJSON(_('Autorización creada'), 0, $doActionOnClose); - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS_EDIT) { + \SP\Http\Response::printJSON(_('Autorización creada'), 0, $doActionOnClose); + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS_EDIT) { try { $ApiTokens->updateToken(); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage(), 2); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage(), 2); } - SP\Response::printJSON(_('Autorización actualizada'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Autorización actualizada'), 0, $doActionOnClose); } - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS_DELETE) { + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS_DELETE) { try { $ApiTokens->deleteToken(); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage(), 2); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage(), 2); } - SP\Response::printJSON(_('Autorización eliminada'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Autorización eliminada'), 0, $doActionOnClose); } -} elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_DELETE +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_DELETE ) { // Variables POST del formulario - $frmFieldName = SP\Request::analyze('name'); - $frmFieldType = SP\Request::analyze('type', 0); - $frmFieldModule = SP\Request::analyze('module', 0); - $frmFieldHelp = SP\Request::analyze('help'); - $frmFieldRequired = SP\Request::analyze('required', false, false, true); + $frmFieldName = \SP\Http\Request::analyze('name'); + $frmFieldType = \SP\Http\Request::analyze('type', 0); + $frmFieldModule = \SP\Http\Request::analyze('module', 0); + $frmFieldHelp = \SP\Http\Request::analyze('help'); + $frmFieldRequired = \SP\Http\Request::analyze('required', false, false, true); - if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT + if ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT ) { if (!$frmFieldName) { - SP\Response::printJSON(_('Nombre del campo no indicado'), 2); + \SP\Http\Response::printJSON(_('Nombre del campo no indicado'), 2); } elseif ($frmFieldType === 0) { - SP\Response::printJSON(_('Tipo del campo no indicado'), 2); + \SP\Http\Response::printJSON(_('Tipo del campo no indicado'), 2); } elseif ($frmFieldModule === 0) { - SP\Response::printJSON(_('Módulo del campo no indicado'), 2); + \SP\Http\Response::printJSON(_('Módulo del campo no indicado'), 2); } - $CustomFieldDef = new \SP\CustomFieldDef($frmFieldName, $frmFieldType, $frmFieldModule); + $CustomFieldDef = new \SP\Mgmt\CustomFieldDef($frmFieldName, $frmFieldType, $frmFieldModule); $CustomFieldDef->setHelp($frmFieldHelp); $CustomFieldDef->setRequired($frmFieldRequired); - if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW) { + if ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_NEW) { try { $CustomFieldDef->addCustomField(); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage(), 2); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage(), 2); } - SP\Response::printJSON(_('Campo creado'), 0, $doActionOnClose); - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT) { + \SP\Http\Response::printJSON(_('Campo creado'), 0, $doActionOnClose); + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_EDIT) { try { $CustomFieldDef->setId($itemId); $CustomFieldDef->updateCustomField(); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage(), 2); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage(), 2); } - SP\Response::printJSON(_('Campo actualizado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Campo actualizado'), 0, $doActionOnClose); } - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_DELETE) { + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_CUSTOMFIELDS_DELETE) { try { - \SP\CustomFieldDef::deleteCustomField($itemId); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage(), 2); + \SP\Mgmt\CustomFieldDef::deleteCustomField($itemId); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage(), 2); } - SP\Response::printJSON(_('Campo eliminado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Campo eliminado'), 0, $doActionOnClose); } -} elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_PUBLICLINKS_NEW - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_PUBLICLINKS_DELETE - || $actionId === \SP\Controller\ActionsInterface::ACTION_MGM_PUBLICLINKS_REFRESH +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_PUBLICLINKS_NEW + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_PUBLICLINKS_DELETE + || $actionId === \SP\Core\ActionsInterface::ACTION_MGM_PUBLICLINKS_REFRESH ) { - if ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_PUBLICLINKS_NEW) { - $frmFieldNotify = SP\Request::analyze('notify', false, false, true); - $doActionOnClose = "sysPassUtil.Common.doAction(" . \SP\Controller\ActionsInterface::ACTION_ACC_VIEW . ",'',$itemId);"; + if ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_PUBLICLINKS_NEW) { + $frmFieldNotify = \SP\Http\Request::analyze('notify', false, false, true); + $doActionOnClose = "sysPassUtil.Common.doAction(" . \SP\Core\ActionsInterface::ACTION_ACC_VIEW . ",'',$itemId);"; try { - $PublicLink = new \SP\PublicLink($itemId, \SP\PublicLink::TYPE_ACCOUNT); + $PublicLink = new \SP\Mgmt\PublicLink($itemId, \SP\Mgmt\PublicLink::TYPE_ACCOUNT); $PublicLink->setNotify($frmFieldNotify); $PublicLink->newLink(); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage()); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage()); } - SP\Response::printJSON(_('Enlace creado'), 0, $doActionOnClose); - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_PUBLICLINKS_DELETE) { + \SP\Http\Response::printJSON(_('Enlace creado'), 0, $doActionOnClose); + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_PUBLICLINKS_DELETE) { try { - $PublicLink = new \SP\PublicLink($itemId, \SP\PublicLink::TYPE_ACCOUNT); + $PublicLink = new \SP\Mgmt\PublicLink($itemId, \SP\Mgmt\PublicLink::TYPE_ACCOUNT); $PublicLink->deleteLink(); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage()); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage()); } - SP\Response::printJSON(_('Enlace eliminado'), 0, $doActionOnClose); - } elseif ($actionId === \SP\Controller\ActionsInterface::ACTION_MGM_PUBLICLINKS_REFRESH) { + \SP\Http\Response::printJSON(_('Enlace eliminado'), 0, $doActionOnClose); + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_MGM_PUBLICLINKS_REFRESH) { try { - $PublicLink = \SP\PublicLink::getLinkById($itemId); + $PublicLink = \SP\Mgmt\PublicLink::getLinkById($itemId); $PublicLink->refreshLink(); - } catch (\SP\SPException $e) { - SP\Response::printJSON($e->getMessage()); + } catch (\SP\Core\SPException $e) { + \SP\Http\Response::printJSON($e->getMessage()); } - SP\Response::printJSON(_('Enlace actualizado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Enlace actualizado'), 0, $doActionOnClose); } } else { - SP\Response::printJSON(_('Acción Inválida')); + \SP\Http\Response::printJSON(_('Acción Inválida')); } \ No newline at end of file diff --git a/ajax/ajax_backup.php b/ajax/ajax_backup.php index 7e65e8c3..5bce8714 100644 --- a/ajax/ajax_backup.php +++ b/ajax/ajax_backup.php @@ -23,58 +23,59 @@ * */ -use SP\SessionUtil; +use SP\Core\SessionUtil; +use SP\Util\Checks; define('APP_ROOT', '..'); require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; -SP\Request::checkReferer('POST'); +\SP\Http\Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Http\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); } -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printJSON(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printJSON(_('CONSULTA INVÁLIDA')); } -$actionId = SP\Request::analyze('actionId', 0); -$onCloseAction = SP\Request::analyze('onCloseAction'); -$activeTab = SP\Request::analyze('activeTab', 0); -$exportPassword = SP\Request::analyzeEncrypted('exportPwd'); -$exportPasswordR = SP\Request::analyzeEncrypted('exportPwdR'); +$actionId = \SP\Http\Request::analyze('actionId', 0); +$onCloseAction = \SP\Http\Request::analyze('onCloseAction'); +$activeTab = \SP\Http\Request::analyze('activeTab', 0); +$exportPassword = \SP\Http\Request::analyzeEncrypted('exportPwd'); +$exportPasswordR = \SP\Http\Request::analyzeEncrypted('exportPwdR'); $doActionOnClose = "sysPassUtil.Common.doAction($actionId,'',$activeTab);"; -if ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_BACKUP) { - if (SP\Util::demoIsEnabled()) { - SP\Response::printJSON(_('Ey, esto es una DEMO!!')); +if ($actionId === \SP\Core\ActionsInterface::ACTION_CFG_BACKUP) { + if (Checks::demoIsEnabled()) { + \SP\Http\Response::printJSON(_('Ey, esto es una DEMO!!')); } - if (!SP\Backup::doBackup()) { - SP\Log::writeNewLogAndEmail(_('Realizar Backup'), _('Error al realizar el backup')); + if (!\SP\Core\Backup::doBackup()) { + \SP\Log\Log::writeNewLogAndEmail(_('Realizar Backup'), _('Error al realizar el backup')); - SP\Response::printJSON(_('Error al realizar el backup') . ';;' . _('Revise el registro de eventos para más detalles')); + \SP\Http\Response::printJSON(_('Error al realizar el backup') . ';;' . _('Revise el registro de eventos para más detalles')); } - SP\Log::writeNewLogAndEmail(_('Realizar Backup'), _('Copia de la aplicación y base de datos realizada correctamente')); + \SP\Log\Log::writeNewLogAndEmail(_('Realizar Backup'), _('Copia de la aplicación y base de datos realizada correctamente')); - SP\Response::printJSON(_('Proceso de backup finalizado'), 0, $doActionOnClose); -} elseif ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_EXPORT) { + \SP\Http\Response::printJSON(_('Proceso de backup finalizado'), 0, $doActionOnClose); +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_CFG_EXPORT) { if (!empty($exportPassword) && $exportPassword !== $exportPasswordR){ - SP\Response::printJSON(_('Las claves no coinciden')); + \SP\Http\Response::printJSON(_('Las claves no coinciden')); } - if(!\SP\XmlExport::doExport($exportPassword)){ - SP\Log::writeNewLogAndEmail(_('Realizar Exportación'), _('Error al realizar la exportación de cuentas')); + if(!\SP\Core\XmlExport::doExport($exportPassword)){ + \SP\Log\Log::writeNewLogAndEmail(_('Realizar Exportación'), _('Error al realizar la exportación de cuentas')); - SP\Response::printJSON(_('Error al realizar la exportación') . ';;' . _('Revise el registro de eventos para más detalles')); + \SP\Http\Response::printJSON(_('Error al realizar la exportación') . ';;' . _('Revise el registro de eventos para más detalles')); } - SP\Log::writeNewLogAndEmail(_('Realizar Exportación'), _('Exportación de cuentas realizada correctamente')); + \SP\Log\Log::writeNewLogAndEmail(_('Realizar Exportación'), _('Exportación de cuentas realizada correctamente')); - SP\Response::printJSON(_('Proceso de exportación finalizado'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Proceso de exportación finalizado'), 0, $doActionOnClose); } \ No newline at end of file diff --git a/ajax/ajax_checkLdap.php b/ajax/ajax_checkLdap.php index 881cd3ad..dcfb6b25 100644 --- a/ajax/ajax_checkLdap.php +++ b/ajax/ajax_checkLdap.php @@ -23,8 +23,8 @@ * */ -use SP\Request; -use SP\SessionUtil; +use SP\Http\Request; +use SP\Core\SessionUtil; define('APP_ROOT', '..'); @@ -32,30 +32,30 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Http\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); } -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printJSON(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printJSON(_('CONSULTA INVÁLIDA')); } -$frmLdapServer = SP\Request::analyze('ldap_server'); -$frmLdapBase = SP\Request::analyze('ldap_base'); -$frmLdapGroup = SP\Request::analyze('ldap_group'); -$frmLdapBindUser = SP\Request::analyze('ldap_binduser'); -$frmLdapBindPass = SP\Request::analyzeEncrypted('ldap_bindpass'); +$frmLdapServer = \SP\Http\Request::analyze('ldap_server'); +$frmLdapBase = \SP\Http\Request::analyze('ldap_base'); +$frmLdapGroup = \SP\Http\Request::analyze('ldap_group'); +$frmLdapBindUser = \SP\Http\Request::analyze('ldap_binduser'); +$frmLdapBindPass = \SP\Http\Request::analyzeEncrypted('ldap_bindpass'); if (!$frmLdapServer || !$frmLdapBase || !$frmLdapBindUser || !$frmLdapBindPass) { - SP\Response::printJSON(_('Los parámetros de LDAP no están configurados')); + \SP\Http\Response::printJSON(_('Los parámetros de LDAP no están configurados')); } -$resCheckLdap = SP\Ldap::checkLDAPConn($frmLdapServer, $frmLdapBindUser, $frmLdapBindPass, $frmLdapBase, $frmLdapGroup); +$resCheckLdap = \SP\Auth\Ldap::checkLDAPConn($frmLdapServer, $frmLdapBindUser, $frmLdapBindPass, $frmLdapBase, $frmLdapGroup); if ($resCheckLdap === false) { - SP\Response::printJSON(_('Error de conexión a LDAP') . ';;' . _('Revise el registro de eventos para más detalles')); + \SP\Http\Response::printJSON(_('Error de conexión a LDAP') . ';;' . _('Revise el registro de eventos para más detalles')); } else { - SP\Response::printJSON(_('Conexión a LDAP correcta') . ';;' . _('Objetos encontrados') . ': ' . $resCheckLdap, 0); + \SP\Http\Response::printJSON(_('Conexión a LDAP correcta') . ';;' . _('Objetos encontrados') . ': ' . $resCheckLdap, 0); } \ No newline at end of file diff --git a/ajax/ajax_checkUpds.php b/ajax/ajax_checkUpds.php index 25d6fd78..6d65b59b 100644 --- a/ajax/ajax_checkUpds.php +++ b/ajax/ajax_checkUpds.php @@ -28,7 +28,7 @@ define('APP_ROOT', '..'); require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; -SP\Request::checkReferer('GET'); +\SP\Http\Request::checkReferer('GET'); $controller = new \SP\Controller\MainC(null, null, false); $controller->getCheckUpdates(); diff --git a/ajax/ajax_configSave.php b/ajax/ajax_configSave.php index 418647f8..2abf7851 100644 --- a/ajax/ajax_configSave.php +++ b/ajax/ajax_configSave.php @@ -23,217 +23,218 @@ * */ -use SP\ConfigDB; -use SP\CryptMasterPass; -use SP\SessionUtil; -use SP\UserPass; +use SP\Config\ConfigDB; +use SP\Core\CryptMasterPass; +use SP\Core\SessionUtil; +use SP\Mgmt\User\UserPass; +use SP\Util\Checks; define('APP_ROOT', '..'); require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; -SP\Request::checkReferer('POST'); +\SP\Http\Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Http\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); } -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printJSON(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printJSON(_('CONSULTA INVÁLIDA')); } // Variables POST del formulario -$actionId = SP\Request::analyze('actionId', 0); -$activeTab = SP\Request::analyze('activeTab', 0); +$actionId = \SP\Http\Request::analyze('actionId', 0); +$activeTab = \SP\Http\Request::analyze('activeTab', 0); $doActionOnClose = "sysPassUtil.Common.doAction($actionId,'',$activeTab);"; -if ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_GENERAL - || $actionId === SP\Controller\ActionsInterface::ACTION_CFG_WIKI - || $actionId === SP\Controller\ActionsInterface::ACTION_CFG_LDAP - || $actionId === SP\Controller\ActionsInterface::ACTION_CFG_MAIL +if ($actionId === \SP\Core\ActionsInterface::ACTION_CFG_GENERAL + || $actionId === \SP\Core\ActionsInterface::ACTION_CFG_WIKI + || $actionId === \SP\Core\ActionsInterface::ACTION_CFG_LDAP + || $actionId === \SP\Core\ActionsInterface::ACTION_CFG_MAIL ) { - $Log = SP\Log::newLog(_('Modificar Configuración')); + $Log = \SP\Log\Log::newLog(_('Modificar Configuración')); - if ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_GENERAL) { + if ($actionId === \SP\Core\ActionsInterface::ACTION_CFG_GENERAL) { // General - $siteLang = SP\Request::analyze('sitelang'); - $siteTheme = SP\Request::analyze('sitetheme', 'material-blue'); - $sessionTimeout = SP\Request::analyze('session_timeout', 300); - $httpsEnabled = SP\Request::analyze('https_enabled', false, false, true); - $logEnabled = SP\Request::analyze('log_enabled', false, false, true); - $debugEnabled = SP\Request::analyze('debug', false, false, true); - $maintenanceEnabled = SP\Request::analyze('maintenance', false, false, true); - $checkUpdatesEnabled = SP\Request::analyze('updates', false, false, true); - $checkNoticesEnabled = SP\Request::analyze('notices', false, false, true); + $siteLang = \SP\Http\Request::analyze('sitelang'); + $siteTheme = \SP\Http\Request::analyze('sitetheme', 'material-blue'); + $sessionTimeout = \SP\Http\Request::analyze('session_timeout', 300); + $httpsEnabled = \SP\Http\Request::analyze('https_enabled', false, false, true); + $logEnabled = \SP\Http\Request::analyze('log_enabled', false, false, true); + $debugEnabled = \SP\Http\Request::analyze('debug', false, false, true); + $maintenanceEnabled = \SP\Http\Request::analyze('maintenance', false, false, true); + $checkUpdatesEnabled = \SP\Http\Request::analyze('updates', false, false, true); + $checkNoticesEnabled = \SP\Http\Request::analyze('notices', false, false, true); - SP\Config::setCacheConfigValue('sitelang', $siteLang); - SP\Config::setCacheConfigValue('sitetheme', $siteTheme); - SP\Config::setCacheConfigValue('session_timeout', $sessionTimeout); - SP\Config::setCacheConfigValue('https_enabled', $httpsEnabled); - SP\Config::setCacheConfigValue('log_enabled', $logEnabled); - SP\Config::setCacheConfigValue('debug', $debugEnabled); - SP\Config::setCacheConfigValue('maintenance', $maintenanceEnabled); - SP\Config::setCacheConfigValue('checkupdates', $checkUpdatesEnabled); - SP\Config::setCacheConfigValue('checknotices', $checkNoticesEnabled); + \SP\Config\Config::setCacheConfigValue('sitelang', $siteLang); + \SP\Config\Config::setCacheConfigValue('sitetheme', $siteTheme); + \SP\Config\Config::setCacheConfigValue('session_timeout', $sessionTimeout); + \SP\Config\Config::setCacheConfigValue('https_enabled', $httpsEnabled); + \SP\Config\Config::setCacheConfigValue('log_enabled', $logEnabled); + \SP\Config\Config::setCacheConfigValue('debug', $debugEnabled); + \SP\Config\Config::setCacheConfigValue('maintenance', $maintenanceEnabled); + \SP\Config\Config::setCacheConfigValue('checkupdates', $checkUpdatesEnabled); + \SP\Config\Config::setCacheConfigValue('checknotices', $checkNoticesEnabled); // Accounts - $globalSearchEnabled = SP\Request::analyze('globalsearch', false, false, true); - $accountPassToImageEnabled = SP\Request::analyze('account_passtoimage', false, false, true); - $accountLinkEnabled = SP\Request::analyze('account_link', false, false, true); - $accountCount = SP\Request::analyze('account_count', 10); - $resultsAsCardsEnabled = SP\Request::analyze('resultsascards', false, false, true); + $globalSearchEnabled = \SP\Http\Request::analyze('globalsearch', false, false, true); + $accountPassToImageEnabled = \SP\Http\Request::analyze('account_passtoimage', false, false, true); + $accountLinkEnabled = \SP\Http\Request::analyze('account_link', false, false, true); + $accountCount = \SP\Http\Request::analyze('account_count', 10); + $resultsAsCardsEnabled = \SP\Http\Request::analyze('resultsascards', false, false, true); - SP\Config::setCacheConfigValue('globalsearch', $globalSearchEnabled); - SP\Config::setCacheConfigValue('account_passtoimage', $accountPassToImageEnabled); - SP\Config::setCacheConfigValue('account_link', $accountLinkEnabled); - SP\Config::setCacheConfigValue('account_count', $accountCount); - SP\Config::setCacheConfigValue('resultsascards', $resultsAsCardsEnabled); + \SP\Config\Config::setCacheConfigValue('globalsearch', $globalSearchEnabled); + \SP\Config\Config::setCacheConfigValue('account_passtoimage', $accountPassToImageEnabled); + \SP\Config\Config::setCacheConfigValue('account_link', $accountLinkEnabled); + \SP\Config\Config::setCacheConfigValue('account_count', $accountCount); + \SP\Config\Config::setCacheConfigValue('resultsascards', $resultsAsCardsEnabled); // Files - $filesEnabled = SP\Request::analyze('files_enabled', false, false, true); - $filesAllowedSize = SP\Request::analyze('files_allowed_size', 1024); - $filesAllowedExts = SP\Request::analyze('files_allowed_exts'); + $filesEnabled = \SP\Http\Request::analyze('files_enabled', false, false, true); + $filesAllowedSize = \SP\Http\Request::analyze('files_allowed_size', 1024); + $filesAllowedExts = \SP\Http\Request::analyze('files_allowed_exts'); - SP\Config::setCacheConfigValue('files_enabled', $filesEnabled); - SP\Config::setCacheConfigValue('files_allowed_size', $filesAllowedSize); - SP\Config::setCacheConfigValue('files_allowed_exts', $filesAllowedExts); + \SP\Config\Config::setCacheConfigValue('files_enabled', $filesEnabled); + \SP\Config\Config::setCacheConfigValue('files_allowed_size', $filesAllowedSize); + \SP\Config\Config::setCacheConfigValue('files_allowed_exts', $filesAllowedExts); if ($filesEnabled && $filesAllowedSize >= 16384) { - SP\Response::printJSON(_('El tamaño máximo por archivo es de 16MB')); + \SP\Http\Response::printJSON(_('El tamaño máximo por archivo es de 16MB')); } // Public Links - $pubLinksEnabled = SP\Request::analyze('publinks_enabled', false, false, true); - $pubLinksImageEnabled = SP\Request::analyze('publinks_image_enabled', false, false, true); - $pubLinksMaxTime = SP\Request::analyze('publinks_maxtime', 10); - $pubLinksMaxViews = SP\Request::analyze('publinks_maxviews', 3); + $pubLinksEnabled = \SP\Http\Request::analyze('publinks_enabled', false, false, true); + $pubLinksImageEnabled = \SP\Http\Request::analyze('publinks_image_enabled', false, false, true); + $pubLinksMaxTime = \SP\Http\Request::analyze('publinks_maxtime', 10); + $pubLinksMaxViews = \SP\Http\Request::analyze('publinks_maxviews', 3); - SP\Config::setCacheConfigValue('publinks_enabled', $pubLinksEnabled); - SP\Config::setCacheConfigValue('publinks_image_enabled', $pubLinksImageEnabled); - SP\Config::setCacheConfigValue('publinks_maxtime', $pubLinksMaxTime * 60); - SP\Config::setCacheConfigValue('publinks_maxviews', $pubLinksMaxViews); + \SP\Config\Config::setCacheConfigValue('publinks_enabled', $pubLinksEnabled); + \SP\Config\Config::setCacheConfigValue('publinks_image_enabled', $pubLinksImageEnabled); + \SP\Config\Config::setCacheConfigValue('publinks_maxtime', $pubLinksMaxTime * 60); + \SP\Config\Config::setCacheConfigValue('publinks_maxviews', $pubLinksMaxViews); // Proxy - $proxyEnabled = SP\Request::analyze('proxy_enabled', false, false, true); - $proxyServer = SP\Request::analyze('proxy_server'); - $proxyPort = SP\Request::analyze('proxy_port', 0); - $proxyUser = SP\Request::analyze('proxy_user'); - $proxyPass = SP\Request::analyzeEncrypted('proxy_pass'); + $proxyEnabled = \SP\Http\Request::analyze('proxy_enabled', false, false, true); + $proxyServer = \SP\Http\Request::analyze('proxy_server'); + $proxyPort = \SP\Http\Request::analyze('proxy_port', 0); + $proxyUser = \SP\Http\Request::analyze('proxy_user'); + $proxyPass = \SP\Http\Request::analyzeEncrypted('proxy_pass'); // Valores para Proxy if ($proxyEnabled && (!$proxyServer || !$proxyPort)) { - SP\Response::printJSON(_('Faltan parámetros de Proxy')); + \SP\Http\Response::printJSON(_('Faltan parámetros de Proxy')); } elseif ($proxyEnabled) { - SP\Config::setCacheConfigValue('proxy_enabled', true); - SP\Config::setCacheConfigValue('proxy_server', $proxyServer); - SP\Config::setCacheConfigValue('proxy_port', $proxyPort); - SP\Config::setCacheConfigValue('proxy_user', $proxyUser); - SP\Config::setCacheConfigValue('proxy_pass', $proxyPass); + \SP\Config\Config::setCacheConfigValue('proxy_enabled', true); + \SP\Config\Config::setCacheConfigValue('proxy_server', $proxyServer); + \SP\Config\Config::setCacheConfigValue('proxy_port', $proxyPort); + \SP\Config\Config::setCacheConfigValue('proxy_user', $proxyUser); + \SP\Config\Config::setCacheConfigValue('proxy_pass', $proxyPass); $Log->addDescription(_('Proxy habiltado')); } else { - SP\Config::setCacheConfigValue('proxy_enabled', false); + \SP\Config\Config::setCacheConfigValue('proxy_enabled', false); $Log->addDescription(_('Proxy deshabilitado')); } $Log->addDescription(sprintf('%s: %s', _('Sección'), _('General'))); - } elseif ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_WIKI) { + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_CFG_WIKI) { // Wiki - $wikiEnabled = SP\Request::analyze('wiki_enabled', false, false, true); - $wikiSearchUrl = SP\Request::analyze('wiki_searchurl'); - $wikiPageUrl = SP\Request::analyze('wiki_pageurl'); - $wikiFilter = SP\Request::analyze('wiki_filter'); + $wikiEnabled = \SP\Http\Request::analyze('wiki_enabled', false, false, true); + $wikiSearchUrl = \SP\Http\Request::analyze('wiki_searchurl'); + $wikiPageUrl = \SP\Http\Request::analyze('wiki_pageurl'); + $wikiFilter = \SP\Http\Request::analyze('wiki_filter'); // Valores para la conexión a la Wiki if ($wikiEnabled && (!$wikiSearchUrl || !$wikiPageUrl || !$wikiFilter)) { - SP\Response::printJSON(_('Faltan parámetros de Wiki')); + \SP\Http\Response::printJSON(_('Faltan parámetros de Wiki')); } elseif ($wikiEnabled) { - SP\Config::setCacheConfigValue('wiki_enabled', true); - SP\Config::setCacheConfigValue('wiki_searchurl', $wikiSearchUrl); - SP\Config::setCacheConfigValue('wiki_pageurl', $wikiPageUrl); - SP\Config::setCacheConfigValue('wiki_filter', $wikiFilter); + \SP\Config\Config::setCacheConfigValue('wiki_enabled', true); + \SP\Config\Config::setCacheConfigValue('wiki_searchurl', $wikiSearchUrl); + \SP\Config\Config::setCacheConfigValue('wiki_pageurl', $wikiPageUrl); + \SP\Config\Config::setCacheConfigValue('wiki_filter', $wikiFilter); $Log->addDescription(_('Wiki habiltada')); } else { - SP\Config::setCacheConfigValue('wiki_enabled', false); + \SP\Config\Config::setCacheConfigValue('wiki_enabled', false); $Log->addDescription(_('Wiki deshabilitada')); } $Log->addDescription(sprintf('%s: %s', _('Sección'), _('Wiki'))); - } elseif ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_LDAP) { + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_CFG_LDAP) { // LDAP - $ldapEnabled = SP\Request::analyze('ldap_enabled', false, false, true); - $ldapADSEnabled = SP\Request::analyze('ldap_ads', false, false, true); - $ldapServer = SP\Request::analyze('ldap_server'); - $ldapBase = SP\Request::analyze('ldap_base'); - $ldapGroup = SP\Request::analyze('ldap_group'); - $ldapDefaultGroup = SP\Request::analyze('ldap_defaultgroup', 0); - $ldapDefaultProfile = SP\Request::analyze('ldap_defaultprofile', 0); - $ldapBindUser = SP\Request::analyze('ldap_binduser'); - $ldapBindPass = SP\Request::analyzeEncrypted('ldap_bindpass'); + $ldapEnabled = \SP\Http\Request::analyze('ldap_enabled', false, false, true); + $ldapADSEnabled = \SP\Http\Request::analyze('ldap_ads', false, false, true); + $ldapServer = \SP\Http\Request::analyze('ldap_server'); + $ldapBase = \SP\Http\Request::analyze('ldap_base'); + $ldapGroup = \SP\Http\Request::analyze('ldap_group'); + $ldapDefaultGroup = \SP\Http\Request::analyze('ldap_defaultgroup', 0); + $ldapDefaultProfile = \SP\Http\Request::analyze('ldap_defaultprofile', 0); + $ldapBindUser = \SP\Http\Request::analyze('ldap_binduser'); + $ldapBindPass = \SP\Http\Request::analyzeEncrypted('ldap_bindpass'); // Valores para la configuración de LDAP if ($ldapEnabled && (!$ldapServer || !$ldapBase || !$ldapBindUser)) { - SP\Response::printJSON(_('Faltan parámetros de LDAP')); + \SP\Http\Response::printJSON(_('Faltan parámetros de LDAP')); } elseif ($ldapEnabled) { - SP\Config::setCacheConfigValue('ldap_enabled', true); - SP\Config::setCacheConfigValue('ldap_ads', $ldapADSEnabled); - SP\Config::setCacheConfigValue('ldap_server', $ldapServer); - SP\Config::setCacheConfigValue('ldap_base', $ldapBase); - SP\Config::setCacheConfigValue('ldap_group', $ldapGroup); - SP\Config::setCacheConfigValue('ldap_defaultgroup', $ldapDefaultGroup); - SP\Config::setCacheConfigValue('ldap_defaultprofile', $ldapDefaultProfile); - SP\Config::setCacheConfigValue('ldap_binduser', $ldapBindUser); - SP\Config::setCacheConfigValue('ldap_bindpass', $ldapBindPass); + \SP\Config\Config::setCacheConfigValue('ldap_enabled', true); + \SP\Config\Config::setCacheConfigValue('ldap_ads', $ldapADSEnabled); + \SP\Config\Config::setCacheConfigValue('ldap_server', $ldapServer); + \SP\Config\Config::setCacheConfigValue('ldap_base', $ldapBase); + \SP\Config\Config::setCacheConfigValue('ldap_group', $ldapGroup); + \SP\Config\Config::setCacheConfigValue('ldap_defaultgroup', $ldapDefaultGroup); + \SP\Config\Config::setCacheConfigValue('ldap_defaultprofile', $ldapDefaultProfile); + \SP\Config\Config::setCacheConfigValue('ldap_binduser', $ldapBindUser); + \SP\Config\Config::setCacheConfigValue('ldap_bindpass', $ldapBindPass); $Log->addDescription(_('LDAP habiltado')); } else { - SP\Config::setCacheConfigValue('ldap_enabled', false); + \SP\Config\Config::setCacheConfigValue('ldap_enabled', false); $Log->addDescription(_('LDAP deshabilitado')); } $Log->addDescription(sprintf('%s: %s', _('Sección'), _('LDAP'))); - } elseif ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_MAIL) { + } elseif ($actionId === \SP\Core\ActionsInterface::ACTION_CFG_MAIL) { // Mail - $mailEnabled = SP\Request::analyze('mail_enabled', false, false, true); - $mailServer = SP\Request::analyze('mail_server'); - $mailPort = SP\Request::analyze('mail_port', 25); - $mailUser = SP\Request::analyze('mail_user'); - $mailPass = SP\Request::analyzeEncrypted('mail_pass'); - $mailSecurity = SP\Request::analyze('mail_security'); - $mailFrom = SP\Request::analyze('mail_from'); - $mailRequests = SP\Request::analyze('mail_requestsenabled', false, false, true); - $mailAuth = SP\Request::analyze('mail_authenabled', false, false, true); + $mailEnabled = \SP\Http\Request::analyze('mail_enabled', false, false, true); + $mailServer = \SP\Http\Request::analyze('mail_server'); + $mailPort = \SP\Http\Request::analyze('mail_port', 25); + $mailUser = \SP\Http\Request::analyze('mail_user'); + $mailPass = \SP\Http\Request::analyzeEncrypted('mail_pass'); + $mailSecurity = \SP\Http\Request::analyze('mail_security'); + $mailFrom = \SP\Http\Request::analyze('mail_from'); + $mailRequests = \SP\Http\Request::analyze('mail_requestsenabled', false, false, true); + $mailAuth = \SP\Http\Request::analyze('mail_authenabled', false, false, true); // Valores para la configuración del Correo if ($mailEnabled && (!$mailServer || !$mailFrom)) { - SP\Response::printJSON(_('Faltan parámetros de Correo')); + \SP\Http\Response::printJSON(_('Faltan parámetros de Correo')); } elseif ($mailEnabled) { - SP\Config::setCacheConfigValue('mail_enabled', true); - SP\Config::setCacheConfigValue('mail_requestsenabled', $mailRequests); - SP\Config::setCacheConfigValue('mail_server', $mailServer); - SP\Config::setCacheConfigValue('mail_port', $mailPort); - SP\Config::setCacheConfigValue('mail_security', $mailSecurity); - SP\Config::setCacheConfigValue('mail_from', $mailFrom); + \SP\Config\Config::setCacheConfigValue('mail_enabled', true); + \SP\Config\Config::setCacheConfigValue('mail_requestsenabled', $mailRequests); + \SP\Config\Config::setCacheConfigValue('mail_server', $mailServer); + \SP\Config\Config::setCacheConfigValue('mail_port', $mailPort); + \SP\Config\Config::setCacheConfigValue('mail_security', $mailSecurity); + \SP\Config\Config::setCacheConfigValue('mail_from', $mailFrom); if ($mailAuth) { - SP\Config::setCacheConfigValue('mail_authenabled', $mailAuth); - SP\Config::setCacheConfigValue('mail_user', $mailUser); - SP\Config::setCacheConfigValue('mail_pass', $mailPass); + \SP\Config\Config::setCacheConfigValue('mail_authenabled', $mailAuth); + \SP\Config\Config::setCacheConfigValue('mail_user', $mailUser); + \SP\Config\Config::setCacheConfigValue('mail_pass', $mailPass); } $Log->addDescription(_('Correo habiltado')); } else { - SP\Config::setCacheConfigValue('mail_enabled', false); - SP\Config::setCacheConfigValue('mail_requestsenabled', false); - SP\Config::setCacheConfigValue('mail_authenabled', false); + \SP\Config\Config::setCacheConfigValue('mail_enabled', false); + \SP\Config\Config::setCacheConfigValue('mail_requestsenabled', false); + \SP\Config\Config::setCacheConfigValue('mail_authenabled', false); $Log->addDescription(_('Correo deshabilitado')); } @@ -242,70 +243,70 @@ if ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_GENERAL } try { - SP\Config::writeConfig(); - } catch (\SP\SPException $e){ + \SP\Config\Config::writeConfig(); + } catch (\SP\Core\SPException $e){ $Log->addDescription($e->getMessage()); $Log->addDescription($e->getHint()); $Log->writeLog(); - SP\Response::printJSON($e->getMessage()); + \SP\Http\Response::printJSON($e->getMessage()); } $Log->writeLog(); - SP\Email::sendEmail($Log); + \SP\Log\Email::sendEmail($Log); - if ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_GENERAL) { + if ($actionId === \SP\Core\ActionsInterface::ACTION_CFG_GENERAL) { // Recargar la aplicación completa para establecer nuevos valores - SP\Util::reload(); + \SP\Util\Util::reload(); } - SP\Response::printJSON(_('Configuración actualizada'), 0, $doActionOnClose); -} elseif ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_ENCRYPTION) { - $currentMasterPass = SP\Request::analyzeEncrypted('curMasterPwd'); - $newMasterPass = SP\Request::analyzeEncrypted('newMasterPwd'); - $newMasterPassR = SP\Request::analyzeEncrypted('newMasterPwdR'); - $confirmPassChange = SP\Request::analyze('confirmPassChange', 0, false, 1); - $noAccountPassChange = SP\Request::analyze('chkNoAccountChange', 0, false, 1); + \SP\Http\Response::printJSON(_('Configuración actualizada'), 0, $doActionOnClose); +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_CFG_ENCRYPTION) { + $currentMasterPass = \SP\Http\Request::analyzeEncrypted('curMasterPwd'); + $newMasterPass = \SP\Http\Request::analyzeEncrypted('newMasterPwd'); + $newMasterPassR = \SP\Http\Request::analyzeEncrypted('newMasterPwdR'); + $confirmPassChange = \SP\Http\Request::analyze('confirmPassChange', 0, false, 1); + $noAccountPassChange = \SP\Http\Request::analyze('chkNoAccountChange', 0, false, 1); if (!UserPass::checkUserUpdateMPass()) { - SP\Response::printJSON(_('Clave maestra actualizada') . ';;' . _('Reinicie la sesión para cambiarla')); + \SP\Http\Response::printJSON(_('Clave maestra actualizada') . ';;' . _('Reinicie la sesión para cambiarla')); } elseif ($newMasterPass == '' && $currentMasterPass == '') { - SP\Response::printJSON(_('Clave maestra no indicada')); + \SP\Http\Response::printJSON(_('Clave maestra no indicada')); } elseif ($confirmPassChange == 0) { - SP\Response::printJSON(_('Se ha de confirmar el cambio de clave')); + \SP\Http\Response::printJSON(_('Se ha de confirmar el cambio de clave')); } if ($newMasterPass == $currentMasterPass) { - SP\Response::printJSON(_('Las claves son idénticas')); + \SP\Http\Response::printJSON(_('Las claves son idénticas')); } elseif ($newMasterPass != $newMasterPassR) { - SP\Response::printJSON(_('Las claves maestras no coinciden')); - } elseif (!SP\Crypt::checkHashPass($currentMasterPass, ConfigDB::getValue('masterPwd'), true)) { - SP\Response::printJSON(_('La clave maestra actual no coincide')); + \SP\Http\Response::printJSON(_('Las claves maestras no coinciden')); + } elseif (!\SP\Core\Crypt::checkHashPass($currentMasterPass, ConfigDB::getValue('masterPwd'), true)) { + \SP\Http\Response::printJSON(_('La clave maestra actual no coincide')); } - $hashMPass = SP\Crypt::mkHashPassword($newMasterPass); + $hashMPass = \SP\Core\Crypt::mkHashPassword($newMasterPass); if (!$noAccountPassChange) { - $Account = new SP\Account(); + $Account = new \SP\Account\Account(); if (!$Account->updateAccountsMasterPass($currentMasterPass, $newMasterPass)) { - SP\Response::printJSON(_('Errores al actualizar las claves de las cuentas')); + \SP\Http\Response::printJSON(_('Errores al actualizar las claves de las cuentas')); } - $AccountHistory = new SP\AccountHistory(); + $AccountHistory = new \SP\Account\AccountHistory(); if (!$AccountHistory->updateAccountsMasterPass($currentMasterPass, $newMasterPass, $hashMPass)) { - SP\Response::printJSON(_('Errores al actualizar las claves de las cuentas del histórico')); + \SP\Http\Response::printJSON(_('Errores al actualizar las claves de las cuentas del histórico')); } - if (!\SP\CustomFields::updateCustomFieldsCrypt($currentMasterPass, $newMasterPass)) { - SP\Response::printJSON(_('Errores al actualizar datos de campos personalizados')); + if (!\SP\Mgmt\CustomFields::updateCustomFieldsCrypt($currentMasterPass, $newMasterPass)) { + \SP\Http\Response::printJSON(_('Errores al actualizar datos de campos personalizados')); } } - if (SP\Util::demoIsEnabled()) { - SP\Response::printJSON(_('Ey, esto es una DEMO!!')); + if (Checks::demoIsEnabled()) { + \SP\Http\Response::printJSON(_('Ey, esto es una DEMO!!')); } // ConfigDB::readConfig(); @@ -313,24 +314,24 @@ if ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_GENERAL ConfigDB::setCacheConfigValue('lastupdatempass', time()); if (ConfigDB::writeConfig()) { - SP\Log::writeNewLogAndEmail(_('Actualizar Clave Maestra')); + \SP\Log\Log::writeNewLogAndEmail(_('Actualizar Clave Maestra')); - SP\Response::printJSON(_('Clave maestra actualizada'), 0); + \SP\Http\Response::printJSON(_('Clave maestra actualizada'), 0); } else { - SP\Response::printJSON(_('Error al guardar el hash de la clave maestra')); + \SP\Http\Response::printJSON(_('Error al guardar el hash de la clave maestra')); } -} elseif ($actionId === SP\Controller\ActionsInterface::ACTION_CFG_ENCRYPTION_TEMPPASS) { - $tempMasterMaxTime = SP\Request::analyze('tmpass_maxtime', 3600); +} elseif ($actionId === \SP\Core\ActionsInterface::ACTION_CFG_ENCRYPTION_TEMPPASS) { + $tempMasterMaxTime = \SP\Http\Request::analyze('tmpass_maxtime', 3600); $tempMasterPass = CryptMasterPass::setTempMasterPass($tempMasterMaxTime); if ($tempMasterPass !== false && !empty($tempMasterPass)) { - SP\Email::sendEmail(new \SP\Log(_('Generar Clave Temporal'), SP\Html::strongText(_('Clave') . ': ') . $tempMasterPass)); + \SP\Log\Email::sendEmail(new \SP\Log\Log(_('Generar Clave Temporal'), \SP\Html\Html::strongText(_('Clave') . ': ') . $tempMasterPass)); - SP\Response::printJSON(_('Clave Temporal Generada'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Clave Temporal Generada'), 0, $doActionOnClose); } else { - SP\Response::printJSON(_('Error al generar clave temporal')); + \SP\Http\Response::printJSON(_('Error al generar clave temporal')); } } else { - SP\Response::printJSON(_('Acción Inválida')); + \SP\Http\Response::printJSON(_('Acción Inválida')); } \ No newline at end of file diff --git a/ajax/ajax_doLogin.php b/ajax/ajax_doLogin.php index 3b9d003c..ebf32966 100644 --- a/ajax/ajax_doLogin.php +++ b/ajax/ajax_doLogin.php @@ -23,13 +23,13 @@ * */ -use SP\CryptMasterPass; -use SP\Request; -use SP\SessionUtil; -use SP\UserLdap; -use SP\UserPass; -use SP\UserPassRecover; -use SP\UserUtil; +use SP\Core\CryptMasterPass; +use SP\Http\Request; +use SP\Core\SessionUtil; +use SP\Mgmt\User\UserLdap; +use SP\Mgmt\User\UserPass; +use SP\Mgmt\User\UserPassRecover; +use SP\Mgmt\User\UserUtil; define('APP_ROOT', '..'); @@ -37,42 +37,42 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Request::analyze('login', false)) { +if (!\SP\Http\Request::analyze('login', false)) { return; } -$userLogin = SP\Request::analyze('user'); -$userPass = SP\Request::analyzeEncrypted('pass'); -$masterPass = SP\Request::analyzeEncrypted('mpass'); +$userLogin = \SP\Http\Request::analyze('user'); +$userPass = \SP\Http\Request::analyzeEncrypted('pass'); +$masterPass = \SP\Http\Request::analyzeEncrypted('mpass'); if (!$userLogin || !$userPass) { - SP\Response::printJSON(_('Usuario/Clave no introducidos')); + \SP\Http\Response::printJSON(_('Usuario/Clave no introducidos')); } -$User = new SP\User(); +$User = new \SP\Mgmt\User\User(); $User->setUserLogin($userLogin); $User->setUserPass($userPass); -if ($resLdap = SP\Auth::authUserLDAP($userLogin, $userPass)) { - $User->setUserName(SP\Auth::$userName); - $User->setUserEmail(SP\Auth::$userEmail); +if ($resLdap = \SP\Auth\Auth::authUserLDAP($userLogin, $userPass)) { + $User->setUserName(\SP\Auth\Auth::$userName); + $User->setUserEmail(\SP\Auth\Auth::$userEmail); } -$Log = new \SP\Log(_('Inicio sesión')); +$Log = new \SP\Log\Log(_('Inicio sesión')); // Autentificamos por LDAP if ($resLdap === true) { $Log->addDescription('(LDAP)'); - $Log->addDescription(sprintf('%s : %s', _('Servidor Login'), \SP\Ldap::getLdapServer())); + $Log->addDescription(sprintf('%s : %s', _('Servidor Login'), \SP\Auth\Ldap::getLdapServer())); // Verificamos si el usuario existe en la BBDD if (!UserLdap::checkLDAPUserInDB($userLogin)) { // Creamos el usuario de LDAP en MySQL - if (!\SP\UserLdap::newUserLDAP($User)) { + if (!\SP\Mgmt\User\UserLdap::newUserLDAP($User)) { $Log->addDescription(_('Error al guardar los datos de LDAP')); $Log->writeLog(); - SP\Response::printJSON(_('Error interno')); + \SP\Http\Response::printJSON(_('Error interno')); } } else { // Actualizamos la clave del usuario en MySQL @@ -80,7 +80,7 @@ if ($resLdap === true) { $Log->addDescription(_('Error al actualizar la clave del usuario en la BBDD')); $Log->writeLog(); - SP\Response::printJSON(_('Error interno')); + \SP\Http\Response::printJSON(_('Error interno')); } } } else if ($resLdap == 49) { @@ -89,32 +89,32 @@ if ($resLdap === true) { $Log->addDescription(_('Usuario') . ": " . $userLogin); $Log->writeLog(); - SP\Response::printJSON(_('Usuario/Clave incorrectos')); + \SP\Http\Response::printJSON(_('Usuario/Clave incorrectos')); } else if ($resLdap === 701) { $Log->addDescription('(LDAP)'); $Log->addDescription(_('Cuenta expirada')); $Log->addDescription(_('Usuario') . ": " . $userLogin); $Log->writeLog(); - SP\Response::printJSON(_('Cuenta expirada')); + \SP\Http\Response::printJSON(_('Cuenta expirada')); } else if ($resLdap === 702) { $Log->addDescription('(LDAP)'); $Log->addDescription(_('El usuario no tiene grupos asociados')); $Log->addDescription(_('Usuario') . ": " . $userLogin); $Log->writeLog(); - SP\Response::printJSON(_('Usuario/Clave incorrectos')); + \SP\Http\Response::printJSON(_('Usuario/Clave incorrectos')); } else { // Autentificamos por MySQL (ha fallado LDAP) $Log->resetDescription(); $Log->addDescription('(MySQL)'); // Autentificamos con la BBDD - if (!SP\Auth::authUserMySQL($userLogin, $userPass)) { + if (!\SP\Auth\Auth::authUserMySQL($userLogin, $userPass)) { $Log->addDescription(_('Login incorrecto')); $Log->addDescription(_('Usuario') . ": " . $userLogin); $Log->writeLog(); - SP\Response::printJSON(_('Usuario/Clave incorrectos')); + \SP\Http\Response::printJSON(_('Usuario/Clave incorrectos')); } } @@ -124,7 +124,7 @@ if (UserUtil::checkUserIsDisabled($userLogin)) { $Log->addDescription(_('Usuario') . ": " . $userLogin); $Log->writeLog(); - SP\Response::printJSON(_('Usuario deshabilitado')); + \SP\Http\Response::printJSON(_('Usuario deshabilitado')); } // Obtenemos los datos del usuario @@ -132,14 +132,14 @@ if (!$User->getUserInfo()) { $Log->addDescription(_('Error al obtener los datos del usuario de la BBDD')); $Log->writeLog(); - SP\Response::printJSON(_('Error interno')); + \SP\Http\Response::printJSON(_('Error interno')); } // Comprobamos que la clave maestra del usuario es correcta y está actualizada if (!$masterPass && (!UserPass::checkUserMPass($User) || !UserPass::checkUserUpdateMPass($userLogin)) ) { - SP\Response::printJSON(_('La clave maestra no ha sido guardada o es incorrecta'), 3); + \SP\Http\Response::printJSON(_('La clave maestra no ha sido guardada o es incorrecta'), 3); } elseif ($masterPass) { if (CryptMasterPass::checkTempMasterPass($masterPass)) { $masterPass = CryptMasterPass::getTempMasterPass($masterPass); @@ -149,17 +149,17 @@ if (!$masterPass $Log->addDescription(_('Clave maestra incorrecta')); $Log->writeLog(); - SP\Response::printJSON(_('Clave maestra incorrecta'), 4); + \SP\Http\Response::printJSON(_('Clave maestra incorrecta'), 4); } } // Comprobar si se ha forzado un cambio de clave if ($User->isUserChangePass()) { - $hash = SP\Util::generate_random_bytes(); + $hash = \SP\Util\Util::generate_random_bytes(); if (UserPassRecover::addPassRecover($userLogin, $hash)) { - $url = SP\Init::$WEBURI . '/index.php?a=passreset&h=' . $hash . '&t=' . time() . '&f=1'; - SP\Response::printJSON($url, 0); + $url = \SP\Core\Init::$WEBURI . '/index.php?a=passreset&h=' . $hash . '&t=' . time() . '&f=1'; + \SP\Http\Response::printJSON($url, 0); } } @@ -172,33 +172,33 @@ if ($User->getUserMPass()) { SessionUtil::loadUserSession($User); $Log->addDescription(sprintf('%s : %s', _('Usuario'), $userLogin)); - $Log->addDescription(sprintf('%s : %s', _('Perfil'), SP\Profile::getProfileNameById($User->getUserProfileId()))); - $Log->addDescription(sprintf('%s : %s', _('Grupo'), SP\Groups::getGroupNameById($User->getUserGroupId()))); + $Log->addDescription(sprintf('%s : %s', _('Perfil'), \SP\Mgmt\User\Profile::getProfileNameById($User->getUserProfileId()))); + $Log->addDescription(sprintf('%s : %s', _('Grupo'), \SP\Mgmt\User\Groups::getGroupNameById($User->getUserGroupId()))); $Log->writeLog(); } else { - SP\Response::printJSON(_('Error interno')); + \SP\Http\Response::printJSON(_('Error interno')); } -$UserPrefs = \SP\UserPreferences::getPreferences($User->getUserId()); +$UserPrefs = \SP\Mgmt\User\UserPreferences::getPreferences($User->getUserId()); if ($UserPrefs->isUse2Fa()) { - SP\Session::set2FApassed(false); - $url = SP\Init::$WEBURI . '/index.php?a=2fa&i=' . $User->getUserId() . '&t=' . time() . '&f=1'; - SP\Response::printJSON($url, 0); + \SP\Core\Session::set2FApassed(false); + $url = \SP\Core\Init::$WEBURI . '/index.php?a=2fa&i=' . $User->getUserId() . '&t=' . time() . '&f=1'; + \SP\Http\Response::printJSON($url, 0); } else { - SP\Session::set2FApassed(true); + \SP\Core\Session::set2FApassed(true); } -SP\Language::setLanguage(true); -SP\Themes::setTheme(true); -SP\Session::setUserPreferences($UserPrefs); +\SP\Core\Language::setLanguage(true); +\SP\Core\Themes::setTheme(true); +\SP\Core\Session::setUserPreferences($UserPrefs); $params = array(); // Comprobar si existen parámetros adicionales en URL via POST para pasarlos por GET foreach ($_POST as $param => $value) { - \SP\Html::sanitize($param); - \SP\Html::sanitize($value); + \SP\Html\Html::sanitize($param); + \SP\Html\Html::sanitize($value); if (!strncmp($param, 'g_', 2)) { $params[] = substr($param, 2) . '=' . $value; @@ -207,4 +207,4 @@ foreach ($_POST as $param => $value) { $urlParams = (count($params) > 0) ? '?' . implode('&', $params) : ''; -SP\Response::printJSON('index.php' . $urlParams, 0); \ No newline at end of file +\SP\Http\Response::printJSON('index.php' . $urlParams, 0); \ No newline at end of file diff --git a/ajax/ajax_eventlog.php b/ajax/ajax_eventlog.php index 063e5a9a..b7d98814 100644 --- a/ajax/ajax_eventlog.php +++ b/ajax/ajax_eventlog.php @@ -23,7 +23,7 @@ * */ -use SP\Request; +use SP\Http\Request; define('APP_ROOT', '..'); @@ -31,19 +31,19 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Util::logout(); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Util\Util::logout(); } -$start = SP\Request::analyze('start', 0); -$clear = SP\Request::analyze('clear', 0); -$sk = SP\Request::analyze('sk', false); +$start = \SP\Http\Request::analyze('start', 0); +$clear = \SP\Http\Request::analyze('clear', 0); +$sk = \SP\Http\Request::analyze('sk', false); -$tpl = new SP\Template(); +$tpl = new \SP\Core\Template(); $tpl->assign('limitStart', $start); $tpl->assign('clear', $clear); $tpl->assign('sk', $sk); -$controller = new SP\Controller\EventlogC($tpl); +$controller = new \SP\Controller\EventlogC($tpl); $controller->checkClear(); $controller->getEventlog(); echo $tpl->render(); \ No newline at end of file diff --git a/ajax/ajax_files.php b/ajax/ajax_files.php index 9091efdf..a8d4881f 100644 --- a/ajax/ajax_files.php +++ b/ajax/ajax_files.php @@ -23,8 +23,9 @@ * */ -use SP\Request; -use SP\SessionUtil; +use SP\Http\Request; +use SP\Core\SessionUtil; +use SP\Util\Checks; define('APP_ROOT', '..'); @@ -32,25 +33,25 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Util::logout(); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Util\Util::logout(); } -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { die(_('CONSULTA INVÁLIDA')); } -if (!SP\Util::fileIsEnabled()) { +if (!Checks::fileIsEnabled()) { exit(_('Gestión de archivos deshabilitada')); } -$action = SP\Request::analyze('action'); -$accountId = SP\Request::analyze('accountId', 0); -$fileId = SP\Request::analyze('fileId', 0); +$action = \SP\Http\Request::analyze('action'); +$accountId = \SP\Http\Request::analyze('accountId', 0); +$fileId = \SP\Http\Request::analyze('fileId', 0); -$log = new \SP\Log(); +$log = new \SP\Log\Log(); if ($action == 'upload') { if (!is_array($_FILES["inFile"]) || !$accountId === 0) { @@ -59,8 +60,8 @@ if ($action == 'upload') { $log->setAction(_('Subir Archivo')); - $allowedExts = strtoupper(SP\Config::getValue('files_allowed_exts')); - $allowedSize = SP\Config::getValue('files_allowed_size'); + $allowedExts = strtoupper(\SP\Config\Config::getValue('files_allowed_exts')); + $allowedSize = \SP\Config\Config::getValue('files_allowed_size'); if ($allowedExts) { // Extensiones aceptadas @@ -90,14 +91,14 @@ if ($action == 'upload') { } // Variables con información del archivo - $fileData['name'] = SP\Html::sanitize($_FILES['inFile']['name']); - $tmpName = SP\Html::sanitize($_FILES['inFile']['tmp_name']); + $fileData['name'] = \SP\Html\Html::sanitize($_FILES['inFile']['name']); + $tmpName = \SP\Html\Html::sanitize($_FILES['inFile']['tmp_name']); $fileData['size'] = $_FILES['inFile']['size']; $fileData['type'] = $_FILES['inFile']['type']; if (!file_exists($tmpName)) { // Registramos el máximo tamaño permitido por PHP - SP\Util::getMaxUpload(); + \SP\Util\Util::getMaxUpload(); $log->addDescription(_('Error interno al leer el archivo')); $log->writeLog(); @@ -122,7 +123,7 @@ if ($action == 'upload') { exit($log->getDescription()); } - if (SP\Files::fileUpload($accountId, $fileData)) { + if (\SP\Mgmt\Files::fileUpload($accountId, $fileData)) { $log->addDescription(_('Archivo guardado')); $log->writeLog(); @@ -143,7 +144,7 @@ if ($action == 'download' || $action == 'view') { $isView = ($action == 'view') ? true : false; - $file = SP\Files::fileDownload($fileId); + $file = \SP\Mgmt\Files::fileDownload($fileId); if (!$file) { exit(_('El archivo no existe')); @@ -200,7 +201,7 @@ if ($action == "delete") { exit(_('No es un ID de archivo válido')); } - if (SP\Files::fileDelete($fileId)) { + if (\SP\Mgmt\Files::fileDelete($fileId)) { $log->addDescription(_('Archivo eliminado')); $log->writeLog(); diff --git a/ajax/ajax_getContent.php b/ajax/ajax_getContent.php index 15f8dd6c..d98b656b 100644 --- a/ajax/ajax_getContent.php +++ b/ajax/ajax_getContent.php @@ -23,8 +23,9 @@ * */ -use SP\Request; -use SP\Themes; +use SP\Http\Request; +use SP\Core\Themes; +use SP\Util\Checks; define('APP_ROOT', '..'); @@ -32,34 +33,34 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Util::logout(); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Util\Util::logout(); } -SP\Util::checkReload(); +\SP\Util\Util::checkReload(); -if (!SP\Request::analyze('actionId', 0, true)) { +if (!\SP\Http\Request::analyze('actionId', 0, true)) { die('
' . _('Parámetros incorrectos') . '
'); } -$actionId = SP\Request::analyze('actionId'); -$itemId = SP\Request::analyze('itemId', 0); -$lastAction = SP\Request::analyze('lastAction', \SP\Controller\ActionsInterface::ACTION_ACC_SEARCH); +$actionId = \SP\Http\Request::analyze('actionId'); +$itemId = \SP\Http\Request::analyze('itemId', 0); +$lastAction = \SP\Http\Request::analyze('lastAction', \SP\Core\ActionsInterface::ACTION_ACC_SEARCH); -$tpl = new SP\Template(); +$tpl = new \SP\Core\Template(); $tpl->assign('actionId', $actionId); $tpl->assign('id', $itemId); $tpl->assign('activeTabId', $itemId); -$tpl->assign('lastAccountId', \SP\Session::getLastAcountId()); +$tpl->assign('lastAccountId', \SP\Core\Session::getLastAcountId()); $tpl->assign('queryTimeStart', microtime()); -$tpl->assign('userId', SP\Session::getUserId()); -$tpl->assign('userGroupId', SP\Session::getUserGroupId()); -$tpl->assign('userIsAdminApp', SP\Session::getUserIsAdminApp()); -$tpl->assign('userIsAdminAcc', SP\Session::getUserIsAdminAcc()); +$tpl->assign('userId', \SP\Core\Session::getUserId()); +$tpl->assign('userGroupId', \SP\Core\Session::getUserGroupId()); +$tpl->assign('userIsAdminApp', \SP\Core\Session::getUserIsAdminApp()); +$tpl->assign('userIsAdminAcc', \SP\Core\Session::getUserIsAdminAcc()); $tpl->assign('themeUri', Themes::$themeUri); // Control de ruta de acciones -if ($actionId != \SP\Controller\ActionsInterface::ACTION_ACC_SEARCH) { +if ($actionId != \SP\Core\ActionsInterface::ACTION_ACC_SEARCH) { $actionsPath = &$_SESSION['actionsPath']; $actionsPath[] = $actionId; $actions = count($actionsPath); @@ -76,81 +77,81 @@ if ($actionId != \SP\Controller\ActionsInterface::ACTION_ACC_SEARCH) { } switch ($actionId) { - case \SP\Controller\ActionsInterface::ACTION_ACC_SEARCH: - $_SESSION['actionsPath'] = array(\SP\Controller\ActionsInterface::ACTION_ACC_SEARCH); + case \SP\Core\ActionsInterface::ACTION_ACC_SEARCH: + $_SESSION['actionsPath'] = array(\SP\Core\ActionsInterface::ACTION_ACC_SEARCH); $tpl->assign('lastAction', $lastAction); - $controller = new SP\Controller\SearchC($tpl); + $controller = new \SP\Controller\SearchC($tpl); $controller->getSearchBox(); $controller->getSearch(); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_NEW: - $controller = new SP\Controller\AccountC($tpl, null, $itemId); + case \SP\Core\ActionsInterface::ACTION_ACC_NEW: + $controller = new \SP\Controller\AccountC($tpl, null, $itemId); $controller->getNewAccount(); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_COPY: - $controller = new SP\Controller\AccountC($tpl, null, $itemId); + case \SP\Core\ActionsInterface::ACTION_ACC_COPY: + $controller = new \SP\Controller\AccountC($tpl, null, $itemId); $controller->getCopyAccount(); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_EDIT: - $controller = new SP\Controller\AccountC($tpl, null, $itemId); + case \SP\Core\ActionsInterface::ACTION_ACC_EDIT: + $controller = new \SP\Controller\AccountC($tpl, null, $itemId); $controller->getEditAccount(); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_EDIT_PASS: - $controller = new SP\Controller\AccountC($tpl, null, $itemId); + case \SP\Core\ActionsInterface::ACTION_ACC_EDIT_PASS: + $controller = new \SP\Controller\AccountC($tpl, null, $itemId); $controller->getEditPassAccount(); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_VIEW: - $controller = new SP\Controller\AccountC($tpl, null, $itemId); + case \SP\Core\ActionsInterface::ACTION_ACC_VIEW: + $controller = new \SP\Controller\AccountC($tpl, null, $itemId); $controller->getViewAccount(); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_VIEW_HISTORY: - $controller = new SP\Controller\AccountC($tpl, null, $itemId); + case \SP\Core\ActionsInterface::ACTION_ACC_VIEW_HISTORY: + $controller = new \SP\Controller\AccountC($tpl, null, $itemId); $controller->getViewHistoryAccount(); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_DELETE: - $controller = new SP\Controller\AccountC($tpl, null, $itemId); + case \SP\Core\ActionsInterface::ACTION_ACC_DELETE: + $controller = new \SP\Controller\AccountC($tpl, null, $itemId); $controller->getDeleteAccount(); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_REQUEST: - $controller = new SP\Controller\AccountC($tpl, null, $itemId); + case \SP\Core\ActionsInterface::ACTION_ACC_REQUEST: + $controller = new \SP\Controller\AccountC($tpl, null, $itemId); $controller->getRequestAccountAccess(); break; - case \SP\Controller\ActionsInterface::ACTION_USR: - case \SP\Controller\ActionsInterface::ACTION_MGM_APITOKENS: - case \SP\Controller\ActionsInterface::ACTION_MGM_PUBLICLINKS: - $controller = new SP\Controller\UsersMgmtC($tpl); + case \SP\Core\ActionsInterface::ACTION_USR: + case \SP\Core\ActionsInterface::ACTION_MGM_APITOKENS: + case \SP\Core\ActionsInterface::ACTION_MGM_PUBLICLINKS: + $controller = new \SP\Controller\UsersMgmtC($tpl); $controller->useTabs(); $controller->getUsersList(); $controller->getGroupsList(); $controller->getProfilesList(); $controller->getAPITokensList(); - if (\SP\Util::publicLinksIsEnabled()) { + if (Checks::publicLinksIsEnabled()) { $controller->getPublicLinksList(); } break; - case \SP\Controller\ActionsInterface::ACTION_MGM: - $controller = new SP\Controller\AccountsMgmtC($tpl); + case \SP\Core\ActionsInterface::ACTION_MGM: + $controller = new \SP\Controller\AccountsMgmtC($tpl); $controller->useTabs(); $controller->getCategories(); $controller->getCustomers(); $controller->getCustomFields(); break; - case \SP\Controller\ActionsInterface::ACTION_CFG: - case \SP\Controller\ActionsInterface::ACTION_CFG_GENERAL: - case \SP\Controller\ActionsInterface::ACTION_CFG_WIKI: - case \SP\Controller\ActionsInterface::ACTION_CFG_LDAP: - case \SP\Controller\ActionsInterface::ACTION_CFG_MAIL: - case \SP\Controller\ActionsInterface::ACTION_CFG_ENCRYPTION: - case \SP\Controller\ActionsInterface::ACTION_CFG_ENCRYPTION_TEMPPASS: - case \SP\Controller\ActionsInterface::ACTION_CFG_BACKUP: - case \SP\Controller\ActionsInterface::ACTION_CFG_EXPORT: - case \SP\Controller\ActionsInterface::ACTION_CFG_IMPORT: + case \SP\Core\ActionsInterface::ACTION_CFG: + case \SP\Core\ActionsInterface::ACTION_CFG_GENERAL: + case \SP\Core\ActionsInterface::ACTION_CFG_WIKI: + case \SP\Core\ActionsInterface::ACTION_CFG_LDAP: + case \SP\Core\ActionsInterface::ACTION_CFG_MAIL: + case \SP\Core\ActionsInterface::ACTION_CFG_ENCRYPTION: + case \SP\Core\ActionsInterface::ACTION_CFG_ENCRYPTION_TEMPPASS: + case \SP\Core\ActionsInterface::ACTION_CFG_BACKUP: + case \SP\Core\ActionsInterface::ACTION_CFG_EXPORT: + case \SP\Core\ActionsInterface::ACTION_CFG_IMPORT: $tpl->assign('onCloseAction', $actionId); $tpl->addTemplate('tabs-start'); - $controller = new SP\Controller\ConfigC($tpl); + $controller = new \SP\Controller\ConfigC($tpl); $controller->getGeneralTab(); $controller->getWikiTab(); $controller->getLdapTab(); @@ -162,13 +163,13 @@ switch ($actionId) { $tpl->addTemplate('tabs-end'); break; - case \SP\Controller\ActionsInterface::ACTION_EVL: - $controller = new SP\Controller\EventlogC($tpl); + case \SP\Core\ActionsInterface::ACTION_EVL: + $controller = new \SP\Controller\EventlogC($tpl); $controller->getEventlog(); break; - case \SP\Controller\ActionsInterface::ACTION_USR_PREFERENCES: - case \SP\Controller\ActionsInterface::ACTION_USR_PREFERENCES_GENERAL: - case \SP\Controller\ActionsInterface::ACTION_USR_PREFERENCES_SECURITY: + case \SP\Core\ActionsInterface::ACTION_USR_PREFERENCES: + case \SP\Core\ActionsInterface::ACTION_USR_PREFERENCES_GENERAL: + case \SP\Core\ActionsInterface::ACTION_USR_PREFERENCES_SECURITY: $tpl->addTemplate('tabs-start'); $controller = new \SP\Controller\UsersPrefsC($tpl); @@ -180,7 +181,7 @@ switch ($actionId) { } // Se comprueba si se debe de mostrar la vista de depuración -if (\SP\Session::getUserIsAdminApp() && SP\Config::getValue('debug')) { +if (\SP\Core\Session::getUserIsAdminApp() && \SP\Config\Config::getValue('debug')) { $controller->getDebug(); } diff --git a/ajax/ajax_getEnvironment.php b/ajax/ajax_getEnvironment.php index 411c865e..da165569 100644 --- a/ajax/ajax_getEnvironment.php +++ b/ajax/ajax_getEnvironment.php @@ -23,7 +23,7 @@ * */ -use SP\Request; +use SP\Http\Request; define('APP_ROOT', '..'); @@ -32,13 +32,13 @@ require APP_ROOT . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'strings.j Request::checkReferer('GET'); -$CryptPKI = new SP\CryptPKI(); -$publicKey = (SP\Session::getPublicKey()) ? SP\Session::getPublicKey() : $CryptPKI->getPublicKey(); +$CryptPKI = new \SP\Core\CryptPKI(); +$publicKey = (\SP\Core\Session::getPublicKey()) ? \SP\Core\Session::getPublicKey() : $CryptPKI->getPublicKey(); $data = array( 'lang' => $stringsJsLang, - 'app_root' => SP\Init::$WEBURI, + 'app_root' => \SP\Core\Init::$WEBURI, 'pk' => $publicKey ); -SP\Response::printJSON($data, 0); \ No newline at end of file +\SP\Http\Response::printJSON($data, 0); \ No newline at end of file diff --git a/ajax/ajax_getFiles.php b/ajax/ajax_getFiles.php index eddf762b..6ced1298 100644 --- a/ajax/ajax_getFiles.php +++ b/ajax/ajax_getFiles.php @@ -23,8 +23,9 @@ * */ -use SP\Request; -use SP\SessionUtil; +use SP\Http\Request; +use SP\Core\SessionUtil; +use SP\Util\Checks; define('APP_ROOT', '..'); @@ -32,21 +33,21 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('GET'); -if (!SP\Init::isLoggedIn()) { +if (!\SP\Core\Init::isLoggedIn()) { return; } -if (!SP\Util::fileIsEnabled()) { +if (!Checks::fileIsEnabled()) { echo _('Gestión de archivos deshabilitada'); return false; } -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printXML(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printXML(_('CONSULTA INVÁLIDA')); } -$controller = new SP\Controller\AccountsMgmtC(); +$controller = new \SP\Controller\AccountsMgmtC(); $controller->getFiles(); $controller->view(); \ No newline at end of file diff --git a/ajax/ajax_import.php b/ajax/ajax_import.php index a24ac867..adda8093 100644 --- a/ajax/ajax_import.php +++ b/ajax/ajax_import.php @@ -23,8 +23,9 @@ * */ -use SP\Request; -use SP\SessionUtil; +use SP\Http\Request; +use SP\Core\SessionUtil; +use SP\Util\Checks; define('APP_ROOT', '..'); @@ -32,39 +33,39 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Http\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); } -if (SP\Util::demoIsEnabled()) { - SP\Response::printJSON(_('Ey, esto es una DEMO!!')); +if (Checks::demoIsEnabled()) { + \SP\Http\Response::printJSON(_('Ey, esto es una DEMO!!')); } -$sk = SP\Request::analyze('sk', false); -$defaultUser= SP\Request::analyze('defUser', 0); -$defaultGroup = SP\Request::analyze('defGroup', 0); -$importPwd = SP\Request::analyzeEncrypted('importPwd'); -$csvDelimiter = SP\Request::analyze('csvDelimiter'); +$sk = \SP\Http\Request::analyze('sk', false); +$defaultUser= \SP\Http\Request::analyze('defUser', 0); +$defaultGroup = \SP\Http\Request::analyze('defGroup', 0); +$importPwd = \SP\Http\Request::analyzeEncrypted('importPwd'); +$csvDelimiter = \SP\Http\Request::analyze('csvDelimiter'); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printJSON(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printJSON(_('CONSULTA INVÁLIDA')); } -SP\Import::setDefUser($defaultUser); -SP\Import::setDefGroup($defaultGroup); -SP\Import::setImportPwd($importPwd); -SP\Import::setCsvDelimiter($csvDelimiter); +\SP\Import\Import::setDefUser($defaultUser); +\SP\Import\Import::setDefGroup($defaultGroup); +\SP\Import\Import::setImportPwd($importPwd); +\SP\Import\Import::setCsvDelimiter($csvDelimiter); -$res = SP\Import::doImport($_FILES["inFile"]); +$res = \SP\Import\Import::doImport($_FILES["inFile"]); if (isset($res['error']) && is_array($res['error'])) { error_log($res['error']['hint']); $out = implode('\n\n', $res['error']); - SP\Response::printJSON($out); + \SP\Http\Response::printJSON($out); } else if (is_array($res['ok'])) { $out = implode('\n\n', $res['ok']); - SP\Response::printJSON($out, 0); + \SP\Http\Response::printJSON($out, 0); } \ No newline at end of file diff --git a/ajax/ajax_migrate.php b/ajax/ajax_migrate.php index 0042ee18..6ae3fbfb 100644 --- a/ajax/ajax_migrate.php +++ b/ajax/ajax_migrate.php @@ -23,8 +23,9 @@ * */ -use SP\Request; -use SP\SessionUtil; +use SP\Http\Request; +use SP\Core\SessionUtil; +use SP\Util\Checks; define('APP_ROOT', '..'); @@ -32,36 +33,36 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Http\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); } -if (SP\Util::demoIsEnabled()) { - SP\Response::printJSON(_('Ey, esto es una DEMO!!')); +if (Checks::demoIsEnabled()) { + \SP\Http\Response::printJSON(_('Ey, esto es una DEMO!!')); } -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printJSON(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printJSON(_('CONSULTA INVÁLIDA')); } -$frmDBUser = SP\Request::analyze('dbuser'); -$frmDBPass = SP\Request::analyzeEncrypted('dbpass'); -$frmDBName = SP\Request::analyze('dbname'); -$frmDBHost = SP\Request::analyze('dbhost'); -$frmMigrateEnabled = SP\Request::analyze('chkmigrate', 0, false, 1); +$frmDBUser = \SP\Http\Request::analyze('dbuser'); +$frmDBPass = \SP\Http\Request::analyzeEncrypted('dbpass'); +$frmDBName = \SP\Http\Request::analyze('dbname'); +$frmDBHost = \SP\Http\Request::analyze('dbhost'); +$frmMigrateEnabled = \SP\Http\Request::analyze('chkmigrate', 0, false, 1); if (!$frmMigrateEnabled) { - SP\Response::printJSON(_('Confirmar la importación de cuentas')); + \SP\Http\Response::printJSON(_('Confirmar la importación de cuentas')); } elseif (!$frmDBUser) { - SP\Response::printJSON(_('Es necesario un usuario de conexión')); + \SP\Http\Response::printJSON(_('Es necesario un usuario de conexión')); } elseif (!$frmDBPass) { - SP\Response::printJSON(_('Es necesaria una clave de conexión')); + \SP\Http\Response::printJSON(_('Es necesaria una clave de conexión')); } elseif (!$frmDBName) { - SP\Response::printJSON(_('Es necesario el nombre de la BBDD')); + \SP\Http\Response::printJSON(_('Es necesario el nombre de la BBDD')); } elseif (!$frmDBHost) { - SP\Response::printJSON(_('Es necesario un nombre de host')); + \SP\Http\Response::printJSON(_('Es necesario un nombre de host')); } $options['dbhost'] = $frmDBHost; @@ -69,7 +70,7 @@ $options['dbname'] = $frmDBName; $options['dbuser'] = $frmDBUser; $options['dbpass'] = $frmDBPass; -$res = SP\Migrate::migrate($options); +$res = \SP\Import\Migrate::migrate($options); if (is_array($res['error'])) { foreach ($res['error'] as $error) { @@ -79,9 +80,9 @@ if (is_array($res['error'])) { } $out = implode('
', $errors); - SP\Response::printJSON($out); + \SP\Http\Response::printJSON($out); } elseif (is_array($res['ok'])) { $out = implode('
', $res['ok']); - SP\Response::printJSON($out, 0); + \SP\Http\Response::printJSON($out, 0); } \ No newline at end of file diff --git a/ajax/ajax_passReset.php b/ajax/ajax_passReset.php index 6829db4f..9570bd1a 100644 --- a/ajax/ajax_passReset.php +++ b/ajax/ajax_passReset.php @@ -23,60 +23,60 @@ * */ -use SP\SessionUtil; -use SP\UserPass; -use SP\UserPassRecover; -use SP\UserUtil; +use SP\Core\SessionUtil; +use SP\Mgmt\User\UserPass; +use SP\Mgmt\User\UserPassRecover; +use SP\Mgmt\User\UserUtil; define('APP_ROOT', '..'); require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; -SP\Request::checkReferer('POST'); +\SP\Http\Request::checkReferer('POST'); -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printJSON(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printJSON(_('CONSULTA INVÁLIDA')); } -$userLogin = SP\Request::analyze('login'); -$userEmail = SP\Request::analyze('email'); -$userPass = SP\Request::analyzeEncrypted('pass'); -$userPassR = SP\Request::analyzeEncrypted('passR'); -$hash = SP\Request::analyze('hash'); -$time = SP\Request::analyze('time'); +$userLogin = \SP\Http\Request::analyze('login'); +$userEmail = \SP\Http\Request::analyze('email'); +$userPass = \SP\Http\Request::analyzeEncrypted('pass'); +$userPassR = \SP\Http\Request::analyzeEncrypted('passR'); +$hash = \SP\Http\Request::analyze('hash'); +$time = \SP\Http\Request::analyze('time'); $message['action'] = _('Recuperación de Clave'); if ($userLogin && $userEmail) { - $log = new \SP\Log(_('Recuperación de Clave')); + $log = new \SP\Log\Log(_('Recuperación de Clave')); - if (SP\Auth::mailPassRecover($userLogin, $userEmail)) { - $log->addDescription(SP\Html::strongText(_('Solicitado para') . ': ') . ' ' . $userLogin . ' (' . $userEmail . ')'); + if (\SP\Auth\Auth::mailPassRecover($userLogin, $userEmail)) { + $log->addDescription(\SP\Html\Html::strongText(_('Solicitado para') . ': ') . ' ' . $userLogin . ' (' . $userEmail . ')'); - SP\Response::printJSON(_('Solicitud enviada') . ';;' . _('En breve recibirá un correo para completar la solicitud.'), 0, 'goLogin();'); + \SP\Http\Response::printJSON(_('Solicitud enviada') . ';;' . _('En breve recibirá un correo para completar la solicitud.'), 0, 'goLogin();'); } else { $log->addDescription('ERROR'); - $log->addDescription(SP\Html::strongText(_('Solicitado para') . ': ') . ' ' . $userLogin . ' (' . $userEmail . ')'); + $log->addDescription(\SP\Html\Html::strongText(_('Solicitado para') . ': ') . ' ' . $userLogin . ' (' . $userEmail . ')'); - SP\Response::printJSON(_('No se ha podido realizar la solicitud. Consulte con el administrador.')); + \SP\Http\Response::printJSON(_('No se ha podido realizar la solicitud. Consulte con el administrador.')); } $log->writeLog(); - SP\Email::sendEmail($log); + \SP\Log\Email::sendEmail($log); } elseif ($userPass && $userPassR && $userPass === $userPassR) { $userId = UserPassRecover::checkHashPassRecover($hash); if ($userId) { if (UserPass::updateUserPass($userId, $userPass) && UserPassRecover::updateHashPassRecover($hash)) { - \SP\Log::writeNewLogAndEmail(_('Modificar Clave Usuario'), SP\Html::strongText(_('Login') . ': ') . UserUtil::getUserLoginById($userId)); + \SP\Log\Log::writeNewLogAndEmail(_('Modificar Clave Usuario'), \SP\Html\Html::strongText(_('Login') . ': ') . UserUtil::getUserLoginById($userId)); - SP\Response::printJSON(_('Clave actualizada'), 0, 'goLogin();'); + \SP\Http\Response::printJSON(_('Clave actualizada'), 0, 'goLogin();'); } } - SP\Response::printJSON(_('Error al modificar la clave')); + \SP\Http\Response::printJSON(_('Error al modificar la clave')); } else { - SP\Response::printJSON(_('La clave es incorrecta o no coincide')); + \SP\Http\Response::printJSON(_('La clave es incorrecta o no coincide')); } \ No newline at end of file diff --git a/ajax/ajax_search.php b/ajax/ajax_search.php index 36056674..bd5f0f32 100644 --- a/ajax/ajax_search.php +++ b/ajax/ajax_search.php @@ -23,8 +23,8 @@ * */ -use SP\Request; -use SP\SessionUtil; +use SP\Http\Request; +use SP\Core\SessionUtil; define('APP_ROOT', '..'); @@ -32,16 +32,16 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Util::logout(); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Util\Util::logout(); } -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { die('
' . _('CONSULTA INVÁLIDA') . '
'); } -$controller = new SP\Controller\SearchC(); +$controller = new \SP\Controller\SearchC(); $controller->getSearch(); $controller->view(); \ No newline at end of file diff --git a/ajax/ajax_sendRequest.php b/ajax/ajax_sendRequest.php index 351cac16..873440d1 100644 --- a/ajax/ajax_sendRequest.php +++ b/ajax/ajax_sendRequest.php @@ -23,31 +23,32 @@ * */ -use SP\AccountUtil; -use SP\SessionUtil; -use SP\UserUtil; +use SP\Account\AccountUtil; +use SP\Core\SessionUtil; +use SP\Mgmt\User\UserUtil; +use SP\Util\Checks; define('APP_ROOT', '..'); require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; -SP\Request::checkReferer('POST'); +\SP\Http\Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Http\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); } -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printJSON(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printJSON(_('CONSULTA INVÁLIDA')); } -$frmAccountId = SP\Request::analyze('accountid', 0); -$frmDescription = SP\Request::analyze('description'); +$frmAccountId = \SP\Http\Request::analyze('accountid', 0); +$frmDescription = \SP\Http\Request::analyze('description'); if (!$frmDescription) { - SP\Response::printJSON(_('Es necesaria una descripción')); + \SP\Http\Response::printJSON(_('Es necesaria una descripción')); } $accountRequestData = AccountUtil::getAccountRequestData($frmAccountId); @@ -57,24 +58,24 @@ $recipients = array( UserUtil::getUserEmail($accountRequestData->account_userEditId) ); -$requestUsername = SP\Session::getUserName(); -$requestLogin = SP\Session::getUserLogin(); +$requestUsername = \SP\Core\Session::getUserName(); +$requestLogin = \SP\Core\Session::getUserLogin(); -$log = new \SP\Log(_('Solicitud de Modificación de Cuenta')); -$log->addDescription(SP\Html::strongText(_('Solicitante') . ': ') . $requestUsername . ' (' . $requestLogin . ')'); -$log->addDescription(SP\Html::strongText(_('Cuenta') . ': ') . $accountRequestData->account_name); -$log->addDescription(SP\Html::strongText(_('Cliente') . ': ') . $accountRequestData->customer_name); -$log->addDescription(SP\Html::strongText(_('Descripción') . ': ') . $frmDescription); +$log = new \SP\Log\Log(_('Solicitud de Modificación de Cuenta')); +$log->addDescription(\SP\Html\Html::strongText(_('Solicitante') . ': ') . $requestUsername . ' (' . $requestLogin . ')'); +$log->addDescription(\SP\Html\Html::strongText(_('Cuenta') . ': ') . $accountRequestData->account_name); +$log->addDescription(\SP\Html\Html::strongText(_('Cliente') . ': ') . $accountRequestData->customer_name); +$log->addDescription(\SP\Html\Html::strongText(_('Descripción') . ': ') . $frmDescription); $mailto = implode(',', $recipients); if (strlen($mailto) > 1 - && SP\Util::mailrequestIsEnabled() - && SP\Email::sendEmail($log, $mailto) + && Checks::mailrequestIsEnabled() + && \SP\Log\Email::sendEmail($log, $mailto) ) { $log->writeLog(); - SP\Response::printJSON(_('Solicitud enviada'), 0, "doAction('" . \SP\Controller\ActionsInterface::ACTION_ACC_SEARCH . "');"); + \SP\Http\Response::printJSON(_('Solicitud enviada'), 0, "doAction('" . \SP\Core\ActionsInterface::ACTION_ACC_SEARCH . "');"); } -SP\Response::printJSON(_('Error al enviar la solicitud')); \ No newline at end of file +\SP\Http\Response::printJSON(_('Error al enviar la solicitud')); \ No newline at end of file diff --git a/ajax/ajax_userPrefsSave.php b/ajax/ajax_userPrefsSave.php index 3c2b453d..7947e4d7 100644 --- a/ajax/ajax_userPrefsSave.php +++ b/ajax/ajax_userPrefsSave.php @@ -23,9 +23,10 @@ * */ -use SP\Request; -use SP\SessionUtil; -use SP\UserUtil; +use SP\Http\Request; +use SP\Core\SessionUtil; +use SP\Mgmt\User\UserUtil; +use SP\Util\Checks; define('APP_ROOT', '..'); @@ -33,34 +34,34 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Http\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); } -$sk = SP\Request::analyze('sk', false); +$sk = \SP\Http\Request::analyze('sk', false); if (!$sk || !SessionUtil::checkSessionKey($sk)) { - SP\Response::printJSON(_('CONSULTA INVÁLIDA')); + \SP\Http\Response::printJSON(_('CONSULTA INVÁLIDA')); } // Variables POST del formulario -$actionId = SP\Request::analyze('actionId', 0); -$itemId = SP\Request::analyze('itemId', 0); -$activeTab = SP\Request::analyze('activeTab', 0); +$actionId = \SP\Http\Request::analyze('actionId', 0); +$itemId = \SP\Http\Request::analyze('itemId', 0); +$activeTab = \SP\Http\Request::analyze('activeTab', 0); // Acción al cerrar la vista $doActionOnClose = "sysPassUtil.Common.doAction($actionId,'',$activeTab);"; -if ($actionId === SP\Controller\ActionsInterface::ACTION_USR_PREFERENCES_GENERAL) { - $userLang = SP\Request::analyze('userlang'); - $userTheme = SP\Request::analyze('usertheme', 'material-blue'); - $resultsPerPage = SP\Request::analyze('resultsperpage', 12); - $accountLink = SP\Request::analyze('account_link', false, false, true); - $sortViews = SP\Request::analyze('sort_views', false, false, true); - $topNavbar = SP\Request::analyze('top_navbar', false, false, true); +if ($actionId === \SP\Core\ActionsInterface::ACTION_USR_PREFERENCES_GENERAL) { + $userLang = \SP\Http\Request::analyze('userlang'); + $userTheme = \SP\Http\Request::analyze('usertheme', 'material-blue'); + $resultsPerPage = \SP\Http\Request::analyze('resultsperpage', 12); + $accountLink = \SP\Http\Request::analyze('account_link', false, false, true); + $sortViews = \SP\Http\Request::analyze('sort_views', false, false, true); + $topNavbar = \SP\Http\Request::analyze('top_navbar', false, false, true); // No se instancia la clase ya que es necesario guardar los atributos ya guardados - $UserPrefs = \SP\UserPreferences::getPreferences($itemId); + $UserPrefs = \SP\Mgmt\User\UserPreferences::getPreferences($itemId); $UserPrefs->setId($itemId); $UserPrefs->setLang($userLang); $UserPrefs->setTheme($userTheme); @@ -70,43 +71,43 @@ if ($actionId === SP\Controller\ActionsInterface::ACTION_USR_PREFERENCES_GENERAL $UserPrefs->setTopNavbar($topNavbar); if (!$UserPrefs->updatePreferences()) { - SP\Response::printJSON(_('Error al actualizar preferencias')); + \SP\Http\Response::printJSON(_('Error al actualizar preferencias')); } // Forzar la detección del lenguaje tras actualizar - SP\Language::setLanguage(true); - SP\Themes::setTheme(true); + \SP\Core\Language::setLanguage(true); + \SP\Core\Themes::setTheme(true); // Actualizar las preferencias en la sesión y recargar la página - SP\Session::setUserPreferences($UserPrefs); - SP\Util::reload(); + \SP\Core\Session::setUserPreferences($UserPrefs); + \SP\Util\Util::reload(); - SP\Response::printJSON(_('Preferencias actualizadas'), 0, $doActionOnClose); -} else if ($actionId === SP\Controller\ActionsInterface::ACTION_USR_PREFERENCES_SECURITY) { - if (SP\Util::demoIsEnabled() && \SP\Session::getUserLogin() === 'demo') { - SP\Response::printJSON(_('Ey, esto es una DEMO!!')); + \SP\Http\Response::printJSON(_('Preferencias actualizadas'), 0, $doActionOnClose); +} else if ($actionId === \SP\Core\ActionsInterface::ACTION_USR_PREFERENCES_SECURITY) { + if (Checks::demoIsEnabled() && \SP\Core\Session::getUserLogin() === 'demo') { + \SP\Http\Response::printJSON(_('Ey, esto es una DEMO!!')); } // Variables POST del formulario - $twoFaEnabled = SP\Request::analyze('security_2faenabled', 0, false, 1); - $pin = SP\Request::analyze('security_pin', 0); + $twoFaEnabled = \SP\Http\Request::analyze('security_2faenabled', 0, false, 1); + $pin = \SP\Http\Request::analyze('security_pin', 0); $userLogin = UserUtil::getUserLoginById($itemId); $twoFa = new \SP\Auth\Auth2FA($itemId, $userLogin); if (!$twoFa->verifyKey($pin)) { - SP\Response::printJSON(_('Código incorrecto')); + \SP\Http\Response::printJSON(_('Código incorrecto')); } // No se instancia la clase ya que es necesario guardar los atributos ya guardados - $UserPrefs = \SP\UserPreferences::getPreferences($itemId); + $UserPrefs = \SP\Mgmt\User\UserPreferences::getPreferences($itemId); $UserPrefs->setId($itemId); - $UserPrefs->setUse2Fa(\SP\Util::boolval($twoFaEnabled)); + $UserPrefs->setUse2Fa(\SP\Util\Util::boolval($twoFaEnabled)); if (!$UserPrefs->updatePreferences()) { - SP\Response::printJSON(_('Error al actualizar preferencias')); + \SP\Http\Response::printJSON(_('Error al actualizar preferencias')); } - SP\Response::printJSON(_('Preferencias actualizadas'), 0, $doActionOnClose); + \SP\Http\Response::printJSON(_('Preferencias actualizadas'), 0, $doActionOnClose); } else { - SP\Response::printJSON(_('Acción Inválida')); + \SP\Http\Response::printJSON(_('Acción Inválida')); } \ No newline at end of file diff --git a/ajax/ajax_usrpass.php b/ajax/ajax_usrpass.php index 6cfbcd88..9ca15e77 100644 --- a/ajax/ajax_usrpass.php +++ b/ajax/ajax_usrpass.php @@ -23,7 +23,7 @@ * */ -use SP\Request; +use SP\Http\Request; define('APP_ROOT', '..'); @@ -31,19 +31,19 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('GET'); -if (!SP\Init::isLoggedIn()) { - SP\Util::logout(); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Util\Util::logout(); } -$userId = SP\Request::analyze('userId', false); +$userId = \SP\Http\Request::analyze('userId', false); if (!$userId) { return; } -$tpl = new SP\Template(); +$tpl = new \SP\Core\Template(); $tpl->assign('userId', $userId); -$controller = new SP\Controller\UsersMgmtC($tpl); +$controller = new \SP\Controller\UsersMgmtC($tpl); $controller->getUserPass(); $tpl->addTemplate('js-common'); $controller->view(); \ No newline at end of file diff --git a/ajax/ajax_viewpass.php b/ajax/ajax_viewpass.php index 69cc21cb..72596fc5 100644 --- a/ajax/ajax_viewpass.php +++ b/ajax/ajax_viewpass.php @@ -23,9 +23,10 @@ * */ -use SP\Request; -use SP\UserPass; -use SP\UserUtil; +use SP\Http\Request; +use SP\Mgmt\User\UserPass; +use SP\Mgmt\User\UserUtil; +use SP\Util\Checks; define('APP_ROOT', '..'); @@ -33,40 +34,40 @@ require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Bas Request::checkReferer('POST'); -if (!SP\Init::isLoggedIn()) { - SP\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); +if (!\SP\Core\Init::isLoggedIn()) { + \SP\Http\Response::printJSON(_('La sesión no se ha iniciado o ha caducado'), 10); } -$accountId = SP\Request::analyze('accountid', false); -$isHistory = SP\Request::analyze('isHistory', false); +$accountId = \SP\Http\Request::analyze('accountid', false); +$isHistory = \SP\Http\Request::analyze('isHistory', false); if (!$accountId) { return; } -$account = (!$isHistory) ? new SP\Account() : new SP\AccountHistory(); +$account = (!$isHistory) ? new \SP\Account\Account() : new \SP\Account\AccountHistory(); -$account->setAccountParentId(\SP\Session::getAccountParentId()); +$account->setAccountParentId(\SP\Core\Session::getAccountParentId()); $account->setAccountId($accountId); $accountData = $account->getAccountPassData(); if ($isHistory && !$account->checkAccountMPass()) { - SP\Response::printJSON(_('La clave maestra no coincide')); + \SP\Http\Response::printJSON(_('La clave maestra no coincide')); } -if (!SP\Acl::checkAccountAccess(SP\Acl::ACTION_ACC_VIEW_PASS, $account->getAccountDataForACL()) || !SP\Acl::checkUserAccess(SP\Acl::ACTION_ACC_VIEW_PASS)) { - SP\Response::printJSON(_('No tiene permisos para acceder a esta cuenta')); +if (!\SP\Core\Acl::checkAccountAccess(\SP\Core\Acl::ACTION_ACC_VIEW_PASS, $account->getAccountDataForACL()) || !\SP\Core\Acl::checkUserAccess(\SP\Core\Acl::ACTION_ACC_VIEW_PASS)) { + \SP\Http\Response::printJSON(_('No tiene permisos para acceder a esta cuenta')); } elseif (!UserPass::checkUserUpdateMPass()) { - SP\Response::printJSON(_('Clave maestra actualizada') . '
' . _('Reinicie la sesión para cambiarla')); + \SP\Http\Response::printJSON(_('Clave maestra actualizada') . '
' . _('Reinicie la sesión para cambiarla')); } -$accountClearPass = SP\Crypt::getDecrypt($accountData->pass, $accountData->iv); +$accountClearPass = \SP\Core\Crypt::getDecrypt($accountData->pass, $accountData->iv); if (!$isHistory) { $account->incrementDecryptCounter(); - $log = new \SP\Log(_('Ver Clave')); + $log = new \SP\Log\Log(_('Ver Clave')); $log->addDescription(_('ID') . ': ' . $accountId); $log->addDescription(_('Cuenta') . ': ' . $accountData->customer_name . " / " . $accountData->name); $log->writeLog(); @@ -74,13 +75,13 @@ if (!$isHistory) { //$accountPass = htmlspecialchars(trim($accountClearPass)); -$useImage = intval(\SP\Util::accountPassToImageIsEnabled()); +$useImage = intval(Checks::accountPassToImageIsEnabled()); $data = array( 'title' => _('Clave de Cuenta'), 'acclogin' => $accountData->login, - 'accpass' => (!$useImage) ? trim($accountClearPass) : \SP\ImageUtil::convertText($accountClearPass), + 'accpass' => (!$useImage) ? trim($accountClearPass) : \SP\Util\ImageUtil::convertText($accountClearPass), 'useimage' => $useImage ); -SP\Response::printJSON($data, 0); \ No newline at end of file +\SP\Http\Response::printJSON($data, 0); \ No newline at end of file diff --git a/api.php b/api.php index a5f93274..6f7e9d7a 100644 --- a/api.php +++ b/api.php @@ -28,24 +28,24 @@ define('APP_ROOT', '.'); require APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; try { - $ApiRequest = new \SP\ApiRequest(); + $ApiRequest = new \SP\Api\ApiRequest(); switch ($ApiRequest->getAction()) { - case \SP\Controller\ActionsInterface::ACTION_ACC_VIEW: - $itemId = \SP\Request::analyze(\SP\ApiRequest::ITEM, 0); + case \SP\Core\ActionsInterface::ACTION_ACC_VIEW: + $itemId = \SP\Http\Request::analyze(\SP\Api\ApiRequest::ITEM, 0); $out = $ApiRequest->getApi()->getAccountData($itemId); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_VIEW_PASS: - $ApiRequest->addVar('userPass', \SP\ApiRequest::analyze(\SP\ApiRequest::USER_PASS)); + case \SP\Core\ActionsInterface::ACTION_ACC_VIEW_PASS: + $ApiRequest->addVar('userPass', \SP\Api\ApiRequest::analyze(\SP\Api\ApiRequest::USER_PASS)); - $itemId = \SP\Request::analyze(\SP\ApiRequest::ITEM, 0); + $itemId = \SP\Http\Request::analyze(\SP\Api\ApiRequest::ITEM, 0); $out = $ApiRequest->getApi()->getAccountPassword($itemId); break; - case \SP\Controller\ActionsInterface::ACTION_ACC_SEARCH: - $search = \SP\Request::analyze(\SP\ApiRequest::SEARCH); - $count = \SP\Request::analyze(\SP\ApiRequest::SEARCH_COUNT, 10); + case \SP\Core\ActionsInterface::ACTION_ACC_SEARCH: + $search = \SP\Http\Request::analyze(\SP\Api\ApiRequest::SEARCH); + $count = \SP\Http\Request::analyze(\SP\Api\ApiRequest::SEARCH_COUNT, 10); $out = $ApiRequest->getApi()->getAccountSearch($search, $count); break; @@ -53,7 +53,7 @@ try { throw new Exception(_('Acción Inválida')); } } catch (Exception $e) { - \SP\Response::printJSON(array($e->getMessage(), _('Ayuda Parámetros') => \SP\ApiRequest::getHelp())); + \SP\Http\Response::printJSON(array($e->getMessage(), _('Ayuda Parámetros') => \SP\Api\ApiRequest::getHelp())); } header('Content-type: application/json'); diff --git a/css/css.php b/css/css.php index 5e2246b3..07ef9abd 100644 --- a/css/css.php +++ b/css/css.php @@ -23,14 +23,14 @@ * */ -use SP\Minify; +use SP\Html\Minify; define('APP_ROOT', '..'); require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; -$file = \SP\Request::analyze('f'); -$base = \SP\Request::analyze('b'); +$file = \SP\Http\Request::analyze('f'); +$base = \SP\Http\Request::analyze('b'); if (!$file) { $Minify = new Minify(); @@ -48,11 +48,11 @@ if (!$file) { $Minify->addFile('material-icons.min.css'); $Minify->getMinified(); } elseif ($file && $base) { - $base = \SP\Request::analyze('b'); + $base = \SP\Http\Request::analyze('b'); $Minify = new Minify(); $Minify->setType(Minify::FILETYPE_CSS); - $Minify->setBase(\SP\Init::$SERVERROOT . urldecode($base)); + $Minify->setBase(\SP\Core\Init::$SERVERROOT . urldecode($base)); $Minify->addFile(urldecode($file)); $Minify->getMinified(); } \ No newline at end of file diff --git a/inc/Base.php b/inc/Base.php index 167bb9dc..432063d8 100644 --- a/inc/Base.php +++ b/inc/Base.php @@ -26,19 +26,27 @@ defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); define('CONFIG_FILE', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'); -define('MODEL_PATH', __DIR__); +define('MODEL_PATH', __DIR__ . DIRECTORY_SEPARATOR . 'SP'); define('CONTROLLER_PATH', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'web'); define('VIEW_PATH', __DIR__ . DIRECTORY_SEPARATOR . 'themes'); -define('EXTENSIONS_PATH', __DIR__ . DIRECTORY_SEPARATOR . 'ext'); +define('EXTENSIONS_PATH', __DIR__ . DIRECTORY_SEPARATOR . 'Exts'); define('LOCALES_PATH', __DIR__ . DIRECTORY_SEPARATOR . 'locales'); -define('DEBUG', false); +define('DEBUG', true); -require MODEL_PATH . DIRECTORY_SEPARATOR . 'Init.class.php'; +require 'SplClassLoader.php'; + +$ClassLoader = new SplClassLoader(); +$ClassLoader->setFileExtension('.class.php'); +$ClassLoader->addExcluded('SP\\Profile'); +$ClassLoader->addExcluded('SP\\UserPreferences'); +$ClassLoader->addExcluded('SP\\CustomFieldDef'); +$ClassLoader->addExcluded('SP\\PublicLink'); +$ClassLoader->register(); // Empezar a calcular el tiempo y memoria utilizados $memInit = memory_get_usage(); -$timeStart = \SP\Init::microtime_float(); +$timeStart = \SP\Core\Init::microtime_float(); // Inicializar sysPass -\SP\Init::start(); \ No newline at end of file +\SP\Core\Init::start(); \ No newline at end of file diff --git a/inc/ext/Base2n.class.php b/inc/Exts/Base2n.class.php similarity index 99% rename from inc/ext/Base2n.class.php rename to inc/Exts/Base2n.class.php index 2f827e44..e4244967 100644 --- a/inc/ext/Base2n.class.php +++ b/inc/Exts/Base2n.class.php @@ -1,6 +1,6 @@ addDescription(_('Inicio')); diff --git a/inc/AccountInterface.class.php b/inc/SP/Account/AccountInterface.class.php similarity index 98% rename from inc/AccountInterface.class.php rename to inc/SP/Account/AccountInterface.class.php index 5877a215..50e7a540 100644 --- a/inc/AccountInterface.class.php +++ b/inc/SP/Account/AccountInterface.class.php @@ -23,7 +23,7 @@ * */ -namespace SP; +namespace SP\Account; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/AccountSearch.class.php b/inc/SP/Account/AccountSearch.class.php similarity index 98% rename from inc/AccountSearch.class.php rename to inc/SP/Account/AccountSearch.class.php index 155976e1..eb7bd9c9 100644 --- a/inc/AccountSearch.class.php +++ b/inc/SP/Account/AccountSearch.class.php @@ -23,7 +23,14 @@ * */ -namespace SP; +namespace SP\Account; + +use SP\Config\Config; +use SP\Storage\DB; +use SP\Mgmt\User\Groups; +use SP\Html\Html; +use SP\Core\Session; +use SP\Mgmt\User\UserUtil; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/AccountUtil.class.php b/inc/SP/Account/AccountUtil.class.php similarity index 98% rename from inc/AccountUtil.class.php rename to inc/SP/Account/AccountUtil.class.php index a4227633..e5f2000d 100644 --- a/inc/AccountUtil.class.php +++ b/inc/SP/Account/AccountUtil.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Account; + +use SP\Storage\DB; +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/UserAccounts.class.php b/inc/SP/Account/UserAccounts.class.php similarity index 99% rename from inc/UserAccounts.class.php rename to inc/SP/Account/UserAccounts.class.php index aed025b4..9216e84f 100644 --- a/inc/UserAccounts.class.php +++ b/inc/SP/Account/UserAccounts.class.php @@ -23,7 +23,9 @@ * */ -namespace SP; +namespace SP\Account; + +use SP\Storage\DB; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Api.class.php b/inc/SP/Api/Api.class.php similarity index 95% rename from inc/Api.class.php rename to inc/SP/Api/Api.class.php index e0d6d794..0f9e97b6 100644 --- a/inc/Api.class.php +++ b/inc/SP/Api/Api.class.php @@ -23,9 +23,19 @@ * */ -namespace SP; +namespace SP\Api; -use SP\Controller\ActionsInterface; +use SP\Account\Account; +use SP\Account\AccountSearch; +use SP\Auth\Auth; +use SP\Core\ActionsInterface; +use SP\Core\Acl; +use SP\Core\Crypt; +use SP\Core\Session; +use SP\Core\SPException; +use SP\Mgmt\User\User; +use SP\Mgmt\User\UserPass; +use SP\Mgmt\User\UserUtil; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/ApiRequest.class.php b/inc/SP/Api/ApiRequest.class.php similarity index 97% rename from inc/ApiRequest.class.php rename to inc/SP/Api/ApiRequest.class.php index 3f98a0a1..f6b442e1 100644 --- a/inc/ApiRequest.class.php +++ b/inc/SP/Api/ApiRequest.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Api; + +use SP\Http\Request; +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/ApiTokens.class.php b/inc/SP/Api/ApiTokens.class.php similarity index 98% rename from inc/ApiTokens.class.php rename to inc/SP/Api/ApiTokens.class.php index c0eb79c1..10808b9c 100644 --- a/inc/ApiTokens.class.php +++ b/inc/SP/Api/ApiTokens.class.php @@ -23,11 +23,19 @@ * */ -namespace SP; +namespace SP\Api; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); -use SP\Controller\ActionsInterface; +use SP\Core\ActionsInterface; +use SP\Core\Acl; +use SP\Storage\DB; +use SP\Log\Email; +use SP\Html\Html; +use SP\Log\Log; +use SP\Core\Session; +use SP\Core\SPException; +use SP\Mgmt\User\UserUtil; /** * Class ApiTokens para la gestión de autorizaciones de acceso a la API de sysPass diff --git a/inc/Auth.class.php b/inc/SP/Auth/Auth.class.php similarity index 95% rename from inc/Auth.class.php rename to inc/SP/Auth/Auth.class.php index d93847f6..362eaf66 100644 --- a/inc/Auth.class.php +++ b/inc/SP/Auth/Auth.class.php @@ -24,7 +24,20 @@ * */ -namespace SP; +namespace SP\Auth; + +use SP\Config\Config; +use SP\Storage\DB; +use SP\Log\Email; +use SP\Html\Html; +use SP\Core\Init; +use SP\Log\Log; +use SP\Mgmt\User\UserLdap; +use SP\Mgmt\User\UserMigrate; +use SP\Mgmt\User\UserPassRecover; +use SP\Mgmt\User\UserUtil; +use SP\Util\Checks; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -45,7 +58,7 @@ class Auth */ public static function authUserLDAP($userLogin, $userPass) { - if (!Util::ldapIsAvailable() || !Util::ldapIsEnabled() || !Ldap::checkLDAPParams()) { + if (!Checks::ldapIsAvailable() || !Checks::ldapIsEnabled() || !Ldap::checkLDAPParams()) { return false; } diff --git a/inc/Auth2FA.class.php b/inc/SP/Auth/Auth2FA.class.php similarity index 97% rename from inc/Auth2FA.class.php rename to inc/SP/Auth/Auth2FA.class.php index df461ed9..03fb2046 100644 --- a/inc/Auth2FA.class.php +++ b/inc/SP/Auth/Auth2FA.class.php @@ -25,10 +25,10 @@ namespace SP\Auth; -use SP\Exts\Google2FA; -use SP\Exts\Base2n; -use SP\UserPass; -use SP\Util; +use Exts\Google2FA; +use Exts\Base2n; +use SP\Mgmt\User\UserPass; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Ldap.class.php b/inc/SP/Auth/Ldap.class.php similarity index 99% rename from inc/Ldap.class.php rename to inc/SP/Auth/Ldap.class.php index 03eb56d6..507ac97b 100644 --- a/inc/Ldap.class.php +++ b/inc/SP/Auth/Ldap.class.php @@ -24,7 +24,10 @@ * */ -namespace SP; +namespace SP\Auth; + +use SP\Config\Config; +use SP\Log\Log; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -269,7 +272,6 @@ class Ldap * * @param string $userLogin con el login del usuario * @throws \Exception - * @return none */ public static function getUserDN($userLogin) { diff --git a/inc/LdapADS.class.php b/inc/SP/Auth/LdapADS.class.php similarity index 98% rename from inc/LdapADS.class.php rename to inc/SP/Auth/LdapADS.class.php index 9acedb5b..7ff94456 100644 --- a/inc/LdapADS.class.php +++ b/inc/SP/Auth/LdapADS.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Auth; + +use SP\Config\Config; +use SP\Log\Log; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Cache.class.php b/inc/SP/Config/Cache.class.php similarity index 99% rename from inc/Cache.class.php rename to inc/SP/Config/Cache.class.php index 68470939..9ee77b19 100644 --- a/inc/Cache.class.php +++ b/inc/SP/Config/Cache.class.php @@ -23,7 +23,7 @@ * */ -namespace SP; +namespace SP\Config; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Config.class.php b/inc/SP/Config/Config.class.php similarity index 99% rename from inc/Config.class.php rename to inc/SP/Config/Config.class.php index 4bed6d48..df824768 100644 --- a/inc/Config.class.php +++ b/inc/SP/Config/Config.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Config; + +use SP\Core\Language; +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/ConfigDB.class.php b/inc/SP/Config/ConfigDB.class.php similarity index 98% rename from inc/ConfigDB.class.php rename to inc/SP/Config/ConfigDB.class.php index 2be14ca1..3d8a60c4 100644 --- a/inc/ConfigDB.class.php +++ b/inc/SP/Config/ConfigDB.class.php @@ -23,7 +23,11 @@ * */ -namespace SP; +namespace SP\Config; + +use SP\Storage\DB; +use SP\Log\Email; +use SP\Log\Log; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/ConfigInterface.class.php b/inc/SP/Config/ConfigInterface.class.php similarity index 99% rename from inc/ConfigInterface.class.php rename to inc/SP/Config/ConfigInterface.class.php index 7b8c9647..2be079ff 100644 --- a/inc/ConfigInterface.class.php +++ b/inc/SP/Config/ConfigInterface.class.php @@ -23,7 +23,7 @@ * */ -namespace SP; +namespace SP\Config; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/web/AccountC.class.php b/inc/SP/Controller/AccountC.class.php similarity index 90% rename from web/AccountC.class.php rename to inc/SP/Controller/AccountC.class.php index 36d2f024..3a43313d 100644 --- a/web/AccountC.class.php +++ b/inc/SP/Controller/AccountC.class.php @@ -25,24 +25,25 @@ namespace SP\Controller; -use SP\Account; -use SP\AccountHistory; -use SP\Acl; -use SP\Config; -use SP\Crypt; -use SP\Init; -use SP\PublicLink; -use SP\Request; -use SP\Response; -use SP\CustomFields; -use SP\Groups; -use SP\Session; -use SP\SessionUtil; -use SP\SPException; -use SP\UserAccounts; -use SP\UserPass; -use SP\UserUtil; -use SP\Util; +use SP\Account\Account; +use SP\Account\AccountHistory; +use SP\Core\Acl; +use SP\Config\Config; +use SP\Core\ActionsInterface; +use SP\Core\Crypt; +use SP\Core\Init; +use SP\Mgmt\PublicLink; +use SP\Mgmt\CustomFields; +use SP\Mgmt\User\Groups; +use SP\Core\Session; +use SP\Core\SessionUtil; +use SP\Core\SPException; +use SP\Account\UserAccounts; +use SP\Mgmt\User\UserPass; +use SP\Storage\DBUtil; +use SP\Util\Checks; +use SP\Util\ImageUtil; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -73,11 +74,11 @@ class AccountC extends Controller implements ActionsInterface /** * Constructor * - * @param \SP\Template $template instancia del motor de plantillas + * @param \SP\Core\Template $template instancia del motor de plantillas * @param int $lastAction int con la última acción realizada * @param int $accountId int con el id de la cuenta */ - public function __construct(\SP\Template $template = null, $lastAction = null, $accountId = null) + public function __construct(\SP\Core\Template $template = null, $lastAction = null, $accountId = null) { parent::__construct($template); @@ -165,14 +166,14 @@ class AccountC extends Controller implements ActionsInterface $this->view->assign('accountOtherUsers', $this->getAccount()->getAccountUsersId()); $this->view->assign('accountOtherUsersName', UserAccounts::getUsersNameForAccount($this->getId())); $this->view->assign('accountOtherGroups', $this->getAccount()->getAccountUserGroupsId()); - $this->view->assign('accountOtherGroupsName', \SP\Groups::getGroupsNameForAccount($this->getId())); + $this->view->assign('accountOtherGroupsName', \SP\Mgmt\User\Groups::getGroupsNameForAccount($this->getId())); $this->view->assign('changesHash', $this->getAccount()->calcChangesHash()); $this->view->assign('chkUserEdit', ($this->view->accountData->account_otherUserEdit) ? 'checked' : ''); $this->view->assign('chkGroupEdit', ($this->view->accountData->account_otherGroupEdit) ? 'checked' : ''); - $this->view->assign('historyData', \SP\AccountHistory::getAccountList($this->getAccount()->getAccountParentId())); + $this->view->assign('historyData', \SP\Account\AccountHistory::getAccountList($this->getAccount()->getAccountParentId())); $this->view->assign('isModified', ($this->view->accountData->account_dateEdit && $this->view->accountData->account_dateEdit <> '0000-00-00 00:00:00')); - $this->view->assign('maxFileSize', round(\SP\Config::getValue('files_allowed_size') / 1024, 1)); - $this->view->assign('filesAllowedExts', \SP\Config::getValue('files_allowed_exts')); + $this->view->assign('maxFileSize', round(Config::getValue('files_allowed_size') / 1024, 1)); + $this->view->assign('filesAllowedExts', Config::getValue('files_allowed_exts')); $this->view->assign('filesDelete', ($this->_action == Acl::ACTION_ACC_EDIT) ? 1 : 0); $publicLinkUrl = Init::$WEBURI . '/?h=' . $this->view->accountData->publicLink_hash . '&a=link'; @@ -180,10 +181,10 @@ class AccountC extends Controller implements ActionsInterface } $this->view->assign('accountParentId', Session::getLastAcountId()); - $this->view->assign('categories', \SP\DB::getValuesForSelect('categories', 'category_id', 'category_name')); - $this->view->assign('customers', \SP\DB::getValuesForSelect('customers', 'customer_id', 'customer_name')); - $this->view->assign('otherUsers', \SP\DB::getValuesForSelect('usrData', 'user_id', 'user_name')); - $this->view->assign('otherGroups', \SP\DB::getValuesForSelect('usrGroups', 'usergroup_id', 'usergroup_name')); + $this->view->assign('categories', DBUtil::getValuesForSelect('categories', 'category_id', 'category_name')); + $this->view->assign('customers', DBUtil::getValuesForSelect('customers', 'customer_id', 'customer_name')); + $this->view->assign('otherUsers', DBUtil::getValuesForSelect('usrData', 'user_id', 'user_name')); + $this->view->assign('otherGroups', DBUtil::getValuesForSelect('usrGroups', 'usergroup_id', 'usergroup_name')); $this->getCustomFieldsForItem(); } @@ -232,7 +233,7 @@ class AccountC extends Controller implements ActionsInterface $this->view->assign('showDetails', ($this->_action == Acl::ACTION_ACC_VIEW || $this->_action == Acl::ACTION_ACC_VIEW_HISTORY || $this->_action == Acl::ACTION_ACC_DELETE)); $this->view->assign('showPass', ($this->_action == Acl::ACTION_ACC_NEW || $this->_action == Acl::ACTION_ACC_COPY)); $this->view->assign('showFiles', (($this->_action == Acl::ACTION_ACC_EDIT || $this->_action == Acl::ACTION_ACC_VIEW || $this->_action == Acl::ACTION_ACC_VIEW_HISTORY) - && (\SP\Util::fileIsEnabled() && Acl::checkUserAccess(Acl::ACTION_ACC_FILES)))); + && (Checks::fileIsEnabled() && Acl::checkUserAccess(Acl::ACTION_ACC_FILES)))); $this->view->assign('showViewPass', (($this->_action == Acl::ACTION_ACC_VIEW || $this->_action == Acl::ACTION_ACC_VIEW_HISTORY) && (Acl::checkAccountAccess(Acl::ACTION_ACC_VIEW_PASS, $aclData) && Acl::checkUserAccess(Acl::ACTION_ACC_VIEW_PASS)))); @@ -251,7 +252,7 @@ class AccountC extends Controller implements ActionsInterface $this->view->assign('showRestore', ($this->_action == Acl::ACTION_ACC_VIEW_HISTORY && Acl::checkAccountAccess(Acl::ACTION_ACC_EDIT, $this->_account->getAccountDataForACL($this->_account->getAccountParentId())) && Acl::checkUserAccess(Acl::ACTION_ACC_EDIT))); - $this->view->assign('showLink', \SP\Util::publicLinksIsEnabled() && Acl::checkUserAccess(Acl::ACTION_MGM_PUBLICLINKS)); + $this->view->assign('showLink', Checks::publicLinksIsEnabled() && Acl::checkUserAccess(Acl::ACTION_MGM_PUBLICLINKS)); } /** @@ -415,7 +416,7 @@ class AccountC extends Controller implements ActionsInterface ); $this->view->assign('showform', false); - \SP\Session::setAccountParentId($this->getId()); + \SP\Core\Session::setAccountParentId($this->getId()); $this->_account->incrementViewCounter(); $this->setCommonData(); @@ -462,7 +463,7 @@ class AccountC extends Controller implements ActionsInterface try { $this->setAccount(new AccountHistory()); $this->_account->setAccountId($this->getId()); - $this->_account->setAccountParentId(\SP\Session::getAccountParentId()); + $this->_account->setAccountParentId(Session::getAccountParentId()); $this->view->assign('accountId', $this->getId()); $this->view->assign('accountData', $this->getAccount()->getAccountData()); @@ -471,7 +472,7 @@ class AccountC extends Controller implements ActionsInterface $this->setAccountDetails(); $this->setGotData(true); - Session::setLastAcountId(\SP\Session::getAccountParentId()); + Session::setLastAcountId(Session::getAccountParentId()); } catch (SPException $e) { return false; } @@ -549,7 +550,7 @@ class AccountC extends Controller implements ActionsInterface $accountPass = Crypt::getDecrypt($this->_account->getAccountPass(), $this->_account->getAccountIV(), $masterPass); if (Config::getValue('publinks_image_enabled', false)) { - $accountPass = \SP\ImageUtil::convertText($accountPass); + $accountPass = ImageUtil::convertText($accountPass); } $this->view->assign('accountPass', $accountPass); diff --git a/web/AccountsMgmtC.class.php b/inc/SP/Controller/AccountsMgmtC.class.php similarity index 88% rename from web/AccountsMgmtC.class.php rename to inc/SP/Controller/AccountsMgmtC.class.php index 2c0c7070..4427196b 100644 --- a/web/AccountsMgmtC.class.php +++ b/inc/SP/Controller/AccountsMgmtC.class.php @@ -25,10 +25,16 @@ namespace SP\Controller; -use SP\ApiTokens; -use SP\CustomFieldDef; -use SP\CustomFields; -use SP\SessionUtil; +use SP\Core\ActionsInterface; +use SP\Http\Request; +use SP\Mgmt\Category; +use SP\Mgmt\Customer; +use SP\Mgmt\CustomFieldDef; +use SP\Mgmt\CustomFields; +use SP\Core\SessionUtil; +use SP\Mgmt\Files; +use SP\Util\Checks; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -51,13 +57,13 @@ class AccountsMgmtC extends Controller implements ActionsInterface /** * Constructor * - * @param $template \SP\Template con instancia de plantilla + * @param $template \SP\Core\Template con instancia de plantilla */ - public function __construct(\SP\Template $template = null) + public function __construct(\SP\Core\Template $template = null) { parent::__construct($template); - $this->view->assign('isDemo', \SP\Util::demoIsEnabled()); + $this->view->assign('isDemo', Checks::demoIsEnabled()); $this->view->assign('sk', SessionUtil::getSessionKey()); } @@ -114,7 +120,7 @@ class AccountsMgmtC extends Controller implements ActionsInterface 'tabs', array( 'title' => _('Gestión de Categorías'), - 'query' => \SP\Category::getCategories(), + 'query' => Category::getCategories(), 'props' => $categoriesTableProp, 'time' => round(microtime() - $this->view->queryTimeStart, 5)) ); @@ -171,7 +177,7 @@ class AccountsMgmtC extends Controller implements ActionsInterface $this->view->append( 'tabs', array( 'title' => _('Gestión de Clientes'), - 'query' => \SP\Customer::getCustomers(), + 'query' => Customer::getCustomers(), 'props' => $customersTableProp, 'time' => round(microtime() - $this->view->queryTimeStart, 5)) ); @@ -199,7 +205,7 @@ class AccountsMgmtC extends Controller implements ActionsInterface $this->_module = self::ACTION_MGM_CUSTOMERS; $this->view->addTemplate('customers'); - $this->view->assign('customer', \SP\Customer::getCustomerData($this->view->itemId)); + $this->view->assign('customer', Customer::getCustomerData($this->view->itemId)); $this->getCustomFieldsForItem(); } @@ -211,7 +217,7 @@ class AccountsMgmtC extends Controller implements ActionsInterface $this->_module = self::ACTION_MGM_CATEGORIES; $this->view->addTemplate('categories'); - $this->view->assign('category', \SP\Category::getCategoryData($this->view->itemId)); + $this->view->assign('category', Category::getCategoryData($this->view->itemId)); $this->getCustomFieldsForItem(); } @@ -235,9 +241,9 @@ class AccountsMgmtC extends Controller implements ActionsInterface { $this->setAction(self::ACTION_ACC_FILES); - $this->view->assign('accountId', \SP\Request::analyze('id', 0)); - $this->view->assign('deleteEnabled', \SP\Request::analyze('del', 0)); - $this->view->assign('files', \SP\Files::getFileList($this->view->accountId)); + $this->view->assign('accountId', Request::analyze('id', 0)); + $this->view->assign('deleteEnabled', Request::analyze('del', 0)); + $this->view->assign('files', Files::getFileList($this->view->accountId)); if (!is_array($this->view->files) || count($this->view->files) === 0) { return; @@ -299,7 +305,7 @@ class AccountsMgmtC extends Controller implements ActionsInterface $this->view->append( 'tabs', array( 'title' => _('Campos Personalizados'), - 'query' => \SP\CustomFieldDef::getCustomFields(), + 'query' => CustomFieldDef::getCustomFields(), 'props' => $tableProp, 'time' => round(microtime() - $this->view->queryTimeStart, 5)) ); @@ -312,13 +318,17 @@ class AccountsMgmtC extends Controller implements ActionsInterface { $this->view->addTemplate('customfields'); - $customField = \SP\CustomFieldDef::getCustomFields($this->view->itemId, true); + $customField = CustomFieldDef::getCustomFields($this->view->itemId, true); $field = unserialize($customField->customfielddef_field); + if (get_class($field) === '__PHP_Incomplete_Class') { + $field = Util::castToClass('SP\Mgmt\CustomFieldDef', $field); + } + $this->view->assign('gotData', ($customField && $field instanceof CustomFieldDef)); $this->view->assign('customField', $customField); $this->view->assign('field', $field); - $this->view->assign('types', \SP\CustomFieldDef::getFieldsTypes()); - $this->view->assign('modules', \SP\CustomFieldDef::getFieldsModules()); + $this->view->assign('types', CustomFieldDef::getFieldsTypes()); + $this->view->assign('modules', CustomFieldDef::getFieldsModules()); } } diff --git a/web/ConfigC.class.php b/inc/SP/Controller/ConfigC.class.php similarity index 58% rename from web/ConfigC.class.php rename to inc/SP/Controller/ConfigC.class.php index 98355ac9..945d1f9b 100644 --- a/web/ConfigC.class.php +++ b/inc/SP/Controller/ConfigC.class.php @@ -25,12 +25,17 @@ namespace SP\Controller; -use SP\Config; -use SP\ConfigDB; -use SP\Language; -use SP\Session; -use SP\SessionUtil; -use SP\Themes; +use SP\Config\Config; +use SP\Config\ConfigDB; +use SP\Core\ActionsInterface; +use SP\Core\Init; +use SP\Core\Language; +use SP\Core\Session; +use SP\Core\SessionUtil; +use SP\Core\Themes; +use SP\Storage\DBUtil; +use SP\Util\Checks; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -46,16 +51,16 @@ class ConfigC extends Controller implements ActionsInterface /** * Constructor * - * @param $template \SP\Template con instancia de plantilla + * @param $template \SP\Core\Template con instancia de plantilla */ - public function __construct(\SP\Template $template = null) + public function __construct(\SP\Core\Template $template = null) { parent::__construct($template); $this->view->assign('tabs', array()); $this->view->assign('sk', SessionUtil::getSessionKey(true)); - $this->view->assign('isDemoMode', (\SP\Util::demoIsEnabled() && !Session::getUserIsAdminApp())); - $this->view->assign('isDisabled', (\SP\Util::demoIsEnabled() && !Session::getUserIsAdminApp()) ? 'DISABLED' : ''); + $this->view->assign('isDemoMode', (Checks::demoIsEnabled() && !Session::getUserIsAdminApp())); + $this->view->assign('isDisabled', (Checks::demoIsEnabled() && !Session::getUserIsAdminApp()) ? 'DISABLED' : ''); } /** @@ -74,41 +79,41 @@ class ConfigC extends Controller implements ActionsInterface $this->view->addTemplate('config'); $this->view->assign('langsAvailable',Language::getAvailableLanguages()); - $this->view->assign('currentLang', \SP\Config::getValue('sitelang')); + $this->view->assign('currentLang', Config::getValue('sitelang')); $this->view->assign('themesAvailable', Themes::getThemesAvailable()); - $this->view->assign('currentTheme', \SP\Config::getValue('sitetheme')); - $this->view->assign('chkHttps', (\SP\Config::getValue('https_enabled')) ? 'checked="checked"' : ''); - $this->view->assign('chkLog', (\SP\Config::getValue('log_enabled')) ? 'checked="checked"' : ''); - $this->view->assign('chkDebug', (\SP\Config::getValue('debug')) ? 'checked="checked"' : ''); - $this->view->assign('chkMaintenance', (\SP\Config::getValue('maintenance')) ? 'checked="checked"' : ''); - $this->view->assign('chkUpdates', (\SP\Config::getValue('checkupdates')) ? 'checked="checked"' : ''); - $this->view->assign('chkNotices', (\SP\Config::getValue('checknotices')) ? 'checked="checked"' : ''); - $this->view->assign('sessionTimeout', \SP\Config::getValue('session_timeout')); + $this->view->assign('currentTheme', Config::getValue('sitetheme')); + $this->view->assign('chkHttps', (Config::getValue('https_enabled')) ? 'checked="checked"' : ''); + $this->view->assign('chkLog', (Config::getValue('log_enabled')) ? 'checked="checked"' : ''); + $this->view->assign('chkDebug', (Config::getValue('debug')) ? 'checked="checked"' : ''); + $this->view->assign('chkMaintenance', (Config::getValue('maintenance')) ? 'checked="checked"' : ''); + $this->view->assign('chkUpdates', (Config::getValue('checkupdates')) ? 'checked="checked"' : ''); + $this->view->assign('chkNotices', (Config::getValue('checknotices')) ? 'checked="checked"' : ''); + $this->view->assign('sessionTimeout', Config::getValue('session_timeout')); // Files - $this->view->assign('chkFiles', (\SP\Config::getValue('files_enabled')) ? 'checked="checked"' : ''); - $this->view->assign('filesAllowedExts', \SP\Config::getValue('files_allowed_exts')); - $this->view->assign('filesAllowedSize', \SP\Config::getValue('files_allowed_size')); + $this->view->assign('chkFiles', (Config::getValue('files_enabled')) ? 'checked="checked"' : ''); + $this->view->assign('filesAllowedExts', Config::getValue('files_allowed_exts')); + $this->view->assign('filesAllowedSize', Config::getValue('files_allowed_size')); // Accounts - $this->view->assign('chkGlobalSearch', (\SP\Config::getValue('globalsearch')) ? 'checked="checked"' : ''); - $this->view->assign('chkResultsAsCards', (\SP\Config::getValue('resultsascards')) ? 'checked="checked"' : ''); - $this->view->assign('chkAccountPassToImage', (\SP\Config::getValue('account_passtoimage')) ? 'checked="checked"' : ''); - $this->view->assign('chkAccountLink', (\SP\Config::getValue('account_link')) ? 'checked="checked"' : ''); - $this->view->assign('accountCount', \SP\Config::getValue('account_count')); + $this->view->assign('chkGlobalSearch', (Config::getValue('globalsearch')) ? 'checked="checked"' : ''); + $this->view->assign('chkResultsAsCards', (Config::getValue('resultsascards')) ? 'checked="checked"' : ''); + $this->view->assign('chkAccountPassToImage', (Config::getValue('account_passtoimage')) ? 'checked="checked"' : ''); + $this->view->assign('chkAccountLink', (Config::getValue('account_link')) ? 'checked="checked"' : ''); + $this->view->assign('accountCount', Config::getValue('account_count')); // Proxy - $this->view->assign('chkPubLinks', (\SP\Config::getValue('publinks_enabled')) ? 'checked="checked"' : ''); - $this->view->assign('chkPubLinksImage', (\SP\Config::getValue('publinks_image_enabled')) ? 'checked="checked"' : ''); - $this->view->assign('pubLinksMaxTime', \SP\Config::getValue('publinks_maxtime') / 60); - $this->view->assign('pubLinksMaxViews', \SP\Config::getValue('publinks_maxviews')); + $this->view->assign('chkPubLinks', (Config::getValue('publinks_enabled')) ? 'checked="checked"' : ''); + $this->view->assign('chkPubLinksImage', (Config::getValue('publinks_image_enabled')) ? 'checked="checked"' : ''); + $this->view->assign('pubLinksMaxTime', Config::getValue('publinks_maxtime') / 60); + $this->view->assign('pubLinksMaxViews', Config::getValue('publinks_maxviews')); // Proxy - $this->view->assign('chkProxy', (\SP\Config::getValue('proxy_enabled')) ? 'checked="checked"' : ''); - $this->view->assign('proxyServer', \SP\Config::getValue('proxy_server')); - $this->view->assign('proxyPort', \SP\Config::getValue('proxy_port')); - $this->view->assign('proxyUser', \SP\Config::getValue('proxy_user')); - $this->view->assign('proxyPass', \SP\Config::getValue('proxy_pass')); + $this->view->assign('chkProxy', (Config::getValue('proxy_enabled')) ? 'checked="checked"' : ''); + $this->view->assign('proxyServer', Config::getValue('proxy_server')); + $this->view->assign('proxyPort', Config::getValue('proxy_port')); + $this->view->assign('proxyUser', Config::getValue('proxy_user')); + $this->view->assign('proxyPass', Config::getValue('proxy_pass')); $this->view->assign('actionId', $this->getAction(), 'config'); $this->view->append('tabs', array('title' => _('General'))); @@ -154,9 +159,9 @@ class ConfigC extends Controller implements ActionsInterface $this->view->addTemplate('backup'); - $this->view->assign('siteName', \SP\Util::getAppInfo('appname')); - $this->view->assign('backupDir', \SP\Init::$SERVERROOT . '/backup'); - $this->view->assign('backupPath', \SP\Init::$WEBROOT . '/backup'); + $this->view->assign('siteName', Util::getAppInfo('appname')); + $this->view->assign('backupDir', Init::$SERVERROOT . '/backup'); + $this->view->assign('backupPath', Init::$WEBROOT . '/backup'); $backupHash = Config::getValue('backup_hash'); $exportHash = Config::getValue('export_hash'); @@ -199,8 +204,8 @@ class ConfigC extends Controller implements ActionsInterface $this->view->addTemplate('import'); - $this->view->assign('groups', \SP\DB::getValuesForSelect('usrGroups', 'usergroup_id', 'usergroup_name')); - $this->view->assign('users', \SP\DB::getValuesForSelect('usrData', 'user_id', 'user_name')); + $this->view->assign('groups', DBUtil::getValuesForSelect('usrGroups', 'usergroup_id', 'usergroup_name')); + $this->view->assign('users', DBUtil::getValuesForSelect('usrData', 'user_id', 'user_name')); $this->view->append('tabs', array('title' => _('Importar Cuentas'))); $this->view->assign('tabIndex', $this->getTabIndex(), 'import'); @@ -220,8 +225,8 @@ class ConfigC extends Controller implements ActionsInterface $this->view->addTemplate('info'); - $this->view->assign('dbInfo', \SP\DB::getDBinfo()); - $this->view->assign('dbName', \SP\Config::getValue('dbname') . '@' . \SP\Config::getValue('dbhost')); + $this->view->assign('dbInfo', DBUtil::getDBinfo()); + $this->view->assign('dbName', Config::getValue('dbname') . '@' . Config::getValue('dbhost')); $this->view->append('tabs', array('title' => _('Información'))); $this->view->assign('tabIndex', $this->getTabIndex(), 'info'); @@ -241,10 +246,10 @@ class ConfigC extends Controller implements ActionsInterface $this->view->addTemplate('wiki'); - $this->view->assign('chkWiki', (\SP\Config::getValue('wiki_enabled')) ? 'checked="checked"' : ''); - $this->view->assign('wikiSearchUrl', \SP\Config::getValue('wiki_searchurl')); - $this->view->assign('wikiPageUrl', \SP\Config::getValue('wiki_pageurl')); - $this->view->assign('wikiFilter', \SP\Config::getValue('wiki_filter')); + $this->view->assign('chkWiki', (Config::getValue('wiki_enabled')) ? 'checked="checked"' : ''); + $this->view->assign('wikiSearchUrl', Config::getValue('wiki_searchurl')); + $this->view->assign('wikiPageUrl', Config::getValue('wiki_pageurl')); + $this->view->assign('wikiFilter', Config::getValue('wiki_filter')); $this->view->assign('actionId', $this->getAction(), 'wiki'); $this->view->append('tabs', array('title' => _('Wiki'))); @@ -265,18 +270,18 @@ class ConfigC extends Controller implements ActionsInterface $this->view->addTemplate('ldap'); - $this->view->assign('chkLdap', (\SP\Config::getValue('ldap_enabled')) ? 'checked="checked"' : ''); - $this->view->assign('chkLdapADS', (\SP\Config::getValue('ldap_ads')) ? 'checked="checked"' : ''); - $this->view->assign('ldapIsAvailable', \SP\Util::ldapIsAvailable()); - $this->view->assign('ldapServer', \SP\Config::getValue('ldap_server')); - $this->view->assign('ldapBindUser', \SP\Config::getValue('ldap_binduser')); - $this->view->assign('ldapBindPass', \SP\Config::getValue('ldap_bindpass')); - $this->view->assign('ldapBase', \SP\Config::getValue('ldap_base')); - $this->view->assign('ldapGroup', \SP\Config::getValue('ldap_group')); - $this->view->assign('groups', \SP\DB::getValuesForSelect('usrGroups', 'usergroup_id', 'usergroup_name')); - $this->view->assign('profiles', \SP\DB::getValuesForSelect('usrProfiles', 'userprofile_id', 'userprofile_name')); - $this->view->assign('ldapDefaultGroup', \SP\Config::getValue('ldap_defaultgroup')); - $this->view->assign('ldapDefaultProfile', \SP\Config::getValue('ldap_defaultprofile')); + $this->view->assign('chkLdap', (Config::getValue('ldap_enabled')) ? 'checked="checked"' : ''); + $this->view->assign('chkLdapADS', (Config::getValue('ldap_ads')) ? 'checked="checked"' : ''); + $this->view->assign('ldapIsAvailable', Checks::ldapIsAvailable()); + $this->view->assign('ldapServer', Config::getValue('ldap_server')); + $this->view->assign('ldapBindUser', Config::getValue('ldap_binduser')); + $this->view->assign('ldapBindPass', Config::getValue('ldap_bindpass')); + $this->view->assign('ldapBase', Config::getValue('ldap_base')); + $this->view->assign('ldapGroup', Config::getValue('ldap_group')); + $this->view->assign('groups', DBUtil::getValuesForSelect('usrGroups', 'usergroup_id', 'usergroup_name')); + $this->view->assign('profiles', DBUtil::getValuesForSelect('usrProfiles', 'userprofile_id', 'userprofile_name')); + $this->view->assign('ldapDefaultGroup', Config::getValue('ldap_defaultgroup')); + $this->view->assign('ldapDefaultProfile', Config::getValue('ldap_defaultprofile')); $this->view->assign('actionId', $this->getAction(), 'ldap'); $this->view->append('tabs', array('title' => _('LDAP'))); @@ -297,15 +302,15 @@ class ConfigC extends Controller implements ActionsInterface $this->view->addTemplate('mail'); - $this->view->assign('chkMail', (\SP\Config::getValue('mail_enabled')) ? 'checked="checked"' : ''); - $this->view->assign('chkMailRequests', (\SP\Config::getValue('mail_requestsenabled')) ? 'checked="checked"' : ''); - $this->view->assign('chkMailAuth', (\SP\Config::getValue('mail_authenabled')) ? 'checked="checked"' : ''); - $this->view->assign('mailServer', \SP\Config::getValue('mail_server','localhost')); - $this->view->assign('mailPort', \SP\Config::getValue('mail_port',25)); - $this->view->assign('mailUser', \SP\Config::getValue('mail_user')); - $this->view->assign('mailPass', \SP\Config::getValue('mail_pass')); - $this->view->assign('currentMailSecurity', \SP\Config::getValue('mail_security')); - $this->view->assign('mailFrom', \SP\Config::getValue('mail_from')); + $this->view->assign('chkMail', (Config::getValue('mail_enabled')) ? 'checked="checked"' : ''); + $this->view->assign('chkMailRequests', (Config::getValue('mail_requestsenabled')) ? 'checked="checked"' : ''); + $this->view->assign('chkMailAuth', (Config::getValue('mail_authenabled')) ? 'checked="checked"' : ''); + $this->view->assign('mailServer', Config::getValue('mail_server','localhost')); + $this->view->assign('mailPort', Config::getValue('mail_port',25)); + $this->view->assign('mailUser', Config::getValue('mail_user')); + $this->view->assign('mailPass', Config::getValue('mail_pass')); + $this->view->assign('currentMailSecurity', Config::getValue('mail_security')); + $this->view->assign('mailFrom', Config::getValue('mail_from')); $this->view->assign('mailSecurity', array('SSL', 'TLS')); $this->view->assign('actionId', $this->getAction(), 'mail'); diff --git a/inc/Controller.class.php b/inc/SP/Controller/Controller.class.php similarity index 85% rename from inc/Controller.class.php rename to inc/SP/Controller/Controller.class.php index 1d083f10..e1c11585 100644 --- a/inc/Controller.class.php +++ b/inc/SP/Controller/Controller.class.php @@ -25,8 +25,11 @@ namespace SP\Controller; -use SP\Session; -use SP\SPException; +use SP\Core\Acl; +use SP\Core\Init; +use SP\Core\Session; +use SP\Core\SPException; +use SP\Core\Template; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -45,7 +48,7 @@ abstract class Controller const ERR_OPERATION_NO_PERMISSION = 4; /** - * @var \SP\Template Instancia del motor de plantillas a utilizar + * @var Template Instancia del motor de plantillas a utilizar */ public $view; /** @@ -56,9 +59,9 @@ abstract class Controller /** * Constructor * - * @param $template \SP\Template con instancia de plantilla + * @param $template Template con instancia de plantilla */ - public function __construct(\SP\Template $template = null) + public function __construct(Template $template = null) { global $timeStart; @@ -75,11 +78,11 @@ abstract class Controller * Obtener una nueva instancia del motor de plantillas. * * @param null $template string con el nombre de la plantilla - * @return \SP\Template + * @return Template */ protected function getTemplate($template = null) { - return new \SP\Template($template); + return new Template($template); } /** @@ -117,7 +120,7 @@ abstract class Controller $this->view->addTemplate('debug'); - $this->view->assign('time', (\SP\Init::microtime_float() - $this->view->timeStart)); + $this->view->assign('time', (Init::microtime_float() - $this->view->timeStart)); $this->view->assign('memInit', $memInit / 1000); $this->view->assign('memEnd', memory_get_usage() / 1000); } @@ -125,9 +128,9 @@ abstract class Controller /** * Establecer la instancia del motor de plantillas a utilizar. * - * @param \SP\Template $template + * @param Template $template */ - protected function setTemplate(\SP\Template $template) + protected function setTemplate(Template $template) { $this->view = $template; } @@ -142,12 +145,11 @@ abstract class Controller { $checkAction = $this->_action; - if (!is_null($action)){ + if (!is_null($action)) { $checkAction = $action; } - if (!Session::getUserIsAdminApp() && !\SP\Acl::checkUserAccess($checkAction)) { -// $this->showError(self::ERR_PAGE_NO_PERMISSION); + if (!Session::getUserIsAdminApp() && !Acl::checkUserAccess($checkAction)) { return false; } @@ -157,7 +159,9 @@ abstract class Controller /** * Establecer la plantilla de error con el código indicado. * - * @param $type int con el tipo de error + * @param int $type int con el tipo de error + * @param bool $reset + * @param bool $fancy */ protected function showError($type, $reset = true, $fancy = false) { diff --git a/web/EventlogC.class.php b/inc/SP/Controller/EventlogC.class.php similarity index 72% rename from web/EventlogC.class.php rename to inc/SP/Controller/EventlogC.class.php index 3cdc110d..2ecb0c08 100644 --- a/web/EventlogC.class.php +++ b/inc/SP/Controller/EventlogC.class.php @@ -25,7 +25,13 @@ namespace SP\Controller; -use SP\SessionUtil; +use SP\Core\ActionsInterface; +use SP\Core\Session; +use SP\Core\SessionUtil; +use SP\Http\Response; +use SP\Log\Log; +use SP\Util\Checks; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -44,9 +50,9 @@ class EventlogC extends Controller implements ActionsInterface /** * Constructor * - * @param $template \SP\Template con instancia de plantilla + * @param $template \SP\Core\Template con instancia de plantilla */ - public function __construct(\SP\Template $template = null) + public function __construct(\SP\Core\Template $template = null) { parent::__construct($template); @@ -68,14 +74,14 @@ class EventlogC extends Controller implements ActionsInterface $this->view->addTemplate('eventlog'); $this->view->assign('rowClass', 'row_even'); - $this->view->assign('isDemoMode', \SP\Util::demoIsEnabled() || !\SP\Session::getUserIsAdminApp()); + $this->view->assign('isDemoMode', Checks::demoIsEnabled() || !Session::getUserIsAdminApp()); $this->view->assign('limitStart', (isset($this->view->limitStart)) ? (int)$this->view->limitStart : 0); - $this->view->assign('events', \SP\Log::getEvents($this->view->limitStart)); - $this->view->assign('totalRows', \SP\Log::$numRows); + $this->view->assign('events', Log::getEvents($this->view->limitStart)); + $this->view->assign('totalRows', Log::$numRows); $this->view->assign('firstPage', ceil(($this->view->limitStart + 1) / self::MAX_ROWS)); - $this->view->assign('lastPage', ceil(\SP\Log::$numRows / self::MAX_ROWS)); + $this->view->assign('lastPage', ceil(Log::$numRows / self::MAX_ROWS)); - $limitLast = (\SP\Log::$numRows % self::MAX_ROWS == 0) ? \SP\Log::$numRows - self::MAX_ROWS : floor(\SP\Log::$numRows / self::MAX_ROWS) * self::MAX_ROWS; + $limitLast = (Log::$numRows % self::MAX_ROWS == 0) ? Log::$numRows - self::MAX_ROWS : floor(Log::$numRows / self::MAX_ROWS) * self::MAX_ROWS; $this->view->assign('pagerOnnClick', array( 'first' => 'sysPassUtil.Common.navLog(0,' . $this->view->limitStart . ')', @@ -91,10 +97,10 @@ class EventlogC extends Controller implements ActionsInterface public function checkClear() { if ($this->view->clear && $this->view->sk && SessionUtil::checkSessionKey($this->view->sk)) { - if (\SP\Log::clearEvents()) { - \SP\Response::printJSON(_('Registro de eventos vaciado'), 0, "sysPassUtil.Common.doAction(" . ActionsInterface::ACTION_EVL . "); sysPassUtil.Common.scrollUp();"); + if (Log::clearEvents()) { + Response::printJSON(_('Registro de eventos vaciado'), 0, "sysPassUtil.Common.doAction(" . ActionsInterface::ACTION_EVL . "); sysPassUtil.Common.scrollUp();"); } else { - \SP\Response::printJSON(_('Error al vaciar el registro de eventos')); + Response::printJSON(_('Error al vaciar el registro de eventos')); } } } diff --git a/web/MainC.class.php b/inc/SP/Controller/MainC.class.php similarity index 91% rename from web/MainC.class.php rename to inc/SP/Controller/MainC.class.php index 9d2dd944..8c65d2fb 100644 --- a/web/MainC.class.php +++ b/inc/SP/Controller/MainC.class.php @@ -25,16 +25,18 @@ namespace SP\Controller; -use SP\Config; -use SP\Init; -use SP\Installer; -use SP\PublicLink; -use SP\Request; -use SP\Session; -use SP\SessionUtil; -use SP\SPException; -use SP\Themes; -use SP\Util; +use SP\Core\ActionsInterface; +use SP\Core\Init; +use SP\Core\Installer; +use SP\Html\Html; +use SP\Mgmt\PublicLink; +use SP\Http\Request; +use SP\Core\Session; +use SP\Core\SessionUtil; +use SP\Core\SPException; +use SP\Core\Themes; +use SP\Util\Checks; +use SP\Util\Util; /** * Clase encargada de mostrar el interface principal de la aplicación @@ -47,11 +49,11 @@ class MainC extends Controller implements ActionsInterface /** * Constructor * - * @param $template \SP\Template con instancia de plantilla + * @param $template \SP\Core\Template con instancia de plantilla * @param null $page El nombre de página para la clase del body * @param bool $initialize Si es una inicialización completa */ - public function __construct(\SP\Template $template = null, $page = null, $initialize = true) + public function __construct(\SP\Core\Template $template = null, $page = null, $initialize = true) { parent::__construct($template); @@ -64,13 +66,13 @@ class MainC extends Controller implements ActionsInterface $this->view->assign('sk', SessionUtil::getSessionKey(true)); $this->view->assign('appInfo', Util::getAppInfo()); $this->view->assign('appVersion', Util::getVersionString()); - $this->view->assign('isDemoMode', Util::demoIsEnabled()); - $this->view->assign('loggedIn', \SP\Init::isLoggedIn()); + $this->view->assign('isDemoMode', Checks::demoIsEnabled()); + $this->view->assign('loggedIn', Init::isLoggedIn()); $this->view->assign('page', $page); $this->view->assign('logoIcon', Init::$WEBURI . '/imgs/logo.png'); $this->view->assign('logoNoText', Init::$WEBURI . '/imgs/logo.svg'); $this->view->assign('logo', Init::$WEBURI . '/imgs/logo_full.svg'); - $this->view->assign('httpsEnabled', Util::httpsEnabled()); + $this->view->assign('httpsEnabled', Checks::httpsEnabled()); // Cargar la clave pública en la sesión SessionUtil::loadPublicKey(); @@ -85,7 +87,7 @@ class MainC extends Controller implements ActionsInterface */ public function getResourcesLinks() { - $cssVersionHash = 'v=' . md5(implode(Util::getVersion()) . Util::resultsCardsIsEnabled()); + $cssVersionHash = 'v=' . md5(implode(Util::getVersion()) . Checks::resultsCardsIsEnabled()); $this->view->assign('cssLink', Init::$WEBROOT . '/css/css.php?' . $cssVersionHash); $jsVersionHash = 'v=' . md5(implode(Util::getVersion())); @@ -101,7 +103,7 @@ class MainC extends Controller implements ActionsInterface } if (isset($themeInfo['css'])) { - if (!\SP\Util::resultsCardsIsEnabled()) { + if (!Checks::resultsCardsIsEnabled()) { array_push($themeInfo['css'], 'search-grid.min.css'); } @@ -135,7 +137,7 @@ class MainC extends Controller implements ActionsInterface if (is_null($onLoad)) { $onLoad = array('sysPassUtil.Common.doAction(' . self::ACTION_ACC_SEARCH . ')'); - if (Session::getUserIsAdminApp() || Util::demoIsEnabled()) { + if (Session::getUserIsAdminApp() || Checks::demoIsEnabled()) { $onLoad[] = 'sysPassUtil.Common.checkUpds()'; } @@ -222,8 +224,8 @@ class MainC extends Controller implements ActionsInterface $this->view->addTemplate('footer'); $this->view->addTemplate('body-end'); - $this->view->assign('demoEnabled', Util::demoIsEnabled()); - $this->view->assign('mailEnabled', Util::mailIsEnabled()); + $this->view->assign('demoEnabled', Checks::demoIsEnabled()); + $this->view->assign('mailEnabled', Checks::mailIsEnabled()); $this->view->assign('isLogout', Request::analyze('logout', false, true)); $this->view->assign('updated', Init::$UPDATED === true); $this->view->assign('newFeatures', array( @@ -248,7 +250,7 @@ class MainC extends Controller implements ActionsInterface if (count($_GET) > 0) { foreach ($_GET as $param => $value) { - $getParams['g_' . \SP\Html::sanitize($param)] = \SP\Html::sanitize($value); + $getParams['g_' . Html::sanitize($param)] = Html::sanitize($value); } $this->view->assign('getParams', $getParams); @@ -264,12 +266,12 @@ class MainC extends Controller implements ActionsInterface $this->view->addTemplate('footer'); $this->view->addTemplate('body-end'); - $this->view->assign('modulesErrors', Util::checkModules()); - $this->view->assign('versionErrors', Util::checkPhpVersion()); + $this->view->assign('modulesErrors', Checks::checkModules()); + $this->view->assign('versionErrors', Checks::checkPhpVersion()); $this->view->assign('securityErrors', array()); $this->view->assign('resInstall', array()); $this->view->assign('isCompleted', false); - $this->view->assign('version', \SP\Util::getVersionString()); + $this->view->assign('version', Util::getVersionString()); $this->view->assign('adminlogin', Request::analyze('adminlogin', 'admin')); $this->view->assign('adminpass', Request::analyzeEncrypted('adminpass')); $this->view->assign('masterpassword', Request::analyzeEncrypted('masterpassword')); @@ -287,7 +289,7 @@ class MainC extends Controller implements ActionsInterface ); } - if (!Util::secureRNG_available()) { + if (!Checks::secureRNGIsAvailable()) { $this->view->append('securityErrors', array( 'type' => SPException::SP_WARNING, 'description' => _('No se encuentra el generador de números aleatorios.'), @@ -339,7 +341,7 @@ class MainC extends Controller implements ActionsInterface */ public function getPassReset() { - if (Util::mailIsEnabled() || Request::analyze('f', 0) === 1) { + if (Checks::mailIsEnabled() || Request::analyze('f', 0) === 1) { $this->view->addTemplate('passreset'); $this->view->assign('action', Request::analyze('a')); @@ -397,7 +399,7 @@ class MainC extends Controller implements ActionsInterface */ public function getCheckUpdates() { - $updates = \SP\Util::checkUpdates(); + $updates = Util::checkUpdates(); $this->view->addTemplate('update'); @@ -414,7 +416,7 @@ class MainC extends Controller implements ActionsInterface $this->view->assign('status', $updates); } - $notices = \SP\Util::checkNotices(); + $notices = Util::checkNotices(); $numNotices = count($notices); $noticesTitle = ''; diff --git a/web/SearchC.class.php b/inc/SP/Controller/SearchC.class.php similarity index 67% rename from web/SearchC.class.php rename to inc/SP/Controller/SearchC.class.php index dde9fd68..491eaa24 100644 --- a/web/SearchC.class.php +++ b/inc/SP/Controller/SearchC.class.php @@ -25,10 +25,19 @@ namespace SP\Controller; -use SP\Session; -use SP\SessionUtil; -use SP\UserAccounts; -use SP\UserUtil; +use SP\Account\AccountSearch; +use SP\Config\Config; +use SP\Core\Acl; +use SP\Core\ActionsInterface; +use SP\Core\Session; +use SP\Core\SessionUtil; +use SP\Account\UserAccounts; +use SP\Html\Html; +use SP\Http\Request; +use SP\Mgmt\User\Groups; +use SP\Storage\DBUtil; +use SP\Util\Checks; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -73,9 +82,9 @@ class SearchC extends Controller implements ActionsInterface /** * Constructor * - * @param $template \SP\Template con instancia de plantilla + * @param $template \SP\Core\Template con instancia de plantilla */ - public function __construct(\SP\Template $template = null) + public function __construct(\SP\Core\Template $template = null) { parent::__construct($template); @@ -88,26 +97,26 @@ class SearchC extends Controller implements ActionsInterface */ private function setVars() { - $this->view->assign('isAdmin', (\SP\Session::getUserIsAdminApp() || \SP\Session::getUserIsAdminAcc())); - $this->view->assign('showGlobalSearch', \SP\Config::getValue('globalsearch', false)); + $this->view->assign('isAdmin', (Session::getUserIsAdminApp() || Session::getUserIsAdminAcc())); + $this->view->assign('showGlobalSearch', Config::getValue('globalsearch', false)); // Comprobar si está creado el objeto de búsqueda en la sesión - if (!is_object(\SP\Session::getSearchFilters())) { - \SP\Session::setSearchFilters(new \SP\AccountSearch()); + if (!is_object(Session::getSearchFilters())) { + Session::setSearchFilters(new AccountSearch()); } // Obtener el filtro de búsqueda desde la sesión - $filters = \SP\Session::getSearchFilters(); + $filters = \SP\Core\Session::getSearchFilters(); // Valores POST - $this->view->assign('searchKey', \SP\Request::analyze('skey', $filters->getSortKey())); - $this->view->assign('searchOrder', \SP\Request::analyze('sorder', $filters->getSortOrder())); - $this->view->assign('searchCustomer', \SP\Request::analyze('customer', $filters->getCustomerId())); - $this->view->assign('searchCategory', \SP\Request::analyze('category', $filters->getCategoryId())); - $this->view->assign('searchTxt', \SP\Request::analyze('search', $filters->getTxtSearch())); - $this->view->assign('searchGlobal', \SP\Request::analyze('gsearch', $filters->getGlobalSearch())); - $this->view->assign('limitStart', \SP\Request::analyze('start', $filters->getLimitStart())); - $this->view->assign('limitCount', \SP\Request::analyze('rpp', $filters->getLimitCount())); + $this->view->assign('searchKey', Request::analyze('skey', $filters->getSortKey())); + $this->view->assign('searchOrder', Request::analyze('sorder', $filters->getSortOrder())); + $this->view->assign('searchCustomer', Request::analyze('customer', $filters->getCustomerId())); + $this->view->assign('searchCategory', Request::analyze('category', $filters->getCategoryId())); + $this->view->assign('searchTxt', Request::analyze('search', $filters->getTxtSearch())); + $this->view->assign('searchGlobal', Request::analyze('gsearch', $filters->getGlobalSearch())); + $this->view->assign('limitStart', Request::analyze('start', $filters->getLimitStart())); + $this->view->assign('limitCount', Request::analyze('rpp', $filters->getLimitCount())); } /** @@ -117,8 +126,8 @@ class SearchC extends Controller implements ActionsInterface { $this->view->addTemplate('searchbox'); - $this->view->assign('customers', \SP\DB::getValuesForSelect('customers', 'customer_id', 'customer_name')); - $this->view->assign('categories', \SP\DB::getValuesForSelect('categories', 'category_id', 'category_name')); + $this->view->assign('customers', DBUtil::getValuesForSelect('customers', 'customer_id', 'customer_name')); + $this->view->assign('categories', DBUtil::getValuesForSelect('categories', 'category_id', 'category_name')); } /** @@ -130,7 +139,7 @@ class SearchC extends Controller implements ActionsInterface $this->view->assign('queryTimeStart', microtime()); - $search = new \SP\AccountSearch(); + $search = new AccountSearch(); $search->setGlobalSearch($this->view->searchGlobal); $search->setTxtSearch($this->view->searchTxt); @@ -167,11 +176,11 @@ class SearchC extends Controller implements ActionsInterface { // Variables para la barra de navegación $this->view->assign('firstPage', ceil(($this->view->limitStart + 1) / $this->view->limitCount)); - $this->view->assign('lastPage', ceil(\SP\AccountSearch::$queryNumRows / $this->view->limitCount)); - $this->view->assign('totalRows', \SP\AccountSearch::$queryNumRows); + $this->view->assign('lastPage', ceil(AccountSearch::$queryNumRows / $this->view->limitCount)); + $this->view->assign('totalRows', AccountSearch::$queryNumRows); $this->view->assign('filterOn', $this->_filterOn); - $limitLast = ((\SP\AccountSearch::$queryNumRows % $this->view->limitCount) == 0) ? \SP\AccountSearch::$queryNumRows - $this->view->limitCount : floor(\SP\AccountSearch::$queryNumRows / $this->view->limitCount) * $this->view->limitCount; + $limitLast = ((AccountSearch::$queryNumRows % $this->view->limitCount) == 0) ? AccountSearch::$queryNumRows - $this->view->limitCount : floor(AccountSearch::$queryNumRows / $this->view->limitCount) * $this->view->limitCount; $this->view->assign('pagerOnnClick', array( 'first' => 'sysPassUtil.Common.searchSort(' . $this->view->searchKey . ', 0,1)', @@ -184,23 +193,23 @@ class SearchC extends Controller implements ActionsInterface $topNavbar = Session::getUserPreferences()->isTopNavbar(); // Variables de configuración - $this->view->assign('accountLink', (is_null($accountLink) ? \SP\Config::getValue('account_link', 0) : $accountLink)); + $this->view->assign('accountLink', (is_null($accountLink) ? Config::getValue('account_link', 0) : $accountLink)); $this->view->assign('topNavbar', $topNavbar); - $this->view->assign('requestEnabled', \SP\Util::mailrequestIsEnabled()); - $this->view->assign('isDemoMode', \SP\Util::demoIsEnabled()); - $maxTextLength = (\SP\Util::resultsCardsIsEnabled()) ? 40 : 60; + $this->view->assign('requestEnabled', Checks::mailrequestIsEnabled()); + $this->view->assign('isDemoMode', Checks::demoIsEnabled()); + $maxTextLength = (Checks::resultsCardsIsEnabled()) ? 40 : 60; - $wikiEnabled = \SP\Util::wikiIsEnabled(); + $wikiEnabled = Checks::wikiIsEnabled(); if ($wikiEnabled) { - $wikiSearchUrl = \SP\Config::getValue('wiki_searchurl', false); - $this->view->assign('wikiFilter', explode(',', \SP\Config::getValue('wiki_filter'))); - $this->view->assign('wikiPageUrl', \SP\Config::getValue('wiki_pageurl')); + $wikiSearchUrl = Config::getValue('wiki_searchurl', false); + $this->view->assign('wikiFilter', explode(',', Config::getValue('wiki_filter'))); + $this->view->assign('wikiPageUrl', Config::getValue('wiki_pageurl')); } $this->setSortFields(); - $objAccount = new \SP\Account(); + $objAccount = new \SP\Account\Account(); foreach ($results as $account) { $objAccount->setAccountId($account->account_id); @@ -213,17 +222,17 @@ class SearchC extends Controller implements ActionsInterface $accountAclData = $objAccount->getAccountDataForACL(); // Establecer los permisos de acceso - $accView = (\SP\Acl::checkAccountAccess(self::ACTION_ACC_VIEW, $accountAclData) && \SP\Acl::checkUserAccess(self::ACTION_ACC_VIEW)); - $accViewPass = (\SP\Acl::checkAccountAccess(self::ACTION_ACC_VIEW_PASS, $accountAclData) && \SP\Acl::checkUserAccess(self::ACTION_ACC_VIEW_PASS)); - $accEdit = (\SP\Acl::checkAccountAccess(self::ACTION_ACC_EDIT, $accountAclData) && \SP\Acl::checkUserAccess(self::ACTION_ACC_EDIT)); - $accCopy = (\SP\Acl::checkAccountAccess(self::ACTION_ACC_COPY, $accountAclData) && \SP\Acl::checkUserAccess(self::ACTION_ACC_COPY)); - $accDel = (\SP\Acl::checkAccountAccess(self::ACTION_ACC_DELETE, $accountAclData) && \SP\Acl::checkUserAccess(self::ACTION_ACC_DELETE)); + $accView = (Acl::checkAccountAccess(self::ACTION_ACC_VIEW, $accountAclData) && Acl::checkUserAccess(self::ACTION_ACC_VIEW)); + $accViewPass = (Acl::checkAccountAccess(self::ACTION_ACC_VIEW_PASS, $accountAclData) && Acl::checkUserAccess(self::ACTION_ACC_VIEW_PASS)); + $accEdit = (Acl::checkAccountAccess(self::ACTION_ACC_EDIT, $accountAclData) && Acl::checkUserAccess(self::ACTION_ACC_EDIT)); + $accCopy = (Acl::checkAccountAccess(self::ACTION_ACC_COPY, $accountAclData) && Acl::checkUserAccess(self::ACTION_ACC_COPY)); + $accDel = (Acl::checkAccountAccess(self::ACTION_ACC_DELETE, $accountAclData) && Acl::checkUserAccess(self::ACTION_ACC_DELETE)); $show = ($accView || $accViewPass || $accEdit || $accCopy || $accDel); // Obtenemos datos si el usuario tiene acceso a los datos de la cuenta if ($show) { - $secondaryGroups = \SP\Groups::getGroupsNameForAccount($account->account_id); + $secondaryGroups = Groups::getGroupsNameForAccount($account->account_id); $secondaryUsers = UserAccounts::getUsersNameForAccount($account->account_id); $secondaryAccesses = '(G) ' . $account->usergroup_name . '*
'; @@ -252,17 +261,17 @@ class SearchC extends Controller implements ActionsInterface $this->view->append('accounts', array( 'id' => $account->account_id, 'name' => $account->account_name, - 'login' => \SP\Html::truncate($account->account_login, $maxTextLength), + 'login' => Html::truncate($account->account_login, $maxTextLength), 'category_name' => $account->category_name, - 'customer_name' => \SP\Html::truncate($account->customer_name, $maxTextLength), + 'customer_name' => Html::truncate($account->customer_name, $maxTextLength), 'customer_link' => ($wikiEnabled) ? $wikiSearchUrl . $account->customer_name : '', 'color' => $this->pickAccountColor($account->account_customerId), 'url' => $account->account_url, - 'url_short' => \SP\Html::truncate($account->account_url, $maxTextLength), + 'url_short' => Html::truncate($account->account_url, $maxTextLength), 'url_islink' => (preg_match("#^https?://.*#i", $account->account_url)) ? true : false, 'notes' => $accountNotes, 'accesses' => (isset($secondaryAccesses)) ? $secondaryAccesses : '', - 'numFiles' => (\SP\Util::fileIsEnabled()) ? $account->num_files : 0, + 'numFiles' => (Checks::fileIsEnabled()) ? $account->num_files : 0, 'show' => $show, 'showView' => $accView, 'showViewPass' => $accViewPass, @@ -280,34 +289,34 @@ class SearchC extends Controller implements ActionsInterface { $this->view->assign('sortFields', array( array( - 'key' => \SP\AccountSearch::SORT_CUSTOMER, + 'key' => AccountSearch::SORT_CUSTOMER, 'title' => _('Ordenar por Cliente'), 'name' => _('Cliente'), - 'function' => 'sysPassUtil.Common.searchSort(' . \SP\AccountSearch::SORT_CUSTOMER . ',' . $this->view->limitStart . ')' + 'function' => 'sysPassUtil.Common.searchSort(' . AccountSearch::SORT_CUSTOMER . ',' . $this->view->limitStart . ')' ), array( - 'key' => \SP\AccountSearch::SORT_NAME, + 'key' => AccountSearch::SORT_NAME, 'title' => _('Ordenar por Nombre'), 'name' => _('Nombre'), - 'function' => 'sysPassUtil.Common.searchSort(' . \SP\AccountSearch::SORT_NAME . ',' . $this->view->limitStart . ')' + 'function' => 'sysPassUtil.Common.searchSort(' . AccountSearch::SORT_NAME . ',' . $this->view->limitStart . ')' ), array( - 'key' => \SP\AccountSearch::SORT_CATEGORY, + 'key' => AccountSearch::SORT_CATEGORY, 'title' => _('Ordenar por Categoría'), 'name' => _('Categoría'), - 'function' => 'sysPassUtil.Common.searchSort(' . \SP\AccountSearch::SORT_CATEGORY . ',' . $this->view->limitStart . ')' + 'function' => 'sysPassUtil.Common.searchSort(' . AccountSearch::SORT_CATEGORY . ',' . $this->view->limitStart . ')' ), array( - 'key' => \SP\AccountSearch::SORT_LOGIN, + 'key' => AccountSearch::SORT_LOGIN, 'title' => _('Ordenar por Usuario'), 'name' => _('Usuario'), - 'function' => 'sysPassUtil.Common.searchSort(' . \SP\AccountSearch::SORT_LOGIN . ',' . $this->view->limitStart . ')' + 'function' => 'sysPassUtil.Common.searchSort(' . AccountSearch::SORT_LOGIN . ',' . $this->view->limitStart . ')' ), array( - 'key' => \SP\AccountSearch::SORT_URL, + 'key' => AccountSearch::SORT_URL, 'title' => _('Ordenar por URL / IP'), 'name' => _('URL / IP'), - 'function' => 'sysPassUtil.Common.searchSort(' . \SP\AccountSearch::SORT_URL . ',' . $this->view->limitStart . ')' + 'function' => 'sysPassUtil.Common.searchSort(' . AccountSearch::SORT_URL . ',' . $this->view->limitStart . ')' ) )); } diff --git a/web/UsersMgmtC.class.php b/inc/SP/Controller/UsersMgmtC.class.php similarity index 94% rename from web/UsersMgmtC.class.php rename to inc/SP/Controller/UsersMgmtC.class.php index e375a49f..3bebfa48 100644 --- a/web/UsersMgmtC.class.php +++ b/inc/SP/Controller/UsersMgmtC.class.php @@ -25,19 +25,21 @@ namespace SP\Controller; -use SP\PublicLink; -use SP\PublicLinkUtil; -use SP\Response; -use SP\CustomFields; -use SP\DB; -use SP\Groups; -use SP\Log; -use SP\Profile; -use SP\Session; -use SP\SessionUtil; -use SP\Template; -use SP\UserUtil; -use SP\Util; +use SP\Api\ApiTokens; +use SP\Core\ActionsInterface; +use SP\Mgmt\PublicLinkUtil; +use SP\Mgmt\CustomFields; +use SP\Storage\DB; +use SP\Mgmt\User\Groups; +use SP\Log\Log; +use SP\Mgmt\User\Profile; +use SP\Core\Session; +use SP\Core\SessionUtil; +use SP\Core\Template; +use SP\Mgmt\User\UserUtil; +use SP\Storage\DBUtil; +use SP\Util\Checks; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -66,7 +68,7 @@ class UsersMgmtC extends Controller implements ActionsInterface { parent::__construct($template); - $this->view->assign('isDemo', Util::demoIsEnabled()); + $this->view->assign('isDemo', Checks::demoIsEnabled()); $this->view->assign('sk', SessionUtil::getSessionKey()); } @@ -319,8 +321,8 @@ class UsersMgmtC extends Controller implements ActionsInterface $this->view->assign('isDisabled', ($this->view->isDemo || $this->view->actionId === self::ACTION_USR_USERS_VIEW) ? 'disabled' : ''); $this->view->assign('user', UserUtil::getUserData($this->view->itemId)); - $this->view->assign('groups', DB::getValuesForSelect('usrGroups', 'usergroup_id', 'usergroup_name')); - $this->view->assign('profiles', DB::getValuesForSelect('usrProfiles', 'userprofile_id', 'userprofile_name')); + $this->view->assign('groups', DBUtil::getValuesForSelect('usrGroups', 'usergroup_id', 'usergroup_name')); + $this->view->assign('profiles', DBUtil::getValuesForSelect('usrProfiles', 'userprofile_id', 'userprofile_name')); $this->view->assign('ro', ($this->view->user['checks']['user_isLdap']) ? 'READONLY' : ''); $this->getCustomFieldsForItem(); @@ -335,8 +337,8 @@ class UsersMgmtC extends Controller implements ActionsInterface $this->view->addTemplate('groups'); $this->view->assign('group', Groups::getGroupData($this->view->itemId)); - $this->view->assign('users', \SP\DB::getValuesForSelect('usrData', 'user_id', 'user_name')); - $this->view->assign('groupUsers', \SP\Groups::getUsersForGroup($this->view->itemId)); + $this->view->assign('users', DBUtil::getValuesForSelect('usrData', 'user_id', 'user_name')); + $this->view->assign('groupUsers', Groups::getUsersForGroup($this->view->itemId)); $this->getCustomFieldsForItem(); } @@ -435,7 +437,7 @@ class UsersMgmtC extends Controller implements ActionsInterface $this->view->append( 'tabs', array( 'title' => _('Gestión de Autorizaciones API'), - 'query' => \SP\ApiTokens::getTokens(), + 'query' => ApiTokens::getTokens(), 'props' => $tokensTableProp, 'time' => round(microtime() - $this->view->queryTimeStart, 5)) ); @@ -448,10 +450,10 @@ class UsersMgmtC extends Controller implements ActionsInterface { $this->view->addTemplate('tokens'); - $token = \SP\ApiTokens::getTokens($this->view->itemId, true); + $token = ApiTokens::getTokens($this->view->itemId, true); - $this->view->assign('users', \SP\DB::getValuesForSelect('usrData', 'user_id', 'user_name')); - $this->view->assign('actions', \SP\ApiTokens::getTokenActions()); + $this->view->assign('users', DBUtil::getValuesForSelect('usrData', 'user_id', 'user_name')); + $this->view->assign('actions', ApiTokens::getTokenActions()); $this->view->assign('token', $token); $this->view->assign('gotData', is_object($token)); @@ -523,7 +525,7 @@ class UsersMgmtC extends Controller implements ActionsInterface $this->view->append( 'tabs', array( 'title' => _('Gestión de Enlaces'), - 'query' => \SP\PublicLinkUtil::getLinks(), + 'query' => PublicLinkUtil::getLinks(), 'props' => $linksTableProp, 'time' => round(microtime() - $this->view->queryTimeStart, 5)) ); diff --git a/web/UsersPrefsC.class.php b/inc/SP/Controller/UsersPrefsC.class.php similarity index 90% rename from web/UsersPrefsC.class.php rename to inc/SP/Controller/UsersPrefsC.class.php index 74311e9e..a3b8e388 100644 --- a/web/UsersPrefsC.class.php +++ b/inc/SP/Controller/UsersPrefsC.class.php @@ -26,11 +26,12 @@ namespace SP\Controller; use SP\Auth\Auth2FA; -use SP\Language; -use SP\Session; -use SP\SessionUtil; -use SP\Themes; -use SP\UserPreferences; +use SP\Core\ActionsInterface; +use SP\Core\Language; +use SP\Core\Session; +use SP\Core\SessionUtil; +use SP\Core\Themes; +use SP\Mgmt\User\UserPreferences; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -58,9 +59,9 @@ class UsersPrefsC extends Controller implements ActionsInterface /** * Constructor * - * @param $template \SP\Template con instancia de plantilla + * @param $template \SP\Core\Template con instancia de plantilla */ - public function __construct(\SP\Template $template = null) + public function __construct(\SP\Core\Template $template = null) { parent::__construct($template); @@ -108,9 +109,9 @@ class UsersPrefsC extends Controller implements ActionsInterface $this->view->assign('langsAvailable',Language::getAvailableLanguages()); $this->view->assign('currentLang', $this->_userPrefs->getLang()); $this->view->assign('themesAvailable', Themes::getThemesAvailable()); - $this->view->assign('currentTheme', ($this->_userPrefs->getTheme()) ? $this->_userPrefs->getTheme() : \SP\Config::getValue('sitetheme')); + $this->view->assign('currentTheme', ($this->_userPrefs->getTheme()) ? $this->_userPrefs->getTheme() : \SP\Config\Config::getValue('sitetheme')); $this->view->assign('chkAccountLink', ($this->_userPrefs->isAccountLink()) ? 'checked="checked"' : ''); - $this->view->assign('resultsPerPage', ($this->_userPrefs->getResultsPerPage()) ? $this->_userPrefs->getResultsPerPage() : \SP\Config::getValue('account_count')); + $this->view->assign('resultsPerPage', ($this->_userPrefs->getResultsPerPage()) ? $this->_userPrefs->getResultsPerPage() : \SP\Config\Config::getValue('account_count')); $this->view->assign('chkSortViews', ($this->_userPrefs->isSortViews()) ? 'checked="checked"' : ''); $this->view->assign('chkTopNavbar', ($this->_userPrefs->isTopNavbar()) ? 'checked="checked"' : ''); diff --git a/inc/Acl.class.php b/inc/SP/Core/Acl.class.php similarity index 98% rename from inc/Acl.class.php rename to inc/SP/Core/Acl.class.php index 0f34ecad..c41c07c8 100644 --- a/inc/Acl.class.php +++ b/inc/SP/Core/Acl.class.php @@ -24,14 +24,18 @@ * */ -namespace SP; +namespace SP\Core; + +use SP\Controller; +use SP\Mgmt\User\Groups; +use SP\Log\Log; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); /** * Esta clase es la encargada de calcular las access lists de acceso a usuarios. */ -class Acl implements Controller\ActionsInterface +class Acl implements \SP\Core\ActionsInterface { /** * Comprobar los permisos de acceso del usuario a los módulos de la aplicación. diff --git a/inc/ActionsInterface.class.php b/inc/SP/Core/ActionsInterface.class.php similarity index 99% rename from inc/ActionsInterface.class.php rename to inc/SP/Core/ActionsInterface.class.php index 70de0bd8..5057ec49 100644 --- a/inc/ActionsInterface.class.php +++ b/inc/SP/Core/ActionsInterface.class.php @@ -23,7 +23,7 @@ * */ -namespace SP\Controller; +namespace SP\Core; /** * Interface ActionsInterface para la definición de constantes de acciones disponibles. diff --git a/inc/Backup.class.php b/inc/SP/Core/Backup.class.php similarity index 97% rename from inc/Backup.class.php rename to inc/SP/Core/Backup.class.php index de84f03a..41b3847d 100644 --- a/inc/Backup.class.php +++ b/inc/SP/Core/Backup.class.php @@ -23,7 +23,14 @@ * */ -namespace SP; +namespace SP\Core; + +use SP\Config\Config; +use SP\Storage\DB; +use SP\Log\Log; +use SP\Storage\DBUtil; +use SP\Util\Checks; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -122,7 +129,7 @@ class Backup if (is_numeric($value)) { fwrite($handle, $value); } else { - fwrite($handle, DB::escape($value)); + fwrite($handle, DBUtil::escape($value)); } if ($field < $numColumns) { @@ -163,7 +170,7 @@ class Backup private static function backupApp($backupFile) { if (!class_exists('PharData')) { - if (Util::runningOnWindows()) { + if (Checks::checkIsWindows()) { throw new SPException(SPException::SP_CRITICAL, _('Esta operación sólo es posible en entornos Linux')); } elseif (!self::backupAppLegacyLinux($backupFile)) { throw new SPException(SPException::SP_CRITICAL, _('Error al realizar backup en modo compatibilidad')); diff --git a/inc/Crypt.class.php b/inc/SP/Core/Crypt.class.php similarity index 97% rename from inc/Crypt.class.php rename to inc/SP/Core/Crypt.class.php index 6ad9e0dd..3c0a5a5c 100644 --- a/inc/Crypt.class.php +++ b/inc/SP/Core/Crypt.class.php @@ -23,7 +23,13 @@ * */ -namespace SP; +namespace SP\Core; + +use SP\Config\Config; +use SP\Config\ConfigDB; +use SP\Log\Log; +use SP\Util\Checks; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -71,7 +77,7 @@ class Crypt $source = MCRYPT_DEV_URANDOM; $mcryptRes = self::getMcryptResource(); - if (Util::runningOnWindows() && (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300)) { + if (Checks::checkIsWindows() && (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300)) { $source = MCRYPT_RAND; } diff --git a/inc/CryptMasterPass.class.php b/inc/SP/Core/CryptMasterPass.class.php similarity index 98% rename from inc/CryptMasterPass.class.php rename to inc/SP/Core/CryptMasterPass.class.php index d5e180c3..98cc9133 100644 --- a/inc/CryptMasterPass.class.php +++ b/inc/SP/Core/CryptMasterPass.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Core; + +use SP\Config\ConfigDB; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/CryptPKI.class.php b/inc/SP/Core/CryptPKI.class.php similarity index 99% rename from inc/CryptPKI.class.php rename to inc/SP/Core/CryptPKI.class.php index 92ca7677..f268a26e 100644 --- a/inc/CryptPKI.class.php +++ b/inc/SP/Core/CryptPKI.class.php @@ -23,7 +23,7 @@ * */ -namespace SP; +namespace SP\Core; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Init.class.php b/inc/SP/Core/Init.class.php similarity index 92% rename from inc/Init.class.php rename to inc/SP/Core/Init.class.php index 7ad1c7b7..05e6239e 100644 --- a/inc/Init.class.php +++ b/inc/SP/Core/Init.class.php @@ -23,9 +23,18 @@ * */ -namespace SP; +namespace SP\Core; -use SP\Controller\ActionsInterface; +use SP\Config\Config; +use SP\Config\ConfigDB; +use SP\Controller; +use SP\Http\Request; +use SP\Log\Email; +use SP\Log\Log; +use SP\Mgmt\User\Profile; +use SP\Storage\DBUtil; +use SP\Util\Checks; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -73,35 +82,12 @@ class Init */ public static function start() { - self::setIncludes(); +// self::setIncludes(); - if (version_compare(PHP_VERSION, '5.1.2', '>=')) { - // Registro del cargador de clases (PHP >= 5.1.2) - if (version_compare(PHP_VERSION, '5.3.0', '>=')) { - spl_autoload_register('SP\Init::loadClass', true); - } else { - spl_autoload_register(array('SP\Init', 'loadClass')); - } - } else { - /** - * Fall back to traditional autoload for old PHP versions - * - * @param string $classname The name of the class to load - */ - function __autoload($classname) - { - \SP\Init::loadClass($classname); - } + if (date_default_timezone_get() === 'UTC'){ + date_default_timezone_set('UTC'); } - error_reporting(E_ALL | E_STRICT); - - if (defined('DEBUG') && DEBUG) { - ini_set('display_errors', 1); - } - - date_default_timezone_set('UTC'); - // Intentar desactivar magic quotes. if (get_magic_quotes_gpc() == 1) { ini_set('magic_quotes_runtime', 0); @@ -178,7 +164,7 @@ class Init self::checkMaintenanceMode(); // Comprobar si la Base de datos existe - if (!DB::checkDatabaseExist()) { + if (!DBUtil::checkDatabaseExist()) { self::initError(_('Error en la verificación de la base de datos')); } @@ -196,7 +182,8 @@ class Init // Intentar establecer el tiempo de vida de la sesión en PHP $sessionLifeTime = self::getSessionLifeTime(); - @ini_set('gc_maxlifetime', (string)$sessionLifeTime); + + @ini_set('gc_maxlifetime', $sessionLifeTime); if (!Config::getValue("installed", false)) { Session::setUserId(''); @@ -221,7 +208,7 @@ class Init } // Volver a cargar la configuración si se recarga la página - if (Request::checkReload()){ + if (Request::checkReload()) { Config::readConfig(); } @@ -234,30 +221,17 @@ class Init } /** - * Establecer las rutas de sysPass en el PATH de PHP + * Cargar las clases de las extensiones de sysPass */ - public static function setIncludes() + private static function loadExtensions() { - set_include_path(MODEL_PATH . PATH_SEPARATOR . CONTROLLER_PATH . PATH_SEPARATOR . EXTENSIONS_PATH . PATH_SEPARATOR . get_include_path()); - } + $phpSecLoader = new \SplClassLoader('phpseclib', EXTENSIONS_PATH); + $phpSecLoader->setPrepend(true); + $phpSecLoader->register(); - /** - * Cargador de clases de sysPass - * - * @param $class string El nombre de la clase a cargar - */ - public static function loadClass($class) - { - // Eliminar \\ para las clases con namespace definido - $class = (strripos($class, '\\')) ? substr($class, strripos($class, '\\') + 1) : $class; - - // Buscar la clase en los directorios de include - foreach (explode(':', get_include_path()) as $includePath) { - $classFile = $includePath . DIRECTORY_SEPARATOR . $class . '.class.php'; - if (is_readable($classFile)) { - require $classFile; - } - } + $phpMailedLoader = new \SplClassLoader('phpmailer', EXTENSIONS_PATH); + $phpMailedLoader->setPrepend(true); + $phpMailedLoader->register(); } /** @@ -304,8 +278,9 @@ class Init { // Calcular los directorios raíz $dir = (defined(__DIR__)) ? __DIR__ : dirname(__FILE__); + $dir = substr($dir, 0, strpos($dir, str_replace('\\', '/', __NAMESPACE__)) - 1); - self::$SERVERROOT = substr($dir, 0, strripos($dir, '/')); + self::$SERVERROOT = substr($dir, 0, strripos($dir, DIRECTORY_SEPARATOR)); self::$_SUBURI = str_replace("\\", '/', substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen(self::$SERVERROOT))); @@ -338,6 +313,18 @@ class Init self::$WEBURI .= $protocol . $_SERVER['HTTP_HOST'] . self::$WEBROOT; } + /** + * Comprobar y forzar (si es necesario) la conexión HTTPS + */ + private static function checkHttps() + { + if (Checks::forceHttpsIsEnabled() && !Checks::httpsEnabled()) { + $port = ($_SERVER['SERVER_PORT'] != 443) ? ':' . $_SERVER['SERVER_PORT'] : ''; + $fullUrl = 'https://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI']; + header('Location: ' . $fullUrl); + } + } + /** * Comprobar el archivo que realiza el include necesita inicialización. * @@ -367,10 +354,9 @@ class Init self::initError(_('No es posible escribir en el directorio "config"')); } - //$configPerms = substr(sprintf('%o', fileperms(self::$SERVERROOT.'/config')), -4); $configPerms = decoct(fileperms(self::$SERVERROOT . DIRECTORY_SEPARATOR . 'config') & 0777); - if (!Util::runningOnWindows() && $configPerms != "750") { + if (!Checks::checkIsWindows() && $configPerms != "750") { clearstatcache(); self::initError(_('Los permisos del directorio "/config" son incorrectos'), _('Actual:') . ' ' . $configPerms . ' - ' . _('Necesario: 750')); } @@ -388,7 +374,7 @@ class Init $url = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . self::$WEBROOT . '/index.php'; header("Location: $url"); exit(); - } elseif (self::$_SUBURI == '/index.php') { + } else { // Comprobar si sysPass está instalada o en modo mantenimiento $controller = new Controller\MainC(); $controller->getInstaller(); @@ -470,7 +456,7 @@ class Init */ private static function goLogin() { - $controller = new Controller\MainC(null,'login'); + $controller = new Controller\MainC(null, 'login'); $controller->getLogin(); $controller->view(); exit; @@ -481,7 +467,7 @@ class Init */ private static function checkVersion() { - if (substr(self::$_SUBURI, -9) != 'index.php' || Request::analyze('logout', 0) === 1) { + if (self::$_SUBURI != '/index.php' || Request::analyze('logout', 0) === 1) { return; } @@ -628,33 +614,6 @@ class Init exit(); } - /** - * Comprobar si hay que ejecutar acciones de URL después de realizar login. - * - * @return bool - */ - public static function checkPostLoginActions() - { - if (!Request::analyze('a', '', true)) { - return false; - } - - $action = Request::analyze('a'); - $controller = new Controller\MainC(null , 'main'); - - switch ($action) { - case 'accView': - $itemId = Request::analyze('i'); - $onLoad = 'doAction(' . ActionsInterface::ACTION_ACC_VIEW . ',' . ActionsInterface::ACTION_ACC_SEARCH . ',' . $itemId . ')'; - $controller->getMain($onLoad); - $controller->view(); - break; - default: - return false; - } - return true; - } - /** * Comprobar si el usuario está logado. * @@ -671,6 +630,60 @@ class Init return false; } + /** + * Establecer las rutas de sysPass en el PATH de PHP + */ + public static function setIncludes() + { + set_include_path(MODEL_PATH . PATH_SEPARATOR . CONTROLLER_PATH . PATH_SEPARATOR . EXTENSIONS_PATH . PATH_SEPARATOR . get_include_path()); + } + + /** + * Cargador de clases de sysPass + * + * @param $class string El nombre de la clase a cargar + */ + public static function loadClass($class) + { + // Eliminar \\ para las clases con namespace definido + $class = (strripos($class, '\\')) ? substr($class, strripos($class, '\\') + 1) : $class; + + // Buscar la clase en los directorios de include + foreach (explode(':', get_include_path()) as $includePath) { + $classFile = $includePath . DIRECTORY_SEPARATOR . $class . '.class.php'; + if (is_readable($classFile)) { + require $classFile; + } + } + } + + /** + * Comprobar si hay que ejecutar acciones de URL después de realizar login. + * + * @return bool + */ + public static function checkPostLoginActions() + { + if (!Request::analyze('a', '', true)) { + return false; + } + + $action = Request::analyze('a'); + $controller = new Controller\MainC(null, 'main'); + + switch ($action) { + case 'accView': + $itemId = Request::analyze('i'); + $onLoad = 'doAction(' . ActionsInterface::ACTION_ACC_VIEW . ',' . ActionsInterface::ACTION_ACC_SEARCH . ',' . $itemId . ')'; + $controller->getMain($onLoad); + $controller->view(); + break; + default: + return false; + } + return true; + } + /** * Devuelve el tiempo actual en coma flotante. * Esta función se utiliza para calcular el tiempo de renderizado con coma flotante @@ -682,28 +695,4 @@ class Init list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } - - /** - * Cargar las clases de las extensiones de sysPass - */ - private static function loadExtensions() - { - // Utilizar un cargador de clases PSR-0 - require EXTENSIONS_PATH . DIRECTORY_SEPARATOR . 'SplClassLoader.php'; - - $phpSecLoader = new \SplClassLoader('phpseclib', EXTENSIONS_PATH); - $phpSecLoader->register(); - } - - /** - * Comprobar y forzar (si es necesario) la coneción HTTPS - */ - private static function checkHttps() - { - if(Util::forceHttpsIsEnabled() && !Util::httpsEnabled()){ - $port = ($_SERVER['SERVER_PORT'] != 443) ? ':' . $_SERVER['SERVER_PORT'] : ''; - $fullUrl = 'https://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI']; - header('Location: ' . $fullUrl); - } - } } \ No newline at end of file diff --git a/inc/Installer.class.php b/inc/SP/Core/Installer.class.php similarity index 99% rename from inc/Installer.class.php rename to inc/SP/Core/Installer.class.php index 15d4c0ff..452c2910 100644 --- a/inc/Installer.class.php +++ b/inc/SP/Core/Installer.class.php @@ -24,7 +24,14 @@ * */ -namespace SP; +namespace SP\Core; + +use SP\Config\Config; +use SP\Config\ConfigDB; +use SP\Mgmt\User\Groups; +use SP\Mgmt\User\Profile; +use SP\Mgmt\User\User; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Language.class.php b/inc/SP/Core/Language.class.php similarity index 98% rename from inc/Language.class.php rename to inc/SP/Core/Language.class.php index fc6b5950..2b28e5a8 100644 --- a/inc/Language.class.php +++ b/inc/SP/Core/Language.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Core; + +use SP\Config\Config; +use SP\Mgmt\User\UserPreferences; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/SPException.class.php b/inc/SP/Core/SPException.class.php similarity index 93% rename from inc/SPException.class.php rename to inc/SP/Core/SPException.class.php index e93a2093..12ad02d0 100644 --- a/inc/SPException.class.php +++ b/inc/SP/Core/SPException.class.php @@ -1,5 +1,5 @@ 'ok', + self::SP_CRITICAL => 'critical', + self::SP_WARNING => 'warning' + ); + + return $typeName[$type]; + } + public function __toString() { return __CLASS__ . ": [{$this->code}]: {$this->message} ({$this->_hint})\n"; @@ -67,14 +81,4 @@ class SPException extends \Exception{ { return $this->_type; } - - public static function getExceptionTypeName($type){ - $typeName = array( - self::SP_OK => 'ok', - self::SP_CRITICAL => 'critical', - self::SP_WARNING => 'warning' - ); - - return $typeName[$type]; - } } \ No newline at end of file diff --git a/inc/Session.class.php b/inc/SP/Core/Session.class.php similarity index 96% rename from inc/Session.class.php rename to inc/SP/Core/Session.class.php index b190f837..f7c33d34 100644 --- a/inc/Session.class.php +++ b/inc/SP/Core/Session.class.php @@ -23,7 +23,12 @@ * */ -namespace SP; +namespace SP\Core; + +use SP\Account; +use SP\Mgmt; +use SP\Mgmt\User\Profile; +use SP\Mgmt\User\UserPreferences; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -275,15 +280,15 @@ class Session /** * Establece el objeto de perfil de usuario en la sesión. * - * @param \SP\Profile $profile + * @param \SP\Mgmt\User\Profile $profile */ - public static function setUserProfile(\SP\Profile $profile) + public static function setUserProfile(Mgmt\User\Profile $profile) { self::setSessionKey('usrprofile', $profile); } /** - * @return \SP\AccountSearch + * @return \SP\Account\AccountSearch */ public static function getSearchFilters() { @@ -291,9 +296,9 @@ class Session } /** - * @param \SP\AccountSearch $searchFilters + * @param \SP\Account\AccountSearch $searchFilters */ - public static function setSearchFilters(\SP\AccountSearch $searchFilters) + public static function setSearchFilters(Account\AccountSearch $searchFilters) { self::setSessionKey('searchFilters', $searchFilters); } @@ -631,9 +636,9 @@ class Session /** * Establece el objeto de preferencias de usuario en la sesión. * - * @param \SP\UserPreferences $preferences + * @param \SP\Mgmt\User\UserPreferences $preferences */ - public static function setUserPreferences(\SP\UserPreferences $preferences) + public static function setUserPreferences(Mgmt\User\UserPreferences $preferences) { self::setSessionKey('usrpreferences', $preferences); } diff --git a/inc/SessionUtil.class.php b/inc/SP/Core/SessionUtil.class.php similarity index 98% rename from inc/SessionUtil.class.php rename to inc/SP/Core/SessionUtil.class.php index e372aa83..4b2540db 100644 --- a/inc/SessionUtil.class.php +++ b/inc/SP/Core/SessionUtil.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Core; + +use SP\Mgmt\User\Profile; +use SP\Mgmt\User\User; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Template.class.php b/inc/SP/Core/Template.class.php similarity index 99% rename from inc/Template.class.php rename to inc/SP/Core/Template.class.php index 73d172a5..097bcc35 100644 --- a/inc/Template.class.php +++ b/inc/SP/Core/Template.class.php @@ -22,7 +22,8 @@ * along with sysPass. If not, see . * */ -namespace SP; + +namespace SP\Core; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Themes.class.php b/inc/SP/Core/Themes.class.php similarity index 98% rename from inc/Themes.class.php rename to inc/SP/Core/Themes.class.php index ee2e8217..f55c20e1 100644 --- a/inc/Themes.class.php +++ b/inc/SP/Core/Themes.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Core; + +use SP\Config\Config; +use SP\Mgmt\User\UserPreferences; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Upgrade.class.php b/inc/SP/Core/Upgrade.class.php similarity index 98% rename from inc/Upgrade.class.php rename to inc/SP/Core/Upgrade.class.php index 2f125189..3e96e741 100644 --- a/inc/Upgrade.class.php +++ b/inc/SP/Core/Upgrade.class.php @@ -24,7 +24,14 @@ * */ -namespace SP; +namespace SP\Core; + +use SP\Config\Config; +use SP\Log\Email; +use SP\Log\Log; +use SP\Mgmt\User\Profile; +use SP\Storage\DB; +use SP\Mgmt\User\UserMigrate; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/XmlExport.class.php b/inc/SP/Core/XmlExport.class.php similarity index 99% rename from inc/XmlExport.class.php rename to inc/SP/Core/XmlExport.class.php index ba41cfa7..a7271587 100644 --- a/inc/XmlExport.class.php +++ b/inc/SP/Core/XmlExport.class.php @@ -23,7 +23,14 @@ * */ -namespace SP; +namespace SP\Core; + +use SP\Account\AccountUtil; +use SP\Config\Config; +use SP\Mgmt\Customer; +use SP\Log\Log; +use SP\Mgmt\Category; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Html.class.php b/inc/SP/Html/Html.class.php similarity index 99% rename from inc/Html.class.php rename to inc/SP/Html/Html.class.php index 063fdd36..cfac7e5a 100644 --- a/inc/Html.class.php +++ b/inc/SP/Html/Html.class.php @@ -23,7 +23,7 @@ * */ -namespace SP; +namespace SP\Html; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Minify.class.php b/inc/SP/Html/Minify.class.php similarity index 99% rename from inc/Minify.class.php rename to inc/SP/Html/Minify.class.php index 80049dfb..f655ea01 100644 --- a/inc/Minify.class.php +++ b/inc/SP/Html/Minify.class.php @@ -23,9 +23,11 @@ * */ -namespace SP; +namespace SP\Html; use CssMin; +use SP\Http\Request; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Request.class.php b/inc/SP/Http/Request.class.php similarity index 98% rename from inc/Request.class.php rename to inc/SP/Http/Request.class.php index f03f178a..59a4924f 100644 --- a/inc/Request.class.php +++ b/inc/SP/Http/Request.class.php @@ -23,7 +23,11 @@ * */ -namespace SP; +namespace SP\Http; + +use SP\Core\CryptPKI; +use SP\Html\Html; +use SP\Core\Init; /** * Clase Request para la gestión de peticiones HTTP diff --git a/inc/Response.class.php b/inc/SP/Http/Response.class.php similarity index 99% rename from inc/Response.class.php rename to inc/SP/Http/Response.class.php index 05e0088a..76fb5cfb 100644 --- a/inc/Response.class.php +++ b/inc/SP/Http/Response.class.php @@ -23,7 +23,7 @@ * */ -namespace SP; +namespace SP\Http; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/CsvImport.class.php b/inc/SP/Import/CsvImport.class.php similarity index 96% rename from inc/CsvImport.class.php rename to inc/SP/Import/CsvImport.class.php index 1c6af834..9b8b16c0 100644 --- a/inc/CsvImport.class.php +++ b/inc/SP/Import/CsvImport.class.php @@ -23,7 +23,9 @@ * */ -namespace SP; +namespace SP\Import; + +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/CsvImportBase.class.php b/inc/SP/Import/CsvImportBase.class.php similarity index 97% rename from inc/CsvImportBase.class.php rename to inc/SP/Import/CsvImportBase.class.php index f3551542..dec1f3ec 100644 --- a/inc/CsvImportBase.class.php +++ b/inc/SP/Import/CsvImportBase.class.php @@ -23,7 +23,13 @@ * */ -namespace SP; +namespace SP\Import; + +use SP\Core\Crypt; +use SP\Mgmt\Customer; +use SP\Log\Log; +use SP\Mgmt\Category; +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/FileImport.class.php b/inc/SP/Import/FileImport.class.php similarity index 98% rename from inc/FileImport.class.php rename to inc/SP/Import/FileImport.class.php index ec8fe0a4..d30d6938 100644 --- a/inc/FileImport.class.php +++ b/inc/SP/Import/FileImport.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Import; + +use SP\Core\SPException; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Import.class.php b/inc/SP/Import/Import.class.php similarity index 98% rename from inc/Import.class.php rename to inc/SP/Import/Import.class.php index 9cbfb814..4a802667 100644 --- a/inc/Import.class.php +++ b/inc/SP/Import/Import.class.php @@ -24,7 +24,10 @@ * */ -namespace SP; +namespace SP\Import; + +use SP\Log\Log; +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/ImportBase.class.php b/inc/SP/Import/ImportBase.class.php similarity index 98% rename from inc/ImportBase.class.php rename to inc/SP/Import/ImportBase.class.php index 0c1cafee..00e5f175 100644 --- a/inc/ImportBase.class.php +++ b/inc/SP/Import/ImportBase.class.php @@ -23,7 +23,13 @@ * */ -namespace SP; +namespace SP\Import; + +use SP\Account\Account; +use SP\Mgmt\Customer; +use SP\Mgmt\Category; +use SP\Core\Session; +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/KeepassImport.class.php b/inc/SP/Import/KeepassImport.class.php similarity index 98% rename from inc/KeepassImport.class.php rename to inc/SP/Import/KeepassImport.class.php index 58278dcf..dda5a264 100644 --- a/inc/KeepassImport.class.php +++ b/inc/SP/Import/KeepassImport.class.php @@ -23,7 +23,9 @@ * */ -namespace SP; +namespace SP\Import; + +use SP\Core\Crypt; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/KeepassXImport.class.php b/inc/SP/Import/KeepassXImport.class.php similarity index 98% rename from inc/KeepassXImport.class.php rename to inc/SP/Import/KeepassXImport.class.php index 780c8c6f..78ac97b0 100644 --- a/inc/KeepassXImport.class.php +++ b/inc/SP/Import/KeepassXImport.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Import; + +use SP\Core\Crypt; +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Migrate.class.php b/inc/SP/Import/Migrate.class.php similarity index 99% rename from inc/Migrate.class.php rename to inc/SP/Import/Migrate.class.php index d0223b91..1953775e 100644 --- a/inc/Migrate.class.php +++ b/inc/SP/Import/Migrate.class.php @@ -23,7 +23,15 @@ * */ -namespace SP; +namespace SP\Import; + +use SP\Config\Config; +use SP\Mgmt\Customer; +use SP\Log\Log; +use SP\Core\Session; +use SP\Core\SPException; +use SP\Storage\DB; +use SP\Storage\DBUtil; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -411,7 +419,7 @@ class Migrate $data['dateEdit'] = $account['datChanged']; if (DB::getQuery($query, __FUNCTION__, $data) === false) { - self::$_currentQuery = DB::escape($query); + self::$_currentQuery = DBUtil::escape($query); throw new SPException(SPException::SP_CRITICAL, _('Error al migrar cuenta'), DB::$txtError); diff --git a/inc/SyspassImport.class.php b/inc/SP/Import/SyspassImport.class.php similarity index 99% rename from inc/SyspassImport.class.php rename to inc/SP/Import/SyspassImport.class.php index 77426bc4..f9e90d51 100644 --- a/inc/SyspassImport.class.php +++ b/inc/SP/Import/SyspassImport.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Import; + +use SP\Core\Crypt; +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/XmlImport.class.php b/inc/SP/Import/XmlImport.class.php similarity index 97% rename from inc/XmlImport.class.php rename to inc/SP/Import/XmlImport.class.php index 19e23955..19e23bd8 100644 --- a/inc/XmlImport.class.php +++ b/inc/SP/Import/XmlImport.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Import; + +use SP\Core\SPException; +use SP\Log\Log; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/XmlImportBase.class.php b/inc/SP/Import/XmlImportBase.class.php similarity index 98% rename from inc/XmlImportBase.class.php rename to inc/SP/Import/XmlImportBase.class.php index 77b7f49d..078cb787 100644 --- a/inc/XmlImportBase.class.php +++ b/inc/SP/Import/XmlImportBase.class.php @@ -23,7 +23,9 @@ * */ -namespace SP; +namespace SP\Import; + +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/ActionLog.class.php b/inc/SP/Log/ActionLog.class.php similarity index 99% rename from inc/ActionLog.class.php rename to inc/SP/Log/ActionLog.class.php index f0cb2629..42913e4e 100644 --- a/inc/ActionLog.class.php +++ b/inc/SP/Log/ActionLog.class.php @@ -23,8 +23,7 @@ * */ -namespace SP; - +namespace SP\Log; /** * Clase abstracta ActionLog para la gestión de mensajes de eventos diff --git a/inc/Email.class.php b/inc/SP/Log/Email.class.php similarity index 94% rename from inc/Email.class.php rename to inc/SP/Log/Email.class.php index c3f43d82..5d4d5f53 100644 --- a/inc/Email.class.php +++ b/inc/SP/Log/Email.class.php @@ -23,7 +23,15 @@ * */ -namespace SP; +namespace SP\Log; + +use PHPMailer; +use SP\Config\Config; +use SP\Html\Html; +use SP\Core\Init; +use SP\Core\Session; +use SP\Util\Checks; +use SP\Util\Util; /** * Clase Email para la gestión de envío de correos de notificación @@ -42,7 +50,7 @@ class Email */ public static function sendEmail(Log $log, $mailTo = '', $isEvent = true) { - if (!Util::mailIsEnabled()) { + if (!Checks::mailIsEnabled()) { return false; } @@ -100,7 +108,7 @@ class Email * * @param string $mailTo con la dirección del destinatario * @param string $action con la acción realizada - * @return false|\PHPMailer + * @return false|\phpmailer\PHPMailer */ private static function getEmailObject($mailTo, $action) { @@ -123,10 +131,7 @@ class Email $mailTo = $mailFrom; } - require_once EXTENSIONS_PATH . '/phpmailer/class.phpmailer.php'; - require_once EXTENSIONS_PATH . '/phpmailer/class.smtp.php'; - - $mail = new \PHPMailer(); + $mail = new \phpmailer\PHPMailer(); $mail->isSMTP(); $mail->CharSet = 'utf-8'; diff --git a/inc/Log.class.php b/inc/SP/Log/Log.class.php similarity index 96% rename from inc/Log.class.php rename to inc/SP/Log/Log.class.php index d14721df..b335d4c1 100644 --- a/inc/Log.class.php +++ b/inc/SP/Log/Log.class.php @@ -23,7 +23,13 @@ * */ -namespace SP; +namespace SP\Log; + +use SP\Storage\DB; +use SP\Log\Email; +use SP\Core\Session; +use SP\Util\Checks; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -143,7 +149,7 @@ class Log extends ActionLog error_log('Action: ' . $this->getAction() . ' -- Description: ' . $this->getDescription()); } - if (!Util::logIsEnabled()) { + if (!Checks::logIsEnabled()) { return false; } diff --git a/inc/Category.class.php b/inc/SP/Mgmt/Category.class.php similarity index 98% rename from inc/Category.class.php rename to inc/SP/Mgmt/Category.class.php index f992e418..447f6a08 100644 --- a/inc/Category.class.php +++ b/inc/SP/Mgmt/Category.class.php @@ -24,7 +24,12 @@ * */ -namespace SP; +namespace SP\Mgmt; + +use SP\Storage\DB; +use SP\Html\Html; +use SP\Log\Log; +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/CustomFieldDef.class.php b/inc/SP/Mgmt/CustomFieldDef.class.php similarity index 95% rename from inc/CustomFieldDef.class.php rename to inc/SP/Mgmt/CustomFieldDef.class.php index 991de94f..b2733ca1 100644 --- a/inc/CustomFieldDef.class.php +++ b/inc/SP/Mgmt/CustomFieldDef.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Mgmt; + +use SP\Storage\DB; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -104,6 +107,10 @@ class CustomFieldDef extends CustomFieldsBase */ $field = unserialize($customField->customfielddef_field); + if (get_class($field) === '__PHP_Incomplete_Class') { + $field = Util::castToClass('SP\Mgmt\CustomFieldDef', $field); + } + $attribs = new \stdClass(); $attribs->id = $customField->customfielddef_id; $attribs->module = self::getFieldsModules($customField->customfielddef_module); diff --git a/inc/CustomFields.class.php b/inc/SP/Mgmt/CustomFields.class.php similarity index 96% rename from inc/CustomFields.class.php rename to inc/SP/Mgmt/CustomFields.class.php index 92595169..2f4b9e06 100644 --- a/inc/CustomFields.class.php +++ b/inc/SP/Mgmt/CustomFields.class.php @@ -23,7 +23,13 @@ * */ -namespace SP; +namespace SP\Mgmt; + +use SP\Core\Crypt; +use SP\Storage\DB; +use SP\Log\Log; +use SP\Core\SPException; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -57,6 +63,10 @@ class CustomFields extends CustomFieldsBase $fieldDef = CustomFieldDef::getCustomFields($customFieldDefId, true); $field = unserialize($fieldDef->customfielddef_field); + if (get_class($field) === '__PHP_Incomplete_Class') { + $field = Util::castToClass('SP\Mgmt\CustomFieldDef', $field); + } + $this->_id = $customFieldDefId; $this->_module = $fieldDef->customfielddef_module; $this->_name = $field->getName(); @@ -96,6 +106,10 @@ class CustomFields extends CustomFieldsBase */ $field = unserialize($customField->customfielddef_field); + if (get_class($field) === '__PHP_Incomplete_Class') { + $field = Util::castToClass('SP\Mgmt\CustomFieldDef', $field); + } + $attribs = new \stdClass(); $attribs->id = $customField->customfielddef_id; $attribs->name = 'cf_' . strtolower(self::cleanFieldName($field->getName())); @@ -158,6 +172,10 @@ class CustomFields extends CustomFieldsBase */ $field = unserialize($customField->customfielddef_field); + if (get_class($field) === '__PHP_Incomplete_Class') { + $field = Util::castToClass('SP\Mgmt\CustomFieldDef', $field); + } + $attribs = new \stdClass(); $attribs->id = $customField->customfielddef_id; $attribs->name = 'cf_' . strtolower(self::cleanFieldName($field->getName())); diff --git a/inc/CustomFieldsBase.class.php b/inc/SP/Mgmt/CustomFieldsBase.class.php similarity index 98% rename from inc/CustomFieldsBase.class.php rename to inc/SP/Mgmt/CustomFieldsBase.class.php index a4600e81..8e00ac5f 100644 --- a/inc/CustomFieldsBase.class.php +++ b/inc/SP/Mgmt/CustomFieldsBase.class.php @@ -23,11 +23,11 @@ * */ -namespace SP; +namespace SP\Mgmt; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); -use SP\Controller\ActionsInterface; +use SP\Core\ActionsInterface; /** * Class CustomFieldsBase para la definición de campos personalizados diff --git a/inc/Customer.class.php b/inc/SP/Mgmt/Customer.class.php similarity index 97% rename from inc/Customer.class.php rename to inc/SP/Mgmt/Customer.class.php index f0c241ba..ee1ef7fd 100644 --- a/inc/Customer.class.php +++ b/inc/SP/Mgmt/Customer.class.php @@ -24,7 +24,13 @@ * */ -namespace SP; +namespace SP\Mgmt; + +use SP\Storage\DB; +use SP\Html\Html; +use SP\Log\Log; +use SP\Core\SPException; +use SP\Storage\DBUtil; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -77,7 +83,7 @@ class Customer $charsSrc = array( ".", " ", "_", ", ", "-", ";", "'", "\"", ":", "(", ")", "|", "/"); - $newValue = strtolower(str_replace($charsSrc, '', DB::escape(self::$customerName))); + $newValue = strtolower(str_replace($charsSrc, '', DBUtil::escape(self::$customerName))); $hashValue = md5($newValue); return $hashValue; diff --git a/inc/Files.class.php b/inc/SP/Mgmt/Files.class.php similarity index 98% rename from inc/Files.class.php rename to inc/SP/Mgmt/Files.class.php index 11299c8b..2c31274c 100644 --- a/inc/Files.class.php +++ b/inc/SP/Mgmt/Files.class.php @@ -24,7 +24,12 @@ * */ -namespace SP; +namespace SP\Mgmt; + +use SP\Util\ImageUtil; +use SP\Log\Email; +use SP\Log\Log; +use SP\Storage\DB; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/PublicLink.class.php b/inc/SP/Mgmt/PublicLink.class.php similarity index 91% rename from inc/PublicLink.class.php rename to inc/SP/Mgmt/PublicLink.class.php index 61ac9e9f..7201e74d 100644 --- a/inc/PublicLink.class.php +++ b/inc/SP/Mgmt/PublicLink.class.php @@ -23,7 +23,18 @@ * */ -namespace SP; +namespace SP\Mgmt; + +use SP\Account\AccountUtil; +use SP\Config\Config; +use SP\Html\Html; +use SP\Log\Email; +use SP\Log\Log; +use SP\Core\Session; +use SP\Core\SPException; +use SP\Storage\DB; +use SP\Mgmt\User\UserUtil; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -63,6 +74,11 @@ class PublicLink extends PublicLinkBase * @var $PublicLink PublicLink */ $PublicLink = unserialize($queryRes->publicLink_linkData); + + if (get_class($PublicLink) === '__PHP_Incomplete_Class') { + $PublicLink = Util::castToClass(__CLASS__, $PublicLink); + } + $PublicLink->setId($queryRes->publicLink_id); return $PublicLink; @@ -92,6 +108,11 @@ class PublicLink extends PublicLinkBase * @var $PublicLink PublicLink */ $PublicLink = unserialize($queryRes->publicLink_linkData); + + if (get_class($PublicLink) === '__PHP_Incomplete_Class') { + $PublicLink = Util::castToClass('\SP\Mgmt\PublicLink', $PublicLink); + } + $PublicLink->setId($queryRes->publicLink_id); return $PublicLink; diff --git a/inc/PublicLinkBase.class.php b/inc/SP/Mgmt/PublicLinkBase.class.php similarity index 98% rename from inc/PublicLinkBase.class.php rename to inc/SP/Mgmt/PublicLinkBase.class.php index 78ed6099..ed35613f 100644 --- a/inc/PublicLinkBase.class.php +++ b/inc/SP/Mgmt/PublicLinkBase.class.php @@ -23,7 +23,13 @@ * */ -namespace SP; +namespace SP\Mgmt; + +use SP\Config\Config; +use SP\Core\Crypt; +use SP\Core\SessionUtil; +use SP\Core\SPException; +use SP\Storage\DB; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/PublicLinkUtil.class.php b/inc/SP/Mgmt/PublicLinkUtil.class.php similarity index 90% rename from inc/PublicLinkUtil.class.php rename to inc/SP/Mgmt/PublicLinkUtil.class.php index 9dfeffd7..77581c6b 100644 --- a/inc/PublicLinkUtil.class.php +++ b/inc/SP/Mgmt/PublicLinkUtil.class.php @@ -23,7 +23,12 @@ * */ -namespace SP; +namespace SP\Mgmt; + +use SP\Account\AccountUtil; +use SP\Storage\DB; +use SP\Mgmt\User\UserUtil; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -66,6 +71,10 @@ class PublicLinkUtil */ $PublicLink = unserialize($data->publicLink_linkData); + if (get_class($PublicLink) === '__PHP_Incomplete_Class') { + $PublicLink = Util::castToClass('SP\Mgmt\PublicLink', $PublicLink); + } + $link = new \stdClass(); $link->publicLink_id = $data->publicLink_id; $link->publicLink_hash = $data->publicLink_hash; diff --git a/inc/Groups.class.php b/inc/SP/Mgmt/User/Groups.class.php similarity index 99% rename from inc/Groups.class.php rename to inc/SP/Mgmt/User/Groups.class.php index 1cdc2ab5..8986af3d 100644 --- a/inc/Groups.class.php +++ b/inc/SP/Mgmt/User/Groups.class.php @@ -24,7 +24,12 @@ * */ -namespace SP; +namespace SP\Mgmt\User; + +use SP\Html\Html; +use SP\Log\Email; +use SP\Log\Log; +use SP\Storage\DB; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Profile.class.php b/inc/SP/Mgmt/User/Profile.class.php similarity index 98% rename from inc/Profile.class.php rename to inc/SP/Mgmt/User/Profile.class.php index ea3eedfa..0050b4f8 100644 --- a/inc/Profile.class.php +++ b/inc/SP/Mgmt/User/Profile.class.php @@ -24,7 +24,11 @@ * */ -namespace SP; +namespace SP\Mgmt\User; + +use SP\Log\Email; +use SP\Log\Log; +use SP\Storage\DB; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/ProfileBase.class.php b/inc/SP/Mgmt/User/ProfileBase.class.php similarity index 97% rename from inc/ProfileBase.class.php rename to inc/SP/Mgmt/User/ProfileBase.class.php index 9cafcaaf..c53c4a36 100644 --- a/inc/ProfileBase.class.php +++ b/inc/SP/Mgmt/User/ProfileBase.class.php @@ -23,7 +23,14 @@ * */ -namespace SP; +namespace SP\Mgmt\User; + +use SP\Html\Html; +use SP\Log\Log; +use SP\Core\SPException; +use SP\Storage\DB; +use SP\Util\Checks; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -150,10 +157,13 @@ abstract class ProfileBase return false; } + /** + * @var Profile $profile + */ $profile = unserialize($queryRes->userprofile_profile); - if (!$profile instanceof Profile) { - throw new SPException(SPException::SP_CRITICAL, _('Datos de perfil incorrectos')); + if (get_class($profile) === '__PHP_Incomplete_Class') { + return Util::castToClass('SP\Mgmt\User\Profile', $profile); } return $profile; @@ -166,7 +176,7 @@ abstract class ProfileBase */ public static function getProfiles() { - if (Util::demoIsEnabled()) { + if (Checks::demoIsEnabled()) { $query = 'SELECT userprofile_id, userprofile_name FROM usrProfiles WHERE userprofile_name <> "Admin" AND userprofile_name <> "Demo" ORDER BY userprofile_name'; } else { $query = 'SELECT userprofile_id, userprofile_name FROM usrProfiles ORDER BY userprofile_name'; diff --git a/inc/User.class.php b/inc/SP/Mgmt/User/User.class.php similarity index 96% rename from inc/User.class.php rename to inc/SP/Mgmt/User/User.class.php index 3bb1a3f3..b792076a 100644 --- a/inc/User.class.php +++ b/inc/SP/Mgmt/User/User.class.php @@ -23,7 +23,12 @@ * */ -namespace SP; +namespace SP\Mgmt\User; + +use SP\Config\ConfigDB; +use SP\Core\Crypt; +use SP\Core\SessionUtil; +use SP\Storage\DB; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/UserBase.class.php b/inc/SP/Mgmt/User/UserBase.class.php similarity index 97% rename from inc/UserBase.class.php rename to inc/SP/Mgmt/User/UserBase.class.php index c4cc10e8..eb166965 100644 --- a/inc/UserBase.class.php +++ b/inc/SP/Mgmt/User/UserBase.class.php @@ -23,7 +23,14 @@ * */ -namespace SP; +namespace SP\Mgmt\User; + +use SP\Auth\Auth; +use SP\Html\Html; +use SP\Log\Email; +use SP\Log\Log; +use SP\Storage\DB; +use SP\Storage\DBUtil; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -384,7 +391,7 @@ abstract class UserBase $Log->addDescription(sprintf('%s: %s (%s)', Html::strongText(_('Usuario')), $this->_userName, $this->_userLogin)); if ($this->_userChangePass) { - if (!Auth::mailPassRecover(DB::escape($this->_userLogin), DB::escape($this->_userEmail))) { + if (!Auth::mailPassRecover(DBUtil::escape($this->_userLogin), DBUtil::escape($this->_userEmail))) { $Log->addDescription(Html::strongText(_('No se pudo realizar la petición de cambio de clave.'))); } } @@ -528,7 +535,7 @@ abstract class UserBase $Log->addDescription(sprintf('%s: %s (%s)', Html::strongText(_('Usuario')), $this->_userName, $this->_userLogin)); if ($this->_userChangePass) { - if (!Auth::mailPassRecover(DB::escape($this->_userLogin), DB::escape($this->_userEmail))) { + if (!Auth::mailPassRecover(DBUtil::escape($this->_userLogin), DBUtil::escape($this->_userEmail))) { $Log->addDescription(Html::strongText(_('No se pudo realizar la petición de cambio de clave.'))); } } diff --git a/inc/UserLdap.class.php b/inc/SP/Mgmt/User/UserLdap.class.php similarity index 97% rename from inc/UserLdap.class.php rename to inc/SP/Mgmt/User/UserLdap.class.php index 9857071c..ff6ddbb1 100644 --- a/inc/UserLdap.class.php +++ b/inc/SP/Mgmt/User/UserLdap.class.php @@ -23,7 +23,12 @@ * */ -namespace SP; +namespace SP\Mgmt\User; + +use SP\Config\Config; +use SP\Log\Email; +use SP\Log\Log; +use SP\Storage\DB; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/UserMigrate.class.php b/inc/SP/Mgmt/User/UserMigrate.class.php similarity index 97% rename from inc/UserMigrate.class.php rename to inc/SP/Mgmt/User/UserMigrate.class.php index 1e90cbe1..c6e57c0b 100644 --- a/inc/UserMigrate.class.php +++ b/inc/SP/Mgmt/User/UserMigrate.class.php @@ -23,7 +23,11 @@ * */ -namespace SP; +namespace SP\Mgmt\User; + +use SP\Log\Email; +use SP\Log\Log; +use SP\Storage\DB; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/UserPass.class.php b/inc/SP/Mgmt/User/UserPass.class.php similarity index 96% rename from inc/UserPass.class.php rename to inc/SP/Mgmt/User/UserPass.class.php index 6876b39a..4ee212c6 100644 --- a/inc/UserPass.class.php +++ b/inc/SP/Mgmt/User/UserPass.class.php @@ -23,7 +23,14 @@ * */ -namespace SP; +namespace SP\Mgmt\User; + +use SP\Config\ConfigDB; +use SP\Core\Crypt; +use SP\Core\Session; +use SP\Html\Html; +use SP\Log\Log; +use SP\Storage\DB; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/UserPassRecover.class.php b/inc/SP/Mgmt/User/UserPassRecover.class.php similarity index 98% rename from inc/UserPassRecover.class.php rename to inc/SP/Mgmt/User/UserPassRecover.class.php index d067bde8..e643a32a 100644 --- a/inc/UserPassRecover.class.php +++ b/inc/SP/Mgmt/User/UserPassRecover.class.php @@ -23,7 +23,9 @@ * */ -namespace SP; +namespace SP\Mgmt\User; + +use SP\Storage\DB; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/UserPreferences.class.php b/inc/SP/Mgmt/User/UserPreferences.class.php similarity index 95% rename from inc/UserPreferences.class.php rename to inc/SP/Mgmt/User/UserPreferences.class.php index 1983d77b..d2fb759e 100644 --- a/inc/UserPreferences.class.php +++ b/inc/SP/Mgmt/User/UserPreferences.class.php @@ -23,7 +23,11 @@ * */ -namespace SP; +namespace SP\Mgmt\User; + +use SP\Core\SPException; +use SP\Storage\DB; +use SP\Util\Util; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -90,13 +94,12 @@ class UserPreferences if ($queryRes === false) { return new UserPreferences(); -// throw new SPException(SPException::SP_WARNING, _('Datos de preferencias incorrectos')); } $preferences = unserialize($queryRes->user_preferences); - if (!$preferences instanceof UserPreferences) { - return new UserPreferences(); + if (get_class($preferences) === '__PHP_Incomplete_Class') { + return Util::castToClass('SP\Mgmt\User\UserPreferences', $preferences); } return $preferences; diff --git a/inc/UserUtil.class.php b/inc/SP/Mgmt/User/UserUtil.class.php similarity index 99% rename from inc/UserUtil.class.php rename to inc/SP/Mgmt/User/UserUtil.class.php index d76ead37..bd6e31d2 100644 --- a/inc/UserUtil.class.php +++ b/inc/SP/Mgmt/User/UserUtil.class.php @@ -23,7 +23,10 @@ * */ -namespace SP; +namespace SP\Mgmt\User; + +use SP\Core\Session; +use SP\Storage\DB; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/DB.class.php b/inc/SP/Storage/DB.class.php similarity index 77% rename from inc/DB.class.php rename to inc/SP/Storage/DB.class.php index 3197bf2f..4eafa23d 100644 --- a/inc/DB.class.php +++ b/inc/SP/Storage/DB.class.php @@ -23,7 +23,11 @@ * */ -namespace SP; +namespace SP\Storage; + +use SP\Config\Config; +use SP\Log\Log; +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -91,70 +95,6 @@ class DB return self::$lastId; } - /** - * Comprobar que la base de datos existe. - * - * @return bool - * @throws SPException - */ - public static function checkDatabaseExist() - { - try { - $db = DBConnectionFactory::getFactory()->getConnection(); - - $query = 'SELECT COUNT(*) ' - . 'FROM information_schema.tables ' - . 'WHERE table_schema=\'' . Config::getValue("dbname") . '\' ' - . 'AND table_name = \'usrData\''; - - if ($db->query($query)->fetchColumn() !== 0) { - return true; - } - } catch (\Exception $e) { - throw new SPException(SPException::SP_CRITICAL, $e->getMessage(), $e->getCode()); - } - - return false; - } - - /** - * Obtener los datos para generar un select. - * - * @param $tblName string con el nombre de la tabla a cunsultar - * @param $tblColId string con el nombre de la columna del tipo Id a mostrar - * @param $tblColName string con el nombre de la columna del tipo Name a mostrar - * @param $arrFilter array con las columnas a filtrar - * @param $arrOrder array con el orden de las columnas - * @return array con los valores del select con el Id como clave y el nombre como valor - */ - public static function getValuesForSelect($tblName, $tblColId, $tblColName, $arrFilter = NULL, $arrOrder = NULL) - { - if (!$tblName || !$tblColId || !$tblColName) { - return false; - } - - $strFilter = (is_array($arrFilter)) ? " WHERE " . implode(" OR ", $arrFilter) : ""; - $strOrder = (is_array($arrOrder)) ? " ORDER BY " . implode(",", $arrOrder) : 'ORDER BY ' . $tblColName . ' ASC'; - - $query = "SELECT $tblColId, $tblColName FROM $tblName $strFilter $strOrder"; - - self::setReturnArray(); - - $queryRes = self::getResults($query, __FUNCTION__); - - if ($queryRes === false) { - return array(); - } - - $arrValues = array(); - - foreach ($queryRes as $row) { - $arrValues[$row->$tblColId] = $row->$tblColName; - } - - return $arrValues; - } - /** * Establecer si se devuelve un array de objetos siempre */ @@ -326,30 +266,13 @@ class DB { $Log = new Log($querySource); $Log->addDescription($errorMsg . '(' . $errorCode . ')'); - $Log->addDescription("SQL: " . self::escape($query)); + $Log->addDescription("SQL: " . DBUtil::escape($query)); $Log->writeLog(); error_log($query); error_log($errorMsg); } - /** - * Escapar una cadena de texto con funciones de mysqli. - * - * @param $str string con la cadena a escapar - * @return string con la cadena escapada - */ - public static function escape($str) - { - try { - $db = DBConnectionFactory::getFactory()->getConnection(); - - return $db->quote(trim($str)); - } catch (SPException $e) { - return $str; - } - } - /** * Obtener el número de filas de una consulta realizada * @@ -446,35 +369,6 @@ class DB self::$_fullRowCount = true; } - /** - * Obtener la información del servidor de base de datos - * - * @return array - */ - public static function getDBinfo() - { - $dbinfo = array(); - - try { - $db = DBConnectionFactory::getFactory()->getConnection(); - - $attributes = array( - 'SERVER_VERSION', - 'CLIENT_VERSION', - 'SERVER_INFO', - 'CONNECTION_STATUS', - ); - - foreach ($attributes as $val) { - $dbinfo[$val] = $db->getAttribute(constant('PDO::ATTR_' . $val)); - } - - } catch (SPException $e) { - return $dbinfo; - } - - return $dbinfo; - } /** * Establecer los parámetos de la consulta preparada diff --git a/inc/DBConnectionFactory.class.php b/inc/SP/Storage/DBConnectionFactory.class.php similarity index 97% rename from inc/DBConnectionFactory.class.php rename to inc/SP/Storage/DBConnectionFactory.class.php index 87a9eb40..dfb1ce4c 100644 --- a/inc/DBConnectionFactory.class.php +++ b/inc/SP/Storage/DBConnectionFactory.class.php @@ -23,9 +23,12 @@ * */ -namespace SP; +namespace SP\Storage; use \PDO; +use SP\Config\Config; +use SP\Core\Init; +use SP\Core\SPException; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/SP/Storage/DBUtil.class.php b/inc/SP/Storage/DBUtil.class.php new file mode 100644 index 00000000..2d8bac0f --- /dev/null +++ b/inc/SP/Storage/DBUtil.class.php @@ -0,0 +1,149 @@ +. + * + */ + +namespace SP\Storage; + + +use SP\Config\Config; +use SP\Core\SPException; + +/** + * Class DBUtil con utilidades de la BD + * + * @package SP\Storage + */ +class DBUtil +{ + /** + * Comprobar que la base de datos existe. + * + * @return bool + * @throws SPException + */ + public static function checkDatabaseExist() + { + try { + $db = DBConnectionFactory::getFactory()->getConnection(); + + $query = 'SELECT COUNT(*) ' + . 'FROM information_schema.tables ' + . 'WHERE table_schema=\'' . Config::getValue("dbname") . '\' ' + . 'AND table_name = \'usrData\''; + + if ($db->query($query)->fetchColumn() !== 0) { + return true; + } + } catch (\Exception $e) { + throw new SPException(SPException::SP_CRITICAL, $e->getMessage(), $e->getCode()); + } + + return false; + } + + /** + * Obtener los datos para generar un select. + * + * @param $tblName string con el nombre de la tabla a cunsultar + * @param $tblColId string con el nombre de la columna del tipo Id a mostrar + * @param $tblColName string con el nombre de la columna del tipo Name a mostrar + * @param $arrFilter array con las columnas a filtrar + * @param $arrOrder array con el orden de las columnas + * @return array con los valores del select con el Id como clave y el nombre como valor + */ + public static function getValuesForSelect($tblName, $tblColId, $tblColName, $arrFilter = NULL, $arrOrder = NULL) + { + if (!$tblName || !$tblColId || !$tblColName) { + return false; + } + + $strFilter = (is_array($arrFilter)) ? " WHERE " . implode(" OR ", $arrFilter) : ""; + $strOrder = (is_array($arrOrder)) ? " ORDER BY " . implode(",", $arrOrder) : 'ORDER BY ' . $tblColName . ' ASC'; + + $query = "SELECT $tblColId, $tblColName FROM $tblName $strFilter $strOrder"; + + DB::setReturnArray(); + + $queryRes = DB::getResults($query, __FUNCTION__); + + if ($queryRes === false) { + return array(); + } + + $arrValues = array(); + + foreach ($queryRes as $row) { + $arrValues[$row->$tblColId] = $row->$tblColName; + } + + return $arrValues; + } + + /** + * Escapar una cadena de texto con funciones de mysqli. + * + * @param $str string con la cadena a escapar + * @return string con la cadena escapada + */ + public static function escape($str) + { + try { + $db = DBConnectionFactory::getFactory()->getConnection(); + + return $db->quote(trim($str)); + } catch (SPException $e) { + return $str; + } + } + + /** + * Obtener la información del servidor de base de datos + * + * @return array + */ + public static function getDBinfo() + { + $dbinfo = array(); + + try { + $db = DBConnectionFactory::getFactory()->getConnection(); + + $attributes = array( + 'SERVER_VERSION', + 'CLIENT_VERSION', + 'SERVER_INFO', + 'CONNECTION_STATUS', + ); + + foreach ($attributes as $val) { + $dbinfo[$val] = $db->getAttribute(constant('PDO::ATTR_' . $val)); + } + + } catch (SPException $e) { + return $dbinfo; + } + + return $dbinfo; + } +} \ No newline at end of file diff --git a/inc/SP/Util/Checks.class.php b/inc/SP/Util/Checks.class.php new file mode 100644 index 00000000..4d8cf573 --- /dev/null +++ b/inc/SP/Util/Checks.class.php @@ -0,0 +1,273 @@ +. + * + */ + +namespace SP\Util; + +use SP\Config\Config; +use SP\Core\SPException; + +/** + * Class Checks utilidades de comprobación + * + * @package SP\Util + */ +class Checks +{ + + /** + * Comprobar si la función de números aleatorios está disponible. + * + * @return bool + */ + public static function secureRNGIsAvailable() + { + // Check openssl_random_pseudo_bytes + if (function_exists('openssl_random_pseudo_bytes')) { + openssl_random_pseudo_bytes(1, $strong); + if ($strong == true) { + return true; + } + } + + // Check /dev/urandom + $fp = @file_get_contents('/dev/urandom', false, null, 0, 1); + if ($fp !== false) { + return true; + } + + return false; + } + + /** + * Comprobar si sysPass se ejecuta en W$indows. + * + * @return bool + */ + public static function checkIsWindows() + { + return (substr(PHP_OS, 0, 3) === "WIN"); + } + + /** + * Comprobar la versión de PHP. + * + * @return bool + */ + public static function checkPhpVersion() + { + $error = array(); + $needsVersion = '5.3.0'; + + if (version_compare(PHP_VERSION, $needsVersion, '>=')) { + $error[] = array( + 'type' => SPException::SP_CRITICAL, + 'description' => _('Versión de PHP requerida >= ') . $needsVersion, + 'hint' => _('Actualice la versión de PHP para que la aplicación funcione correctamente') + ); + } + + return $error; + } + + /** + * Comprobar los módulos necesarios. + * + * @return array con los módulos no disponibles + */ + public static function checkModules() + { + $modsNeed = array( + 'ldap', + 'mcrypt', + 'curl', + 'SimpleXML', + 'Phar', + 'json', + 'xml', + 'PDO', + 'zlib', + 'gettext', + 'openssl', + 'pcre', + 'session', + 'gd' + ); + $error = array(); + + foreach ($modsNeed as $module) { + if (!extension_loaded($module)) { + $error[] = array( + 'type' => SPException::SP_WARNING, + 'description' => sprintf('%s (%s)', _('Módulo no disponible'), $module), + 'hint' => _('Sin este módulo la aplicación puede no funcionar correctamente.') + ); + } + } + + return $error; + } + + /** + * Comprobar si el módulo de LDAP está instalado. + * + * @return bool + */ + public static function ldapIsAvailable() + { + return extension_loaded('ldap'); + } + + /** + * Comprobar si el módulo CURL está instalado. + * + * @return bool + */ + public static function curlIsAvailable() + { + return (function_exists('curl_init')); + } + + /** + * Comprobar si está en modo DEMO. + * + * @return bool + */ + public static function demoIsEnabled() + { + return Util::boolval(Config::getValue('demo_enabled', false)); + } + + /** + * Comprobar si está habilitada la gestión de archivos. + * + * @return bool + */ + public static function fileIsEnabled() + { + return Util::boolval(Config::getValue('files_enabled', false)); + } + + /** + * Comprobar si están habilitadas las notificaciones por correo. + * + * @return bool + */ + public static function mailIsEnabled() + { + return Util::boolval(Config::getValue('mail_enabled', false)); + } + + /** + * Comprobar si está habilitada la Wiki. + * + * @return bool + */ + public static function wikiIsEnabled() + { + return Util::boolval(Config::getValue('wiki_enabled', false)); + } + + /** + * Comprobar si están habilitadas las peticiones por correo. + * + * @return bool + */ + public static function mailrequestIsEnabled() + { + return Util::boolval(Config::getValue('mail_requestsenabled', false)); + } + + /** + * Comprobar si está habilitado LDAP. + * + * @return bool + */ + public static function ldapIsEnabled() + { + return Util::boolval(Config::getValue('ldap_enabled', false)); + } + + /** + * Comprobar si está habilitado el log de eventos. + * + * @return bool + */ + public static function logIsEnabled() + { + return Util::boolval(Config::getValue('log_enabled', false)); + } + + /** + * Comprobar si está habilitado el formato de tarjeta en los resultados. + * + * @return bool + */ + public static function resultsCardsIsEnabled() + { + return Util::boolval(Config::getValue('resultsascards', false)); + } + + /** + * Comprobar si está habilitado usar imagen para claves de cuentas + * + * @return bool + */ + public static function accountPassToImageIsEnabled() + { + return Util::boolval(Config::getValue('account_passtoimage', false)); + } + + /** + * Comprobar si está habilitado forzar la conexión por HTTPS + * + * @return bool + */ + public static function forceHttpsIsEnabled() + { + return Util::boolval(Config::getValue('https_enabled', false)); + } + + /** + * Comprobar si está habilitado la publicación de enlaces + * + * @return bool + */ + public static function publicLinksIsEnabled() + { + return Util::boolval(Config::getValue('publinks_enabled', false)); + } + + /** + * Comprobar si se utiliza HTTPS + * + * @return bool + */ + public static function httpsEnabled() + { + return + (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') + || $_SERVER['SERVER_PORT'] == 443; + } +} \ No newline at end of file diff --git a/inc/ImageUtil.class.php b/inc/SP/Util/ImageUtil.class.php similarity index 98% rename from inc/ImageUtil.class.php rename to inc/SP/Util/ImageUtil.class.php index 2ad29f89..ddd68b01 100644 --- a/inc/ImageUtil.class.php +++ b/inc/SP/Util/ImageUtil.class.php @@ -23,7 +23,9 @@ * */ -namespace SP; +namespace SP\Util; + +use SP\Core\Init; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); diff --git a/inc/Util.class.php b/inc/SP/Util/Util.class.php similarity index 66% rename from inc/Util.class.php rename to inc/SP/Util/Util.class.php index 81f993c5..caf03bef 100644 --- a/inc/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -23,7 +23,13 @@ * */ -namespace SP; +namespace SP\Util; + +use SP\Config\Config; +use SP\Core\Init; +use SP\Core\Session; +use SP\Html\Html; +use SP\Log\Log; defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo')); @@ -32,39 +38,7 @@ defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo' */ class Util { - /** - * Comprobar si la función de números aleatorios está disponible. - * - * @return bool - */ - public static function secureRNG_available() - { - // Check openssl_random_pseudo_bytes - if (function_exists('openssl_random_pseudo_bytes')) { - openssl_random_pseudo_bytes(1, $strong); - if ($strong == true) { - return true; - } - } - // Check /dev/urandom - $fp = @file_get_contents('/dev/urandom', false, null, 0, 1); - if ($fp !== false) { - return true; - } - - return false; - } - - /** - * Comprobar si sysPass se ejecuta en W$indows. - * - * @return bool - */ - public static function runningOnWindows() - { - return (substr(PHP_OS, 0, 3) === "WIN"); - } /** * Generar una cadena aleatoria usuando criptografía. @@ -103,64 +77,6 @@ class Util return $pseudo_byte; } - /** - * Comprobar la versión de PHP. - * - * @return bool - */ - public static function checkPhpVersion() - { - $error = array(); - $needsVersion = '5.3.0'; - - if (version_compare(PHP_VERSION, $needsVersion, '>=')) { - $error[] = array( - 'type' => SPException::SP_CRITICAL, - 'description' => _('Versión de PHP requerida >= ') . $needsVersion, - 'hint' => _('Actualice la versión de PHP para que la aplicación funcione correctamente') - ); - } - - return $error; - } - - /** - * Comprobar los módulos necesarios. - * - * @return array con los módulos no disponibles - */ - public static function checkModules() - { - $modsNeed = array( - 'ldap', - 'mcrypt', - 'curl', - 'SimpleXML', - 'Phar', - 'json', - 'xml', - 'PDO', - 'zlib', - 'gettext', - 'openssl', - 'pcre', - 'session', - 'gd' - ); - $error = array(); - - foreach ($modsNeed as $module) { - if (!extension_loaded($module)) { - $error[] = array( - 'type' => SPException::SP_WARNING, - 'description' => sprintf('%s (%s)', _('Módulo no disponible'), $module), - 'hint' => _('Sin este módulo la aplicación puede no funcionar correctamente.') - ); - } - } - - return $error; - } /** * Devuelve el valor de la variable enviada por un formulario. @@ -179,15 +95,6 @@ class Util return $r; } - /** - * Comprobar si el módulo de LDAP está instalado. - * - * @return bool - */ - public static function ldapIsAvailable() - { - return extension_loaded('ldap'); - } /** * Devuelve la versión de sysPass. @@ -291,15 +198,6 @@ class Util return false; } - /** - * Comprobar si el módulo CURL está instalado. - * - * @return bool - */ - public static function curlIsAvailable() - { - return (function_exists('curl_init')); - } /** * Devuelve la versión de sysPass. @@ -341,15 +239,6 @@ class Util Log::writeNewLog(__FUNCTION__, "Max. PHP upload: " . $upload_mb . "MB"); } - /** - * Comprobar si está en modo DEMO. - * - * @return bool - */ - public static function demoIsEnabled() - { - return self::boolval(Config::getValue('demo_enabled', false)); - } /** * Checks a variable to see if it should be considered a boolean true or false. @@ -381,116 +270,6 @@ class Util } } - /** - * Comprobar si está habilitada la gestión de archivos. - * - * @return bool - */ - public static function fileIsEnabled() - { - return self::boolval(Config::getValue('files_enabled', false)); - } - - /** - * Comprobar si están habilitadas las notificaciones por correo. - * - * @return bool - */ - public static function mailIsEnabled() - { - return self::boolval(Config::getValue('mail_enabled', false)); - } - - /** - * Comprobar si está habilitada la Wiki. - * - * @return bool - */ - public static function wikiIsEnabled() - { - return self::boolval(Config::getValue('wiki_enabled', false)); - } - - /** - * Comprobar si están habilitadas las peticiones por correo. - * - * @return bool - */ - public static function mailrequestIsEnabled() - { - return self::boolval(Config::getValue('mail_requestsenabled', false)); - } - - /** - * Comprobar si está habilitado LDAP. - * - * @return bool - */ - public static function ldapIsEnabled() - { - return self::boolval(Config::getValue('ldap_enabled', false)); - } - - /** - * Comprobar si está habilitado el log de eventos. - * - * @return bool - */ - public static function logIsEnabled() - { - return self::boolval(Config::getValue('log_enabled', false)); - } - - /** - * Comprobar si está habilitado el formato de tarjeta en los resultados. - * - * @return bool - */ - public static function resultsCardsIsEnabled() - { - return self::boolval(Config::getValue('resultsascards', false)); - } - - /** - * Comprobar si está habilitado usar imagen para claves de cuentas - * - * @return bool - */ - public static function accountPassToImageIsEnabled() - { - return self::boolval(Config::getValue('account_passtoimage', false)); - } - - /** - * Comprobar si está habilitado forzar la conexión por HTTPS - * - * @return bool - */ - public static function forceHttpsIsEnabled() - { - return self::boolval(Config::getValue('https_enabled', false)); - } - - /** - * Comprobar si está habilitado la publicación de enlaces - * - * @return bool - */ - public static function publicLinksIsEnabled() - { - return self::boolval(Config::getValue('publinks_enabled', false)); - } - - /** - * Comprobar si se utiliza HTTPS - * - * @return bool - */ - public static function httpsEnabled() { - return - (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') - || $_SERVER['SERVER_PORT'] == 443; - } /** * Establecer variable de sesión para recargar la aplicación. @@ -562,7 +341,7 @@ class Util */ public static function getDataFromUrl($url) { - if (!self::curlIsAvailable()) { + if (!Checks::curlIsAvailable()) { return false; } @@ -605,9 +384,22 @@ class Util */ public static function getServerUrl() { - $urlScheme = (self::httpsEnabled()) ? 'https://' : 'http://'; + $urlScheme = (Checks::httpsEnabled()) ? 'https://' : 'http://'; $urlPort = ($_SERVER['SERVER_PORT'] != 443) ? ':' . $_SERVER['SERVER_PORT'] : ''; return $urlScheme . $_SERVER['SERVER_NAME'] . $urlPort; } + + /** + * Cast an object to another class, keeping the properties, but changing the methods + * + * @param string $class Class name + * @param object $object + * @return object + * @link http://blog.jasny.net/articles/a-dark-corner-of-php-class-casting/ + */ + public static function castToClass($class, $object) + { + return unserialize(preg_replace('/^O:\d+:"[^"]++"/', 'O:' . strlen($class) . ':"' . $class . '"', serialize($object))); + } } \ No newline at end of file diff --git a/inc/ext/SplClassLoader.php b/inc/SplClassLoader.php similarity index 87% rename from inc/ext/SplClassLoader.php rename to inc/SplClassLoader.php index c2a10292..2ed40651 100644 --- a/inc/ext/SplClassLoader.php +++ b/inc/SplClassLoader.php @@ -41,6 +41,8 @@ class SplClassLoader private $_namespace; private $_includePath; private $_namespaceSeparator = '\\'; + private $_prepend = false; + private $_excluded = array(); /** * Creates a new SplClassLoader that loads classes of the @@ -54,6 +56,22 @@ class SplClassLoader $this->_includePath = $includePath; } + /** + * @param string $excluded + */ + public function addExcluded($excluded) + { + $this->_excluded[] = $excluded; + } + + /** + * @param boolean $prepend + */ + public function setPrepend($prepend) + { + $this->_prepend = $prepend; + } + /** * Gets the namespace seperator used by classes in the namespace of this class loader. * @@ -119,7 +137,7 @@ class SplClassLoader */ public function register() { - spl_autoload_register(array($this, 'loadClass')); + spl_autoload_register(array($this, 'loadClass'), true, $this->_prepend); } /** @@ -138,7 +156,13 @@ class SplClassLoader */ public function loadClass($className) { - if (null === $this->_namespace || $this->_namespace . $this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace . $this->_namespaceSeparator))) { + if (in_array($className, $this->_excluded)) { + return; + } + + if (null === $this->_namespace + || $this->_namespace . $this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace . $this->_namespaceSeparator)) + ) { $fileName = ''; $namespace = ''; if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) { diff --git a/inc/dbstructure.sql b/inc/dbstructure.sql index 7f9b75a7..2436301e 100644 --- a/inc/dbstructure.sql +++ b/inc/dbstructure.sql @@ -231,15 +231,15 @@ CREATE TABLE `usrToGroups` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `publicLinks`( - `publicLink_id` INT PRIMARY KEY NOT NULL AUTO_INCREMENT, + `publicLink_id` INT NOT NULL AUTO_INCREMENT, `publicLink_itemId` INT, `publicLink_hash` VARBINARY(100) NOT NULL, - `publicLink_linkData` LONGBLOB + `publicLink_linkData` LONGBLOB, + PRIMARY KEY (`publicLink_id`), + KEY `IDX_itemId` (`publicLink_itemId`), + UNIQUE KEY `IDX_hash` (`publicLink_hash`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE UNIQUE INDEX unique_publicLink_accountId ON publicLinks (publicLink_itemId); -CREATE UNIQUE INDEX unique_publicLink_hash ON publicLinks (publicLink_hash); - /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; diff --git a/inc/themes/classic/2fa.inc b/inc/themes/classic/2fa.inc index eea64b92..3669b4e8 100644 --- a/inc/themes/classic/2fa.inc +++ b/inc/themes/classic/2fa.inc @@ -24,7 +24,7 @@
diff --git a/inc/themes/classic/account.inc b/inc/themes/classic/account.inc index f9b45ad6..16d6b35e 100644 --- a/inc/themes/classic/account.inc +++ b/inc/themes/classic/account.inc @@ -1,4 +1,4 @@ -
+
@@ -49,8 +49,8 @@ value="" account_categoryId) ? 'selected' : ''; ?>> - - add + + add category_name; ?> @@ -195,7 +195,7 @@ - +
@@ -227,7 +227,7 @@ var historyId = $('#selHistory').val(); if (historyId > 0) - sysPassUtil.Common.doAction(,, historyId); + sysPassUtil.Common.doAction(,, historyId); }); $('#selHistory').chosen({ @@ -239,7 +239,7 @@ - + user_editName): ?> @@ -266,11 +266,11 @@ required) ? 'required' : ''; ?>> - type === \SP\CustomFields::TYPE_PASSWORD && !$showViewPass):?> + type === \SP\Mgmt\CustomFields::TYPE_PASSWORD && !$showViewPass):?> **** value; ?> @@ -357,7 +357,7 @@
+ value=""> @@ -367,65 +367,65 @@
- + - +
diff --git a/inc/themes/classic/backup.inc b/inc/themes/classic/backup.inc index ebaaa100..231e3f19 100644 --- a/inc/themes/classic/backup.inc +++ b/inc/themes/classic/backup.inc @@ -37,14 +37,14 @@ - +

@@ -52,7 +52,7 @@

@@ -105,14 +105,14 @@ - +

@@ -124,7 +124,7 @@

diff --git a/inc/themes/classic/categories.inc b/inc/themes/classic/categories.inc index 45a762fa..2533dd39 100644 --- a/inc/themes/classic/categories.inc +++ b/inc/themes/classic/categories.inc @@ -36,9 +36,9 @@ required) ? 'required' : ''; ?>> value; ?> @@ -60,7 +60,7 @@
\ No newline at end of file diff --git a/inc/themes/classic/config.inc b/inc/themes/classic/config.inc index ca723c6e..81409f1a 100644 --- a/inc/themes/classic/config.inc +++ b/inc/themes/classic/config.inc @@ -285,14 +285,14 @@ + value=""/>
diff --git a/inc/themes/classic/customers.inc b/inc/themes/classic/customers.inc index 233ba65a..e4dbdc37 100644 --- a/inc/themes/classic/customers.inc +++ b/inc/themes/classic/customers.inc @@ -36,9 +36,9 @@ required) ? 'required' : ''; ?>> value; ?> @@ -60,7 +60,7 @@
\ No newline at end of file diff --git a/inc/themes/classic/customfields.inc b/inc/themes/classic/customfields.inc index 01e4bd23..348bc78d 100644 --- a/inc/themes/classic/customfields.inc +++ b/inc/themes/classic/customfields.inc @@ -61,7 +61,7 @@
diff --git a/inc/themes/classic/debug.inc b/inc/themes/classic/debug.inc index 72a90dfd..2f9a6561 100644 --- a/inc/themes/classic/debug.inc +++ b/inc/themes/classic/debug.inc @@ -8,9 +8,9 @@
  • SESSION:
  • -
  • MASTER PASS:
  • +
  • MASTER PASS:
  • CONFIG FILE: -
    +
  • diff --git a/inc/themes/classic/editpass.inc b/inc/themes/classic/editpass.inc index f2580b30..e21794d6 100644 --- a/inc/themes/classic/editpass.inc +++ b/inc/themes/classic/editpass.inc @@ -1,4 +1,4 @@ -
    @@ -43,12 +43,12 @@ echo $title['class']; ?>">
    - +
    @@ -269,7 +269,7 @@ var historyId = $('#selHistory').val(); if(historyId > 0) { - sysPassUtil.Common.doAction(,, historyId); + sysPassUtil.Common.doAction(,, historyId); } }); @@ -282,7 +282,7 @@ -user_editName): ?> +user_editName): ?> user_editName): ?> @@ -311,15 +311,15 @@
    required) ? 'required' : ''; ?>>
    - type === \SP\CustomFields::TYPE_PASSWORD && !$showViewPass):?> + type === \SP\Mgmt\CustomFields::TYPE_PASSWORD && !$showViewPass):?> **** - type === \SP\CustomFields::TYPE_COLOR):?> + type === \SP\Mgmt\CustomFields::TYPE_COLOR):?> value; ?> @@ -414,7 +414,7 @@
    + value=""> @@ -423,13 +423,13 @@
    - - @@ -438,7 +438,7 @@ - + @@ -446,13 +446,13 @@ - - @@ -462,11 +462,11 @@ - - - diff --git a/inc/themes/material-blue/backup.inc b/inc/themes/material-blue/backup.inc index a3b197b7..d070371c 100644 --- a/inc/themes/material-blue/backup.inc +++ b/inc/themes/material-blue/backup.inc @@ -37,7 +37,7 @@ - + @@ -119,7 +119,7 @@ - + diff --git a/inc/themes/material-blue/categories.inc b/inc/themes/material-blue/categories.inc index 3d21ad99..5f3579c8 100644 --- a/inc/themes/material-blue/categories.inc +++ b/inc/themes/material-blue/categories.inc @@ -44,8 +44,8 @@
    required) ? 'required' : ''; ?>>
    diff --git a/inc/themes/material-blue/css/styles.min.css b/inc/themes/material-blue/css/styles.min.css index 9aabb2c6..731baa25 100644 --- a/inc/themes/material-blue/css/styles.min.css +++ b/inc/themes/material-blue/css/styles.min.css @@ -1 +1 @@ -*{font-family:Roboto-Regular,Verdana,Tahoma,sans-serif}html,body{margin:0;padding:0;text-align:left;background-color:#f5f5f5;color:#555;font-size:12px;font-weight:normal}table{font-size:11px;border-spacing:0}#tblTools,#tblAccion{border:1px solid #d9d9d9;background-color:#f9f9f9;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#rpp{width:40px}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}.altTxtError{color:#c00;font-weight:bold}.altTxtOk{color:green;font-weight:bold}.altTxtWarn{color:orange;font-weight:bold}.altTxtGreen{color:green}.altTxtRed{color:darkred}.altTxtBlue{color:#339;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}#wrap{height:auto !important;min-height:100%;min-width:1024px;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;min-height:650px;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 #session{width:35%;margin:0 auto;height:25px;background:url("../imgs/bg_session.png") repeat-x scroll left top #e9e9e9;color:#999;font-size:10px;text-align:right}#container #session img{width:24px;height:24px;margin-left:10px;margin-right:10px;vertical-align:middle}#container #session .imgLang{width:28px;height:auto;filter:alpha(opacity=40);-moz-opacity:.4;opacity:.4}#container #actionsBar{position:absolute;top:0;z-index:100;width:100%;text-align:center;padding:.5em 0}#container #actionsBar #actionsBar-logo img{display:none;position:absolute;top:.5em;left:1em;width:50px}#container #content{width:95%;min-height:500px;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 #searchbox{position:relative;left:10%;width:90%;height:5em;padding:5px;padding-left:15px}#content #tblTools{height:5em;padding:5px;padding-left:15px}#content #resBuscar{min-height:450px;margin-bottom:50px}#content #resBuscar img{vertical-align:middle}#content #pageNav{width:100%;margin-top:15px;height:1.5em;padding:5px 10px 5px 10px;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{float:left;width:50%;height:1.5em;line-height:1.5em}#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;border:1px solid #dfdfdf;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 #fileUpload{display:none}#content .data .account-permissions{float:left;margin-right:10px}#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 .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{width:100%;margin:0 auto}#content .data-header ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-header li{float:left;display:block;padding:.5em;font-weight:bold;letter-spacing:.2em;color:#fff}#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{margin:0}#content .data-header-minimal li{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:1.5em .5em;color:#696969;text-align:center;background-color:#fcfcfc;height:1em}#content .data-rows li.cell-nodata{padding:1em 0;height:2em;text-align:left}#content .data-rows li.cell-actions{float:right;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 #data-search{text-align:center}#content #data-search .account-label{width:310px;height:195px;text-align:left;margin:1em;padding:.5em;color:#696969;background-color:#fcfcfc;display:inline-block}#content #data-search .account-label .label-field{width:100%;height:2em}#content #data-search .account-label .field-name{float:left;width:80px;padding:.4em .2em;color:#b9b9b9}#content #data-search .account-label .field-text{float:left;width:215px;padding:.4em .2em}#content #data-search .account-label .header .field-name{color:white;font-weight:bold}#content #data-search .account-label .field-customer .field-name{display:none}#content #data-search .account-label .field-customer .field-text{width:304px}#content #data-search .account-label .field-url{height:2.5em}#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{width:100%;height:2em;padding:.5em 0;text-align:left}#content #data-search .account-actions{width:100%;height:2.5em;padding-top:5px;text-align:right;background-color:#f5f5f5;box-shadow:0 0 8px rgba(0,0,0,0.075) inset}#content .actions-optional{display:none}#content #data-search .account-spacer{width:100%;height:7.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 #tblTools div.chosen-container{margin:0 5px}#content #tblTools select{min-width:180px}#content #tblTools #toolsLeft{display:inline-block;text-align:left;width:90%}#content #tblTools #toolsRight{display:inline-block;text-align:right;width:8%}#content #tblTools #toolsRight input{margin-left:15px;text-align:center}#content #tblTools .custom-combobox{margin-left:25px}#content #tblTools #btnClear{opacity:.35;filter:alpha(opacity=35)}#content #tblTools #btnClear:hover{opacity:1;filter:alpha(opacity=100)}#content #tblTools #order{margin-top:.5em;padding:.3em;color:#696969}#content #tabs>div{min-height:475px}#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 15px 15px 15px}#fancyContainer h2{width:90%;font-size:18px;color:white;background-color:#607d8b;margin:0 0 20px 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}.fancydata .descField{min-width:100px;font-weight:bold}footer{position:fixed;bottom:0;z-index:100;width:100%;height:1.5em;margin:0 auto;padding:1em 0;background-color:#f5f5f5;color:#b9b9b9;font-size:13px;box-shadow:0 -8px 6px -6px #c9c9c9;-webkit-box-shadow:0 -8px 6px -6px #c9c9c9;-moz-box-shadow:0 -8px 6px -6px #c9c9c9}footer #project{float:right;text-align:right;padding-right:1em}footer #updates{display:inline-block;padding-left:20px;cursor:pointer}footer #updates div{display:inline-block;margin:0 .5em}footer #status{float:right;text-align:right;color:#b94a48;padding:0 1em}footer #status .status-info{padding:.5em}footer #session{float:left;width:50em;text-align:left;padding:.2em 1em;color:#999;font-size:10px}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:10px !important;-moz-border-radius:10px !important;-webkit-border-radius:10px !important}.round5{border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}.midround{border-radius:0 0 15px 15px !important;-moz-border-radius:0 0 15px 15px !important;-webkit-border-radius:0 0 15px 15px !important}.midroundup{border-radius:15px 15px 0 0 !important;-moz-border-radius:15px 15px 0 0 !important;-webkit-border-radius:15px 15px 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{border:1px solid #d9d9d9;padding:5px;margin:5px 0;width:30em}.shadow{box-shadow:3px 3px 6px -3px #d9d9d9;-webkit-box-shadow:3px 3px 6px -3px #a9a9a9;-moz-box-shadow:3px 3px 6px -3px #a9a9a9}.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:30px;text-align:center}.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{float:right;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}#boxLogin{width:500px;min-height:150px;margin:0 auto;padding:3em;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{position:relative;top:4em;left:10em;display:inline-block;width:250px;height:100%;min-height:100px;text-align:left;margin-left:auto;margin-right:auto;background-color:transparent}#boxLogin #boxButton{position:relative;left:10em;width:130px;display:inline-block;text-align:right;margin:0 auto;padding:6em 0 0 0}#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 all and (max-width:1024px){#container #actionsBar{text-align:right}#container #content{width:95%;min-height:500px;margin:15em auto 5em auto}#content .data{width:95%;padding:10px;margin:auto}#content #tabs .ui-tabs-nav{left:0;width:100%}.action{max-width:95%;height:4em;margin:.7em auto}} \ No newline at end of file +*{font-family:Roboto-Regular,Verdana,Tahoma,sans-serif}html,body{margin:0;padding:0;text-align:left;background-color:#f5f5f5;color:#555;font-size:12px;font-weight:normal}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#rpp{width:40px}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}.altTxtError{color:#c00;font-weight:bold}.altTxtOk{color:green;font-weight:bold}.altTxtWarn{color:orange;font-weight:bold}.altTxtGreen{color:green}.altTxtRed{color:darkred}.altTxtBlue{color:#339;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}#wrap{height:auto !important;min-height:100%;min-width:1024px;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;min-height:650px;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 #session{width:35%;margin:0 auto;height:25px;background:url("../imgs/bg_session.png") repeat-x scroll left top #e9e9e9;color:#999;font-size:10px;text-align:right}#container #session img{width:24px;height:24px;margin-left:10px;margin-right:10px;vertical-align:middle}#container #session .imgLang{width:28px;height:auto;filter:alpha(opacity=40);-moz-opacity:.4;opacity:.4}#container #actionsBar{position:absolute;top:0;z-index:100;width:100%;text-align:center;padding:.5em 0}#container #actionsBar #actionsBar-logo img{display:none;position:absolute;top:.5em;left:1em;width:50px}#container #content{width:95%;min-height:500px;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 #searchbox{position:relative;left:8%;width:91%;height:5em;padding:5px 15px}#content #resBuscar{min-height:450px;margin-bottom:50px}#content #resBuscar img{vertical-align:middle}#content #pageNav{width:100%;margin-top:15px;height:1.5em;padding:5px 10px 5px 10px;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{float:left;width:50%;height:1.5em;line-height:1.5em}#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;border:1px solid #dfdfdf;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 #fileUpload{display:none}#content .data .account-permissions{float:left;margin-right:10px}#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 .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{width:100%;margin:0 auto}#content .data-header ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-header li{float:left;display:block;padding:.5em;font-weight:bold;letter-spacing:.2em;color:#fff}#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{margin:0}#content .data-header-minimal li{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:1.5em .5em;color:#696969;text-align:center;background-color:#fcfcfc;height:1em}#content .data-rows li.cell-nodata{padding:1em 0;height:2em;text-align:left}#content .data-rows li.cell-actions{float:right;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 #data-search{text-align:center}#content #data-search .account-label{width:310px;height:195px;text-align:left;margin:1em;padding:.5em;color:#696969;background-color:#fcfcfc;display:inline-block}#content #data-search .account-label .label-field{width:100%;height:2em}#content #data-search .account-label .field-name{float:left;width:80px;padding:.4em .2em;color:#b9b9b9}#content #data-search .account-label .field-text{float:left;width:215px;padding:.4em .2em}#content #data-search .account-label .header .field-name{color:white;font-weight:bold}#content #data-search .account-label .field-customer .field-name{display:none}#content #data-search .account-label .field-customer .field-text{width:304px}#content #data-search .account-label .field-url{height:2.5em}#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{width:100%;height:2em;padding:.5em 0;text-align:left}#content #data-search .account-actions{width:100%;height:2.5em;padding-top:5px;text-align:right;background-color:#f5f5f5;box-shadow:0 0 8px rgba(0,0,0,0.075) inset}#content .actions-optional{display:none}#content #data-search .account-spacer{width:100%;height:7.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 div.chosen-container{margin:0 5px}#content #searchbox select{min-width:180px}#content #searchbox #toolsLeft{display:inline-block;text-align:left;width:90%}#content #searchbox #toolsRight{display:inline-block;text-align:right;width:8%}#content #searchbox #toolsRight input{margin-left:15px;text-align:center}#content #searchbox .custom-combobox{margin-left:25px}#content #searchbox #btnClear{opacity:.35;filter:alpha(opacity=35)}#content #searchbox #btnClear:hover{opacity:1;filter:alpha(opacity=100)}#content #searchbox #order{margin-top:.5em;padding:.3em;color:#696969}#content #tabs>div{min-height:475px}#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 15px 15px 15px}#fancyContainer h2{width:90%;font-size:18px;color:white;background-color:#607d8b;margin:0 0 20px 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}.fancydata .descField{min-width:100px;font-weight:bold}footer{position:fixed;bottom:0;z-index:100;width:100%;height:1.5em;margin:0 auto;padding:1em 0;background-color:#f5f5f5;color:#b9b9b9;font-size:13px;box-shadow:0 -8px 6px -6px #c9c9c9;-webkit-box-shadow:0 -8px 6px -6px #c9c9c9;-moz-box-shadow:0 -8px 6px -6px #c9c9c9}footer #project{float:right;text-align:right;padding-right:1em}footer #updates{display:inline-block;padding-left:20px;cursor:pointer}footer #updates div{display:inline-block;margin:0 .5em}footer #status{float:right;text-align:right;color:#b94a48;padding:0 1em}footer #status .status-info{padding:.5em}footer #session{float:left;width:50em;text-align:left;padding:.2em 1em;color:#999;font-size:10px}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:10px !important;-moz-border-radius:10px !important;-webkit-border-radius:10px !important}.round5{border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}.midround{border-radius:0 0 15px 15px !important;-moz-border-radius:0 0 15px 15px !important;-webkit-border-radius:0 0 15px 15px !important}.midroundup{border-radius:15px 15px 0 0 !important;-moz-border-radius:15px 15px 0 0 !important;-webkit-border-radius:15px 15px 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{border:1px solid #d9d9d9;padding:5px;margin:5px 0;width:30em}.shadow{box-shadow:3px 3px 6px -3px #d9d9d9;-webkit-box-shadow:3px 3px 6px -3px #a9a9a9;-moz-box-shadow:3px 3px 6px -3px #a9a9a9}.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:30px;text-align:center}.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{float:right;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}#boxLogin{width:500px;min-height:150px;margin:0 auto;padding:3em;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{position:relative;top:4em;left:10em;display:inline-block;width:250px;height:100%;min-height:100px;text-align:left;margin-left:auto;margin-right:auto;background-color:transparent}#boxLogin #boxButton{position:relative;left:10em;width:130px;display:inline-block;text-align:right;margin:0 auto;padding:6em 0 0 0}#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 all and (max-width:1024px){#container #actionsBar{text-align:right}#container #content{width:95%;min-height:500px;margin:15em auto 5em auto}#content .data{width:95%;padding:10px;margin:auto}#content #tabs .ui-tabs-nav{left:0;width:100%}.action{max-width:95%;height:4em;margin:.7em auto}} \ No newline at end of file diff --git a/inc/themes/material-blue/customers.inc b/inc/themes/material-blue/customers.inc index 1bb6dd2b..a522211d 100644 --- a/inc/themes/material-blue/customers.inc +++ b/inc/themes/material-blue/customers.inc @@ -45,8 +45,8 @@
    required) ? 'required' : ''; ?>>
    diff --git a/inc/themes/material-blue/debug.inc b/inc/themes/material-blue/debug.inc index 16e4b390..2f9a6561 100644 --- a/inc/themes/material-blue/debug.inc +++ b/inc/themes/material-blue/debug.inc @@ -8,9 +8,9 @@
  • SESSION:
  • -
  • MASTER PASS:
  • +
  • MASTER PASS:
  • CONFIG FILE: -
    +
  • diff --git a/inc/themes/material-blue/editpass.inc b/inc/themes/material-blue/editpass.inc index dc26d38b..7f2f8952 100644 --- a/inc/themes/material-blue/editpass.inc +++ b/inc/themes/material-blue/editpass.inc @@ -51,7 +51,7 @@
    diff --git a/inc/themes/material-blue/encryption.inc b/inc/themes/material-blue/encryption.inc index c299429b..1a893de9 100644 --- a/inc/themes/material-blue/encryption.inc +++ b/inc/themes/material-blue/encryption.inc @@ -95,7 +95,7 @@ + value=""/> @@ -168,7 +168,7 @@ + value=""/> diff --git a/inc/themes/material-blue/error.inc b/inc/themes/material-blue/error.inc index 7c775bea..945974ae 100644 --- a/inc/themes/material-blue/error.inc +++ b/inc/themes/material-blue/error.inc @@ -8,7 +8,7 @@