less warnings in CLI mode

This commit is contained in:
Michael Save 2012-03-14 15:38:28 +11:00
parent c8d1f1cdd4
commit e09dd8782e
2 changed files with 26 additions and 19 deletions

View File

@ -635,7 +635,10 @@
// The root directory, including the trailing slash, for Tinyboard.
// examples: '/', 'http://boards.chan.org/', '/chan/'
if(isset($_SERVER['REQUEST_URI']))
$config['root'] = (str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) == '/' ? '/' : str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) . '/');
else
$config['root'] = '/'; // CLI mode
// If for some reason the folders and static HTML index files aren't in the current working direcotry,
// enter the directory path here. Otherwise, keep it false.

View File

@ -45,6 +45,7 @@
$config['post_url'] = $config['root'] . $config['file_post'];
if(!isset($config['referer_match']))
if(isset($_SERVER['HTTP_HOST'])) {
$config['referer_match'] = '/^' .
(preg_match($config['url_regex'], $config['root']) ? '' :
'https?:\/\/' . $_SERVER['HTTP_HOST']) .
@ -62,7 +63,10 @@
'|' .
preg_quote($config['file_mod'], '/') . '\?\/.+' .
')([#?](.+)?)?$/i';
} else {
// CLI mode
$config['referer_match'] = '//';
}
if(!isset($config['cookies']['path']))
$config['cookies']['path'] = &$config['root'];