Make WordPress Core

Ticket #26802: 26802.diff

File 26802.diff, 1.7 KB (added by dd32, 11 years ago)
  • class-wp-filesystem-ftpext.php

     
    291291                if ( is_null($is_windows) )
    292292                        $is_windows = stripos( ftp_systype($this->link), 'win') !== false;
    293293
    294                 if ( $is_windows && preg_match('/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/', $line, $lucifer) ) {
     294                if ( $is_windows && preg_match( '/([0-9]{2})-([0-9]{2})-([0-9]{2,4}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/', $line, $lucifer ) ) {
    295295                        $b = array();
    296296                        if ( $lucifer[3] < 70 )
    297297                                $lucifer[3] +=2000;
    298                         else
     298                        elseif ( $lucifer[3] < 1900 )
    299299                                $lucifer[3] += 1900; // 4digit year fix
    300300                        $b['isdir'] = ( $lucifer[7] == '<DIR>');
    301301                        if ( $b['isdir'] )
    302302                                $b['type'] = 'd';
    303303                        else
    304304                                $b['type'] = 'f';
    305                         $b['size'] = $lucifer[7];
     305                        $b['size'] = $b['isdir'] ? 0 : $lucifer[7];
    306306                        $b['month'] = $lucifer[1];
    307307                        $b['day'] = $lucifer[2];
    308308                        $b['year'] = $lucifer[3];
    309309                        $b['hour'] = $lucifer[4];
     310                        if ( strcasecmp( $lucifer[6], "PM" ) == 0 )
     311                                $b['hour'] += 12;
    310312                        $b['minute'] = $lucifer[5];
    311                         $b['time'] = @mktime($lucifer[4] + (strcasecmp($lucifer[6], "PM") == 0 ? 12 : 0), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3]);
    312                         $b['am/pm'] = $lucifer[6];
     313                        $b['time'] = @mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] );
    313314                        $b['name'] = $lucifer[8];
    314                 } elseif ( !$is_windows && $lucifer = preg_split('/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY)) {
    315                         //echo $line."\n";
     315                } elseif ( $lucifer = preg_split( '/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY ) ) {
    316316                        $lcount = count($lucifer);
    317317                        if ( $lcount < 8 )
    318318                                return '';