| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 | */ | 
| 17 | 17 | namespace BounceMailHandler; | 
| 18 | 18 | |
| 19 | -require_once __DIR__ . '/phpmailer-bmh_rules.php'; | |
| 19 | +require_once __DIR__.'/phpmailer-bmh_rules.php'; | |
| 20 | 20 | |
| 21 | 21 | /** | 
| 22 | 22 | * BounceMailHandler class | 
| @@ -310,7 +310,7 @@ discard block | ||
| 310 | 310 |    { | 
| 311 | 311 | // before starting the processing, let's check the delete flag and do global deletes if true | 
| 312 | 312 |      if (trim($this->deleteMsgDate) != '') { | 
| 313 | - echo 'processing global delete based on date of ' . $this->deleteMsgDate . '<br />'; | |
| 313 | + echo 'processing global delete based on date of '.$this->deleteMsgDate.'<br />'; | |
| 314 | 314 | $this->globalDelete(); | 
| 315 | 315 | } | 
| 316 | 316 | |
| @@ -320,24 +320,24 @@ discard block | ||
| 320 | 320 | $this->moveHard = false; | 
| 321 | 321 | } | 
| 322 | 322 | |
| 323 | - $port = $this->port . '/' . $this->service . '/' . $this->serviceOption; | |
| 323 | + $port = $this->port.'/'.$this->service.'/'.$this->serviceOption; | |
| 324 | 324 | |
| 325 | 325 | set_time_limit(6000); | 
| 326 | 326 | |
| 327 | 327 |      if (!$this->testMode) { | 
| 328 | -      $this->mailboxLink = imap_open('{' . $this->mailhost . ':' . $port . '}' . $this->boxname, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE | ($this->testMode ? OP_READONLY : 0)); | |
| 328 | +      $this->mailboxLink = imap_open('{'.$this->mailhost.':'.$port.'}'.$this->boxname, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE | ($this->testMode ? OP_READONLY : 0)); | |
| 329 | 329 |      } else { | 
| 330 | -      $this->mailboxLink = imap_open('{' . $this->mailhost . ':' . $port . '}' . $this->boxname, $this->mailboxUserName, $this->mailboxPassword, ($this->testMode ? OP_READONLY : 0)); | |
| 330 | +      $this->mailboxLink = imap_open('{'.$this->mailhost.':'.$port.'}'.$this->boxname, $this->mailboxUserName, $this->mailboxPassword, ($this->testMode ? OP_READONLY : 0)); | |
| 331 | 331 | } | 
| 332 | 332 | |
| 333 | 333 |      if (!$this->mailboxLink) { | 
| 334 | - $this->errorMessage = 'Cannot create ' . $this->service . ' connection to ' . $this->mailhost . $this->bmhNewLine . 'Error MSG: ' . imap_last_error(); | |
| 334 | + $this->errorMessage = 'Cannot create '.$this->service.' connection to '.$this->mailhost.$this->bmhNewLine.'Error MSG: '.imap_last_error(); | |
| 335 | 335 | $this->output(); | 
| 336 | 336 | |
| 337 | 337 | return false; | 
| 338 | 338 | } | 
| 339 | 339 | |
| 340 | -    $this->output('Connected to: ' . $this->mailhost . ' (' . $this->mailboxUserName . ')'); | |
| 340 | +    $this->output('Connected to: '.$this->mailhost.' ('.$this->mailboxUserName.')'); | |
| 341 | 341 | |
| 342 | 342 | return true; | 
| 343 | 343 | } | 
| @@ -352,14 +352,14 @@ discard block | ||
| 352 | 352 |      $dateArr = explode('-', $this->deleteMsgDate); // date format is yyyy-mm-dd | 
| 353 | 353 | $delDate = mktime(0, 0, 0, $dateArr[1], $dateArr[2], $dateArr[0]); | 
| 354 | 354 | |
| 355 | - $port = $this->port . '/' . $this->service . '/' . $this->serviceOption; | |
| 356 | -    $mboxt = imap_open('{' . $this->mailhost . ':' . $port . '}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); | |
| 355 | + $port = $this->port.'/'.$this->service.'/'.$this->serviceOption; | |
| 356 | +    $mboxt = imap_open('{'.$this->mailhost.':'.$port.'}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); | |
| 357 | 357 | |
| 358 | 358 |      if ($mboxt === false) { | 
| 359 | 359 | return false; | 
| 360 | 360 | } | 
| 361 | 361 | |
| 362 | -    $list = imap_getmailboxes($mboxt, '{' . $this->mailhost . ':' . $port . '}', '*'); | |
| 362 | +    $list = imap_getmailboxes($mboxt, '{'.$this->mailhost.':'.$port.'}', '*'); | |
| 363 | 363 | |
| 364 | 364 |      if (is_array($list)) { | 
| 365 | 365 |        foreach ($list as $key => $val) { | 
| @@ -368,7 +368,7 @@ discard block | ||
| 368 | 368 | $nameRaw = $nameArr[count($nameArr) - 1]; | 
| 369 | 369 | |
| 370 | 370 |          if (false === stripos($nameRaw, 'sent')) { | 
| 371 | -          $mboxd = imap_open('{' . $this->mailhost . ':' . $port . '}' . $nameRaw, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE); | |
| 371 | +          $mboxd = imap_open('{'.$this->mailhost.':'.$port.'}'.$nameRaw, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE); | |
| 372 | 372 | $messages = imap_sort($mboxd, SORTDATE, 0); | 
| 373 | 373 | $i = 0; | 
| 374 | 374 | |
| @@ -408,9 +408,9 @@ discard block | ||
| 408 | 408 |    { | 
| 409 | 409 |      if ($this->verbose >= $verboseLevel) { | 
| 410 | 410 |        if (empty($msg)) { | 
| 411 | - echo $this->errorMessage . $this->bmhNewLine; | |
| 411 | + echo $this->errorMessage.$this->bmhNewLine; | |
| 412 | 412 |        } else { | 
| 413 | - echo $msg . $this->bmhNewLine; | |
| 413 | + echo $msg.$this->bmhNewLine; | |
| 414 | 414 | } | 
| 415 | 415 | } | 
| 416 | 416 | } | 
| @@ -433,13 +433,13 @@ discard block | ||
| 433 | 433 | } | 
| 434 | 434 | |
| 435 | 435 |      if (!$this->mailboxLink) { | 
| 436 | - $this->errorMessage = 'Cannot open the mailbox file to ' . $filePath . $this->bmhNewLine . 'Error MSG: ' . imap_last_error(); | |
| 436 | + $this->errorMessage = 'Cannot open the mailbox file to '.$filePath.$this->bmhNewLine.'Error MSG: '.imap_last_error(); | |
| 437 | 437 | $this->output(); | 
| 438 | 438 | |
| 439 | 439 | return false; | 
| 440 | 440 | } | 
| 441 | 441 | |
| 442 | -    $this->output('Opened ' . $filePath); | |
| 442 | +    $this->output('Opened '.$filePath); | |
| 443 | 443 | |
| 444 | 444 | return true; | 
| 445 | 445 | } | 
| @@ -476,12 +476,12 @@ discard block | ||
| 476 | 476 | $unprocessedCount = 0; | 
| 477 | 477 | $deletedCount = 0; | 
| 478 | 478 | $movedCount = 0; | 
| 479 | -    $this->output('Total: ' . $totalCount . ' messages '); | |
| 479 | +    $this->output('Total: '.$totalCount.' messages '); | |
| 480 | 480 | |
| 481 | 481 | // process maximum number of messages | 
| 482 | 482 |      if ($fetchedCount > $this->maxMessages) { | 
| 483 | 483 | $fetchedCount = $this->maxMessages; | 
| 484 | -      $this->output('Processing first ' . $fetchedCount . ' messages '); | |
| 484 | +      $this->output('Processing first '.$fetchedCount.' messages '); | |
| 485 | 485 | } | 
| 486 | 486 | |
| 487 | 487 |      if ($this->testMode) { | 
| @@ -523,7 +523,7 @@ discard block | ||
| 523 | 523 | $processedResult = $this->processBounce($x, 'DSN', $totalCount); | 
| 524 | 524 |          } else { | 
| 525 | 525 | // not standard DSN msg | 
| 526 | -          $this->output('Msg #' . $x . ' is not a standard DSN message', self::VERBOSE_REPORT); | |
| 526 | +          $this->output('Msg #'.$x.' is not a standard DSN message', self::VERBOSE_REPORT); | |
| 527 | 527 | |
| 528 | 528 |            if ($this->debugBodyRule) { | 
| 529 | 529 |              if ($structure->ifdescription) { | 
| @@ -549,7 +549,7 @@ discard block | ||
| 549 | 549 | $processedResult = $this->processBounce($x, 'DSN', $totalCount); | 
| 550 | 550 |            } else { | 
| 551 | 551 | // not standard DSN msg | 
| 552 | -            $this->output('Msg #' . $x . ' is not a standard DSN message', self::VERBOSE_REPORT); | |
| 552 | +            $this->output('Msg #'.$x.' is not a standard DSN message', self::VERBOSE_REPORT); | |
| 553 | 553 | |
| 554 | 554 |              if ($this->debugBodyRule) { | 
| 555 | 555 |                $this->output("  Content-Type : {$match[1]}", self::VERBOSE_DEBUG); | 
| @@ -559,10 +559,10 @@ discard block | ||
| 559 | 559 | } | 
| 560 | 560 |          } else { | 
| 561 | 561 | // didn't get content-type header | 
| 562 | -          $this->output('Msg #' . $x . ' is not a well-formatted MIME mail, missing Content-Type', self::VERBOSE_REPORT); | |
| 562 | +          $this->output('Msg #'.$x.' is not a well-formatted MIME mail, missing Content-Type', self::VERBOSE_REPORT); | |
| 563 | 563 | |
| 564 | 564 |            if ($this->debugBodyRule) { | 
| 565 | -            $this->output('  Headers: ' . $this->bmhNewLine . $header . $this->bmhNewLine, self::VERBOSE_DEBUG); | |
| 565 | +            $this->output('  Headers: '.$this->bmhNewLine.$header.$this->bmhNewLine, self::VERBOSE_DEBUG); | |
| 566 | 566 | } | 
| 567 | 567 | |
| 568 | 568 | $processedResult = $this->processBounce($x, 'BODY', $totalCount); | 
| @@ -638,17 +638,17 @@ discard block | ||
| 638 | 638 | flush(); | 
| 639 | 639 | } | 
| 640 | 640 | |
| 641 | - $this->output($this->bmhNewLine . 'Closing mailbox, and purging messages'); | |
| 641 | + $this->output($this->bmhNewLine.'Closing mailbox, and purging messages'); | |
| 642 | 642 | |
| 643 | 643 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ | 
| 644 | 644 | @imap_expunge($this->mailboxLink); | 
| 645 | 645 | imap_close($this->mailboxLink); | 
| 646 | 646 | |
| 647 | -    $this->output('Read: ' . $fetchedCount . ' messages'); | |
| 648 | - $this->output($processedCount . ' action taken'); | |
| 649 | - $this->output($unprocessedCount . ' no action taken'); | |
| 650 | - $this->output($deletedCount . ' messages deleted'); | |
| 651 | - $this->output($movedCount . ' messages moved'); | |
| 647 | +    $this->output('Read: '.$fetchedCount.' messages'); | |
| 648 | + $this->output($processedCount.' action taken'); | |
| 649 | + $this->output($unprocessedCount.' no action taken'); | |
| 650 | + $this->output($deletedCount.' messages deleted'); | |
| 651 | + $this->output($movedCount.' messages moved'); | |
| 652 | 652 | |
| 653 | 653 | return true; | 
| 654 | 654 | } | 
| @@ -756,7 +756,7 @@ discard block | ||
| 756 | 756 | break; | 
| 757 | 757 | |
| 758 | 758 | default: // un-support Content-type | 
| 759 | -          $this->output('Msg #' . $pos . ' is unsupported Content-Type:' . $structure->type, self::VERBOSE_REPORT); | |
| 759 | +          $this->output('Msg #'.$pos.' is unsupported Content-Type:'.$structure->type, self::VERBOSE_REPORT); | |
| 760 | 760 | |
| 761 | 761 | return false; | 
| 762 | 762 | } | 
| @@ -803,7 +803,7 @@ discard block | ||
| 803 | 803 | } | 
| 804 | 804 | |
| 805 | 805 |        if ($this->testMode) { | 
| 806 | -        $this->output('Match: ' . $ruleNumber . ':' . $ruleCategory . '; ' . $bounceType . '; ' . $email); | |
| 806 | +        $this->output('Match: '.$ruleNumber.':'.$ruleCategory.'; '.$bounceType.'; '.$email); | |
| 807 | 807 |        } else { | 
| 808 | 808 | // code below will use the Callback function, but return no value | 
| 809 | 809 | $params = array( | 
| @@ -828,7 +828,7 @@ discard block | ||
| 828 | 828 |      } else { | 
| 829 | 829 | // match rule, do bounce action | 
| 830 | 830 |        if ($this->testMode) { | 
| 831 | -        $this->output('Match: ' . $ruleNumber . ':' . $ruleCategory . '; ' . $bounceType . '; ' . $email); | |
| 831 | +        $this->output('Match: '.$ruleNumber.':'.$ruleCategory.'; '.$bounceType.'; '.$email); | |
| 832 | 832 | |
| 833 | 833 | return true; | 
| 834 | 834 | } | 
| @@ -871,19 +871,19 @@ discard block | ||
| 871 | 871 |      if (trim($mailbox) == '') { | 
| 872 | 872 | // this is a critical error with either the mailbox name blank or an invalid mailbox name | 
| 873 | 873 | // need to stop processing and exit at this point | 
| 874 | - echo 'Invalid mailbox name for move operation. Cannot continue: ' . $mailbox . "<br />\n"; | |
| 874 | + echo 'Invalid mailbox name for move operation. Cannot continue: '.$mailbox."<br />\n"; | |
| 875 | 875 | exit(); | 
| 876 | 876 | } | 
| 877 | 877 | |
| 878 | - $port = $this->port . '/' . $this->service . '/' . $this->serviceOption; | |
| 878 | + $port = $this->port.'/'.$this->service.'/'.$this->serviceOption; | |
| 879 | 879 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ | 
| 880 | -    $mbox = @imap_open('{' . $this->mailhost . ':' . $port . '}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); | |
| 880 | +    $mbox = @imap_open('{'.$this->mailhost.':'.$port.'}', $this->mailboxUserName, $this->mailboxPassword, OP_HALFOPEN); | |
| 881 | 881 | |
| 882 | 882 |      if ($mbox === false) { | 
| 883 | 883 | return false; | 
| 884 | 884 | } | 
| 885 | 885 | |
| 886 | -    $list = imap_getmailboxes($mbox, '{' . $this->mailhost . ':' . $port . '}', '*'); | |
| 886 | +    $list = imap_getmailboxes($mbox, '{'.$this->mailhost.':'.$port.'}', '*'); | |
| 887 | 887 | $mailboxFound = false; | 
| 888 | 888 | |
| 889 | 889 |      if (is_array($list)) { | 
| @@ -898,7 +898,7 @@ discard block | ||
| 898 | 898 | |
| 899 | 899 |        if (($mailboxFound === false) && $create) { | 
| 900 | 900 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ | 
| 901 | -        @imap_createmailbox($mbox, imap_utf7_encode('{' . $this->mailhost . ':' . $port . '}' . $mailbox)); | |
| 901 | +        @imap_createmailbox($mbox, imap_utf7_encode('{'.$this->mailhost.':'.$port.'}'.$mailbox)); | |
| 902 | 902 | imap_close($mbox); | 
| 903 | 903 | |
| 904 | 904 | return true; |