You are here

function PclZip::privCheckFileHeaders in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/lib/pclzip/pclzip.lib.php \PclZip::privCheckFileHeaders()
4 calls to PclZip::privCheckFileHeaders()
PclZip::privDeleteByRule in includes/moodle/lib/pclzip/pclzip.lib.php
PclZip::privExtractFile in includes/moodle/lib/pclzip/pclzip.lib.php
PclZip::privExtractFileAsString in includes/moodle/lib/pclzip/pclzip.lib.php
PclZip::privExtractFileInOutput in includes/moodle/lib/pclzip/pclzip.lib.php

File

includes/moodle/lib/pclzip/pclzip.lib.php, line 4342

Class

PclZip

Code

function privCheckFileHeaders(&$p_local_header, &$p_central_header) {

  //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFileHeaders", "");
  $v_result = 1;

  // ----- Check the static values
  // TBC
  if ($p_local_header['filename'] != $p_central_header['filename']) {

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');
  }
  if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');
  }
  if ($p_local_header['flag'] != $p_central_header['flag']) {

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');
  }
  if ($p_local_header['compression'] != $p_central_header['compression']) {

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');
  }
  if ($p_local_header['mtime'] != $p_central_header['mtime']) {

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');
  }
  if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
  }

  // ----- Look for flag bit 3
  if (($p_local_header['flag'] & 8) == 8) {

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');
    $p_local_header['size'] = $p_central_header['size'];

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_local_header['size'].'\'');
    $p_local_header['compressed_size'] = $p_central_header['compressed_size'];

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_local_header['compressed_size'].'\'');
    $p_local_header['crc'] = $p_central_header['crc'];

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_local_header['crc']).'\'');
  }

  // ----- Return

  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
  return $v_result;
}