@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | * @param array $old =null old/last state of the entry or null for a new entry |
107 | 107 | * @return mixed |
108 | 108 | */ |
109 | - function get_config($name,$data,$old=null) |
|
109 | + function get_config($name, $data, $old = null) |
|
110 | 110 | { |
111 | - unset($old); // not used, but required by function signature |
|
111 | + unset($old); // not used, but required by function signature |
|
112 | 112 | |
113 | - switch($name) |
|
113 | + switch ($name) |
|
114 | 114 | { |
115 | 115 | case 'copy': |
116 | 116 | if ($data['is_contactform']) |
117 | 117 | { |
118 | - $copy = preg_split('/, ?/',$data['email_contactform']); |
|
119 | - if ($data['email_copytoreceiver']) $copy[] = $data['email']; |
|
118 | + $copy = preg_split('/, ?/', $data['email_contactform']); |
|
119 | + if ($data['email_copytoreceiver']) $copy[] = $data['email']; |
|
120 | 120 | return $copy; |
121 | 121 | } |
122 | 122 | break; |
@@ -144,27 +144,27 @@ discard block |
||
144 | 144 | * @param array $changed_fields =null changed fields from ealier call to $this->changed_fields($data,$old), to not compute it again |
145 | 145 | * @return int number of log-entries made |
146 | 146 | */ |
147 | - protected function save_history(array $data,array $old=null,$deleted=null,array $changed_fields=null) |
|
147 | + protected function save_history(array $data, array $old = null, $deleted = null, array $changed_fields = null) |
|
148 | 148 | { |
149 | 149 | if (is_null($changed_fields)) |
150 | 150 | { |
151 | - $changed_fields = self::changed_fields($data,$old); |
|
151 | + $changed_fields = self::changed_fields($data, $old); |
|
152 | 152 | } |
153 | 153 | if (!$changed_fields) return 0; |
154 | 154 | |
155 | - foreach(array('adr_one_countryname' => 'adr_one_countrycode', 'adr_two_countryname' => 'adr_two_countrycode') as $name => $code) |
|
155 | + foreach (array('adr_one_countryname' => 'adr_one_countrycode', 'adr_two_countryname' => 'adr_two_countrycode') as $name => $code) |
|
156 | 156 | { |
157 | 157 | // Only codes involved, but old text name is automatically added when loaded |
158 | - if($old[$code] && $data[$code] && ($key = array_search($name, $changed_fields)) !== false) |
|
158 | + if ($old[$code] && $data[$code] && ($key = array_search($name, $changed_fields)) !== false) |
|
159 | 159 | { |
160 | 160 | unset($changed_fields[$key]); |
161 | 161 | continue; |
162 | 162 | } |
163 | 163 | |
164 | 164 | // Code and a text name |
165 | - if(in_array($name, $changed_fields) && in_array($code, $changed_fields)) |
|
165 | + if (in_array($name, $changed_fields) && in_array($code, $changed_fields)) |
|
166 | 166 | { |
167 | - if($data[$code]) |
|
167 | + if ($data[$code]) |
|
168 | 168 | { |
169 | 169 | $data[$name] = Api\Country::get_full_name($data[$code], true); |
170 | 170 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | } |
174 | 174 | //error_log(__METHOD__.__LINE__.' ChangedFields:'.array2string($changed_fields)); |
175 | - return parent::save_history($data,$old,$deleted,$changed_fields); |
|
175 | + return parent::save_history($data, $old, $deleted, $changed_fields); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | * @param int|string $receiver nummeric account_id or email address |
184 | 184 | * @return string |
185 | 185 | */ |
186 | - protected function get_message($data,$old,$receiver=null) |
|
186 | + protected function get_message($data, $old, $receiver = null) |
|
187 | 187 | { |
188 | - unset($receiver); // not used, but required by function signature |
|
188 | + unset($receiver); // not used, but required by function signature |
|
189 | 189 | |
190 | 190 | if (!$data['modified'] || !$old) |
191 | 191 | { |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | * @param int|string $receiver nummeric account_id or email address |
208 | 208 | * @return string |
209 | 209 | */ |
210 | - protected function get_subject($data,$old,$deleted=null,$receiver=null) |
|
210 | + protected function get_subject($data, $old, $deleted = null, $receiver = null) |
|
211 | 211 | { |
212 | - unset($old, $deleted, $receiver); // not used, but required by function signature |
|
212 | + unset($old, $deleted, $receiver); // not used, but required by function signature |
|
213 | 213 | |
214 | 214 | if ($data['is_contactform']) |
215 | 215 | { |
@@ -225,15 +225,15 @@ discard block |
||
225 | 225 | * @param int|string $receiver nummeric account_id or email address |
226 | 226 | * @return array of details as array with values for keys 'label','value','type' |
227 | 227 | */ |
228 | - function get_details($data,$receiver=null) |
|
228 | + function get_details($data, $receiver = null) |
|
229 | 229 | { |
230 | - unset($receiver); // not used, but required by function signature |
|
230 | + unset($receiver); // not used, but required by function signature |
|
231 | 231 | |
232 | - foreach($this->contacts->contact_fields as $name => $label) |
|
232 | + foreach ($this->contacts->contact_fields as $name => $label) |
|
233 | 233 | { |
234 | 234 | if (!$data[$name] && $name != 'owner') continue; |
235 | 235 | |
236 | - switch($name) |
|
236 | + switch ($name) |
|
237 | 237 | { |
238 | 238 | case 'n_prefix': case 'n_given': case 'n_middle': case 'n_family': case 'n_suffix': // already in n_fn |
239 | 239 | case 'n_fileas': case 'id': case 'tid': |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | if ($data[$name]) |
264 | 264 | { |
265 | 265 | $cats = array(); |
266 | - foreach(is_array($data[$name]) ? $data[$name] : explode(',',$data[$name]) as $cat_id) |
|
266 | + foreach (is_array($data[$name]) ? $data[$name] : explode(',', $data[$name]) as $cat_id) |
|
267 | 267 | { |
268 | 268 | $cats[] = $GLOBALS['egw']->cats->id2name($cat_id); |
269 | 269 | } |
270 | 270 | $details[$name] = array( |
271 | 271 | 'label' => $label, |
272 | - 'value' => explode(', ',$cats), |
|
272 | + 'value' => explode(', ', $cats), |
|
273 | 273 | ); |
274 | 274 | } |
275 | 275 | case 'note': |
@@ -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']); |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | function getChild($name) |
67 | 67 | { |
68 | 68 | //error_log(__METHOD__."('$name') this->path=$this->path, this->vfs_path=$this->vfs_path"); |
69 | - $path = $this->vfs_path . '/' . $name; |
|
70 | - $vfs_path = $this->vfs_path . '/' . Vfs::encodePathComponent($name); |
|
69 | + $path = $this->vfs_path.'/'.$name; |
|
70 | + $vfs_path = $this->vfs_path.'/'.Vfs::encodePathComponent($name); |
|
71 | 71 | |
72 | - if (!Vfs::file_exists($vfs_path)) throw new DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
72 | + if (!Vfs::file_exists($vfs_path)) throw new DAV\Exception\NotFound('File with name '.$path.' could not be located'); |
|
73 | 73 | |
74 | 74 | if (Vfs::is_dir($vfs_path)) |
75 | 75 | { |
@@ -88,6 +88,6 @@ discard block |
||
88 | 88 | */ |
89 | 89 | function getQuotaInfo() |
90 | 90 | { |
91 | - return [ false, false ]; |
|
91 | + return [false, false]; |
|
92 | 92 | } |
93 | 93 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param boolean $store_request =false if true whole request data will be made available in $this->request |
98 | 98 | * @access public |
99 | 99 | */ |
100 | - function __construct($path, $store_request=false) |
|
100 | + function __construct($path, $store_request = false) |
|
101 | 101 | { |
102 | 102 | $this->success = true; |
103 | 103 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | xml_parser_set_option($xml_parser, |
124 | 124 | XML_OPTION_CASE_FOLDING, false); |
125 | 125 | |
126 | - while($this->success && !feof($f_in)) { |
|
126 | + while ($this->success && !feof($f_in)) { |
|
127 | 127 | $line = fgets($f_in); |
128 | 128 | if ($store_request) $this->request .= $line; |
129 | 129 | if (is_string($line)) { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | - if($had_input) { |
|
135 | + if ($had_input) { |
|
136 | 136 | $this->success &= xml_parse($xml_parser, "", true); |
137 | 137 | } |
138 | 138 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $prop = array("name" => $tag); |
170 | 170 | $this->current = array("name" => $tag, "ns" => $ns, "status"=> 200); |
171 | 171 | if ($this->mode == "set") { |
172 | - $this->current["val"] = ""; // default set val |
|
172 | + $this->current["val"] = ""; // default set val |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $this->current["val"] .= "<$tag"; |
178 | 178 | if (isset($attr)) { |
179 | 179 | foreach ($attr as $key => $val) { |
180 | - $this->current["val"] .= ' '.$key.'="'.str_replace('"','"', $val).'"'; |
|
180 | + $this->current["val"] .= ' '.$key.'="'.str_replace('"', '"', $val).'"'; |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | $this->current["val"] .= ">"; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param string $path |
112 | 112 | * @param boolean $store_request =false if true whole request data will be made available in $this->request |
113 | 113 | */ |
114 | - function __construct($path, $store_request=false) |
|
114 | + function __construct($path, $store_request = false) |
|
115 | 115 | { |
116 | 116 | // success state flag |
117 | 117 | $this->success = true; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | array(&$this, "_endElement")); |
142 | 142 | |
143 | 143 | xml_set_character_data_handler($xml_parser, |
144 | - array(&$this,'_charData') |
|
144 | + array(&$this, '_charData') |
|
145 | 145 | ); |
146 | 146 | |
147 | 147 | // we want a case sensitive parser |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | fclose($f_in); |
171 | 171 | |
172 | 172 | // if no input was parsed it was a request |
173 | - if(!count($this->props)) $this->props = "all"; // default |
|
173 | + if (!count($this->props)) $this->props = "all"; // default |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | break; |
214 | 214 | case 'filter': |
215 | 215 | $this->use = 'filters'; |
216 | - $this->filters['attrs'] = $attrs; // need attrs eg. <filters test="(anyof|alloff)"> |
|
216 | + $this->filters['attrs'] = $attrs; // need attrs eg. <filters test="(anyof|alloff)"> |
|
217 | 217 | break; |
218 | 218 | default: |
219 | 219 | $this->use = 'other'; |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | // this can happen if we have allprop and prop in one propfind: |
245 | 245 | // <allprop /><prop><blah /></prop>, eg. blah is not automatic returned by allprop |
246 | 246 | if (!is_array($this->{$this->use}) && $this->{$this->use}) $this->{$this->use} = array($this->{$this->use}); |
247 | - $this->{$this->use}[] =& $prop; |
|
248 | - $this->last_prop =& $prop; |
|
247 | + $this->{$this->use}[] = & $prop; |
|
248 | + $this->last_prop = & $prop; |
|
249 | 249 | unset($prop); |
250 | 250 | } |
251 | 251 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | function _charData($parser, $data) |
280 | 280 | { |
281 | 281 | if ($this->use != 'props' && ($n = count($this->{$this->use})) && ($data = trim($data))) { |
282 | - $this->{$this->use}[$n-1]['data'] = $data; |
|
282 | + $this->{$this->use}[$n - 1]['data'] = $data; |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | function PROPFIND(&$options, &$files) |
152 | 152 | { |
153 | 153 | // get absolute fs path to requested resource |
154 | - $fspath = $this->base . $options["path"]; |
|
154 | + $fspath = $this->base.$options["path"]; |
|
155 | 155 | |
156 | 156 | // sanity check |
157 | 157 | if (!file_exists($fspath)) { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | function fileinfo($path) |
199 | 199 | { |
200 | 200 | // map URI path to filesystem path |
201 | - $fspath = $this->base . $path; |
|
201 | + $fspath = $this->base.$path; |
|
202 | 202 | |
203 | 203 | // create result array |
204 | 204 | $info = array(); |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | $info["props"][] = $this->mkprop("displayname", strtoupper($path)); |
211 | 211 | |
212 | 212 | // creation and modification time |
213 | - $info["props"][] = $this->mkprop("creationdate", filectime($fspath)); |
|
213 | + $info["props"][] = $this->mkprop("creationdate", filectime($fspath)); |
|
214 | 214 | $info["props"][] = $this->mkprop("getlastmodified", filemtime($fspath)); |
215 | 215 | |
216 | 216 | // Microsoft extensions: last access time and 'hidden' status |
217 | - $info["props"][] = $this->mkprop("lastaccessed", fileatime($fspath)); |
|
217 | + $info["props"][] = $this->mkprop("lastaccessed", fileatime($fspath)); |
|
218 | 218 | $info["props"][] = $this->mkprop("ishidden", ('.' === substr(basename($fspath), 0, 1))); |
219 | 219 | |
220 | 220 | // type and size (caller already made sure that path exists) |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | // so we test the format of the returned string |
342 | 342 | |
343 | 343 | // the reply begins with the requested filename |
344 | - if (!strncmp($reply, "$fspath: ", strlen($fspath)+2)) { |
|
345 | - $reply = substr($reply, strlen($fspath)+2); |
|
344 | + if (!strncmp($reply, "$fspath: ", strlen($fspath) + 2)) { |
|
345 | + $reply = substr($reply, strlen($fspath) + 2); |
|
346 | 346 | // followed by the mime type (maybe including options) |
347 | 347 | if (preg_match('|^[[:alnum:]_-]+/[[:alnum:]_-]+;?.*|', $reply, $matches)) { |
348 | 348 | $mime_type = $matches[0]; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | function HEAD(&$options) |
393 | 393 | { |
394 | 394 | // get absolute fs path to requested resource |
395 | - $fspath = $this->base . $options["path"]; |
|
395 | + $fspath = $this->base.$options["path"]; |
|
396 | 396 | |
397 | 397 | // sanity check |
398 | 398 | if (!file_exists($fspath)) return false; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | function GET(&$options) |
422 | 422 | { |
423 | 423 | // get absolute fs path to requested resource |
424 | - $fspath = $this->base . $options["path"]; |
|
424 | + $fspath = $this->base.$options["path"]; |
|
425 | 425 | |
426 | 426 | // is this a collection? |
427 | 427 | if (is_dir($fspath)) { |
@@ -504,14 +504,14 @@ discard block |
||
504 | 504 | */ |
505 | 505 | function PUT(&$options) |
506 | 506 | { |
507 | - $fspath = $this->base . $options["path"]; |
|
507 | + $fspath = $this->base.$options["path"]; |
|
508 | 508 | |
509 | 509 | $dir = dirname($fspath); |
510 | 510 | if (!file_exists($dir) || !is_dir($dir)) { |
511 | 511 | return "409 Conflict"; // TODO right status code for both? |
512 | 512 | } |
513 | 513 | |
514 | - $options["new"] = ! file_exists($fspath); |
|
514 | + $options["new"] = !file_exists($fspath); |
|
515 | 515 | |
516 | 516 | if ($options["new"] && !$this->_is_writable($dir)) { |
517 | 517 | return "403 Forbidden"; |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | */ |
538 | 538 | function MKCOL($options) |
539 | 539 | { |
540 | - $path = $this->base .$options["path"]; |
|
540 | + $path = $this->base.$options["path"]; |
|
541 | 541 | $parent = dirname($path); |
542 | 542 | $name = basename($path); |
543 | 543 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | return "403 Forbidden"; |
550 | 550 | } |
551 | 551 | |
552 | - if ( file_exists($parent."/".$name) ) { |
|
552 | + if (file_exists($parent."/".$name)) { |
|
553 | 553 | return "405 Method not allowed"; |
554 | 554 | } |
555 | 555 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | */ |
575 | 575 | function DELETE($options) |
576 | 576 | { |
577 | - $path = $this->base . "/" .$options["path"]; |
|
577 | + $path = $this->base."/".$options["path"]; |
|
578 | 578 | |
579 | 579 | if (!file_exists($path)) { |
580 | 580 | return "404 Not found"; |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | * @param array general parameter passing array |
614 | 614 | * @return bool true on success |
615 | 615 | */ |
616 | - function COPY($options, $del=false) |
|
616 | + function COPY($options, $del = false) |
|
617 | 617 | { |
618 | 618 | // TODO Property updates still broken (Litmus should detect this?) |
619 | 619 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | return "502 bad gateway"; |
627 | 627 | } |
628 | 628 | |
629 | - $source = $this->base . $options["path"]; |
|
629 | + $source = $this->base.$options["path"]; |
|
630 | 630 | if (!file_exists($source)) { |
631 | 631 | return "404 Not found"; |
632 | 632 | } |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | } |
647 | 647 | } |
648 | 648 | |
649 | - $dest = $this->base . $options["dest"]; |
|
649 | + $dest = $this->base.$options["dest"]; |
|
650 | 650 | $destdir = dirname($dest); |
651 | 651 | |
652 | 652 | if (!file_exists($destdir) || !is_dir($destdir)) { |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | function LOCK(&$options) |
796 | 796 | { |
797 | 797 | // get absolute fs path to requested resource |
798 | - $fspath = $this->base . $options["path"]; |
|
798 | + $fspath = $this->base.$options["path"]; |
|
799 | 799 | |
800 | 800 | // TODO recursive locks on directories not supported yet |
801 | 801 | // makes litmus test "32. lock_collection" fail |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | return "409 Conflict"; |
804 | 804 | } |
805 | 805 | |
806 | - $options["timeout"] = time()+300; // 5min. hardcoded |
|
806 | + $options["timeout"] = time() + 300; // 5min. hardcoded |
|
807 | 807 | |
808 | 808 | if (isset($options["update"])) { // Lock Update |
809 | 809 | $where = "WHERE path = '$options[path]' AND token = '$options[update]'"; |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | |
823 | 823 | $options['owner'] = $row['owner']; |
824 | 824 | $options['scope'] = $row["exclusivelock"] ? "exclusive" : "shared"; |
825 | - $options['type'] = $row["exclusivelock"] ? "write" : "read"; |
|
825 | + $options['type'] = $row["exclusivelock"] ? "write" : "read"; |
|
826 | 826 | |
827 | 827 | return true; |
828 | 828 | } else { |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | , modified = ".time()." |
838 | 838 | , owner = '$options[owner]' |
839 | 839 | , expires = '$options[timeout]' |
840 | - , exclusivelock = " .($options['scope'] === "exclusive" ? "1" : "0") |
|
840 | + , exclusivelock = ".($options['scope'] === "exclusive" ? "1" : "0") |
|
841 | 841 | ; |
842 | 842 | mysql_query($query); |
843 | 843 | |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | mysql_free_result($res); |
882 | 882 | |
883 | 883 | if ($row) { |
884 | - $result = array( "type" => "write", |
|
884 | + $result = array("type" => "write", |
|
885 | 885 | "scope" => $row["exclusivelock"] ? "exclusive" : "shared", |
886 | 886 | "depth" => 0, |
887 | 887 | "owner" => $row['owner'], |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'script-src' => array("'unsafe-eval'"), |
34 | 34 | 'style-src' => array("'unsafe-inline'"), |
35 | 35 | 'connect-src' => array(), |
36 | - 'frame-src' => null, // NOT array(), to allow setting no default frame-src! |
|
36 | + 'frame-src' => null, // NOT array(), to allow setting no default frame-src! |
|
37 | 37 | ); |
38 | 38 | |
39 | 39 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $attrs = array('www.egroupware.org'); |
56 | 56 | if (($app_additional = Api\Hooks::process('csp-frame-src'))) |
57 | 57 | { |
58 | - foreach($app_additional as $addtional) |
|
58 | + foreach ($app_additional as $addtional) |
|
59 | 59 | { |
60 | 60 | if ($addtional) $attrs = array_unique(array_merge($attrs, $addtional)); |
61 | 61 | } |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | } |
64 | 64 | self::$sources[$source] = array(); |
65 | 65 | } |
66 | - foreach((array)$attrs as $attr) |
|
66 | + foreach ((array)$attrs as $attr) |
|
67 | 67 | { |
68 | 68 | if (in_array($attr, array('none', 'self', 'unsafe-eval', 'unsafe-inline'))) |
69 | 69 | { |
70 | - $attr = "'$attr'"; // automatic add quotes |
|
70 | + $attr = "'$attr'"; // automatic add quotes |
|
71 | 71 | } |
72 | 72 | if (!in_array($attr, self::$sources[$source])) |
73 | 73 | { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @param string|array $set =array() 'unsafe-eval' and/or 'unsafe-inline' (without quotes!) or URL (incl. protocol!) |
90 | 90 | */ |
91 | - public static function add_script_src($set=null) |
|
91 | + public static function add_script_src($set = null) |
|
92 | 92 | { |
93 | 93 | self::add('script-src', $set); |
94 | 94 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @param string|array $set =array() 'unsafe-inline' (without quotes!) and/or URL (incl. protocol!) |
102 | 102 | */ |
103 | - public static function add_style_src($set=null) |
|
103 | + public static function add_style_src($set = null) |
|
104 | 104 | { |
105 | 105 | self::add('style-src', $set); |
106 | 106 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @param string|array $set =array() URL (incl. protocol!) |
112 | 112 | */ |
113 | - public static function add_connect_src($set=null) |
|
113 | + public static function add_connect_src($set = null) |
|
114 | 114 | { |
115 | 115 | self::add('connect-src', $set); |
116 | 116 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param string|array $set =array() URL (incl. protocol!) |
124 | 124 | * @return string with attributes eg. "'unsafe-inline'" |
125 | 125 | */ |
126 | - public static function add_frame_src($set=null) |
|
126 | + public static function add_frame_src($set = null) |
|
127 | 127 | { |
128 | 128 | self::add('frame-src', $set); |
129 | 129 | } |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public static function send() |
137 | 137 | { |
138 | - self::add('frame-src', null); // set defaults for frame-src |
|
138 | + self::add('frame-src', null); // set defaults for frame-src |
|
139 | 139 | |
140 | 140 | $policies = array(); |
141 | - foreach(self::$sources as $source => $urls) |
|
141 | + foreach (self::$sources as $source => $urls) |
|
142 | 142 | { |
143 | 143 | $policies[] = "$source 'self' ".implode(' ', $urls); |
144 | 144 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // recommendaton ist to not send regular AND deprecated headers together, as they can cause unexpected behavior |
153 | 153 | if ($user_agent == 'chrome' && $version < 25 || $user_agent == 'safari' && $version < 7) |
154 | 154 | { |
155 | - header("X-Webkit-CSP: $csp"); // Chrome: <= 24, Safari incl. iOS |
|
155 | + header("X-Webkit-CSP: $csp"); // Chrome: <= 24, Safari incl. iOS |
|
156 | 156 | } |
157 | 157 | elseif ($user_agent == 'firefox' && $version < 23 || $user_agent == 'msie') // Edge is reported as 'edge'! |
158 | 158 | { |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | { |
77 | 77 | // should be Ok for all HTML 4 compatible browsers |
78 | 78 | $parts = $all_parts = null; |
79 | - if(!preg_match('/compatible; ([a-z]+)[\/ ]+([0-9.]+)/i',$_SERVER['HTTP_USER_AGENT'],$parts)) |
|
79 | + if (!preg_match('/compatible; ([a-z]+)[\/ ]+([0-9.]+)/i', $_SERVER['HTTP_USER_AGENT'], $parts)) |
|
80 | 80 | { |
81 | - preg_match_all('/([a-z]+)\/([0-9.]+)/i',$_SERVER['HTTP_USER_AGENT'],$all_parts,PREG_SET_ORDER); |
|
81 | + preg_match_all('/([a-z]+)\/([0-9.]+)/i', $_SERVER['HTTP_USER_AGENT'], $all_parts, PREG_SET_ORDER); |
|
82 | 82 | $parts = array_pop($all_parts); |
83 | - foreach($all_parts as $p) |
|
83 | + foreach ($all_parts as $p) |
|
84 | 84 | { |
85 | 85 | if ($p[1] == 'Chrome' && $parts[1] != 'Edge') |
86 | 86 | { |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
92 | - list(,self::$user_agent,self::$ua_version) = $parts; |
|
92 | + list(,self::$user_agent, self::$ua_version) = $parts; |
|
93 | 93 | if ((self::$user_agent = strtolower(self::$user_agent)) == 'version') self::$user_agent = 'opera'; |
94 | 94 | // IE no longer reports MSIE, but "Trident/7.0; rv:11.0" |
95 | - if (self::$user_agent=='trident') |
|
95 | + if (self::$user_agent == 'trident') |
|
96 | 96 | { |
97 | - self::$user_agent='msie'; |
|
97 | + self::$user_agent = 'msie'; |
|
98 | 98 | $matches = null; |
99 | 99 | self::$ua_version = preg_match('|Trident/[0-9.]+; rv:([0-9.]+)|i', $_SERVER['HTTP_USER_AGENT'], $matches) ? |
100 | 100 | $matches[1] : 11.0; |