@@ -50,7 +50,10 @@ discard block |
||
| 50 | 50 | else |
| 51 | 51 | { |
| 52 | 52 | $this->base_path = Api\Cache::get_system_config('temp_dir', false); |
| 53 | - if (isset($this->base_path)) $this->base_path .= '/egw_cache'; |
|
| 53 | + if (isset($this->base_path)) |
|
| 54 | + { |
|
| 55 | + $this->base_path .= '/egw_cache'; |
|
| 56 | + } |
|
| 54 | 57 | } |
| 55 | 58 | if (!isset($this->base_path) || !file_exists($this->base_path) && !mkdir($this->base_path,0700,true)) |
| 56 | 59 | { |
@@ -86,7 +89,10 @@ discard block |
||
| 86 | 89 | { |
| 87 | 90 | flock($ret, LOCK_EX); |
| 88 | 91 | $ok = fwrite($ret, serialize($data)); |
| 89 | - if ((int)$expiration > 0) file_put_contents($fname.self::EXPIRATION_EXTENSION,(string)$expiration); |
|
| 92 | + if ((int)$expiration > 0) |
|
| 93 | + { |
|
| 94 | + file_put_contents($fname.self::EXPIRATION_EXTENSION,(string)$expiration); |
|
| 95 | + } |
|
| 90 | 96 | flock($ret, LOCK_UN); |
| 91 | 97 | fclose($ret); |
| 92 | 98 | $ret = $ok !== false; |
@@ -106,7 +112,10 @@ discard block |
||
| 106 | 112 | { |
| 107 | 113 | if (($ret = @file_put_contents($fname=$this->filename($keys,true),serialize($data),LOCK_EX) > 0)) |
| 108 | 114 | { |
| 109 | - if ((int)$expiration > 0) file_put_contents($fname.self::EXPIRATION_EXTENSION,(string)$expiration); |
|
| 115 | + if ((int)$expiration > 0) |
|
| 116 | + { |
|
| 117 | + file_put_contents($fname.self::EXPIRATION_EXTENSION,(string)$expiration); |
|
| 118 | + } |
|
| 110 | 119 | } |
| 111 | 120 | return $ret; |
| 112 | 121 | } |
@@ -182,17 +191,26 @@ discard block |
||
| 182 | 191 | } |
| 183 | 192 | foreach(scandir($path) as $file) |
| 184 | 193 | { |
| 185 | - if ($file == '.' || $file == '..') continue; |
|
| 194 | + if ($file == '.' || $file == '..') |
|
| 195 | + { |
|
| 196 | + continue; |
|
| 197 | + } |
|
| 186 | 198 | |
| 187 | 199 | $file = $path.'/'.$file; |
| 188 | 200 | |
| 189 | 201 | if (is_dir($file)) |
| 190 | 202 | { |
| 191 | - if (!self::rm_recursive($file)) return false; |
|
| 203 | + if (!self::rm_recursive($file)) |
|
| 204 | + { |
|
| 205 | + return false; |
|
| 206 | + } |
|
| 192 | 207 | } |
| 193 | 208 | else |
| 194 | 209 | { |
| 195 | - if (!unlink($file)) return false; |
|
| 210 | + if (!unlink($file)) |
|
| 211 | + { |
|
| 212 | + return false; |
|
| 213 | + } |
|
| 196 | 214 | } |
| 197 | 215 | } |
| 198 | 216 | return rmdir($path); |
@@ -18,4 +18,6 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Exception thrown by Cache classes |
| 20 | 20 | */ |
| 21 | -class Exception extends Api\Exception {} |
|
| 21 | +class Exception extends Api\Exception |
|
| 22 | +{ |
|
| 23 | +} |
|
@@ -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', |
@@ -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 |
@@ -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); |