]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Merge branch '0.8.x' of git://gitorious.org/~brion/statusnet/brion-fixes into 0.8.x
[quix0rs-gnu-social.git] / lib / util.php
index 3e95d2bea34afe90345d0ba42d2ec47bb4f821c7..b831859e993392d14de493f3ae349d9e61e919e2 100644 (file)
@@ -442,9 +442,9 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) {
         ')'.
         '(?:'.
             '(?:\:\d+)?'. //:port
-            '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"]*)?'. // /path
-            '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\/]*)?'. // ?query string
-            '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\/\?\#]*)?'. // #fragment
+            '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@]*)?'. // /path
+            '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@\/]*)?'. // ?query string
+            '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\@/\?\#]*)?'. // #fragment
         ')(?<![\?\.\,\#\,])'.
     ')'.
     '#ixu';
@@ -552,12 +552,13 @@ function common_linkify($url) {
     }
 
     if (!empty($f)) {
-        if (isset($f->filename)) {
+        if ($f->isEnclosure()) {
             $is_attachment = true;
             $attachment_id = $f->id;
-        } else { // if it has OEmbed info, it's an attachment, too
+        } else {
             $foe = File_oembed::staticGet('file_id', $f->id);
             if (!empty($foe)) {
+                // if it has OEmbed info, it's an attachment, too
                 $is_attachment = true;
                 $attachment_id = $f->id;
 
@@ -1414,9 +1415,6 @@ function common_shorten_url($long_url)
 
     curl_close($curlh);
 
-    if(substr($short_url,0,7)=='http://'){
-        $short_url = substr($short_url,7);
-    }
     return $short_url;
 }