@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | static public $default_params = array( |
| 59 | 59 | //'debug' => '/tmp/imap.log', // uncomment to log communitcation with IMAP server |
| 60 | 60 | //'debug_literal' => true, // uncomment to log mail contents returned by IMAP server |
| 61 | - 'cache' => true, // default caching via emailadmin_horde_cache / egw_cache |
|
| 61 | + 'cache' => true, // default caching via emailadmin_horde_cache / egw_cache |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @param int $_timeout =null timeout in secs, if none given fmail pref or default of 20 is used |
| 137 | 137 | * @return void |
| 138 | 138 | */ |
| 139 | - function __construct(array $params, $_adminConnection=false, $_timeout=null) |
|
| 139 | + function __construct(array $params, $_adminConnection = false, $_timeout = null) |
|
| 140 | 140 | { |
| 141 | 141 | if (function_exists('mb_convert_encoding')) |
| 142 | 142 | { |
@@ -148,18 +148,18 @@ discard block |
||
| 148 | 148 | $this->loginType = $this->params['acc_imap_logintype']; |
| 149 | 149 | $this->domainName = $this->params['acc_domain']; |
| 150 | 150 | |
| 151 | - if (is_null($_timeout)) $_timeout = $this->params['acc_imap_timeout']?$this->params['acc_imap_timeout']:self::getTimeOut (); |
|
| 151 | + if (is_null($_timeout)) $_timeout = $this->params['acc_imap_timeout'] ? $this->params['acc_imap_timeout'] : self::getTimeOut(); |
|
| 152 | 152 | |
| 153 | - switch($this->params['acc_imap_ssl'] & ~emailadmin_account::SSL_VERIFY) |
|
| 153 | + switch ($this->params['acc_imap_ssl']&~emailadmin_account::SSL_VERIFY) |
|
| 154 | 154 | { |
| 155 | 155 | case emailadmin_account::SSL_STARTTLS: |
| 156 | - $secure = 'tls'; // Horde uses 'tls' for STARTTLS, not ssl connection with tls version >= 1 and no sslv2/3 |
|
| 156 | + $secure = 'tls'; // Horde uses 'tls' for STARTTLS, not ssl connection with tls version >= 1 and no sslv2/3 |
|
| 157 | 157 | break; |
| 158 | 158 | case emailadmin_account::SSL_SSL: |
| 159 | 159 | $secure = 'ssl'; |
| 160 | 160 | break; |
| 161 | 161 | case emailadmin_account::SSL_TLS: |
| 162 | - $secure = 'tlsv1'; // since Horde_Imap_Client-1.16.0 requiring Horde_Socket_Client-1.1.0 |
|
| 162 | + $secure = 'tlsv1'; // since Horde_Imap_Client-1.16.0 requiring Horde_Socket_Client-1.1.0 |
|
| 163 | 163 | break; |
| 164 | 164 | } |
| 165 | 165 | // Horde use locale for translation of error messages |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | 'port' => $this->params['acc_imap_port'], |
| 180 | 180 | 'secure' => $secure, |
| 181 | 181 | 'timeout' => $_timeout, |
| 182 | - )+self::$default_params; |
|
| 182 | + ) + self::$default_params; |
|
| 183 | 183 | |
| 184 | 184 | if ($parent_params['cache'] === true) |
| 185 | 185 | { |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | // as we have no way to tell this apart we ignore BINARY this affects |
| 204 | 204 | // Horde_Imap_Client_Fetch_Query::bodyPart for its fetch parameter decode=true is ignored |
| 205 | 205 | // (other functionality depending on BINARY is, of cause, affected too) |
| 206 | - $parent_params['capability_ignore']= array_merge((array)$parent_params['capability_ignore'],array('BINARY')); |
|
| 206 | + $parent_params['capability_ignore'] = array_merge((array)$parent_params['capability_ignore'], array('BINARY')); |
|
| 207 | 207 | break; |
| 208 | 208 | } |
| 209 | 209 | parent::__construct($parent_params); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * |
| 217 | 217 | * @param string $_username =true create an admin connection for given user or $this->acc_imap_username |
| 218 | 218 | */ |
| 219 | - function adminConnection($_username=true) |
|
| 219 | + function adminConnection($_username = true) |
|
| 220 | 220 | { |
| 221 | 221 | if ($this->isAdminConnection !== $_username) |
| 222 | 222 | { |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @param string $_username =null create an admin connection for given user or $this->acc_imap_username |
| 234 | 234 | * @throws Horde_IMAP_Client_Exception |
| 235 | 235 | */ |
| 236 | - public function checkAdminConnection($_username=true) |
|
| 236 | + public function checkAdminConnection($_username = true) |
|
| 237 | 237 | { |
| 238 | 238 | if ($this->acc_imap_administration) |
| 239 | 239 | { |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public function __get($name) |
| 252 | 252 | { |
| 253 | - switch($name) |
|
| 253 | + switch ($name) |
|
| 254 | 254 | { |
| 255 | 255 | case 'acc_imap_administration': |
| 256 | 256 | return !empty($this->params['acc_imap_admin_username']); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | { |
| 269 | 269 | return $this->$name; |
| 270 | 270 | } |
| 271 | - if (array_key_exists($name,$this->params)) |
|
| 271 | + if (array_key_exists($name, $this->params)) |
|
| 272 | 272 | { |
| 273 | 273 | return $this->params[$name]; |
| 274 | 274 | } |
@@ -289,9 +289,9 @@ discard block |
||
| 289 | 289 | * @deprecated allready called by constructor automatic, parameters must be passed to constructor! |
| 290 | 290 | * @return boolean|PEAR_Error true on success, PEAR_Error of false on failure |
| 291 | 291 | */ |
| 292 | - function openConnection($_adminConnection=false, $_timeout=null) |
|
| 292 | + function openConnection($_adminConnection = false, $_timeout = null) |
|
| 293 | 293 | { |
| 294 | - unset($_timeout); // not used |
|
| 294 | + unset($_timeout); // not used |
|
| 295 | 295 | if ($_adminConnection !== $this->params['adminConnection']) |
| 296 | 296 | { |
| 297 | 297 | throw new egw_exception_wrong_parameter('need to set parameters on calling emailadmin_account->imapServer()!'); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * @param string _use decide if the use is for IMAP or SIEVE, by now only the default differs |
| 305 | 305 | * @return int - timeout (either set or default 20/10) |
| 306 | 306 | */ |
| 307 | - static function getTimeOut($_use='IMAP') |
|
| 307 | + static function getTimeOut($_use = 'IMAP') |
|
| 308 | 308 | { |
| 309 | 309 | $timeout = $GLOBALS['egw_info']['user']['preferences']['mail']['connectionTimeout']; |
| 310 | 310 | if (empty($timeout) || !($timeout > 0)) $timeout = $_use == 'SIEVE' ? 10 : 20; // this is the default value |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | function addAccount($_hookValues) |
| 331 | 331 | { |
| 332 | - unset($_hookValues); // not used |
|
| 332 | + unset($_hookValues); // not used |
|
| 333 | 333 | return true; |
| 334 | 334 | } |
| 335 | 335 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | function updateAccount($_hookValues) |
| 343 | 343 | { |
| 344 | - unset($_hookValues); // not used |
|
| 344 | + unset($_hookValues); // not used |
|
| 345 | 345 | return true; |
| 346 | 346 | } |
| 347 | 347 | |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | */ |
| 354 | 354 | function deleteAccount($_hookValues) |
| 355 | 355 | { |
| 356 | - unset($_hookValues); // not used |
|
| 356 | + unset($_hookValues); // not used |
|
| 357 | 357 | return true; |
| 358 | 358 | } |
| 359 | 359 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | function encodeFolderName($_folderName) |
| 372 | 372 | { |
| 373 | - if($this->mbAvailable) { |
|
| 373 | + if ($this->mbAvailable) { |
|
| 374 | 374 | return mb_convert_encoding($_folderName, "UTF7-IMAP", translation::charset()); |
| 375 | 375 | } |
| 376 | 376 | |
@@ -387,17 +387,17 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | function getMailbox($mailbox) |
| 389 | 389 | { |
| 390 | - $mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_ALL); |
|
| 391 | - if (empty($mailboxes)) $mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED); |
|
| 390 | + $mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_ALL); |
|
| 391 | + if (empty($mailboxes)) $mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_UNSUBSCRIBED); |
|
| 392 | 392 | //error_log(__METHOD__.__LINE__.'->'.$mailbox.'/'.array2string($mailboxes)); |
| 393 | 393 | $mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes); |
| 394 | 394 | //_debug_array($mboxes->count()); |
| 395 | 395 | foreach ($mboxes->getIterator() as $k =>$box) |
| 396 | 396 | { |
| 397 | 397 | //error_log(__METHOD__.__LINE__.'->'.$k); |
| 398 | - if ($k!='user' && $k != '' && $k==$mailbox) return $box['mailbox']; //_debug_array(array($k => $client->status($k))); |
|
| 398 | + if ($k != 'user' && $k != '' && $k == $mailbox) return $box['mailbox']; //_debug_array(array($k => $client->status($k))); |
|
| 399 | 399 | } |
| 400 | - return ($this->mailboxExist($mailbox)?$mailbox:false); |
|
| 400 | + return ($this->mailboxExist($mailbox) ? $mailbox : false); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | /** |
@@ -413,23 +413,23 @@ discard block |
||
| 413 | 413 | //error_log(__METHOD__.__LINE__.':'.$mailbox); |
| 414 | 414 | $currentMailbox = $this->currentMailbox(); |
| 415 | 415 | } |
| 416 | - catch(Exception $e) |
|
| 416 | + catch (Exception $e) |
|
| 417 | 417 | { |
| 418 | 418 | //error_log(__METHOD__.__LINE__.' failed detecting currentMailbox:'.$currentMailbox.':'.$e->getMessage()); |
| 419 | - $currentMailbox=null; |
|
| 419 | + $currentMailbox = null; |
|
| 420 | 420 | unset($e); |
| 421 | 421 | } |
| 422 | 422 | try |
| 423 | 423 | { |
| 424 | 424 | //error_log(__METHOD__.__LINE__.':'.$mailbox); |
| 425 | 425 | $this->openMailbox($mailbox); |
| 426 | - $returnvalue=true; |
|
| 426 | + $returnvalue = true; |
|
| 427 | 427 | } |
| 428 | - catch(Exception $e) |
|
| 428 | + catch (Exception $e) |
|
| 429 | 429 | { |
| 430 | 430 | //error_log(__METHOD__.__LINE__.' failed opening:'.$mailbox.':'.$e->getMessage().' Called by:'.function_backtrace()); |
| 431 | 431 | unset($e); |
| 432 | - $returnvalue=false; |
|
| 432 | + $returnvalue = false; |
|
| 433 | 433 | } |
| 434 | 434 | if (!empty($currentMailbox) && $currentMailbox['mailbox'] != $mailbox) |
| 435 | 435 | { |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | //error_log(__METHOD__.__LINE__.':'.$currentMailbox .'<->'.$mailbox); |
| 439 | 439 | $this->openMailbox($currentMailbox['mailbox']); |
| 440 | 440 | } |
| 441 | - catch(Exception $e) |
|
| 441 | + catch (Exception $e) |
|
| 442 | 442 | { |
| 443 | 443 | //error_log(__METHOD__.__LINE__.' failed reopening:'.$currentMailbox.':'.$e->getMessage()); |
| 444 | 444 | unset($e); |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | { |
| 459 | 459 | $mailbox = $this->currentMailbox(); |
| 460 | 460 | } |
| 461 | - catch(Exception $e) |
|
| 461 | + catch (Exception $e) |
|
| 462 | 462 | { |
| 463 | 463 | error_log(__METHOD__.' ('.__LINE__.') failed fetching currentMailbox:'.$e->getMessage()); |
| 464 | 464 | //throw new egw_exception(__METHOD__.' ('.__LINE__.") failed to ".__METHOD__." :".$e->getMessage()); |
@@ -476,16 +476,16 @@ discard block |
||
| 476 | 476 | */ |
| 477 | 477 | function getSpecialUseFolders() |
| 478 | 478 | { |
| 479 | - $mailboxes = $this->getMailboxes('',0,true); |
|
| 479 | + $mailboxes = $this->getMailboxes('', 0, true); |
|
| 480 | 480 | $suF = array(); |
| 481 | 481 | foreach ($mailboxes as $box) |
| 482 | 482 | { |
| 483 | - if ($box['MAILBOX']!='user' && $box['MAILBOX'] != '') |
|
| 483 | + if ($box['MAILBOX'] != 'user' && $box['MAILBOX'] != '') |
|
| 484 | 484 | { |
| 485 | 485 | //error_log(__METHOD__.__LINE__.$k.'->'.array2string($box)); |
| 486 | - if (isset($box['ATTRIBUTES'])&&!empty($box['ATTRIBUTES'])&& |
|
| 487 | - stripos(strtolower(array2string($box['ATTRIBUTES'])),'\noselect')=== false&& |
|
| 488 | - stripos(strtolower(array2string($box['ATTRIBUTES'])),'\nonexistent')=== false) |
|
| 486 | + if (isset($box['ATTRIBUTES']) && !empty($box['ATTRIBUTES']) && |
|
| 487 | + stripos(strtolower(array2string($box['ATTRIBUTES'])), '\noselect') === false && |
|
| 488 | + stripos(strtolower(array2string($box['ATTRIBUTES'])), '\nonexistent') === false) |
|
| 489 | 489 | { |
| 490 | 490 | $suF[$box['MAILBOX']] = $box; |
| 491 | 491 | } |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | $status = $this->status($mailbox); |
| 508 | 508 | foreach ($status as $key => $v) |
| 509 | 509 | { |
| 510 | - $_status[strtoupper($key)]=$v; |
|
| 510 | + $_status[strtoupper($key)] = $v; |
|
| 511 | 511 | } |
| 512 | 512 | return $_status; |
| 513 | 513 | } |
@@ -525,9 +525,9 @@ discard block |
||
| 525 | 525 | * @param ignoreStatusCache bool ignore the cache used for counters |
| 526 | 526 | * @return array with counters |
| 527 | 527 | */ |
| 528 | - function getStatus($mailbox, $ignoreStatusCache=false) |
|
| 528 | + function getStatus($mailbox, $ignoreStatusCache = false) |
|
| 529 | 529 | { |
| 530 | - $mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_ALL,array( |
|
| 530 | + $mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_ALL, array( |
|
| 531 | 531 | 'attributes'=>true, |
| 532 | 532 | 'children'=>true, //child info |
| 533 | 533 | 'delimiter'=>true, |
@@ -541,16 +541,16 @@ discard block |
||
| 541 | 541 | //error_log(__METHOD__.__LINE__.array2string($mboxes->count())); |
| 542 | 542 | foreach ($mboxes->getIterator() as $k =>$box) |
| 543 | 543 | { |
| 544 | - if ($k!='user' && $k != '' && $k==$mailbox) |
|
| 544 | + if ($k != 'user' && $k != '' && $k == $mailbox) |
|
| 545 | 545 | { |
| 546 | - if (stripos(array2string($box['attributes']),'\noselect')=== false) |
|
| 546 | + if (stripos(array2string($box['attributes']), '\noselect') === false) |
|
| 547 | 547 | { |
| 548 | 548 | $status = $this->status($k, $flags); |
| 549 | 549 | foreach ($status as $key => $v) |
| 550 | 550 | { |
| 551 | - $_status[strtoupper($key)]=$v; |
|
| 551 | + $_status[strtoupper($key)] = $v; |
|
| 552 | 552 | } |
| 553 | - $_status['HIERACHY_DELIMITER'] = $_status['delimiter'] = ($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal')); |
|
| 553 | + $_status['HIERACHY_DELIMITER'] = $_status['delimiter'] = ($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal')); |
|
| 554 | 554 | $_status['ATTRIBUTES'] = $box['attributes']; |
| 555 | 555 | //error_log(__METHOD__.__LINE__.$k.'->'.array2string($_status)); |
| 556 | 556 | return $_status; |
@@ -576,14 +576,14 @@ discard block |
||
| 576 | 576 | * |
| 577 | 577 | * @return mixed array of mailboxes |
| 578 | 578 | */ |
| 579 | - function getMailboxes($reference = '' , $restriction_search = 0, $returnAttributes = false) |
|
| 579 | + function getMailboxes($reference = '', $restriction_search = 0, $returnAttributes = false) |
|
| 580 | 580 | { |
| 581 | - if ( is_bool($restriction_search) ){ |
|
| 582 | - $restriction_search = (int) $restriction_search; |
|
| 581 | + if (is_bool($restriction_search)) { |
|
| 582 | + $restriction_search = (int)$restriction_search; |
|
| 583 | 583 | } |
| 584 | 584 | $mailbox = ''; |
| 585 | - if ( is_int( $restriction_search ) ){ |
|
| 586 | - switch ( $restriction_search ) { |
|
| 585 | + if (is_int($restriction_search)) { |
|
| 586 | + switch ($restriction_search) { |
|
| 587 | 587 | case 0: |
| 588 | 588 | $searchstring = $reference."*"; |
| 589 | 589 | break; |
@@ -595,8 +595,8 @@ discard block |
||
| 595 | 595 | $searchstring = $reference."%"; |
| 596 | 596 | break; |
| 597 | 597 | } |
| 598 | - }else{ |
|
| 599 | - if ( is_string( $restriction_search ) ){ |
|
| 598 | + } else { |
|
| 599 | + if (is_string($restriction_search)) { |
|
| 600 | 600 | $mailbox = $searchstring = $restriction_search; |
| 601 | 601 | } |
| 602 | 602 | } |
@@ -609,35 +609,35 @@ discard block |
||
| 609 | 609 | 'special_use'=>true, |
| 610 | 610 | 'sort'=>true, |
| 611 | 611 | ); |
| 612 | - if ($returnAttributes==false) |
|
| 612 | + if ($returnAttributes == false) |
|
| 613 | 613 | { |
| 614 | 614 | unset($options['attributes']); |
| 615 | 615 | unset($options['children']); |
| 616 | 616 | unset($options['special_use']); |
| 617 | 617 | } |
| 618 | - $mailboxes = $this->listMailboxes($searchstring,Horde_Imap_Client::MBOX_ALL, $options); |
|
| 618 | + $mailboxes = $this->listMailboxes($searchstring, Horde_Imap_Client::MBOX_ALL, $options); |
|
| 619 | 619 | //$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes); |
| 620 | 620 | //_debug_array($mboxes->count()); |
| 621 | 621 | foreach ((array)$mailboxes as $k =>$box) |
| 622 | 622 | { |
| 623 | 623 | //error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box)); |
| 624 | - $ret[$k]=array('MAILBOX'=>$k,'ATTRIBUTES'=>$box['attributes'],'delimiter'=>($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal')),'SUBSCRIBED'=>true); |
|
| 624 | + $ret[$k] = array('MAILBOX'=>$k, 'ATTRIBUTES'=>$box['attributes'], 'delimiter'=>($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal')), 'SUBSCRIBED'=>true); |
|
| 625 | 625 | } |
| 626 | 626 | // for unknown reasons on ALL, UNSUBSCRIBED are not returned |
| 627 | 627 | //always fetch unsubscribed, think about only fetching it when $options['attributes'] is set |
| 628 | 628 | //but then allMailboxes are not all, .... |
| 629 | 629 | //if (!empty($mailbox) && !isset($ret[$mailbox])) |
| 630 | 630 | { |
| 631 | - $unsub_mailboxes = $this->listMailboxes($searchstring,Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options); |
|
| 631 | + $unsub_mailboxes = $this->listMailboxes($searchstring, Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options); |
|
| 632 | 632 | //$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes); |
| 633 | 633 | //_debug_array($mboxes->count()); |
| 634 | 634 | //error_log(__METHOD__.__LINE__.' '.$mailbox.':'.count((array)$mailboxes).'->'.function_backtrace()); |
| 635 | 635 | foreach ((array)$unsub_mailboxes as $k =>$box) |
| 636 | 636 | { |
| 637 | 637 | //error_log(__METHOD__.__LINE__.' Box:'.$k.' already In?'.array_key_exists($k,$boxexists).'->'.array2string($box)); |
| 638 | - if(!array_key_exists($k,$ret)) |
|
| 638 | + if (!array_key_exists($k, $ret)) |
|
| 639 | 639 | { |
| 640 | - $ret[$k]=array('MAILBOX'=>$k,'ATTRIBUTES'=>$box['attributes'],'delimiter'=>($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal')),'SUBSCRIBED'=>false); |
|
| 640 | + $ret[$k] = array('MAILBOX'=>$k, 'ATTRIBUTES'=>$box['attributes'], 'delimiter'=>($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal')), 'SUBSCRIBED'=>false); |
|
| 641 | 641 | } |
| 642 | 642 | else |
| 643 | 643 | { |
@@ -660,14 +660,14 @@ discard block |
||
| 660 | 660 | * |
| 661 | 661 | * @return mixed array of mailboxes |
| 662 | 662 | */ |
| 663 | - function listSubscribedMailboxes($reference = '' , $restriction_search = 0, $returnAttributes = false) |
|
| 663 | + function listSubscribedMailboxes($reference = '', $restriction_search = 0, $returnAttributes = false) |
|
| 664 | 664 | { |
| 665 | - if ( is_bool($restriction_search) ){ |
|
| 666 | - $restriction_search = (int) $restriction_search; |
|
| 665 | + if (is_bool($restriction_search)) { |
|
| 666 | + $restriction_search = (int)$restriction_search; |
|
| 667 | 667 | } |
| 668 | 668 | $mailbox = ''; |
| 669 | - if ( is_int( $restriction_search ) ){ |
|
| 670 | - switch ( $restriction_search ) { |
|
| 669 | + if (is_int($restriction_search)) { |
|
| 670 | + switch ($restriction_search) { |
|
| 671 | 671 | case 0: |
| 672 | 672 | $searchstring = $reference."*"; |
| 673 | 673 | break; |
@@ -679,8 +679,8 @@ discard block |
||
| 679 | 679 | $searchstring = $reference."%"; |
| 680 | 680 | break; |
| 681 | 681 | } |
| 682 | - }else{ |
|
| 683 | - if ( is_string( $restriction_search ) ){ |
|
| 682 | + } else { |
|
| 683 | + if (is_string($restriction_search)) { |
|
| 684 | 684 | $mailbox = $searchstring = $restriction_search; |
| 685 | 685 | } |
| 686 | 686 | } |
@@ -692,25 +692,25 @@ discard block |
||
| 692 | 692 | 'special_use'=>true, |
| 693 | 693 | 'sort'=>true, |
| 694 | 694 | ); |
| 695 | - if ($returnAttributes==false) |
|
| 695 | + if ($returnAttributes == false) |
|
| 696 | 696 | { |
| 697 | 697 | unset($options['attributes']); |
| 698 | 698 | unset($options['children']); |
| 699 | 699 | unset($options['special_use']); |
| 700 | 700 | } |
| 701 | - $mailboxes = $this->listMailboxes($searchstring,Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options); |
|
| 701 | + $mailboxes = $this->listMailboxes($searchstring, Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options); |
|
| 702 | 702 | //$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes); |
| 703 | 703 | //_debug_array($mboxes->count()); |
| 704 | 704 | foreach ((array)$mailboxes as $k =>$box) |
| 705 | 705 | { |
| 706 | 706 | //error_log(__METHOD__.__LINE__.' Searched for:'.$mailbox.' got Box:'.$k.'->'.array2string($box).function_backtrace()); |
| 707 | - if ($returnAttributes==false) |
|
| 707 | + if ($returnAttributes == false) |
|
| 708 | 708 | { |
| 709 | - $ret[]=$k; |
|
| 709 | + $ret[] = $k; |
|
| 710 | 710 | } |
| 711 | 711 | else |
| 712 | 712 | { |
| 713 | - $ret[$k]=array('MAILBOX'=>$k,'ATTRIBUTES'=>$box['attributes'],'delimiter'=>($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal')),'SUBSCRIBED'=>true); |
|
| 713 | + $ret[$k] = array('MAILBOX'=>$k, 'ATTRIBUTES'=>$box['attributes'], 'delimiter'=>($box['delimiter'] ? $box['delimiter'] : $this->getDelimiter('personal')), 'SUBSCRIBED'=>true); |
|
| 714 | 714 | } |
| 715 | 715 | } |
| 716 | 716 | return $ret; |
@@ -726,14 +726,14 @@ discard block |
||
| 726 | 726 | * |
| 727 | 727 | * @return mixed array of mailboxes |
| 728 | 728 | */ |
| 729 | - function listUnSubscribedMailboxes($reference = '' , $restriction_search = 0) |
|
| 729 | + function listUnSubscribedMailboxes($reference = '', $restriction_search = 0) |
|
| 730 | 730 | { |
| 731 | - if ( is_bool($restriction_search) ){ |
|
| 732 | - $restriction_search = (int) $restriction_search; |
|
| 731 | + if (is_bool($restriction_search)) { |
|
| 732 | + $restriction_search = (int)$restriction_search; |
|
| 733 | 733 | } |
| 734 | 734 | |
| 735 | - if ( is_int( $restriction_search ) ){ |
|
| 736 | - switch ( $restriction_search ) { |
|
| 735 | + if (is_int($restriction_search)) { |
|
| 736 | + switch ($restriction_search) { |
|
| 737 | 737 | case 0: |
| 738 | 738 | $mailbox = $reference."*"; |
| 739 | 739 | break; |
@@ -745,8 +745,8 @@ discard block |
||
| 745 | 745 | $mailbox = "%"; |
| 746 | 746 | break; |
| 747 | 747 | } |
| 748 | - }else{ |
|
| 749 | - if ( is_string( $restriction_search ) ){ |
|
| 748 | + } else { |
|
| 749 | + if (is_string($restriction_search)) { |
|
| 750 | 750 | $mailbox = $restriction_search; |
| 751 | 751 | } |
| 752 | 752 | } |
@@ -755,17 +755,17 @@ discard block |
||
| 755 | 755 | 'sort'=>true, |
| 756 | 756 | //'flat'=>true, |
| 757 | 757 | ); |
| 758 | - $mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options); |
|
| 758 | + $mailboxes = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, $options); |
|
| 759 | 759 | foreach ($mailboxes as $box) |
| 760 | 760 | { |
| 761 | 761 | //error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box['mailbox']->utf8)); |
| 762 | - $sret[]=$box['mailbox']->utf8; |
|
| 762 | + $sret[] = $box['mailbox']->utf8; |
|
| 763 | 763 | } |
| 764 | - $unsubscribed = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options); |
|
| 764 | + $unsubscribed = $this->listMailboxes($mailbox, Horde_Imap_Client::MBOX_UNSUBSCRIBED, $options); |
|
| 765 | 765 | foreach ($unsubscribed as $box) |
| 766 | 766 | { |
| 767 | 767 | //error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box['mailbox']->utf8)); |
| 768 | - if (!in_array($box['mailbox']->utf8,$sret) && $box['mailbox']->utf8!='INBOX') $ret[]=$box['mailbox']->utf8; |
|
| 768 | + if (!in_array($box['mailbox']->utf8, $sret) && $box['mailbox']->utf8 != 'INBOX') $ret[] = $box['mailbox']->utf8; |
|
| 769 | 769 | } |
| 770 | 770 | return $ret; |
| 771 | 771 | } |
@@ -777,12 +777,12 @@ discard block |
||
| 777 | 777 | * @param int $flags =null default Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS |
| 778 | 778 | * @return array of counters for mailbox |
| 779 | 779 | */ |
| 780 | - function examineMailbox($mailbox, $flags=null) |
|
| 780 | + function examineMailbox($mailbox, $flags = null) |
|
| 781 | 781 | { |
| 782 | - if ($mailbox=='') return false; |
|
| 782 | + if ($mailbox == '') return false; |
|
| 783 | 783 | $mailboxes = $this->listMailboxes($mailbox); |
| 784 | 784 | |
| 785 | - if (is_null($flags)) $flags = Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS; |
|
| 785 | + if (is_null($flags)) $flags = Horde_Imap_Client::STATUS_ALL|Horde_Imap_Client::STATUS_FLAGS|Horde_Imap_Client::STATUS_PERMFLAGS; |
|
| 786 | 786 | |
| 787 | 787 | $mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes); |
| 788 | 788 | //_debug_array($mboxes->count()); |
@@ -790,18 +790,18 @@ discard block |
||
| 790 | 790 | { |
| 791 | 791 | //error_log(__METHOD__.__LINE__.array2string($box)); |
| 792 | 792 | unset($box); |
| 793 | - if ($k!='user' && $k != '' && $k==$mailbox) |
|
| 793 | + if ($k != 'user' && $k != '' && $k == $mailbox) |
|
| 794 | 794 | { |
| 795 | 795 | $status = $this->status($k, $flags); |
| 796 | 796 | //error_log(__METHOD__.__LINE__.array2string($status)); |
| 797 | 797 | foreach ($status as $key => $v) |
| 798 | 798 | { |
| 799 | - $_status[strtoupper($key)]=$v; |
|
| 799 | + $_status[strtoupper($key)] = $v; |
|
| 800 | 800 | } |
| 801 | - if ($flags & (Horde_Imap_Client::STATUS_FLAGS|Horde_Imap_Client::STATUS_PERMFLAGS)) |
|
| 801 | + if ($flags&(Horde_Imap_Client::STATUS_FLAGS|Horde_Imap_Client::STATUS_PERMFLAGS)) |
|
| 802 | 802 | { |
| 803 | 803 | self::$supports_keywords[$this->ImapServerId] = stripos(implode('', $status['flags']), '$label') !== false || |
| 804 | - in_array('\\*', $status['permflags']); // arbitrary keyswords also allow keywords |
|
| 804 | + in_array('\\*', $status['permflags']); // arbitrary keyswords also allow keywords |
|
| 805 | 805 | } |
| 806 | 806 | return $_status; |
| 807 | 807 | } |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | */ |
| 841 | 841 | function hasCapability($capability) |
| 842 | 842 | { |
| 843 | - if ($capability=='SUPPORTS_KEYWORDS') |
|
| 843 | + if ($capability == 'SUPPORTS_KEYWORDS') |
|
| 844 | 844 | { |
| 845 | 845 | // if pseudo-flag is not set, call examineMailbox now to set it (no STATUS_ALL = counters necessary) |
| 846 | 846 | if (!isset(self::$supports_keywords[$this->ImapServerId])) |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | catch (Exception $e) |
| 853 | 853 | { |
| 854 | 854 | error_log(__METHOD__.__LINE__.' (examineServer for detection) '.$capability.'->'.array2string(self::$supports_keywords).' failed '.function_backtrace()); |
| 855 | - self::$supports_keywords[$this->ImapServerId]=false; |
|
| 855 | + self::$supports_keywords[$this->ImapServerId] = false; |
|
| 856 | 856 | } |
| 857 | 857 | } |
| 858 | 858 | //error_log(__METHOD__.__LINE__.' '.$capability.'->'.array2string(self::$supports_keywords).' '.function_backtrace()); |
@@ -902,9 +902,9 @@ discard block |
||
| 902 | 902 | */ |
| 903 | 903 | static function getFolderPrefixFromNamespace($_nameSpace, $_folderName) |
| 904 | 904 | { |
| 905 | - foreach($_nameSpace as &$singleNameSpace) |
|
| 905 | + foreach ($_nameSpace as &$singleNameSpace) |
|
| 906 | 906 | { |
| 907 | - if (substr($_folderName,0,strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix']) return $singleNameSpace['prefix']; |
|
| 907 | + if (substr($_folderName, 0, strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix']) return $singleNameSpace['prefix']; |
|
| 908 | 908 | } |
| 909 | 909 | return ""; |
| 910 | 910 | } |
@@ -919,33 +919,33 @@ discard block |
||
| 919 | 919 | * @param string $reclevel = 0, counter to keep track of the current recursionlevel |
| 920 | 920 | * @return array of mailboxes |
| 921 | 921 | */ |
| 922 | - function getMailBoxesRecursive($_mailbox, $delimiter, $prefix, $reclevel=0) |
|
| 922 | + function getMailBoxesRecursive($_mailbox, $delimiter, $prefix, $reclevel = 0) |
|
| 923 | 923 | { |
| 924 | 924 | if ($reclevel > 25) { |
| 925 | - error_log( __METHOD__." Recursion Level Exeeded ($reclevel) while looking up $_mailbox$delimiter "); |
|
| 925 | + error_log(__METHOD__." Recursion Level Exeeded ($reclevel) while looking up $_mailbox$delimiter "); |
|
| 926 | 926 | return array(); |
| 927 | 927 | } |
| 928 | 928 | $reclevel++; |
| 929 | 929 | // clean up double delimiters |
| 930 | - $mailbox = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter:$delimiter).'+~s',$delimiter,$_mailbox); |
|
| 930 | + $mailbox = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter : $delimiter).'+~s', $delimiter, $_mailbox); |
|
| 931 | 931 | //get that mailbox in question |
| 932 | - $mbx = $this->getMailboxes($mailbox,1,true); |
|
| 932 | + $mbx = $this->getMailboxes($mailbox, 1, true); |
|
| 933 | 933 | $mbxkeys = array_keys($mbx); |
| 934 | 934 | |
| 935 | 935 | // Example: Array([INBOX/GaGa] => Array([MAILBOX] => INBOX/GaGa[ATTRIBUTES] => Array([0] => \\unmarked)[delimiter] => /)) |
| 936 | - if (is_array($mbx[$mbxkeys[0]]["ATTRIBUTES"]) && (in_array('\HasChildren',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Haschildren',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\haschildren',$mbx[$mbxkeys[0]]["ATTRIBUTES"]))) |
|
| 936 | + if (is_array($mbx[$mbxkeys[0]]["ATTRIBUTES"]) && (in_array('\HasChildren', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Haschildren', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\haschildren', $mbx[$mbxkeys[0]]["ATTRIBUTES"]))) |
|
| 937 | 937 | { |
| 938 | - $buff = $this->getMailboxes($mbx[$mbxkeys[0]]['MAILBOX'].($mbx[$mbxkeys[0]]['MAILBOX'] == $prefix ? '':$delimiter),2,false); |
|
| 938 | + $buff = $this->getMailboxes($mbx[$mbxkeys[0]]['MAILBOX'].($mbx[$mbxkeys[0]]['MAILBOX'] == $prefix ? '' : $delimiter), 2, false); |
|
| 939 | 939 | $allMailboxes = array(); |
| 940 | 940 | foreach ($buff as $mbxname) { |
| 941 | - $mbxname = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter:$delimiter).'+~s',$delimiter,$mbxname['MAILBOX']); |
|
| 941 | + $mbxname = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter : $delimiter).'+~s', $delimiter, $mbxname['MAILBOX']); |
|
| 942 | 942 | #echo "About to recur in level $reclevel:".$mbxname."<br>"; |
| 943 | - if ( $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'] && $mbxname != $prefix && $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'].$delimiter) |
|
| 943 | + if ($mbxname != $mbx[$mbxkeys[0]]['MAILBOX'] && $mbxname != $prefix && $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'].$delimiter) |
|
| 944 | 944 | { |
| 945 | 945 | $allMailboxes = array_merge($allMailboxes, self::getMailBoxesRecursive($mbxname, $delimiter, $prefix, $reclevel)); |
| 946 | 946 | } |
| 947 | 947 | } |
| 948 | - if (!(in_array('\NoSelect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]))) $allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX']; |
|
| 948 | + if (!(in_array('\NoSelect', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect', $mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect', $mbx[$mbxkeys[0]]["ATTRIBUTES"]))) $allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX']; |
|
| 949 | 949 | return $allMailboxes; |
| 950 | 950 | } |
| 951 | 951 | else |
@@ -964,24 +964,24 @@ discard block |
||
| 964 | 964 | */ |
| 965 | 965 | function getNameSpace() |
| 966 | 966 | { |
| 967 | - static $nameSpace=null; |
|
| 967 | + static $nameSpace = null; |
|
| 968 | 968 | $foldersNameSpace = array(); |
| 969 | 969 | $delimiter = $this->getDelimiter(); |
| 970 | - if (empty($delimiter)) $delimiter='/'; |
|
| 970 | + if (empty($delimiter)) $delimiter = '/'; |
|
| 971 | 971 | if (is_null($nameSpace)) $nameSpace = $this->getNameSpaceArray(); |
| 972 | 972 | if (is_array($nameSpace)) { |
| 973 | - foreach($nameSpace as $type => $singleNameSpaceArray) |
|
| 973 | + foreach ($nameSpace as $type => $singleNameSpaceArray) |
|
| 974 | 974 | { |
| 975 | 975 | foreach ($singleNameSpaceArray as $singleNameSpace) |
| 976 | 976 | { |
| 977 | 977 | $_foldersNameSpace = array(); |
| 978 | - if($type == 'personal' && $singleNameSpace['name'] == '#mh/' && ($this->folderExists('Mail')||$this->folderExists('INBOX'))) |
|
| 978 | + if ($type == 'personal' && $singleNameSpace['name'] == '#mh/' && ($this->folderExists('Mail') || $this->folderExists('INBOX'))) |
|
| 979 | 979 | { |
| 980 | 980 | $_foldersNameSpace['prefix_present'] = 'forced'; |
| 981 | 981 | // uw-imap server with mailbox prefix or dovecot maybe |
| 982 | - $_foldersNameSpace['prefix'] = ($this->folderExists('Mail')?'Mail':(!empty($singleNameSpace['name'])?$singleNameSpace['name']:'')); |
|
| 982 | + $_foldersNameSpace['prefix'] = ($this->folderExists('Mail') ? 'Mail' : (!empty($singleNameSpace['name']) ? $singleNameSpace['name'] : '')); |
|
| 983 | 983 | } |
| 984 | - elseif($type == 'personal' && ($singleNameSpace['name'] == '#mh/') && $this->folderExists('mail')) |
|
| 984 | + elseif ($type == 'personal' && ($singleNameSpace['name'] == '#mh/') && $this->folderExists('mail')) |
|
| 985 | 985 | { |
| 986 | 986 | $_foldersNameSpace['prefix_present'] = 'forced'; |
| 987 | 987 | // uw-imap server with mailbox prefix or dovecot maybe |
@@ -990,9 +990,9 @@ discard block |
||
| 990 | 990 | $_foldersNameSpace['prefix_present'] = !empty($singleNameSpace['name']); |
| 991 | 991 | $_foldersNameSpace['prefix'] = $singleNameSpace['name']; |
| 992 | 992 | } |
| 993 | - $_foldersNameSpace['delimiter'] = ($singleNameSpace['delimiter']?$singleNameSpace['delimiter']:$delimiter); |
|
| 993 | + $_foldersNameSpace['delimiter'] = ($singleNameSpace['delimiter'] ? $singleNameSpace['delimiter'] : $delimiter); |
|
| 994 | 994 | $_foldersNameSpace['type'] = $type; |
| 995 | - $foldersNameSpace[] =$_foldersNameSpace; |
|
| 995 | + $foldersNameSpace[] = $_foldersNameSpace; |
|
| 996 | 996 | } |
| 997 | 997 | } |
| 998 | 998 | } |
@@ -1004,29 +1004,29 @@ discard block |
||
| 1004 | 1004 | * @param mixed _type (1=personal, 2=user/other, 3=shared) |
| 1005 | 1005 | * @return string the delimimiter |
| 1006 | 1006 | */ |
| 1007 | - function getDelimiter($_type=1) |
|
| 1007 | + function getDelimiter($_type = 1) |
|
| 1008 | 1008 | { |
| 1009 | 1009 | switch ($_type) |
| 1010 | 1010 | { |
| 1011 | 1011 | case 'user': |
| 1012 | 1012 | case 'other': |
| 1013 | 1013 | case 2: |
| 1014 | - $type=2; |
|
| 1014 | + $type = 2; |
|
| 1015 | 1015 | break; |
| 1016 | 1016 | case 'shared': |
| 1017 | 1017 | case '': |
| 1018 | 1018 | case 3: |
| 1019 | - $type=3; |
|
| 1019 | + $type = 3; |
|
| 1020 | 1020 | break; |
| 1021 | 1021 | case 'personal': |
| 1022 | 1022 | case 1: |
| 1023 | 1023 | default: |
| 1024 | - $type=1; |
|
| 1024 | + $type = 1; |
|
| 1025 | 1025 | } |
| 1026 | 1026 | $namespaces = $this->getNamespaces(); |
| 1027 | 1027 | foreach ($namespaces as $nsp) |
| 1028 | 1028 | { |
| 1029 | - if ($nsp['type']==$type && $nsp['delimiter']) return $nsp['delimiter']; |
|
| 1029 | + if ($nsp['type'] == $type && $nsp['delimiter']) return $nsp['delimiter']; |
|
| 1030 | 1030 | } |
| 1031 | 1031 | return "/"; |
| 1032 | 1032 | } |
@@ -1054,7 +1054,7 @@ discard block |
||
| 1054 | 1054 | { |
| 1055 | 1055 | if (is_numeric($_username)) |
| 1056 | 1056 | { |
| 1057 | - $_username = $GLOBALS['egw']->accounts->id2name($accountID=$_username); |
|
| 1057 | + $_username = $GLOBALS['egw']->accounts->id2name($accountID = $_username); |
|
| 1058 | 1058 | } |
| 1059 | 1059 | else |
| 1060 | 1060 | { |
@@ -1078,8 +1078,8 @@ discard block |
||
| 1078 | 1078 | if (empty($this->loginType)) |
| 1079 | 1079 | { |
| 1080 | 1080 | // try to figure out by params['acc_imap_username'] |
| 1081 | - list($lusername,$domain) = explode('@',$this->params['acc_imap_username'],2); |
|
| 1082 | - if (strpos($_username,'@')===false && !empty($domain) && !empty($lusername)) |
|
| 1081 | + list($lusername, $domain) = explode('@', $this->params['acc_imap_username'], 2); |
|
| 1082 | + if (strpos($_username, '@') === false && !empty($domain) && !empty($lusername)) |
|
| 1083 | 1083 | { |
| 1084 | 1084 | $_username = $_username.'@'.$domain; |
| 1085 | 1085 | } |
@@ -1118,20 +1118,20 @@ discard block |
||
| 1118 | 1118 | * @param string $_folderName='' |
| 1119 | 1119 | * @return string utf-7 encoded (done in getMailboxName) |
| 1120 | 1120 | */ |
| 1121 | - function getUserMailboxString($_username, $_folderName='') |
|
| 1121 | + function getUserMailboxString($_username, $_folderName = '') |
|
| 1122 | 1122 | { |
| 1123 | 1123 | $nameSpaces = $this->getNameSpaceArray(); |
| 1124 | 1124 | |
| 1125 | - if(!isset($nameSpaces['others'])) { |
|
| 1125 | + if (!isset($nameSpaces['others'])) { |
|
| 1126 | 1126 | return false; |
| 1127 | 1127 | } |
| 1128 | 1128 | |
| 1129 | 1129 | $username = $this->getMailBoxUserName($_username); |
| 1130 | - if($this->loginType == 'vmailmgr' || $this->loginType == 'email' || $this->loginType == 'uidNumber') { |
|
| 1131 | - $username .= '@'. $this->domainName; |
|
| 1130 | + if ($this->loginType == 'vmailmgr' || $this->loginType == 'email' || $this->loginType == 'uidNumber') { |
|
| 1131 | + $username .= '@'.$this->domainName; |
|
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | - $mailboxString = $nameSpaces['others'][0]['name'] . $username . (!empty($_folderName) ? ($nameSpaces['others'][0]['delimiter']?$nameSpaces['others'][0]['delimiter']:'/') . $_folderName : ''); |
|
| 1134 | + $mailboxString = $nameSpaces['others'][0]['name'].$username.(!empty($_folderName) ? ($nameSpaces['others'][0]['delimiter'] ? $nameSpaces['others'][0]['delimiter'] : '/').$_folderName : ''); |
|
| 1135 | 1135 | |
| 1136 | 1136 | return $mailboxString; |
| 1137 | 1137 | } |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | ); |
| 1151 | 1151 | //error_log(__METHOD__.__LINE__.array2string($types)); |
| 1152 | 1152 | $result = array(); |
| 1153 | - foreach($this->getNamespaces() as $data) |
|
| 1153 | + foreach ($this->getNamespaces() as $data) |
|
| 1154 | 1154 | { |
| 1155 | 1155 | //error_log(__METHOD__.__LINE__.array2string($data)); |
| 1156 | 1156 | if (isset($types[$data['type']])) |
@@ -1160,7 +1160,7 @@ discard block |
||
| 1160 | 1160 | 'name' => $data['name'], |
| 1161 | 1161 | 'prefix' => $data['name'], |
| 1162 | 1162 | 'prefix_present' => !empty($data['name']), |
| 1163 | - 'delimiter' => ($data['delimiter']?$data['delimiter']:'/'), |
|
| 1163 | + 'delimiter' => ($data['delimiter'] ? $data['delimiter'] : '/'), |
|
| 1164 | 1164 | ); |
| 1165 | 1165 | } |
| 1166 | 1166 | } |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | { |
| 1182 | 1182 | if ($qInfo['storage']) |
| 1183 | 1183 | { |
| 1184 | - return array('USED'=>$qInfo['storage']['usage'],'QMAX'=>$qInfo['storage']['limit']); |
|
| 1184 | + return array('USED'=>$qInfo['storage']['usage'], 'QMAX'=>$qInfo['storage']['limit']); |
|
| 1185 | 1185 | } |
| 1186 | 1186 | } |
| 1187 | 1187 | return false; |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | * @param string $_what - what to retrieve either limit/QMAX, usage/USED or ALL is supported |
| 1196 | 1196 | * @return int|array|boolean the quota for specified user (by what) or array with values for "limit" and "usage", or false |
| 1197 | 1197 | */ |
| 1198 | - function getQuotaByUser($_username, $_what='QMAX') |
|
| 1198 | + function getQuotaByUser($_username, $_what = 'QMAX') |
|
| 1199 | 1199 | { |
| 1200 | 1200 | $mailboxName = $this->getUserMailboxString($_username); |
| 1201 | 1201 | $storageQuota = $this->getQuotaRoot($mailboxName); |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | if (is_array($storageQuota) && isset($storageQuota[$mailboxName]) && is_array($storageQuota[$mailboxName]) && |
| 1205 | 1205 | isset($storageQuota[$mailboxName]['storage']) && is_array($storageQuota[$mailboxName]['storage'])) |
| 1206 | 1206 | { |
| 1207 | - switch($_what) |
|
| 1207 | + switch ($_what) |
|
| 1208 | 1208 | { |
| 1209 | 1209 | case 'QMAX': |
| 1210 | 1210 | $_what = 'limit'; |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | */ |
| 1231 | 1231 | function getUserData($_username) |
| 1232 | 1232 | { |
| 1233 | - unset($_username); // not used |
|
| 1233 | + unset($_username); // not used |
|
| 1234 | 1234 | return array(); |
| 1235 | 1235 | } |
| 1236 | 1236 | |
@@ -1243,7 +1243,7 @@ discard block |
||
| 1243 | 1243 | */ |
| 1244 | 1244 | function setUserData($_username, $_quota) |
| 1245 | 1245 | { |
| 1246 | - unset($_username, $_quota); // not used |
|
| 1246 | + unset($_username, $_quota); // not used |
|
| 1247 | 1247 | return true; |
| 1248 | 1248 | } |
| 1249 | 1249 | |
@@ -1277,10 +1277,10 @@ discard block |
||
| 1277 | 1277 | * @param array $params |
| 1278 | 1278 | * @throws Exception |
| 1279 | 1279 | */ |
| 1280 | - public function __call($name,array $params=null) |
|
| 1280 | + public function __call($name, array $params = null) |
|
| 1281 | 1281 | { |
| 1282 | 1282 | if ($this->debug) error_log(__METHOD__.'->'.$name.' with params:'.array2string($params)); |
| 1283 | - switch($name) |
|
| 1283 | + switch ($name) |
|
| 1284 | 1284 | { |
| 1285 | 1285 | case 'installScript': |
| 1286 | 1286 | case 'getScript': |
@@ -1297,11 +1297,11 @@ discard block |
||
| 1297 | 1297 | { |
| 1298 | 1298 | PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION); |
| 1299 | 1299 | $this->sieve = new emailadmin_sieve($this); |
| 1300 | - $this->error =& $this->sieve->error; |
|
| 1300 | + $this->error = & $this->sieve->error; |
|
| 1301 | 1301 | } |
| 1302 | - $ret = call_user_func_array(array($this->sieve,$name),$params); |
|
| 1302 | + $ret = call_user_func_array(array($this->sieve, $name), $params); |
|
| 1303 | 1303 | } |
| 1304 | - catch(Exception $e) { |
|
| 1304 | + catch (Exception $e) { |
|
| 1305 | 1305 | throw new PEAR_Exception('Error in Sieve: '.$e->getMessage(), $e); |
| 1306 | 1306 | } |
| 1307 | 1307 | //error_log(__CLASS__.'->'.$name.'('.array2string($params).') returns '.array2string($ret)); |
@@ -1318,7 +1318,7 @@ discard block |
||
| 1318 | 1318 | * @param string $_scriptName =null |
| 1319 | 1319 | * @return boolean |
| 1320 | 1320 | */ |
| 1321 | - public function setVacationUser($_euser, array $_vacation, $_scriptName=null) |
|
| 1321 | + public function setVacationUser($_euser, array $_vacation, $_scriptName = null) |
|
| 1322 | 1322 | { |
| 1323 | 1323 | if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser).' Scriptname:'.array2string($_scriptName).' VacationMessage:'.array2string($_vacation)); |
| 1324 | 1324 | |
@@ -1331,8 +1331,8 @@ discard block |
||
| 1331 | 1331 | $this->adminConnection($_euser); |
| 1332 | 1332 | PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION); |
| 1333 | 1333 | $this->sieve = new emailadmin_sieve($this, $_euser, $_scriptName); |
| 1334 | - $this->scriptName =& $this->sieve->scriptName; |
|
| 1335 | - $this->error =& $this->sieve->error; |
|
| 1334 | + $this->scriptName = & $this->sieve->scriptName; |
|
| 1335 | + $this->error = & $this->sieve->error; |
|
| 1336 | 1336 | } |
| 1337 | 1337 | $ret = $this->setVacation($_vacation, $_scriptName); |
| 1338 | 1338 | |
@@ -1347,7 +1347,7 @@ discard block |
||
| 1347 | 1347 | * @throws Exception on connection error or authentication failure |
| 1348 | 1348 | * @return array |
| 1349 | 1349 | */ |
| 1350 | - public function getVacationUser($_euser, $_scriptName=null) |
|
| 1350 | + public function getVacationUser($_euser, $_scriptName = null) |
|
| 1351 | 1351 | { |
| 1352 | 1352 | if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser)); |
| 1353 | 1353 | |
@@ -1360,8 +1360,8 @@ discard block |
||
| 1360 | 1360 | $this->adminConnection($_euser); |
| 1361 | 1361 | PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION); |
| 1362 | 1362 | $this->sieve = new emailadmin_sieve($this, $_euser, $_scriptName); |
| 1363 | - $this->error =& $this->sieve->error; |
|
| 1364 | - $this->scriptName =& $this->sieve->scriptName; |
|
| 1363 | + $this->error = & $this->sieve->error; |
|
| 1364 | + $this->scriptName = & $this->sieve->scriptName; |
|
| 1365 | 1365 | } |
| 1366 | 1366 | return $this->sieve->getVacation(); |
| 1367 | 1367 | } |
@@ -1381,7 +1381,7 @@ discard block |
||
| 1381 | 1381 | */ |
| 1382 | 1382 | public function init_static() |
| 1383 | 1383 | { |
| 1384 | - self::$supports_keywords =& egw_cache::getSession (__CLASS__, 'supports_keywords'); |
|
| 1384 | + self::$supports_keywords = & egw_cache::getSession(__CLASS__, 'supports_keywords'); |
|
| 1385 | 1385 | } |
| 1386 | 1386 | } |
| 1387 | 1387 | emailadmin_imap::init_static(); |