2011/2/10 Nicolas Michaux <nicolas-glpi-...@michaux.homelinux.org> > On Wednesday 09 February 2011 08:30:14 Denis Linvinus wrote: > > Hello Nicolas! > Hello, >
Hello! > > > As we have problem only with template condition, better decode only > > condition. > Ok, what about this patch for you? > This patch also works for me. But i don't understand why if (preg_match_all("/##IF([a-z\.]*)[=]?(.*)##/Ui",$string,$out)) { not the same as if (preg_match_all("/##IF([a-z\.]*)[=]?(.*?)##/i",$string,$out)) { > > --- inc/notificationtemplate.class.php.orig 2011-01-24 > 01:52:54.000000000 +0100 > +++ inc/notificationtemplate.class.php 2011-02-10 00:06:53.000000000 +0100 > @@ -324,13 +324,13 @@ > > static function processIf($string, $data) { > > - if (preg_match_all("/##IF([a-z\.]*)[=]?([\w ]*)##/i",$string,$out)) > { > + if (preg_match_all("/##IF([a-z\.]*)[=]?(.*?)##/i",$string,$out)) { > foreach ($out[1] as $key => $tag_infos) { > $if_field = $tag_infos; > //Get the field tag value (if one) > - $regex_if = "/##IF".$if_field."[=]?[\w > ]*##(.*)##ENDIF".$if_field."##/Uis"; > + $regex_if = > "/##IF".$if_field."[=]?.*##(.*)##ENDIF".$if_field."##/Uis"; > //Get the else tag value (if one) > - $regex_else = "/##ELSE".$if_field."[=]?[\w > ]*##(.*)##ENDELSE".$if_field."##/Uis"; > + $regex_else = > "/##ELSE".$if_field."[=]?.*##(.*)##ENDELSE".$if_field."##/Uis"; > if (empty($out[2][$key])){ // No = : check if ot empty or not > null > if (isset($data['##'.$if_field.'##']) > && $data['##'.$if_field.'##'] != '' > @@ -342,7 +342,7 @@ > } > } else { // check exact match > if (isset($data['##'.$if_field.'##']) > - && $data['##'.$if_field.'##'] == $out[2][$key]) { > + && html_entity_decode_deep($data['##'.$if_field.'##']) > == html_entity_decode_deep($out[2][$key])) { > $condition_ok=true; > } else { > $condition_ok=false; > > It modifies patterns to match HTML or UTF8 strings and adds a comparison > between UTF8 strings (for text and html template). > I works fine with my template (html and text too). > > Thanks, > > Nicolas > > _______________________________________________ > Glpi-dev mailing list > Glpi-dev@gna.org > https://mail.gna.org/listinfo/glpi-dev >
_______________________________________________ Glpi-dev mailing list Glpi-dev@gna.org https://mail.gna.org/listinfo/glpi-dev