. * */ define('APP_ROOT', '.'); require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; $userLogin = \SP\Request::analyze('u'); $userPass = \SP\Request::analyze('up'); $authToken = \SP\Request::analyze('t'); $actionId = \SP\Request::analyze('a', 0); if (!$userLogin || !$authToken || !$actionId){ \SP\Common::printJSON(_('Parámetros incorrectos')); } try { switch ($actionId) { case \SP\Controller\ActionsInterface::ACTION_ACC_VIEW: $itemId = \SP\Request::analyze('i', 0); $Api = new \SP\Api($userLogin, $actionId, $authToken); $out = $Api->getAccountData($itemId); break; case \SP\Controller\ActionsInterface::ACTION_ACC_VIEW_PASS: $itemId = \SP\Request::analyze('i', 0); $Api = new \SP\Api($userLogin, $actionId, $authToken, $userPass); $out = $Api->getAccountPassword($itemId); break; case \SP\Controller\ActionsInterface::ACTION_ACC_SEARCH: $search = \SP\Request::analyze('s'); $count = \SP\Request::analyze('c', 10); $Api = new \SP\Api($userLogin, $actionId, $authToken); $out = $Api->getAccountSearch($search, $count); break; default: throw new Exception(_('Acción Inválida')); } } catch (Exception $e) { \SP\Common::printJSON($e->getMessage(), 1, $actionId); } header('Content-type: application/json'); echo $out;