You are here

function PclZip::properties 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::properties()

File

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

Class

PclZip

Code

function properties() {

  // ----- Reset the error handler
  $this
    ->privErrorReset();

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

  // ----- Check archive
  if (!$this
    ->privCheckFormat()) {
    $this
      ->privSwapBackMagicQuotes();
    return 0;
  }

  // ----- Default properties
  $v_prop = array();
  $v_prop['comment'] = '';
  $v_prop['nb'] = 0;
  $v_prop['status'] = 'not_exist';

  // ----- Look if file exists
  if (@is_file($this->zipname)) {

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

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

      // ----- Return
      return 0;
    }

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

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

    // ----- Set the user attributes
    $v_prop['comment'] = $v_central_dir['comment'];
    $v_prop['nb'] = $v_central_dir['entries'];
    $v_prop['status'] = 'ok';
  }

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

  // ----- Return
  return $v_prop;
}