mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-03-11 21:50:15 +01:00
using now emailadmin_smtp constants for internally used values for deliveryMode and accountStatus, fixing not working forward-only mode because of wrong case of values, ldap classes now ignore case to deal with existing data
This commit is contained in:
parent
42660ddfa1
commit
09e44d87fe
@ -22,13 +22,17 @@ class emailadmin_smtp
|
||||
|
||||
/**
|
||||
* Attribute value to enable mail for an account, OR false if existense of attribute is enough to enable account
|
||||
*
|
||||
* Logical values uses inside EGroupware, different classes might store different values internally
|
||||
*/
|
||||
const MAIL_ENABLED = 'active';
|
||||
|
||||
/**
|
||||
* Attribute value to only forward mail
|
||||
*
|
||||
* Logical values uses inside EGroupware, different classes might store different values internally
|
||||
*/
|
||||
const FORWARD_ONLY = 'forwardonly';
|
||||
const FORWARD_ONLY = 'forwardOnly';
|
||||
|
||||
/**
|
||||
* Reference to global account object
|
||||
|
@ -296,26 +296,26 @@ class emailadmin_smtp_ldap extends emailadmin_smtp
|
||||
// groups are always active (if they have an email) and allways forwardOnly
|
||||
if (in_array('posixGroup', $values['objectclass']))
|
||||
{
|
||||
$accountStatus = 'active';
|
||||
$deliveryMode = 'forwardOnly';
|
||||
$accountStatus = emailadmin_smtp::MAIL_ENABLED;
|
||||
$deliveryMode = emailadmin_smtp::FORWARD_ONLY;
|
||||
}
|
||||
else // for users we have to check the attributes
|
||||
{
|
||||
if ($this->config['mail_enable_attr'])
|
||||
{
|
||||
$accountStatus = isset($values[$this->config['mail_enable_attr']]) &&
|
||||
($this->config['mail_enabled'] && $values[$this->config['mail_enable_attr']][0] == $this->config['mail_enabled'] ||
|
||||
!$this->config['mail_enabled'] && $values[$this->config['alias_attr']]['count'] > 0) ? 'active' : '';
|
||||
($this->config['mail_enabled'] && !strcasecmp($values[$this->config['mail_enable_attr']][0], $this->config['mail_enabled']) ||
|
||||
!$this->config['mail_enabled'] && $values[$this->config['alias_attr']]['count'] > 0) ? emailadmin_smtp::MAIL_ENABLED : '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$accountStatus = $values[$this->config['alias_attr']]['count'] > 0 ? 'active' : '';
|
||||
$accountStatus = $values[$this->config['alias_attr']]['count'] > 0 ? emailadmin_smtp::MAIL_ENABLED : '';
|
||||
}
|
||||
if ($this->config['forward_only_attr'])
|
||||
{
|
||||
$deliveryMode = isset($values[$this->config['forward_only_attr']]) &&
|
||||
($this->config['forward_only'] && $values[$this->config['forward_only_attr']][0] == $this->config['forward_only'] ||
|
||||
!$this->config['forward_only'] && $values[$this->config['forward_only_attr']]['count'] > 0) ? 'forwardOnly' : '';
|
||||
($this->config['forward_only'] && !strcasecmp($values[$this->config['forward_only_attr']][0], $this->config['forward_only']) ||
|
||||
!$this->config['forward_only'] && $values[$this->config['forward_only_attr']]['count'] > 0) ? emailadmin_smtp::FORWARD_ONLY : '';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -327,7 +327,7 @@ class emailadmin_smtp_ldap extends emailadmin_smtp
|
||||
if ($accountStatus)
|
||||
{
|
||||
// groups never have a mailbox, accounts can have a deliveryMode of "forwardOnly"
|
||||
if ($deliveryMode != 'forwardOnly')
|
||||
if ($deliveryMode != emailadmin_smtp::FORWARD_ONLY)
|
||||
{
|
||||
$userData['uid'][] = $values['uid'][0];
|
||||
if ($this->config['mailbox_attr'] && isset($values[$this->config['mailbox_attr']]))
|
||||
@ -369,8 +369,8 @@ class emailadmin_smtp_ldap extends emailadmin_smtp
|
||||
if ($this->config['forward_only_attr'])
|
||||
{
|
||||
$userData['deliveryMode'] = isset($values[$this->config['forward_only_attr']]) &&
|
||||
($this->config['forward_only'] && $values[$this->config['forward_only_attr']][0] == $this->config['forward_only'] ||
|
||||
!$this->config['forward_only'] && $values[$this->config['forward_only_attr']]['count'] > 0) ? 'forwardOnly' : '';
|
||||
($this->config['forward_only'] && !strcasecmp($values[$this->config['forward_only_attr']][0], $this->config['forward_only']) ||
|
||||
!$this->config['forward_only'] && $values[$this->config['forward_only_attr']]['count'] > 0) ? emailadmin_smtp::FORWARD_ONLY : '';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -157,8 +157,8 @@ class emailadmin_smtp_sql extends emailadmin_smtp
|
||||
break;
|
||||
|
||||
case self::TYPE_DELIVERY:
|
||||
$userData['deliveryMode'] = $row['mail_value'];
|
||||
$forwardOnly[$row['account_id']] = $row['mail_value'] == self::FORWARD_ONLY;
|
||||
$userData['deliveryMode'] = !strcasecmp($row['mail_value'], self::FORWARD_ONLY) ? emailadmin_smtp::FORWARD_ONLY : '';
|
||||
$forwardOnly[$row['account_id']] = !strcasecmp($row['mail_value'], self::FORWARD_ONLY);
|
||||
break;
|
||||
|
||||
case self::TYPE_QUOTA:
|
||||
|
@ -57,7 +57,7 @@ class postfixldap extends emailadmin_smtp_ldap
|
||||
/**
|
||||
* Attribute value to only forward mail
|
||||
*/
|
||||
const FORWARD_ONLY = 'forwardonly';
|
||||
const FORWARD_ONLY = 'forwardOnly';
|
||||
|
||||
/**
|
||||
* Attribute for mailbox, to which mail gets delivered OR false if not supported
|
||||
|
@ -126,11 +126,11 @@ class uiuserdata
|
||||
$this->t->set_var("deliveryProgramPath",$userData["deliveryProgramPath"]);
|
||||
|
||||
$this->t->set_var("uid",rawurlencode($_accountData["dn"]));
|
||||
if ($userData["accountStatus"] == "active")
|
||||
if ($userData["accountStatus"] == emailadmin_smtp::MAIL_ENABLED)
|
||||
$this->t->set_var("account_checked","checked");
|
||||
if ($userData["deliveryMode"] == "forwardOnly")
|
||||
if ($userData["deliveryMode"] == emailadmin_smtp::FORWARD_ONLY)
|
||||
$this->t->set_var("forwardOnly_checked","checked");
|
||||
if ($_accountData["deliverExtern"] == "active")
|
||||
if ($_accountData["deliverExtern"] == emailadmin_smtp::MAIL_ENABLED)
|
||||
$this->t->set_var("deliver_checked","checked");
|
||||
} else {
|
||||
$this->t->set_var("mailLocalAddress",'');
|
||||
@ -173,11 +173,11 @@ class uiuserdata
|
||||
function saveUserData()
|
||||
{
|
||||
if($_POST["accountStatus"] == "on") {
|
||||
$accountStatus = "active";
|
||||
$accountStatus = emailadmin_smtp::MAIL_ENABLED;
|
||||
}
|
||||
|
||||
if($_POST["forwardOnly"] == "on") {
|
||||
$deliveryMode = "forwardOnly";
|
||||
$deliveryMode = emailadmin_smtp::FORWARD_ONLY;
|
||||
}
|
||||
|
||||
$formData = array (
|
||||
|
Loading…
Reference in New Issue
Block a user