7
7
* This TBS plug-in can open a zip file, read the central directory,
8
8
* and retrieve the content of a zipped file which is not compressed.
9
9
*
10
- * @version 1.11.0
11
- * @date 2023-05-15
10
+ * @version 1.11.1
11
+ * @date 2023-09-17
12
12
* @see http://www.tinybutstrong.com/plugins.php
13
13
* @author Skrol29 http://www.tinybutstrong.com/onlyyou.html
14
14
* @license LGPL-3.0
@@ -145,7 +145,7 @@ function OnInstall() {
145
145
if (!isset ($ TBS ->OtbsClearMsPowerpoint )) $ TBS ->OtbsClearMsPowerpoint = true ;
146
146
if (!isset ($ TBS ->OtbsGarbageCollector )) $ TBS ->OtbsGarbageCollector = true ;
147
147
if (!isset ($ TBS ->OtbsMsExcelCompatibility )) $ TBS ->OtbsMsExcelCompatibility = true ;
148
- $ this ->Version = '1.11.0 ' ;
148
+ $ this ->Version = '1.11.1 ' ;
149
149
$ this ->DebugLst = false ; // deactivate the debug mode
150
150
$ this ->ExtInfo = false ;
151
151
$ TBS ->TbsZip = &$ this ; // a shortcut
@@ -7978,8 +7978,8 @@ class clsTbsXmlCellReader extends clsTbsXmlLoc {
7978
7978
}
7979
7979
7980
7980
/*
7981
- TbsZip version 2.16 + compatibility PHP 8.2
7982
- Date : 2014-04-08
7981
+ TbsZip version 2.17
7982
+ Date : 2023-09-16
7983
7983
Author : Skrol29 (email: http://www.tinybutstrong.com/onlyyou.html)
7984
7984
Licence : LGPL
7985
7985
This class is independent from any other classes and has been originally created for the OpenTbs plug-in
@@ -7998,6 +7998,26 @@ class clsTbsZip {
7998
7998
public $ DisplayError ;
7999
7999
public $ ArchFile ;
8000
8000
public $ Error ;
8001
+
8002
+ // Compatibility PHP 8.2
8003
+ public $ ArchHnd ;
8004
+ public $ ArchIsNew ;
8005
+ public $ CdEndPos ;
8006
+ public $ CdPos ;
8007
+ public $ CdInfo ;
8008
+ public $ ArchIsStream ;
8009
+ public $ CdFileLst ;
8010
+ public $ CdFileNbr ;
8011
+ public $ CdFileByName ;
8012
+ public $ VisFileLst ;
8013
+ public $ LastReadComp ;
8014
+ public $ LastReadIdx ;
8015
+ public $ ReplInfo ;
8016
+ public $ ReplByPos ;
8017
+ public $ AddInfo ;
8018
+ public $ OutputMode ;
8019
+ public $ OutputHandle ;
8020
+ public $ OutputSrc ;
8001
8021
8002
8022
function __construct () {
8003
8023
$ this ->Meth8Ok = extension_loaded ('zlib ' ); // check if Zlib extension is available. This is need for compress and uncompress with method 8.
@@ -8006,8 +8026,10 @@ function __construct() {
8006
8026
$ this ->Error = false ;
8007
8027
}
8008
8028
8029
+ /**
8030
+ * Create a new virtual empty archive, the name will be the default name when the archive is flushed.
8031
+ */
8009
8032
function CreateNew ($ ArchName ='new.zip ' ) {
8010
- // Create a new virtual empty archive, the name will be the default name when the archive is flushed.
8011
8033
if (!isset ($ this ->Meth8Ok )) $ this ->__construct (); // for PHP 4 compatibility
8012
8034
$ this ->Close (); // note that $this->ArchHnd is set to false here
8013
8035
$ this ->Error = false ;
@@ -8019,8 +8041,11 @@ function CreateNew($ArchName='new.zip') {
8019
8041
$ this ->CdPos = $ this ->CdInfo ['p_cd ' ];
8020
8042
}
8021
8043
8044
+ /**
8045
+ * Open the zip archive
8046
+ */
8022
8047
function Open ($ ArchFile , $ UseIncludePath =false ) {
8023
- // Open the zip archive
8048
+
8024
8049
if (!isset ($ this ->Meth8Ok )) $ this ->__construct (); // for PHP 4 compatibility
8025
8050
$ this ->Close (); // close handle and init info
8026
8051
$ this ->Error = false ;
@@ -8232,8 +8257,10 @@ function FileExists($NameOrIdx) {
8232
8257
return ($ this ->FileGetIdx ($ NameOrIdx )!==false );
8233
8258
}
8234
8259
8235
- function FileGetIdx ($ NameOrIdx ) {
8236
- // Check if a file name, or a file index exists in the Central Directory, and return its index
8260
+ /**
8261
+ * Check if a file name, or a file index exists in the Central Directory, and return its index
8262
+ */
8263
+ function FileGetIdx ($ NameOrIdx ) {
8237
8264
if (is_string ($ NameOrIdx )) {
8238
8265
if (isset ($ this ->CdFileByName [$ NameOrIdx ])) {
8239
8266
return $ this ->CdFileByName [$ NameOrIdx ];
@@ -8249,8 +8276,10 @@ function FileGetIdx($NameOrIdx) {
8249
8276
}
8250
8277
}
8251
8278
8279
+ /**
8280
+ * Check if a file name exists in the list of file to add, and return its index
8281
+ */
8252
8282
function FileGetIdxAdd ($ Name ) {
8253
- // Check if a file name exists in the list of file to add, and return its index
8254
8283
if (!is_string ($ Name )) return false ;
8255
8284
$ idx_lst = array_keys ($ this ->AddInfo );
8256
8285
foreach ($ idx_lst as $ idx ) {
@@ -8297,8 +8326,10 @@ function FileRead($NameOrIdx, $Uncompress=true) {
8297
8326
8298
8327
}
8299
8328
8329
+ /**
8330
+ * Read the file header (and maybe the data ) in the archive, assuming the cursor in at a new file position
8331
+ */
8300
8332
function _ReadFile ($ idx , $ ReadData ) {
8301
- // read the file header (and maybe the data ) in the archive, assuming the cursor in at a new file position
8302
8333
8303
8334
$ b = $ this ->_ReadData (30 );
8304
8335
@@ -8376,8 +8407,10 @@ function _ReadFile($idx, $ReadData) {
8376
8407
8377
8408
}
8378
8409
8410
+ /**
8411
+ * Store replacement information.
8412
+ */
8379
8413
function FileReplace ($ NameOrIdx , $ Data , $ DataType =TBSZIP_STRING , $ Compress =true ) {
8380
- // Store replacement information.
8381
8414
8382
8415
$ idx = $ this ->FileGetIdx ($ NameOrIdx );
8383
8416
if ($ idx ===false ) return $ this ->RaiseError ('File " ' .$ NameOrIdx .'" is not found in the Central Directory. ' );
@@ -8429,9 +8462,11 @@ function FileGetState($NameOrIdx) {
8429
8462
8430
8463
}
8431
8464
8465
+ /**
8466
+ * Cancel added, modified or deleted modifications on a file in the archive.
8467
+ * @return integer The number of cancellations.
8468
+ */
8432
8469
function FileCancelModif ($ NameOrIdx , $ ReplacedAndDeleted =true ) {
8433
- // cancel added, modified or deleted modifications on a file in the archive
8434
- // return the number of cancels
8435
8470
8436
8471
$ nbr = 0 ;
8437
8472
@@ -8925,8 +8960,10 @@ function _DataCreateNewRef($Data, $DataType, $Compress, $Diff, $NameOrIdx) {
8925
8960
8926
8961
}
8927
8962
8963
+ /**
8964
+ * Returns the real size of data
8965
+ */
8928
8966
function _DataPrepare (&$ Ref ) {
8929
- // returns the real size of data
8930
8967
if ($ Ref ['path ' ]!==false ) {
8931
8968
$ Ref ['data ' ] = file_get_contents ($ Ref ['path ' ]);
8932
8969
if ($ Ref ['crc32 ' ]===false ) $ Ref ['crc32 ' ] = crc32 ($ Ref ['data ' ]);
@@ -8938,8 +8975,10 @@ function _DataPrepare(&$Ref) {
8938
8975
}
8939
8976
}
8940
8977
8941
- function _EstimateNewArchSize ($ Optim =true ) {
8942
- // Return the size of the new archive, or false if it cannot be calculated (because of external file that must be compressed before to be insered)
8978
+ /**
8979
+ * Return the size of the new archive, or false if it cannot be calculated (because of external file that must be compressed before to be insered)
8980
+ */
8981
+ function _EstimateNewArchSize ($ Optim =true ) {
8943
8982
8944
8983
if ($ this ->ArchIsNew ) {
8945
8984
$ Len = strlen ($ this ->CdInfo ['bin ' ]);
0 commit comments