diff options
author | Andreas Gohr <andi@splitbrain.org> | 2007-12-18 15:10:30 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2007-12-18 15:10:30 +0100 |
commit | 03ff8795c5212cb5bb8ec4cb5d78c442e8750bd5 (patch) | |
tree | 7231d8c425b79cf78797dc9051425be48fbf318f | |
parent | 867121c2a0811559de92ea96c3b5b3286b220675 (diff) | |
download | rpg-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
-rw-r--r-- | inc/confutils.php | 5 |
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); |