mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-01 12:48:08 +09:00
Minor bugfixes / deprecation cleanups (#2128)
* Minor bugfixes / deprecation cleanups * Making the tests happy
This commit is contained in:
1 parent
46eb6a1786
commit
ea0b7068b7
4 files changed
+13
-9
No files matched your search
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright 2022-2023 FOSSBilling
|
||||
* Copyright 2011-2021 BoxBilling, Inc.
|
||||
@@ -40,6 +41,7 @@ class Box_Url implements FOSSBilling\InjectionAwareInterface
|
||||
*/
|
||||
public function link($uri = null, $params = [])
|
||||
{
|
||||
$uri ??= '';
|
||||
$uri = trim($uri, '/');
|
||||
$link = $this->baseUri . $uri;
|
||||
if (!empty($params)) {
|
||||
@@ -51,6 +53,7 @@ class Box_Url implements FOSSBilling\InjectionAwareInterface
|
||||
|
||||
public function adminLink($uri, $params = [])
|
||||
{
|
||||
$uri ??= '';
|
||||
$uri = trim($uri, '/');
|
||||
$uri = ADMIN_PREFIX . '/' . $uri;
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ class SentryHelper
|
||||
/**
|
||||
* Tries to guess what type of webserver is being used and tags the Sentry event with it.
|
||||
*/
|
||||
private static function estimateWebServer(): string
|
||||
public static function estimateWebServer(): string
|
||||
{
|
||||
$serverSoftware = $_SERVER['SERVER_SOFTWARE'] ?? '';
|
||||
if (function_exists('apache_get_version') || (stripos(strtolower($serverSoftware), 'apache') !== false)) {
|
||||
|
||||
@@ -29,7 +29,7 @@ class Server_Account
|
||||
*
|
||||
* @return string returns the username as a string
|
||||
*/
|
||||
public function getUsername(): string
|
||||
public function getUsername(): ?string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
+8
-7
@@ -11,6 +11,7 @@
|
||||
|
||||
use FOSSBilling\Config;
|
||||
use FOSSBilling\Environment;
|
||||
use FOSSBilling\SentryHelper;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Whoops\Handler\PrettyPageHandler;
|
||||
use Whoops\Run;
|
||||
@@ -116,7 +117,8 @@ function checkSSL()
|
||||
$config = include PATH_CONFIG;
|
||||
if (isset($config['security']['force_https']) && $config['security']['force_https'] && !Environment::isCLI()) {
|
||||
if (!FOSSBilling\Tools::isHTTPS()) {
|
||||
$url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
$hostname = $_SERVER['HTTP_X_FORWARDED_HOST'] ?? $_SERVER['HTTP_HOST'] ?? '';
|
||||
$url = 'https://' . $hostname . $_SERVER['REQUEST_URI'];
|
||||
header('Location: ' . $url);
|
||||
exit;
|
||||
}
|
||||
@@ -131,9 +133,8 @@ function checkWebServer()
|
||||
$filesystem = new Filesystem();
|
||||
|
||||
// Check for missing required .htaccess on Apache and Apache-compatible web servers.
|
||||
$isApache = function_exists('apache_get_version') ? true : false;
|
||||
$serverSoftware = $_SERVER['SERVER_SOFTWARE'] ?? '';
|
||||
if ($isApache or (stripos($serverSoftware, 'apache') !== false) or stripos($serverSoftware, 'litespeed') !== false) {
|
||||
$webSever = SentryHelper::estimateWebServer();
|
||||
if ($webSever === 'Apache' || $webSever === 'Litespeed') {
|
||||
if (!$filesystem->exists('.htaccess')) {
|
||||
throw new Exception('Missing .htaccess file', 5);
|
||||
}
|
||||
@@ -232,9 +233,6 @@ checkRequirements();
|
||||
// Requirements met - load required packages/files.
|
||||
require PATH_VENDOR . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
|
||||
// Check web server and web server settings.
|
||||
checkWebServer();
|
||||
|
||||
// Check for legacy BoxBilling/FOSSBilling files.
|
||||
checkLegacyFiles();
|
||||
|
||||
@@ -269,6 +267,9 @@ checkInstaller();
|
||||
// Check if SSL required, and enforce if so.
|
||||
checkSSL();
|
||||
|
||||
// Check web server and web server settings.
|
||||
checkWebServer();
|
||||
|
||||
// Set error and exception handlers, and default logging settings.
|
||||
ini_set('log_errors', '1');
|
||||
ini_set('html_errors', false);
|
||||
|
||||
Reference in new issue
Block a user