WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/06/2008 06:06:13 AM (14 years ago)
Author:
ryan
Message:

wpfs fixes from DD32. see #5586

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-filesystem-ftpsockets.php

    r7155 r7164  
    8888
    8989    function find_base_dir($base = '.',$echo = false) {
     90        $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
     91        if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
     92            if( preg_match("|.{1}\:(.+)|i", $abspath, $mat) )
     93                $abspath = $mat[1];
     94        }
     95   
    9096        if( empty( $base ) || '.' == $base ) $base = $this->cwd();
    9197        if( empty( $base ) ) $base = '/';
     
    9399
    94100        if($echo) echo __('Changing to ') . $base  .'<br>';
    95         if( false === $this->ftp->chdir($base) )
     101        if( false === $this->chdir($base) )
    96102            return false;
    97103
     
    102108        }
    103109
    104         if( strpos(ABSPATH, $base) > 0)
    105             $arrPath = split('/',substr(ABSPATH,strpos(ABSPATH, $base)));
     110        if( strpos($abspath, $base) > 0)
     111            $arrPath = split('/',substr($abspath,strpos($abspath, $base)));
    106112        else
    107             $arrPath = split('/',ABSPATH);
     113            $arrPath = split('/',$abspath);
    108114
    109115        for($i = 0; $i <= count($arrPath); $i++)
     
    130136
    131137    function get_contents($file,$type='',$resumepos=0){
     138        if( ! $this->exists($file) )
     139            return false;
     140
    132141        if( empty($type) ){
    133142            $extension = substr(strrchr($filename, "."), 1);
     
    138147        if ( ! $this->ftp->fget($temp, $file) ) {
    139148            fclose($temp);
    140             return false;
     149            return ''; //Blank document, File does exist, Its just blank.
    141150        }
    142151        fseek($temp, 0); //Skip back to the start of the file being written to
     
    288297
    289298        $content = $this->get_contents($source);
    290         if ( !$content )
     299        if ( false === $content )
    291300            return false;
    292301
Note: See TracChangeset for help on using the changeset viewer.