diff --git a/ajax/ajax_checkConnection.php b/ajax/ajax_checkConnection.php deleted file mode 100644 index c583f55c..00000000 --- a/ajax/ajax_checkConnection.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -use SP\Controller\ChecksController; -use SP\Http\Request; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('POST'); - -$Controller = new ChecksController(); -$Controller->doAction(); \ No newline at end of file diff --git a/ajax/ajax_eventlog.php b/ajax/ajax_eventlog.php deleted file mode 100644 index d394c3bb..00000000 --- a/ajax/ajax_eventlog.php +++ /dev/null @@ -1,39 +0,0 @@ -. - */ - -use SP\Controller\EventlogController; -use SP\Core\Init; -use SP\Http\Request; -use SP\Util\Util; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('GET'); - -$Controller = new EventlogController(); -$Controller->checkLoggedIn(); -$Controller->doAction(); -$Controller->view(); \ No newline at end of file diff --git a/ajax/ajax_getContent.php b/ajax/ajax_getContent.php deleted file mode 100644 index e8964156..00000000 --- a/ajax/ajax_getContent.php +++ /dev/null @@ -1,151 +0,0 @@ -. - */ - -use SP\Controller\AccountController; -use SP\Controller\AccountSearchController; -use SP\Controller\ConfigController; -use SP\Controller\EventlogController; -use SP\Controller\ItemListController; -use SP\Controller\NoticesController; -use SP\Controller\UserPreferencesController; -use SP\Core\Acl\ActionsInterface; -use SP\Core\SessionFactory; -use SP\Mvc\View\Template; -use SP\Http\Request; -use SP\Http\Response; -use SP\Util\Util; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('GET'); - -/** @var \SP\Storage\Database $db */ -$db = $dic->get(\SP\Storage\Database::class); -/** @var SessionFactory $session */ -$session = $dic->get(SessionFactory::class); -/** @var \SP\Core\UI\Theme $theme */ -$theme = $dic->get(\SP\Core\UI\Theme::class); - -if (!Util::isLoggedIn($session)) { - Util::logout(); -} - -Util::checkReload(); - -if (!Request::analyze('actionId', 0, true)) { - Response::printHtmlError(__('Parámetros incorrectos')); -} - -$actionId = Request::analyze('actionId', 0); -$itemId = Request::analyze('itemId', 0); - -$UserData = SessionFactory::getUserData(); - -$Tpl = new Template(); -$Tpl->assign('actionId', $actionId); -$Tpl->assign('id', $itemId); -$Tpl->assign('activeTabId', $itemId); -$Tpl->assign('queryTimeStart', microtime()); -$Tpl->assign('userId', $UserData->getId()); -$Tpl->assign('userGroupId', $UserData->getUserGroupId()); -$Tpl->assign('userIsAdminApp', $UserData->isIsAdminApp()); -$Tpl->assign('userIsAdminAcc', $UserData->isIsAdminAcc()); -$Tpl->assign('themeUri', $theme->getThemeUri()); - -switch ($actionId) { - case ActionsInterface::ACCOUNT_SEARCH: - $Controller = new AccountSearchController($Tpl); - $Controller->doAction(); - break; - case ActionsInterface::ACCOUNT_CREATE: - case ActionsInterface::ACCOUNT_COPY: - case ActionsInterface::ACCOUNT_EDIT: - case ActionsInterface::ACCOUNT_EDIT_PASS: - case ActionsInterface::ACCOUNT_VIEW: - case ActionsInterface::ACCOUNT_VIEW_HISTORY: - case ActionsInterface::ACCOUNT_DELETE: - case ActionsInterface::ACCOUNT_REQUEST: - $Controller = new AccountController($Tpl, $itemId); - $Controller->doAction($actionId); - break; - case ActionsInterface::ACCESS_MANAGE: - case ActionsInterface::USER: - case ActionsInterface::GROUP: - case ActionsInterface::PROFILE: - case ActionsInterface::APITOKEN: - case ActionsInterface::PUBLICLINK: - $Controller = new ItemListController($Tpl); - $Controller->doAction(ItemListController::TYPE_ACCESSES); - break; - case ActionsInterface::ITEMS_MANAGE: - case ActionsInterface::CATEGORY: - case ActionsInterface::CLIENT: - case ActionsInterface::CUSTOMFIELD: - case ActionsInterface::FILE: - case ActionsInterface::ACCOUNTMGR: - case ActionsInterface::TAG: - $Controller = new ItemListController($Tpl); - $Controller->doAction(ItemListController::TYPE_ACCOUNTS); - break; - case ActionsInterface::CONFIG: - case ActionsInterface::CONFIG_GENERAL: - case ActionsInterface::WIKI_CONFIG: - case ActionsInterface::LDAP_CONFIG: - case ActionsInterface::MAIL_CONFIG: - case ActionsInterface::ENCRYPTION_CONFIG: - case ActionsInterface::ENCRYPTION_TEMPPASS: - case ActionsInterface::BACKUP_CONFIG: - case ActionsInterface::EXPORT_CONFIG: - case ActionsInterface::IMPORT_CONFIG: - $Controller = new ConfigController($Tpl); - $Controller->doAction(); - break; - case ActionsInterface::EVENTLOG: - $Controller = new EventlogController($Tpl); - $Controller->doAction(); - break; - case ActionsInterface::PREFERENCE: - case ActionsInterface::PREFERENCE_GENERAL: - case ActionsInterface::PREFERENCE_SECURITY: - $Controller = new UserPreferencesController($Tpl); - $Controller->doAction(); - break; - case ActionsInterface::NOTICE: - case ActionsInterface::NOTICE_USER: - $Controller = new NoticesController($Tpl); - $Controller->doAction(); - break; -} - -/** @var \SP\Config\ConfigData $ConfigData */ -$ConfigData = $dic->get(\SP\Config\ConfigData::class); - -// Se comprueba si se debe de mostrar la vista de depuración -if ($UserData->isIsAdminApp() && $ConfigData->isDebug()) { - $Controller->getDebug(); -} - -$Controller->view(); \ No newline at end of file diff --git a/ajax/ajax_getItems.php b/ajax/ajax_getItems.php deleted file mode 100644 index 1d006bd5..00000000 --- a/ajax/ajax_getItems.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -use SP\Controller\ItemsController; -use SP\Http\Request; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('GET'); - -$Controller = new ItemsController(); -$Controller->doAction(); \ No newline at end of file diff --git a/ajax/ajax_itemSave.php b/ajax/ajax_itemSave.php deleted file mode 100644 index 7bbb8aaf..00000000 --- a/ajax/ajax_itemSave.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -use SP\Controller\ItemActionController; -use SP\Http\Request; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('POST'); - -$ItemAction = new ItemActionController(); -$ItemAction->doAction(); \ No newline at end of file diff --git a/ajax/ajax_itemSearch.php b/ajax/ajax_itemSearch.php deleted file mode 100644 index d308e9c9..00000000 --- a/ajax/ajax_itemSearch.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -use SP\Controller\ItemSearchController; -use SP\Http\Request; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('GET'); - -$ItemSearch = new ItemSearchController(); -$ItemSearch->doAction(); \ No newline at end of file diff --git a/ajax/ajax_itemShow.php b/ajax/ajax_itemShow.php deleted file mode 100644 index ec0da55a..00000000 --- a/ajax/ajax_itemShow.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -use SP\Controller\ItemShowController; -use SP\Http\Request; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('GET'); - -$ItemShow = new ItemShowController(); -$ItemShow->doAction(); \ No newline at end of file diff --git a/ajax/ajax_noticeSearch.php b/ajax/ajax_noticeSearch.php deleted file mode 100644 index 6f5bebff..00000000 --- a/ajax/ajax_noticeSearch.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -use SP\Controller\NoticesSearchController; -use SP\Http\Request; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('GET'); - -$NoticesSearch = new NoticesSearchController(); -$NoticesSearch->doAction(); \ No newline at end of file diff --git a/ajax/ajax_noticeShow.php b/ajax/ajax_noticeShow.php deleted file mode 100644 index f4974c94..00000000 --- a/ajax/ajax_noticeShow.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -use SP\Controller\NoticeShowController; -use SP\Http\Request; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('GET'); - -$NoticeShow = new NoticeShowController(); -$NoticeShow->doAction(); \ No newline at end of file diff --git a/ajax/ajax_upgrade.php b/ajax/ajax_upgrade.php deleted file mode 100644 index 43e15c09..00000000 --- a/ajax/ajax_upgrade.php +++ /dev/null @@ -1,36 +0,0 @@ -. - */ - -use SP\Controller\MainActionController; -use SP\Http\Request; - -define('APP_ROOT', dirname(__DIR__)); -define('IS_UPGRADE', 1); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('GET'); - -$Controller = new MainActionController(); -$Controller->doAction(); \ No newline at end of file diff --git a/ajax/ajax_wiki.php b/ajax/ajax_wiki.php deleted file mode 100644 index 5530c738..00000000 --- a/ajax/ajax_wiki.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -use SP\Controller\WikiController; -use SP\Http\Request; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('GET'); - -$Controller = new WikiController(); -$Controller->doAction(); \ No newline at end of file diff --git a/api.php b/api.php index 44455eaa..f04d3885 100644 --- a/api.php +++ b/api.php @@ -22,19 +22,17 @@ * along with sysPass. If not, see . */ -use SP\Api\ApiRequest; -use SP\Log\Log; - -define('APP_ROOT', '.'); +define('APP_ROOT', __DIR__); +define('APP_MODULE', 'api'); require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; -header('Content-type: application/json'); - -try { - $ApiRequest = new ApiRequest(); - exit($ApiRequest->runApi()); -} catch (Exception $e) { - Log::writeNewLog('API', $e->getMessage(), Log::ERROR); - exit($ApiRequest->formatJsonError($e)); -} \ No newline at end of file +//header('Content-type: application/json'); +// +//try { +// $ApiRequest = new ApiRequest(); +// exit($ApiRequest->runApi()); +//} catch (Exception $e) { +// Log::writeNewLog('API', $e->getMessage(), Log::ERROR); +// exit($ApiRequest->formatJsonError($e)); +//} \ No newline at end of file diff --git a/ajax/ajax_configSave.php b/app/modules/api/module.php similarity index 73% rename from ajax/ajax_configSave.php rename to app/modules/api/module.php index 5e73aaad..a91c7dd0 100644 --- a/ajax/ajax_configSave.php +++ b/app/modules/api/module.php @@ -22,14 +22,5 @@ * along with sysPass. If not, see . */ -use SP\Controller\ConfigActionController; -use SP\Http\Request; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('POST'); - -$Controller = new ConfigActionController(); -$Controller->doAction(); +define('MODULE_PATH', __DIR__); +define('PLUGINS_PATH', MODULE_PATH . DIRECTORY_SEPARATOR . 'plugins'); diff --git a/index.php b/index.php index 9cb1039b..961047df 100644 --- a/index.php +++ b/index.php @@ -22,17 +22,7 @@ * along with sysPass. If not, see . */ -use SP\Core\Init; -use SP\Core\SessionFactory; -use SP\Modules\Web\Controllers\MainController; - define('APP_ROOT', __DIR__); define('APP_MODULE', 'web'); -require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; - -//if (!Init::checkPostLoginActions() && Session::getAuthCompleted()) { -// $Controller = new MainController(); -// $Controller->getMain(); -// $Controller->view(); -//} \ No newline at end of file +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; \ No newline at end of file