Ticket #4337: 4337.2.diff
File 4337.2.diff, 13.1 KB (added by , 17 years ago) |
---|
-
wp-includes/class-pop3.php
57 57 settype($timeout,"integer"); 58 58 $this->TIMEOUT = $timeout; 59 59 if (!ini_get('safe_mode')) 60 set_time_limit($timeout);60 set_time_limit($timeout); 61 61 } 62 62 return true; 63 63 } 64 64 65 65 function update_timer () { 66 66 if (!ini_get('safe_mode')) 67 set_time_limit($this->TIMEOUT);67 set_time_limit($this->TIMEOUT); 68 68 return true; 69 69 } 70 70 … … 73 73 // port defaults to 110. Returns true on success, false on fail 74 74 75 75 // If MAILSERVER is set, override $server with it's value 76 77 76 77 if (!isset($port) || !$port) {$port = 110;} 78 78 if(!empty($this->MAILSERVER)) 79 79 $server = $this->MAILSERVER; 80 80 81 81 if(empty($server)){ 82 $this->ERROR = _("POP3 connect:") . ' '. _("No server specified");82 $this->ERROR = "POP3 connect: " . _("No server specified"); 83 83 unset($this->FP); 84 84 return false; 85 85 } … … 87 87 $fp = @fsockopen("$server", $port, $errno, $errstr); 88 88 89 89 if(!$fp) { 90 $this->ERROR = _("POP3 connect:") . ' '. _("Error ") . "[$errno] [$errstr]";90 $this->ERROR = "POP3 connect: " . _("Error ") . "[$errno] [$errstr]"; 91 91 unset($this->FP); 92 92 return false; 93 93 } … … 99 99 if($this->DEBUG) 100 100 error_log("POP3 SEND [connect: $server] GOT [$reply]",0); 101 101 if(!$this->is_ok($reply)) { 102 $this->ERROR = _("POP3 connect:") . ' '. _("Error ") . "[$reply]";102 $this->ERROR = "POP3 connect: " . _("Error ") . "[$reply]"; 103 103 unset($this->FP); 104 104 return false; 105 105 } … … 112 112 // Sends the USER command, returns true or false 113 113 114 114 if( empty($user) ) { 115 $this->ERROR = _("POP3 user:") . ' '. _("no login ID submitted");115 $this->ERROR = "POP3 user: " . _("no login ID submitted"); 116 116 return false; 117 117 } elseif(!isset($this->FP)) { 118 $this->ERROR = _("POP3 user:") . ' '. _("connection not established");118 $this->ERROR = "POP3 user: " . _("connection not established"); 119 119 return false; 120 120 } else { 121 121 $reply = $this->send_cmd("USER $user"); 122 122 if(!$this->is_ok($reply)) { 123 $this->ERROR = _("POP3 user:") . ' '. _("Error ") . "[$reply]";123 $this->ERROR = "POP3 user: " . _("Error ") . "[$reply]"; 124 124 return false; 125 125 } else 126 126 return true; … … 132 132 // returns false (undef) on Auth failure 133 133 134 134 if(empty($pass)) { 135 $this->ERROR = _("POP3 pass:") . ' '. _("No password submitted");135 $this->ERROR = "POP3 pass: " . _("No password submitted"); 136 136 return false; 137 137 } elseif(!isset($this->FP)) { 138 $this->ERROR = _("POP3 pass:") . ' '. _("connection not established");138 $this->ERROR = "POP3 pass: " . _("connection not established"); 139 139 return false; 140 140 } else { 141 141 $reply = $this->send_cmd("PASS $pass"); 142 142 if(!$this->is_ok($reply)) { 143 $this->ERROR = _("POP3 pass:") . ' ' . _("Authentication failed ") . "[$reply]";143 $this->ERROR = "POP3 pass: " . _("Authentication failed") . " [$reply]"; 144 144 $this->quit(); 145 145 return false; 146 146 } else { … … 159 159 // (apop is optional per rfc1939) 160 160 161 161 if(!isset($this->FP)) { 162 $this->ERROR = _("POP3 apop:") . ' '. _("No connection to server");162 $this->ERROR = "POP3 apop: " . _("No connection to server"); 163 163 return false; 164 164 } elseif(!$this->ALLOWAPOP) { 165 165 $retVal = $this->login($login,$pass); 166 166 return $retVal; 167 167 } elseif(empty($login)) { 168 $this->ERROR = _("POP3 apop:") . ' '. _("No login ID submitted");168 $this->ERROR = "POP3 apop: " . _("No login ID submitted"); 169 169 return false; 170 170 } elseif(empty($pass)) { 171 $this->ERROR = _("POP3 apop:") . ' '. _("No password submitted");171 $this->ERROR = "POP3 apop: " . _("No password submitted"); 172 172 return false; 173 173 } else { 174 174 $banner = $this->BANNER; 175 175 if( (!$banner) or (empty($banner)) ) { 176 $this->ERROR = _("POP3 apop:") . ' '. _("No server banner") . ' - ' . _("abort");176 $this->ERROR = "POP3 apop: " . _("No server banner") . ' - ' . _("abort"); 177 177 $retVal = $this->login($login,$pass); 178 178 return $retVal; 179 179 } else { … … 183 183 $cmd = "APOP $login $APOPString"; 184 184 $reply = $this->send_cmd($cmd); 185 185 if(!$this->is_ok($reply)) { 186 $this->ERROR = _("POP3 apop:") . ' '. _("apop authentication failed") . ' - ' . _("abort");186 $this->ERROR = "POP3 apop: " . _("apop authentication failed") . ' - ' . _("abort"); 187 187 $retVal = $this->login($login,$pass); 188 188 return $retVal; 189 189 } else { … … 202 202 // the number of messages.) 203 203 204 204 if( !isset($this->FP) ) { 205 $this->ERROR = _("POP3 login:") . ' '. _("No connection to server");205 $this->ERROR = "POP3 login: " . _("No connection to server"); 206 206 return false; 207 207 } else { 208 208 $fp = $this->FP; … … 227 227 // only the header information, and none of the body. 228 228 229 229 if(!isset($this->FP)) { 230 $this->ERROR = _("POP3 top:") . ' '. _("No connection to server");230 $this->ERROR = "POP3 top: " . _("No connection to server"); 231 231 return false; 232 232 } 233 233 $this->update_timer(); … … 243 243 } 244 244 if(!$this->is_ok($reply)) 245 245 { 246 $this->ERROR = _("POP3 top:") . ' '. _("Error ") . "[$reply]";246 $this->ERROR = "POP3 top: " . _("Error ") . "[$reply]"; 247 247 return false; 248 248 } 249 249 … … 269 269 270 270 if(!isset($this->FP)) 271 271 { 272 $this->ERROR = _("POP3 pop_list:") . ' '. _("No connection to server");272 $this->ERROR = "POP3 pop_list: " . _("No connection to server"); 273 273 return false; 274 274 } 275 275 $fp = $this->FP; … … 297 297 } 298 298 if(!$this->is_ok($reply)) 299 299 { 300 $this->ERROR = _("POP3 pop_list:") . ' '. _("Error ") . "[$reply]";300 $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; 301 301 return false; 302 302 } 303 303 list($junk,$num,$size) = preg_split('/\s+/',$reply); … … 308 308 if(!$this->is_ok($reply)) 309 309 { 310 310 $reply = $this->strip_clf($reply); 311 $this->ERROR = _("POP3 pop_list:") . ' '. _("Error ") . "[$reply]";311 $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; 312 312 return false; 313 313 } 314 314 $MsgArray = array(); … … 320 320 $line = $this->strip_clf($line); 321 321 if(ereg("^\.",$line)) 322 322 { 323 $this->ERROR = _("POP3 pop_list:") . ' '. _("Premature end of list");323 $this->ERROR = "POP3 pop_list: " . _("Premature end of list"); 324 324 return false; 325 325 } 326 326 list($thisMsg,$msgSize) = preg_split('/\s+/',$line); … … 343 343 344 344 if(!isset($this->FP)) 345 345 { 346 $this->ERROR = _("POP3 get:") . ' '. _("No connection to server");346 $this->ERROR = "POP3 get: " . _("No connection to server"); 347 347 return false; 348 348 } 349 349 … … 356 356 357 357 if(!$this->is_ok($reply)) 358 358 { 359 $this->ERROR = _("POP3 get:") . ' '. _("Error ") . "[$reply]";359 $this->ERROR = "POP3 get: " . _("Error ") . "[$reply]"; 360 360 return false; 361 361 } 362 362 363 363 $count = 0; 364 364 $MsgArray = array(); 365 365 366 $line = "";366 $line = fgets($fp,$buffer); 367 367 while ( !ereg("^\.\r\n",$line)) 368 368 { 369 $line = fgets($fp,$buffer); 370 if (preg_match("/^\s+/", $line) && $count > 0) { 371 $MsgArray[$count-1] .= $line; 372 continue; 373 } 374 if(empty($line)) { break; } 375 369 if ( $line{0} == '.' ) { $line = substr($line,1); } 376 370 $MsgArray[$count] = $line; 377 371 $count++; 372 $line = fgets($fp,$buffer); 373 if(empty($line)) { break; } 378 374 } 379 375 return $MsgArray; 380 376 } … … 387 383 $last = -1; 388 384 if(!isset($this->FP)) 389 385 { 390 $this->ERROR = _("POP3 last:") . ' '. _("No connection to server");386 $this->ERROR = "POP3 last: " . _("No connection to server"); 391 387 return $last; 392 388 } 393 389 394 390 $reply = $this->send_cmd("STAT"); 395 391 if(!$this->is_ok($reply)) 396 392 { 397 $this->ERROR = _("POP3 last:") . ' '. _("Error ") . "[$reply]";393 $this->ERROR = "POP3 last: " . _("Error ") . "[$reply]"; 398 394 return $last; 399 395 } 400 396 … … 417 413 418 414 if(!isset($this->FP)) 419 415 { 420 $this->ERROR = _("POP3 reset:") . ' '. _("No connection to server");416 $this->ERROR = "POP3 reset: " . _("No connection to server"); 421 417 return false; 422 418 } 423 419 $reply = $this->send_cmd("RSET"); … … 427 423 // response - if it ever does, something truely 428 424 // wild is going on. 429 425 430 $this->ERROR = _("POP3 reset:") . ' '. _("Error ") . "[$reply]";426 $this->ERROR = "POP3 reset: " . _("Error ") . "[$reply]"; 431 427 @error_log("POP3 reset: ERROR [$reply]",0); 432 428 } 433 429 $this->quit(); … … 451 447 452 448 if(!isset($this->FP)) 453 449 { 454 $this->ERROR = _("POP3 send_cmd:") . ' '. _("No connection to server");450 $this->ERROR = "POP3 send_cmd: " . _("No connection to server"); 455 451 return false; 456 452 } 457 453 458 454 if(empty($cmd)) 459 455 { 460 $this->ERROR = _("POP3 send_cmd:") . ' '. _("Empty command string");456 $this->ERROR = "POP3 send_cmd: " . _("Empty command string"); 461 457 return ""; 462 458 } 463 459 … … 477 473 478 474 if(!isset($this->FP)) 479 475 { 480 $this->ERROR = _("POP3 quit:") . ' '. _("connection does not exist");476 $this->ERROR = "POP3 quit: " . _("connection does not exist"); 481 477 return false; 482 478 } 483 479 $fp = $this->FP; … … 514 510 // Array element 0 will contain the total number of msgs 515 511 516 512 if(!isset($this->FP)) { 517 $this->ERROR = _("POP3 uidl:") . ' '. _("No connection to server");513 $this->ERROR = "POP3 uidl: " . _("No connection to server"); 518 514 return false; 519 515 } 520 516 … … 526 522 $reply = $this->send_cmd($cmd); 527 523 if(!$this->is_ok($reply)) 528 524 { 529 $this->ERROR = _("POP3 uidl:") . ' '. _("Error ") . "[$reply]";525 $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; 530 526 return false; 531 527 } 532 528 list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply); … … 549 545 if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } 550 546 if(!$this->is_ok($reply)) 551 547 { 552 $this->ERROR = _("POP3 uidl:") . ' '. _("Error ") . "[$reply]";548 $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; 553 549 return false; 554 550 } 555 551 … … 582 578 583 579 if(!isset($this->FP)) 584 580 { 585 $this->ERROR = _("POP3 delete:") . ' '. _("No connection to server");581 $this->ERROR = "POP3 delete: " . _("No connection to server"); 586 582 return false; 587 583 } 588 584 if(empty($msgNum)) 589 585 { 590 $this->ERROR = _("POP3 delete:") . ' '. _("No msg number submitted");586 $this->ERROR = "POP3 delete: " . _("No msg number submitted"); 591 587 return false; 592 588 } 593 589 $reply = $this->send_cmd("DELE $msgNum"); 594 590 if(!$this->is_ok($reply)) 595 591 { 596 $this->ERROR = _("POP3 delete:") . ' '. _("Command failed ") . "[$reply]";592 $this->ERROR = "POP3 delete: " . _("Command failed ") . "[$reply]"; 597 593 return false; 598 594 } 599 595 return true; … … 630 626 $length = strlen($server_text); 631 627 for($count =0; $count < $length; $count++) 632 628 { 633 $digit = substr($server_text, $count,1);634 if (!empty($digit)){629 $digit = substr($server_text,$count,1); 630 if(!empty($digit)) { 635 631 if( (!$outside) && ($digit != '<') && ($digit != '>') ) 636 632 { 637 633 $banner .= $digit; … … 651 647 } 652 648 653 649 } // End class 654 655 650 ?>