thomascube
2005-11-18 5bc8cb662fc3bcda9aa641b7a5e88c0b81dd63d6
program/include/main.inc
@@ -40,12 +40,16 @@
  include_once('config/db.inc.php');
  $CONFIG = array_merge($CONFIG, $rcmail_config);
  if (empty($CONFIG['log_dir']))
    $CONFIG['log_dir'] = $INSTALL_PATH.'logs';
  else
    $CONFIG['log_dir'] = ereg_replace('\/$', '', $CONFIG['log_dir']);
  // set PHP error logging according to config
  if ($CONFIG['debug_level'] & 1)
    {
    ini_set('log_errors', 1);
    ini_set('error_log', $INSTALL_PATH.'logs/errors');
    ini_set('error_log', $CONFIG['log_dir'].'/errors');
    }
  if ($CONFIG['debug_level'] & 4)
    ini_set('display_errors', 1);
@@ -227,7 +231,7 @@
// init output object for GUI and add common scripts
function load_gui()
  {
  global $CONFIG, $OUTPUT, $COMM_PATH, $JS_OBJECT_NAME, $sess_user_lang;
  global $CONFIG, $OUTPUT, $COMM_PATH, $JS_OBJECT_NAME, $CHARSET, $sess_user_lang;
  // init output page
  $OUTPUT = new rcube_html_page();
@@ -244,8 +248,11 @@
  $OUTPUT->include_script('program/js/app.js');
  // set user-selected charset
  if ($CONFIG['charset'])
  if (!empty($CONFIG['charset']))
    {
    $OUTPUT->set_charset($CONFIG['charset']);
    $CHARSET = $CONFIG['charset'];
    }
  else
    rcmail_set_locale($sess_user_lang);
  
@@ -257,16 +264,22 @@
// set localization charset based on the given language
function rcmail_set_locale($lang)
  {
  global $OUTPUT, $INSTLL_PATH;
  global $OUTPUT, $INSTLL_PATH, $CHARSET;
  static $rcube_charsets;
  if (!$rcube_charsets)
    @include($INSTLL_PATH.'program/localization/index.inc');
  if (isset($rcube_charsets[$lang]))
    {
    $OUTPUT->set_charset($rcube_charsets[$lang]);
    $CHARSET = $rcube_charsets[$lang];
    }
  else
    {
    $OUTPUT->set_charset('ISO-8859-1');
    $CHARSET = 'ISO-8859-1';
    }
  }
@@ -573,6 +586,7 @@
// replace all strings ($varname) with the content of the according global variable
function parse_with_globals($input)
  {
  $GLOBALS['__comm_path'] = $GLOBALS['COMM_PATH'];
  $output = preg_replace('/\$(__[a-z0-9_\-]+)/e', '$GLOBALS["\\1"]', $input);
  return $output;
  }