summaryrefslogtreecommitdiffstats
path: root/wp-includes/class-pop3.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-02-26 14:03:58 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-02-26 14:03:58 +0000
commitce8693de30e8da06a8a4982e321f0a33fbeee979 (patch)
treec80ea3a19e84d0da5a48815fe4457e46f784e193 /wp-includes/class-pop3.php
parent132f53ddaeb250222a4ac85ebc0bf4dd780db60e (diff)
downloadwordpress-mu-ce8693de30e8da06a8a4982e321f0a33fbeee979.tar.gz
wordpress-mu-ce8693de30e8da06a8a4982e321f0a33fbeee979.tar.xz
wordpress-mu-ce8693de30e8da06a8a4982e321f0a33fbeee979.zip
WP Merge to rev 4950
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@900 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/class-pop3.php')
-rw-r--r--wp-includes/class-pop3.php73
1 files changed, 24 insertions, 49 deletions
diff --git a/wp-includes/class-pop3.php b/wp-includes/class-pop3.php
index 468ca8b..fccf329 100644
--- a/wp-includes/class-pop3.php
+++ b/wp-includes/class-pop3.php
@@ -3,7 +3,7 @@
/**
* mail_fetch/setup.php
*
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * 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
@@ -13,7 +13,7 @@
*
* pop3 class
*
- * $Id: class-pop3.php 2066 2005-01-07 01:29:49Z saxmatt $
+ * $Id: class-pop3.php 4945 2007-02-25 18:19:21Z ryan $
*/
class POP3 {
@@ -40,9 +40,6 @@ class POP3 {
var $BANNER = ''; // Holds the banner returned by the
// pop server - used for apop()
- var $RFC1939 = TRUE; // Set by noop(). See rfc1939.txt
- //
-
var $ALLOWAPOP = FALSE; // Allow or disallow apop()
// This must be set to true
// manually
@@ -59,12 +56,14 @@ class POP3 {
if(!empty($timeout)) {
settype($timeout,"integer");
$this->TIMEOUT = $timeout;
+ if (!ini_get('safe_mode'))
set_time_limit($timeout);
}
return true;
}
function update_timer () {
+ if (!ini_get('safe_mode'))
set_time_limit($this->TIMEOUT);
return true;
}
@@ -75,6 +74,7 @@ class POP3 {
// If MAILSERVER is set, override $server with it's value
+ if (!isset($port) || !$port) {$port = 110;}
if(!empty($this->MAILSERVER))
$server = $this->MAILSERVER;
@@ -84,7 +84,7 @@ class POP3 {
return false;
}
- $fp = fsockopen("$server", $port, $errno, $errstr);
+ $fp = @fsockopen("$server", $port, $errno, $errstr);
if(!$fp) {
$this->ERROR = _("POP3 connect:") . ' ' . _("Error ") . "[$errno] [$errstr]";
@@ -105,25 +105,7 @@ class POP3 {
}
$this->FP = $fp;
$this->BANNER = $this->parse_banner($reply);
- $this->RFC1939 = $this->noop();
- if($this->RFC1939) {
- $this->ERROR = _("POP3: premature NOOP OK, NOT an RFC 1939 Compliant server");
- $this->quit();
- return false;
- } else
- return true;
- }
-
- function noop () {
-
- if(!isset($this->FP)) {
- $this->ERROR = _("POP3 noop:") . ' ' . _("No connection to server");
- return false;
- } else {
- $cmd = "NOOP";
- $reply = $this->send_cmd( $cmd );
- return( $this->is_ok( $reply ) );
- }
+ return true;
}
function user ($user = "") {
@@ -158,20 +140,14 @@ class POP3 {
} else {
$reply = $this->send_cmd("PASS $pass");
if(!$this->is_ok($reply)) {
- $this->ERROR = _("POP3 pass:") . ' ' . _("authentication failed ") . "[$reply]";
+ $this->ERROR = _("POP3 pass:") . ' ' . _("Authentication failed ") . "[$reply]";
$this->quit();
return false;
} else {
// Auth successful.
$count = $this->last("count");
$this->COUNT = $count;
- $this->RFC1939 = $this->noop();
- if(!$this->RFC1939) {
- $this->ERROR = _("POP3 pass:") . ' ' . _("NOOP failed. Server not RFC 1939 compliant");
- $this->quit();
- return false;
- } else
- return $count;
+ return $count;
}
}
}
@@ -214,13 +190,7 @@ class POP3 {
// Auth successful.
$count = $this->last("count");
$this->COUNT = $count;
- $this->RFC1939 = $this->noop();
- if(!$this->RFC1939) {
- $this->ERROR = _("POP3 apop:") . ' ' . _("NOOP failed. Server not RFC 1939 compliant");
- $this->quit();
- return false;
- } else
- return $count;
+ return $count;
}
}
}
@@ -330,7 +300,7 @@ class POP3 {
$this->ERROR = _("POP3 pop_list:") . ' ' . _("Error ") . "[$reply]";
return false;
}
- list($junk,$num,$size) = explode(" ",$reply);
+ list($junk,$num,$size) = preg_split('/\s+/',$reply);
return $size;
}
$cmd = "LIST";
@@ -353,7 +323,7 @@ class POP3 {
$this->ERROR = _("POP3 pop_list:") . ' ' . _("Premature end of list");
return false;
}
- list($thisMsg,$msgSize) = explode(" ",$line);
+ list($thisMsg,$msgSize) = preg_split('/\s+/',$line);
settype($thisMsg,"integer");
if($thisMsg != $msgC)
{
@@ -393,13 +363,18 @@ class POP3 {
$count = 0;
$MsgArray = array();
- $line = fgets($fp,$buffer);
+ $line = "";
while ( !ereg("^\.\r\n",$line))
{
- $MsgArray[$count] = $line;
- $count++;
$line = fgets($fp,$buffer);
+ if (preg_match("/^\s+/", $line) && $count > 0) {
+ $MsgArray[$count-1] .= $line;
+ continue;
+ }
if(empty($line)) { break; }
+
+ $MsgArray[$count] = $line;
+ $count++;
}
return $MsgArray;
}
@@ -423,7 +398,7 @@ class POP3 {
return $last;
}
- $Vars = explode(" ",$reply);
+ $Vars = preg_split('/\s+/',$reply);
$count = $Vars[1];
$size = $Vars[2];
settype($count,"integer");
@@ -554,7 +529,7 @@ class POP3 {
$this->ERROR = _("POP3 uidl:") . ' ' . _("Error ") . "[$reply]";
return false;
}
- list ($ok,$num,$myUidl) = explode(" ",$reply);
+ list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply);
return $myUidl;
} else {
$this->update_timer();
@@ -585,7 +560,7 @@ class POP3 {
if(ereg("^\.\r\n",$line)) {
break;
}
- list ($msg,$msgUidl) = explode(" ",$line);
+ list ($msg,$msgUidl) = preg_split('/\s+/',$line);
$msgUidl = $this->strip_clf($msgUidl);
if($count == $msg) {
$UIDLArray[$msg] = $msgUidl;
@@ -656,7 +631,7 @@ class POP3 {
for($count =0; $count < $length; $count++)
{
$digit = substr($server_text, $count, 1);
- if ( false !== $digit ) {
+ if (!empty($digit)) {
if( (!$outside) && ($digit != '<') && ($digit != '>') )
{
$banner .= $digit;