forked from extern/egroupware
* PostgreSQL/Setup/EMailAdmin: fixed Setup >> Configuration was not storing anything
caused by egw_emailadmin.ea_(user|group) is varchar (for whatever reason) and postgres never returned a default profile
This commit is contained in:
parent
8dc0cc4e05
commit
9b7d0f0b17
@ -83,7 +83,7 @@
|
|||||||
foreach($vals as $key => $val)
|
foreach($vals as $key => $val)
|
||||||
{
|
{
|
||||||
if (($k = array_search($key,$this->db_cols)) === false) $k = $key;
|
if (($k = array_search($key,$this->db_cols)) === false) $k = $key;
|
||||||
|
|
||||||
$cols[$k] = $val;
|
$cols[$k] = $val;
|
||||||
}
|
}
|
||||||
return $cols;
|
return $cols;
|
||||||
@ -101,7 +101,7 @@
|
|||||||
foreach($cols as $key => $val)
|
foreach($cols as $key => $val)
|
||||||
{
|
{
|
||||||
if (isset($this->db_cols[$key])) $key = $this->db_cols[$key];
|
if (isset($this->db_cols[$key])) $key = $this->db_cols[$key];
|
||||||
|
|
||||||
$vals[$key] = $val;
|
$vals[$key] = $val;
|
||||||
}
|
}
|
||||||
return $vals;
|
return $vals;
|
||||||
@ -135,18 +135,18 @@
|
|||||||
{
|
{
|
||||||
$_fieldNames = array_keys($this->vals2db(array_flip($_fieldNames)));
|
$_fieldNames = array_keys($this->vals2db(array_flip($_fieldNames)));
|
||||||
$this->db->select($this->table,$_fieldNames,array('ea_profile_id' => $_profileID), __LINE__, __FILE__);
|
$this->db->select($this->table,$_fieldNames,array('ea_profile_id' => $_profileID), __LINE__, __FILE__);
|
||||||
|
|
||||||
if (($data = $this->db->row(true))) {
|
if (($data = $this->db->row(true))) {
|
||||||
return $this->db2vals($data);
|
return $this->db2vals($data);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserProfile($_appName, $_groups, $_user = NULL)
|
function getUserProfile($_appName, $_groups, $_user = NULL)
|
||||||
{
|
{
|
||||||
if(empty($_appName) || !is_array($_groups))
|
if(empty($_appName) || !is_array($_groups))
|
||||||
return false;
|
return false;
|
||||||
if (!empty($_user)) {
|
if (!empty($_user)) {
|
||||||
$where = $this->db->expression(
|
$where = $this->db->expression(
|
||||||
$this->table,'(',
|
$this->table,'(',
|
||||||
array('ea_appname'=>$_appName),
|
array('ea_appname'=>$_appName),
|
||||||
@ -218,15 +218,15 @@
|
|||||||
*/
|
*/
|
||||||
static function mergeProfileData($mergeInTo, $toMerge)
|
static function mergeProfileData($mergeInTo, $toMerge)
|
||||||
{
|
{
|
||||||
if (is_array($toMerge) && count($toMerge)>0)
|
if (is_array($toMerge) && count($toMerge)>0)
|
||||||
{
|
{
|
||||||
$allkeys = array_unique(array_keys($mergeInTo)+array_keys($toMerge));
|
$allkeys = array_unique(array_keys($mergeInTo)+array_keys($toMerge));
|
||||||
foreach ($allkeys as $i => $key) {
|
foreach ($allkeys as $i => $key) {
|
||||||
if (!array_key_exists($key, $mergeInTo) && array_key_exists($key, $toMerge) && !empty($toMerge[$key]))
|
if (!array_key_exists($key, $mergeInTo) && array_key_exists($key, $toMerge) && !empty($toMerge[$key]))
|
||||||
{
|
{
|
||||||
$mergeInTo[$key]=$toMerge[$key];
|
$mergeInTo[$key]=$toMerge[$key];
|
||||||
} else {
|
} else {
|
||||||
if (array_key_exists($key, $toMerge) && !empty($toMerge[$key]))
|
if (array_key_exists($key, $toMerge) && !empty($toMerge[$key]))
|
||||||
{
|
{
|
||||||
#error_log($key.'->'.$toMerge[$key]);
|
#error_log($key.'->'.$toMerge[$key]);
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
@ -254,10 +254,10 @@
|
|||||||
case 'smtpServer':
|
case 'smtpServer':
|
||||||
if (strlen($toMerge['smtpServer'])>0) $mergeInTo[$key]=$toMerge[$key];
|
if (strlen($toMerge['smtpServer'])>0) $mergeInTo[$key]=$toMerge[$key];
|
||||||
break;
|
break;
|
||||||
case 'smtpLDAPServer':
|
case 'smtpLDAPServer':
|
||||||
case 'smtpLDAPBaseDN':
|
case 'smtpLDAPBaseDN':
|
||||||
case 'smtpLDAPAdminDN':
|
case 'smtpLDAPAdminDN':
|
||||||
case 'smtpLDAPAdminPW':
|
case 'smtpLDAPAdminPW':
|
||||||
case 'smtpLDAPUseDefault':
|
case 'smtpLDAPUseDefault':
|
||||||
if (strlen($toMerge['smtpLDAPServer'])>0) $mergeInTo[$key]=$toMerge[$key];
|
if (strlen($toMerge['smtpLDAPServer'])>0) $mergeInTo[$key]=$toMerge[$key];
|
||||||
break;
|
break;
|
||||||
@ -274,9 +274,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $mergeInTo;
|
return $mergeInTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProfileList($_profileID=0,$_defaultProfile=false,$_appName=false,$_groupID=false,$_accountID=false)
|
function getProfileList($_profileID=0,$_defaultProfile=false,$_appName=false,$_groupID=false,$_accountID=false)
|
||||||
{
|
{
|
||||||
$where = false;
|
$where = false;
|
||||||
@ -287,8 +287,8 @@
|
|||||||
elseif ($_defaultProfile)
|
elseif ($_defaultProfile)
|
||||||
{
|
{
|
||||||
$where[] = "(ea_appname ='' or ea_appname is NULL)";
|
$where[] = "(ea_appname ='' or ea_appname is NULL)";
|
||||||
$where[] = "(ea_group=0 or ea_group is NULL)";
|
$where[] = "(ea_group='0' or ea_group is NULL)"; // ea_group&ea_user are varchar!
|
||||||
$where[] = "(ea_user =0 or ea_user is NULL)";
|
$where[] = "(ea_user ='0' or ea_user is NULL)";
|
||||||
}
|
}
|
||||||
elseif ($_appName)
|
elseif ($_appName)
|
||||||
{
|
{
|
||||||
@ -315,7 +315,7 @@
|
|||||||
function getUserData($_accountID)
|
function getUserData($_accountID)
|
||||||
{
|
{
|
||||||
$ldap = $GLOBALS['egw']->common->ldapConnect();
|
$ldap = $GLOBALS['egw']->common->ldapConnect();
|
||||||
|
|
||||||
if (($sri = @ldap_search($ldap,$GLOBALS['egw_info']['server']['ldap_context'],"(uidnumber=$_accountID)")))
|
if (($sri = @ldap_search($ldap,$GLOBALS['egw_info']['server']['ldap_context'],"(uidnumber=$_accountID)")))
|
||||||
{
|
{
|
||||||
$allValues = ldap_get_entries($ldap, $sri);
|
$allValues = ldap_get_entries($ldap, $sri);
|
||||||
@ -331,16 +331,16 @@
|
|||||||
$userData["deliveryMode"] = $allValues[0]["deliverymode"][0];
|
$userData["deliveryMode"] = $allValues[0]["deliverymode"][0];
|
||||||
|
|
||||||
unset($userData["mailAlternateAddress"]["count"]);
|
unset($userData["mailAlternateAddress"]["count"]);
|
||||||
unset($userData["mailRoutingAddress"]["count"]);
|
unset($userData["mailRoutingAddress"]["count"]);
|
||||||
|
|
||||||
return $userData;
|
return $userData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we did not return before, return false
|
// if we did not return before, return false
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveUserData($_accountID, $_accountData)
|
function saveUserData($_accountID, $_accountData)
|
||||||
{
|
{
|
||||||
$ldap = $GLOBALS['egw']->common->ldapConnect();
|
$ldap = $GLOBALS['egw']->common->ldapConnect();
|
||||||
@ -362,21 +362,21 @@
|
|||||||
$uid = $allValues[0]['uid'][0];
|
$uid = $allValues[0]['uid'][0];
|
||||||
$homedirectory = $allValues[0]['homedirectory'][0];
|
$homedirectory = $allValues[0]['homedirectory'][0];
|
||||||
$objectClasses = $allValues[0]['objectclass'];
|
$objectClasses = $allValues[0]['objectclass'];
|
||||||
|
|
||||||
unset($objectClasses['count']);
|
unset($objectClasses['count']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($homedirectory))
|
if(empty($homedirectory))
|
||||||
{
|
{
|
||||||
$homedirectory = "/home/".$uid;
|
$homedirectory = "/home/".$uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the old code for qmail ldap
|
// the old code for qmail ldap
|
||||||
$newData = array
|
$newData = array
|
||||||
(
|
(
|
||||||
'mail' => $_accountData["mailLocalAddress"],
|
'mail' => $_accountData["mailLocalAddress"],
|
||||||
'mailAlternateAddress' => $_accountData["mailAlternateAddress"],
|
'mailAlternateAddress' => $_accountData["mailAlternateAddress"],
|
||||||
@ -387,15 +387,15 @@
|
|||||||
'qmailDotMode' => $_accountData["qmailDotMode"],
|
'qmailDotMode' => $_accountData["qmailDotMode"],
|
||||||
'deliveryProgramPath' => $_accountData["deliveryProgramPath"]
|
'deliveryProgramPath' => $_accountData["deliveryProgramPath"]
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!in_array('qmailUser',$objectClasses) &&
|
if(!in_array('qmailUser',$objectClasses) &&
|
||||||
!in_array('qmailuser',$objectClasses))
|
!in_array('qmailuser',$objectClasses))
|
||||||
{
|
{
|
||||||
$objectClasses[] = 'qmailuser';
|
$objectClasses[] = 'qmailuser';
|
||||||
}
|
}
|
||||||
|
|
||||||
// the new code for postfix+cyrus+ldap
|
// the new code for postfix+cyrus+ldap
|
||||||
$newData = array
|
$newData = array
|
||||||
(
|
(
|
||||||
'mail' => $_accountData["mailLocalAddress"],
|
'mail' => $_accountData["mailLocalAddress"],
|
||||||
'accountStatus' => $_accountData["accountStatus"],
|
'accountStatus' => $_accountData["accountStatus"],
|
||||||
@ -403,7 +403,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
if(is_array($_accountData["mailAlternateAddress"]))
|
if(is_array($_accountData["mailAlternateAddress"]))
|
||||||
{
|
{
|
||||||
$newData['mailAlternateAddress'] = $_accountData["mailAlternateAddress"];
|
$newData['mailAlternateAddress'] = $_accountData["mailAlternateAddress"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -412,7 +412,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($_accountData["accountStatus"] == 'active')
|
if($_accountData["accountStatus"] == 'active')
|
||||||
{
|
{
|
||||||
$newData['accountStatus'] = 'active';
|
$newData['accountStatus'] = 'active';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -421,7 +421,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($_accountData["deliveryMode"]))
|
if(!empty($_accountData["deliveryMode"]))
|
||||||
{
|
{
|
||||||
$newData['deliveryMode'] = $_accountData["deliveryMode"];
|
$newData['deliveryMode'] = $_accountData["deliveryMode"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -431,18 +431,18 @@
|
|||||||
|
|
||||||
|
|
||||||
if(is_array($_accountData["mailRoutingAddress"]))
|
if(is_array($_accountData["mailRoutingAddress"]))
|
||||||
{
|
{
|
||||||
$newData['mailForwardingAddress'] = $_accountData["mailRoutingAddress"];
|
$newData['mailForwardingAddress'] = $_accountData["mailRoutingAddress"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$newData['mailForwardingAddress'] = array();
|
$newData['mailForwardingAddress'] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
#print "DN: $accountDN<br>";
|
#print "DN: $accountDN<br>";
|
||||||
ldap_mod_replace ($ldap, $accountDN, $newData);
|
ldap_mod_replace ($ldap, $accountDN, $newData);
|
||||||
#print ldap_error($ldap);
|
#print ldap_error($ldap);
|
||||||
|
|
||||||
// also update the account_email field in egw_accounts
|
// also update the account_email field in egw_accounts
|
||||||
// when using sql account storage
|
// when using sql account storage
|
||||||
if($GLOBALS['egw_info']['server']['account_repository'] == 'sql')
|
if($GLOBALS['egw_info']['server']['account_repository'] == 'sql')
|
||||||
@ -456,6 +456,6 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user