Hi GLPI team!
i'm migrating from 0.72.2 to 0.78.2, because almost all my patches was
included in this release,
but again utf8 problems :)

There is my favorite template, it indicate that followup is private only if
that is true

##FOREACHfollowups##
[##followup.date##]  Новый ответ по заявке ##lang.followup.author##
##followup.author##  ##IFfollowup.isprivate=Да## ##lang.followup.isprivate##
##ENDIFfollowup.isprivate## :
##followup.description##
##ENDFOREACHfollowups##

But it will not works because \w in regexp support only latin symbols. This
bug can be easily resolved if use .*?

notificationtemplate.class.php_utf8.patch



Second problem with mailgate and ticket,
when creating new ticket from email, with empty email subject,
ticket subject creating from mail body with limiting to 70 utf8 chars,
but! if at place 69-71 was \\n then ticket subject will contain incorret
text which will cause error in mysql

Error posted there http://pastebin.com/DqTFCX8u

Look at \\n *\\\*',\'yyyyyyyy...@xxxx.ru

Possible solution, but i'm not sure at 100%
ticket.class.php_slashes_problem.patch
--- ./notificationtemplate.class.php	2011-01-18 17:04:00.000000000 +0300
+++ ./notificationtemplate.class.php.new	2011-02-02 17:17:15.000000000 +0300
@@ -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);
@@ -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\.]*)[=]?(.*?)##/",$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."##/s";
             //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."##/s";
             if (empty($out[2][$key])){ // No = : check if ot empty or not null
                if (isset($data['##'.$if_field.'##'])
                   && $data['##'.$if_field.'##'] != ''
--- ./ticket.class.php	2011-02-02 17:57:11.000000000 +0300
+++ ./ticket.class.php.new	2011-02-02 17:57:11.000000000 +0300
@@ -1092,9 +1092,9 @@
 
       // No name set name
       if (empty($input["name"])) {
-         $input["name"] = preg_replace('/\r\n/',' ',$input['content']);
+         $input["name"] = preg_replace('/\r\n/',' ',stripslashes($input['content']));
          $input["name"] = preg_replace('/\n/',' ',$input['name']);
-         $input["name"] = utf8_substr($input['name'],0,70);
+         $input["name"] = addslashes(utf8_substr($input['name'],0,70));
       }
 
 
_______________________________________________
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev

Reply via email to