Le 03/02/2011 12:20, Denis Linvinus a écrit :


2011/2/3 MoYo <[email protected] <mailto:[email protected]>>

    Hi,

    thanks for your interest in GLPI.
    A similar bug report could be found here :
    http://www.glpi-project.org/forum/viewtopic.php?id=22834


    The proposed solution : replace \w by \p{L}
    Could you test it and validate the proposed solution ?


No, without changes this patch don't work for me,

ok

I get
[03-02-2011 13:36] Новый ответ по заявке Автор Денис ##IFfollowup.isprivate=Да## Личный ##ENDIFfollowup.isprivate## :
фывфыв

Others IF conditions works fine.

But in my version template also decoded
@@ -208,7 +208,7 @@
             Plugin::loadLang(strtolower($plug['plugin']));
          }

-         if ($template_datas = $this->getByLanguage($language)) {
+ if ($template_datas = html_entity_decode_deep($this->getByLanguage($language))) {
             //Template processing
             // Decode html chars to have clean text
             $data = html_entity_decode_deep($data);


But html decode here do not introduce problem when template included html characters ?

but even with that, patch from forum don't work for Russian letters in template.
But this one (remove Ui from regexp)

Removing Ui modifier will introduce troubles.
U is used to ungreedy the regular expression (find the shortest instead of the longuest, problems if you have the same condition twice).
Maybe ungreedy using ? works better (your initial proposition).
i modifier permit to be not case sensitive... removing it may also cause troubles.



if (preg_match_all("/##IF([a-z\.]*)[=]?([\p{L}\w ]*)##/",$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."[=]?[\p{L}\w ]*##(.*)##ENDIF".$if_field."##/s";
            //Get the else tag value (if one)
$regex_else = "/##ELSE".$if_field."[=]?[\p{L}\w ]*##(.*)##ENDELSE".$if_field."##/s";

with
-         if ($template_datas = $this->getByLanguage($language)) {
+ if ($template_datas = html_entity_decode_deep($this->getByLanguage($language))) {

also works, as my.
I don't understand for what this change,
|-&&  $data['##'.$if_field.'##'] == $out[2][$key]) {

+&&  $data['##'.$if_field.'##'] == htmlentities(utf8_decode($out[2][$key]))) {
|
without it my template works fine.


I do not understand it also.

If you can get us a complete patch if will be perfect.

Regards

_______________________________________________
Glpi-dev mailing list
[email protected]
https://mail.gna.org/listinfo/glpi-dev

Reply via email to