summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2005-11-14 23:55:46 +0000
committerthomascube <thomas@roundcube.net>2005-11-14 23:55:46 +0000
commitfd8c5061097f156da55a9cee8972aa4f13daa7b1 (patch)
treeb1e506f5cb480bb4eb787e6f64622b29a400f631 /program/include
parentecf7590cb84bb944d4adcd46124fbf0d081848f3 (diff)
SMTPS support and minor bugfixes
Diffstat (limited to 'program/include')
-rw-r--r--program/include/bugs.inc8
-rw-r--r--program/include/main.inc6
-rw-r--r--program/include/rcube_shared.inc8
-rw-r--r--program/include/rcube_smtp.inc16
4 files changed, 32 insertions, 6 deletions
diff --git a/program/include/bugs.inc b/program/include/bugs.inc
index d67281ef3..c9116d5a2 100644
--- a/program/include/bugs.inc
+++ b/program/include/bugs.inc
@@ -63,8 +63,12 @@ function log_bug($arg_arr)
$arg_arr['message'],
$arg_arr['file'],
$arg_arr['line']);
-
- if ($fp = fopen($INSTALL_PATH.'logs/errors', 'a'))
+
+ if (empty($CONFIG['log_dir']))
+ $CONFIG['log_dir'] = $INSTALL_PATH.'logs';
+
+ if ($fp = fopen($CONFIG['log_dir'].'/errors', 'a'))
+
{
fwrite($fp, $log_entry);
fclose($fp);
diff --git a/program/include/main.inc b/program/include/main.inc
index adb0b8822..306d2105e 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -40,12 +40,16 @@ function rcmail_startup($task='mail')
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);
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index edf19b66e..9b1b23bf6 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -1146,6 +1146,8 @@ EOF;
// perform utf-8 decoding
if ($utf8_decode && function_exists('utf8ToUnicodeEntities'))
$text = utf8ToUnicodeEntities($text);
+ else if ($utf8_decode)
+ $OUTPUT->set_charset('UTF-8');
// format output
@@ -1206,7 +1208,7 @@ function rep_specialchars_output($str, $enctype='', $mode='', $newlines=TRUE)
{
if (!$html_encode_arr)
{
- $html_encode_arr = get_html_translation_table(HTML_ENTITIES); // HTML_SPECIALCHARS
+ $html_encode_arr = get_html_translation_table(HTML_SPECIALCHARS); // HTML_ENTITIES
$html_encode_arr[chr(128)] = '&euro;';
unset($html_encode_arr['?']);
unset($html_encode_arr['&']);
@@ -1238,10 +1240,12 @@ function rep_specialchars_output($str, $enctype='', $mode='', $newlines=TRUE)
// if the replace tables for RTF, XML and JS are not yet defined
if (!$js_rep_table)
{
+ $js_rep_table = $rtf_rep_table = $xml_rep_table = array();
+
for ($c=160; $c<256; $c++) // can be increased to support more charsets
{
$hex = dechex($c);
- $js_rep_table[Chr($c)] = sprintf("\u%s%s", str_repeat('0', 4-strlen($hex)), $hex);
+ //$js_rep_table[Chr($c)] = sprintf("\u%s%s", str_repeat('0', 4-strlen($hex)), $hex);
$rtf_rep_table[Chr($c)] = "\\'$hex";
$xml_rep_table[Chr($c)] = "&#$c;";
}
diff --git a/program/include/rcube_smtp.inc b/program/include/rcube_smtp.inc
index e5691759c..e4aea09d2 100644
--- a/program/include/rcube_smtp.inc
+++ b/program/include/rcube_smtp.inc
@@ -53,12 +53,26 @@ function smtp_mail($from, $recipients, $headers, &$body)
{
global $SMTP_CONN, $CONFIG, $SMTP_ERROR;
$smtp_timeout = null;
+ $smtp_host = $CONFIG['smtp_server'];
$smtp_port = is_numeric($CONFIG['smtp_port']) ? $CONFIG['smtp_port'] : 25;
+ $smtp_host_url = parse_url($CONFIG['smtp_server']);
+ // overwrite port
+ if ($smtp_host_url['host'] && $smtp_host_url['port'])
+ {
+ $smtp_host = $smtp_host_url['host'];
+ $smtp_port = $smtp_host_url['port'];
+ }
+
+ // re-write smtp host
+ if ($smtp_host_url['host'] && $smtp_host_url['scheme'])
+ $smtp_host = sprintf('%s://%s', $smtp_host_url['scheme'], $smtp_host_url['host']);
+
+
// create Net_SMTP object and connect to server
if (!is_object($smtp_conn))
{
- $SMTP_CONN = new Net_SMTP($CONFIG['smtp_server'], $smtp_port, 'localhost');
+ $SMTP_CONN = new Net_SMTP($smtp_host, $smtp_port, 'localhost');
// set debugging
if ($CONFIG['debug_level'] & 8)