Skip to content

Commit 78fadaf

Browse files
author
Skrol29
committedSep 17, 2023
OpenTBS 1.11.1
1 parent 89aea4d commit 78fadaf

File tree

3 files changed

+64
-17
lines changed

3 files changed

+64
-17
lines changed
 

‎CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.11.1] - 2023-09-17
6+
7+
### Enhancements
8+
9+
- PHP 8.2 compatibility for subclass TbsZip
10+
511
## [1.11.0] - 2023-05-15
612

713
### Enhancements

‎tbs_plugin_opentbs.html

+2
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,8 @@ <h4>• <a id="opentbs_chart"></a>Change series in a chart:</h4>
556556
<li>The name of a field placed anywhere in the Alternative
557557
Text property of the frame that embeds the chart. <span class="versioning">(supported
558558
since OpenTBS 1.10.4)</span>. <br>
559+
This name must be unique for charts in the entire document.
560+
<br>
559561
For example: <code>$ChartRef = 'my_chart'</code> is
560562
corresponding to the field <code>[my_chart]</code> placed
561563
in the Alt Text property. <br>

‎tbs_plugin_opentbs.php

+56-17
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* This TBS plug-in can open a zip file, read the central directory,
88
* and retrieve the content of a zipped file which is not compressed.
99
*
10-
* @version 1.11.0
11-
* @date 2023-05-15
10+
* @version 1.11.1
11+
* @date 2023-09-17
1212
* @see http://www.tinybutstrong.com/plugins.php
1313
* @author Skrol29 http://www.tinybutstrong.com/onlyyou.html
1414
* @license LGPL-3.0
@@ -145,7 +145,7 @@ function OnInstall() {
145145
if (!isset($TBS->OtbsClearMsPowerpoint)) $TBS->OtbsClearMsPowerpoint = true;
146146
if (!isset($TBS->OtbsGarbageCollector)) $TBS->OtbsGarbageCollector = true;
147147
if (!isset($TBS->OtbsMsExcelCompatibility)) $TBS->OtbsMsExcelCompatibility = true;
148-
$this->Version = '1.11.0';
148+
$this->Version = '1.11.1';
149149
$this->DebugLst = false; // deactivate the debug mode
150150
$this->ExtInfo = false;
151151
$TBS->TbsZip = &$this; // a shortcut
@@ -7978,8 +7978,8 @@ class clsTbsXmlCellReader extends clsTbsXmlLoc {
79787978
}
79797979

79807980
/*
7981-
TbsZip version 2.16 + compatibility PHP 8.2
7982-
Date : 2014-04-08
7981+
TbsZip version 2.17
7982+
Date : 2023-09-16
79837983
Author : Skrol29 (email: http://www.tinybutstrong.com/onlyyou.html)
79847984
Licence : LGPL
79857985
This class is independent from any other classes and has been originally created for the OpenTbs plug-in
@@ -7998,6 +7998,26 @@ class clsTbsZip {
79987998
public $DisplayError;
79997999
public $ArchFile;
80008000
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;
80018021

80028022
function __construct() {
80038023
$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() {
80068026
$this->Error = false;
80078027
}
80088028

8029+
/**
8030+
* Create a new virtual empty archive, the name will be the default name when the archive is flushed.
8031+
*/
80098032
function CreateNew($ArchName='new.zip') {
8010-
// Create a new virtual empty archive, the name will be the default name when the archive is flushed.
80118033
if (!isset($this->Meth8Ok)) $this->__construct(); // for PHP 4 compatibility
80128034
$this->Close(); // note that $this->ArchHnd is set to false here
80138035
$this->Error = false;
@@ -8019,8 +8041,11 @@ function CreateNew($ArchName='new.zip') {
80198041
$this->CdPos = $this->CdInfo['p_cd'];
80208042
}
80218043

8044+
/**
8045+
* Open the zip archive
8046+
*/
80228047
function Open($ArchFile, $UseIncludePath=false) {
8023-
// Open the zip archive
8048+
80248049
if (!isset($this->Meth8Ok)) $this->__construct(); // for PHP 4 compatibility
80258050
$this->Close(); // close handle and init info
80268051
$this->Error = false;
@@ -8232,8 +8257,10 @@ function FileExists($NameOrIdx) {
82328257
return ($this->FileGetIdx($NameOrIdx)!==false);
82338258
}
82348259

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) {
82378264
if (is_string($NameOrIdx)) {
82388265
if (isset($this->CdFileByName[$NameOrIdx])) {
82398266
return $this->CdFileByName[$NameOrIdx];
@@ -8249,8 +8276,10 @@ function FileGetIdx($NameOrIdx) {
82498276
}
82508277
}
82518278

8279+
/**
8280+
* Check if a file name exists in the list of file to add, and return its index
8281+
*/
82528282
function FileGetIdxAdd($Name) {
8253-
// Check if a file name exists in the list of file to add, and return its index
82548283
if (!is_string($Name)) return false;
82558284
$idx_lst = array_keys($this->AddInfo);
82568285
foreach ($idx_lst as $idx) {
@@ -8297,8 +8326,10 @@ function FileRead($NameOrIdx, $Uncompress=true) {
82978326

82988327
}
82998328

8329+
/**
8330+
* Read the file header (and maybe the data ) in the archive, assuming the cursor in at a new file position
8331+
*/
83008332
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
83028333

83038334
$b = $this->_ReadData(30);
83048335

@@ -8376,8 +8407,10 @@ function _ReadFile($idx, $ReadData) {
83768407

83778408
}
83788409

8410+
/**
8411+
* Store replacement information.
8412+
*/
83798413
function FileReplace($NameOrIdx, $Data, $DataType=TBSZIP_STRING, $Compress=true) {
8380-
// Store replacement information.
83818414

83828415
$idx = $this->FileGetIdx($NameOrIdx);
83838416
if ($idx===false) return $this->RaiseError('File "'.$NameOrIdx.'" is not found in the Central Directory.');
@@ -8429,9 +8462,11 @@ function FileGetState($NameOrIdx) {
84298462

84308463
}
84318464

8465+
/**
8466+
* Cancel added, modified or deleted modifications on a file in the archive.
8467+
* @return integer The number of cancellations.
8468+
*/
84328469
function FileCancelModif($NameOrIdx, $ReplacedAndDeleted=true) {
8433-
// cancel added, modified or deleted modifications on a file in the archive
8434-
// return the number of cancels
84358470

84368471
$nbr = 0;
84378472

@@ -8925,8 +8960,10 @@ function _DataCreateNewRef($Data, $DataType, $Compress, $Diff, $NameOrIdx) {
89258960

89268961
}
89278962

8963+
/**
8964+
* Returns the real size of data
8965+
*/
89288966
function _DataPrepare(&$Ref) {
8929-
// returns the real size of data
89308967
if ($Ref['path']!==false) {
89318968
$Ref['data'] = file_get_contents($Ref['path']);
89328969
if ($Ref['crc32']===false) $Ref['crc32'] = crc32($Ref['data']);
@@ -8938,8 +8975,10 @@ function _DataPrepare(&$Ref) {
89388975
}
89398976
}
89408977

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) {
89438982

89448983
if ($this->ArchIsNew) {
89458984
$Len = strlen($this->CdInfo['bin']);

0 commit comments

Comments
 (0)
Please sign in to comment.