thomascube
2006-03-02 bddb8fee29654c0bbec7c0c057a37dcf80ec96c9
program/include/main.inc
@@ -79,7 +79,6 @@
  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'])
    {
@@ -308,11 +307,12 @@
  $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');
@@ -351,7 +351,7 @@
  if ($MBSTRING && function_exists("mb_language"))
    {
    if (!mb_language(strtok($lang, "_")))
    if (!@mb_language(strtok($lang, "_")))
      $MBSTRING = FALSE;   //  unsupport language
    }
@@ -470,10 +470,10 @@
  if ($user_id = $DB->insert_id(get_sequence_name('users')))
    {
    if (is_string($CONFIG['mail_domain']))
      $mail_domain = $CONFIG['mail_domain'];
    else if (is_array($CONFIG['mail_domain']) && isset($CONFIG['mail_domain'][$host]))
    if (is_array($CONFIG['mail_domain']) && isset($CONFIG['mail_domain'][$host]))
      $mail_domain = $CONFIG['mail_domain'][$host];
    else if (!empty($CONFIG['mail_domain']))
      $mail_domain = $CONFIG['mail_domain'];
    else
      $mail_domain = $host;
   
@@ -501,14 +501,6 @@
                       
    // get existing mailboxes
    $a_mailboxes = $IMAP->list_mailboxes();
    // check if the configured mailbox for sent messages exists
    if ($CONFIG['sent_mbox'] && !in_array_nocase($CONFIG['sent_mbox'], $a_mailboxes))
      $IMAP->create_mailbox($CONFIG['sent_mbox'], TRUE);
    // check if the configured mailbox for sent messages exists
    if ($CONFIG['trash_mbox'] && !in_array_nocase($CONFIG['trash_mbox'], $a_mailboxes))
      $IMAP->create_mailbox($CONFIG['trash_mbox'], TRUE);
    }
  else
    {
@@ -662,6 +654,7 @@
// 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)
@@ -673,7 +666,7 @@
    }
  // 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();
@@ -888,7 +881,12 @@
  // 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')
@@ -1543,6 +1541,8 @@
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)
@@ -1571,7 +1571,7 @@
  $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);
  }