Test Setup Failed
Push — 17.1 ( 80400e...1bcf53 )
by Ralf
10:23
created
infolog/inc/class.infolog_so.inc.php 1 patch
Braces   +115 added lines, -28 removed lines patch added patch discarded remove patch
@@ -95,7 +95,10 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	function is_responsible($info,$user=null)
97 97
 	{
98
-		if (!$user) $user = $this->user;
98
+		if (!$user)
99
+		{
100
+			$user = $this->user;
101
+		}
99 102
 
100 103
 		return self::is_responsible_user($info, $user);
101 104
 	}
@@ -132,20 +135,32 @@  discard block
 block discarded – undo
132 135
 	 */
133 136
 	function check_access( $info,$required_rights,$implicit_edit=false,array $grants=null,$user=null )
134 137
 	{
135
-		if (is_null($grants)) $grants = $this->grants;
136
-		if (!$user) $user = $this->user;
138
+		if (is_null($grants))
139
+		{
140
+			$grants = $this->grants;
141
+		}
142
+		if (!$user)
143
+		{
144
+			$user = $this->user;
145
+		}
137 146
 
138 147
 		// if info-array, but no owner given, force reading of info from db
139
-		if (is_array($info) && !$info['info_owner']) $info = $info['info_id'];
148
+		if (is_array($info) && !$info['info_owner'])
149
+		{
150
+			$info = $info['info_id'];
151
+		}
140 152
 
141 153
 		if (is_array($info))
142 154
 		{
143 155
 
144 156
 		}
145
-		elseif ((int) $info != $this->data['info_id'])      	// already loaded?
157
+		elseif ((int) $info != $this->data['info_id'])
158
+		{
159
+			// already loaded?
146 160
 		{
147 161
 			// dont change our own internal data,
148 162
 			$backup_data = $this->data;
163
+		}
149 164
 			$info = $this->read(array('info_id'=>$info));
150 165
 			$this->data = $backup_data;
151 166
 		}
@@ -178,7 +193,10 @@  discard block
 block discarded – undo
178 193
 	 */
179 194
 	function responsible_filter($users, $deleted_too=false)
180 195
 	{
181
-		if (!$users) return '0';
196
+		if (!$users)
197
+		{
198
+			return '0';
199
+		}
182 200
 
183 201
 		$responsible = array();
184 202
 		foreach((array)$users as $user)
@@ -271,11 +289,14 @@  discard block
 block discarded – undo
271 289
 						" OR info_status = 'offer' AND $public_access" : '').")".
272 290
 				                 " AND (info_access='public'".($has_private_access?" OR $has_private_access":'').')';
273 291
 			}
274
-			elseif ($filter != 'my' && $filter != 'responsible')	// none --> all entrys user has rights to see
292
+			elseif ($filter != 'my' && $filter != 'responsible')
293
+			{
294
+				// none --> all entrys user has rights to see
275 295
 			{
276 296
 				if ($has_private_access)
277 297
 				{
278 298
 					$filtermethod .= " OR $has_private_access";
299
+			}
279 300
 				}
280 301
 				if (count($public_user_list))
281 302
 				{
@@ -439,7 +460,10 @@  discard block
 block discarded – undo
439 460
 			$this->data['info_responsible'] = $this->data['info_responsible'] ? explode(',',$this->data['info_responsible']) : array();
440 461
 			foreach($this->data['info_responsible'] as $k => $v)
441 462
 			{
442
-				if (!is_numeric($v)) unset($this->data['info_responsible'][$k]);
463
+				if (!is_numeric($v))
464
+				{
465
+					unset($this->data['info_responsible'][$k]);
466
+				}
443 467
 			}
444 468
 			$this->data['info_responsible'] = array_values($this->data['info_responsible']);
445 469
 		}
@@ -579,12 +603,18 @@  discard block
 block discarded – undo
579 603
 			}
580 604
 		}
581 605
 		// writing no price as SQL NULL (required by postgres)
582
-		if ($to_write['info_price'] === '') $to_write['info_price'] = NULL;
606
+		if ($to_write['info_price'] === '')
607
+		{
608
+			$to_write['info_price'] = NULL;
609
+		}
583 610
 
