Files
sysPass/app/modules/web/Controllers/BootstrapController.php
nuxsmin cd2c0379db * [MOD] Improved plugins manager
* [MOD] Code refactoring and cleanup
* [MOD] Make classes final for performance improvements and avoid some side behaviours
2018-07-28 21:45:49 +02:00

74 lines
2.6 KiB
PHP

<?php
/**
* sysPass
*
* @author nuxsmin
* @link https://syspass.org
* @copyright 2012-2018, 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/>.
*/
namespace SP\Modules\Web\Controllers;
use phpseclib\Crypt\RSA;
use SP\Bootstrap;
use SP\Core\Crypt\CryptPKI;
use SP\Http\Cookies;
use SP\Http\Response;
use SP\Providers\Auth\Browser\Browser;
/**
* Class BootstrapController
*
* @package SP\Modules\Web\Controllers
*/
final class BootstrapController extends SimpleControllerBase
{
/**
* Returns environment data
*
* @throws \SP\Core\Exceptions\FileNotFoundException
* @throws \SP\Core\Exceptions\SPException
*/
public function getEnvironmentAction()
{
$configData = $this->config->getConfigData();
$checkStatus = $this->session->getAuthCompleted() && ($this->session->getUserData()->getIsAdminApp() || $configData->isDemoEnabled());
$data = [
'lang' => require CONFIG_PATH . DIRECTORY_SEPARATOR . 'strings.js.inc',
'locale' => $configData->getSiteLang(),
'app_root' => Bootstrap::$WEBURI,
'max_file_size' => $configData->getFilesAllowedSize(),
'check_updates' => $checkStatus && $configData->isCheckUpdates(),
'check_notices' => $checkStatus && $configData->isChecknotices(),
'timezone' => date_default_timezone_get(),
'debug' => DEBUG || $configData->isDebug(),
'cookies_enabled' => Cookies::checkCookies(),
// 'plugins' => PluginUtil::getEnabledPlugins(),
'plugins' => [],
'loggedin' => $this->session->isLoggedIn(),
'authbasic_autologin' => Browser::getServerAuthUser() && $configData->isAuthBasicAutoLoginEnabled(),
'pk' => $this->session->getPublicKey() ?: (new CryptPKI($this->dic->get(RSA::class)))->getPublicKey(),
'import_allowed_exts' => ['CSV', 'XML'],
'files_allowed_exts' => $configData->getFilesAllowedExts()
];
Response::printJson($data, 0);
}
}