mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-30 20:27:07 +09:00
* Rename htaccess to be applied automatically
Rename the htaccess file, improve handling when .htaccess is missing, and remove from .gitignore so that rules are automatically applied on supported web servers.
* Clean up .gitignore file
* Update .htaccess to improve security
Update .htaccess file to improve general security, handle missing mod_rewrite, and to simplify the required rules.
* Improve HTTP and generic error handling
Improve handling of HTTP errors, and make the error handling code more generic to permit catching more errors.
* Remove outdated example web server config files
Remove the outdated and unmaintained example web server configuration files in favour of FOSSBilling/config-generator.
* Remove support for non-search engine friendly URLs
Remove support for non-search engine friendly URLs as these are depreciated.
* Revert "Remove support for non-search engine friendly URLs"
This reverts commit 724b1eb274.
* Update config migration backup handling
54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* FOSSBilling.
|
|
*
|
|
* @copyright FOSSBilling (https://www.fossbilling.org)
|
|
* @license Apache-2.0
|
|
*
|
|
* Copyright FOSSBilling 2022
|
|
* This software may contain code previously used in the BoxBilling project.
|
|
* Copyright BoxBilling, Inc 2011-2021
|
|
*
|
|
* This source file is subject to the Apache-2.0 License that is bundled
|
|
* with this source code in the file LICENSE.
|
|
*/
|
|
|
|
require_once __DIR__ . '/load.php';
|
|
$di = include __DIR__ . '/di.php';
|
|
|
|
$url = $di['request']->getQuery('_url') ?? '';
|
|
$http_err_code = $di['request']->getQuery('_errcode') ?? null;
|
|
|
|
$admin_prefix = $di['config']['admin_area_prefix'];
|
|
if (0 === strncasecmp($url, $admin_prefix, strlen($admin_prefix))) {
|
|
$appUrl = str_replace($admin_prefix, '', preg_replace('/\?.+/', '', $url));
|
|
$app = new Box_AppAdmin();
|
|
} else {
|
|
$appUrl = $url;
|
|
$app = new Box_AppClient();
|
|
}
|
|
|
|
$app->setUrl($appUrl);
|
|
$di['translate']();
|
|
$app->setDi($di);
|
|
|
|
// If HTTP error code has been passed, handle it.
|
|
if (!is_null($http_err_code)) {
|
|
switch ($http_err_code) {
|
|
case '404':
|
|
$e = new Box_Exception('Page :url not found', [':url' => $url], 404);
|
|
echo $app->show404($e);
|
|
break;
|
|
default:
|
|
http_response_code($http_err_code);
|
|
$e = new Box_Exception('HTTP Error :err_code occured attempting to load :url', [':err_code' => $http_err_code, ':url' => $url], $http_err_code);
|
|
echo $app->render('error', ['exception' => $e]);
|
|
}
|
|
exit;
|
|
}
|
|
|
|
// If no HTTP error passed, run the app.
|
|
echo $app->run();
|
|
exit;
|