Format code using php-cs-fixer

This commit is contained in:
jo 2021-10-11 16:10:47 +02:00
parent 43d7dc92cd
commit d52c6184b9
352 changed files with 17473 additions and 17041 deletions

View file

@ -5,22 +5,27 @@
// but the default installation configs are likely to be installed by
// amature users on the setup that does not have https. Forcing
// cookie_secure on non https would result in confusing login problems.
if(!empty($_SERVER['HTTPS'])) {
if (!empty($_SERVER['HTTPS'])) {
ini_set('session.cookie_secure', '1');
}
ini_set('session.cookie_httponly', '1');
error_reporting(E_ALL|E_STRICT);
error_reporting(E_ALL | E_STRICT);
function exception_error_handler($errno, $errstr, $errfile, $errline) {
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
//Check if the statement that threw this error wanted its errors to be
//suppressed. If so then return without with throwing exception.
if (0 === error_reporting()) return;
if (0 === error_reporting()) {
return;
}
throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
return false;
}
set_error_handler("exception_error_handler");
set_error_handler('exception_error_handler');
// Define application environment
defined('APPLICATION_ENV')
@ -30,10 +35,10 @@ defined('VERBOSE_STACK_TRACE')
|| define('VERBOSE_STACK_TRACE', (getenv('VERBOSE_STACK_TRACE') ? getenv('VERBOSE_STACK_TRACE') : true));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
set_include_path(implode(PATH_SEPARATOR, [
get_include_path(),
realpath(LIB_PATH)
)));
realpath(LIB_PATH),
]));
set_include_path(APPLICATION_PATH . 'common' . PATH_SEPARATOR . get_include_path());
set_include_path(APPLICATION_PATH . 'common/enum' . PATH_SEPARATOR . get_include_path());
@ -65,12 +70,12 @@ require_once 'autoload.php';
/** Zend_Application */
$application = new Zend_Application(
APPLICATION_ENV,
CONFIG_PATH . 'application.ini',
true
APPLICATION_ENV,
CONFIG_PATH . 'application.ini',
true
);
require_once(APPLICATION_PATH . "logging/Logging.php");
require_once APPLICATION_PATH . 'logging/Logging.php';
Logging::setLogPath(LIBRETIME_LOG_DIR . '/zendphp.log');
Logging::setupParseErrorLogging();
@ -79,14 +84,15 @@ try {
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cli') {
set_include_path(APPLICATION_PATH . PATH_SEPARATOR . get_include_path());
require_once("Bootstrap.php");
require_once 'Bootstrap.php';
} else {
$application->bootstrap()->run();
}
} catch (Exception $e) {
if ($e->getCode() == 401)
{
if ($e->getCode() == 401) {
header($_SERVER['SERVER_PROTOCOL'] . ' 401 Unauthorized', true, 401);
return;
}
@ -95,14 +101,14 @@ try {
if (VERBOSE_STACK_TRACE) {
echo $e->getMessage();
echo "<pre>";
echo '<pre>';
echo $e->getTraceAsString();
echo "</pre>";
echo '</pre>';
Logging::error($e->getMessage());
Logging::error($e->getTraceAsString());
} else {
Logging::error($e->getTrace());
}
throw $e;
}