From e09dd8782efae9226c31ab67d61456a5ef0bfe8d Mon Sep 17 00:00:00 2001 From: Michael Save Date: Wed, 14 Mar 2012 15:38:28 +1100 Subject: less warnings in CLI mode --- inc/functions.php | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'inc/functions.php') diff --git a/inc/functions.php b/inc/functions.php index d7136fa7..12b51d25 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -45,24 +45,28 @@ $config['post_url'] = $config['root'] . $config['file_post']; if(!isset($config['referer_match'])) - $config['referer_match'] = '/^' . - (preg_match($config['url_regex'], $config['root']) ? '' : - 'https?:\/\/' . $_SERVER['HTTP_HOST']) . - preg_quote($config['root'], '/') . - '(' . - str_replace('%s', '\w+', preg_quote($config['board_path'], '/')) . - '(' . - preg_quote($config['file_index'], '/') . '|' . - str_replace('%d', '\d+', preg_quote($config['file_page'])) . - ')?' . - '|' . - str_replace('%s', '\w+', preg_quote($config['board_path'], '/')) . - preg_quote($config['dir']['res'], '/') . - str_replace('%d', '\d+', preg_quote($config['file_page'], '/')) . - '|' . - preg_quote($config['file_mod'], '/') . '\?\/.+' . - ')([#?](.+)?)?$/i'; - + if(isset($_SERVER['HTTP_HOST'])) { + $config['referer_match'] = '/^' . + (preg_match($config['url_regex'], $config['root']) ? '' : + 'https?:\/\/' . $_SERVER['HTTP_HOST']) . + preg_quote($config['root'], '/') . + '(' . + str_replace('%s', '\w+', preg_quote($config['board_path'], '/')) . + '(' . + preg_quote($config['file_index'], '/') . '|' . + str_replace('%d', '\d+', preg_quote($config['file_page'])) . + ')?' . + '|' . + str_replace('%s', '\w+', preg_quote($config['board_path'], '/')) . + preg_quote($config['dir']['res'], '/') . + str_replace('%d', '\d+', preg_quote($config['file_page'], '/')) . + '|' . + preg_quote($config['file_mod'], '/') . '\?\/.+' . + ')([#?](.+)?)?$/i'; + } else { + // CLI mode + $config['referer_match'] = '//'; + } if(!isset($config['cookies']['path'])) $config['cookies']['path'] = &$config['root']; -- cgit v1.3