Make WordPress Core

Changeset 17677


Ignore:
Timestamp:
04/21/2011 08:40:32 PM (13 years ago)
Author:
ryan
Message:

Update pop3 class. Props aaroncampbell. fixes #17064

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-pop3.php

    r17435 r17677  
    33 * mail_fetch/setup.php
    44 *
    5  * @package SquirrelMail
    6  *
    7  * @copyright (c) 1999-2006 The SquirrelMail Project Team
    8  *
    9  * @copyright (c) 1999 CDI (cdi@thewebmasters.net) All Rights Reserved
    10  * Modified by Philippe Mingo 2001 mingo@rotedic.com
     5 * Copyright (c) 1999-2011 CDI (cdi@thewebmasters.net) All Rights Reserved
     6 * Modified by Philippe Mingo 2001-2009 mingo@rotedic.com
    117 * An RFC 1939 compliant wrapper class for the POP3 protocol.
    128 *
    139 * Licensed under the GNU GPL. For full terms see the file COPYING.
    14  * @license http://opensource.org/licenses/gpl-license.php GNU General Public License
    1510 *
    16  * pop3 class
     11 * POP3 class
    1712 *
    18  * $Id$
     13 * @copyright 1999-2011 The SquirrelMail Project Team
     14 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
     15 * @package plugins
     16 * @subpackage mail_fetch
    1917 */
    2018
     
    7775        // If MAILSERVER is set, override $server with it's value
    7876
    79     if (!isset($port) || !$port) {$port = 110;}
     77    if (!isset($port) || !$port) {$port = 110;}
    8078        if(!empty($this->MAILSERVER))
    8179            $server = $this->MAILSERVER;
     
    254252
    255253        $line = fgets($fp,$buffer);
    256         while ( !ereg("^\.\r\n",$line))
     254        while ( !preg_match('/^\.\r\n/',$line))
    257255        {
    258256            $MsgArray[$count] = $line;
     
    321319            $line = fgets($fp,$this->BUFFER);
    322320            $line = $this->strip_clf($line);
    323             if(ereg("^\.",$line))
     321            if(strpos($line, '.') === 0)
    324322            {
    325323                $this->ERROR = "POP3 pop_list: " . _("Premature end of list");
     
    367365
    368366        $line = fgets($fp,$buffer);
    369         while ( !ereg("^\.\r\n",$line))
    370         {
    371             if ( $line[0] == '.' ) { $line = substr($line,1); }
     367        while ( !preg_match('/^\.\r\n/',$line))
     368        {
     369            if ( $line{0} == '.' ) { $line = substr($line,1); }
    372370            $MsgArray[$count] = $line;
    373371            $count++;
     
    555553            $count = 1;
    556554            $line = fgets($fp,$buffer);
    557             while ( !ereg("^\.\r\n",$line)) {
    558                 if(ereg("^\.\r\n",$line)) {
    559                     break;
    560                 }
     555            while ( !preg_match('/^\.\r\n/',$line)) {
    561556                list ($msg,$msgUidl) = preg_split('/\s+/',$line);
    562557                $msgUidl = $this->strip_clf($msgUidl);
     
    608603            return false;
    609604        else
    610             return( ereg ("^\+OK", $cmd ) );
     605            return( stripos($cmd, '+OK') !== false );
    611606    }
    612607
     
    617612            return $text;
    618613        else {
    619             $stripped = str_replace("\r",'',$text);
    620             $stripped = str_replace("\n",'',$stripped);
     614            $stripped = str_replace(array("\r","\n"),'',$text);
    621615            return $stripped;
    622616        }
     
    650644
    651645}   // End class
    652 ?>
     646
     647// For php4 compatibility
     648if (!function_exists("stripos")) {
     649    function stripos($haystack, $needle){
     650        return strpos($haystack, stristr( $haystack, $needle ));
     651    }
     652}
Note: See TracChangeset for help on using the changeset viewer.