From e58df3adc9b4182c232c94178d024bb4a89c2290 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Sun, 15 Jun 2008 05:19:47 -0400 Subject: [PATCH] - Added option to select skin in user preferences (#1485031) - template_exists() moved to rcube_template class --- program/include/rcube_config.php | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 50 insertions(+), 1 deletions(-) diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php index 277299f..b862bf7 100644 --- a/program/include/rcube_config.php +++ b/program/include/rcube_config.php @@ -40,6 +40,8 @@ /** * Load config from local config file + * + * @todo Remove global $CONFIG */ private function load() { @@ -54,9 +56,12 @@ // load database config include_once(INSTALL_PATH . 'config/db.inc.php'); $this->prop += (array)$rcmail_config; + + // load host-specific configuration + $this->load_host_config(); // fix paths - $this->prop['skin_path'] = $this->prop['skin_path'] ? unslashify($this->prop['skin_path']) : 'skins/default'; + $this->prop['default_skin'] = $this->prop['default_skin'] ? unslashify($this->prop['default_skin']) : 'default'; $this->prop['log_dir'] = $this->prop['log_dir'] ? unslashify($this->prop['log_dir']) : INSTALL_PATH . 'logs'; // handle aliases @@ -77,6 +82,9 @@ // clear output buffer ob_end_clean(); + + // export config data + $GLOBALS['CONFIG'] = &$this->prop; } @@ -169,5 +177,46 @@ } + /** + * Try to autodetect operating system and find the correct line endings + * + * @return string The appropriate mail header delimiter + */ + public function header_delimiter() + { + // use the configured delimiter for headers + if (!empty($this->prop['mail_header_delimiter'])) + return $this->prop['mail_header_delimiter']; + else if (strtolower(substr(PHP_OS, 0, 3) == 'win')) + return "\r\n"; + else if (strtolower(substr(PHP_OS, 0, 3) == 'mac')) + return "\r\n"; + else + return "\n"; + } + + + + /** + * Return the mail domain configured for the given host + * + * @param string IMAP host + * @return string Resolved SMTP host + */ + public function mail_domain($host) + { + $domain = $host; + + if (is_array($this->prop['mail_domain'])) { + if (isset($this->prop['mail_domain'][$host])) + $domain = $this->prop['mail_domain'][$host]; + } + else if (!empty($this->prop['mail_domain'])) + $domain = $this->prop['mail_domain']; + + return $domain; + } + + } -- Gitblit v1.9.1