當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PclZip::privWriteFileHeader方法代碼示例

本文整理匯總了PHP中PclZip::privWriteFileHeader方法的典型用法代碼示例。如果您正苦於以下問題:PHP PclZip::privWriteFileHeader方法的具體用法?PHP PclZip::privWriteFileHeader怎麽用?PHP PclZip::privWriteFileHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PclZip的用法示例。


在下文中一共展示了PclZip::privWriteFileHeader方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: privDeleteByRule


//.........這裏部分代碼省略.........
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset='". $v_header_list[$i]['offset']."'");
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
             @rewind($this->zip_fd);
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
             if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Error log
                 PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
                 // ----- Return
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
                 return PclZip::errorCode();
             }
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
             // ----- Read the file header
             $v_local_header = array();
             if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                 return $v_result;
             }
             // ----- Check that local file header is same as central file header
             if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) {
                 // TBC
             }
             unset($v_local_header);
             // ----- Write the file header
             if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                 return $v_result;
             }
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v_header_list[$i]['offset']."'");
             // ----- Read/write the data block
             if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                 return $v_result;
             }
         }
         // ----- Store the offset of the central dir
         $v_offset = @ftell($v_temp_zip->zip_fd);
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v_offset");
         // ----- Re-Create the Central Dir files header
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory");
         for ($i = 0; $i < sizeof($v_header_list); $i++) {
             // ----- Create the file header
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v_header_list[$i]['offset']);
             if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
                 $v_temp_zip->privCloseFd();
                 $this->privCloseFd();
                 @unlink($v_zip_temp_name);
開發者ID:kondrat-shmoylov,項目名稱:Pagetest,代碼行數:67,代碼來源:pclzip.lib.php

示例2: privDeleteByRule


//.........這裏部分代碼省略.........
             // ----- Return
             return $v_result;
         }
         // ----- Look which file need to be kept
         for ($i = 0; $i < sizeof($v_header_list); $i++) {
             // ----- Calculate the position of the header
             @rewind($this->zip_fd);
             if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Error log
                 PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
                 // ----- Return
                 return PclZip::errorCode();
             }
             // ----- Read the file header
             $v_local_header = array();
             if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 return $v_result;
             }
             // ----- Check that local file header is same as central file header
             if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) {
                 // TBC
             }
             unset($v_local_header);
             // ----- Write the file header
             if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 return $v_result;
             }
             // ----- Read/write the data block
             if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
                 // ----- Close the zip file
                 $this->privCloseFd();
                 $v_temp_zip->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 return $v_result;
             }
         }
         // ----- Store the offset of the central dir
         $v_offset = @ftell($v_temp_zip->zip_fd);
         // ----- Re-Create the Central Dir files header
         for ($i = 0; $i < sizeof($v_header_list); $i++) {
             // ----- Create the file header
             if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
                 $v_temp_zip->privCloseFd();
                 $this->privCloseFd();
                 @unlink($v_zip_temp_name);
                 // ----- Return
                 return $v_result;
             }
             // ----- Transform the header to a 'usable' info
             $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
         }
開發者ID:belerweb,項目名稱:pigcms,代碼行數:67,代碼來源:Update.class.php

示例3: privDeleteByIndex


//.........這裏部分代碼省略.........
         return $v_result;
     }
     // ----- Look which file need to be kept
     for ($i = 0; $i < sizeof($v_header_list); $i++) {
         PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry : {$i}'");
         // ----- Calculate the position of the header
         PclTraceFctMessage(__FILE__, __LINE__, 2, "Offset='" . $v_header_list[$i]['offset'] . "'");
         PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : " . ftell($this->zip_fd) . "'");
         @rewind($this->zip_fd);
         PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : " . ftell($this->zip_fd) . "'");
         if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
             // ----- Close the zip file
             $this->privCloseFd();
             $v_temp_zip->privCloseFd();
             @unlink($v_zip_temp_name);
             // ----- Error log
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
             // ----- Return
             PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
             return PclZip::errorCode();
         }
         PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : " . ftell($this->zip_fd) . "'");
         // ----- Read the file header
         if (($v_result = $this->privReadFileHeader($v_header_list[$i])) != 1) {
             // ----- Close the zip file
             $this->privCloseFd();
             $v_temp_zip->privCloseFd();
             @unlink($v_zip_temp_name);
             // ----- Return
             PclTraceFctEnd(__FILE__, __LINE__, $v_result);
             return $v_result;
         }
         // ----- Write the file header
         if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
             // ----- Close the zip file
             $this->privCloseFd();
             $v_temp_zip->privCloseFd();
             @unlink($v_zip_temp_name);
             // ----- Return
             PclTraceFctEnd(__FILE__, __LINE__, $v_result);
             return $v_result;
         }
         PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset for this file is '" . $v_header_list[$i]['offset'] . "'");
         // ----- Read/write the data block
         if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
             // ----- Close the zip file
             $this->privCloseFd();
             $v_temp_zip->privCloseFd();
             @unlink($v_zip_temp_name);
             // ----- Return
             PclTraceFctEnd(__FILE__, __LINE__, $v_result);
             return $v_result;
         }
     }
     // ----- Store the offset of the central dir
     $v_offset = @ftell($v_temp_zip->zip_fd);
     PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : {$v_offset}");
     // ----- Re-Create the Central Dir files header
     for ($i = 0; $i < sizeof($v_header_list); $i++) {
         // ----- Create the file header
         PclTraceFctMessage(__FILE__, __LINE__, 4, "Offset of file : " . $v_header_list[$i]['offset']);
         if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
             $v_temp_zip->privCloseFd();
             $this->privCloseFd();
             @unlink($v_zip_temp_name);
             // ----- Return
開發者ID:BackupTheBerlios,項目名稱:phreakpic,代碼行數:67,代碼來源:pclzip-trace.lib.php


注:本文中的PclZip::privWriteFileHeader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。