Completed
Push — master ( c85f1f...df263c )
by Ralf
74:39 queued 51:38
created
api/src/Mail/Imap/Dbmailqmailuser.php 1 patch
Braces   +45 added lines, -21 removed lines patch added patch discarded remove patch
@@ -47,16 +47,20 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 			}
Please login to merge, or discard this patch.
api/src/Mail/Imap/Dovecot.php 1 patch
Braces   +16 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,10 +68,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
api/src/Mail/Cache.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
api/src/Mail/Sieve.php 1 patch
Braces   +14 added lines, -4 removed lines patch added patch discarded remove patch
@@ -104,21 +104,30 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     	}
Please login to merge, or discard this patch.
api/src/Mail/Hooks.php 1 patch
Braces   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,11 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
api/src/Mail/Types.php 1 patch
Braces   +20 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,10 +33,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
api/src/Mail/Notifications.php 1 patch
Braces   +17 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
api/src/Ldap.php 1 patch
Braces   +36 added lines, -9 removed lines patch added patch discarded remove patch
@@ -129,12 +129,18 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	static function result2array($ldap)
131 131
 	{
132
-		if (!is_array($ldap)) return false;
132
+		if (!is_array($ldap))
133
+		{
134
+			return false;
135
+		}
133 136
 
134 137
 		$arr = array();
135 138
 		foreach($ldap as $var => $val)
136 139
 		{
137
-			if (is_int($var) || $var == 'count') continue;
140
+			if (is_int($var) || $var == 'count')
141
+			{
142
+				continue;
143
+			}
138 144
 
139 145
 			if (is_array($val) && $val['count'] == 1)
140 146
 			{
@@ -142,7 +148,10 @@  discard block
 block discarded – undo
142 148
 			}
143 149
 			else
144 150
 			{
145
-				if (is_array($val)) unset($val['count']);
151
+				if (is_array($val))
152
+				{
153
+					unset($val['count']);
154
+				}
146 155
 
147 156
 				$arr[$var] = $val;
148 157
 			}
@@ -168,7 +177,10 @@  discard block
 block discarded – undo
168 177
 	{
169 178
 		if(!function_exists('ldap_connect'))
170 179
 		{
171
-			if ($this->exception_on_error) throw new Exception\AssertionFailed('LDAP support unavailable!');
180
+			if ($this->exception_on_error)
181
+			{
182
+				throw new Exception\AssertionFailed('LDAP support unavailable!');
183
+			}
172 184
 
173 185
 			printf('<b>Error: LDAP support unavailable</b><br>',$host);
174 186
 			return False;
@@ -194,10 +206,13 @@  discard block
 block discarded – undo
194 206
 			{
195 207
 				if ($h !== $host)
196 208
 				{
197
-					if (isset($_SESSION))	// store working host as first choice in session
209
+					if (isset($_SESSION))
210
+					{
211
+						// store working host as first choice in session
198 212
 					{
199 213
 						$_SESSION['ldapConnect'][$host] = implode(' ',array_unique(array_merge(array($h),$hosts)));
200 214
 					}
215
+					}
201 216
 				}
202 217
 				return $this->ds;
203 218
 			}
@@ -206,7 +221,10 @@  discard block
 block discarded – undo
206 221
 				' '.function_backtrace());
207 222
 		}
208 223
 		// give visible error, only if we cant connect to any ldap server
209
-		if ($this->exception_on_error) throw new Exception\NoPermission("Can't connect/bind to LDAP server '$host' and dn='$dn'!");
224
+		if ($this->exception_on_error)
225
+		{
226
+			throw new Exception\NoPermission("Can't connect/bind to LDAP server '$host' and dn='$dn'!");
227
+		}
210 228
 
211 229
 		return false;
212 230
 	}
@@ -242,7 +260,10 @@  discard block
 block discarded – undo
242 260
 		{
243 261
 			$supportedLDAPVersion = 2;
244 262
 		}
245
-		if ($use_tls) ldap_start_tls($this->ds);
263
+		if ($use_tls)
264
+		{
265
+			ldap_start_tls($this->ds);
266
+		}
246 267
 
247 268
 		if (!isset($this->ldapserverinfo) ||
248 269
 			!is_a($this->ldapserverinfo,'EGroupware\Ldap\ServerInfo') ||
@@ -281,10 +302,13 @@  discard block
 block discarded – undo
281 302
 	 */
282 303
 	function restoreSessionData()
283 304
 	{
284
-		if (isset($GLOBALS['egw']->session))	// no availible in setup
305
+		if (isset($GLOBALS['egw']->session))
306
+		{
307
+			// no availible in setup
285 308
 		{
286 309
 			$this->ldapserverinfo = Cache::getSession(__CLASS__, 'ldapServerInfo');
287 310
 		}
311
+		}
288 312
 	}
289 313
 
290 314
 	/**
@@ -292,9 +316,12 @@  discard block
 block discarded – undo
292 316
 	 */
293 317
 	function saveSessionData()
294 318
 	{
295
-		if (isset($GLOBALS['egw']->session))	// no availible in setup
319
+		if (isset($GLOBALS['egw']->session))
320
+		{
321
+			// no availible in setup
296 322
 		{
297 323
 			Cache::setSession(__CLASS__, 'ldapServerInfo', $this->ldapserverinfo);
298 324
 		}
325
+		}
299 326
 	}
300 327
 }
Please login to merge, or discard this patch.
api/setup/default_records.inc.php 1 patch
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -215,14 +215,20 @@
 block discarded – undo
215 215
 $prefs->read_repository(false);
216 216
 foreach(array('','addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager', 'filemanager') as $app)
217 217
 {
218
-	if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) continue;
218
+	if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app))
219
+	{
220
+		continue;
221
+	}
219 222
 
220 223
 	// create directory and set permissions: Admins writable and other readable
221 224
 	$dir = '/templates'.($app ? '/'.$app : '');
222 225
 	Vfs::mkdir($dir, 075, STREAM_MKDIR_RECURSIVE);
223 226
 	Vfs::chgrp($dir, abs($admins));
224 227
 	Vfs::chmod($dir, 075);
225
-	if (!$app) continue;
228
+	if (!$app)
229
+	{
230
+		continue;
231
+	}
226 232
 
227 233
 	// set default preference for app (preserving a maybe already set document-directory)
228 234
 	if ($prefs->default[$app]['document_dir'])
Please login to merge, or discard this patch.