Ticket #3864: 3864.diff
File 3864.diff, 6.1 KB (added by , 18 years ago) |
---|
-
wp-includes/class-pop3.php
3 3 /** 4 4 * mail_fetch/setup.php 5 5 * 6 * Copyright (c) 1999-200 2The SquirrelMail Project Team6 * Copyright (c) 1999-2006 The SquirrelMail Project Team 7 7 * 8 8 * Copyright (c) 1999 CDI (cdi@thewebmasters.net) All Rights Reserved 9 9 * Modified by Philippe Mingo 2001 mingo@rotedic.com … … 40 40 var $BANNER = ''; // Holds the banner returned by the 41 41 // pop server - used for apop() 42 42 43 var $RFC1939 = TRUE; // Set by noop(). See rfc1939.txt44 //45 46 43 var $ALLOWAPOP = FALSE; // Allow or disallow apop() 47 44 // This must be set to true 48 45 // manually … … 59 56 if(!empty($timeout)) { 60 57 settype($timeout,"integer"); 61 58 $this->TIMEOUT = $timeout; 59 if (!ini_get('safe_mode')) 62 60 set_time_limit($timeout); 63 61 } 64 62 return true; 65 63 } 66 64 67 65 function update_timer () { 66 if (!ini_get('safe_mode')) 68 67 set_time_limit($this->TIMEOUT); 69 68 return true; 70 69 } … … 75 74 76 75 // If MAILSERVER is set, override $server with it's value 77 76 77 if (!isset($port) || !$port) {$port = 110;} 78 78 if(!empty($this->MAILSERVER)) 79 79 $server = $this->MAILSERVER; 80 80 … … 84 84 return false; 85 85 } 86 86 87 $fp = fsockopen("$server", $port, $errno, $errstr);87 $fp = @fsockopen("$server", $port, $errno, $errstr); 88 88 89 89 if(!$fp) { 90 90 $this->ERROR = _("POP3 connect:") . ' ' . _("Error ") . "[$errno] [$errstr]"; … … 105 105 } 106 106 $this->FP = $fp; 107 107 $this->BANNER = $this->parse_banner($reply); 108 $this->RFC1939 = $this->noop(); 109 if($this->RFC1939) { 110 $this->ERROR = _("POP3: premature NOOP OK, NOT an RFC 1939 Compliant server"); 111 $this->quit(); 112 return false; 113 } else 114 return true; 108 return true; 115 109 } 116 110 117 function noop () {118 119 if(!isset($this->FP)) {120 $this->ERROR = _("POP3 noop:") . ' ' . _("No connection to server");121 return false;122 } else {123 $cmd = "NOOP";124 $reply = $this->send_cmd( $cmd );125 return( $this->is_ok( $reply ) );126 }127 }128 129 111 function user ($user = "") { 130 112 // Sends the USER command, returns true or false 131 113 … … 158 140 } else { 159 141 $reply = $this->send_cmd("PASS $pass"); 160 142 if(!$this->is_ok($reply)) { 161 $this->ERROR = _("POP3 pass:") . ' ' . _(" authentication failed ") . "[$reply]";143 $this->ERROR = _("POP3 pass:") . ' ' . _("Authentication failed ") . "[$reply]"; 162 144 $this->quit(); 163 145 return false; 164 146 } else { 165 147 // Auth successful. 166 148 $count = $this->last("count"); 167 149 $this->COUNT = $count; 168 $this->RFC1939 = $this->noop(); 169 if(!$this->RFC1939) { 170 $this->ERROR = _("POP3 pass:") . ' ' . _("NOOP failed. Server not RFC 1939 compliant"); 171 $this->quit(); 172 return false; 173 } else 174 return $count; 150 return $count; 175 151 } 176 152 } 177 153 } … … 214 190 // Auth successful. 215 191 $count = $this->last("count"); 216 192 $this->COUNT = $count; 217 $this->RFC1939 = $this->noop(); 218 if(!$this->RFC1939) { 219 $this->ERROR = _("POP3 apop:") . ' ' . _("NOOP failed. Server not RFC 1939 compliant"); 220 $this->quit(); 221 return false; 222 } else 223 return $count; 193 return $count; 224 194 } 225 195 } 226 196 } … … 330 300 $this->ERROR = _("POP3 pop_list:") . ' ' . _("Error ") . "[$reply]"; 331 301 return false; 332 302 } 333 list($junk,$num,$size) = explode(" ",$reply);303 list($junk,$num,$size) = preg_split('/\s+/',$reply); 334 304 return $size; 335 305 } 336 306 $cmd = "LIST"; … … 353 323 $this->ERROR = _("POP3 pop_list:") . ' ' . _("Premature end of list"); 354 324 return false; 355 325 } 356 list($thisMsg,$msgSize) = explode(" ",$line);326 list($thisMsg,$msgSize) = preg_split('/\s+/',$line); 357 327 settype($thisMsg,"integer"); 358 328 if($thisMsg != $msgC) 359 329 { … … 423 393 return $last; 424 394 } 425 395 426 $Vars = explode(" ",$reply);396 $Vars = preg_split('/\s+/',$reply); 427 397 $count = $Vars[1]; 428 398 $size = $Vars[2]; 429 399 settype($count,"integer"); … … 554 524 $this->ERROR = _("POP3 uidl:") . ' ' . _("Error ") . "[$reply]"; 555 525 return false; 556 526 } 557 list ($ok,$num,$myUidl) = explode(" ",$reply);527 list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply); 558 528 return $myUidl; 559 529 } else { 560 530 $this->update_timer(); … … 585 555 if(ereg("^\.\r\n",$line)) { 586 556 break; 587 557 } 588 list ($msg,$msgUidl) = explode(" ",$line);558 list ($msg,$msgUidl) = preg_split('/\s+/',$line); 589 559 $msgUidl = $this->strip_clf($msgUidl); 590 560 if($count == $msg) { 591 561 $UIDLArray[$msg] = $msgUidl; … … 656 626 for($count =0; $count < $length; $count++) 657 627 { 658 628 $digit = substr($server_text, $count, 1); 659 if ( false !== $digit) {629 if (!empty($digit)) { 660 630 if( (!$outside) && ($digit != '<') && ($digit != '>') ) 661 631 { 662 632 $banner .= $digit;