Completed
Push — master ( c85f1f...df263c )
by Ralf
74:39 queued 51:38
created
api/src/Etemplate/Widget/HistoryLog.php 1 patch
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,10 @@  discard block
 block discarded – undo
60 60
 				{
61 61
 					// need to use self::form_name($form_name, $key) as index into sel_options see comment in header
62 62
 					$options =& self::get_array(self::$request->sel_options, self::form_name($form_name, $key), true);
63
-					if (!is_array($options)) $options = array();
63
+					if (!is_array($options))
64
+					{
65
+						$options = array();
66
+					}
64 67
 					$options += $type;
65 68
 				}
66 69
 
@@ -87,7 +90,10 @@  discard block
 block discarded – undo
87 90
 		$form_name = self::form_name($cname, $this->id, $expand);
88 91
 		$value = self::get_array($content, $form_name);
89 92
 		$valid =& self::get_array($validated, $form_name, true);
90
-		if (true) $valid = $value;
93
+		if (true)
94
+		{
95
+			$valid = $value;
96
+		}
91 97
 		return true;
92 98
 	}
93 99
 }
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/Image.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,10 @@
 block discarded – undo
36 36
 
37 37
 		$image = $value != '' ? $value : $this->attrs['src'];
38 38
 
39
-		if (is_string($image)) list($app,$img) = explode('/',$image,2);
39
+		if (is_string($image))
40
+		{
41
+			list($app,$img) = explode('/',$image,2);
42
+		}
40 43
 		if (!$app || !$img || !is_dir(EGW_SERVER_ROOT.'/'.$app) || strpos($img,'/')!==false)
