From 2dca2e30fac0297cfe25cd51d2772b0b7a7524ff Mon Sep 17 00:00:00 2001 From: Evan Wills Date: Wed, 7 Jul 2010 18:25:23 +0000 Subject: [PATCH] fixed issue 04420: group.php will strip out {QUESTION_ESSENTIALS} if it appears at the very first part of the template in dev branch Dev used preg_match() instead of strpos() to over come stripping of {QUESTION_ESSENTIALS} Dev strip out {QUESTION_CLASS} if {QUESTION_ESSENTIALS} is missing. Dev this issue applies to group.php, question.php and survey.php so all have been updated. git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@8911 b72ed6b6-b9f8-46b5-92b4-906544132732 --- group.php | 3 ++- question.php | 3 ++- survey.php | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/group.php b/group.php index cb062de123c..dbf8950abc2 100644 --- a/group.php +++ b/group.php @@ -1107,10 +1107,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 '
diff --git a/question.php b/question.php index 5858c129076..18f80e6034b 100644 --- a/question.php +++ b/question.php @@ -514,10 +514,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 '
diff --git a/survey.php b/survey.php index 6fe6e7668bd..ae4ec49913c 100644 --- a/survey.php +++ b/survey.php @@ -904,10 +904,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 '