]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Merge branch '0.7.x' of git://gitorious.org/laconica/bAvatar-clone without the uninte...
[quix0rs-gnu-social.git] / lib / util.php
index 5d16e39b56a2214d9d5321c9cad1a88616bad47f..e0eda0114b7101e046c55df94a3cb95919550bd4 100644 (file)
@@ -519,11 +519,16 @@ function common_shorten_links($text)
 
 function common_shorten_link($url, $reverse = false)
 {
+
     static $url_cache = array();
     if ($reverse) return isset($url_cache[$url]) ? $url_cache[$url] : $url;
 
     $user = common_current_user();
-
+    if (!isset($user)) {
+      // common current user does not find a user when called from the XMPP daemon
+      // therefore we'll set one here fix, so that XMPP given URLs may be shortened
+      $user->urlshorteningservice = 'ur1.ca';
+    }
     $curlh = curl_init();
     curl_setopt($curlh, CURLOPT_CONNECTTIMEOUT, 20); // # seconds to wait
     curl_setopt($curlh, CURLOPT_USERAGENT, 'Laconica');
@@ -1334,4 +1339,3 @@ function common_database_tablename($tablename)
   //table prefixes could be added here later
   return $tablename;
 }
-