On Friday 11 February 2011 13:54:54 Denis Linvinus wrote: > 2011/2/11 Denis Linvinus <linvi...@gmail.com> > i have check content_text and it also need to be decoded, > > otherwise i get > > --b1_823641f82b34a65ee8f9b0a60fb836ae > Content-Type: text/plain; charset = "utf-8" > Content-Transfer-Encoding: 8bit > > > > [11-02-2011 14:19]  Новый Личный >  ответ по > заявке Автор > Денис : > > zsdafsdf > > so this is my current working patch > > --- ./notificationtemplate.class.php 2011-01-18 17:04:00.000000000 > +0300 +++ ./notificationtemplate.class.php.new 2011-02-11 > 15:50:25.000000000 +0300 > @@ -211,6 +211,7 @@ > if ($template_datas = $this->getByLanguage($language)) { > //Template processing > // Decode html chars to have clean text > + $template_datas['content_text'] = > html_entity_decode_deep($template_datas['content_text']); > $data = html_entity_decode_deep($data); > $template_datas['subject'] = > html_entity_decode_deep($template_datas['subject']); > $this->signature = > html_entity_decode_deep($this->signature); @@ -324,14 +325,14 @@ > > 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"; > - if (empty($out[2][$key])){ // No = : check if ot empty > or not null > + $regex_else = > "/##ELSE".$if_field."[=]?.*##(.*)##ENDELSE".$if_field."##/Uis"; > + if (empty($out[2][$key]) && !strlen($out[2][$key]) ){ // > No = : check if ot empty or not null > if (isset($data['##'.$if_field.'##']) > && $data['##'.$if_field.'##'] != '' > && $data['##'.$if_field.'##'] != ' ' > @@ -342,7 +343,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; > Your patch is working fine with my template too.
I'll post it on the forum too for others users if you agree (and close the thread). Nicolas _______________________________________________ Glpi-dev mailing list Glpi-dev@gna.org https://mail.gna.org/listinfo/glpi-dev