Make WordPress Core


Ignore:
Timestamp:
03/02/2008 08:17:30 PM (18 years ago)
Author:
ryan
Message:

Remove trailing whites.

File:
1 edited

Legend:

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

    r6919 r7130  
    2828  // ----- Constants
    2929  define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
    30  
     30
    3131  // ----- File list separator
    3232  // In version 1.x of PclZip, the separator for file list is a space
     
    127127  //define( 'PCLZIP_OPT_CRYPT', 77018 );
    128128  define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
    129  
     129
    130130  // ----- File description attributes
    131131  define( 'PCLZIP_ATT_FILE_NAME', 79001 );
     
    170170    var $error_code = 1;
    171171    var $error_string = '';
    172    
     172
    173173    // ----- Current status of the magic_quotes_runtime
    174174    // This value store the php configuration for magic_quotes
     
    316316    $v_filedescr_list = array();
    317317    $p_result_list = array();
    318    
     318
    319319    // ----- Look if the $p_filelist is really an array
    320320    if (is_array($p_filelist)) {
    321    
     321
    322322      // ----- Look if the first element is also an array
    323323      //       This will mean that this is a file description entry
     
    325325        $v_att_list = $p_filelist;
    326326      }
    327      
     327
    328328      // ----- The list is a list of string names
    329329      else {
     
    344344      return 0;
    345345    }
    346    
     346
    347347    // ----- Reformat the string list
    348348    if (sizeof($v_string_list) != 0) {
     
    356356      }
    357357    }
    358    
     358
    359359    // ----- For each file in the list check the attributes
    360360    $v_supported_attributes
     
    506506    $v_filedescr_list = array();
    507507    $p_result_list = array();
    508    
     508
    509509    // ----- Look if the $p_filelist is really an array
    510510    if (is_array($p_filelist)) {
    511    
     511
    512512      // ----- Look if the first element is also an array
    513513      //       This will mean that this is a file description entry
     
    515515        $v_att_list = $p_filelist;
    516516      }
    517      
     517
    518518      // ----- The list is a list of string names
    519519      else {
     
    534534      return 0;
    535535    }
    536    
     536
    537537    // ----- Reformat the string list
    538538    if (sizeof($v_string_list) != 0) {
     
    541541      }
    542542    }
    543    
     543
    544544    // ----- For each file in the list check the attributes
    545545    $v_supported_attributes
     
    991991  //   PCLZIP_OPT_BY_INDEX :
    992992  //   PCLZIP_OPT_BY_NAME :
    993   //   PCLZIP_OPT_BY_EREG : 
     993  //   PCLZIP_OPT_BY_EREG :
    994994  //   PCLZIP_OPT_BY_PREG :
    995995  // Return Values :
     
    10661066  {
    10671067    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
    1068    
     1068
    10691069    $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
    10701070
     
    11201120      {
    11211121        $this->privSwapBackMagicQuotes();
    1122        
     1122
    11231123        // ----- Error log
    11241124        PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
     
    14491449    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
    14501450    $v_result=1;
    1451    
     1451
    14521452    // ----- Read the options
    14531453    $i=0;
     
    16461646            return PclZip::errorCode();
    16471647          }
    1648          
     1648
    16491649          // ----- Reduce the index list
    16501650          // each index item in the list must be a couple with a start and
     
    16571657              $v_item_list = explode("-", $v_work_list[$j]);
    16581658              $v_size_item_list = sizeof($v_item_list);
    1659              
     1659
    16601660              // ----- TBC : Here we might check that each item is a
    16611661              // real integer ...
    1662              
     1662
    16631663              // ----- Look for single value
    16641664              if ($v_size_item_list == 1) {
     
    16981698              $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
    16991699          }
    1700          
     1700
    17011701          // ----- Sort the items
    17021702          if ($v_sort_flag) {
     
    18301830    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
    18311831    $v_result=1;
    1832    
     1832
    18331833    // ----- For each file in the list check the attributes
    18341834    foreach ($p_file_list as $v_key => $v_value) {
    1835    
     1835
    18361836      // ----- Check if the option is supported
    18371837      if (!isset($v_requested_options[$v_key])) {
     
    18551855          $p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
    18561856          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
    1857          
     1857
    18581858          if ($p_filedescr['filename'] == '') {
    18591859            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
     
    19231923        }
    19241924      }
    1925    
     1925
    19261926    // end foreach
    19271927    }
    1928    
     1928
    19291929    // ----- Return
    19301930    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     
    19451945    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
    19461946    $v_result=1;
    1947    
     1947
    19481948    // ----- Create a result list
    19491949    $v_result_list = array();
    1950    
     1950
    19511951    // ----- Look each entry
    19521952    for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
    19531953      // ----- Get filedescr
    19541954      $v_descr = $p_filedescr_list[$i];
    1955      
     1955
    19561956      // ----- Reduce the filename
    19571957      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
     
    19591959      $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
    19601960      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
    1961      
     1961
    19621962      // ----- Get type of descr
    19631963      if (!file_exists($v_descr['filename'])) {
     
    19881988        continue;
    19891989      }
    1990      
     1990
    19911991      // ----- Calculate the stored filename
    19921992      $this->privCalculateStoredFilename($v_descr, $p_options);
    1993      
     1993
    19941994      // ----- Add the descriptor in result list
    19951995      $v_result_list[sizeof($v_result_list)] = $v_descr;
    1996      
     1996
    19971997      // ----- Look for folder
    19981998      if ($v_descr['type'] == 'folder') {
     
    20082008                continue;
    20092009            }
    2010            
     2010
    20112011            // ----- Compose the full filename
    20122012            $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
    2013            
     2013
    20142014            // ----- Look for different stored filename
    20152015            // Because the name of the folder was changed, the name of the
     
    20182018              $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
    20192019            }
    2020      
     2020
    20212021            $v_dirlist_nb++;
    20222022          }
     
    20262026          // TBC : unable to open folder in read mode
    20272027        }
    2028        
     2028
    20292029        // ----- Expand each element of the list
    20302030        if ($v_dirlist_nb != 0) {
     
    20342034            return $v_result;
    20352035          }
    2036          
     2036
    20372037          // ----- Concat the resulting list
    20382038          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
     
    20432043          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
    20442044        }
    2045          
     2045
    20462046        // ----- Free local array
    20472047        unset($v_dirlist_descr);
    20482048      }
    20492049    }
    2050    
     2050
    20512051    // ----- Get the result list
    20522052    $p_filedescr_list = $v_result_list;
     
    20692069    $v_result=1;
    20702070    $v_list_detail = array();
    2071    
     2071
    20722072    // ----- Magic quotes trick
    20732073    $this->privDisableMagicQuotes();
     
    24302430  // Description :
    24312431  // Parameters :
    2432   //   $p_filedescr_list : An array containing the file description 
     2432  //   $p_filedescr_list : An array containing the file description
    24332433  //                      or directory names to add in the zip
    24342434  //   $p_result_list : list of added files with their properties (specially the status field)
     
    24502450      $p_filedescr_list[$j]['filename']
    24512451      = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
    2452      
     2452
    24532453      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
    24542454
     
    25042504    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
    25052505    $v_result=1;
    2506    
     2506
    25072507    // ----- Working variable
    25082508    $p_filename = $p_filedescr['filename'];
     
    25172517      return PclZip::errorCode();
    25182518    }
    2519  
    2520     // ----- Look for a stored different filename 
     2519
     2520    // ----- Look for a stored different filename
    25212521    if (isset($p_filedescr['stored_filename'])) {
    25222522      $v_stored_filename = $p_filedescr['stored_filename'];
     
    25842584      $p_header['status'] = "filtered";
    25852585    }
    2586    
     2586
    25872587    // ----- Check the path length
    25882588    if (strlen($p_header['stored_filename']) > 0xFF) {
     
    26312631          $p_header['compression'] = 8;
    26322632        }
    2633        
     2633
    26342634        // ----- Look for encryption
    26352635        /*
     
    26372637            && ($p_options[PCLZIP_OPT_CRYPT] != "")) {
    26382638          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File need to be crypted ....");
    2639          
     2639
    26402640          // Should be a random header
    26412641          $v_header = 'xxxxxxxxxxxx';
     
    26452645                                                   $p_header['crc'],
    26462646                                                   "test");
    2647                                                    
     2647
    26482648          $p_header['compressed_size'] += 12;
    26492649          $p_header['flag'] = 1;
    2650          
     2650
    26512651          // ----- Add the header to the data
    26522652          $v_content_compressed = $v_header.$v_content_compressed;
     
    26632663
    26642664        // ----- Write the compressed (or not) content
    2665         @fwrite($this->zip_fd, 
     2665        @fwrite($this->zip_fd,
    26662666                    $v_content_compressed, $p_header['compressed_size']);
    2667        
     2667
    26682668        // ----- Close the file
    26692669        @fclose($v_file);
     
    27312731    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
    27322732    $v_result=1;
    2733    
     2733
    27342734    // ----- Working variables
    27352735    $p_filename = $p_filedescr['filename'];
     
    27582758      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
    27592759    }
    2760    
     2760
    27612761    // ----- Look for path and/or short name change
    27622762    else {
     
    27892789        if (   (substr($p_filename, 0, 2) == "./")
    27902790            || (substr($p_remove_dir, 0, 2) == "./")) {
    2791            
     2791
    27922792          if (   (substr($p_filename, 0, 2) == "./")
    27932793              && (substr($p_remove_dir, 0, 2) != "./")) {
     
    28292829    $p_filedescr['stored_filename'] = $v_stored_filename;
    28302830    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));
    2831    
     2831
    28322832    // ----- Return
    28332833    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     
    29922992      // ----- Magic quotes trick
    29932993      $this->privSwapBackMagicQuotes();
    2994      
     2994
    29952995      // ----- Error log
    29962996      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
     
    32713271               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
    32723272          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
    3273          
     3273
    32743274          // ----- Look if the index is in the list
    32753275          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
     
    33113311
    33123312              $this->privSwapBackMagicQuotes();
    3313              
     3313
    33143314              PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
    33153315                                   "Filename '".$v_header['stored_filename']."' is "
     
    33213321          }
    33223322      }
    3323      
     3323
    33243324      // ----- Check encrypted files
    33253325      if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
     
    33583358          $v_extract = false;
    33593359      }
    3360      
     3360
    33613361      // ----- Look for real extraction
    33623362      if ($v_extract)
     
    34123412          // ----- Next extracted file
    34133413          $v_nb_extracted++;
    3414          
     3414
    34153415          // ----- Look for user callback abort
    34163416          if ($v_result1 == 2) {
     
    35643564      $p_entry['filename'] = $p_path."/".$p_entry['filename'];
    35653565    }
    3566    
     3566
    35673567    // ----- Check a base_dir_restriction
    35683568    if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
     
    35703570      $v_inclusion
    35713571      = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
    3572                                 $p_entry['filename']); 
     3572                                $p_entry['filename']);
    35733573      if ($v_inclusion == 0) {
    35743574        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");
     
    36003600        $v_result = 1;
    36013601      }
    3602      
     3602
    36033603      // ----- Look for abort result
    36043604      if ($v_result == 2) {
     
    36323632        // ----- Change the file status
    36333633        $p_entry['status'] = "already_a_directory";
    3634        
     3634
    36353635        // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
    36363636        // For historical reason first PclZip implementation does not stop
     
    37653765            @fwrite($v_dest_file, $v_binary_data, $v_read_size);
    37663766            */
    3767             @fwrite($v_dest_file, $v_buffer, $v_read_size);           
     3767            @fwrite($v_dest_file, $v_buffer, $v_read_size);
    37683768            $v_size -= $v_read_size;
    37693769          }
     
    37743774          // ----- Change the file mtime
    37753775          touch($p_entry['filename'], $p_entry['mtime']);
    3776          
     3776
    37773777
    37783778        }
     
    37873787              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read 12 encryption header bytes");
    37883788              $v_encryption_header = @fread($this->zip_fd, 12);
    3789              
     3789
    37903790              // ----- Read the encrypted & compressed file in a buffer
    37913791              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".($p_entry['compressed_size']-12)."' compressed & encrypted bytes");
    37923792              $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']-12);
    3793              
     3793
    37943794              // ----- Decrypt the buffer
    37953795              $this->privDecrypt($v_encryption_header, $v_buffer,
     
    38033803              $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
    38043804          }
    3805          
     3805
    38063806          // ----- Decompress the file
    38073807          $v_file_content = @gzinflate($v_buffer);
     
    38133813            // TBC
    38143814            $p_entry['status'] = "error";
    3815            
     3815
    38163816            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
    38173817            return $v_result;
    38183818          }
    3819          
     3819
    38203820          // ----- Opening destination file
    38213821          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
     
    38563856      $p_entry['status'] = "skipped";
    38573857    }
    3858    
     3858
    38593859    // ----- Look for post-extract callback
    38603860    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
     
    39653965          // ----- Read the compressed file in a buffer (one shot)
    39663966          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
    3967          
     3967
    39683968          // ----- Decompress the file
    39693969          $v_file_content = gzinflate($v_buffer);
     
    40544054        // ----- Reading the file
    40554055        $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
    4056        
     4056
    40574057        // ----- Decompress the file
    40584058        if (($p_string = @gzinflate($v_data)) === FALSE) {
     
    48044804                return $v_result;
    48054805            }
    4806            
     4806
    48074807            // ----- Check that local file header is same as central file header
    48084808            if ($this->privCheckFileHeaders($v_local_header,
     
    48974897        //@rename($v_zip_temp_name, $this->zipname);
    48984898        PclZipUtilRename($v_zip_temp_name, $this->zipname);
    4899    
     4899
    49004900        // ----- Destroy the temporary archive
    49014901        unset($v_temp_zip);
    49024902    }
    4903    
     4903
    49044904    // ----- Remove every files : reset the file
    49054905    else if ($v_central_dir['entries'] != 0) {
     
    53165316    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDecrypt', "size=".$p_size."");
    53175317    $v_result=1;
    5318    
     5318
    53195319    // ----- To Be Modified ;-)
    53205320    $v_pwd = "test";
    5321    
     5321
    53225322    $p_buffer = PclZipUtilZipDecrypt($p_buffer, $p_size, $p_encryption_header,
    53235323                                     $p_crc, $v_pwd);
    5324    
     5324
    53255325    // ----- Return
    53265326    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     
    54725472        }
    54735473      }
    5474      
     5474
    54755475      // ----- Look for skip
    54765476      if ($v_skip > 0) {
     
    55075507    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
    55085508    $v_result = 1;
    5509    
     5509
    55105510    // ----- Look for path beginning by ./
    55115511    if (   ($p_dir == '.')
     
    56985698  {
    56995699    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
    5700    
     5700
    57015701    $v_list = get_defined_constants();
    57025702    for (reset($v_list); $v_key = key($v_list); next($v_list)) {
     
    57105710        }
    57115711    }
    5712    
     5712
    57135713    $v_result = 'Unknown';
    57145714
Note: See TracChangeset for help on using the changeset viewer.