Update pop3 class. Props aaroncampbell. fixes #17064
git-svn-id: https://develop.svn.wordpress.org/trunk@17677 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ac60019881
commit
d60e75b7d3
@ -2,20 +2,18 @@
|
|||||||
/**
|
/**
|
||||||
* mail_fetch/setup.php
|
* mail_fetch/setup.php
|
||||||
*
|
*
|
||||||
* @package SquirrelMail
|
* Copyright (c) 1999-2011 CDI (cdi@thewebmasters.net) All Rights Reserved
|
||||||
*
|
* Modified by Philippe Mingo 2001-2009 mingo@rotedic.com
|
||||||
* @copyright (c) 1999-2006 The SquirrelMail Project Team
|
|
||||||
*
|
|
||||||
* @copyright (c) 1999 CDI (cdi@thewebmasters.net) All Rights Reserved
|
|
||||||
* Modified by Philippe Mingo 2001 mingo@rotedic.com
|
|
||||||
* An RFC 1939 compliant wrapper class for the POP3 protocol.
|
* An RFC 1939 compliant wrapper class for the POP3 protocol.
|
||||||
*
|
*
|
||||||
* Licensed under the GNU GPL. For full terms see the file COPYING.
|
* Licensed under the GNU GPL. For full terms see the file COPYING.
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License
|
|
||||||
*
|
*
|
||||||
* pop3 class
|
* POP3 class
|
||||||
*
|
*
|
||||||
* $Id$
|
* @copyright 1999-2011 The SquirrelMail Project Team
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
* @package plugins
|
||||||
|
* @subpackage mail_fetch
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class POP3 {
|
class POP3 {
|
||||||
@ -76,7 +74,7 @@ class POP3 {
|
|||||||
|
|
||||||
// If MAILSERVER is set, override $server with it's value
|
// If MAILSERVER is set, override $server with it's value
|
||||||
|
|
||||||
if (!isset($port) || !$port) {$port = 110;}
|
if (!isset($port) || !$port) {$port = 110;}
|
||||||
if(!empty($this->MAILSERVER))
|
if(!empty($this->MAILSERVER))
|
||||||
$server = $this->MAILSERVER;
|
$server = $this->MAILSERVER;
|
||||||
|
|
||||||
@ -253,7 +251,7 @@ class POP3 {
|
|||||||
$MsgArray = array();
|
$MsgArray = array();
|
||||||
|
|
||||||
$line = fgets($fp,$buffer);
|
$line = fgets($fp,$buffer);
|
||||||
while ( !ereg("^\.\r\n",$line))
|
while ( !preg_match('/^\.\r\n/',$line))
|
||||||
{
|
{
|
||||||
$MsgArray[$count] = $line;
|
$MsgArray[$count] = $line;
|
||||||
$count++;
|
$count++;
|
||||||
@ -320,7 +318,7 @@ class POP3 {
|
|||||||
if($msgC > $Total) { break; }
|
if($msgC > $Total) { break; }
|
||||||
$line = fgets($fp,$this->BUFFER);
|
$line = fgets($fp,$this->BUFFER);
|
||||||
$line = $this->strip_clf($line);
|
$line = $this->strip_clf($line);
|
||||||
if(ereg("^\.",$line))
|
if(strpos($line, '.') === 0)
|
||||||
{
|
{
|
||||||
$this->ERROR = "POP3 pop_list: " . _("Premature end of list");
|
$this->ERROR = "POP3 pop_list: " . _("Premature end of list");
|
||||||
return false;
|
return false;
|
||||||
@ -366,9 +364,9 @@ class POP3 {
|
|||||||
$MsgArray = array();
|
$MsgArray = array();
|
||||||
|
|
||||||
$line = fgets($fp,$buffer);
|
$line = fgets($fp,$buffer);
|
||||||
while ( !ereg("^\.\r\n",$line))
|
while ( !preg_match('/^\.\r\n/',$line))
|
||||||
{
|
{
|
||||||
if ( $line[0] == '.' ) { $line = substr($line,1); }
|
if ( $line{0} == '.' ) { $line = substr($line,1); }
|
||||||
$MsgArray[$count] = $line;
|
$MsgArray[$count] = $line;
|
||||||
$count++;
|
$count++;
|
||||||
$line = fgets($fp,$buffer);
|
$line = fgets($fp,$buffer);
|
||||||
@ -554,10 +552,7 @@ class POP3 {
|
|||||||
$line = "";
|
$line = "";
|
||||||
$count = 1;
|
$count = 1;
|
||||||
$line = fgets($fp,$buffer);
|
$line = fgets($fp,$buffer);
|
||||||
while ( !ereg("^\.\r\n",$line)) {
|
while ( !preg_match('/^\.\r\n/',$line)) {
|
||||||
if(ereg("^\.\r\n",$line)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
list ($msg,$msgUidl) = preg_split('/\s+/',$line);
|
list ($msg,$msgUidl) = preg_split('/\s+/',$line);
|
||||||
$msgUidl = $this->strip_clf($msgUidl);
|
$msgUidl = $this->strip_clf($msgUidl);
|
||||||
if($count == $msg) {
|
if($count == $msg) {
|
||||||
@ -607,7 +602,7 @@ class POP3 {
|
|||||||
if( empty($cmd) )
|
if( empty($cmd) )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return( ereg ("^\+OK", $cmd ) );
|
return( stripos($cmd, '+OK') !== false );
|
||||||
}
|
}
|
||||||
|
|
||||||
function strip_clf ($text = "") {
|
function strip_clf ($text = "") {
|
||||||
@ -616,8 +611,7 @@ class POP3 {
|
|||||||
if(empty($text))
|
if(empty($text))
|
||||||
return $text;
|
return $text;
|
||||||
else {
|
else {
|
||||||
$stripped = str_replace("\r",'',$text);
|
$stripped = str_replace(array("\r","\n"),'',$text);
|
||||||
$stripped = str_replace("\n",'',$stripped);
|
|
||||||
return $stripped;
|
return $stripped;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -649,4 +643,10 @@ class POP3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // End class
|
} // End class
|
||||||
?>
|
|
||||||
|
// For php4 compatibility
|
||||||
|
if (!function_exists("stripos")) {
|
||||||
|
function stripos($haystack, $needle){
|
||||||
|
return strpos($haystack, stristr( $haystack, $needle ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user