@@ -26,10 +26,10 @@ |
||
26 | 26 | * @param string $msg =null message, default "Entry not found!" |
27 | 27 | * @param int $code =99 numerical code, default 2 |
28 | 28 | */ |
29 | - function __construct($msg=null,$code=2) |
|
29 | + function __construct($msg = null, $code = 2) |
|
30 | 30 | { |
31 | 31 | if (is_null($msg)) $msg = lang('Entry not found!'); |
32 | 32 | |
33 | - parent::__construct($msg,$code); |
|
33 | + parent::__construct($msg, $code); |
|
34 | 34 | } |
35 | 35 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @param string $msg |
34 | 34 | * @param int $code |
35 | 35 | */ |
36 | - function __construct($url,$app=null,$msg=null,$code=301) |
|
36 | + function __construct($url, $app = null, $msg = null, $code = 301) |
|
37 | 37 | { |
38 | 38 | $this->url = $url; |
39 | 39 | $this->app = $app; |
@@ -27,10 +27,10 @@ |
||
27 | 27 | * @param string $msg =null message, default "Permission denied!" |
28 | 28 | * @param int $code =100 numerical code, default 100 |
29 | 29 | */ |
30 | - function __construct($msg=null,$code=100) |
|
30 | + function __construct($msg = null, $code = 100) |
|
31 | 31 | { |
32 | 32 | if (is_null($msg)) $msg = lang('Permisson denied!'); |
33 | 33 | |
34 | - parent::__construct($msg,$code); |
|
34 | + parent::__construct($msg, $code); |
|
35 | 35 | } |
36 | 36 | } |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | * @param array $params =array() additional parameters, row is always first parameter |
100 | 100 | * @param $key_callback =null optional callback, if you want different keys |
101 | 101 | */ |
102 | - public function __construct(\Traversable $rs, $callback, $params=array(), $key_callback=null) |
|
102 | + public function __construct(\Traversable $rs, $callback, $params = array(), $key_callback = null) |
|
103 | 103 | { |
104 | 104 | $this->callback = $callback; |
105 | 105 | $this->params = $params; |
106 | 106 | $this->key_callback = $key_callback; |
107 | 107 | |
108 | - if (is_a($rs,'IteratorAggregate')) |
|
108 | + if (is_a($rs, 'IteratorAggregate')) |
|
109 | 109 | { |
110 | 110 | $this->rs = $rs->getIterator(); |
111 | 111 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function current() |
124 | 124 | { |
125 | - if (is_a($this->rs,'iterator')) |
|
125 | + if (is_a($this->rs, 'iterator')) |
|
126 | 126 | { |
127 | 127 | $params = $this->params; |
128 | 128 | array_unshift($params, $this->rs->current()); |
@@ -138,11 +138,10 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function key() |
140 | 140 | { |
141 | - if (is_a($this->rs,'iterator')) |
|
141 | + if (is_a($this->rs, 'iterator')) |
|
142 | 142 | { |
143 | 143 | return $this->key_callback ? |
144 | - call_user_func($this->key_callback, $this->rs->current()) : |
|
145 | - $this->rs->key(); |
|
144 | + call_user_func($this->key_callback, $this->rs->current()) : $this->rs->key(); |
|
146 | 145 | } |
147 | 146 | return 0; |
148 | 147 | } |
@@ -152,7 +151,7 @@ discard block |
||
152 | 151 | */ |
153 | 152 | public function next() |
154 | 153 | { |
155 | - if (is_a($this->rs,'iterator')) |
|
154 | + if (is_a($this->rs, 'iterator')) |
|
156 | 155 | { |
157 | 156 | return $this->rs->next(); |
158 | 157 | } |
@@ -163,7 +162,7 @@ discard block |
||
163 | 162 | */ |
164 | 163 | public function rewind() |
165 | 164 | { |
166 | - if (is_a($this->rs,'iterator')) |
|
165 | + if (is_a($this->rs, 'iterator')) |
|
167 | 166 | { |
168 | 167 | return $this->rs->rewind(); |
169 | 168 | } |
@@ -174,9 +173,9 @@ discard block |
||
174 | 173 | * |
175 | 174 | * @return boolean |
176 | 175 | */ |
177 | - public function valid () |
|
176 | + public function valid() |
|
178 | 177 | { |
179 | - if (is_a($this->rs,'iterator')) |
|
178 | + if (is_a($this->rs, 'iterator')) |
|
180 | 179 | { |
181 | 180 | return $this->rs->valid(); |
182 | 181 | } |
@@ -27,10 +27,10 @@ |
||
27 | 27 | * @param string $msg =null message, default "Database error!" |
28 | 28 | * @param int $code =100 |
29 | 29 | */ |
30 | - function __construct($msg=null,$code=100) |
|
30 | + function __construct($msg = null, $code = 100) |
|
31 | 31 | { |
32 | 32 | if (is_null($msg)) $msg = lang('Database error!'); |
33 | 33 | |
34 | - parent::__construct($msg,$code); |
|
34 | + parent::__construct($msg, $code); |
|
35 | 35 | } |
36 | 36 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @return ADORecordSet or false, if the query fails |
55 | 55 | * @throws EGroupware\Api\Db\Exception\InvalidSql with $this->Link_ID->ErrorNo() as code |
56 | 56 | */ |
57 | - function query($Query_String, $line = '', $file = '', $offset=0, $num_rows=-1, $inputarr=false, $fetchmode=self::FETCH_BOTH, $reconnect=true) |
|
57 | + function query($Query_String, $line = '', $file = '', $offset = 0, $num_rows = -1, $inputarr = false, $fetchmode = self::FETCH_BOTH, $reconnect = true) |
|
58 | 58 | { |
59 | 59 | // New query, discard previous result. |
60 | 60 | if ($this->Query_ID) |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | function free() |
104 | 104 | { |
105 | - unset($this->Query_ID); // else copying of the db-object does not work |
|
105 | + unset($this->Query_ID); // else copying of the db-object does not work |
|
106 | 106 | $this->Query_ID = 0; |
107 | 107 | } |
108 | 108 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param int $fetch_mode self::FETCH_BOTH = numerical+assoc keys (eGW default), self::FETCH_ASSOC or self::FETCH_NUM |
116 | 116 | * @return bool was another row found? |
117 | 117 | */ |
118 | - function next_record($fetch_mode=self::FETCH_BOTH) |
|
118 | + function next_record($fetch_mode = self::FETCH_BOTH) |
|
119 | 119 | { |
120 | 120 | if (!$this->Query_ID) |
121 | 121 | { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | if ($this->capabilities[self::CAPABILITY_NAME_CASE] == 'upper') // maxdb, oracle, ... |
137 | 137 | { |
138 | - switch($fetch_mode) |
|
138 | + switch ($fetch_mode) |
|
139 | 139 | { |
140 | 140 | case self::FETCH_ASSOC: |
141 | 141 | $this->Record = array_change_key_case($this->Record); |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | */ |
173 | 173 | function seek($pos = 0) |
174 | 174 | { |
175 | - if (!$this->Query_ID || !$this->Query_ID->Move($this->Row = $pos)) |
|
175 | + if (!$this->Query_ID || !$this->Query_ID->Move($this->Row = $pos)) |
|
176 | 176 | { |
177 | - throw new Exception("seek($pos) failed: resultset has " . $this->num_rows() . " rows"); |
|
177 | + throw new Exception("seek($pos) failed: resultset has ".$this->num_rows()." rows"); |
|
178 | 178 | } |
179 | 179 | return True; |
180 | 180 | } |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | * @param string $mode type of lock required (optional), default write |
188 | 188 | * @return bool True if sucessful, False if fails |
189 | 189 | */ |
190 | - function lock($table, $mode='write') |
|
190 | + function lock($table, $mode = 'write') |
|
191 | 191 | { |
192 | - unset($table, $mode); // not used anymore |
|
192 | + unset($table, $mode); // not used anymore |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -278,18 +278,18 @@ discard block |
||
278 | 278 | * @param string $strip ='' string to strip of the column-name, default '' |
279 | 279 | * @return array/bool the associative array or False if no (more) result-row is availible |
280 | 280 | */ |
281 | - function row($do_next_record=False,$strip='') |
|
281 | + function row($do_next_record = False, $strip = '') |
|
282 | 282 | { |
283 | 283 | if ($do_next_record && !$this->next_record(self::FETCH_ASSOC) || !is_array($this->Record)) |
284 | 284 | { |
285 | 285 | return False; |
286 | 286 | } |
287 | 287 | $result = array(); |
288 | - foreach($this->Record as $column => $value) |
|
288 | + foreach ($this->Record as $column => $value) |
|
289 | 289 | { |
290 | 290 | if (!is_numeric($column)) |
291 | 291 | { |
292 | - if ($strip) $column = str_replace($strip,'',$column); |
|
292 | + if ($strip) $column = str_replace($strip, '', $column); |
|
293 | 293 | |
294 | 294 | $result[$column] = $value; |
295 | 295 | } |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | */ |
65 | 65 | static $sub_objects = array( |
66 | 66 | 'log' => 'errorlog', |
67 | - 'link' => 'bolink', // depricated use static egw_link methods |
|
67 | + 'link' => 'bolink', // depricated use static egw_link methods |
|
68 | 68 | 'datetime' => 'egw_datetime', |
69 | 69 | // classes moved to new api dir |
70 | 70 | 'template' => true, |
71 | 71 | 'applications' => 'EGroupware\\Api\\Egw\\Applications', |
72 | - 'framework' => true, // special handling in __get() |
|
72 | + 'framework' => true, // special handling in __get() |
|
73 | 73 | 'ldap' => true, |
74 | 74 | ); |
75 | 75 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | //error_log(__METHOD__."($name)".function_backtrace()); |
97 | 97 | |
98 | - if ($name == 'js') $name = 'framework'; // javascript class is integrated now into framework |
|
98 | + if ($name == 'js') $name = 'framework'; // javascript class is integrated now into framework |
|
99 | 99 | |
100 | 100 | if (isset($this->$name)) |
101 | 101 | { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | if ($name != 'ADOdb') error_log(__METHOD__.": There's NO $name object! ".function_backtrace()); |
108 | 108 | return null; |
109 | 109 | } |
110 | - switch($name) |
|
110 | + switch ($name) |
|
111 | 111 | { |
112 | 112 | case 'framework': |
113 | 113 | return $this->framework = Api\Framework::factory(); |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * minimum: $this->columns_to_search = array('n_family','n_given','org_name','email'); |
36 | 36 | */ |
37 | 37 | var $search_attributes = array( |
38 | - 'n_family','n_middle','n_given','org_name','org_unit', |
|
39 | - 'adr_one_location','note','email','samaccountname', |
|
38 | + 'n_family', 'n_middle', 'n_given', 'org_name', 'org_unit', |
|
39 | + 'adr_one_location', 'note', 'email', 'samaccountname', |
|
40 | 40 | ); |
41 | 41 | |
42 | 42 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @var string |
52 | 52 | */ |
53 | - var $dn_attribute='cn'; |
|
53 | + var $dn_attribute = 'cn'; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Do NOT attempt to change DN (dn-attribute can NOT be part of schemas used in addressbook!) |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | * @param array $ldap_config =null default use from $GLOBALS['egw_info']['server'] |
83 | 83 | * @param resource $ds =null ldap connection to use |
84 | 84 | */ |
85 | - function __construct(array $ldap_config=null, $ds=null) |
|
85 | + function __construct(array $ldap_config = null, $ds = null) |
|
86 | 86 | { |
87 | - if (false) parent::__construct (); // quiten IDE warning, we are explicitly NOT calling parrent constructor! |
|
87 | + if (false) parent::__construct(); // quiten IDE warning, we are explicitly NOT calling parrent constructor! |
|
88 | 88 | |
89 | - $this->accountName = $GLOBALS['egw_info']['user']['account_lid']; |
|
89 | + $this->accountName = $GLOBALS['egw_info']['user']['account_lid']; |
|
90 | 90 | |
91 | 91 | if ($ldap_config) |
92 | 92 | { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | else |
96 | 96 | { |
97 | - $this->ldap_config =& $GLOBALS['egw_info']['server']; |
|
97 | + $this->ldap_config = & $GLOBALS['egw_info']['server']; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $this->accounts_ads = $GLOBALS['egw']->accounts->backend; |
@@ -119,15 +119,15 @@ discard block |
||
119 | 119 | 'account_id' => 'objectsid', |
120 | 120 | 'id' => 'objectguid', |
121 | 121 | 'uid' => 'objectguid', |
122 | - 'n_fn' => 'displayname', // leave CN used in DN untouched |
|
123 | - 'accountexpires', 'useraccountcontrol', // needed to exclude deactivated or expired accounts |
|
122 | + 'n_fn' => 'displayname', // leave CN used in DN untouched |
|
123 | + 'accountexpires', 'useraccountcontrol', // needed to exclude deactivated or expired accounts |
|
124 | 124 | )); |
125 | 125 | unset($this->schema2egw['user']['n_fileas']); |
126 | 126 | unset($this->schema2egw['inetorgperson']); |
127 | 127 | |
128 | - foreach($this->schema2egw as $attributes) |
|
128 | + foreach ($this->schema2egw as $attributes) |
|
129 | 129 | { |
130 | - $this->all_attributes = array_merge($this->all_attributes,array_values($attributes)); |
|
130 | + $this->all_attributes = array_merge($this->all_attributes, array_values($attributes)); |
|
131 | 131 | } |
132 | 132 | $this->all_attributes = array_values(array_unique($this->all_attributes)); |
133 | 133 | |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @param boolean $admin =false true (re-)connect with admin not user credentials, eg. to modify accounts |
141 | 141 | */ |
142 | - function connect($admin=false) |
|
142 | + function connect($admin = false) |
|
143 | 143 | { |
144 | - unset($admin); // not used, but required by function signature |
|
144 | + unset($admin); // not used, but required by function signature |
|
145 | 145 | |
146 | 146 | $this->ds = $this->accounts_ads->ldap_connection(); |
147 | 147 | } |
@@ -174,15 +174,14 @@ discard block |
||
174 | 174 | function read($_contact_id) |
175 | 175 | { |
176 | 176 | if (is_array($_contact_id) && isset($_contact_id['account_id']) || |
177 | - !is_array($_contact_id) && substr($_contact_id,0,8) == 'account:') |
|
177 | + !is_array($_contact_id) && substr($_contact_id, 0, 8) == 'account:') |
|
178 | 178 | { |
179 | - $account_id = (int)(is_array($_contact_id) ? $_contact_id['account_id'] : substr($_contact_id,8)); |
|
179 | + $account_id = (int)(is_array($_contact_id) ? $_contact_id['account_id'] : substr($_contact_id, 8)); |
|
180 | 180 | $_contact_id = $GLOBALS['egw']->accounts->id2name($account_id, 'person_id'); |
181 | 181 | } |
182 | - $contact_id = !is_array($_contact_id) ? $_contact_id : |
|
183 | - (isset ($_contact_id['id']) ? $_contact_id['id'] : $_contact_id['uid']); |
|
182 | + $contact_id = !is_array($_contact_id) ? $_contact_id : (isset ($_contact_id['id']) ? $_contact_id['id'] : $_contact_id['uid']); |
|
184 | 183 | |
185 | - $rows = $this->_searchLDAP($this->allContactsDN, $filter=$this->id_filter($contact_id), $this->all_attributes, Ldap::ALL); |
|
184 | + $rows = $this->_searchLDAP($this->allContactsDN, $filter = $this->id_filter($contact_id), $this->all_attributes, Ldap::ALL); |
|
186 | 185 | //error_log(__METHOD__."('$contact_id') _searchLDAP($this->allContactsDN, '$filter',...)=".array2string($rows)); |
187 | 186 | return $rows ? $rows[0] : false; |
188 | 187 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * @param array $keys if given $keys are copied to data before saveing => allows a save as |
36 | 36 | * @return int 0 on success and errno != 0 else |
37 | 37 | */ |
38 | - function save($keys=null) |
|
38 | + function save($keys = null) |
|
39 | 39 | { |
40 | 40 | // UCS lowercases email when storing |
41 | 41 | $keys['email'] = strtolower(!empty($keys['email']) ? $keys['email'] : $this->data['email']); |