Changeset 33 for trunk

Show
Ignore:
Timestamp:
21.07.2005 12:58:13 (3 years ago)
Author:
m
Message:

Whitespace operations

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/File/Bittorrent/MakeTorrent.php

    r27 r33  
    3333 * @category File 
    3434 */ 
    35   
     35 
    3636/** 
    3737 * Include required classes 
     
    4848 * @author Justin Jones <j.nagash@gmail.com> 
    4949 * @author Markus Tacker <m@tacker.org> 
    50  * @version $Id$ 
    5150 * @package File_Bittorrent 
    5251 * @category File 
     
    9493     */ 
    9594    var $_created_by = 'File_Bittorrent_MakeTorrent $Rev$. http://pear.php.net/package/File_Bittorrent'; 
    96      
     95 
    9796    /** 
    9897     * @var string The .torrent suggested name (file/dir) 
     
    124123     */ 
    125124    var $_data_gap = false; 
    126      
     125 
    127126    /** 
    128127    * @var resource file pointer 
     
    167166    { 
    168167        if (!is_array($announce_list)) { 
    169             PEAR::raiseError(__CLASS__ . '::'. __FUNCTION__ . '() - No array given.'); 
    170             return false; 
     168            PEAR::raiseError(__CLASS__ . '::'. __FUNCTION__ . '() - No array given.'); 
     169            return false; 
    171170        } 
    172171        $this->_announce_list = $announce_list; 
     
    221220    { 
    222221        if ($piece_length < 32 or $piece_length > 4096) { 
    223             PEAR::raiseError(__CLASS__ . '::'. __FUNCTION__ . '() - Invalid piece lenth: "' . $piece_length . '"'); 
    224             return false; 
     222            PEAR::raiseError(__CLASS__ . '::'. __FUNCTION__ . '() - Invalid piece lenth: "' . $piece_length . '"'); 
     223            return false; 
    225224        } 
    226225        $this->_piece_length = $piece_length * 1024; 
     
    239238        if ($this->_is_file) { 
    240239            if (!$info = $this->_addFile($this->_path)) { 
    241                 return false; 
     240                return false; 
    242241            } 
    243242            if (!$metainfo = $this->_encodeTorrent($info)) { 
    244                 return false; 
    245             }             
     243                return false; 
     244            } 
    246245        } else if ($this->_is_dir) { 
    247246            if (!$diradd_ok = $this->_addDir($this->_path)) { 
    248                 return false; 
     247                return false; 
    249248            } 
    250249            $metainfo = $this->_encodeTorrent(); 
     
    275274            $bencdata['info']['files'] = $this->_files; 
    276275        } else { 
    277             PEAR::raiseError(__CLASS__ . '::'. __FUNCTION__ . '() - Use ' .  __CLASS__ . '::setPath() to define a file or directory.'); 
     276            PEAR::raiseError(__CLASS__ . '::'. __FUNCTION__ . '() - Use ' .  __CLASS__ . '::setPath() to define a file or directory.'); 
    278277            return false; 
    279278        } 
     
    297296     * @param string path to the file 
    298297     * @return mixed false on failure or file metainfo data 
    299     * @access private 
    300     */ 
     298    * @access private 
     299    */ 
    301300    function _addFile($file) 
    302301    { 
    303         if (!$this->_openFile($file)) return false; 
    304          
     302        if (!$this->_openFile($file)) return false; 
     303 
    305304        $filelength = 0; 
    306305        $md5sum = md5_file($file); 
     
    406405            if ($dh = opendir($current_dir)) { 
    407406                while ( ($file = readdir($dh)) !== false ) { 
    408                     if ($file{0} =='.') continue; 
     407                    if ($file{0} =='.') continue; 
    409408                    $current_file = $current_dir . '/' . $file; 
    410409                    if (is_file($current_file)) { 
     
    428427     */ 
    429428    function _filesize($file) 
    430     { 
     429    { 
    431430        $size = @filesize($file); 
    432431        if ($size == 0) { 
    433             if (PHP_OS != 'Linux') return false;  
     432            if (PHP_OS != 'Linux') return false; 
    434433            $size = exec('du -b ' . escapeshellarg($file)); 
    435434        } 
     
    446445     */ 
    447446    function _openFile($file) 
    448     { 
     447    { 
    449448        $fsize = $this->_filesize($file); 
    450449        if ($fsize <= 2*1024*1024*1024) { 
    451             if (!$this->_fp = fopen($file, 'r')) { 
    452                 PEAR::raiseError(__CLASS__ . '::'. __FUNCTION__ . '() - Failed to open "' . $file . '"'); 
    453                 return false; 
    454             } 
     450            if (!$this->_fp = fopen($file, 'r')) { 
     451                PEAR::raiseError(__CLASS__ . '::'. __FUNCTION__ . '() - Failed to open "' . $file . '"'); 
     452                return false; 
     453            } 
    455454            $this->_fopen = true; 
    456455        } else { 
    457             if (PHP_OS != 'Linux') { 
    458                 PEAR::raiseError(__CLASS__ . '::'. __FUNCTION__ . '() - File size is greater than 2GB. This is only supported under Linux.'); 
    459                 return false; 
    460             } 
     456            if (PHP_OS != 'Linux') { 
     457                PEAR::raiseError(__CLASS__ . '::'. __FUNCTION__ . '() - File size is greater than 2GB. This is only supported under Linux.'); 
     458                return false; 
     459            } 
    461460            $this->_fp = popen('cat ' . escapeshellarg($file), 'r'); 
    462461            $this->_fopen = false; 
     
    472471    function _closeFile() 
    473472    { 
    474         if ($this->_fopen) { 
    475             fclose($this->_fp); 
    476         } else { 
     473        if ($this->_fopen) { 
     474            fclose($this->_fp); 
     475        } else { 
    477476            pclose($this->_fp); 
    478477        }