X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Futil.php;h=4d670edcc157a059aa84edcc67247e9529b3fde4;hb=17fd7b185054e260f0a9a2cedd264ff3ef43d725;hp=44ed185fe44c8e8e4a8bcb7289daaedd08ae00a9;hpb=48c2d39ae4ec3d9116f4e316726b221e02f09f4b;p=quix0rs-gnu-social.git diff --git a/lib/util.php b/lib/util.php index 44ed185fe4..4d670edcc1 100644 --- a/lib/util.php +++ b/lib/util.php @@ -131,17 +131,24 @@ function common_end_xml() { $xw->flush(); } +function common_init_locale($language=null) { + if(!$language) { + $language = common_language(); + } + putenv('LANGUAGE='.$language); + putenv('LANG='.$language); + return setlocale(LC_ALL, $language . ".utf8", + $language . ".UTF8", + $language . ".utf-8", + $language . ".UTF-8", + $language); +} + function common_init_language() { mb_internal_encoding('UTF-8'); $language = common_language(); # So we don't have to make people install the gettext locales - putenv('LANGUAGE='.$language); - putenv('LANG='.$language); - $locale_set = setlocale(LC_ALL, $language . ".utf8", - $language . ".UTF8", - $language . ".utf-8", - $language . ".UTF-8", - $language); + $locale_set = common_init_locale($language); bindtextdomain("laconica", common_config('site','locale_path')); bind_textdomain_codeset("laconica", "UTF-8"); textdomain("laconica"); @@ -154,11 +161,12 @@ function common_init_language() { define('PAGE_TYPE_PREFS', 'text/html,application/xhtml+xml,application/xml;q=0.3,text/xml;q=0.2'); function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=NULL) { - + global $config, $xw; + global $action; /* XXX: kind of cheating here. */ common_start_html(); - + common_element_start('head'); common_element('title', NULL, $pagetitle . " - " . $config['site']['name']); @@ -202,7 +210,7 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall= } } common_element_end('head'); - common_element_start('body'); + common_element_start('body', $action); common_element_start('div', array('id' => 'wrap')); common_element_start('div', array('id' => 'header')); common_nav_menu(); @@ -236,21 +244,21 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall= } function common_start_html($type=NULL, $indent=true) { - + if (!$type) { $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : NULL; - + # XXX: allow content negotiation for RDF, RSS, or XRDS - + $type = common_negotiate_type(common_accept_to_prefs($httpaccept), common_accept_to_prefs(PAGE_TYPE_PREFS)); - + if (!$type) { common_user_error(_('This page is not available in a media type you accept'), 406); exit(0); } } - + header('Content-Type: '.$type); common_start_xml('html', @@ -401,9 +409,8 @@ function common_checkbox($id, $label, $checked=false, $instructions=NULL, $value $attrs['disabled'] = 'true'; } common_element('input', $attrs); - # XXX: use a