summaryrefslogtreecommitdiff
path: root/inc/confutils.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2007-12-18 15:10:30 +0100
committerAndreas Gohr <andi@splitbrain.org>2007-12-18 15:10:30 +0100
commit03ff8795c5212cb5bb8ec4cb5d78c442e8750bd5 (patch)
tree7231d8c425b79cf78797dc9051425be48fbf318f /inc/confutils.php
parent867121c2a0811559de92ea96c3b5b3286b220675 (diff)
downloadrpg-03ff8795c5212cb5bb8ec4cb5d78c442e8750bd5.tar.gz
rpg-03ff8795c5212cb5bb8ec4cb5d78c442e8750bd5.tar.bz2
make hashs escapable in configfile #1282
If a hash is needed in config files (parsed by confToHash) it can be escaped as \# (backslash hash) to avoid having it treated as comment start darcs-hash:20071218141030-7ad00-4c0c7317f2f049537d8ed02b47c6c2a18627ee86.gz
Diffstat (limited to 'inc/confutils.php')
-rw-r--r--inc/confutils.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/inc/confutils.php b/inc/confutils.php
index 8133dc209..bf1791e76 100644
--- a/inc/confutils.php
+++ b/inc/confutils.php
@@ -147,8 +147,9 @@ function confToHash($file,$lower=false) {
if ( !$lines ) return $conf;
foreach ( $lines as $line ) {
- //ignore comments
- $line = preg_replace('/(?<!&)#.*$/','',$line);
+ //ignore comments (except escaped ones)
+ $line = preg_replace('/(?<![&\\\\])#.*$/','',$line);
+ $line = str_replace('\\#','#',$line);
$line = trim($line);
if(empty($line)) continue;
$line = preg_split('/\s+/',$line,2);