Skip to content

Commit

Permalink
FluxCP now only overwrites local php values for error reporting if De…
Browse files Browse the repository at this point in the history
…bugMode is enabled (#326)
  • Loading branch information
Akkarinage committed Oct 2, 2022
1 parent e7d866f commit 26eb80d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions index.php
Expand Up @@ -9,9 +9,6 @@
// Time started.
define('__START__', microtime(true));

error_reporting(E_ALL);
ini_set('display_errors', 1);

define('FLUX_ROOT', str_replace('\\', '/', dirname(__FILE__)));
define('FLUX_DATA_DIR', 'data');
define('FLUX_CONFIG_DIR', 'config');
Expand Down Expand Up @@ -103,24 +100,24 @@
mkdir($directory, 0777);
}
}

if (Flux::config('RequireOwnership') && function_exists('posix_getuid'))
$uid = posix_getuid();

$directories = array(
FLUX_DATA_DIR.'/logs' => 'log storage',
FLUX_DATA_DIR.'/itemshop' => 'item shop image',
FLUX_DATA_DIR.'/tmp' => 'temporary'
);

foreach ($directories as $directory => $directoryFunction) {
$directory = realpath($directory);
if (!is_writable($directory))
throw new Flux_PermissionError("The $directoryFunction directory '$directory' is not writable. Remedy with `chmod 0600 $directory`");
if (Flux::config('RequireOwnership') && function_exists('posix_getuid') && fileowner($directory) != $uid)
throw new Flux_PermissionError("The $directoryFunction directory '$directory' is not owned by the executing user. Remedy with `chown -R ".posix_geteuid().":".posix_geteuid()." $directory`");
}

if (ini_get('session.use_trans_sid'))
throw new Flux_Error("The 'session.use_trans_sid' php.ini configuration must be turned off for Flux to work.");

Expand Down Expand Up @@ -154,8 +151,9 @@
$accessConfig->set('unauthorized.index', AccountLevel::ANYONE);
$authComponent = Flux_Authorization::getInstance($accessConfig, Flux::$sessionData);

if (!Flux::config('DebugMode')) {
ini_set('display_errors', 0);
if (Flux::config('DebugMode')) {
error_reporting(E_ALL);
ini_set('display_errors', 1);
}

// Dispatch requests->modules->actions->views.
Expand Down

0 comments on commit 26eb80d

Please sign in to comment.