diff --git a/wp-includes/class-pop3.php b/wp-includes/class-pop3.php index aa36c48f2..0822aa7da 100644 --- a/wp-includes/class-pop3.php +++ b/wp-includes/class-pop3.php @@ -57,14 +57,14 @@ class POP3 { settype($timeout,"integer"); $this->TIMEOUT = $timeout; if (!ini_get('safe_mode')) - set_time_limit($timeout); + set_time_limit($timeout); } return true; } function update_timer () { if (!ini_get('safe_mode')) - set_time_limit($this->TIMEOUT); + set_time_limit($this->TIMEOUT); return true; } @@ -74,12 +74,12 @@ class POP3 { // 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)) $server = $this->MAILSERVER; if(empty($server)){ - $this->ERROR = _("POP3 connect:") . ' ' . _("No server specified"); + $this->ERROR = "POP3 connect: " . _("No server specified"); unset($this->FP); return false; } @@ -87,7 +87,7 @@ class POP3 { $fp = @fsockopen("$server", $port, $errno, $errstr); if(!$fp) { - $this->ERROR = _("POP3 connect:") . ' ' . _("Error ") . "[$errno] [$errstr]"; + $this->ERROR = "POP3 connect: " . _("Error ") . "[$errno] [$errstr]"; unset($this->FP); return false; } @@ -99,7 +99,7 @@ class POP3 { if($this->DEBUG) error_log("POP3 SEND [connect: $server] GOT [$reply]",0); if(!$this->is_ok($reply)) { - $this->ERROR = _("POP3 connect:") . ' ' . _("Error ") . "[$reply]"; + $this->ERROR = "POP3 connect: " . _("Error ") . "[$reply]"; unset($this->FP); return false; } @@ -112,15 +112,15 @@ class POP3 { // Sends the USER command, returns true or false if( empty($user) ) { - $this->ERROR = _("POP3 user:") . ' ' . _("no login ID submitted"); + $this->ERROR = "POP3 user: " . _("no login ID submitted"); return false; } elseif(!isset($this->FP)) { - $this->ERROR = _("POP3 user:") . ' ' . _("connection not established"); + $this->ERROR = "POP3 user: " . _("connection not established"); return false; } else { $reply = $this->send_cmd("USER $user"); if(!$this->is_ok($reply)) { - $this->ERROR = _("POP3 user:") . ' ' . _("Error ") . "[$reply]"; + $this->ERROR = "POP3 user: " . _("Error ") . "[$reply]"; return false; } else return true; @@ -132,15 +132,15 @@ class POP3 { // returns false (undef) on Auth failure if(empty($pass)) { - $this->ERROR = _("POP3 pass:") . ' ' . _("No password submitted"); + $this->ERROR = "POP3 pass: " . _("No password submitted"); return false; } elseif(!isset($this->FP)) { - $this->ERROR = _("POP3 pass:") . ' ' . _("connection not established"); + $this->ERROR = "POP3 pass: " . _("connection not established"); return false; } 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 { @@ -159,21 +159,21 @@ class POP3 { // (apop is optional per rfc1939) if(!isset($this->FP)) { - $this->ERROR = _("POP3 apop:") . ' ' . _("No connection to server"); + $this->ERROR = "POP3 apop: " . _("No connection to server"); return false; } elseif(!$this->ALLOWAPOP) { $retVal = $this->login($login,$pass); return $retVal; } elseif(empty($login)) { - $this->ERROR = _("POP3 apop:") . ' ' . _("No login ID submitted"); + $this->ERROR = "POP3 apop: " . _("No login ID submitted"); return false; } elseif(empty($pass)) { - $this->ERROR = _("POP3 apop:") . ' ' . _("No password submitted"); + $this->ERROR = "POP3 apop: " . _("No password submitted"); return false; } else { $banner = $this->BANNER; if( (!$banner) or (empty($banner)) ) { - $this->ERROR = _("POP3 apop:") . ' ' . _("No server banner") . ' - ' . _("abort"); + $this->ERROR = "POP3 apop: " . _("No server banner") . ' - ' . _("abort"); $retVal = $this->login($login,$pass); return $retVal; } else { @@ -183,7 +183,7 @@ class POP3 { $cmd = "APOP $login $APOPString"; $reply = $this->send_cmd($cmd); if(!$this->is_ok($reply)) { - $this->ERROR = _("POP3 apop:") . ' ' . _("apop authentication failed") . ' - ' . _("abort"); + $this->ERROR = "POP3 apop: " . _("apop authentication failed") . ' - ' . _("abort"); $retVal = $this->login($login,$pass); return $retVal; } else { @@ -202,7 +202,7 @@ class POP3 { // the number of messages.) if( !isset($this->FP) ) { - $this->ERROR = _("POP3 login:") . ' ' . _("No connection to server"); + $this->ERROR = "POP3 login: " . _("No connection to server"); return false; } else { $fp = $this->FP; @@ -227,7 +227,7 @@ class POP3 { // only the header information, and none of the body. if(!isset($this->FP)) { - $this->ERROR = _("POP3 top:") . ' ' . _("No connection to server"); + $this->ERROR = "POP3 top: " . _("No connection to server"); return false; } $this->update_timer(); @@ -243,7 +243,7 @@ class POP3 { } if(!$this->is_ok($reply)) { - $this->ERROR = _("POP3 top:") . ' ' . _("Error ") . "[$reply]"; + $this->ERROR = "POP3 top: " . _("Error ") . "[$reply]"; return false; } @@ -269,7 +269,7 @@ class POP3 { if(!isset($this->FP)) { - $this->ERROR = _("POP3 pop_list:") . ' ' . _("No connection to server"); + $this->ERROR = "POP3 pop_list: " . _("No connection to server"); return false; } $fp = $this->FP; @@ -297,7 +297,7 @@ class POP3 { } if(!$this->is_ok($reply)) { - $this->ERROR = _("POP3 pop_list:") . ' ' . _("Error ") . "[$reply]"; + $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; return false; } list($junk,$num,$size) = preg_split('/\s+/',$reply); @@ -308,7 +308,7 @@ class POP3 { if(!$this->is_ok($reply)) { $reply = $this->strip_clf($reply); - $this->ERROR = _("POP3 pop_list:") . ' ' . _("Error ") . "[$reply]"; + $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; return false; } $MsgArray = array(); @@ -320,7 +320,7 @@ class POP3 { $line = $this->strip_clf($line); if(ereg("^\.",$line)) { - $this->ERROR = _("POP3 pop_list:") . ' ' . _("Premature end of list"); + $this->ERROR = "POP3 pop_list: " . _("Premature end of list"); return false; } list($thisMsg,$msgSize) = preg_split('/\s+/',$line); @@ -343,7 +343,7 @@ class POP3 { if(!isset($this->FP)) { - $this->ERROR = _("POP3 get:") . ' ' . _("No connection to server"); + $this->ERROR = "POP3 get: " . _("No connection to server"); return false; } @@ -356,25 +356,21 @@ class POP3 { if(!$this->is_ok($reply)) { - $this->ERROR = _("POP3 get:") . ' ' . _("Error ") . "[$reply]"; + $this->ERROR = "POP3 get: " . _("Error ") . "[$reply]"; return false; } $count = 0; $MsgArray = array(); - $line = ""; + $line = fgets($fp,$buffer); while ( !ereg("^\.\r\n",$line)) { - $line = fgets($fp,$buffer); - if (preg_match("/^\s+/", $line) && $count > 0) { - $MsgArray[$count-1] .= $line; - continue; - } - if(empty($line)) { break; } - + if ( $line{0} == '.' ) { $line = substr($line,1); } $MsgArray[$count] = $line; $count++; + $line = fgets($fp,$buffer); + if(empty($line)) { break; } } return $MsgArray; } @@ -387,14 +383,14 @@ class POP3 { $last = -1; if(!isset($this->FP)) { - $this->ERROR = _("POP3 last:") . ' ' . _("No connection to server"); + $this->ERROR = "POP3 last: " . _("No connection to server"); return $last; } $reply = $this->send_cmd("STAT"); if(!$this->is_ok($reply)) { - $this->ERROR = _("POP3 last:") . ' ' . _("Error ") . "[$reply]"; + $this->ERROR = "POP3 last: " . _("Error ") . "[$reply]"; return $last; } @@ -417,7 +413,7 @@ class POP3 { if(!isset($this->FP)) { - $this->ERROR = _("POP3 reset:") . ' ' . _("No connection to server"); + $this->ERROR = "POP3 reset: " . _("No connection to server"); return false; } $reply = $this->send_cmd("RSET"); @@ -427,7 +423,7 @@ class POP3 { // response - if it ever does, something truely // wild is going on. - $this->ERROR = _("POP3 reset:") . ' ' . _("Error ") . "[$reply]"; + $this->ERROR = "POP3 reset: " . _("Error ") . "[$reply]"; @error_log("POP3 reset: ERROR [$reply]",0); } $this->quit(); @@ -451,13 +447,13 @@ class POP3 { if(!isset($this->FP)) { - $this->ERROR = _("POP3 send_cmd:") . ' ' . _("No connection to server"); + $this->ERROR = "POP3 send_cmd: " . _("No connection to server"); return false; } if(empty($cmd)) { - $this->ERROR = _("POP3 send_cmd:") . ' ' . _("Empty command string"); + $this->ERROR = "POP3 send_cmd: " . _("Empty command string"); return ""; } @@ -477,7 +473,7 @@ class POP3 { if(!isset($this->FP)) { - $this->ERROR = _("POP3 quit:") . ' ' . _("connection does not exist"); + $this->ERROR = "POP3 quit: " . _("connection does not exist"); return false; } $fp = $this->FP; @@ -514,7 +510,7 @@ class POP3 { // Array element 0 will contain the total number of msgs if(!isset($this->FP)) { - $this->ERROR = _("POP3 uidl:") . ' ' . _("No connection to server"); + $this->ERROR = "POP3 uidl: " . _("No connection to server"); return false; } @@ -526,7 +522,7 @@ class POP3 { $reply = $this->send_cmd($cmd); if(!$this->is_ok($reply)) { - $this->ERROR = _("POP3 uidl:") . ' ' . _("Error ") . "[$reply]"; + $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; return false; } list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply); @@ -549,7 +545,7 @@ class POP3 { if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } if(!$this->is_ok($reply)) { - $this->ERROR = _("POP3 uidl:") . ' ' . _("Error ") . "[$reply]"; + $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; return false; } @@ -582,18 +578,18 @@ class POP3 { if(!isset($this->FP)) { - $this->ERROR = _("POP3 delete:") . ' ' . _("No connection to server"); + $this->ERROR = "POP3 delete: " . _("No connection to server"); return false; } if(empty($msgNum)) { - $this->ERROR = _("POP3 delete:") . ' ' . _("No msg number submitted"); + $this->ERROR = "POP3 delete: " . _("No msg number submitted"); return false; } $reply = $this->send_cmd("DELE $msgNum"); if(!$this->is_ok($reply)) { - $this->ERROR = _("POP3 delete:") . ' ' . _("Command failed ") . "[$reply]"; + $this->ERROR = "POP3 delete: " . _("Command failed ") . "[$reply]"; return false; } return true; @@ -630,8 +626,8 @@ class POP3 { $length = strlen($server_text); for($count =0; $count < $length; $count++) { - $digit = substr($server_text, $count, 1); - if (!empty($digit)) { + $digit = substr($server_text,$count,1); + if(!empty($digit)) { if( (!$outside) && ($digit != '<') && ($digit != '>') ) { $banner .= $digit; @@ -651,5 +647,4 @@ class POP3 { } } // End class - ?>