aboutsummaryrefslogtreecommitdiffstats
path: root/core/application.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2017-10-23 15:36:46 +0200
committerThomas Lange <code@nerdmind.de>2017-10-23 15:36:46 +0200
commit08a9f943563291ac66c9ea253bdb0edc9bcdcce1 (patch)
tree575fdf8c417d85f5a58f250203b1a42ce1ef7127 /core/application.php
parentb22b2cc4bdbafeb4a955753e2d92fbc706c79407 (diff)
downloadblog-08a9f943563291ac66c9ea253bdb0edc9bcdcce1.tar.gz
blog-08a9f943563291ac66c9ea253bdb0edc9bcdcce1.tar.xz
blog-08a9f943563291ac66c9ea253bdb0edc9bcdcce1.zip
An overwrite mechanism for the application's configuration has been implemented. This makes the configuration.php much cleaner and you only have to define configuration values if the default values doesn't satisfy you. In addition, it makes it easier to implement new configuration values to the core without the need, that the users have to update their personal configuration.php files manually.
Diffstat (limited to 'core/application.php')
-rw-r--r--core/application.php59
1 files changed, 57 insertions, 2 deletions
diff --git a/core/application.php b/core/application.php
index a575f9d..c5a73a8 100644
--- a/core/application.php
+++ b/core/application.php
@@ -3,7 +3,8 @@
# Application initialization [Thomas Lange <code@nerdmind.de>] #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
# #
-# This file brings the application up! #
+# This file brings the application up and defines default configuration values #
+# for the application which can be overwritten in configuration.php. #
# #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
@@ -33,7 +34,61 @@ set_exception_handler(function(Throwable $Exception) {
HTTP::init($_GET, $_POST, $_FILES, TRUE);
#===============================================================================
-# Include configuration
+# Default configuration (can be overwritten in configuration.php)
+#===============================================================================
+$configuration = [
+ 'CORE.LANGUAGE' => 'en',
+ 'CORE.SEND_304' => FALSE,
+ 'BLOGMETA.NAME' => 'Example blog',
+ 'BLOGMETA.HOME' => 'This is an example blog.',
+ 'BLOGMETA.MAIL' => 'mail@example.org',
+ 'BLOGMETA.LANG' => 'en',
+ 'DATABASE.HOSTNAME' => 'localhost',
+ 'DATABASE.BASENAME' => 'blog',
+ 'DATABASE.USERNAME' => 'blog',
+ 'DATABASE.PASSWORD' => '',
+ 'TEMPLATE.NAME' => 'standard',
+ 'TEMPLATE.LANG' => 'en',
+ 'ADMIN.TEMPLATE' => 'admin',
+ 'ADMIN.LANGUAGE' => 'en',
+ 'PATHINFO.PROT' => $_SERVER['REQUEST_SCHEME'],
+ 'PATHINFO.HOST' => $_SERVER['HTTP_HOST'],
+ 'PATHINFO.BASE' => '',
+ 'PAGE.DIRECTORY' => 'page',
+ 'POST.DIRECTORY' => 'post',
+ 'USER.DIRECTORY' => 'user',
+ 'PAGE.SLUG_URLS' => TRUE,
+ 'POST.SLUG_URLS' => TRUE,
+ 'USER.SLUG_URLS' => TRUE,
+ 'PAGE.EMOTICONS' => TRUE,
+ 'POST.EMOTICONS' => TRUE,
+ 'USER.EMOTICONS' => TRUE,
+ 'PAGE.LIST_SIZE' => 10,
+ 'POST.LIST_SIZE' => 10,
+ 'USER.LIST_SIZE' => 10,
+ 'PAGE.FEED_SIZE' => 25,
+ 'POST.FEED_SIZE' => 25,
+ 'PAGE.DESCRIPTION_SIZE' => 200,
+ 'POST.DESCRIPTION_SIZE' => 200,
+ 'USER.DESCRIPTION_SIZE' => 200,
+ 'PAGE.LIST_SORT' => 'time_insert DESC',
+ 'POST.LIST_SORT' => 'time_insert DESC',
+ 'USER.LIST_SORT' => 'time_insert DESC',
+ 'PAGE.FEED_SORT' => 'time_insert DESC',
+ 'POST.FEED_SORT' => 'time_insert DESC',
+ 'PAGE.FEED_GUID' => ['id', 'time_insert'],
+ 'POST.FEED_GUID' => ['id', 'time_insert']
+];
+
+#===============================================================================
+# Set default configuration
+#===============================================================================
+foreach($configuration as $name => $value) {
+ Application::set($name, $value);
+}
+
+#===============================================================================
+# Include custom configuration
#===============================================================================
require 'configuration.php';