If you have used Hesk before, you must have mentioned that all links that were posted by users at the time of ticlet creation/reply were opening in new tabs. If you decide to update to 2.5.2 (I was using version 2.3 before), you will notice that all links will be opening in the current tab.
If you want to change this, you’ll need to change one function.
Go to inc/common.inc.php
Find function hesk_makeURL($text, $class = ”)
it should look like:
function hesk_makeURL($text, $class = '') { global $hesk_settings;</code> if ( ! defined('MAGIC_URL_EMAIL')) { define('MAGIC_URL_EMAIL', 1); define('MAGIC_URL_FULL', 2); define('MAGIC_URL_LOCAL', 3); define('MAGIC_URL_WWW', 4); } $class = ($class) ? ' class="' . $class . '"' : ''; // matches a xxxx://aaaaa.bbb.cccc. ... $text = preg_replace_callback( '#(^|[nt (>.])([a-z][a-zd+]*:/{2}(?:(?:[a-z0-9-._~!$&'(*+,;=:@|]+|%[dA-F]{2})+|[0-9.]+|[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+])(?::d*)?(?:/(?:[a-z0-9-._~!$&'(*+,;=:@|]+|%[dA-F]{2})*)*(?:?(?:[a-z0-9-._~!$&'(*+,;=:@/?|]+|%[dA-F]{2})*)?(?:#(?:[a-z0-9-._~!$&'(*+,;=:@/?|]+|%[dA-F]{2})*)?)#i', create_function( "$matches", "return make_clickable_callback(MAGIC_URL_FULL, $matches[1], $matches[2], '', '$class');" ), $text ); // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing $text = preg_replace_callback( '#(^|[nt (>.])(www.(?:[a-z0-9-._~!$&'(*+,;=:@|]+|%[dA-F]{2})+(?::d*)?(?:/(?:[a-z0-9-._~!$&'(*+,;=:@|]+|%[dA-F]{2})*)*(?:?(?:[a-z0-9-._~!$&'(*+,;=:@/?|]+|%[dA-F]{2})*)?(?:#(?:[a-z0-9-._~!$&'(*+,;=:@/?|]+|%[dA-F]{2})*)?)#i', create_function( "$matches", "return make_clickable_callback(MAGIC_URL_WWW, $matches[1], $matches[2], '', '$class');" ), $text ); // matches an email address $text = preg_replace_callback( '#(^|[nt (>.])(([w!#$%&'*+-/=?^`{|}~]+.)*(?:[w!#$%'*+-/=?^`{|}~]|&)+@((((([a-z0-9]{1}[a-z0-9-]{0,62}[a-z0-9]{1})|[a-z]).)+[a-z]{2,63})|(d{1,3}.){3}d{1,3}(:d{1,5})?))#i', create_function( "$matches", "return make_clickable_callback(MAGIC_URL_EMAIL, $matches[1], $matches[2], '', '$class');" ), $text ); // return $text; } // END hesk_makeURL()
And replace it with the code from the previous version of Hesk:
function hesk_makeURL($strUrl) { $myMsg = ' ' . $strUrl; $myMsg = preg_replace("#(^|[n ])([w]+?://[^ "nrt<]*)#is", "$1<a href="$2" target="_blank">$2</a>", $myMsg); $myMsg = preg_replace("#(^|[n ])((www|ftp).[^ "tnr<]*)#is", "$1<a href="http://$2" target="_blank">$2</a>", $myMsg); $myMsg = preg_replace("#(^|[n ])([a-z0-9&-_.]+?)@([w-]+.([w-.]+.)*[w]+)#i", "$1<a href="mailto:$2@$3">$2@$3</a>", $myMsg); $myMsg = substr($myMsg, 1); return($myMsg); } // End hesk_makeURL()
Save file and have fun.