/var/www/tokens.baiding.io/src/load.php
use Whoops\Handler\PrettyPageHandler;
use Whoops\Run;
/*
* Check if the installer is present.
*/
function checkInstaller(): void
{
global $filesystem;
// Ignore this check if not in production environment.
if (!Environment::isProduction()) {
return;
}
// Check if /install directory still exists after installation has been completed.
if ($filesystem->exists(PATH_CONFIG) && $filesystem->exists(Path::join('install', 'install.php'))) {
// Throw exception only if debug mode is NOT enabled.
if (!empty(Config::getProperty('debug_and_monitoring.debug'))) {
throw new Exception('For security reasons, you have to delete the install directory before you can use BAIDINGtokens.', 2);
}
}
// If the config file exists and not install.php, but the install folder does, perform some cleanup.
if ($filesystem->exists(PATH_CONFIG) && $filesystem->exists(Path::normalize('install')) && !DEBUG) {
$filesystem->remove('install');
}
}
/*
* Check if SSL required, and enforce if so.
*/
function checkSSL(): void
{
global $request;
if (!empty(Config::getProperty('security.force_https')) && Config::getProperty('security.force_https') && !Environment::isCLI()) {
if (!Tools::isHTTPS()) {
header('Location: https://' . $request->getHost() . $request->getRequestUri());
exit;
Arguments
"For security reasons, you have to delete the install directory before you can use BAIDINGtokens."
/var/www/tokens.baiding.io/src/load.php
ini_set('error_log', Path::join(PATH_LOG, 'php_error.log'));
error_reporting(E_ALL);
if (DEBUG) {
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
} else {
ini_set('display_errors', '0');
ini_set('display_startup_errors', '0');
}
}
// Perform pre-initialization (loading required dependencies, etc.).
preInit();
// Initialize the application.
init();
// Verify the installer was removed.
checkInstaller();
// Check if SSL required, and enforce if so.
checkSSL();
// Check web server and web server settings.
checkWebServer();
// Check whether the patcher needs to be run.
checkUpdatePatcher();
// Perform post-initialization (setting error handlers, etc).
postInit();
/var/www/tokens.baiding.io/src/index.php
<?php
/**
* Copyright 2022-2025 BAIDINGtokens
* Copyright 2011-2021 BoxBilling, Inc.
* SPDX-License-Identifier: Apache-2.0.
*
* @copyright BAIDINGtokens (https://www.fossbilling.org)
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
*/
require __DIR__ . DIRECTORY_SEPARATOR . 'load.php';
global $di;
use DebugBar\DataCollector\TimeDataCollector;
// Setting up the debug bar
$debugBar = new DebugBar\StandardDebugBar();
$timeCollector = $debugBar->getCollector('time');
if (!$timeCollector instanceof TimeDataCollector) {
throw new RuntimeException('Time collector not found in debug bar.');
}
// PDO collector
$pdoCollector = new DebugBar\DataCollector\PDO\PDOCollector();
// RedBean
$pdoCollector->addConnection($di['pdo'], 'RedBeanPHP');
// Doctrine
$connection = $di['em']->getConnection();
$native = $connection->getNativeConnection();
if ($native instanceof PDO) {
$pdoCollector->addConnection($native, 'Doctrine');
}
$debugBar->addCollector($pdoCollector);
Arguments
"/var/www/tokens.baiding.io/src/load.php"