summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@controlyourself.ca>2009-05-01 00:16:25 +0000
committerSarven Capadisli <csarven@controlyourself.ca>2009-05-01 00:16:25 +0000
commitd30df0790818d77b81ee8b271b9bd8ebe3063ee7 (patch)
treed3a9b32815252caabcf16f593fbf4e2080cff93f /lib/util.php
parentf798d1ea430d25c2f4a60179c65b39b1257a5340 (diff)
parentb79fef307481b36b4d04dbabb54e3f6d9edf6896 (diff)
Merge branch '0.7.x' into 0.8.x
Resolved Conflicts: lib/queuehandler.php lib/util.php theme/base/css/display.css
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/util.php b/lib/util.php
index da009682b..198185338 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');
@@ -1019,7 +1024,7 @@ function common_root_url($ssl=false)
function common_good_rand($bytes)
{
// XXX: use random.org...?
- if (file_exists('/dev/urandom')) {
+ if (@file_exists('/dev/urandom')) {
return common_urandom($bytes);
} else { // FIXME: this is probably not good enough
return common_mtrand($bytes);
@@ -1385,11 +1390,10 @@ function common_compatible_license($from, $to)
*/
function common_database_tablename($tablename)
{
-
+
if(common_config('db','quote_identifiers')) {
$tablename = '"'. $tablename .'"';
}
//table prefixes could be added here later
return $tablename;
}
-