summaryrefslogtreecommitdiff
path: root/inc/functions.php
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2015-02-27 21:16:03 +0100
committerczaks <marcin@6irc.net>2015-02-27 21:16:03 +0100
commitbffe03e65171a4ba7da40573d9f0131b58e9cb48 (patch)
tree7804c906902527a5251110d3509df9b94ba34047 /inc/functions.php
parenta93f168c79a0c8137a6d9032d42e598469b4b072 (diff)
rearrange config processing a bit
Diffstat (limited to 'inc/functions.php')
-rwxr-xr-xinc/functions.php28
1 files changed, 16 insertions, 12 deletions
diff --git a/inc/functions.php b/inc/functions.php
index ef071592..25362a62 100755
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -124,10 +124,6 @@ function loadConfig() {
init_locale($config['locale'], $error);
}
- if (!isset($__version))
- $__version = file_exists('.installed') ? trim(file_get_contents('.installed')) : false;
- $config['version'] = $__version;
-
date_default_timezone_set($config['timezone']);
if (!isset($config['global_message']))
@@ -136,6 +132,7 @@ function loadConfig() {
if (!isset($config['post_url']))
$config['post_url'] = $config['root'] . $config['file_post'];
+
if (!isset($config['referer_match']))
if (isset($_SERVER['HTTP_HOST'])) {
$config['referer_match'] = '/^' .
@@ -206,10 +203,24 @@ function loadConfig() {
if (!isset($config['user_flags']))
$config['user_flags'] = array();
+ // Effectful config processing below:
+
if ($config['root_file']) {
chdir($config['root_file']);
}
+ // Keep the original address to properly comply with other board configurations
+ if (!isset($__ip))
+ $__ip = $_SERVER['REMOTE_ADDR'];
+
+ // ::ffff:0.0.0.0
+ if (preg_match('/^\:\:(ffff\:)?(\d+\.\d+\.\d+\.\d+)$/', $__ip, $m))
+ $_SERVER['REMOTE_ADDR'] = $m[2];
+
+ if (!isset($__version))
+ $__version = file_exists('.installed') ? trim(file_get_contents('.installed')) : false;
+ $config['version'] = $__version;
+
if ($config['verbose_errors']) {
set_error_handler('verbose_error_handler');
error_reporting(E_ALL);
@@ -219,19 +230,12 @@ function loadConfig() {
ini_set('display_errors', false);
}
- // Keep the original address to properly comply with other board configurations
- if (!isset($__ip))
- $__ip = $_SERVER['REMOTE_ADDR'];
-
- // ::ffff:0.0.0.0
- if (preg_match('/^\:\:(ffff\:)?(\d+\.\d+\.\d+\.\d+)$/', $__ip, $m))
- $_SERVER['REMOTE_ADDR'] = $m[2];
-
if ($config['syslog'])
openlog('tinyboard', LOG_ODELAY, LOG_SYSLOG); // open a connection to sysem logger
if ($config['recaptcha'])
require_once 'inc/lib/recaptcha/recaptchalib.php';
+
if ($config['cache']['enabled'])
require_once 'inc/cache.php';