Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/itchief/feedbackForm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'feedback/phpmailer/src/POP3.php')
-rw-r--r--feedback/phpmailer/src/POP3.php87
1 files changed, 58 insertions, 29 deletions
diff --git a/feedback/phpmailer/src/POP3.php b/feedback/phpmailer/src/POP3.php
index 50d5f0c..9bd3198 100644
--- a/feedback/phpmailer/src/POP3.php
+++ b/feedback/phpmailer/src/POP3.php
@@ -1,4 +1,5 @@
<?php
+
/**
* PHPMailer POP-Before-SMTP Authentication Class.
* PHP Version 5.5.
@@ -9,7 +10,7 @@
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
- * @copyright 2012 - 2019 Marcus Bointon
+ * @copyright 2012 - 2020 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
@@ -45,7 +46,7 @@ class POP3
*
* @var string
*/
- const VERSION = '6.1.4';
+ const VERSION = '6.4.0';
/**
* Default POP3 port number.
@@ -62,12 +63,16 @@ class POP3
const DEFAULT_TIMEOUT = 30;
/**
- * Debug display level.
- * Options: 0 = no, 1+ = yes.
+ * POP3 class debug output mode.
+ * Debug output level.
+ * Options:
+ * @see POP3::DEBUG_OFF: No output
+ * @see POP3::DEBUG_SERVER: Server messages, connection/server errors
+ * @see POP3::DEBUG_CLIENT: Client and Server messages, connection/server errors
*
* @var int
*/
- public $do_debug = 0;
+ public $do_debug = self::DEBUG_OFF;
/**
* POP3 mail server hostname.
@@ -131,6 +136,28 @@ class POP3
const LE = "\r\n";
/**
+ * Debug level for no output.
+ *
+ * @var int
+ */
+ const DEBUG_OFF = 0;
+
+ /**
+ * Debug level to show server -> client messages
+ * also shows clients connection errors or errors from server
+ *
+ * @var int
+ */
+ const DEBUG_SERVER = 1;
+
+ /**
+ * Debug level to show client -> server and server -> client messages.
+ *
+ * @var int
+ */
+ const DEBUG_CLIENT = 2;
+
+ /**
* Simple static wrapper for all-in-one POP before SMTP.
*
* @param string $host The hostname to connect to
@@ -172,13 +199,13 @@ class POP3
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
{
$this->host = $host;
- // If no port value provided, use default
+ //If no port value provided, use default
if (false === $port) {
$this->port = static::DEFAULT_PORT;
} else {
$this->port = (int) $port;
}
- // If no timeout value provided, use default
+ //If no timeout value provided, use default
if (false === $timeout) {
$this->tval = static::DEFAULT_TIMEOUT;
} else {
@@ -187,9 +214,9 @@ class POP3
$this->do_debug = $debug_level;
$this->username = $username;
$this->password = $password;
- // Reset the error log
+ //Reset the error log
$this->errors = [];
- // connect
+ //Connect
$result = $this->connect($this->host, $this->port, $this->tval);
if ($result) {
$login_result = $this->login($this->username, $this->password);
@@ -199,7 +226,7 @@ class POP3
return true;
}
}
- // We need to disconnect regardless of whether the login succeeded
+ //We need to disconnect regardless of whether the login succeeded
$this->disconnect();
return false;
@@ -216,7 +243,7 @@ class POP3
*/
public function connect($host, $port = false, $tval = 30)
{
- // Are we already connected?
+ //Are we already connected?
if ($this->connected) {
return true;
}
@@ -229,20 +256,22 @@ class POP3
$port = static::DEFAULT_PORT;
}
- // connect to the POP3 server
+ //Connect to the POP3 server
+ $errno = 0;
+ $errstr = '';
$this->pop_conn = fsockopen(
- $host, // POP3 Host
- $port, // Port #
- $errno, // Error Number
- $errstr, // Error Message
+ $host, //POP3 Host
+ $port, //Port #
+ $errno, //Error Number
+ $errstr, //Error Message
$tval
- ); // Timeout (seconds)
- // Restore the error handler
+ ); //Timeout (seconds)
+ //Restore the error handler
restore_error_handler();
- // Did we connect?
+ //Did we connect?
if (false === $this->pop_conn) {
- // It would appear not...
+ //It would appear not...
$this->setError(
"Failed to connect to server $host on port $port. errno: $errno; errstr: $errstr"
);
@@ -250,14 +279,14 @@ class POP3
return false;
}
- // Increase the stream time-out
+ //Increase the stream time-out
stream_set_timeout($this->pop_conn, $tval, 0);
- // Get the POP3 server response
+ //Get the POP3 server response
$pop3_response = $this->getResponse();
- // Check for the +OK
+ //Check for the +OK
if ($this->checkResponse($pop3_response)) {
- // The connection is established and the POP3 server is talking
+ //The connection is established and the POP3 server is talking
$this->connected = true;
return true;
@@ -287,11 +316,11 @@ class POP3
$password = $this->password;
}
- // Send the Username
+ //Send the Username
$this->sendString("USER $username" . static::LE);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
- // Send the Password
+ //Send the Password
$this->sendString("PASS $password" . static::LE);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
@@ -327,7 +356,7 @@ class POP3
protected function getResponse($size = 128)
{
$response = fgets($this->pop_conn, $size);
- if ($this->do_debug >= 1) {
+ if ($this->do_debug >= self::DEBUG_SERVER) {
echo 'Server -> Client: ', $response;
}
@@ -344,7 +373,7 @@ class POP3
protected function sendString($string)
{
if ($this->pop_conn) {
- if ($this->do_debug >= 2) { //Show client messages when debug >= 2
+ if ($this->do_debug >= self::DEBUG_CLIENT) { //Show client messages when debug >= 2
echo 'Client -> Server: ', $string;
}
@@ -382,7 +411,7 @@ class POP3
protected function setError($error)
{
$this->errors[] = $error;
- if ($this->do_debug >= 1) {
+ if ($this->do_debug >= self::DEBUG_SERVER) {
echo '<pre>';
foreach ($this->errors as $e) {
print_r($e);