Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bakeiro committed Oct 25, 2020
1 parent c760229 commit e7d7806
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 48 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
/.idea/*
/.vscode/*

# Config
/system/config/config.php
/system/config/ini.php

# Libraries
/system/composer/vendor/*
/src/view/www/node_modules/*
Expand Down
5 changes: 4 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
require SYSTEM . "engine/Router.php";
require SYSTEM . "engine/Controller.php";
require SYSTEM . "engine/SessionSecureHandler.php";
require SYSTEM . "engine/Errors.php";
require SYSTEM . "engine/Log.php";
require SYSTEM . "engine/AutoLoader.php";

// AutoLoader
Expand All @@ -25,6 +25,9 @@
$loader->addNamespace('Services', DIR_ROOT.'/system/services');
$loader->addNamespace('Engine', DIR_ROOT.'/system/engine');

// Define environment
putenv("ENVIRONMENT=DEVELOPMENT");

// Bootstrap
require SYSTEM . "config/ini.php";
require SYSTEM . "startup.php";
Expand Down
1 change: 0 additions & 1 deletion src/view/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "light-php",
"version": "1.0.0",
"description": "",
"main": ".eslintrc.js",
"scripts": {
"lint": "eslint \"src/**/*.js\" "
},
Expand Down
33 changes: 0 additions & 33 deletions system/config/_config.php

This file was deleted.

55 changes: 55 additions & 0 deletions system/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

/**
* Config array, used for specify the Services properties, and allows you to have different environments configuration
*
* Database credentials
* Session variables
* Email credentials
* TimeZone
* Debug console (for outputting php errors and debug messages)
* Cache number (in case you update the browser resources)
*/

return [
"development" => [
"database_host" => "",
"database_user" => "",
"database_pass" => "",
"dabatase_name" => "",
"session_name" => "session",
"session_encrypt_method" => "aes-256-cbc",
"session_iv" => "ThisIsMySecretIv", // Generated automatically in the install process
"session_key" => "ThisIsMySecretPass", // Generated automatically in the install process
"email_host" => "",
"email_name" => "",
"email_pass" => "",
"email_port" => "",
"email_from" => "",
"system_default_time_zone" => "Europe/Madrid",
"system_debug_console" => true,
"system_execution_time" => microtime(true),
"system_cache_version" => 0001, // Refresh frontend cache
"system_allow_forms_without_csrf" => false
],
"production" => [
"database_host" => "",
"database_user" => "",
"database_pass" => "",
"dabatase_name" => "",
"session_name" => "session",
"session_encrypt_method" => "aes-256-cbc",
"session_iv" => "ThisIsMySecretIv", // Generated automatically in the install process
"session_key" => "ThisIsMySecretPass", // Generated automatically in the install process
"email_host" => "",
"email_name" => "",
"email_pass" => "",
"email_port" => "",
"email_from" => "",
"system_default_time_zone" => "Europe/Madrid",
"system_debug_console" => true,
"system_execution_time" => microtime(true),
"system_cache_version" => 0001, // Refresh frontend cache
"system_allow_forms_without_csrf" => false
]
];
File renamed without changes.
10 changes: 5 additions & 5 deletions system/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Array key => url
* Array value => folder/class/method (index method if none specified)
*/

$routes = array();
$routes["/"] = "index/index/index";
$routes["/welcome"] = "index/index/index";
$routes["/sample"] = "index/index/samplePage";
return [
"/" => "index/index/index",
"/welcome" => "index/index/index",
"/sample" => "index/index/samplePage"
];
6 changes: 3 additions & 3 deletions system/services/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Error handling class, define callbacks to execute when warnings, errors, exceptions and unknown errors happen
*/
class Errors extends Singleton
class Log extends Singleton
{
public $error_handle;

Expand All @@ -17,15 +17,15 @@ class Errors extends Singleton
private $unknown_errors_log_path;

/**
*
*
*/
public function __construct($error_log_path, $notice_log_path, $warning_log_path, $unknown_errors_log_path) {
$this->error_log_path = $error_log_path;
$this->notice_log_path = $notice_log_path;
$this->warning_log_path = $warning_log_path;
$this->unknown_errors_log_path = $unknown_errors_log_path;
}

/**
* Error handler, parses the error, and wether it's a warning, exception, notice or something else, executes the
* correct callback
Expand Down
2 changes: 1 addition & 1 deletion system/startup.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
date_default_timezone_set(Config::get("default_time_zone"));

// Error/Warning/Notice handler
$error_class = new Errors();
$error_class = new Log();
set_error_handler(array($error_class,"myErrorHandler"), E_ALL);
error_reporting(E_ALL);

Expand Down

0 comments on commit e7d7806

Please sign in to comment.