]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Drop a debug info line that isn't really needed
[quix0rs-gnu-social.git] / lib / util.php
index 5b57b79b5498151a8594c6ec36eed0435867db75..d679d717f2fa4c8a078cc087fc78d0df239148a8 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__);
     }
@@ -750,18 +760,8 @@ function common_local_url($action, $args=null, $params=null, $fragment=null)
     return $url;
 }
 
-function common_path($relative, $ssl=null)
+function common_path($relative, $ssl=false)
 {
-    if($ssl==null) {
-        //ssl was not specifically requested
-        if( $_SERVER['HTTPS'] && $_SERVER['HTTPS']!="off" ) {
-            //currently in https, so stay in https
-            $ssl=true;
-        } else {
-            //not in https, so stay not in https
-            $ssl=false;
-        }
-    }
     $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : '';
 
     if (($ssl && (common_config('site', 'ssl') === 'sometimes'))
@@ -991,7 +991,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()
@@ -1158,7 +1158,7 @@ function common_negotiate_type($cprefs, $sprefs)
     }
 
     if ('text/html' === $besttype) {
-        return "text/html; charset=utf-8";
+        return "text/html";
     }
     return $besttype;
 }