From f8e7c0ceb95973b2f10ec5ee1204bbe8da86885a Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Wed, 16 Feb 2011 16:24:23 +1100 Subject: [PATCH] Don't overwrite configs when loading --- inc/functions.php | 59 ++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 1c9f6b78..2ba56e96 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -9,32 +9,39 @@ require 'instance-config.php'; } - $config['post_url'] = $config['root'] . $config['file_post']; - - $config['url_match'] = '/^' . - (preg_match($config['url_regex'], $config['root']) ? '' : - (@$_SERVER['HTTPS']?'https':'http') . - ':\/\/'.$_SERVER['HTTP_HOST']) . - preg_quote($config['root'], '/') . - '(' . - str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) . - '|' . - str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) . - preg_quote($config['file_index'], '/') . - '|' . - str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) . - str_replace('%d', '\d+', preg_quote($config['file_page'], '/')) . - '|' . - preg_quote($config['file_mod'], '/') . - '\?\/.+' . - ')$/i'; - - $config['dir']['static'] = $config['root'] . 'static/'; - - $config['image_sticky'] = $config['dir']['static'] . 'sticky.gif'; - $config['image_locked'] = $config['dir']['static'] . 'locked.gif'; - $config['image_deleted'] = $config['dir']['static'] . 'deleted.png'; - $config['image_zip'] = $config['dir']['static'] . 'zip.png'; + if(!isset($config['post_url'])) + $config['post_url'] = $config['root'] . $config['file_post']; + + if(!isset($config['url_match'])) + $config['url_match'] = '/^' . + (preg_match($config['url_regex'], $config['root']) ? '' : + (@$_SERVER['HTTPS']?'https':'http') . + ':\/\/'.$_SERVER['HTTP_HOST']) . + preg_quote($config['root'], '/') . + '(' . + str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) . + '|' . + str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) . + preg_quote($config['file_index'], '/') . + '|' . + str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) . + str_replace('%d', '\d+', preg_quote($config['file_page'], '/')) . + '|' . + preg_quote($config['file_mod'], '/') . + '\?\/.+' . + ')$/i'; + + if(!isset($config['dir']['static'])) + $config['dir']['static'] = $config['root'] . 'static/'; + + if(!isset($config['image_sticky'])) + $config['image_sticky'] = $config['dir']['static'] . 'sticky.gif'; + if(!isset($config['image_locked'])) + $config['image_locked'] = $config['dir']['static'] . 'locked.gif'; + if(!isset($config['image_deleted'])) + $config['image_deleted'] = $config['dir']['static'] . 'deleted.png'; + if(!isset($config['image_zip'])) + $config['image_zip'] = $config['dir']['static'] . 'zip.png'; } function sprintf3($str, $vars, $delim = '%') {