@@ -368,7 +368,10 @@ discard block |
||
368 | 368 | { |
369 | 369 | if ($translated) |
370 | 370 | { |
371 | - if (!self::$countries_translated) self::_translate_countries(); |
|
371 | + if (!self::$countries_translated) |
|
372 | + { |
|
373 | + self::_translate_countries(); |
|
374 | + } |
|
372 | 375 | |
373 | 376 | return self::$countries_translated[strtoupper($code)]; |
374 | 377 | } |
@@ -383,7 +386,11 @@ discard block |
||
383 | 386 | */ |
384 | 387 | public static function country_code($name) |
385 | 388 | { |
386 | - if (!$name) return ''; // nothing to do |
|
389 | + if (!$name) |
|
390 | + { |
|
391 | + return ''; |
|
392 | + } |
|
393 | + // nothing to do |
|
387 | 394 | |
388 | 395 | if (strlen($name) == 2 && isset(self::$country_array[$name])) |
389 | 396 | { |
@@ -394,7 +401,10 @@ discard block |
||
394 | 401 | { |
395 | 402 | return $code; |
396 | 403 | } |
397 | - if (!self::$countries_translated) self::_translate_countries(); |
|
404 | + if (!self::$countries_translated) |
|
405 | + { |
|
406 | + self::_translate_countries(); |
|
407 | + } |
|
398 | 408 | |
399 | 409 | if (($code = array_search(strtoupper($name),self::$countries_translated)) !== false || |
400 | 410 | ($code = array_search($name,self::$countries_translated)) !== false) |
@@ -429,7 +439,10 @@ discard block |
||
429 | 439 | { |
430 | 440 | if ($translated) |
431 | 441 | { |
432 | - if (!self::$countries_translated) self::_translate_countries(); |
|
442 | + if (!self::$countries_translated) |
|
443 | + { |
|
444 | + self::_translate_countries(); |
|
445 | + } |
|
433 | 446 | |
434 | 447 | return self::$countries_translated; |
435 | 448 | } |
@@ -443,7 +456,10 @@ discard block |
||
443 | 456 | */ |
444 | 457 | protected static function _translate_countries() |
445 | 458 | { |
446 | - if (self::$countries_translated) return; |
|
459 | + if (self::$countries_translated) |
|
460 | + { |
|
461 | + return; |
|
462 | + } |
|
447 | 463 | |
448 | 464 | self::$countries_translated = self::$country_array; |
449 | 465 | // try to translate them and sort alphabetic |
@@ -90,7 +90,10 @@ discard block |
||
90 | 90 | if (($id = $GLOBALS['egw']->accounts->name2id($username,'account_lid','u'))) |
91 | 91 | { |
92 | 92 | $ret = $GLOBALS['egw']->accounts->id2name($id,'account_status') == 'A'; |
93 | - if (!$ret) error_log(__METHOD__."('$username') account_status check returning ".array2string($ret)); |
|
93 | + if (!$ret) |
|
94 | + { |
|
95 | + error_log(__METHOD__."('$username') account_status check returning ".array2string($ret)); |
|
96 | + } |
|
94 | 97 | return $ret; |
95 | 98 | } |
96 | 99 | // store homedirectory for egw_session->read_repositories |
@@ -158,7 +161,10 @@ discard block |
||
158 | 161 | static function setLastPwdChange($account_id=0, $passwd=NULL, $lastpwdchange=NULL, $return_mod=false) |
159 | 162 | { |
160 | 163 | unset($passwd); // not used but required by function signature |
161 | - if (!($adldap = Api\Accounts\Ads::get_adldap())) return false; |
|
164 | + if (!($adldap = Api\Accounts\Ads::get_adldap())) |
|
165 | + { |
|
166 | + return false; |
|
167 | + } |
|
162 | 168 | |
163 | 169 | if ($lastpwdchange) |
164 | 170 | { |
@@ -166,7 +172,10 @@ discard block |
||
166 | 172 | $ldapServerInfo = Api\Ldap\ServerInfo::get($adldap->getLdapConnection(), $GLOBALS['egw_info']['server']['ads_host']); |
167 | 173 | if ($ldapServerInfo->serverType == Api\Ldap\ServerInfo::SAMBA4) |
168 | 174 | { |
169 | - if ($lastpwdchange == -1) $lastpwdchange = time(); |
|
175 | + if ($lastpwdchange == -1) |
|
176 | + { |
|
177 | + $lastpwdchange = time(); |
|
178 | + } |
|
170 | 179 | } |
171 | 180 | // while Windows only allows to set -1 for current time (or 0 to force user to change password) |
172 | 181 | else |
@@ -179,7 +188,10 @@ discard block |
||
179 | 188 | $lastpwdchange = Api\Accounts\Ads::convertUnixTimeToWindowsTime($lastpwdchange); |
180 | 189 | } |
181 | 190 | $mod = array('pwdlastset' => $lastpwdchange); |
182 | - if ($return_mod) return $mod; |
|
191 | + if ($return_mod) |
|
192 | + { |
|
193 | + return $mod; |
|
194 | + } |
|
183 | 195 | |
184 | 196 | $ret = false; |
185 | 197 | if ($account_id && ($username = Api\Accounts::id2name($account_id, 'account_lid')) && |
@@ -70,7 +70,10 @@ discard block |
||
70 | 70 | } |
71 | 71 | catch(Horde_Imap_Client_Exception $e) { |
72 | 72 | // throw everything but authentication failed as exception |
73 | - if ($e->getCode() != Horde_Imap_Client_Exception::LOGIN_AUTHENTICATIONFAILED) throw $e; |
|
73 | + if ($e->getCode() != Horde_Imap_Client_Exception::LOGIN_AUTHENTICATIONFAILED) |
|
74 | + { |
|
75 | + throw $e; |
|
76 | + } |
|
74 | 77 | |
75 | 78 | $mailauth = false; |
76 | 79 | } |
@@ -84,23 +87,38 @@ discard block |
||
84 | 87 | { |
85 | 88 | case 'imap': |
86 | 89 | default: |
87 | - if (!isset($port)) $port = 143; |
|
90 | + if (!isset($port)) |
|
91 | + { |
|
92 | + $port = 143; |
|
93 | + } |
|
88 | 94 | $mailauth = imap_open('{'.$host.':'.$port.'/imap/novalidate-cert}INBOX', $username , $passwd); |
89 | 95 | break; |
90 | 96 | case 'imaps': |
91 | - if (!isset($port)) $port = 993; |
|
97 | + if (!isset($port)) |
|
98 | + { |
|
99 | + $port = 993; |
|
100 | + } |
|
92 | 101 | $mailauth = imap_open('{'.$host.'/imap/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd); |
93 | 102 | break; |
94 | 103 | case 'pop3': |
95 | - if (!isset($port)) $port = 110; |
|
104 | + if (!isset($port)) |
|
105 | + { |
|
106 | + $port = 110; |
|
107 | + } |
|
96 | 108 | $mailauth = imap_open('{'.$host.'/pop3/novalidate-cert:'.$port.'}INBOX', $username , $passwd); |
97 | 109 | break; |
98 | 110 | case 'pop3s': |
99 | - if (!isset($port)) $port = 995; |
|
111 | + if (!isset($port)) |
|
112 | + { |
|
113 | + $port = 995; |
|
114 | + } |
|
100 | 115 | $mailauth = imap_open('{'.$host.'/pop3/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd); |
101 | 116 | break; |
102 | 117 | } |
103 | - if ($mailauth) imap_close($mailauth); |
|
118 | + if ($mailauth) |
|
119 | + { |
|
120 | + imap_close($mailauth); |
|
121 | + } |
|
104 | 122 | } |
105 | 123 | return !!$mailauth; |
106 | 124 | } |
@@ -33,13 +33,16 @@ |
||
33 | 33 | { |
34 | 34 | /* if program goes here, authenticate is, normaly, already verified by CAS */ |
35 | 35 | if ($GLOBALS['egw_info']['server']['account_repository'] != 'ldap' && |
36 | - $GLOBALS['egw_info']['server']['account_repository'] != 'ldsq') /* For anonymous LDAP connection */ |
|
36 | + $GLOBALS['egw_info']['server']['account_repository'] != 'ldsq') |
|
37 | + { |
|
38 | + /* For anonymous LDAP connection */ |
|
37 | 39 | { |
38 | 40 | if (!($id = $GLOBALS['egw']->accounts->name2id($username,'account_lid','u')) && |
39 | 41 | $GLOBALS['egw_info']['server']['auto_create_acct']) |
40 | 42 | { |
41 | 43 | // create a global array with all availible info about that account |
42 | 44 | $GLOBALS['auto_create_acct'] = array(); |
45 | + } |
|
43 | 46 | foreach(array( |
44 | 47 | 'givenname' => 'firstname', |
45 | 48 | 'sn' => 'lastname', |
@@ -109,9 +109,18 @@ discard block |
||
109 | 109 | function run($html2check, $Config=null, $Spec=array()) |
110 | 110 | { |
111 | 111 | //error_log(__METHOD__.__LINE__.' Input:'.$html2check); |
112 | - if (is_array($Config) && is_array($this->Configuration)) $Config = array_merge($this->Configuration, $Config); |
|
113 | - if (empty($Config)) $Config = $this->Configuration; |
|
114 | - if (empty($Spec)) $Spec = $this->Spec; |
|
112 | + if (is_array($Config) && is_array($this->Configuration)) |
|
113 | + { |
|
114 | + $Config = array_merge($this->Configuration, $Config); |
|
115 | + } |
|
116 | + if (empty($Config)) |
|
117 | + { |
|
118 | + $Config = $this->Configuration; |
|
119 | + } |
|
120 | + if (empty($Spec)) |
|
121 | + { |
|
122 | + $Spec = $this->Spec; |
|
123 | + } |
|
115 | 124 | // If we are processing mails, we take out stuff in <style> stuff </style> tags and |
116 | 125 | // put it back in after purifying; styles are processed for known security risks |
117 | 126 | // in self::getStyles |
@@ -139,7 +148,10 @@ discard block |
||
139 | 148 | { |
140 | 149 | $ct=0; |
141 | 150 | $newStyle = null; |
142 | - if (stripos($html,'<style')!==false) $ct = preg_match_all('#<style(?:\s.*)?>(.+)</style>#isU', $html, $newStyle); |
|
151 | + if (stripos($html,'<style')!==false) |
|
152 | + { |
|
153 | + $ct = preg_match_all('#<style(?:\s.*)?>(.+)</style>#isU', $html, $newStyle); |
|
154 | + } |
|
143 | 155 | if ($ct>0) |
144 | 156 | { |
145 | 157 | //error_log(__METHOD__.__LINE__.array2string($newStyle[0])); |
@@ -173,7 +185,11 @@ discard block |
||
173 | 185 | // CSS Security |
174 | 186 | // http://code.google.com/p/browsersec/wiki/Part1#Cascading_stylesheets |
175 | 187 | $css = preg_replace('/(javascript|expession|-moz-binding)/i','',$style); |
176 | - if (stripos($css,'script')!==false) Api\Mail\Html::replaceTagsCompletley($css,'script'); // Strip out script that may be included |
|
188 | + if (stripos($css,'script')!==false) |
|
189 | + { |
|
190 | + Api\Mail\Html::replaceTagsCompletley($css,'script'); |
|
191 | + } |
|
192 | + // Strip out script that may be included |
|
177 | 193 | // we need this, as styledefinitions are enclosed with curly brackets; and template stuff tries to replace everything between curly brackets that is having no horizontal whitespace |
178 | 194 | // as the comments as <!-- styledefinition --> in stylesheet are outdated, and ck-editor does not understand it, we remove it |
179 | 195 | $css_no_comment = str_replace(array(':','<!--','-->'),array(': ','',''),$css); |
@@ -199,12 +215,19 @@ discard block |
||
199 | 215 | { |
200 | 216 | $defaultConfig = array('valid_xhtml'=>1,'safe'=>1); |
201 | 217 | |
202 | - if (empty($html)) return $html; // no need to process further |
|
218 | + if (empty($html)) |
|
219 | + { |
|
220 | + return $html; |
|
221 | + } |
|
222 | + // no need to process further |
|
203 | 223 | if (!empty($config) && is_string($config)) |
204 | 224 | { |
205 | 225 | //error_log(__METHOD__.__LINE__.$config); |
206 | 226 | $config = json_decode($config,true); |
207 | - if (is_null($config)) error_log(__METHOD__.__LINE__." decoding of config failed; standard will be applied"); |
|
227 | + if (is_null($config)) |
|
228 | + { |
|
229 | + error_log(__METHOD__.__LINE__." decoding of config failed; standard will be applied"); |
|
230 | + } |
|
208 | 231 | } |
209 | 232 | |
210 | 233 | // User preferences |
@@ -218,8 +241,14 @@ discard block |
||
218 | 241 | return ''; |
219 | 242 | } |
220 | 243 | $htmLawed = new HtmLawed(); |
221 | - if (is_array($config) && $_force===false) $config = array_merge($defaultConfig, $config); |
|
222 | - if (empty($config)) $config = $defaultConfig; |
|
244 | + if (is_array($config) && $_force===false) |
|
245 | + { |
|
246 | + $config = array_merge($defaultConfig, $config); |
|
247 | + } |
|
248 | + if (empty($config)) |
|
249 | + { |
|
250 | + $config = $defaultConfig; |
|
251 | + } |
|
223 | 252 | //error_log(__METHOD__.__LINE__.array2string($config)); |
224 | 253 | return $htmLawed->run($html,$config,$spec); |
225 | 254 | } |
@@ -236,7 +265,8 @@ discard block |
||
236 | 265 | function hl_my_tag_transform($element, $attribute_array=0) |
237 | 266 | { |
238 | 267 | // If second argument is not received, it means a closing tag is being handled |
239 | - if(is_numeric($attribute_array)){ |
|
268 | + if(is_numeric($attribute_array)) |
|
269 | + { |
|
240 | 270 | return "</$element>"; |
241 | 271 | } |
242 | 272 | |
@@ -258,18 +288,30 @@ discard block |
||
258 | 288 | if($element == 'img') |
259 | 289 | { |
260 | 290 | // Re-build 'alt' |
261 | - if (isset($attribute_array['alt'])) $attribute_array['alt'] = ($attribute_array['alt']=='image'?'':$attribute_array['alt']); |
|
262 | - if (isset($attribute_array['alt'])&&strpos($attribute_array['alt'],'@')!==false) $attribute_array['alt']=str_replace('@','(at)',$attribute_array['alt']); |
|
291 | + if (isset($attribute_array['alt'])) |
|
292 | + { |
|
293 | + $attribute_array['alt'] = ($attribute_array['alt']=='image'?'':$attribute_array['alt']); |
|
294 | + } |
|
295 | + if (isset($attribute_array['alt'])&&strpos($attribute_array['alt'],'@')!==false) |
|
296 | + { |
|
297 | + $attribute_array['alt']=str_replace('@','(at)',$attribute_array['alt']); |
|
298 | + } |
|
263 | 299 | } |
264 | 300 | if (isset($attribute_array['title'])) |
265 | 301 | { |
266 | - if (strpos($attribute_array['title'],'@')!==false) $attribute_array['title']=str_replace('@','(at)',$attribute_array['title']); |
|
302 | + if (strpos($attribute_array['title'],'@')!==false) |
|
303 | + { |
|
304 | + $attribute_array['title']=str_replace('@','(at)',$attribute_array['title']); |
|
305 | + } |
|
267 | 306 | } |
268 | 307 | if ($element == 'blockquote') |
269 | 308 | { |
270 | 309 | if (isset($attribute_array['cite'])) |
271 | 310 | { |
272 | - if (strpos($attribute_array['cite'],'@')!==false) $attribute_array['cite']=str_replace('@','(at)',$attribute_array['cite']); |
|
311 | + if (strpos($attribute_array['cite'],'@')!==false) |
|
312 | + { |
|
313 | + $attribute_array['cite']=str_replace('@','(at)',$attribute_array['cite']); |
|
314 | + } |
|
273 | 315 | } |
274 | 316 | } |
275 | 317 | /* |
@@ -301,7 +343,10 @@ discard block |
||
301 | 343 | $attribute_array['style'] = implode('; ', $style); |
302 | 344 | } |
303 | 345 | */ |
304 | - if (isset($attribute_array['style']) && stripos($attribute_array['style'],'script')!==false) $attribute_array['style'] = str_ireplace('script','',$attribute_array['style']); |
|
346 | + if (isset($attribute_array['style']) && stripos($attribute_array['style'],'script')!==false) |
|
347 | + { |
|
348 | + $attribute_array['style'] = str_ireplace('script','',$attribute_array['style']); |
|
349 | + } |
|
305 | 350 | if($element == 'a') |
306 | 351 | { |
307 | 352 | //error_log(__METHOD__.__LINE__.array2string($attribute_array)); |
@@ -314,12 +359,16 @@ discard block |
||
314 | 359 | { |
315 | 360 | $attribute_array['href']=str_ireplace("');",'',str_ireplace("javascript:GoToAnchor('","#",$attribute_array['href'])); |
316 | 361 | } |
317 | - if (strpos($attribute_array['href'],'denied:javascript')===0) $attribute_array['href']=''; |
|
362 | + if (strpos($attribute_array['href'],'denied:javascript')===0) |
|
363 | + { |
|
364 | + $attribute_array['href']=''; |
|
365 | + } |
|
318 | 366 | } |
319 | 367 | |
320 | 368 | // Build the attributes string |
321 | 369 | $attributes = ''; |
322 | - foreach($attribute_array as $k=>$v){ |
|
370 | + foreach($attribute_array as $k=>$v) |
|
371 | + { |
|
323 | 372 | $attributes .= " {$k}=\"{$v}\""; |
324 | 373 | } |
325 | 374 | |
@@ -344,27 +393,52 @@ discard block |
||
344 | 393 | //error_log(__METHOD__.__LINE__.$element.'=>'.array2string($attribute_array)); |
345 | 394 | static $lastelement = null; |
346 | 395 | static $throwawaycounter = null; |
347 | - if (is_null($lastelement)) $lastelement=''; |
|
348 | - if (is_null($throwawaycounter)) $throwawaycounter = 0; |
|
396 | + if (is_null($lastelement)) |
|
397 | + { |
|
398 | + $lastelement=''; |
|
399 | + } |
|
400 | + if (is_null($throwawaycounter)) |
|
401 | + { |
|
402 | + $throwawaycounter = 0; |
|
403 | + } |
|
349 | 404 | //if ($throwawaycounter>1) error_log(__METHOD__.__LINE__.' '.$throwawaycounter.$element.array2string($attribute_array)); |
350 | 405 | if ($element=='div' && $element==$lastelement && ($attribute_array==0 || empty($attribute_array))) |
351 | 406 | { |
352 | - if (is_array($attribute_array)) $throwawaycounter++; |
|
353 | - if ($attribute_array==0 && $throwawaycounter>0) $throwawaycounter--; |
|
354 | - if ($throwawaycounter>1) return ''; |
|
407 | + if (is_array($attribute_array)) |
|
408 | + { |
|
409 | + $throwawaycounter++; |
|
410 | + } |
|
411 | + if ($attribute_array==0 && $throwawaycounter>0) |
|
412 | + { |
|
413 | + $throwawaycounter--; |
|
414 | + } |
|
415 | + if ($throwawaycounter>1) |
|
416 | + { |
|
417 | + return ''; |
|
418 | + } |
|
419 | + } |
|
420 | + if ($lastelement=='div' && $element!=$lastelement && is_array($attribute_array)) |
|
421 | + { |
|
422 | + $throwawaycounter = 0; |
|
355 | 423 | } |
356 | - if ($lastelement=='div' && $element!=$lastelement && is_array($attribute_array)) $throwawaycounter = 0; |
|
357 | 424 | if (is_array($attribute_array) && !empty($attribute_array) && $element=='div') |
358 | 425 | { |
359 | 426 | $lastelement = 'div_with_attr'; |
360 | 427 | } |
361 | 428 | else |
362 | 429 | { |
363 | - if (is_array($attribute_array)) $lastelement = $element; |
|
430 | + if (is_array($attribute_array)) |
|
431 | + { |
|
432 | + $lastelement = $element; |
|
433 | + } |
|
364 | 434 | } |
365 | 435 | // If second argument is not received, it means a closing tag is being handled |
366 | - if(is_numeric($attribute_array)){ |
|
367 | - if($element==$lastelement) $lastelement=''; |
|
436 | + if(is_numeric($attribute_array)) |
|
437 | + { |
|
438 | + if($element==$lastelement) |
|
439 | + { |
|
440 | + $lastelement=''; |
|
441 | + } |
|
368 | 442 | return "</$element>"; |
369 | 443 | } |
370 | 444 | |
@@ -386,15 +460,24 @@ discard block |
||
386 | 460 | if($element == 'img') |
387 | 461 | { |
388 | 462 | // Re-build 'alt' |
389 | - if (isset($attribute_array['alt'])) $attribute_array['alt'] = ($attribute_array['alt']=='image'?'':$attribute_array['alt']); |
|
390 | - if (isset($attribute_array['alt'])&&strpos($attribute_array['alt'],'@')!==false) $attribute_array['alt']=str_replace('@','(at)',$attribute_array['alt']); |
|
463 | + if (isset($attribute_array['alt'])) |
|
464 | + { |
|
465 | + $attribute_array['alt'] = ($attribute_array['alt']=='image'?'':$attribute_array['alt']); |
|
466 | + } |
|
467 | + if (isset($attribute_array['alt'])&&strpos($attribute_array['alt'],'@')!==false) |
|
468 | + { |
|
469 | + $attribute_array['alt']=str_replace('@','(at)',$attribute_array['alt']); |
|
470 | + } |
|
391 | 471 | // $GLOBALS['egw_info']['user']['preferences']['mail']['allowExternalIMGs'] ? '' : 'match' => '/^cid:.*/'), |
392 | 472 | if (isset($attribute_array['src'])) |
393 | 473 | { |
394 | 474 | if (!(strlen($attribute_array['src'])>4 && strlen($attribute_array['src']<400))) |
395 | 475 | { |
396 | 476 | $attribute_array['alt']= $attribute_array['alt'].' [blocked (reason: url length):'.$attribute_array['src'].']'; |
397 | - if (!isset($attribute_array['title'])) $attribute_array['title']=$attribute_array['alt']; |
|
477 | + if (!isset($attribute_array['title'])) |
|
478 | + { |
|
479 | + $attribute_array['title']=$attribute_array['alt']; |
|
480 | + } |
|
398 | 481 | $attribute_array['src']=Api\Image::find('phpgwapi','dialog_error'); |
399 | 482 | } |
400 | 483 | if (!preg_match('/^cid:.*/',$attribute_array['src'])) |
@@ -405,36 +488,60 @@ discard block |
||
405 | 488 | if (empty($GLOBALS['egw_info']['server']['webserver_url'])||!preg_match("$^".$GLOBALS['egw_info']['server']['webserver_url'].".*$",$attribute_array['src'])) |
406 | 489 | { |
407 | 490 | $attribute_array['alt']= $attribute_array['alt'].' [blocked external image:'.$attribute_array['src'].']'; |
408 | - if (!isset($attribute_array['title'])) $attribute_array['title']=$attribute_array['alt']; |
|
491 | + if (!isset($attribute_array['title'])) |
|
492 | + { |
|
493 | + $attribute_array['title']=$attribute_array['alt']; |
|
494 | + } |
|
409 | 495 | $attribute_array['src']=Api\Image::find('mail','no-image-shown'); |
410 | 496 | $attribute_array['border'] = 1; |
411 | 497 | if ($attribute_array['style']) |
412 | 498 | { |
413 | - if (stripos($attribute_array['style'],'border')!==false) $attribute_array['style'] = preg_replace('~border(:|-left:|-right:|-bottom:|-top:)+ (0px)+ (none)+;~si','',$attribute_array['style']); |
|
499 | + if (stripos($attribute_array['style'],'border')!==false) |
|
500 | + { |
|
501 | + $attribute_array['style'] = preg_replace('~border(:|-left:|-right:|-bottom:|-top:)+ (0px)+ (none)+;~si','',$attribute_array['style']); |
|
502 | + } |
|
414 | 503 | } |
415 | 504 | } |
416 | 505 | } |
417 | 506 | } |
418 | 507 | } |
419 | 508 | } |
420 | - if (isset($attribute_array['style']) && stripos($attribute_array['style'],'script')!==false) $attribute_array['style'] = str_ireplace('script','',$attribute_array['style']); |
|
509 | + if (isset($attribute_array['style']) && stripos($attribute_array['style'],'script')!==false) |
|
510 | + { |
|
511 | + $attribute_array['style'] = str_ireplace('script','',$attribute_array['style']); |
|
512 | + } |
|
421 | 513 | if (isset($attribute_array['title'])) |
422 | 514 | { |
423 | - if (strpos($attribute_array['title'],'@')!==false) $attribute_array['title']=str_replace('@','(at)',$attribute_array['title']); |
|
515 | + if (strpos($attribute_array['title'],'@')!==false) |
|
516 | + { |
|
517 | + $attribute_array['title']=str_replace('@','(at)',$attribute_array['title']); |
|
518 | + } |
|
424 | 519 | } |
425 | 520 | if ($element == 'blockquote') |
426 | 521 | { |
427 | 522 | if (isset($attribute_array['cite'])) |
428 | 523 | { |
429 | - if (strpos($attribute_array['cite'],'@')!==false) $attribute_array['cite']=str_replace('@','(at)',$attribute_array['cite']); |
|
524 | + if (strpos($attribute_array['cite'],'@')!==false) |
|
525 | + { |
|
526 | + $attribute_array['cite']=str_replace('@','(at)',$attribute_array['cite']); |
|
527 | + } |
|
430 | 528 | } |
431 | 529 | } |
432 | 530 | if($element == 'a') |
433 | 531 | { |
434 | 532 | //error_log(__METHOD__.__LINE__.array2string($attribute_array)); |
435 | - if (strpos($attribute_array['href'],'denied:javascript')===0) $attribute_array['href']=''; |
|
436 | - if (isset($attribute_array['name']) && isset($attribute_array['id'])) $attribute_array['id'] = $attribute_array['name']; |
|
437 | - if (strpos($attribute_array['href'],'@')!==false) $attribute_array['href'] = str_replace('@','%40',$attribute_array['href']); |
|
533 | + if (strpos($attribute_array['href'],'denied:javascript')===0) |
|
534 | + { |
|
535 | + $attribute_array['href']=''; |
|
536 | + } |
|
537 | + if (isset($attribute_array['name']) && isset($attribute_array['id'])) |
|
538 | + { |
|
539 | + $attribute_array['id'] = $attribute_array['name']; |
|
540 | + } |
|
541 | + if (strpos($attribute_array['href'],'@')!==false) |
|
542 | + { |
|
543 | + $attribute_array['href'] = str_replace('@','%40',$attribute_array['href']); |
|
544 | + } |
|
438 | 545 | if (strpos($attribute_array['href'],'#')===0 && (isset(Api\Mail::$htmLawed_config['transform_anchor']) && Api\Mail::$htmLawed_config['transform_anchor']===true)) |
439 | 546 | { |
440 | 547 | $attribute_array['href'] = "javascript:GoToAnchor('".trim(substr($attribute_array['href'],1))."');"; |
@@ -444,7 +551,8 @@ discard block |
||
444 | 551 | |
445 | 552 | // Build the attributes string |
446 | 553 | $attributes = ''; |
447 | - foreach($attribute_array as $k=>$v){ |
|
554 | + foreach($attribute_array as $k=>$v) |
|
555 | + { |
|
448 | 556 | $attributes .= " {$k}=\"{$v}\""; |
449 | 557 | } |
450 | 558 |
@@ -64,10 +64,16 @@ |
||
64 | 64 | if (!isset($stored_purpose) || $stored_purpose !== $_purpose) |
65 | 65 | { |
66 | 66 | error_log('CSRF detected from IP '.$_SERVER['REMOTE_ADDR'].' to '.$_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI']); |
67 | - if ($_POST) error_log(array2string($_POST)); |
|
67 | + if ($_POST) |
|
68 | + { |
|
69 | + error_log(array2string($_POST)); |
|
70 | + } |
|
68 | 71 | // we are not throwing an exception here, but die, to not allow catching it! |
69 | 72 | die("CSRF detected, request terminated!"); |
70 | 73 | } |
71 | - if ($_delete_token) Cache::unsetSession(__CLASS__, $_token); |
|
74 | + if ($_delete_token) |
|
75 | + { |
|
76 | + Cache::unsetSession(__CLASS__, $_token); |
|
77 | + } |
|
72 | 78 | } |
73 | 79 | } |
74 | 80 | \ No newline at end of file |
@@ -33,7 +33,10 @@ discard block |
||
33 | 33 | { |
34 | 34 | $svg = Header\UserAgent::mobile() ? null : $_svg; // ATM we use svg icons only for mobile theme |
35 | 35 | static $image_map_no_svg = null, $image_map_svg = null; |
36 | - if (is_null($svg)) $svg = self::svg_usable (); |
|
36 | + if (is_null($svg)) |
|
37 | + { |
|
38 | + $svg = self::svg_usable (); |
|
39 | + } |
|
37 | 40 | if ($svg) |
38 | 41 | { |
39 | 42 | $image_map =& $image_map_svg; |
@@ -42,7 +45,10 @@ discard block |
||
42 | 45 | { |
43 | 46 | $image_map =& $image_map_no_svg; |
44 | 47 | } |
45 | - if (is_null($image_map)) $image_map = self::map(null, $svg); |
|
48 | + if (is_null($image_map)) |
|
49 | + { |
|
50 | + $image_map = self::map(null, $svg); |
|
51 | + } |
|
46 | 52 | |
47 | 53 | // array of images in descending precedence |
48 | 54 | if (is_array($image)) |
@@ -152,15 +158,24 @@ discard block |
||
152 | 158 | $img_types = array('png','jpg','gif','ico'); |
153 | 159 | |
154 | 160 | // if we want svg, prepend it to img-types |
155 | - if ($svg) array_unshift ($img_types, 'svg'); |
|
161 | + if ($svg) |
|
162 | + { |
|
163 | + array_unshift ($img_types, 'svg'); |
|
164 | + } |
|
156 | 165 | |
157 | 166 | $map = array(); |
158 | 167 | foreach(scandir(EGW_SERVER_ROOT) as $app) |
159 | 168 | { |
160 | - if ($app[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$app) || !file_exists(EGW_SERVER_ROOT.'/'.$app.'/templates')) continue; |
|
169 | + if ($app[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$app) || !file_exists(EGW_SERVER_ROOT.'/'.$app.'/templates')) |
|
170 | + { |
|
171 | + continue; |
|
172 | + } |
|
161 | 173 | |
162 | 174 | $app_map =& $map[$app]; |
163 | - if (true) $app_map = array(); |
|
175 | + if (true) |
|
176 | + { |
|
177 | + $app_map = array(); |
|
178 | + } |
|
164 | 179 | $imagedirs = array(); |
165 | 180 | if (Header\UserAgent::mobile()) |
166 | 181 | { |
@@ -174,24 +189,39 @@ discard block |
||
174 | 189 | { |
175 | 190 | $imagedirs[] = '/'.$app.'/templates/'.$template_set.'/images'; |
176 | 191 | } |
177 | - if ($template_set != 'idots') $imagedirs[] = '/'.$app.'/templates/idots/images'; |
|
192 | + if ($template_set != 'idots') |
|
193 | + { |
|
194 | + $imagedirs[] = '/'.$app.'/templates/idots/images'; |
|
195 | + } |
|
178 | 196 | $imagedirs[] = '/'.$app.'/templates/default/images'; |
179 | 197 | |
180 | 198 | foreach($imagedirs as $imagedir) |
181 | 199 | { |
182 | - if (!file_exists($dir = EGW_SERVER_ROOT.$imagedir) || !is_readable($dir)) continue; |
|
200 | + if (!file_exists($dir = EGW_SERVER_ROOT.$imagedir) || !is_readable($dir)) |
|
201 | + { |
|
202 | + continue; |
|
203 | + } |
|
183 | 204 | |
184 | 205 | foreach(scandir($dir) as $img) |
185 | 206 | { |
186 | - if ($img[0] == '.') continue; |
|
207 | + if ($img[0] == '.') |
|
208 | + { |
|
209 | + continue; |
|
210 | + } |
|
187 | 211 | |
188 | 212 | $subdir = null; |
189 | 213 | foreach(is_dir($dir.'/'.$img) ? scandir($dir.'/'.($subdir=$img)) : (array) $img as $img) |
190 | 214 | { |
191 | 215 | $name = null; |
192 | - if (!in_array($ext = self::get_extension($img, $name), $img_types) || empty($name)) continue; |
|
216 | + if (!in_array($ext = self::get_extension($img, $name), $img_types) || empty($name)) |
|
217 | + { |
|
218 | + continue; |
|
219 | + } |
|
193 | 220 | |
194 | - if (isset($subdir)) $name = $subdir.'/'.$name; |
|
221 | + if (isset($subdir)) |
|
222 | + { |
|
223 | + $name = $subdir.'/'.$name; |
|
224 | + } |
|
195 | 225 | |
196 | 226 | if (!isset($app_map[$name]) || array_search($ext, $img_types) < array_search(self::get_extension($app_map[$name]), $img_types)) |
197 | 227 | { |
@@ -202,12 +232,18 @@ discard block |
||
202 | 232 | } |
203 | 233 | } |
204 | 234 | $app_map =& $map['vfs']; |
205 | - if (true) $app_map = array(); |
|
235 | + if (true) |
|
236 | + { |
|
237 | + $app_map = array(); |
|
238 | + } |
|
206 | 239 | if (($dir = $GLOBALS['egw_info']['server']['vfs_image_dir']) && Vfs::file_exists($dir) && Vfs::is_readable($dir)) |
207 | 240 | { |
208 | 241 | foreach(Vfs::find($dir) as $img) |
209 | 242 | { |
210 | - if (!in_array($ext = self::get_extension($img, $name), $img_types) || empty($name)) continue; |
|
243 | + if (!in_array($ext = self::get_extension($img, $name), $img_types) || empty($name)) |
|
244 | + { |
|
245 | + continue; |
|
246 | + } |
|
211 | 247 | |
212 | 248 | if (!isset($app_map[$name]) || array_search($ext, $img_types) < array_search(self::get_extension($app_map[$name]), $img_types)) |
213 | 249 | { |
@@ -235,8 +235,14 @@ discard block |
||
235 | 235 | */ |
236 | 236 | /*static*/ public function mailbox_addr($account,$domain=null,$mail_login_type=null) |
237 | 237 | { |
238 | - if (is_null($domain)) $domain = $this->defaultDomain; |
|
239 | - if (is_null($mail_login_type)) $mail_login_type = $this->loginType; |
|
238 | + if (is_null($domain)) |
|
239 | + { |
|
240 | + $domain = $this->defaultDomain; |
|
241 | + } |
|
242 | + if (is_null($mail_login_type)) |
|
243 | + { |
|
244 | + $mail_login_type = $this->loginType; |
|
245 | + } |
|
240 | 246 | |
241 | 247 | switch($mail_login_type) |
242 | 248 | { |
@@ -245,7 +251,10 @@ discard block |
||
245 | 251 | break; |
246 | 252 | |
247 | 253 | case 'uidNumber': |
248 | - if (is_array($account)) $account = $account['account_id']; |
|
254 | + if (is_array($account)) |
|
255 | + { |
|
256 | + $account = $account['account_id']; |
|
257 | + } |
|
249 | 258 | $mbox = 'u'.$account.'@'.$domain; |
250 | 259 | break; |
251 | 260 |
@@ -121,7 +121,10 @@ discard block |
||
121 | 121 | function getUserData($_username) |
122 | 122 | { |
123 | 123 | // no need to switch to admin-connection for reading quota of current user |
124 | - if ($_username !== $GLOBALS['egw_info']['user']['account_lid']) $this->adminConnection(); |
|
124 | + if ($_username !== $GLOBALS['egw_info']['user']['account_lid']) |
|
125 | + { |
|
126 | + $this->adminConnection(); |
|
127 | + } |
|
125 | 128 | $userData = array(); |
126 | 129 | |
127 | 130 | if(($quota = $this->getQuotaByUser($_username,'ALL'))) |
@@ -131,7 +134,10 @@ discard block |
||
131 | 134 | } |
132 | 135 | //error_log(__LINE__.': '.__METHOD__."('$_username') quota=".array2string($quota).' returning '.array2string($userData)); |
133 | 136 | |
134 | - if ($_username !== $GLOBALS['egw_info']['user']['account_lid']) $this->disconnect(); |
|
137 | + if ($_username !== $GLOBALS['egw_info']['user']['account_lid']) |
|
138 | + { |
|
139 | + $this->disconnect(); |
|
140 | + } |
|
135 | 141 | |
136 | 142 | return $userData; |
137 | 143 | } |
@@ -204,7 +210,10 @@ discard block |
||
204 | 210 | $userimap->subscribeMailbox($value); |
205 | 211 | } |
206 | 212 | } |
207 | - if (isset($userimap)) $userimap->logout(); |
|
213 | + if (isset($userimap)) |
|
214 | + { |
|
215 | + $userimap->logout(); |
|
216 | + } |
|
208 | 217 | } |
209 | 218 | catch(Horde_Imap_Client_Exception $e) { |
210 | 219 | _egw_log_exception($e); |