| | |
| | | |
| | | |
| | | // system error reporting: 1 = log; 2 = report (not implemented yet), 4 = show, 8 = trace |
| | | $rcmail_config['debug_level'] = 5; |
| | | $rcmail_config['debug_level'] = 1; |
| | | |
| | | // enable caching of messages and mailbox data in the local database. |
| | | // this is recommended if the IMAP server does not run on the same machine |
| | |
| | | |
| | | // This domain will be used to form e-mail addresses of new users |
| | | // Specify an array with 'host' => 'domain' values to support multiple hosts |
| | | $rcmail_config['mail_domain'] = 'roundcube.net'; |
| | | $rcmail_config['mail_domain'] = ''; |
| | | |
| | | // Path to a virtuser table file to resolve user names and e-mail addresses |
| | | $rcmail_config['virtuser_file'] = ''; |
| | |
| | | /* |
| | | +-----------------------------------------------------------------------+ |
| | | | RoundCube Webmail IMAP Client | |
| | | | Version 0.1b-20060219 | |
| | | | Version 0.1-20060220 | |
| | | | | |
| | | | Copyright (C) 2005, RoundCube Dev. - Switzerland | |
| | | | Licensed under the GNU GPL | |
| | |
| | | |
| | | */ |
| | | |
| | | define('RCMAIL_VERSION', '0.1b-20060219'); |
| | | define('RCMAIL_VERSION', '0.1-20060220'); |
| | | |
| | | |
| | | // define global vars |
| | |
| | | ini_set('session.use_cookies', 1); |
| | | ini_set('session.gc_maxlifetime', 21600); |
| | | ini_set('session.gc_divisor', 500); |
| | | ini_set('magic_quotes_gpc', 0); |
| | | ini_set('error_reporting', E_ALL&~E_NOTICE); |
| | | |
| | | // increase maximum execution time for php scripts |
| | |
| | | $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); |
| | | } |
| | | |
| | |
| | | $count = iil_C_CountMessages($this->conn, $mailbox); |
| | | } |
| | | |
| | | if (is_array($a_mailbox_cache[$mailbox])) |
| | | if (!is_array($a_mailbox_cache[$mailbox])) |
| | | $a_mailbox_cache[$mailbox] = array(); |
| | | |
| | | $a_mailbox_cache[$mailbox][$mode] = (int)$count; |
| | |
| | | function set_charset($charset) |
| | | { |
| | | global $MBSTRING; |
| | | |
| | | $this->charset = $charset; |
| | | if ($MBSTRING&&function_exists( "mb_internal_encoding")) |
| | | |
| | | if ($MBSTRING && function_exists("mb_internal_encoding")) |
| | | { |
| | | if(!@mb_internal_encoding( $charset)) |
| | | { |
| | | if(!@mb_internal_encoding($charset)) |
| | | $MBSTRING = FALSE; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | if (!isset($_POST[$fname])) |
| | | continue; |
| | | |
| | | $a_write_sql[] = sprintf("%s=%s", $DB->quoteIdentifier($col), $DB->quote(strip_tags($_POST[$fname]))); |
| | | $a_write_sql[] = sprintf("%s=%s", |
| | | $DB->quoteIdentifier($col), |
| | | $DB->quote(rcube_charset_convert(strip_tags($_POST[$fname]), $OUTPUT->get_charset()))); |
| | | } |
| | | |
| | | if (sizeof($a_write_sql)) |
| | |
| | | continue; |
| | | |
| | | $a_insert_cols[] = $col; |
| | | $a_insert_values[] = $DB->quote(strip_tags($_POST[$fname])); |
| | | $a_insert_values[] = $DB->quote(rcube_charset_convert(strip_tags($_POST[$fname]), $OUTPUT->get_charset())); |
| | | } |
| | | |
| | | if (sizeof($a_insert_cols)) |
| | |
| | | |
| | | $mimetype = sprintf('%s/%s', $ctype_primary, $ctype_secondary); |
| | | $filename = $part->d_parameters['filename'] ? $part->d_parameters['filename'] : $part->ctype_parameters['name']; |
| | | |
| | | if ($ctype_primary=='text') |
| | | |
| | | if ($ctype_primary=='text' && $ctype_secondary=='html') |
| | | { |
| | | list($MESSAGE['parts']) = rcmail_parse_message($part, |
| | | array('safe' => (bool)$_GET['_safe'], |
| | |
| | | |
| | | function rcmail_get_identity($id) |
| | | { |
| | | global $DB; |
| | | global $DB, $CHARSET, $OUTPUT; |
| | | |
| | | // get identity record |
| | | $sql_result = $DB->query("SELECT *, email AS mailto |
| | |
| | | { |
| | | $sql_arr = $DB->fetch_assoc($sql_result); |
| | | $out = $sql_arr; |
| | | $out['string'] = sprintf('%s <%s>', $sql_arr['name'], $sql_arr['mailto']); |
| | | $out['string'] = sprintf('%s <%s>', |
| | | rcube_charset_convert($sql_arr['name'], $CHARSET, $OUTPUT->get_charset()), |
| | | $sql_arr['mailto']); |
| | | return $out; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | // set default charset |
| | | if (empty($CHARSET)) |
| | | $CHARSET = 'ISO-8859-1'; |
| | | |
| | | $input_charset = $CHARSET; |
| | | $input_charset = $OUTPUT->get_charset(); |
| | | $message_charset = isset($_POST['_charset']) ? $_POST['_charset'] : $input_charset; |
| | | |
| | | $mailto_regexp = array('/[,;]\s*[\r\n]+/', '/[\r\n]+/', '/[,;]\s*$/m'); |
| | |
| | | |
| | | |
| | | // use the configured delimiter for headers |
| | | $header_delm = $rcmail_config['mail_header_delimiter'] ? $rcmail_config['mail_header_delimiter'] : "\r\n"; |
| | | $header_delm = $CONFIG['mail_header_delimiter'] ? $CONFIG['mail_header_delimiter'] : "\r\n"; |
| | | |
| | | // create PEAR::Mail_mime instance |
| | | $MAIL_MIME = new Mail_mime($header_delm); |
| | |
| | | $msg_body = $MAIL_MIME->get($message_param); |
| | | |
| | | $msg_subject = $headers['Subject']; |
| | | global $MBSTRING; |
| | | if ($MBSTRING&&function_exists( "mb_encode_mimeheader")) |
| | | $headers['Subject'] = mb_encode_mimeheader( $headers['Subject'],$message_charset); |
| | | |
| | | if ($MBSTRING && function_exists("mb_encode_mimeheader")) |
| | | $headers['Subject'] = mb_encode_mimeheader($headers['Subject'], $message_charset); |
| | | |
| | | // send thru SMTP server using cusotm SMTP library |
| | | if ($CONFIG['smtp_server']) |
| | |
| | | else |
| | | { |
| | | // unset some headers because they will be added by the mail() function |
| | | $headers_php = $MAIL_MIME->_headers; |
| | | $headers_enc = $MAIL_MIME->headers($headers); |
| | | $headers_php = $MAIL_MIME->_headers; |
| | | unset($headers_php['To'], $headers_php['Subject']); |
| | | |
| | | |
| | | // reset stored headers and overwrite |
| | | $MAIL_MIME->_headers = array(); |
| | | $header_str = $MAIL_MIME->txtHeaders($headers_php); |
| | | |
| | | if(ini_get('safe_mode')) |
| | | if (ini_get('safe_mode')) |
| | | $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str); |
| | | else |
| | | $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str, "-f$from"); |
| | |
| | | else if ($_action=='create-folder') |
| | | { |
| | | if (strlen($_GET['_name'])) |
| | | $create = $IMAP->create_mailbox(strip_tags(trim($_GET['_name'])), TRUE); |
| | | $create = $IMAP->create_mailbox(rcube_charset_convert(strip_tags(trim($_GET['_name'])), $OUTPUT->get_charset()), TRUE); |
| | | |
| | | if ($create && $_GET['_remote']) |
| | | { |
| | |
| | | if (!isset($_POST[$fname])) |
| | | continue; |
| | | |
| | | $a_write_sql[] = sprintf("%s=%s", $DB->quoteIdentifier($col), $DB->quote(strip_tags($_POST[$fname]))); |
| | | $a_write_sql[] = sprintf("%s=%s", |
| | | $DB->quoteIdentifier($col), |
| | | $DB->quote(rcube_charset_convert(strip_tags($_POST[$fname]), $OUTPUT->get_charset()))); |
| | | } |
| | | |
| | | if (sizeof($a_write_sql)) |
| | |
| | | continue; |
| | | |
| | | $a_insert_cols[] = $DB->quoteIdentifier($col); |
| | | $a_insert_values[] = $DB->quote(strip_tags($_POST[$fname])); |
| | | $a_insert_values[] = $DB->quote(rcube_charset_convert(strip_tags($_POST[$fname]), $OUTPUT->get_charset())); |
| | | } |
| | | |
| | | if (sizeof($a_insert_cols)) |