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

Clickable URLs

I noticed the following (unexpexted) behaviour on v1.6 RC5:
When selecting the system preferences and settings "Clickable URLs" active, the URLs in the email send are clickable but not visible in the ticket thread. It's only showing http:// which obvisouly opens an empty browser screen when clicked.

When deselecting the option, the email still contains a clickable URL and the full URL is show in the ticket thread.

So it seems like there's something wrong when using the Clickable URL option when showing the ticket information in the thread.

When switching of the Clickable URL, all the previously entered URL info is shown, so the storing into the database is working, it must be the way the info is shown.

Any suggestion where in the code to fix this?

Comments

  • Sorry I dont have a copy of 1.6rc5. Considering how old it is you may want to consider upgrading to 1.6st (the stable release) or the newer 1.7rc4.
  • Thanks for the response, but I'm a little hesitant to perform an upgrade. Not that I don't want it, but I have made a lot of changes is the code to make it (almost) fully Dutch language. And since I did not discover a template-override mechanism as used in Joomla, I had to do it directly in the code.

    And I'm pretty sure that upgrading will overwrite all my changes :mad:

    So unless you have a better solution, I think I'll need to stay on my current version until I have enough confidence that the 1.7 release is mature enough.
  • Upgrading would indeed wipe out your changes.

    I'm personally running 1.6ST and have clickable urls enabled, and have not experienced the problem that you are describing.

    There is a clickableURLS function in 1.6st is located in \include\class.config.php. You may want to compare it to your version. Line 245 is the start of the function.

    There is also in \include\class.format.php circa line 84 a reference to it. You might want to compare that to your version also.

        function display($text) {
    global $cfg;

    $text=Format::htmlchars($text); //take care of html special chars
    if($cfg && $cfg->clickableURLS() && $text)
    $text=Format::clickableurls($text);


    and again on line 97.
        //make urls clickable. Mainly for display 
    function clickableurls($text) {

    //Not perfect but it works - please help improve it.
    $text=preg_replace('/(((f|ht){1}tp(s?):\/\/)[-a-zA-Z0-9@:%_\+.~#?&;\/\/=]+)/','<a href=\"\\1\" target=\"_blank\">\\1</a>', $text);
    $text=preg_replace(\"/(^|[ \\n\\r\\t])(www\.([a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)(\/[^\/ \\n\\r]*)*)/\",
    '\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>', $text);
    $text=preg_replace(\"/(^|[ \\n\\r\\t])([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4})/\",'\\1<a href=\"mailto:\\2\" target=\"_blank\">\\2</a>', $text);

    return $text;
    }


    I didn't really see anywhere else in the source that references it but I also looked very quickly.
  • Thanks, I'll give it a try to compare my file with the one from 1.6ST, and yes, I noticed that in 1.6ST the problem did not appear.

    (Which I have just installed on my testserver to perform an update to version 1.7 just to see how that goes and that went pretty smooth, good job!)
  • Replacing the stuff around line 82 in my version
    //make urls clickable. Mainly for display

    with the lines you displayed below solved my problem.
    Thanks!
  • Awesome! :) Glad to be able to point you in the right direction.
  • Now that you helped me out with this simple issue, I dare to ask for another one :-)
    I noticed that in the 1.6ST release, the ticket# and description are mailed as subject of the notification email.
    In the 1.6RC4 that's not the case, only "New ticket alert" is used as the topic.

    Is there a simply way to modify the old RC4 code (in what file?) to achive this?

    And I'm going to plan for an update to 1.7 straight from 1.6RC4, do you have any idea when that version will become available?

    Remember that I made a lot of Dutch translations, so I want to keep the number of upgrades to the minumum (it does take quite some time to translate hardcoded text.......)
  • Yes I was just going to post this same fix as I just fixed mine as well. Its been awhile since I have used mine 1.6rc5 business has been dead or non existent for awhile now. But I thought I would go ahead and fire it up.

    And this was one of the things I fixed as well and was going to post on the forum.
    Function eregi_replace() is deprecated in /include/class.format.php on line 87

    I am glad that someone has posted this already.

    The only difference between my fix and the one above is that it is recommended that you use the /i modifier. So with mine you can see just before the close ', of the first attribute I added /I



    /make urls clickable. Mainly for display
    function clickableurls($text) {
    $text=preg_replace('(((f|ht){1}tp(s?)://)[-a-zA-Z0-9@:%_\+.~#?&;//=]+)/i','<a href=\"\\1\" target=\"_blank\">\\1</a>', $text);
    $text=preg_replace(\"(^|[ \n\r\t])(www\.([a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)(/[^/ \n\r]*)*)/i\",
    '\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>', $text);
    $text=preg_replace(\"(^|[ \n\r\t])([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4})/i\",'\\1<a href=\"mailto:\\2\" target=\"_blank\">\\2</a>', $text);





    And yes I know I need to update to 1.6ST and prob then to 1.7 but I have made soooooo many mods to this and many of them are undocumented my bad..... I will have to update at some point I know.
Sign In or Register to comment.