-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
|
||
path: / | ||
domain: localhost | ||
secure: false | ||
httponly: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters