You are here

function PclZip::privList in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php \PclZip::privList()
1 call to PclZip::privList()
PclZip::listContent in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php, line 3149

Class

PclZip

Code

function privList(&$p_list) {
  $v_result = 1;

  // ----- Magic quotes trick
  $this
    ->privDisableMagicQuotes();

  // ----- Open the zip file
  if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) {

    // ----- Magic quotes trick
    $this
      ->privSwapBackMagicQuotes();

    // ----- Error log
    PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in binary read mode');

    // ----- Return
    return PclZip::errorCode();
  }

  // ----- Read the central directory informations
  $v_central_dir = array();
  if (($v_result = $this
    ->privReadEndCentralDir($v_central_dir)) != 1) {
    $this
      ->privSwapBackMagicQuotes();
    return $v_result;
  }

  // ----- Go to beginning of Central Dir
  @rewind($this->zip_fd);
  if (@fseek($this->zip_fd, $v_central_dir['offset'])) {
    $this
      ->privSwapBackMagicQuotes();

    // ----- Error log
    PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');

    // ----- Return
    return PclZip::errorCode();
  }

  // ----- Read each entry
  for ($i = 0; $i < $v_central_dir['entries']; $i++) {

    // ----- Read the file header
    if (($v_result = $this
      ->privReadCentralFileHeader($v_header)) != 1) {
      $this
        ->privSwapBackMagicQuotes();
      return $v_result;
    }
    $v_header['index'] = $i;

    // ----- Get the only interesting attributes
    $this
      ->privConvertHeader2FileInfo($v_header, $p_list[$i]);
    unset($v_header);
  }

  // ----- Close the zip file
  $this
    ->privCloseFd();

  // ----- Magic quotes trick
  $this
    ->privSwapBackMagicQuotes();

  // ----- Return
  return $v_result;
}