Permalink
Browse files

Cleaned up config files and stopped tracking them in version control

  • Loading branch information...
ekinhbayar authored and PeeHaa committed Oct 14, 2017
1 parent 5e1fad0 commit b752cd06e0b4c91df00bfb59a4906908e79bd049
Showing with 55 additions and 53 deletions.
  1. +1 −1 .gitignore
  2. +12 −28 init.example.php → config.sample.php
  3. +42 −10 index.php
  4. +0 −14 init.deployment.php
@@ -1,3 +1,3 @@
/public/.htaccess
init.*.php
config.php
vendor
@@ -1,6 +1,6 @@
<?php
/**
* Example file for settin up the environment specific configuration
* Example file for setting up the environment specific configuration
*
* Note: you probably don't want to use the configuration in your project
* directly, but instead you want to:
@@ -16,33 +16,11 @@
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
*/
namespace OpCacheGUI;
use OpCacheGUI\I18n\FileTranslator;
use OpCacheGUI\Network\Router;
/**
* Setup error reporting
*/
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 0);
/**
* Setup timezone
*/
ini_set('date.timezone', 'Europe/Amsterdam');
/**
* Setup the translator
*/
$translator = new FileTranslator(__DIR__ . '/texts', 'en');
/**
* Setup URI scheme (url rewrites [Router::URL_REWRITE] / query strings [Router::QUERY_STRING])
*/
$uriScheme = Router::URL_REWRITE;
/**
* Login credentials
*
@@ -60,10 +38,16 @@
*
* Multiple addresses or ranges can be defined
*/
$login = [
'username' => 'peehaa',
'password' => '$2y$14$kHoRlbxPF7Bf1903cDMTgeYBsFgF8aJA46LIH9Nsg4/ocDa9HTTbe',
'whitelist' => [
return [
'username' => 'peehaa',
'password' => '$2y$14$kHoRlbxPF7Bf1903cDMTgeYBsFgF8aJA46LIH9Nsg4/ocDa9HTTbe',
'whitelist' => [
'localhost',
],
'language' => 'en',
'timezone' => 'Europe/Amsterdam',
'error_reporting' => E_ALL,
'display_errors' => 'Off',
'log_errors' => 'On',
'uri_scheme' => Router::URL_REWRITE
];
@@ -9,18 +9,19 @@
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
*/
use OpCacheGUI\Format\Byte as ByteFormatter;
use OpCacheGUI\Storage\Session;
use OpCacheGUI\Auth\Ip;
use OpCacheGUI\Auth\User;
use OpCacheGUI\Security\Generator\Factory;
use OpCacheGUI\Security\CsrfToken;
use OpCacheGUI\Auth\User;
use OpCacheGUI\Storage\Session;
use OpCacheGUI\Network\Request;
use OpCacheGUI\Network\Router;
use OpCacheGUI\Network\RouteFactory;
use OpCacheGUI\Presentation\Url;
use OpCacheGUI\Presentation\Html;
use OpCacheGUI\Presentation\Json;
use OpCacheGUI\Network\Router;
use OpCacheGUI\Network\RouteFactory;
use OpCacheGUI\I18n\FileTranslator;
use OpCacheGUI\Format\Byte as ByteFormatter;
/**
* Bootstrap the library
@@ -30,7 +31,29 @@
/**
* Setup the environment
*/
require_once __DIR__ . '/init.deployment.php';
$configuration = require_once __DIR__ . '/config.php';
/**
* Setup error reporting
*/
error_reporting($configuration['error_reporting']);
ini_set('display_errors', $configuration['display_errors']);
ini_set('log_errors', $configuration['display_errors']);
/**
* Setup timezone
*/
ini_set('date.timezone', $configuration['timezone']);
/**
* Setup the translator
*/
$translator = new FileTranslator(__DIR__ . '/texts', $configuration['language']);
/**
* Setup URI scheme (url rewrites [Router::URL_REWRITE] / query strings [Router::QUERY_STRING])
*/
$uriScheme = $configuration['uri_scheme'];
/**
* Start the session
@@ -59,12 +82,12 @@
new \OpCacheGUI\Network\Ip\Range(),
new \OpCacheGUI\Network\Ip\Cidr(),
]);
$whitelist->buildWhitelist($login['whitelist']);
$whitelist->buildWhitelist($configuration['whitelist']);
/**
* Setup the authentication object
*/
$user = new User($sessionStorage, $login['username'], $login['password'], $whitelist);
$user = new User($sessionStorage, $configuration['username'], $configuration['password'], $whitelist);
/**
* Setup URL renderer
@@ -101,12 +124,21 @@
* Load the routes
*/
if (!extension_loaded('Zend OPcache') || opcache_get_status() === false) {
if (!in_array($router->getIdentifier(), ['error', 'mainjs', 'maincss', 'fontawesome-webfont_eot', 'fontawesome-webfont_woff', 'fontawesome-webfont_ttf', 'fontawesome-webfont_svg'], true)) {
if (!in_array($router->getIdentifier(), [
'error',
'mainjs',
'maincss',
'fontawesome-webfont_eot',
'fontawesome-webfont_woff',
'fontawesome-webfont_ttf',
'fontawesome-webfont_svg'
], true)
) {
header('Location: ' . $urlRenderer->get('error'));
exit;
}
$router->get('error', function() use ($htmlTemplate) {
$router->get('error', function () use ($htmlTemplate) {
return $htmlTemplate->render('error.phtml', [
'login' => true,
'title' => 'Error',

This file was deleted.

Oops, something went wrong.

0 comments on commit b752cd0

Please sign in to comment.