Skip to content

Commit

Permalink
Fixed issue 04420 group.php will strip out {QUESTION_ESSENTIALS} if i…
Browse files Browse the repository at this point in the history
…t appears at the very first part of the template

Dev substituted strpos() with preg_match() to fix stripping of {QUESTION_ESSENTIALS}
Dev strip {QUESTION_CLASS} if {QUESTION_ESSENTIALS} is missing
Dev this issue occured in question.php, group.php and survey.php so all have been updated


git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@8909 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Evan Wills committed Jul 7, 2010
1 parent 54a2f28 commit 6ca5411
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion group.php
Expand Up @@ -1096,10 +1096,11 @@ function checkconditions(value, name, type)

$question_template = file_get_contents($thistpl.'/question.pstpl');

if( (strpos( $question_template , '{QUESTION_ESSENTIALS}') == false) || (strpos( $question_template , '{QUESTION_CLASS}') == false) )
if( preg_match( '/\{QUESTION_ESSENTIALS\}/' , $question_template ) === false || preg_match( '/\{QUESTION_CLASS\}/' , $question_template ) === false )
{
// if {QUESTION_ESSENTIALS} is present in the template but not {QUESTION_CLASS} remove it because you don't want id="" and display="" duplicated.
$question_template = str_replace( '{QUESTION_ESSENTIALS}' , '' , $question_template );
$question_template = str_replace( '{QUESTION_CLASS}' , '' , $question_template );
echo '
<!-- NEW QUESTION -->
<div id="question'.$qa[4].'" class="'.$q_class.$man_class.'"'.$n_q_display.'>
Expand Down
3 changes: 2 additions & 1 deletion question.php
Expand Up @@ -512,10 +512,11 @@

$question_template = file_get_contents($thistpl.'/question.pstpl');

if( (strpos( $question_template , '{QUESTION_ESSENTIALS}') == false) || (strpos( $question_template , '{QUESTION_CLASS}') == false) )
if( preg_match( '/\{QUESTION_ESSENTIALS\}/' , $question_template ) === false || preg_match( '/\{QUESTION_CLASS\}/' , $question_template ) === false )
{
// if {QUESTION_ESSENTIALS} is present in the template but not {QUESTION_CLASS} remove it because you don't want id="" and display="" duplicated.
$question_template = str_replace( '{QUESTION_ESSENTIALS}' , '' , $question_template );
$question_template = str_replace( '{QUESTION_CLASS}' , '' , $question_template );
echo '
<!-- NEW QUESTION -->
<div id="question'.$qa[4].'" class="'.$q_class.$man_class.'"'.$n_q_display.'>
Expand Down
5 changes: 3 additions & 2 deletions survey.php
Expand Up @@ -900,10 +900,11 @@ function checkconditions(value, name, type)

$question_template = file_get_contents($thistpl.'/question.pstpl');

if( (strpos( $question_template , '{QUESTION_ESSENTIALS}') == false) || (strpos( $question_template , '{QUESTION_CLASS}') == false) )
if( preg_match( '/\{QUESTION_ESSENTIALS\}/' , $question_template ) === false || preg_match( '/\{QUESTION_CLASS\}/' , $question_template ) === false )
{
// if {QUESTION_ESSENTIALS} is present in the template but not {QUESTION_CLASS} remove it because you don't want id="" and display="" duplicated.
$question_template = str_replace( '{QUESTION_ESSENTIALS}' , '' , $question_template );
$question_template = str_replace( '{QUESTION_ESSENTIALS}' , '' , $question_template );
$question_template = str_replace( '{QUESTION_CLASS}' , '' , $question_template );

echo '
<!-- NEW QUESTION -->
Expand Down

0 comments on commit 6ca5411

Please sign in to comment.