Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Bugfix: class.format.php > error when using special characters, accents or umlauts in pages names

If you are using special characters, accents or umlauts in your pages names osticket will create an error 403.

affected file: include/class.format.php

Remove or escape line 683 to 696:
    // Thanks, http://stackoverflow.com/a/2955878/1025836
    /* static */
    function slugify($text) {
        // replace non letter or digits by -
        $text = preg_replace('~[^\p{L}\p{N}]+~u', '-', $text);

        // trim
        $text = trim($text, '-');

        // lowercase
        $text = strtolower($text);

        return (empty($text)) ? 'n-a' : $text;
    }

and replace it with:

    /* DMT Slugify to support special characters Start */
   
        function slugify($text)
    {
          // replace non letter or digits by -
          $text = preg_replace('~[^\\pL\d]+~u', '-', $text);
        // trim
          $text = trim($text, '-');
        // transliterate
          if (function_exists('iconv'))
              {
            $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
              }
        // lowercase
          $text = strtolower($text);
        // remove unwanted characters
       
          $text = preg_replace('~[^-\w]+~', '', $text);
        $text = preg_replace('#&([A-za-z])(?:acute|cedil|caron|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $text);
        $text = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $text);
        $text = preg_replace('#&[^;]+;#', '', $text);
          if (empty($text))
           {
            return 'n-a';
           }
          return $text;
    }
   
    /* DMT Slugify Ende */

Best regards,
Jürgen
Tagged:

Comments

  • Some reason why you wouldn't report this on github and then do a Pull Request so it makes it into core?
  • Two years ago we forked osTicket-1.8 on github, made some improvements, bugfixes... contacted the devs and get no response. At the same time we made a forum post with the same topic as above. We have deleted the repository on github, because nobody was interested in it.

    We made a lot of code changes, bugfixes, replacements, improvements over the last years and remarked that known issues are not implemented in the core. That's the reason why we build our own customized base to use it as starting point for our customer osTicket projects.

    Think about the redactor discussion as example: The last published version of redactor I is 10.2.5, even it's heavy discussed in the forum and on github the integrated version in osTicket is 10.2.2

    Yesterday we improved the slugify code for better multilanguage support and posted it here, to give the users the possibilty to integrate it by themselves if it's not integrated in the core. In future, we will post bugfixes here and in github... hope it will help. 
Sign In or Register to comment.