584 611
 		if (($this->data['info_id'] = $info_id) && !$force_insert)
585 612
 		{
586 613
 			$where = array('info_id' => $info_id);
587
-			if ($check_modified) $where['info_datemodified'] = $check_modified;
614
+			if ($check_modified)
615
+			{
616
+				$where['info_datemodified'] = $check_modified;
617
+			}
588 618
 			if (!$this->db->update($this->info_table,$to_write,$where,__LINE__,__FILE__))
589 619
 			{
590 620
 				//error_log("### soinfolog::write(".print_r($to_write,true).") where=".print_r($where,true)." returning false");
@@ -598,7 +628,11 @@  discard block
 block discarded – undo
598 628
 		}
599 629
 		else
600 630
 		{
601
-			if (!isset($to_write['info_id_parent'])) $to_write['info_id_parent'] = 0;	// must not be null
631
+			if (!isset($to_write['info_id_parent']))
632
+			{
633
+				$to_write['info_id_parent'] = 0;
634
+			}
635
+			// must not be null
602 636
 
603 637
 			$this->db->insert($this->info_table,$to_write,false,__LINE__,__FILE__);
604 638
 			$info_id = $this->data['info_id'] = $this->db->get_last_insert_id($this->info_table,'info_id');
@@ -627,7 +661,10 @@  discard block
 block discarded – undo
627 661
 		if ($purge_cfs)
628 662
 		{
629 663
 			$where = array('info_id' => $info_id);
630
-			if ($purge_cfs == 'ical') $where[] = "info_extra_name LIKE '#%'";
664
+			if ($purge_cfs == 'ical')
665
+			{
666
+				$where[] = "info_extra_name LIKE '#%'";
667
+			}
631 668
 			$this->db->delete($this->extra_table,$where,__LINE__,__FILE__);
632 669
 		}
633 670
 		$to_delete = array();
@@ -741,7 +778,10 @@  discard block
 block discarded – undo
741 778
 	{
742 779
 		if (!is_array($info_id) || !$info_id)
743 780
 		{
744
-			if ((int)$info_id <= 0) return 0;
781
+			if ((int)$info_id <= 0)
782
+			{
783
+				return 0;
784
+			}
745 785
 		}
746 786
 		$counts = array();
747 787
 		foreach($this->db->select($this->info_table,'info_id_parent,COUNT(*) AS info_anz_subs',array(
@@ -815,11 +855,20 @@  discard block
 block discarded – undo
815 855
 				else
816 856
 				{
817 857
 					static $table_def = null;
818
-					if (is_null($table_def)) $table_def = $this->db->get_table_definitions('infolog',$this->info_table);
819
-					if (substr($val,0,5) != 'info_' && isset($table_def['fd']['info_'.$val])) $val = 'info_'.$val;
858
+					if (is_null($table_def))
859
+					{
860
+						$table_def = $this->db->get_table_definitions('infolog',$this->info_table);
861
+					}
862
+					if (substr($val,0,5) != 'info_' && isset($table_def['fd']['info_'.$val]))
863
+					{
864
+						$val = 'info_'.$val;
865
+					}
820 866
 					if ($val == 'info_des' && $this->db->capabilities['order_on_text'] !== true)
821 867
 					{
822
-						if (!$this->db->capabilities['order_on_text']) continue;
868
+						if (!$this->db->capabilities['order_on_text'])
869
+						{
870
+							continue;
871
+						}
823 872
 
824 873
 						$val = sprintf($this->db->capabilities['order_on_text'],$val);
825 874
 					}
@@ -833,7 +882,10 @@  discard block
 block discarded – undo
833 882
 			$ordermethod = 'ORDER BY info_datemodified DESC';   // newest first
834 883
 		}
835 884
 		$filtermethod = $no_acl ? '1=1' : $this->aclFilter($query['filter']);
836
-		if (!$query['col_filter']['info_status'])  $filtermethod .= $this->statusFilter($query['filter']);
885
+		if (!$query['col_filter']['info_status'])
886
+		{
887
+			$filtermethod .= $this->statusFilter($query['filter']);
888
+		}
837 889
 		$filtermethod .= $this->dateFilter($query['filter']);
838 890
 		$cfcolfilter=0;
839 891
 		if (is_array($query['col_filter']))
@@ -845,14 +897,21 @@  discard block
 block discarded – undo
845 897
 					$filtermethod .= ' AND '.$data;
846 898
 					continue;
847 899
 				}
848
-				if ($col[0] != '#' && substr($col,0,5) != 'info_' && isset($table_def['fd']['info_'.$col])) $col = 'info_'.$col;
900
+				if ($col[0] != '#' && substr($col,0,5) != 'info_' && isset($table_def['fd']['info_'.$col]))
901
+				{
902
+					$col = 'info_'.$col;
903
+				}
849 904
 				if ((string)$data !== '' && preg_match('/^[a-z_0-9]+$/i',$col))
850 905
 				{
851 906
 					switch ($col)
852 907
 					{
853 908
 						case 'info_responsible':
854 909
 							$data = (int) $data;
855
-							if (!$data) continue 2;	// +1 for switch
910
+							if (!$data)
911
+							{
912
+								continue 2;
913
+							}
914
+							// +1 for switch
856 915
 							$filtermethod .= ' AND ('.$this->responsible_filter($data)." OR $this->users_table.account_id IS NULL AND ".
857 916
 								$this->db->expression($this->info_table,array(
858 917
 									'info_owner' => $data > 0 ? $data : $GLOBALS['egw']->accounts->members($data,true)
@@ -901,12 +960,22 @@  discard block
 block discarded – undo
901 960
 			$filtermethod .= ' AND info_cat'.(count($cats)>1? ' IN ('.implode(',',$cats).') ' : '='.(int)$query['cat_id']);
902 961
 		}
903 962
 		$join = $distinct = '';
904
-		if ($query['query']) $query['search'] = $query['query'];	// allow both names
905
-		if ($query['search'])			  // we search in _from, _subject, _des and _extra_value for $query
963
+		if ($query['query'])
964
+		{
965
+			$query['search'] = $query['query'];
966
+		}
967
+		// allow both names
968
+		if ($query['search'])
969
+		{
970
+			// we search in _from, _subject, _des and _extra_value for $query
906 971
 		{
907 972
 			$columns = array('info_from','info_location','info_subject');
973
+		}
908 974
 			// at the moment MaxDB 7.5 cant cast nor search text columns, it's suppost to change in 7.6
909
-			if ($this->db->capabilities['like_on_text']) $columns[] = 'info_des';
975
+			if ($this->db->capabilities['like_on_text'])
976
+			{
977
+				$columns[] = 'info_des';
978
+			}
910 979
 
911 980
 			$wildcard = '%'; $op = null;
912 981
 			$so_sql = new Api\Storage('infolog', $this->info_table, $this->extra_table, '', 'info_extra_name', 'info_extra_value', 'info_id', $this->db);
@@ -959,7 +1028,10 @@  discard block
 block discarded – undo
959 1028
 			if ($sortbycf != '')
960 1029
 			{
961 1030
 				$sort_col = "(SELECT DISTINCT info_extra_value FROM $this->extra_table sub2 WHERE sub2.info_id=main.info_id AND info_extra_name=".$this->db->quote($sortbycf).")";
962
-				if (!isset($custom_fields)) $custom_fields = Api\Storage\Customfields::get('infolog');
1031
+				if (!isset($custom_fields))
1032
+				{
1033
+					$custom_fields = Api\Storage\Customfields::get('infolog');
1034
+				}
963 1035
 				switch($custom_fields[$sortbycf]['type'])
964 1036
 				{
965 1037
 					case 'int':
@@ -979,7 +1051,10 @@  discard block
 block discarded – undo
979 1051
 					$query['start'] = 0;
980 1052
 				}
981 1053
 				$cols = isset($query['cols']) ? $query['cols'] : 'main.*';
982
-				if (is_array($cols)) $cols = implode(',',$cols);
1054
+				if (is_array($cols))
1055
+				{
1056
+					$cols = implode(',',$cols);
1057
+				}
983 1058
 				$cols .= ','.$this->db->group_concat('attendees.account_id').' AS info_responsible';
984 1059
 				$cols .= ','.$this->db->group_concat('attendees.info_res_attendee').' AS info_cc';
985 1060
 				$rs = $this->db->query($sql='SELECT '.$mysql_calc_rows.' '.$distinct.' '.$cols.' '.$info_customfield.' '.$sql_query.
@@ -1004,7 +1079,10 @@  discard block
 block discarded – undo
1004 1079
 				$info['info_responsible'] = $info['info_responsible'] ? array_unique(explode(',',$info['info_responsible'])) : array();
1005 1080
 				foreach($info['info_responsible'] as $k => $v)
1006 1081
 				{
1007
-					if (!is_numeric($v)) unset($info['info_responsible'][$k]);
1082
+					if (!is_numeric($v))
1083
+					{
1084
+						unset($info['info_responsible'][$k]);
1085
+					}
1008 1086
 				}
1009 1087
 				$info['info_responsible'] = array_values($info['info_responsible']);
1010 1088
 
@@ -1015,7 +1093,10 @@  discard block
 block discarded – undo
1015 1093
 			{
1016 1094
 				$config_data = Api\Config::read('infolog');
1017 1095
 				$index_load_cfs = $config_data['index_load_cfs'];
1018
-				if (!is_array($index_load_cfs)) $index_load_cfs = explode(',', $index_load_cfs);
1096
+				if (!is_array($index_load_cfs))
1097
+				{
1098
+					$index_load_cfs = explode(',', $index_load_cfs);
1099
+				}
1019 1100
 			}
1020 1101
 			// if no specific custom field is selected, show/query all custom fields
1021 1102
 			if ($ids && ($query['custom_fields'] || $query['csv_export'] ||
@@ -1028,7 +1109,10 @@  discard block
 block discarded – undo
1028 1109
 					$where['info_extra_name'] = array();
1029 1110
 					foreach(is_array($query['selectcols']) ? $query['selectcols'] : explode(',',$query['selectcols']) as $col)
1030 1111
 					{
1031
-						if ($col[0] == '#') $where['info_extra_name'][] = substr($col,1);
1112
+						if ($col[0] == '#')
1113
+						{
1114
+							$where['info_extra_name'][] = substr($col,1);
1115
+						}
1032 1116
 					}
1033 1117
 				}
1034 1118
 				foreach($this->db->select($this->extra_table,'*',$where,__LINE__,__FILE__) as $row)
@@ -1078,7 +1162,10 @@  discard block
 block discarded – undo
1078 1162
 			{
1079 1163
 				foreach((array)$responsible as $user)
1080 1164
 				{
1081
-					if ($user && !in_array($user,$users)) $users[] = $user;
1165
+					if ($user && !in_array($user,$users))
1166
+					{
1167
+						$users[] = $user;
1168
+					}
1082 1169
 				}
1083 1170
 			}
1084 1171
 		}
Please login to merge, or discard this patch.
api/src/Contacts/Storage.php 1 patch
Braces   +140 added lines, -35 removed lines patch added patch discarded remove patch
@@ -348,7 +348,10 @@  discard block
 block discarded – undo
348 348
 	 */
349 349
 	function get_grants($user, $contact_app='addressbook', $preferences=null)
350 350
 	{
351
-		if (!isset($preferences)) $preferences = $GLOBALS['egw_info']['user']['preferences'];
351
+		if (!isset($preferences))
352
+		{
353
+			$preferences = $GLOBALS['egw_info']['user']['preferences'];
354
+		}
352 355
 
353 356
 		if ($user)
354 357
 		{
@@ -376,12 +379,25 @@  discard block
 block discarded – undo
376 379
 				$grants[0] = Api\Acl::READ;
377 380
 			}
378 381
 			// add account grants for admins (only for current user!)
379
-			if ($user == $this->user && $this->is_admin())	// admin rights can be limited by ACL!
382
+			if ($user == $this->user && $this->is_admin())
383
+			{
384
+				// admin rights can be limited by ACL!
380 385
 			{
381
-				$grants[0] = Api\Acl::READ;	// admins always have read-access
382
-				if (!$GLOBALS['egw']->acl->check('account_access',16,'admin')) $grants[0] |= Api\Acl::EDIT;
383
-				if (!$GLOBALS['egw']->acl->check('account_access',4,'admin'))  $grants[0] |= Api\Acl::ADD;
384
-				if (!$GLOBALS['egw']->acl->check('account_access',32,'admin')) $grants[0] |= Api\Acl::DELETE;
386
+				$grants[0] = Api\Acl::READ;
387
+			}
388
+			// admins always have read-access
389
+				if (!$GLOBALS['egw']->acl->check('account_access',16,'admin'))
390
+				{
391
+					$grants[0] |= Api\Acl::EDIT;
392
+				}
393
+				if (!$GLOBALS['egw']->acl->check('account_access',4,'admin'))
394
+				{
395
+					$grants[0] |= Api\Acl::ADD;
396
+				}
397
+				if (!$GLOBALS['egw']->acl->check('account_access',32,'admin'))
398
+				{
399
+					$grants[0] |= Api\Acl::DELETE;
400
+				}
385 401
 			}
386 402
 			// allow certain groups to edit contact-data of accounts
387 403
 			if (self::allow_account_edit($user))
@@ -451,12 +467,22 @@  discard block
 block discarded – undo
451 467
 		}
452 468
 		foreach($ids as $key => $id)
453 469
 		{
454
-			if (!is_numeric($id)) unset($ids[$key]);
470
+			if (!is_numeric($id))
471
+			{
472
+				unset($ids[$key]);
473
+			}
474
+		}
475
+		if (!$ids)
476
+		{
477
+			return array();
455 478
 		}
456
-		if (!$ids) return array();	// nothing to do, eg. all these contacts are in ldap
479
+		// nothing to do, eg. all these contacts are in ldap
457 480
 		$fields = array();
458 481
 		$filter[$this->distri_id]=$ids;
459
-		if (count($dl_allowed)) $filter[$this->distri_key]=$dl_allowed;
482
+		if (count($dl_allowed))
483
+		{
484
+			$filter[$this->distri_key]=$dl_allowed;
485
+		}
460 486
 		$distri_view = str_replace(') d_view',' and '.$this->distri_id.' in ('.implode(',',$ids).')) d_view',$this->distributionlist_view);
461 487
 		#_debug_array($this->distributionlist_tabledef);
462 488
 		foreach($this->db->select($distri_view, '*', $filter, __LINE__, __FILE__,
@@ -506,10 +532,16 @@  discard block
 block discarded – undo
506 532
 	*/
507 533
 	function delete($contact,$check_etag=null)
508 534
 	{
509
-		if (is_array($contact)) $contact = $contact['id'];
535
+		if (is_array($contact))
536
+		{
537
+			$contact = $contact['id'];
538
+		}
510 539
 
511 540
 		$where = array('id' => $contact);
512
-		if ($check_etag) $where['etag'] = $check_etag;
541
+		if ($check_etag)
542
+		{
543
+			$where['etag'] = $check_etag;
544
+		}
513 545
 
514 546
 		// delete mainfields
515 547
 		if ($this->somain->delete($where))
@@ -586,7 +618,10 @@  discard block
 block discarded – undo
586 618
 				}
587 619
 			}
588 620
 		}
589
-		if($error_nr) return $error_nr;
621
+		if($error_nr)
622
+		{
623
+			return $error_nr;
624
+		}
590 625
 
591 626
 		return false;	// no error
592 627
 	}
@@ -614,7 +649,10 @@  discard block
 block discarded – undo
614 649
 			return $contact;
615 650
 		}
616 651
 		$dl_list=$this->read_distributionlist(array($contact['id']));
617
-		if (count($dl_list)) $contact['distrib_lists']=implode("\n",$dl_list[$contact['id']]);
652
+		if (count($dl_list))
653
+		{
654
+			$contact['distrib_lists']=implode("\n",$dl_list[$contact['id']]);
655
+		}
618 656
 		return $this->db2data($contact);
619 657
 	}
620 658
 
@@ -648,7 +686,10 @@  discard block
 block discarded – undo
648 686
 			unset($filter['adr_one_countrycode']);
649 687
 		}
650 688
 		// Hide deleted items unless type is specifically deleted
651
-		if(!is_array($filter)) $filter = $filter ? (array) $filter : array();
689
+		if(!is_array($filter))
690
+		{
691
+			$filter = $filter ? (array) $filter : array();
692
+		}
652 693
 
653 694
 		if (isset($filter['cols_to_search']))
654 695
 		{
@@ -659,10 +700,13 @@  discard block
 block discarded – undo
659 700
 		// if no tid set or tid==='' do NOT return deleted entries ($tid === null returns all entries incl. deleted)
660 701
 		if(!array_key_exists('tid', $filter) || $filter['tid'] === '')
661 702
 		{
662
-			if ($join && strpos($join,'RIGHT JOIN') !== false)	// used eg. to search for groups
703
+			if ($join && strpos($join,'RIGHT JOIN') !== false)
704
+			{
705
+				// used eg. to search for groups
663 706
 			{
664 707
 				$filter[] = '(contact_tid != \'' . self::DELETED_TYPE . '\' OR contact_tid IS NULL)';
665 708
 			}
709
+			}
666 710
 			else
667 711
 			{
668 712
 				$filter[] = 'contact_tid != \'' . self::DELETED_TYPE . '\'';
@@ -710,7 +754,10 @@  discard block
 block discarded – undo
710 754
 							unset($cols[$key]);
711 755
 						}
712 756
 					}
713
-					if ($col=='contact_id') $col='egw_addressbook.contact_id';
757
+					if ($col=='contact_id')
758
+					{
759
+						$col='egw_addressbook.contact_id';
760
+					}
714 761
 				}
715 762
 
716 763
 				$backend->columns_to_search = $cols;
@@ -785,7 +832,11 @@  discard block
 block discarded – undo
785 832
 			{
786 833
 				foreach($this->columns_to_search as $col)
787 834
 				{
788
-					if ($col != 'contact_value') $param['search'][$col] = $search;	// we dont search the customfields
835
+					if ($col != 'contact_value')
836
+					{
837
+						$param['search'][$col] = $search;
838
+					}
839
+					// we dont search the customfields
789 840
 				}
790 841
 			}
791 842
 		}
@@ -805,11 +856,17 @@  discard block
 block discarded – undo
805 856
 		$rows = $this->somain->organisations($param);
806 857
 		$this->total = $this->somain->total;
807 858
 
808
-		if (!$rows) return array();
859
+		if (!$rows)
860
+		{
861
+			return array();
862
+		}
809 863
 
810 864
 		foreach($rows as $n => $row)
811 865
 		{
812
-			if (strpos($row['org_name'],'&')!==false) $row['org_name'] = str_replace('&','*AND*',$row['org_name']);
866
+			if (strpos($row['org_name'],'&')!==false)
867
+			{
868
+				$row['org_name'] = str_replace('&','*AND*',$row['org_name']);
869
+			}
813 870
 			$rows[$n]['id'] = 'org_name:'.$row['org_name'];
814 871
 			foreach(array(
815 872
 				'org_unit' => lang('departments'),
@@ -822,7 +879,10 @@  discard block
 block discarded – undo
822 879
 				}
823 880
 				else
824 881
 				{
825
-					if (strpos($row[$by],'&')!==false) $row[$by] = str_replace('&','*AND*',$row[$by]);
882
+					if (strpos($row[$by],'&')!==false)
883
+					{
884
+						$row[$by] = str_replace('&','*AND*',$row[$by]);
885
+					}
826 886
 					$rows[$n]['id'] .= '|||'.$by.':'.$row[$by];
827 887
 				}
828 888
 			}
@@ -865,7 +925,10 @@  discard block
 block discarded – undo
865 925
 				foreach($this->columns_to_search as $col)
866 926
 				{
867 927
 					// we don't search the customfields
868
-					if ($col != 'contact_value') $param['search'][$col] = $search;
928
+					if ($col != 'contact_value')
929
+					{
930
+						$param['search'][$col] = $search;
931
+					}
869 932
 				}
870 933
 			}
871 934
 		}
@@ -897,14 +960,20 @@  discard block
 block discarded – undo
897 960
 		$rows = $this->somain->duplicates($param);
898 961
 		$this->total = $this->somain->total;
899 962
 
900
-		if (!$rows) return array();
963
+		if (!$rows)
964
+		{
965
+			return array();
966
+		}
901 967
 
902 968
 		foreach($rows as $n => $row)
903 969
 		{
904 970
 			$rows[$n]['id'] = 'duplicate:';
905 971
 			foreach(array_keys(static::$duplicate_fields) as $by)
906 972
 			{
907
-				if (strpos($row[$by],'&')!==false) $row[$by] = str_replace('&','*AND*',$row[$by]);
973
+				if (strpos($row[$by],'&')!==false)
974
+				{
975
+					$row[$by] = str_replace('&','*AND*',$row[$by]);
976
+				}
908 977
 				if($row[$by])
909 978
 				{
910 979
 					$rows[$n]['id'] .= '|||'.$by.':'.$row[$by];
@@ -966,7 +1035,10 @@  discard block
 block discarded – undo
966 1035
 	 */
967 1036
 	function get_backend($keys=null,$owner=null)
968 1037
 	{
969
-		if ($owner === '') $owner = null;
1038
+		if ($owner === '')
1039
+		{
1040
+			$owner = null;
1041
+		}
970 1042
 
971 1043
 		$contact_id = !is_array($keys) ? $keys :
972 1044
 			(isset($keys['id']) ? $keys['id'] : $keys['contact_id']);
@@ -1038,7 +1110,10 @@  discard block
 block discarded – undo
1038 1110
 			$ldap_contacts = new Ldap(null, $ds);
1039 1111
 		}
1040 1112
 
1041
-		if (!is_array($type)) $type = explode(',', $type);
1113
+		if (!is_array($type))
1114
+		{
1115
+			$type = explode(',', $type);
1116
+		}
1042 1117
 
1043 1118
 		$start = $n = 0;
1044 1119
 		$num = 100;
@@ -1054,7 +1129,10 @@  discard block
 block discarded – undo
1054 1129
 			{
1055 1130
 				foreach($contacts as $contact)
1056 1131
 				{
1057
-					if ($contact['account_id']) $contact['id'] = $GLOBALS['egw']->accounts->id2name($contact['account_id']);
1132
+					if ($contact['account_id'])
1133
+					{
1134
+						$contact['id'] = $GLOBALS['egw']->accounts->id2name($contact['account_id']);
1135
+					}
1058 1136
 
1059 1137
 					$ldap_contacts->data = $contact;
1060 1138
 					$n++;
@@ -1082,10 +1160,13 @@  discard block
 block discarded – undo
1082 1160
 				false, $filter) as $contact)
1083 1161
 			{
1084 1162
 				//error_log(__METHOD__."(".array2string($type).") do=".array2string($type)." migrating ".array2string($contact));
1085
-				if ($contact['jpegphoto'])	// photo is NOT read by LDAP backend on search, need to do an extra read
1163
+				if ($contact['jpegphoto'])
1164
+				{
1165
+					// photo is NOT read by LDAP backend on search, need to do an extra read
1086 1166
 				{
1087 1167
 					$contact = $ldap_contacts->read($contact['id']);
1088 1168
 				}
1169
+				}
1089 1170
 				$old_contact_id = $contact['id'];
1090 1171
 				unset($contact['id']);	// ldap uid/account_lid
1091 1172
 				if ($contact['account_id'] && ($old = $sql_contacts->read(array('account_id' => $contact['account_id']))))
@@ -1146,7 +1227,10 @@  discard block
 block discarded – undo
1146 1227
 			foreach($this->grants as $uid => $rights)
1147 1228
 			{
1148 1229
 				// only requests groups / list in accounts addressbook for read
1149
-				if (!$uid && $required != Api\Acl::READ) continue;
1230
+				if (!$uid && $required != Api\Acl::READ)
1231
+				{
1232
+					continue;
1233
+				}
1150 1234
 
1151 1235
 				if (($rights & $required) == $required)
1152 1236
 				{
@@ -1191,7 +1275,10 @@  discard block
 block discarded – undo
1191 1275
 	function read_lists($keys,$member_attr=null,$limit_in_ab=false)
1192 1276
 	{
1193 1277
 		$backend = (string)$limit_in_ab === '0' && $this->so_accounts ? $this->so_accounts : $this->somain;
1194
-		if (!method_exists($backend, 'get_lists')) return false;
1278
+		if (!method_exists($backend, 'get_lists'))
1279
+		{
1280
+			return false;
1281
+		}
1195 1282
 
1196 1283
 		return $backend->get_lists($keys,null,$member_attr,$limit_in_ab);
1197 1284
 	}
@@ -1208,7 +1295,10 @@  discard block
 block discarded – undo
1208 1295
 	function add_list($keys,$owner,$contacts=array(),array &$data=array())
1209 1296
 	{
1210 1297
 		$backend = (string)$owner === '0' && $this->so_accounts ? $this->so_accounts : $this->somain;
1211
-		if (!method_exists($backend, 'add_list')) return false;
1298
+		if (!method_exists($backend, 'add_list'))
1299
+		{
1300
+			return false;
1301
+		}
1212 1302
 
1213 1303
 		return $backend->add_list($keys,$owner,$contacts,$data);
1214 1304
 	}
@@ -1223,7 +1313,10 @@  discard block
 block discarded – undo
1223 1313
 	 */
1224 1314
 	function add2list($contact,$list,array $existing=null)
1225 1315
 	{
1226
-		if (!method_exists($this->somain,'add2list')) return false;
1316
+		if (!method_exists($this->somain,'add2list'))
1317
+		{
1318
+			return false;
1319
+		}
1227 1320
 
1228 1321
 		return $this->somain->add2list($contact,$list,$existing);
1229 1322
 	}
@@ -1237,7 +1330,10 @@  discard block
 block discarded – undo
1237 1330
 	 */
1238 1331
 	function remove_from_list($contact,$list=null)
1239 1332
 	{
1240
-		if (!method_exists($this->somain,'remove_from_list')) return false;
1333
+		if (!method_exists($this->somain,'remove_from_list'))
1334
+		{
1335
+			return false;
1336
+		}
1241 1337
 
1242 1338
 		return $this->somain->remove_from_list($contact,$list);
1243 1339
 	}
@@ -1250,7 +1346,10 @@  discard block
 block discarded – undo
1250 1346
 	 */
1251 1347
 	function delete_list($list)
1252 1348
 	{
1253
-		if (!method_exists($this->somain,'delete_list')) return false;
1349
+		if (!method_exists($this->somain,'delete_list'))
1350
+		{
1351
+			return false;
1352
+		}
1254 1353
 
1255 1354
 		return $this->somain->delete_list($list);
1256 1355
 	}
@@ -1263,7 +1362,10 @@  discard block
 block discarded – undo
1263 1362
 	 */
1264 1363
 	function read_list($list)
1265 1364
 	{
1266
-		if (!method_exists($this->somain,'read_list')) return false;
1365
+		if (!method_exists($this->somain,'read_list'))
1366
+		{
1367
+			return false;
1368
+		}
1267 1369
 
1268 1370
 		return $this->somain->read_list($list);
1269 1371
 	}
@@ -1289,7 +1391,10 @@  discard block
 block discarded – undo
1289 1391
 	 */
1290 1392
 	function lists_ctag($owner=null)
1291 1393
 	{
1292
-		if (!method_exists($this->somain,'lists_ctag')) return 0;
1394
+		if (!method_exists($this->somain,'lists_ctag'))
1395
+		{
1396
+			return 0;
1397
+		}
1293 1398
 
1294 1399
 		return $this->somain->lists_ctag($owner);
1295 1400
 	}
Please login to merge, or discard this patch.