Make WordPress Core

Changeset 4945


Ignore:
Timestamp:
02/25/2007 06:19:21 PM (18 years ago)
Author:
ryan
Message:

Upgrade class-pop3. Props Nazgul. fixes #3864

File:
1 edited

Legend:

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

    r4938 r4945  
    44    * mail_fetch/setup.php
    55    *
    6     * Copyright (c) 1999-2002 The SquirrelMail Project Team
     6    * Copyright (c) 1999-2006 The SquirrelMail Project Team
    77    *
    88    * Copyright (c) 1999 CDI (cdi@thewebmasters.net) All Rights Reserved
     
    4141                                //  pop server - used for apop()
    4242
    43     var $RFC1939    = TRUE;     //  Set by noop(). See rfc1939.txt
    44                                 //
    45 
    4643    var $ALLOWAPOP  = FALSE;    //  Allow or disallow apop()
    4744                                //  This must be set to true
     
    6057            settype($timeout,"integer");
    6158            $this->TIMEOUT = $timeout;
     59            if (!ini_get('safe_mode'))
    6260            set_time_limit($timeout);
    6361        }
     
    6664
    6765    function update_timer () {
     66        if (!ini_get('safe_mode'))
    6867        set_time_limit($this->TIMEOUT);
    6968        return true;
     
    7675        // If MAILSERVER is set, override $server with it's value
    7776
     77        if (!isset($port) || !$port) {$port = 110;}
    7878        if(!empty($this->MAILSERVER))
    7979            $server = $this->MAILSERVER;
     
    8585        }
    8686
    87         $fp = fsockopen("$server", $port, $errno, $errstr);
     87        $fp = @fsockopen("$server", $port, $errno, $errstr);
    8888
    8989        if(!$fp) {
     
    106106        $this->FP = $fp;
    107107        $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;
    115     }
    116 
    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         }
     108        return true;
    127109    }
    128110
     
    159141            $reply = $this->send_cmd("PASS $pass");
    160142            if(!$this->is_ok($reply)) {
    161                 $this->ERROR = _("POP3 pass:") . ' ' . _("authentication failed ") . "[$reply]";
     143                $this->ERROR = _("POP3 pass:") . ' ' . _("Authentication failed ") . "[$reply]";
    162144                $this->quit();
    163145                return false;
     
    166148                $count = $this->last("count");
    167149                $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;
    175151            }
    176152        }
     
    215191                    $count = $this->last("count");
    216192                    $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;
    224194                }
    225195            }
     
    331301                return false;
    332302            }
    333             list($junk,$num,$size) = explode(" ",$reply);
     303            list($junk,$num,$size) = preg_split('/\s+/',$reply);
    334304            return $size;
    335305        }
     
    354324                return false;
    355325            }
    356             list($thisMsg,$msgSize) = explode(" ",$line);
     326            list($thisMsg,$msgSize) = preg_split('/\s+/',$line);
    357327            settype($thisMsg,"integer");
    358328            if($thisMsg != $msgC)
     
    429399        }
    430400
    431         $Vars = explode(" ",$reply);
     401        $Vars = preg_split('/\s+/',$reply);
    432402        $count = $Vars[1];
    433403        $size = $Vars[2];
     
    560530                return false;
    561531            }
    562             list ($ok,$num,$myUidl) = explode(" ",$reply);
     532            list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply);
    563533            return $myUidl;
    564534        } else {
     
    591561                    break;
    592562                }
    593                 list ($msg,$msgUidl) = explode(" ",$line);
     563                list ($msg,$msgUidl) = preg_split('/\s+/',$line);
    594564                $msgUidl = $this->strip_clf($msgUidl);
    595565                if($count == $msg) {
     
    662632        {
    663633            $digit = substr($server_text, $count, 1);
    664             if ( false !== $digit ) {
     634            if (!empty($digit)) {
    665635                if( (!$outside) && ($digit != '<') && ($digit != '>') )
    666636                {
Note: See TracChangeset for help on using the changeset viewer.