| | |
| | | session_start(); |
| | | $sess_id = session_id(); |
| | | |
| | | $_SESSION['user_lang'] = rcube_language_prop($CONFIG['locale_string']); |
| | | // create session and set session vars |
| | | if (!$_SESSION['client_id']) |
| | | { |
| | |
| | | $OUTPUT->include_script('program/js/common.js'); |
| | | $OUTPUT->include_script('program/js/app.js'); |
| | | |
| | | // set locale setting |
| | | rcmail_set_locale($sess_user_lang); |
| | | |
| | | // set user-selected charset |
| | | if (!empty($CONFIG['charset'])) |
| | | $OUTPUT->set_charset($CONFIG['charset']); |
| | | else |
| | | rcmail_set_locale($sess_user_lang); |
| | | |
| | | // add some basic label to client |
| | | rcube_add_label('loading'); |
| | |
| | | |
| | | if ($MBSTRING && function_exists("mb_language")) |
| | | { |
| | | if (!mb_language(strtok($lang, "_"))) |
| | | if (!@mb_language(strtok($lang, "_"))) |
| | | $MBSTRING = FALSE; // unsupport language |
| | | } |
| | | |
| | |
| | | // send correct response on a remote request |
| | | function rcube_remote_response($js_code, $flush=FALSE) |
| | | { |
| | | global $OUTPUT, $CHARSET; |
| | | static $s_header_sent = FALSE; |
| | | |
| | | if (!$s_header_sent) |
| | |
| | | } |
| | | |
| | | // send response code |
| | | print rcube_charset_convert($js_code, 'UTF-8', $GLOBALS['CHARSET']); |
| | | print rcube_charset_convert($js_code, $CHARSET, $OUTPUT->get_charset()); |
| | | |
| | | if ($flush) // flush the output buffer |
| | | flush(); |
| | |
| | | |
| | | // encode for javascript use |
| | | if ($enctype=='js') |
| | | { |
| | | if ($OUTPUT->get_charset()!='UTF-8') |
| | | $str = rcube_charset_convert($str, $GLOBALS['CHARSET'], $OUTPUT->get_charset()); |
| | | |
| | | return preg_replace(array("/\r\n/", '/"/', "/([^\\\])'/"), array('\n', '\"', "$1\'"), strtr($str, $js_rep_table)); |
| | | } |
| | | |
| | | // encode for RTF |
| | | if ($enctype=='rtf') |
| | |
| | | |
| | | function rcmail_charset_selector($attrib) |
| | | { |
| | | global $OUTPUT; |
| | | |
| | | // pass the following attributes to the form class |
| | | $field_attrib = array('name' => '_charset'); |
| | | foreach ($attrib as $attr => $value) |
| | |
| | | $select = new select($field_attrib); |
| | | $select->add(array_values($charsets), array_keys($charsets)); |
| | | |
| | | $set = $_POST['_charset'] ? $_POST['_charset'] : $GLOBALS['CHARSET']; |
| | | $set = $_POST['_charset'] ? $_POST['_charset'] : $OUTPUT->get_charset(); |
| | | return $select->show($set); |
| | | } |
| | | |