41 44
 		{
42 45
 			$img = $image;
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/Checkbox.php 1 patch
Braces   +13 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,11 @@  discard block
 block discarded – undo
56 56
 		if (!$this->is_readonly($cname, $form_name))
57 57
 		{
58 58
 			$value = self::get_array($content, $form_name);
59
-			if (!isset($value))	return;	// value not transmitted --> nothing to validate
59
+			if (!isset($value))
60
+			{
61
+				return;
62
+			}
63
+			// value not transmitted --> nothing to validate
60 64
 			$valid =& self::get_array($validated, $form_name, true);
61 65
 
62 66
 			if (!$value && $this->attrs['needed'])
@@ -101,7 +105,10 @@  discard block
 block discarded – undo
101 105
 			{
102 106
 				if ($multiple)
103 107
 				{
104
-					if (!isset($valid)) $valid = array();
108
+					if (!isset($valid))
109
+					{
110
+						$valid = array();
111
+					}
105 112
 					$valid[] = $selected_value;
106 113
 				}
107 114
 				else
@@ -113,7 +120,10 @@  discard block
 block discarded – undo
113 120
 			{
114 121
 				if ($multiple)
115 122
 				{
116
-					if (!isset($valid)) $valid = array();
123
+					if (!isset($valid))
124
+					{
125
+						$valid = array();
126
+					}
117 127
 				}
118 128
 				elseif ($value === 'true')
119 129
 				{
Please login to merge, or discard this patch.
api/src/Etemplate/KeyManager.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,8 @@
 block discarded – undo
101 101
 		}
102 102
 
103 103
 		// Special keys
104
-		switch ($keyCode) {
104
+		switch ($keyCode)
105
+		{
105 106
 			case self::BACKSPACE:
106 107
 				return lang("Back");
107 108
 			case self::TAB:
Please login to merge, or discard this patch.
api/src/Etemplate/Request/Session.php 1 patch
Braces   +22 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,12 +63,18 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	private function __construct($id=null)
65 65
 	{
66
-		if (!$id) $id = self::request_id();
66
+		if (!$id)
67
+		{
68
+			$id = self::request_id();
69
+		}
67 70
 
68 71
 		$this->id = $id;
69 72
 
70 73
 		// hack to quiten IDE Warning for not calling parent::__construct, which we can not!
71
-		if (false) parent::__construct();
74
+		if (false)
75
+		{
76
+			parent::__construct();
77
+		}
72 78
 	}
73 79
 
74 80
 	/**
@@ -162,7 +168,11 @@  discard block
 block discarded – undo
162 168
 		}
163 169
 		$this->garbage_collection_done = true;
164 170
 
165
-		if (count($appsessions) < 20) return;	// we dont need to care
171
+		if (count($appsessions) < 20)
172
+		{
173
+			return;
174
+		}
175
+		// we dont need to care
166 176
 
167 177
 		$now = (int) (100 * microtime(true));	// gives precision of 1/100 sec
168 178
 
@@ -170,15 +180,22 @@  discard block
 block discarded – undo
170 180
 		{
171 181
 			list(,$time) = explode(':',$id);
172 182
 
173
-			if (!$time) continue;	// other data, no session
183
+			if (!$time)
184
+			{
185
+				continue;
186
+			}
187
+			// other data, no session
174 188
 
175 189
 			//echo ++$n.') '.$id.': '.(($now-$time)/100.0)."secs old, used=".$session_used[$id].", size=".strlen($appsessions[$id])."<br>\n";
176 190
 
177 191
 			if ($session_used[$id] == 1 && $time < $now - 10*6000 || // session used and older then 10min
178
-				$time < $now - 30*6000)	// session not used and older then 30min
192
+				$time < $now - 30*6000)
193
+			{
194
+				// session not used and older then 30min
179 195
 			{
180 196
 				//echo "<p>boetemplate::php4_session_garbage_collection('$id_used'): unsetting session '$id' (now=$now)</p>\n";
181 197
 				unset($appsessions[$id]);
198
+			}
182 199
 				unset($session_used[$id]);
183 200
 			}
184 201
 		}
Please login to merge, or discard this patch.
api/src/Etemplate/Request/Files.php 1 patch
Braces   +12 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,12 +77,18 @@  discard block
 block discarded – undo
77 77
 		{
78 78
 			self::$directory = $GLOBALS['egw_info']['server']['temp_dir'];
79 79
 		}
80
-		if (!$id) $id = self::request_id();
80
+		if (!$id)
81
+		{
82
+			$id = self::request_id();
83
+		}
81 84
 
82 85
 		$this->id = $id;
83 86
 
84 87
 		// hack to quiten IDE Warning for not calling parent::__construct, which we can not!
85
-		if (false) parent::__construct();
88
+		if (false)
89
+		{
90
+			parent::__construct();
91
+		}
86 92
 	}
87 93
 
88 94
 	/**
@@ -114,7 +120,10 @@  discard block
 block discarded – undo
114 120
 				return false;
115 121
 			}
116 122
 			$request->data = unserialize(file_get_contents($filename));
117
-			if ($request->data === false) error_log("Error unserializing '$filename' to read the etemplate request data!");
123
+			if ($request->data === false)
124
+			{
125
+				error_log("Error unserializing '$filename' to read the etemplate request data!");
126
+			}
118 127
 		}
119 128
 		//error_log(__METHOD__."(id=$id");
120 129
 		return $request;
Please login to merge, or discard this patch.
api/src/Etemplate/Request/Cache.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,10 @@
 block discarded – undo
78 78
 		//error_log(__METHOD__."($_id) this->id=$this->id");
79 79
 
80 80
 		// hack to quiten IDE Warning for not calling parent::__construct, which we can not!
81
-		if (false) parent::__construct();
81
+		if (false)
82
+		{
83
+			parent::__construct();
84
+		}
82 85
 	}
83 86
 
84 87
 	/**
Please login to merge, or discard this patch.
api/src/MimeMagic.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,10 @@
 block discarded – undo
106 106
 	public static function mime2ext($_type)
107 107
 	{
108 108
 		$type = strtolower($_type);
109
-		if (isset(self::$mime_alias_map[$type])) $type = self::$mime_alias_map[$type];
109
+		if (isset(self::$mime_alias_map[$type]))
110
+		{
111
+			$type = self::$mime_alias_map[$type];
112
+		}
110 113
 		$key = array_search($type, self::$mime_extension_map);
111 114
 		if (empty($type) || $key === false)
112 115
 		{
Please login to merge, or discard this patch.
api/src/Accounts/Sql.php 1 patch
Braces   +94 added lines, -23 removed lines patch added patch discarded remove patch
@@ -122,7 +122,10 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	function read($account_id)
124 124
 	{
125
-		if (!(int)$account_id) return false;
125
+		if (!(int)$account_id)
126
+		{
127
+			return false;
128
+		}
126 129
 
127 130
 		if ($account_id > 0)
128 131
 		{
@@ -152,11 +155,14 @@  discard block
 block discarded – undo
152 155
 			unset($e);
153 156
 		}
154 157
 
155
-		if (!$rs)	// handle not (yet) existing mailaccounts table
158
+		if (!$rs)
159
+		{
160
+			// handle not (yet) existing mailaccounts table
156 161
 		{
157 162
 			$rs = $this->db->select($this->table, $this->table.'.*',
158 163
 				$this->table.'.account_id='.abs($account_id), __LINE__, __FILE__);
159 164
 		}
165
+		}
160 166
 		if (!$rs || !($data = $rs->fetch()))
161 167
 		{
162 168
 			return false;
@@ -166,7 +172,10 @@  discard block
 block discarded – undo
166 172
 			$data['account_id'] = -$data['account_id'];
167 173
 			$data['mailAllowed'] = true;
168 174
 		}
169
-		if (!$data['account_firstname']) $data['account_firstname'] = $data['account_lid'];
175
+		if (!$data['account_firstname'])
176
+		{
177
+			$data['account_firstname'] = $data['account_lid'];
178
+		}
170 179
 		if (!$data['account_lastname'])
171 180
 		{
172 181
 			$data['account_lastname'] = $data['account_type'] == 'g' ? 'Group' : 'User';
@@ -177,7 +186,10 @@  discard block
 block discarded – undo
177 186
 				$data['account_lastname'] = lang($data['account_lastname']);
178 187
 			}
179 188
 		}
180
-		if (!$data['account_fullname']) $data['account_fullname'] = $data['account_firstname'].' '.$data['account_lastname'];
189
+		if (!$data['account_fullname'])
190
+		{
191
+			$data['account_fullname'] = $data['account_firstname'].' '.$data['account_lastname'];
192
+		}
181 193
 
182 194
 		return $data;
183 195
 	}
@@ -199,31 +211,57 @@  discard block
 block discarded – undo
199 211
 		{
200 212
 			// if password it's not already entcrypted, do so now
201 213
 			if (!preg_match('/^\\{[a-z5]{3,5}\\}.+/i',$data['account_passwd']) &&
202
-				!preg_match('/^[0-9a-f]{32}$/',$data['account_passwd']))	// md5 hash
214
+				!preg_match('/^[0-9a-f]{32}$/',$data['account_passwd']))
215
+			{
216
+				// md5 hash
203 217
 			{
204 218
 				$data['account_passwd'] = Api\Auth::encrypt_sql($data['account_passwd']);
205 219
 			}
220
+			}
206 221
 			$to_write['account_pwd'] = $data['account_passwd'];
207 222
 			$to_write['account_lastpwd_change'] = time();
208 223
 		}
209
-		if ($data['mustchangepassword'] == 1) $to_write['account_lastpwd_change']=0;
224
+		if ($data['mustchangepassword'] == 1)
225
+		{
226
+			$to_write['account_lastpwd_change']=0;
227
+		}
210 228
 		if (!(int)$data['account_id'] || !$this->id2name($data['account_id']))
211 229
 		{
212
-			if ($to_write['account_id'] < 0) $to_write['account_id'] *= -1;
230
+			if ($to_write['account_id'] < 0)
231
+			{
232
+				$to_write['account_id'] *= -1;
233
+			}
213 234
 
214
-			if (!isset($to_write['account_pwd'])) $to_write['account_pwd'] = '';	// is NOT NULL!
215
-			if (!isset($to_write['account_status'])) $to_write['account_status'] = '';	// is NOT NULL!
235
+			if (!isset($to_write['account_pwd']))
236
+			{
237
+				$to_write['account_pwd'] = '';
238
+			}
239
+			// is NOT NULL!
240
+			if (!isset($to_write['account_status']))
241
+			{
242
+				$to_write['account_status'] = '';
243
+			}
244
+			// is NOT NULL!
216 245
 
217 246
 			// postgres requires the auto-id field to be unset!
218
-			if (isset($to_write['account_id']) && !$to_write['account_id']) unset($to_write['account_id']);
247
+			if (isset($to_write['account_id']) && !$to_write['account_id'])
248
+			{
249
+				unset($to_write['account_id']);
250
+			}
219 251
 
220 252
 			if (!in_array($to_write['account_type'],array('u','g')) ||
221
-				!$this->db->insert($this->table,$to_write,false,__LINE__,__FILE__)) return false;
253
+				!$this->db->insert($this->table,$to_write,false,__LINE__,__FILE__))
254
+			{
255
+				return false;
256
+			}
222 257
 
223 258
 			if (!(int)$data['account_id'])
224 259
 			{
225 260
 				$data['account_id'] = $this->db->get_last_insert_id($this->table,'account_id');
226
-				if ($data['account_type'] == 'g') $data['account_id'] *= -1;
261
+				if ($data['account_type'] == 'g')
262
+				{
263
+					$data['account_id'] *= -1;
264
+				}
227 265
 			}
228 266
 		}
229 267
 		else	// update of existing account
@@ -276,7 +314,10 @@  discard block
 block discarded – undo
276 314
 	 */
277 315
 	function delete($account_id)
278 316
 	{
279
-		if (!(int)$account_id) return false;
317
+		if (!(int)$account_id)
318
+		{
319
+			return false;
320
+		}
280 321
 
281 322
 		$contact_id = $this->id2name($account_id,'person_id');
282 323
 
@@ -286,7 +327,10 @@  discard block
 block discarded – undo
286 327
 		}
287 328
 		if ($contact_id)
288 329
 		{
289
-			if (!isset($this->contacts)) $this->contacts = new Api\Contacts();
330
+			if (!isset($this->contacts))
331
+			{
332
+				$this->contacts = new Api\Contacts();
333
+			}
290 334
 			$this->contacts->delete($contact_id,false);	// false = allow to delete accounts (!)
291 335
 		}
292 336
 		return true;
@@ -300,7 +344,10 @@  discard block
 block discarded – undo
300 344
 	 */
301 345
 	function memberships($account_id)
302 346
 	{
303
-		if (!(int)$account_id) return false;
347
+		if (!(int)$account_id)
348
+		{
349
+			return false;
350
+		}
304 351
 
305 352
 		$memberships = array();
306 353
 		if(($gids = $GLOBALS['egw']->acl->get_location_list_for_id('phpgw_group', 1, $account_id)))
@@ -321,7 +368,10 @@  discard block
 block discarded – undo
321 368
 	 */
322 369
 	function set_memberships($groups,$account_id)
323 370
 	{
324
-		if (!(int)$account_id) return;
371
+		if (!(int)$account_id)
372
+		{
373
+			return;
374
+		}
325 375
 
326 376
 		$acl = new Api\Acl($account_id);
327 377
 		$acl->read_repository();
@@ -342,7 +392,10 @@  discard block
 block discarded – undo
342 392
 	 */
343 393
 	function members($account_id)
344 394
 	{
345
-		if (!is_numeric($account_id)) $account_id = $this->name2id($account_id);
395
+		if (!is_numeric($account_id))
396
+		{
397
+			$account_id = $this->name2id($account_id);
398
+		}
346 399
 
347 400
 		$members = array();
348 401
 		foreach($this->db->select($this->table, 'account_id,account_lid',
@@ -418,7 +471,10 @@  discard block
 block discarded – undo
418 471
 		{
419 472
 			$order .= ($order?',':'').'account_lid';
420 473
 		}
421
-		if ($param['sort']) $order = implode(' '.$param['sort'].',', explode(',', $order)).' '.$param['sort'];
474
+		if ($param['sort'])
475
+		{
476
+			$order = implode(' '.$param['sort'].',', explode(',', $order)).' '.$param['sort'];
477
+		}
422 478
 
423 479
 		$search_cols = array('account_lid','n_family','n_given','email');
424 480
 		$join = $this->contacts_join;
@@ -455,7 +511,10 @@  discard block
 block discarded – undo
455 511
 				{
456 512
 					unset($name);
457 513
 					$members = array_unique(array_merge($members, array_keys((array)$this->members($grp))));
458
-					if ($param['type'] == 'groupmembers+memberships') $members[] = abs($grp);
514
+					if ($param['type'] == 'groupmembers+memberships')
515
+					{
516
+						$members[] = abs($grp);
517
+					}
459 518
 				}
460 519
 				$filter['account_id'] = $members;
461 520
 				break;
@@ -474,9 +533,12 @@  discard block
 block discarded – undo
474 533
 		// fix ambigous account_id (used in accounts and contacts table)
475 534
 		if (array_key_exists('account_id', $filter))
476 535
 		{
477
-			if (!$filter['account_id'])	// eg. group without members (would give SQL error)
536
+			if (!$filter['account_id'])
537
+			{
538
+				// eg. group without members (would give SQL error)
478 539
 			{
479 540
 				$this->total = 0;
541
+			}
480 542
 				return array();
481 543
 			}
482 544
 			$filter[] = $this->db->expression($this->table, $this->table.'.', array(
@@ -528,7 +590,10 @@  discard block
 block discarded – undo
528 590
 					break;
529 591
 			}
530 592
 		}
531
-		if (!isset($this->contacts)) $this->contacts = new Api\Contacts();
593
+		if (!isset($this->contacts))
594
+		{
595
+			$this->contacts = new Api\Contacts();
596
+		}
532 597
 
533 598
 		$accounts = array();
534 599
 		foreach((array) $this->contacts->search($criteria,
@@ -578,7 +643,10 @@  discard block
 block discarded – undo
578 643
 	 */
579 644
 	function name2id($name,$which='account_lid',$account_type=null)
580 645
 	{
581
-		if ($account_type === 'g' && $which != 'account_lid') return false;
646
+		if ($account_type === 'g' && $which != 'account_lid')
647
+		{
648
+			return false;
649
+		}
582 650
 
583 651
 		$where = array();
584 652
 		$cols = 'account_id';
@@ -601,9 +669,12 @@  discard block
 block discarded – undo
601 669
 				$cols .= ',account_type';
602 670
 				$where[$which] = $name;
603 671
 				// check if we need to treat username case-insensitive
604
-				if ($which == 'account_lid' && !$GLOBALS['egw_info']['server']['case_sensitive_username'])	// = is case sensitiv eg. on postgres, but not on mysql!
672
+				if ($which == 'account_lid' && !$GLOBALS['egw_info']['server']['case_sensitive_username'])
673
+				{
674
+					// = is case sensitiv eg. on postgres, but not on mysql!
605 675
 				{
606 676
 					$where[] = 'account_lid '.$this->db->capabilities[Api\Db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.$this->db->quote($where['account_lid']);
677
+				}
607 678
 					unset($where['account_lid']);
608 679
 				}
609 680
 		}
Please login to merge, or discard this patch.