Skip to content

Commit

Permalink
Merge 768bac0 into 5f85c18
Browse files Browse the repository at this point in the history
  • Loading branch information
Nenglish7 committed Feb 7, 2018
2 parents 5f85c18 + 768bac0 commit b333331
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
5 changes: 4 additions & 1 deletion config/cookie.conf.yml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@

path: /
domain: localhost
secure: false
httponly: true
53 changes: 53 additions & 0 deletions load.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
/**
* This file is a part of secure-php-login-system.
*
* @author Akbar Hashmi (Owner/Developer) <me@akbarhashmi.com>.
* @author Nicholas English (Contributor/Developer) <nenglish0820@outlook.com>.
*
* @link <https://github.com/akbarhashmi/Secure-PHP-Login-System> Github repository.
* @license <https://github.com/akbarhashmi/Secure-PHP-Login-System/blob/master/LICENSE> MIT license.
*/

use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Yaml\Exception\ParseException;

// List the configuration files.
$configFiles = [
'cookie.conf.yml',
'login.conf.yml',
'oauth.conf.yml',
'other.conf.yml',
'register.conf.yml',
'security.conf.yml',
'session.conf.yml'
];

// Temp variable.
$configuration = [];

// Load the configuration.
foreach ($configFiles as $configFile)
{
try
{
$contents = Yaml::parseFile(SYSTEM_ROOT . "/config/{$configFile}");

// Get the config array key.
$file_data = explode('.', $configFile);
reset($file_data);

// Inject the config in the config array.
$configuration[$file_data[0]] = $contents;
} catch (ParseException $e)
{
printf('Unable to parse the YAML string: %s', $e->getMessage());
}
}

// Check the configuration contents.
if (empty($configuration))
{
trigger_error('No configuration was loaded.');
}
4 changes: 3 additions & 1 deletion server.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
* @link <https://github.com/akbarhashmi/Secure-PHP-Login-System> Github repository.
* @license <https://github.com/akbarhashmi/Secure-PHP-Login-System/blob/master/LICENSE> MIT license.
*/

define('SYSTEM_ROOT', __DIR__);

// Check composer.
if (!file_exists(SYSTEM_ROOT . '/vendor/autoload.php')) {
trigger_error('You need to run composer install or else the system will not run.', E_USER_ERROR);
}

// Load the Engine\App configuration.
require_once SYSTEM_ROOT . '/load.php';

// Start pimple.
$container = new Pimple\Container();

Expand Down

0 comments on commit b333331

Please sign in to comment.