Make WordPress Core

Ticket #3864: 3864.diff

File 3864.diff, 6.1 KB (added by Nazgul, 18 years ago)
  • wp-includes/class-pop3.php

     
    33   /**
    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
    99    * Modified by Philippe Mingo 2001 mingo@rotedic.com
     
    4040    var $BANNER     = '';       //  Holds the banner returned by the
    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
    4845                                //  manually
     
    5956        if(!empty($timeout)) {
    6057            settype($timeout,"integer");
    6158            $this->TIMEOUT = $timeout;
     59            if (!ini_get('safe_mode'))
    6260            set_time_limit($timeout);
    6361        }
    6462        return true;
    6563    }
    6664
    6765    function update_timer () {
     66        if (!ini_get('safe_mode'))
    6867        set_time_limit($this->TIMEOUT);
    6968        return true;
    7069    }
     
    7574
    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;
    8080
     
    8484            return false;
    8585        }
    8686
    87         $fp = fsockopen("$server", $port, $errno, $errstr);
     87        $fp = @fsockopen("$server", $port, $errno, $errstr);
    8888
    8989        if(!$fp) {
    9090            $this->ERROR = _("POP3 connect:") . ' ' . _("Error ") . "[$errno] [$errstr]";
     
    105105        }
    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;
     108        return true;
    115109    }
    116110
    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 
    129111    function user ($user = "") {
    130112        // Sends the USER command, returns true or false
    131113
     
    158140        } else {
    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;
    164146            } else {
    165147                //  Auth successful.
    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        }
    177153    }
     
    214190                    //  Auth successful.
    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            }
    226196        }
     
    330300                $this->ERROR = _("POP3 pop_list:") . ' ' . _("Error ") . "[$reply]";
    331301                return false;
    332302            }
    333             list($junk,$num,$size) = explode(" ",$reply);
     303            list($junk,$num,$size) = preg_split('/\s+/',$reply);
    334304            return $size;
    335305        }
    336306        $cmd = "LIST";
     
    353323                $this->ERROR = _("POP3 pop_list:") . ' ' . _("Premature end of list");
    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)
    359329            {
     
    423393            return $last;
    424394        }
    425395
    426         $Vars = explode(" ",$reply);
     396        $Vars = preg_split('/\s+/',$reply);
    427397        $count = $Vars[1];
    428398        $size = $Vars[2];
    429399        settype($count,"integer");
     
    554524                $this->ERROR = _("POP3 uidl:") . ' ' . _("Error ") . "[$reply]";
    555525                return false;
    556526            }
    557             list ($ok,$num,$myUidl) = explode(" ",$reply);
     527            list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply);
    558528            return $myUidl;
    559529        } else {
    560530            $this->update_timer();
     
    585555                if(ereg("^\.\r\n",$line)) {
    586556                    break;
    587557                }
    588                 list ($msg,$msgUidl) = explode(" ",$line);
     558                list ($msg,$msgUidl) = preg_split('/\s+/',$line);
    589559                $msgUidl = $this->strip_clf($msgUidl);
    590560                if($count == $msg) {
    591561                    $UIDLArray[$msg] = $msgUidl;
     
    656626        for($count =0; $count < $length; $count++)
    657627        {
    658628            $digit = substr($server_text, $count, 1);
    659             if ( false !== $digit ) {
     629            if (!empty($digit)) {
    660630                if( (!$outside) && ($digit != '<') && ($digit != '>') )
    661631                {
    662632                    $banner .= $digit;