diff --git a/Config_File.class.php b/Config_File.class.php index 6688bb47..bf8b14b9 100644 --- a/Config_File.class.php +++ b/Config_File.class.php @@ -1,4 +1,4 @@ - */ - if(preg_match_all('!(<\?[^?]*?\?>|)!i',$text_blocks[$curr_tb],$sp_match)) { + if(preg_match_all('!(<\?[^?]*?\?>|)(\n)?!i',$text_blocks[$curr_tb],$sp_match)) { /* found at least one match, loop through each one */ - foreach($sp_match[0] as $curr_sp) { + for($curr_sp = 0; $curr_sp <= count($sp_match[0]); $curr_sp++) { if(!$this->allow_php) { /* we don't allow php, so echo everything */ - $text_blocks[$curr_tb] = str_replace($curr_sp,'',$text_blocks[$curr_tb]); + $text_blocks[$curr_tb] = str_replace($sp_match[0][$curr_sp],'',$text_blocks[$curr_tb]); } elseif(!preg_match("!^(<\?(php | )|)!i",$curr_sp)) /* we allow php, so echo only non-php tags */ diff --git a/demo/index.php b/demo/index.php index 3794acb0..d784a5af 100644 --- a/demo/index.php +++ b/demo/index.php @@ -1,4 +1,4 @@ -", "<","<=",">=" are all valid conditional - qualifiers. + qualifiers, and must be separated from surrounding elements by + spaces. if statements @@ -1266,6 +1267,12 @@ Intro = """This is a value that spans more ... {/if} +{* the following syntax will NOT work, conditional qualifiers + must be separated from surrounding elements by spaces *} +{if $name=="Fred" || $name=="Wilma"} + ... +{/if} + {* parenthesis are allowed *} {if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#} diff --git a/index.php b/index.php index 3794acb0..d784a5af 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,4 @@ - */ - if(preg_match_all('!(<\?[^?]*?\?>|)!i',$text_blocks[$curr_tb],$sp_match)) { + if(preg_match_all('!(<\?[^?]*?\?>|)(\n)?!i',$text_blocks[$curr_tb],$sp_match)) { /* found at least one match, loop through each one */ - foreach($sp_match[0] as $curr_sp) { + for($curr_sp = 0; $curr_sp <= count($sp_match[0]); $curr_sp++) { if(!$this->allow_php) { /* we don't allow php, so echo everything */ - $text_blocks[$curr_tb] = str_replace($curr_sp,'',$text_blocks[$curr_tb]); + $text_blocks[$curr_tb] = str_replace($sp_match[0][$curr_sp],'',$text_blocks[$curr_tb]); } elseif(!preg_match("!^(<\?(php | )|)!i",$curr_sp)) /* we allow php, so echo only non-php tags */