Skip to content

Commit

Permalink
Merge pull request #5444 from ChurchCRM/bug/slim-settings
Browse files Browse the repository at this point in the history
Fix SLIM displayErrorDetails setting
  • Loading branch information
DawoudIO authored Oct 17, 2020
2 parents a8e198d + b6c0e13 commit 8838522
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 25 deletions.
7 changes: 0 additions & 7 deletions src/Include/slim/settings.php

This file was deleted.

7 changes: 5 additions & 2 deletions src/api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@
// This file is generated by Composer
require_once dirname(__FILE__) . '/../vendor/autoload.php';

use ChurchCRM\dto\SystemConfig;
use ChurchCRM\Slim\Middleware\AuthMiddleware;
use ChurchCRM\Slim\Middleware\VersionMiddleware;
use Monolog\Logger;
use Slim\App;
use Slim\Container;
use Slim\HttpCache\CacheProvider;

// Instantiate the app
$settings = require __DIR__ . '/../Include/slim/settings.php';

$container = new Container;
$container['cache'] = function () {
return new CacheProvider();
};
if (SystemConfig::getValue("sLogLevel") == Logger::DEBUG) {
$container["settings"]['displayErrorDetails'] = true;
}

// Add middleware to the application
$app = new App($container);
Expand Down
8 changes: 6 additions & 2 deletions src/external/index.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
<?php

use ChurchCRM\dto\SystemConfig;
use Monolog\Logger;

require '../Include/Config.php';
//require '../Include/Functions.php';

// This file is generated by Composer
require_once dirname(__FILE__) . '/../vendor/autoload.php';

// Instantiate the app
//$settings = require __DIR__ . '/settings.php';
$app = new \Slim\App();
$container = $app->getContainer();
if (SystemConfig::getValue("sLogLevel") == Logger::DEBUG) {
$container["settings"]['displayErrorDetails'] = true;
}

// Set up
require __DIR__.'/dependencies.php';
require __DIR__ . '/../Include/slim/error-handler.php';
$settings = require __DIR__ . '/../Include/slim/settings.php';

// routes
require __DIR__ . '/routes/register.php';
Expand Down
10 changes: 5 additions & 5 deletions src/kiosk/index.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?php

require '../Include/Config.php';
//require '../Include/Functions.php';

// This file is generated by Composer
require_once dirname(__FILE__) . '/../vendor/autoload.php';

use ChurchCRM\dto\SystemConfig;
use \ChurchCRM\Utils\MiscUtils;
use Monolog\Logger;

// Instantiate the app
//$settings = require __DIR__ . '/settings.php';
$app = new \Slim\App();
$app = new App();
$container = $app->getContainer();
if (SystemConfig::getValue("sLogLevel") == Logger::DEBUG) {
$container["settings"]['displayErrorDetails'] = true;
}

// Set up
require __DIR__ . '/../Include/slim/error-handler.php';
$settings = require __DIR__ . '/../Include/slim/settings.php';

// routes
require __DIR__ . '/routes/kiosk.php';
Expand Down
12 changes: 7 additions & 5 deletions src/session/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
use Slim\Views\PhpRenderer;
use ChurchCRM\dto\SystemURLs;
use ChurchCRM\Slim\Middleware\VersionMiddleware;
use ChurchCRM\dto\SystemConfig;
use Monolog\Logger;

// Instantiate the app
$settings = require __DIR__.'/../Include/slim/settings.php';

$container = new Container;

if (SystemConfig::getValue("sLogLevel") == Logger::DEBUG) {
$container["settings"]['displayErrorDetails'] = true;
}
// Add middleware to the application
$app = new App($container);

Expand All @@ -45,7 +47,7 @@ function processTwoFactorGet(Request $request, Response $response, array $args)
'sRootPath' => SystemURLs::getRootPath(),
'user' => $curUser,
];

return $renderer->render($response, 'two-factor.php', $pageArgs);
}

Expand Down Expand Up @@ -79,7 +81,7 @@ function beginSession(Request $request, Response $response, array $args)
}

$renderer = new PhpRenderer('templates/');

$pageArgs['prefilledUserName'] = "";
# Defermine if approprirate to pre-fill the username field
if (isset($_GET['username'])) {
Expand Down
5 changes: 4 additions & 1 deletion src/setup/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use ChurchCRM\dto\SystemURLs;
use ChurchCRM\dto\SystemConfig;
use Monolog\Logger;

error_reporting(E_ALL);
ini_set('log_errors', 1);
Expand All @@ -18,9 +19,11 @@

$app = new \Slim\App();
$container = $app->getContainer();
if (SystemConfig::getValue("sLogLevel") == Logger::DEBUG) {
$container["settings"]['displayErrorDetails'] = true;
}

require __DIR__ . '/../Include/slim/error-handler.php';
$settings = require __DIR__ . '/../Include/slim/settings.php';

require __DIR__ . '/routes/setup.php';

Expand Down
8 changes: 5 additions & 3 deletions src/v2/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
use Slim\App;
use ChurchCRM\Slim\Middleware\VersionMiddleware;
use ChurchCRM\Slim\Middleware\AuthMiddleware;

// Instantiate the app
$settings = require __DIR__.'/../Include/slim/settings.php';
use ChurchCRM\dto\SystemConfig;
use Monolog\Logger;

$container = new Container;
if (SystemConfig::getValue("sLogLevel") == Logger::DEBUG) {
$container["settings"]['displayErrorDetails'] = true;
}

// Add middleware to the application
$app = new App($container);
Expand Down

0 comments on commit 8838522

Please sign in to comment.