* [MOD] Cleanup

This commit is contained in:
nuxsmin
2018-02-05 01:18:55 +01:00
parent d0f910c1f2
commit 8ce69f38bc
14 changed files with 14 additions and 541 deletions

View File

@@ -1,35 +0,0 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();

View File

@@ -1,39 +0,0 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();

View File

@@ -1,151 +0,0 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();

View File

@@ -1,35 +0,0 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();

View File

@@ -1,35 +0,0 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();

View File

@@ -1,35 +0,0 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();

View File

@@ -1,35 +0,0 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();

View File

@@ -1,35 +0,0 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();

View File

@@ -1,35 +0,0 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();

View File

@@ -1,36 +0,0 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();

View File

@@ -1,35 +0,0 @@
<?php
/**
* sysPass
*
* @author nuxsmin
* @link http://syspass.org
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();

24
api.php
View File

@@ -22,19 +22,17 @@
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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));
}
//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));
//}

View File

@@ -22,14 +22,5 @@
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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');

View File

@@ -22,17 +22,7 @@
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
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();
//}
require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php';