]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Remove automatic enqueuing for Facebook
[quix0rs-gnu-social.git] / lib / util.php
index 44a377220016ea08347426f5b1bdc97241b930db..b6e89f0bd9cd8fb364083a28cb90716e3f4ce160 100644 (file)
@@ -51,13 +51,23 @@ function common_init_locale($language=null)
 function common_init_language()
 {
     mb_internal_encoding('UTF-8');
+
+    // gettext seems very picky... We first need to setlocale()
+    // to a locale which _does_ exist on the system, and _then_
+    // we can set in another locale that may not be set up
+    // (say, ga_ES for Galego/Galician) it seems to take it.
+    common_init_locale("en_US");
+    
     $language = common_language();
-    // So we don't have to make people install the gettext locales
     $locale_set = common_init_locale($language);
-    bindtextdomain("statusnet", common_config('site','locale_path'));
+    setlocale(LC_CTYPE, 'C');
+    
+    // So we don't have to make people install the gettext locales
+    $path = common_config('site','locale_path');
+    bindtextdomain("statusnet", $path);
     bind_textdomain_codeset("statusnet", "UTF-8");
     textdomain("statusnet");
-    setlocale(LC_CTYPE, 'C');
+
     if(!$locale_set) {
         common_log(LOG_INFO, 'Language requested:' . $language . ' - locale could not be set. Perhaps that system locale is not installed.', __FILE__);
     }
@@ -391,7 +401,7 @@ function common_render_content($text, $notice)
 {
     $r = common_render_text($text);
     $id = $notice->profile_id;
-    $r = preg_replace('/(^|[\s\.\,\:\;]+)@([A-Za-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);
+    $r = preg_replace('/(^|\s+)@(['.NICKNAME_FMT.']{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);
     $r = preg_replace('/^T ([A-Z0-9]{1,64}) /e', "'T '.common_at_link($id, '\\1').' '", $r);
     $r = preg_replace('/(^|[\s\.\,\:\;]+)@#([A-Za-z0-9]{1,64})/e', "'\\1@#'.common_at_hash_link($id, '\\2')", $r);
     $r = preg_replace('/(^|[\s\.\,\:\;]+)!([A-Za-z0-9]{1,64})/e', "'\\1!'.common_group_link($id, '\\2')", $r);
@@ -896,8 +906,6 @@ function common_broadcast_notice($notice, $remote=false)
 function common_enqueue_notice($notice)
 {
     static $localTransports = array('omb',
-                                    'twitter',
-                                    'facebook',
                                     'ping');
 
     static $allTransports = array('sms', 'plugin');
@@ -998,7 +1006,7 @@ function common_set_returnto($url)
 function common_get_returnto()
 {
     common_ensure_session();
-    return $_SESSION['returnto'];
+    return (array_key_exists('returnto', $_SESSION)) ? $_SESSION['returnto'] : null;
 }
 
 function common_timestamp()
@@ -1165,7 +1173,7 @@ function common_negotiate_type($cprefs, $sprefs)
     }
 
     if ('text/html' === $besttype) {
-        return "text/html";
+        return "text/html; charset=utf-8";
     }
     return $besttype;
 }