From 2d81544bccb9ab39e80c6ae8d101acbac5263f9b Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 14 Feb 2008 13:12:34 +0000 Subject: [PATCH] Udpated mail methods. -Improved configuration falg detection for MAIL_ATTRIB git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@8910 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_mail-methods-cyrus.inc | 9 +++++++-- include/class_mail-methods-golab.inc | 9 +++++++-- include/class_mail-methods-kolab.inc | 9 +++++++-- include/class_mail-methods-sendmail-cyrus.inc | 9 +++++++-- include/class_mail-methods.inc | 9 +++++++-- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/include/class_mail-methods-cyrus.inc b/include/class_mail-methods-cyrus.inc index 2812f63b3..6c822691b 100644 --- a/include/class_mail-methods-cyrus.inc +++ b/include/class_mail-methods-cyrus.inc @@ -30,8 +30,13 @@ var $uattrib= "uid"; /* Check if the mail account identification attribute is overridden in the configuration file */ - if(isset($config->current['MAIL_ATTRIB'])){ - $this->uattrib = $config->current['MAIL_ATTRIB']; + if(isset($config->current['MAIL_ATTRIB']) && !empty($config->current['MAIL_ATTRIB'])){ + $new_uattrib= strtolower($config->current['MAIL_ATTRIB']); + if(in_array($new_uattrib,array("mail","uid"))){ + $this->uattrib = $new_uattrib; + }else{ + trigger_error(sprintf("Unsupported MAIL_ATTRIB in gosa configuration specified, use 'mail' or 'uid', instead of '%s'.", $new_uattrib)); + } } $this->config= $config->data['SERVERS']['IMAP']; diff --git a/include/class_mail-methods-golab.inc b/include/class_mail-methods-golab.inc index 64cd7dd69..0ac850459 100644 --- a/include/class_mail-methods-golab.inc +++ b/include/class_mail-methods-golab.inc @@ -35,8 +35,13 @@ class mailMethodGolab extends mailMethodCyrus /* Check if the mail account identification attribute is overridden in the configuration file */ - if(isset($config->current['MAIL_ATTRIB'])){ - $this->uattrib = $config->current['MAIL_ATTRIB']; + if(isset($config->current['MAIL_ATTRIB']) && !empty($config->current['MAIL_ATTRIB'])){ + $new_uattrib= strtolower($config->current['MAIL_ATTRIB']); + if(in_array($new_uattrib,array("mail","uid"))){ + $this->uattrib = $new_uattrib; + }else{ + trigger_error(sprintf("Unsupported MAIL_ATTRIB in gosa configuration specified, use 'mail' or 'uid', instead of '%s'.", $new_uattrib)); + } } $this->config= $config->data['SERVERS']['IMAP']; diff --git a/include/class_mail-methods-kolab.inc b/include/class_mail-methods-kolab.inc index a4944df64..61d15c47f 100644 --- a/include/class_mail-methods-kolab.inc +++ b/include/class_mail-methods-kolab.inc @@ -35,8 +35,13 @@ class mailMethodKolab extends mailMethodCyrus /* Check if the mail account identification attribute is overridden in the configuration file */ - if(isset($config->current['MAIL_ATTRIB'])){ - $this->uattrib = $config->current['MAIL_ATTRIB']; + if(isset($config->current['MAIL_ATTRIB']) && !empty($config->current['MAIL_ATTRIB'])){ + $new_uattrib= strtolower($config->current['MAIL_ATTRIB']); + if(in_array($new_uattrib,array("mail","uid"))){ + $this->uattrib = $new_uattrib; + }else{ + trigger_error(sprintf("Unsupported MAIL_ATTRIB in gosa configuration specified, use 'mail' or 'uid', instead of '%s'.", $new_uattrib)); + } } $this->config= $config->data['SERVERS']['IMAP']; diff --git a/include/class_mail-methods-sendmail-cyrus.inc b/include/class_mail-methods-sendmail-cyrus.inc index 255c85529..ede415d62 100644 --- a/include/class_mail-methods-sendmail-cyrus.inc +++ b/include/class_mail-methods-sendmail-cyrus.inc @@ -27,8 +27,13 @@ class mailMethodSendmailCyrus extends mailMethodCyrus /* Check if the mail account identification attribute is overridden in the configuration file */ - if(isset($config->current['MAIL_ATTRIB'])){ - $this->uattrib = $config->current['MAIL_ATTRIB']; + if(isset($config->current['MAIL_ATTRIB']) && !empty($config->current['MAIL_ATTRIB'])){ + $new_uattrib= strtolower($config->current['MAIL_ATTRIB']); + if(in_array($new_uattrib,array("mail","uid"))){ + $this->uattrib = $new_uattrib; + }else{ + trigger_error(sprintf("Unsupported MAIL_ATTRIB in gosa configuration specified, use 'mail' or 'uid', instead of '%s'.",$new_uattrib)); + } } $this->config= $config->data['SERVERS']['IMAP']; diff --git a/include/class_mail-methods.inc b/include/class_mail-methods.inc index 9c7c428fe..ad317fd20 100644 --- a/include/class_mail-methods.inc +++ b/include/class_mail-methods.inc @@ -28,8 +28,13 @@ class mailMethod /* Check if the mail account identification attribute is overridden in the configuration file */ - if(isset($config->current['MAIL_ATTRIB'])){ - $this->uattrib = $config->current['MAIL_ATTRIB']; + if(isset($config->current['MAIL_ATTRIB']) && !empty($config->current['MAIL_ATTRIB'])){ + $new_uattrib= strtolower($config->current['MAIL_ATTRIB']); + if(in_array($new_uattrib,array("mail","uid"))){ + $this->uattrib = $new_uattrib; + }else{ + trigger_error(sprintf("Unsupported MAIL_ATTRIB in gosa configuration specified, use 'mail' or 'uid', instead of '%s'.", $new_uattrib)); + } } } -- 2.30.2