diff --git a/include/application.php b/include/application.php index 1d1fac6..57fcb57 100644 --- a/include/application.php +++ b/include/application.php @@ -744,7 +744,7 @@ class Application { $oVendor = new Vendor($this->iVendorId); // set URL - $appLinkURL = ($this->sWebpage) ? "sWebpage."\">".substr(stripslashes($this->sWebpage),0,30)."": " "; + $appLinkURL = ($this->sWebpage) ? trimmed_link($this->sWebpage,30) : " "; // start display application echo html_frame_start("","98%","",0); diff --git a/include/util.php b/include/util.php index 49ddedf..bf6f8df 100644 --- a/include/util.php +++ b/include/util.php @@ -916,6 +916,22 @@ function HtmlAreaLoaderScript($aTextareas) $outputIndex++; /* increment the output index */ } +/** + * Cuts the link text to the specified number of chars if it's longer, + * and adds an ellipsis + */ +function trimmed_link($shUrl, $iLength) +{ + $shText = $shUrl; + $shEnd = ''; + if(strlen($shUrl) > $iLength) + { + $shText = substr($shUrl, 0, $iLength); + $shText .= '...'; + } + return "$shText"; +} + /** * Remove html formatting from description and extract the first part of the description only. * This is to be used for search results, application summary tables, etc. diff --git a/include/version.php b/include/version.php index b6ed1bf..4bbf882 100644 --- a/include/version.php +++ b/include/version.php @@ -822,7 +822,7 @@ class version { $oCategory->display($oApp->iAppId, $this->iVersionId); // set URL - $appLinkURL = ($oApp->sWebpage) ? "sWebpage."\">".substr(stripslashes($oApp->sWebpage),0,30)."": " "; + $appLinkURL = ($oApp->sWebpage) ? trimmed_link($oApp->sWebpage,30) : " "; // start version display echo html_frame_start("","98%","",0);