]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge commit 'upstream/0.7.x' into 0.7.x
authorSean Murphy <sgmurphy@gmail.com>
Mon, 9 Feb 2009 22:29:39 +0000 (17:29 -0500)
committerSean Murphy <sgmurphy@gmail.com>
Mon, 9 Feb 2009 22:29:39 +0000 (17:29 -0500)
lib/util.php

index c5a092f6300c4f7c8bdae1bd27b4e8d0cac9f95f..be92f422fbb507d5657c81d0e3fe809afc32028f 100644 (file)
@@ -412,8 +412,8 @@ function common_replace_urls_callback($text, $callback) {
 
     // Then clean up what the regex left behind
     $offset = 0;
-    foreach($matches[0] as $url) {
-        $url = htmlspecialchars_decode($url);
+    foreach($matches[0] as $orig_url) {
+        $url = htmlspecialchars_decode($orig_url);
 
         // Make sure we didn't pick up an email address
         if (preg_match('#^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$#i', $url)) continue;
@@ -456,6 +456,9 @@ function common_replace_urls_callback($text, $callback) {
 
         if (!in_array($url_parts[2], $tlds)) continue;
 
+        // Put the url back the way we found it.
+        $url = (mb_strpos($orig_url, htmlspecialchars($url)) === FALSE) ? $url:htmlspecialchars($url);
+
         // Call user specified func
         $modified_url = $callback($url);