@@ -47,16 +47,20 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $ds = Ldap::factory(); |
| 49 | 49 | |
| 50 | - if(!is_resource($ds)) { |
|
| 50 | + if(!is_resource($ds)) |
|
| 51 | + { |
|
| 51 | 52 | return false; |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | $filter = '(&(objectclass=posixaccount)(uid='. $_username .')(dbmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))'; |
| 55 | 56 | $justthese = array('dn', 'objectclass', 'mailQuota'); |
| 56 | - if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) { |
|
| 57 | + if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) |
|
| 58 | + { |
|
| 57 | 59 | |
| 58 | - if(($info = ldap_get_entries($ds, $sri))) { |
|
| 59 | - if(isset($info[0]['mailquota'][0])) { |
|
| 60 | + if(($info = ldap_get_entries($ds, $sri))) |
|
| 61 | + { |
|
| 62 | + if(isset($info[0]['mailquota'][0])) |
|
| 63 | + { |
|
| 60 | 64 | $userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576; |
| 61 | 65 | } |
| 62 | 66 | } |
@@ -66,13 +70,15 @@ discard block |
||
| 66 | 70 | |
| 67 | 71 | function updateAccount($_hookValues) |
| 68 | 72 | { |
| 69 | - if(!$uidnumber = (int)$_hookValues['account_id']) { |
|
| 73 | + if(!$uidnumber = (int)$_hookValues['account_id']) |
|
| 74 | + { |
|
| 70 | 75 | return false; |
| 71 | 76 | } |
| 72 | 77 | |
| 73 | 78 | $ds = Ldap::factory(); |
| 74 | 79 | |
| 75 | - if(!is_resource($ds)) { |
|
| 80 | + if(!is_resource($ds)) |
|
| 81 | + { |
|
| 76 | 82 | return false; |
| 77 | 83 | } |
| 78 | 84 | |
@@ -80,8 +86,10 @@ discard block |
||
| 80 | 86 | $justthese = array('dn', 'objectclass', 'dbmailUID', 'dbmailGID', 'mail'); |
| 81 | 87 | $sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese); |
| 82 | 88 | |
| 83 | - if(($info = ldap_get_entries($ds, $sri))) { |
|
| 84 | - if((!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass'])) && $info[0]['mail']) { |
|
| 89 | + if(($info = ldap_get_entries($ds, $sri))) |
|
| 90 | + { |
|
| 91 | + if((!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass'])) && $info[0]['mail']) |
|
| 92 | + { |
|
| 85 | 93 | $newData['objectclass'] = $info[0]['objectclass']; |
| 86 | 94 | unset($newData['objectclass']['count']); |
| 87 | 95 | $newData['objectclass'][] = 'dbmailuser'; |
@@ -89,17 +97,21 @@ discard block |
||
| 89 | 97 | $newData['dbmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])); |
| 90 | 98 | $newData['dbmailUID'] = (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid']; |
| 91 | 99 | |
| 92 | - if(!ldap_modify($ds, $info[0]['dn'], $newData)) { |
|
| 100 | + if(!ldap_modify($ds, $info[0]['dn'], $newData)) |
|
| 101 | + { |
|
| 93 | 102 | #print ldap_error($ds); |
| 94 | 103 | } |
| 95 | 104 | |
| 96 | 105 | return true; |
| 97 | - } else { |
|
| 106 | + } |
|
| 107 | + else |
|
| 108 | + { |
|
| 98 | 109 | $newData = array(); |
| 99 | 110 | $newData['dbmailUID'] = (!empty($this->domainName)) ? $_hookValues['account_lid'] .'@'. $this->domainName : $_hookValues['account_lid']; |
| 100 | 111 | $newData['dbmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])); |
| 101 | 112 | |
| 102 | - if(!ldap_modify($ds, $info[0]['dn'], $newData)) { |
|
| 113 | + if(!ldap_modify($ds, $info[0]['dn'], $newData)) |
|
| 114 | + { |
|
| 103 | 115 | print ldap_error($ds); |
| 104 | 116 | _debug_array($newData); |
| 105 | 117 | exit; |
@@ -115,7 +127,8 @@ discard block |
||
| 115 | 127 | { |
| 116 | 128 | $ds = Ldap::factory(); |
| 117 | 129 | |
| 118 | - if(!is_resource($ds)) { |
|
| 130 | + if(!is_resource($ds)) |
|
| 131 | + { |
|
| 119 | 132 | return false; |
| 120 | 133 | } |
| 121 | 134 | |
@@ -123,13 +136,16 @@ discard block |
||
| 123 | 136 | $justthese = array('dn', 'objectclass', 'dbmailGID', 'dbmailUID', 'mail'); |
| 124 | 137 | $sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese); |
| 125 | 138 | |
| 126 | - if(($info = ldap_get_entries($ds, $sri))) { |
|
| 139 | + if(($info = ldap_get_entries($ds, $sri))) |
|
| 140 | + { |
|
| 127 | 141 | $validLDAPConfig = false; |
| 128 | - if(in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) { |
|
| 142 | + if(in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) |
|
| 143 | + { |
|
| 129 | 144 | $validLDAPConfig = true; |
| 130 | 145 | } |
| 131 | 146 | |
| 132 | - if(!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass']) && $info[0]['mail']) { |
|
| 147 | + if(!in_array('dbmailuser',$info[0]['objectclass']) && !in_array('dbmailUser',$info[0]['objectclass']) && $info[0]['mail']) |
|
| 148 | + { |
|
| 133 | 149 | $newData['objectclass'] = $info[0]['objectclass']; |
| 134 | 150 | unset($newData['objectclass']['count']); |
| 135 | 151 | $newData['objectclass'][] = 'dbmailUser'; |
@@ -137,41 +153,53 @@ discard block |
||
| 137 | 153 | $newData['dbmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])); |
| 138 | 154 | $newData['dbmailUID'] = (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username; |
| 139 | 155 | |
| 140 | - if(ldap_modify($ds, $info[0]['dn'], $newData)) { |
|
| 156 | + if(ldap_modify($ds, $info[0]['dn'], $newData)) |
|
| 157 | + { |
|
| 141 | 158 | $validLDAPConfig = true; |
| 142 | 159 | } |
| 143 | - } else { |
|
| 144 | - if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailuid']) { |
|
| 160 | + } |
|
| 161 | + else |
|
| 162 | + { |
|
| 163 | + if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailuid']) |
|
| 164 | + { |
|
| 145 | 165 | $newData = array(); |
| 146 | 166 | $newData['dbmailUID'] = (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username; |
| 147 | 167 | |
| 148 | - if(!ldap_modify($ds, $info[0]['dn'], $newData)) { |
|
| 168 | + if(!ldap_modify($ds, $info[0]['dn'], $newData)) |
|
| 169 | + { |
|
| 149 | 170 | #print ldap_error($ds); |
| 150 | 171 | #return false; |
| 151 | 172 | } |
| 152 | 173 | } |
| 153 | 174 | |
| 154 | - if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailgid']) { |
|
| 175 | + if ((in_array('dbmailuser',$info[0]['objectclass']) || in_array('dbmailUser',$info[0]['objectclass'])) && !$info[0]['dbmailgid']) |
|
| 176 | + { |
|
| 155 | 177 | $newData = array(); |
| 156 | 178 | $newData['dbmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])); |
| 157 | 179 | |
| 158 | - if(!ldap_modify($ds, $info[0]['dn'], $newData)) { |
|
| 180 | + if(!ldap_modify($ds, $info[0]['dn'], $newData)) |
|
| 181 | + { |
|
| 159 | 182 | #print ldap_error($ds); |
| 160 | 183 | #return false; |
| 161 | 184 | } |
| 162 | 185 | } |
| 163 | 186 | } |
| 164 | 187 | |
| 165 | - if($validLDAPConfig) { |
|
| 188 | + if($validLDAPConfig) |
|
| 189 | + { |
|
| 166 | 190 | $newData = array(); |
| 167 | 191 | |
| 168 | - if((int)$_quota >= 0) { |
|
| 192 | + if((int)$_quota >= 0) |
|
| 193 | + { |
|
| 169 | 194 | $newData['mailQuota'] = (int)$_quota * 1048576; |
| 170 | - } else { |
|
| 195 | + } |
|
| 196 | + else |
|
| 197 | + { |
|
| 171 | 198 | $newData['mailQuota'] = array(); |
| 172 | 199 | } |
| 173 | 200 | |
| 174 | - if(!ldap_modify($ds, $info[0]['dn'], $newData)) { |
|
| 201 | + if(!ldap_modify($ds, $info[0]['dn'], $newData)) |
|
| 202 | + { |
|
| 175 | 203 | #print ldap_error($ds); |
| 176 | 204 | return false; |
| 177 | 205 | } |
@@ -47,16 +47,20 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $ds = Ldap::factory(); |
| 49 | 49 | |
| 50 | - if(!is_resource($ds)) { |
|
| 50 | + if(!is_resource($ds)) |
|
| 51 | + { |
|
| 51 | 52 | return false; |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | $filter = '(&(objectclass=posixaccount)(uid='. $_username .')(qmailGID='. sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])) .'))'; |
| 55 | 56 | $justthese = array('dn', 'objectclass', 'mailQuota'); |
| 56 | - if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) { |
|
| 57 | + if(($sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese))) |
|
| 58 | + { |
|
| 57 | 59 | |
| 58 | - if(($info = ldap_get_entries($ds, $sri))) { |
|
| 59 | - if(isset($info[0]['mailquota'][0])) { |
|
| 60 | + if(($info = ldap_get_entries($ds, $sri))) |
|
| 61 | + { |
|
| 62 | + if(isset($info[0]['mailquota'][0])) |
|
| 63 | + { |
|
| 60 | 64 | $userData['quotaLimit'] = $info[0]['mailquota'][0] / 1048576; |
| 61 | 65 | } |
| 62 | 66 | } |
@@ -64,14 +68,17 @@ discard block |
||
| 64 | 68 | return $userData; |
| 65 | 69 | } |
| 66 | 70 | |
| 67 | - function updateAccount($_hookValues) { |
|
| 68 | - if(!$uidnumber = (int)$_hookValues['account_id']) { |
|
| 71 | + function updateAccount($_hookValues) |
|
| 72 | + { |
|
| 73 | + if(!$uidnumber = (int)$_hookValues['account_id']) |
|
| 74 | + { |
|
| 69 | 75 | return false; |
| 70 | 76 | } |
| 71 | 77 | |
| 72 | 78 | $ds = Ldap::factory(); |
| 73 | 79 | |
| 74 | - if(!is_resource($ds)) { |
|
| 80 | + if(!is_resource($ds)) |
|
| 81 | + { |
|
| 75 | 82 | return false; |
| 76 | 83 | } |
| 77 | 84 | |
@@ -79,8 +86,10 @@ discard block |
||
| 79 | 86 | $justthese = array('dn', 'objectclass', 'qmailUID', 'qmailGID', 'mail'); |
| 80 | 87 | $sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese); |
| 81 | 88 | |
| 82 | - if(($info = ldap_get_entries($ds, $sri))) { |
|
| 83 | - if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) { |
|
| 89 | + if(($info = ldap_get_entries($ds, $sri))) |
|
| 90 | + { |
|
| 91 | + if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) |
|
| 92 | + { |
|
| 84 | 93 | $newData['objectclass'] = $info[0]['objectclass']; |
| 85 | 94 | unset($newData['objectclass']['count']); |
| 86 | 95 | $newData['objectclass'][] = 'qmailuser'; |
@@ -91,12 +100,15 @@ discard block |
||
| 91 | 100 | ldap_modify($ds, $info[0]['dn'], $newData); |
| 92 | 101 | |
| 93 | 102 | return true; |
| 94 | - } else { |
|
| 103 | + } |
|
| 104 | + else |
|
| 105 | + { |
|
| 95 | 106 | $newData = array(); |
| 96 | 107 | $newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])); |
| 97 | 108 | #$newData['qmailUID'] = (!empty($this->domainName)) ? $_username .'@'. $this->domainName : $_username; |
| 98 | 109 | |
| 99 | - if(!ldap_modify($ds, $info[0]['dn'], $newData)) { |
|
| 110 | + if(!ldap_modify($ds, $info[0]['dn'], $newData)) |
|
| 111 | + { |
|
| 100 | 112 | #print ldap_error($ds); |
| 101 | 113 | #return false; |
| 102 | 114 | } |
@@ -106,10 +118,12 @@ discard block |
||
| 106 | 118 | return false; |
| 107 | 119 | } |
| 108 | 120 | |
| 109 | - function setUserData($_username, $_quota) { |
|
| 121 | + function setUserData($_username, $_quota) |
|
| 122 | + { |
|
| 110 | 123 | $ds = Ldap::factory(); |
| 111 | 124 | |
| 112 | - if(!is_resource($ds)) { |
|
| 125 | + if(!is_resource($ds)) |
|
| 126 | + { |
|
| 113 | 127 | return false; |
| 114 | 128 | } |
| 115 | 129 | |
@@ -117,9 +131,11 @@ discard block |
||
| 117 | 131 | $justthese = array('dn', 'objectclass', 'qmailGID', 'mail'); |
| 118 | 132 | $sri = ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context'], $filter, $justthese); |
| 119 | 133 | |
| 120 | - if(($info = ldap_get_entries($ds, $sri))) { |
|
| 134 | + if(($info = ldap_get_entries($ds, $sri))) |
|
| 135 | + { |
|
| 121 | 136 | #_debug_array($info); |
| 122 | - if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) { |
|
| 137 | + if(!in_array('qmailuser',$info[0]['objectclass']) && $info[0]['email']) |
|
| 138 | + { |
|
| 123 | 139 | $newData['objectclass'] = $info[0]['objectclass']; |
| 124 | 140 | unset($newData['objectclass']['count']); |
| 125 | 141 | $newData['objectclass'][] = 'qmailuser'; |
@@ -127,12 +143,16 @@ discard block |
||
| 127 | 143 | $newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])); |
| 128 | 144 | |
| 129 | 145 | ldap_modify($ds, $info[0]['dn'], $newData); |
| 130 | - } else { |
|
| 131 | - if (in_array('qmailuser',$info[0]['objectclass']) && !$info[0]['qmailgid']) { |
|
| 146 | + } |
|
| 147 | + else |
|
| 148 | + { |
|
| 149 | + if (in_array('qmailuser',$info[0]['objectclass']) && !$info[0]['qmailgid']) |
|
| 150 | + { |
|
| 132 | 151 | $newData = array(); |
| 133 | 152 | $newData['qmailGID'] = sprintf("%u", crc32($GLOBALS['egw_info']['server']['install_id'])); |
| 134 | 153 | |
| 135 | - if(!ldap_modify($ds, $info[0]['dn'], $newData)) { |
|
| 154 | + if(!ldap_modify($ds, $info[0]['dn'], $newData)) |
|
| 155 | + { |
|
| 136 | 156 | #print ldap_error($ds); |
| 137 | 157 | #return false; |
| 138 | 158 | } |
@@ -141,13 +161,17 @@ discard block |
||
| 141 | 161 | |
| 142 | 162 | $newData = array(); |
| 143 | 163 | |
| 144 | - if((int)$_quota >= 0) { |
|
| 164 | + if((int)$_quota >= 0) |
|
| 165 | + { |
|
| 145 | 166 | $newData['mailQuota'] = (int)$_quota * 1048576; |
| 146 | - } else { |
|
| 167 | + } |
|
| 168 | + else |
|
| 169 | + { |
|
| 147 | 170 | $newData['mailQuota'] = array(); |
| 148 | 171 | } |
| 149 | 172 | |
| 150 | - if(!ldap_modify($ds, $info[0]['dn'], $newData)) { |
|
| 173 | + if(!ldap_modify($ds, $info[0]['dn'], $newData)) |
|
| 174 | + { |
|
| 151 | 175 | #print ldap_error($ds); |
| 152 | 176 | return false; |
| 153 | 177 | } |
@@ -68,10 +68,13 @@ discard block |
||
| 68 | 68 | function adminConnection($_username=true) |
| 69 | 69 | { |
| 70 | 70 | // generate admin user name of $username |
| 71 | - if (($pos = strpos($this->acc_imap_admin_username, '*')) !== false) // remove evtl. set username |
|
| 71 | + if (($pos = strpos($this->acc_imap_admin_username, '*')) !== false) |
|
| 72 | + { |
|
| 73 | + // remove evtl. set username |
|
| 72 | 74 | { |
| 73 | 75 | $this->params['acc_imap_admin_username'] = substr($this->acc_imap_admin_username, $pos+1); |
| 74 | 76 | } |
| 77 | + } |
|
| 75 | 78 | $this->params['acc_imap_admin_username'] = (is_string($_username) ? $_username : $this->acc_imap_username). |
| 76 | 79 | '*'.$this->acc_imap_admin_username; |
| 77 | 80 | |
@@ -185,7 +188,10 @@ discard block |
||
| 185 | 188 | { |
| 186 | 189 | foreach(scandir($path) as $file) |
| 187 | 190 | { |
| 188 | - if ($file == '.' || $file == '..') continue; |
|
| 191 | + if ($file == '.' || $file == '..') |
|
| 192 | + { |
|
| 193 | + continue; |
|
| 194 | + } |
|
| 189 | 195 | |
| 190 | 196 | if (is_dir($path)) |
| 191 | 197 | { |
@@ -217,8 +223,14 @@ discard block |
||
| 217 | 223 | */ |
| 218 | 224 | function getUserData($_username) |
| 219 | 225 | { |
| 220 | - if (isset($this->username)) $bufferUsername = $this->username; |
|
| 221 | - if (isset($this->loginName)) $bufferLoginName = $this->loginName; |
|
| 226 | + if (isset($this->username)) |
|
| 227 | + { |
|
| 228 | + $bufferUsername = $this->username; |
|
| 229 | + } |
|
| 230 | + if (isset($this->loginName)) |
|
| 231 | + { |
|
| 232 | + $bufferLoginName = $this->loginName; |
|
| 233 | + } |
|
| 222 | 234 | $this->username = $this->loginName = $_username; |
| 223 | 235 | |
| 224 | 236 | // now disconnect to be able to reestablish the connection with the targetUser while we go on |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @return mixed Cached data, or false if none was found. |
| 39 | 39 | */ |
| 40 | 40 | public function get($key, $lifetime = 0) |
| 41 | - { |
|
| 41 | + { |
|
| 42 | 42 | unset($lifetime); // not (yet) used, but required by function signature |
| 43 | 43 | |
| 44 | 44 | $ret = Api\Cache::getCache(self::LEVEL, 'mail', $key); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * collection. If 0 will not be GC'd. |
| 57 | 57 | */ |
| 58 | 58 | public function set($key, $data, $lifetime = 0) |
| 59 | - { |
|
| 59 | + { |
|
| 60 | 60 | Api\Cache::setCache(self::LEVEL, 'mail', $key, $data, $lifetime); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return boolean Existence. |
| 71 | 71 | */ |
| 72 | 72 | public function exists($key, $lifetime = 0) |
| 73 | - { |
|
| 73 | + { |
|
| 74 | 74 | unset($lifetime); // not (yet) used, but required by function signature |
| 75 | 75 | |
| 76 | 76 | return !is_null(Api\Cache::getCache(self::LEVEL, 'mail', $key)); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @return boolean Success or failure. |
| 85 | 85 | */ |
| 86 | 86 | public function expire($key) |
| 87 | - { |
|
| 87 | + { |
|
| 88 | 88 | Api\Cache::unsetCache(self::LEVEL, 'mail', $key); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @throws Horde_Cache_Exception |
| 95 | 95 | */ |
| 96 | 96 | public function clear() |
| 97 | - { |
|
| 97 | + { |
|
| 98 | 98 | Api\Cache::flush(self::LEVEL, self::APP); |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -104,21 +104,30 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | function getRules() |
| 106 | 106 | { |
| 107 | - if (!isset($this->rules)) $this->retrieveRules(); |
|
| 107 | + if (!isset($this->rules)) |
|
| 108 | + { |
|
| 109 | + $this->retrieveRules(); |
|
| 110 | + } |
|
| 108 | 111 | |
| 109 | 112 | return $this->rules; |
| 110 | 113 | } |
| 111 | 114 | |
| 112 | 115 | function getVacation() |
| 113 | 116 | { |
| 114 | - if (!isset($this->rules)) $this->retrieveRules(); |
|
| 117 | + if (!isset($this->rules)) |
|
| 118 | + { |
|
| 119 | + $this->retrieveRules(); |
|
| 120 | + } |
|
| 115 | 121 | |
| 116 | 122 | return $this->vacation; |
| 117 | 123 | } |
| 118 | 124 | |
| 119 | 125 | function getEmailNotification() |
| 120 | 126 | { |
| 121 | - if (!isset($this->rules)) $this->retrieveRules(); |
|
| 127 | + if (!isset($this->rules)) |
|
| 128 | + { |
|
| 129 | + $this->retrieveRules(); |
|
| 130 | + } |
|
| 122 | 131 | |
| 123 | 132 | return $this->emailNotification; |
| 124 | 133 | } |
@@ -169,7 +178,8 @@ discard block |
||
| 169 | 178 | */ |
| 170 | 179 | function setEmailNotification(array $_emailNotification, $_scriptName=null) |
| 171 | 180 | { |
| 172 | - if ($_emailNotification['externalEmail'] == '' || !preg_match("/\@/",$_emailNotification['externalEmail'])) { |
|
| 181 | + if ($_emailNotification['externalEmail'] == '' || !preg_match("/\@/",$_emailNotification['externalEmail'])) |
|
| 182 | + { |
|
| 173 | 183 | $_emailNotification['status'] = 'off'; |
| 174 | 184 | $_emailNotification['externalEmail'] = ''; |
| 175 | 185 | } |
@@ -94,7 +94,10 @@ discard block |
||
| 94 | 94 | ); |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | - if ($this->debug) error_log(__METHOD__."('$_accountName') returning ".array2string($emailAddresses)); |
|
| 97 | + if ($this->debug) |
|
| 98 | + { |
|
| 99 | + error_log(__METHOD__."('$_accountName') returning ".array2string($emailAddresses)); |
|
| 100 | + } |
|
| 98 | 101 | |
| 99 | 102 | return $emailAddresses; |
| 100 | 103 | } |
@@ -145,7 +148,10 @@ discard block |
||
| 145 | 148 | 'mail_value' => $user, |
| 146 | 149 | ), __LINE__, __FILE__, false, '', self::APP) as $row) |
| 147 | 150 | { |
| 148 | - if (!in_array($row['account_id'], $account_id)) $account_id[] = $row['account_id']; |
|
| 151 | + if (!in_array($row['account_id'], $account_id)) |
|
| 152 | + { |
|
| 153 | + $account_id[] = $row['account_id']; |
|
| 154 | + } |
|
| 149 | 155 | } |
| 150 | 156 | //error_log(__METHOD__."('$user') account_id=".array2string($account_id)); |
| 151 | 157 | } |
@@ -218,7 +224,10 @@ discard block |
||
| 218 | 224 | } |
| 219 | 225 | } |
| 220 | 226 | } |
| 221 | - if ($this->debug) error_log(__METHOD__."('$user') returning ".array2string($userData)); |
|
| 227 | + if ($this->debug) |
|
| 228 | + { |
|
| 229 | + error_log(__METHOD__."('$user') returning ".array2string($userData)); |
|
| 230 | + } |
|
| 222 | 231 | |
| 223 | 232 | return $userData; |
| 224 | 233 | } |
@@ -240,7 +249,10 @@ discard block |
||
| 240 | 249 | function setUserData($_uidnumber, array $_mailAlternateAddress, array $_mailForwardingAddress, $_deliveryMode, |
| 241 | 250 | $_accountStatus, $_mailLocalAddress, $_quota, $_forwarding_only=false, $_setMailbox=null) |
| 242 | 251 | { |
| 243 | - if ($this->debug) error_log(__METHOD__."($_uidnumber, ".array2string($_mailAlternateAddress).', '.array2string($_mailForwardingAddress).", '$_deliveryMode', '$_accountStatus', '$_mailLocalAddress', $_quota, forwarding_only=".array2string($_forwarding_only).') '.function_backtrace()); |
|
| 252 | + if ($this->debug) |
|
| 253 | + { |
|
| 254 | + error_log(__METHOD__."($_uidnumber, ".array2string($_mailAlternateAddress).', '.array2string($_mailForwardingAddress).", '$_deliveryMode', '$_accountStatus', '$_mailLocalAddress', $_quota, forwarding_only=".array2string($_forwarding_only).') '.function_backtrace()); |
|
| 255 | + } |
|
| 244 | 256 | |
| 245 | 257 | if (!$_forwarding_only && $this->accounts->id2name($_uidnumber, 'account_email') !== $_mailLocalAddress) |
| 246 | 258 | { |
@@ -254,7 +266,10 @@ discard block |
||
| 254 | 266 | self::TYPE_QUOTA => $_quota, |
| 255 | 267 | ); |
| 256 | 268 | $where = array('account_id' => $_uidnumber); |
| 257 | - if ($_forwarding_only) $where['mail_type'] = array(self::TYPE_FORWARD, self::TYPE_DELIVERY); |
|
| 269 | + if ($_forwarding_only) |
|
| 270 | + { |
|
| 271 | + $where['mail_type'] = array(self::TYPE_FORWARD, self::TYPE_DELIVERY); |
|
| 272 | + } |
|
| 258 | 273 | // find all invalid values: either delete or update them |
| 259 | 274 | $delete_ids = array(); |
| 260 | 275 | foreach($this->db->select(self::TABLE, '*', $where, __LINE__, __FILE__, false, '', self::APP) as $row) |
@@ -265,7 +280,10 @@ discard block |
||
| 265 | 280 | $new_addresses =& $_mailAlternateAddress; |
| 266 | 281 | // fall-throught |
| 267 | 282 | case self::TYPE_FORWARD: |
| 268 | - if ($row['mail_type'] == self::TYPE_FORWARD) $new_addresses =& $_mailForwardingAddress; |
|
| 283 | + if ($row['mail_type'] == self::TYPE_FORWARD) |
|
| 284 | + { |
|
| 285 | + $new_addresses =& $_mailForwardingAddress; |
|
| 286 | + } |
|
| 269 | 287 | if (($key = array_search($row['mail_value'], $new_addresses)) === false) |
| 270 | 288 | { |
| 271 | 289 | $delete_ids[] = $row['mail_id']; |
@@ -367,7 +385,11 @@ discard block |
||
| 367 | 385 | self::TABLE.'.mail_type='.self::TYPE_MAILBOX, |
| 368 | 386 | __LINE__, __FILE__, false, 'ORDER BY account_lid', self::APP, 0, $join) as $row) |
| 369 | 387 | { |
| 370 | - if ($row['uid'] == 'anonymous') continue; // anonymous is never a mail-user! |
|
| 388 | + if ($row['uid'] == 'anonymous') |
|
| 389 | + { |
|
| 390 | + continue; |
|
| 391 | + } |
|
| 392 | + // anonymous is never a mail-user! |
|
| 371 | 393 | list($mailbox) = explode('@', $row['mailbox']); |
| 372 | 394 | $mailboxes[$row['uid']] = $mailbox; |
| 373 | 395 | } |
@@ -84,7 +84,11 @@ |
||
| 84 | 84 | { |
| 85 | 85 | foreach(Account::search((int)$data['account_id'], 'params') as $params) |
| 86 | 86 | { |
| 87 | - if (!Account::is_multiple($params)) continue; // no need to waste time on personal accounts |
|
| 87 | + if (!Account::is_multiple($params)) |
|
| 88 | + { |
|
| 89 | + continue; |
|
| 90 | + } |
|
| 91 | + // no need to waste time on personal accounts |
|
| 88 | 92 | |
| 89 | 93 | try { |
| 90 | 94 | $account = new Account($params); |
@@ -33,10 +33,14 @@ discard block |
||
| 33 | 33 | 'extended' => $extended, |
| 34 | 34 | ), array('managementserver'), true) as $app => $data) |
| 35 | 35 | { |
| 36 | - if ($data && $app != 'emailadmin') $retData += $data; |
|
| 36 | + if ($data && $app != 'emailadmin') |
|
| 37 | + { |
|
| 38 | + $retData += $data; |
|
| 39 | + } |
|
| 37 | 40 | } |
| 38 | 41 | |
| 39 | - uksort($retData, function($a, $b) { |
|
| 42 | + uksort($retData, function($a, $b) |
|
| 43 | + { |
|
| 40 | 44 | static $prio = array( // not explicitly mentioned get 0 |
| 41 | 45 | 'EGroupware\\Api\\Mail\\Smtp' => 9, |
| 42 | 46 | 'EGroupware\\Api\\Mail\\Smtp\\Sql' => 8, |
@@ -63,9 +67,13 @@ discard block |
||
| 63 | 67 | 'extended' => $extended, |
| 64 | 68 | ), array('managementserver'), true) as $app => $data) |
| 65 | 69 | { |
| 66 | - if ($data && $app != 'emailadmin') $retData += $data; |
|
| 70 | + if ($data && $app != 'emailadmin') |
|
| 71 | + { |
|
| 72 | + $retData += $data; |
|
| 73 | + } |
|
| 67 | 74 | } |
| 68 | - uksort($retData, function($a, $b) { |
|
| 75 | + uksort($retData, function($a, $b) |
|
| 76 | + { |
|
| 69 | 77 | static $prio = array( // not explicitly mentioned get 0 |
| 70 | 78 | 'EGroupware\\Api\\Mail\\Imap' => 9, |
| 71 | 79 | 'managementserver_imap' => 8, |
@@ -102,13 +110,19 @@ discard block |
||
| 102 | 110 | { |
| 103 | 111 | continue; |
| 104 | 112 | } |
| 105 | - if (!class_exists($class_name)) continue; |
|
| 113 | + if (!class_exists($class_name)) |
|
| 114 | + { |
|
| 115 | + continue; |
|
| 116 | + } |
|
| 106 | 117 | |
| 107 | 118 | $type = array( |
| 108 | 119 | 'classname' => $class_name, |
| 109 | 120 | 'description' => is_callable($function=$class_name.'::description') ? call_user_func($function) : $class_name, |
| 110 | 121 | ); |
| 111 | - if ($imap) $type['protocol'] = 'imap'; |
|
| 122 | + if ($imap) |
|
| 123 | + { |
|
| 124 | + $type['protocol'] = 'imap'; |
|
| 125 | + } |
|
| 112 | 126 | |
| 113 | 127 | $types[$class_name] = $extended ? $type : $type['description']; |
| 114 | 128 | } |
@@ -88,7 +88,10 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | $folders = (array)self::$cache[$acc_id][$account_specific]; |
| 91 | - if (!$return_empty_marker && $folders == array(null)) $folders = array(); |
|
| 91 | + if (!$return_empty_marker && $folders == array(null)) |
|
| 92 | + { |
|
| 93 | + $folders = array(); |
|
| 94 | + } |
|
| 92 | 95 | $result = array( |
| 93 | 96 | 'notify_folders' => $folders, |
| 94 | 97 | 'notify_account_id' => $account_specific, |
@@ -117,7 +120,11 @@ discard block |
||
| 117 | 120 | $folders[] = null; // we need to write a marker, that user wants no notifications! |
| 118 | 121 | } |
| 119 | 122 | $old = self::read($acc_id, $account_id, true); // true = return empty marker |
| 120 | - if ($account_id && !$old['notify_account_id']) $old['notify_folders'] = array(); // ignore returned default |
|
| 123 | + if ($account_id && !$old['notify_account_id']) |
|
| 124 | + { |
|
| 125 | + $old['notify_folders'] = array(); |
|
| 126 | + } |
|
| 127 | + // ignore returned default |
|
| 121 | 128 | |
| 122 | 129 | $changed = 0; |
| 123 | 130 | // insert newly added ones |
@@ -163,8 +170,14 @@ discard block |
||
| 163 | 170 | throw new Api\Exception\WrongParameter(__METHOD__."() no acc_id AND no account_id parameter!"); |
| 164 | 171 | } |
| 165 | 172 | $where = array(); |
| 166 | - if ($acc_id > 0) $where['acc_id'] = $acc_id; |
|
| 167 | - if (isset($account_id)) $where['account_id'] = $account_id; |
|
| 173 | + if ($acc_id > 0) |
|
| 174 | + { |
|
| 175 | + $where['acc_id'] = $acc_id; |
|
| 176 | + } |
|
| 177 | + if (isset($account_id)) |
|
| 178 | + { |
|
| 179 | + $where['account_id'] = $account_id; |
|
| 180 | + } |
|
| 168 | 181 | |
| 169 | 182 | self::$db->delete(self::TABLE, $where, __LINE__, __FILE__, self::APP); |
| 170 | 183 | |