summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorAdrian Lang <mail@adrianlang.de>2009-04-20 12:15:12 +0200
committerAdrian Lang <mail@adrianlang.de>2009-04-20 12:15:12 +0200
commit558fa2743e182e50efb8aa1ad3fbc756ca1665e7 (patch)
treee826e8a88d3914d693d1e4068efedf5c6c48cd36 /lib/util.php
parent046e5b23bb192699efad179f0de81a3d03ea1b7e (diff)
parent7196410bb0398c15fbab767a9b7cedc513e6520b (diff)
Merge branch '0.7.x' of git://gitorious.org/laconica/bAvatar-clone without the unintended deletion.
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/util.php b/lib/util.php
index 5d16e39b5..e0eda0114 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -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;
}
-