init
- 框架初始化 - 安装插件 - 修复PHP8.4报错
This commit is contained in:
39
vendor/nelexa/zip/src/Constants/DosAttrs.php
vendored
Normal file
39
vendor/nelexa/zip/src/Constants/DosAttrs.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the nelexa/zip package.
|
||||
* (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PhpZip\Constants;
|
||||
|
||||
interface DosAttrs
|
||||
{
|
||||
/** @var int DOS File Attribute Read Only */
|
||||
public const DOS_READ_ONLY = 0x01;
|
||||
|
||||
/** @var int DOS File Attribute Hidden */
|
||||
public const DOS_HIDDEN = 0x02;
|
||||
|
||||
/** @var int DOS File Attribute System */
|
||||
public const DOS_SYSTEM = 0x04;
|
||||
|
||||
/** @var int DOS File Attribute Label */
|
||||
public const DOS_LABEL = 0x08;
|
||||
|
||||
/** @var int DOS File Attribute Directory */
|
||||
public const DOS_DIRECTORY = 0x10;
|
||||
|
||||
/** @var int DOS File Attribute Archive */
|
||||
public const DOS_ARCHIVE = 0x20;
|
||||
|
||||
/** @var int DOS File Attribute Link */
|
||||
public const DOS_LINK = 0x40;
|
||||
|
||||
/** @var int DOS File Attribute Execute */
|
||||
public const DOS_EXE = 0x80;
|
||||
}
|
||||
103
vendor/nelexa/zip/src/Constants/DosCodePage.php
vendored
Normal file
103
vendor/nelexa/zip/src/Constants/DosCodePage.php
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the nelexa/zip package.
|
||||
* (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PhpZip\Constants;
|
||||
|
||||
final class DosCodePage
|
||||
{
|
||||
public const CP_LATIN_US = 'cp437';
|
||||
|
||||
public const CP_GREEK = 'cp737';
|
||||
|
||||
public const CP_BALT_RIM = 'cp775';
|
||||
|
||||
public const CP_LATIN1 = 'cp850';
|
||||
|
||||
public const CP_LATIN2 = 'cp852';
|
||||
|
||||
public const CP_CYRILLIC = 'cp855';
|
||||
|
||||
public const CP_TURKISH = 'cp857';
|
||||
|
||||
public const CP_PORTUGUESE = 'cp860';
|
||||
|
||||
public const CP_ICELANDIC = 'cp861';
|
||||
|
||||
public const CP_HEBREW = 'cp862';
|
||||
|
||||
public const CP_CANADA = 'cp863';
|
||||
|
||||
public const CP_ARABIC = 'cp864';
|
||||
|
||||
public const CP_NORDIC = 'cp865';
|
||||
|
||||
public const CP_CYRILLIC_RUSSIAN = 'cp866';
|
||||
|
||||
public const CP_GREEK2 = 'cp869';
|
||||
|
||||
public const CP_THAI = 'cp874';
|
||||
|
||||
/** @var string[] */
|
||||
private const CP_CHARSETS = [
|
||||
self::CP_LATIN_US,
|
||||
self::CP_GREEK,
|
||||
self::CP_BALT_RIM,
|
||||
self::CP_LATIN1,
|
||||
self::CP_LATIN2,
|
||||
self::CP_CYRILLIC,
|
||||
self::CP_TURKISH,
|
||||
self::CP_PORTUGUESE,
|
||||
self::CP_ICELANDIC,
|
||||
self::CP_HEBREW,
|
||||
self::CP_CANADA,
|
||||
self::CP_ARABIC,
|
||||
self::CP_NORDIC,
|
||||
self::CP_CYRILLIC_RUSSIAN,
|
||||
self::CP_GREEK2,
|
||||
self::CP_THAI,
|
||||
];
|
||||
|
||||
/**
|
||||
* @noinspection PhpComposerExtensionStubsInspection
|
||||
*/
|
||||
public static function toUTF8(string $str, ?string $sourceEncoding): string
|
||||
{
|
||||
$s = iconv($sourceEncoding, 'UTF-8', $str);
|
||||
|
||||
if ($s === false) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @noinspection PhpComposerExtensionStubsInspection
|
||||
*/
|
||||
public static function fromUTF8(string $str, ?string $destEncoding): string
|
||||
{
|
||||
$s = iconv('UTF-8', $destEncoding, $str);
|
||||
|
||||
if ($s === false) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getCodePages(): array
|
||||
{
|
||||
return self::CP_CHARSETS;
|
||||
}
|
||||
}
|
||||
77
vendor/nelexa/zip/src/Constants/GeneralPurposeBitFlag.php
vendored
Normal file
77
vendor/nelexa/zip/src/Constants/GeneralPurposeBitFlag.php
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the nelexa/zip package.
|
||||
* (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PhpZip\Constants;
|
||||
|
||||
interface GeneralPurposeBitFlag
|
||||
{
|
||||
/**
|
||||
* General Purpose Bit Flag mask for encrypted data.
|
||||
* Bit 0: If set, indicates that the file is encrypted.
|
||||
*/
|
||||
public const ENCRYPTION = 1 << 0;
|
||||
|
||||
/**
|
||||
* Compression Flag Bit 1 for method Deflating.
|
||||
*
|
||||
* Bit 2 Bit 1
|
||||
* 0 0 Normal compression
|
||||
* 0 1 Maximum compression
|
||||
* 1 0 Fast compression
|
||||
* 1 1 Super Fast compression
|
||||
*
|
||||
* @see GeneralPurposeBitFlag::COMPRESSION_FLAG2
|
||||
*/
|
||||
public const COMPRESSION_FLAG1 = 1 << 1;
|
||||
|
||||
/**
|
||||
* Compression Flag Bit 2 for method Deflating.
|
||||
*
|
||||
* Bit 2 Bit 1
|
||||
* 0 0 Normal compression
|
||||
* 0 1 Maximum compression
|
||||
* 1 0 Fast compression
|
||||
* 1 1 Super Fast compression
|
||||
*
|
||||
* @see GeneralPurposeBitFlag::COMPRESSION_FLAG1
|
||||
*/
|
||||
public const COMPRESSION_FLAG2 = 1 << 2;
|
||||
|
||||
/**
|
||||
* General Purpose Bit Flag mask for data descriptor.
|
||||
*
|
||||
* Bit 3: If this bit is set, the fields crc-32, compressed
|
||||
* size and uncompressed size are set to zero in the
|
||||
* local header. The correct values are put in the data
|
||||
* descriptor immediately following the compressed data.
|
||||
*/
|
||||
public const DATA_DESCRIPTOR = 1 << 3;
|
||||
|
||||
/**
|
||||
* General Purpose Bit Flag mask for strong encryption.
|
||||
*
|
||||
* Bit 6: Strong encryption.
|
||||
* If this bit is set, you MUST set the version needed to extract
|
||||
* value to at least 50 and you MUST also set bit 0.
|
||||
* If AES encryption is used, the version needed to extract value
|
||||
* MUST be at least 51.
|
||||
*/
|
||||
public const STRONG_ENCRYPTION = 1 << 6;
|
||||
|
||||
/**
|
||||
* General Purpose Bit Flag mask for UTF-8.
|
||||
*
|
||||
* Bit 11: Language encoding flag (EFS).
|
||||
* If this bit is set, the filename and comment fields
|
||||
* for this file MUST be encoded using UTF-8. (see APPENDIX D)
|
||||
*/
|
||||
public const UTF8 = 1 << 11;
|
||||
}
|
||||
90
vendor/nelexa/zip/src/Constants/UnixStat.php
vendored
Normal file
90
vendor/nelexa/zip/src/Constants/UnixStat.php
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the nelexa/zip package.
|
||||
* (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PhpZip\Constants;
|
||||
|
||||
/**
|
||||
* Unix stat constants.
|
||||
*/
|
||||
interface UnixStat
|
||||
{
|
||||
/** @var int unix file type mask */
|
||||
public const UNX_IFMT = 0170000;
|
||||
|
||||
/** @var int unix regular file */
|
||||
public const UNX_IFREG = 0100000;
|
||||
|
||||
/** @var int unix socket (BSD, not SysV or Amiga) */
|
||||
public const UNX_IFSOCK = 0140000;
|
||||
|
||||
/** @var int unix symbolic link (not SysV, Amiga) */
|
||||
public const UNX_IFLNK = 0120000;
|
||||
|
||||
/** @var int unix block special (not Amiga) */
|
||||
public const UNX_IFBLK = 0060000;
|
||||
|
||||
/** @var int unix directory */
|
||||
public const UNX_IFDIR = 0040000;
|
||||
|
||||
/** @var int unix character special (not Amiga) */
|
||||
public const UNX_IFCHR = 0020000;
|
||||
|
||||
/** @var int unix fifo (BCC, not MSC or Amiga) */
|
||||
public const UNX_IFIFO = 0010000;
|
||||
|
||||
/** @var int unix set user id on execution */
|
||||
public const UNX_ISUID = 04000;
|
||||
|
||||
/** @var int unix set group id on execution */
|
||||
public const UNX_ISGID = 02000;
|
||||
|
||||
/** @var int unix directory permissions control */
|
||||
public const UNX_ISVTX = 01000;
|
||||
|
||||
/** @var int unix record locking enforcement flag */
|
||||
public const UNX_ENFMT = 02000;
|
||||
|
||||
/** @var int unix read, write, execute: owner */
|
||||
public const UNX_IRWXU = 00700;
|
||||
|
||||
/** @var int unix read permission: owner */
|
||||
public const UNX_IRUSR = 00400;
|
||||
|
||||
/** @var int unix write permission: owner */
|
||||
public const UNX_IWUSR = 00200;
|
||||
|
||||
/** @var int unix execute permission: owner */
|
||||
public const UNX_IXUSR = 00100;
|
||||
|
||||
/** @var int unix read, write, execute: group */
|
||||
public const UNX_IRWXG = 00070;
|
||||
|
||||
/** @var int unix read permission: group */
|
||||
public const UNX_IRGRP = 00040;
|
||||
|
||||
/** @var int unix write permission: group */
|
||||
public const UNX_IWGRP = 00020;
|
||||
|
||||
/** @var int unix execute permission: group */
|
||||
public const UNX_IXGRP = 00010;
|
||||
|
||||
/** @var int unix read, write, execute: other */
|
||||
public const UNX_IRWXO = 00007;
|
||||
|
||||
/** @var int unix read permission: other */
|
||||
public const UNX_IROTH = 00004;
|
||||
|
||||
/** @var int unix write permission: other */
|
||||
public const UNX_IWOTH = 00002;
|
||||
|
||||
/** @var int unix execute permission: other */
|
||||
public const UNX_IXOTH = 00001;
|
||||
}
|
||||
63
vendor/nelexa/zip/src/Constants/ZipCompressionLevel.php
vendored
Normal file
63
vendor/nelexa/zip/src/Constants/ZipCompressionLevel.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the nelexa/zip package.
|
||||
* (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PhpZip\Constants;
|
||||
|
||||
/**
|
||||
* Compression levels for Deflate and BZIP2.
|
||||
*
|
||||
* {@see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT} Section 4.4.4:
|
||||
*
|
||||
* For Methods 8 and 9 - Deflating
|
||||
* -------------------------------
|
||||
* Bit 2 Bit 1
|
||||
* 0 0 Normal (-en) compression option was used.
|
||||
* 0 1 Maximum (-exx/-ex) compression option was used.
|
||||
* 1 0 Fast (-ef) compression option was used.
|
||||
* 1 1 Super Fast (-es) compression option was used.
|
||||
*
|
||||
* Different programs encode compression level information in different ways:
|
||||
*
|
||||
* Deflate Compress Level pkzip zip 7z, WinRAR WinZip
|
||||
* ---------------------- ---------------- ------- ---------- ------
|
||||
* Super Fast compression 1 1
|
||||
* Fast compression 2 1, 2
|
||||
* Normal Compression 3 - 8 (5 default) 3 - 7 1 - 9
|
||||
* Maximum compression 9 8, 9 9
|
||||
*/
|
||||
interface ZipCompressionLevel
|
||||
{
|
||||
/** @var int Compression level for super fast compression. */
|
||||
public const SUPER_FAST = 1;
|
||||
|
||||
/** @var int compression level for fast compression */
|
||||
public const FAST = 2;
|
||||
|
||||
/** @var int compression level for normal compression */
|
||||
public const NORMAL = 5;
|
||||
|
||||
/** @var int compression level for maximum compression */
|
||||
public const MAXIMUM = 9;
|
||||
|
||||
/**
|
||||
* @var int int Minimum compression level
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public const LEVEL_MIN = self::SUPER_FAST;
|
||||
|
||||
/**
|
||||
* @var int int Maximum compression level
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public const LEVEL_MAX = self::MAXIMUM;
|
||||
}
|
||||
97
vendor/nelexa/zip/src/Constants/ZipCompressionMethod.php
vendored
Normal file
97
vendor/nelexa/zip/src/Constants/ZipCompressionMethod.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the nelexa/zip package.
|
||||
* (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PhpZip\Constants;
|
||||
|
||||
use PhpZip\Exception\ZipUnsupportMethodException;
|
||||
|
||||
final class ZipCompressionMethod
|
||||
{
|
||||
/** @var int Compression method Store */
|
||||
public const STORED = 0;
|
||||
|
||||
/** @var int Compression method Deflate */
|
||||
public const DEFLATED = 8;
|
||||
|
||||
/** @var int Compression method Bzip2 */
|
||||
public const BZIP2 = 12;
|
||||
|
||||
/** @var int Compression method AES-Encryption */
|
||||
public const WINZIP_AES = 99;
|
||||
|
||||
/** @var array Compression Methods */
|
||||
private const ZIP_COMPRESSION_METHODS = [
|
||||
self::STORED => 'Stored',
|
||||
1 => 'Shrunk',
|
||||
2 => 'Reduced compression factor 1',
|
||||
3 => 'Reduced compression factor 2',
|
||||
4 => 'Reduced compression factor 3',
|
||||
5 => 'Reduced compression factor 4',
|
||||
6 => 'Imploded',
|
||||
7 => 'Reserved for Tokenizing compression algorithm',
|
||||
self::DEFLATED => 'Deflated',
|
||||
9 => 'Enhanced Deflating using Deflate64(tm)',
|
||||
10 => 'PKWARE Data Compression Library Imploding',
|
||||
11 => 'Reserved by PKWARE',
|
||||
self::BZIP2 => 'BZIP2',
|
||||
13 => 'Reserved by PKWARE',
|
||||
14 => 'LZMA',
|
||||
15 => 'Reserved by PKWARE',
|
||||
16 => 'Reserved by PKWARE',
|
||||
17 => 'Reserved by PKWARE',
|
||||
18 => 'File is compressed using IBM TERSE (new)',
|
||||
19 => 'IBM LZ77 z Architecture (PFS)',
|
||||
96 => 'WinZip JPEG Compression',
|
||||
97 => 'WavPack compressed data',
|
||||
98 => 'PPMd version I, Rev 1',
|
||||
self::WINZIP_AES => 'AES Encryption',
|
||||
];
|
||||
|
||||
public static function getCompressionMethodName(int $value): string
|
||||
{
|
||||
return self::ZIP_COMPRESSION_METHODS[$value] ?? 'Unknown Method';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int[]
|
||||
*/
|
||||
public static function getSupportMethods(): array
|
||||
{
|
||||
static $methods;
|
||||
|
||||
if ($methods === null) {
|
||||
$methods = [
|
||||
self::STORED,
|
||||
self::DEFLATED,
|
||||
];
|
||||
|
||||
if (\extension_loaded('bz2')) {
|
||||
$methods[] = self::BZIP2;
|
||||
}
|
||||
}
|
||||
|
||||
return $methods;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ZipUnsupportMethodException
|
||||
*/
|
||||
public static function checkSupport(int $compressionMethod): void
|
||||
{
|
||||
if (!\in_array($compressionMethod, self::getSupportMethods(), true)) {
|
||||
throw new ZipUnsupportMethodException(sprintf(
|
||||
'Compression method %d (%s) is not supported.',
|
||||
$compressionMethod,
|
||||
self::getCompressionMethodName($compressionMethod)
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
105
vendor/nelexa/zip/src/Constants/ZipConstants.php
vendored
Normal file
105
vendor/nelexa/zip/src/Constants/ZipConstants.php
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the nelexa/zip package.
|
||||
* (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PhpZip\Constants;
|
||||
|
||||
/**
|
||||
* Zip Constants.
|
||||
*/
|
||||
interface ZipConstants
|
||||
{
|
||||
/** @var int End Of Central Directory Record signature. */
|
||||
public const END_CD = 0x06054B50; // "PK\005\006"
|
||||
|
||||
/** @var int Zip64 End Of Central Directory Record. */
|
||||
public const ZIP64_END_CD = 0x06064B50; // "PK\006\006"
|
||||
|
||||
/** @var int Zip64 End Of Central Directory Locator. */
|
||||
public const ZIP64_END_CD_LOC = 0x07064B50; // "PK\006\007"
|
||||
|
||||
/** @var int Central File Header signature. */
|
||||
public const CENTRAL_FILE_HEADER = 0x02014B50; // "PK\001\002"
|
||||
|
||||
/** @var int Local File Header signature. */
|
||||
public const LOCAL_FILE_HEADER = 0x04034B50; // "PK\003\004"
|
||||
|
||||
/** @var int Data Descriptor signature. */
|
||||
public const DATA_DESCRIPTOR = 0x08074B50; // "PK\007\008"
|
||||
|
||||
/**
|
||||
* @var int value stored in four-byte size and similar fields
|
||||
* if ZIP64 extensions are used
|
||||
*/
|
||||
public const ZIP64_MAGIC = 0xFFFFFFFF;
|
||||
|
||||
/**
|
||||
* Local File Header signature 4
|
||||
* Version Needed To Extract 2
|
||||
* General Purpose Bit Flags 2
|
||||
* Compression Method 2
|
||||
* Last Mod File Time 2
|
||||
* Last Mod File Date 2
|
||||
* CRC-32 4
|
||||
* Compressed Size 4
|
||||
* Uncompressed Size 4.
|
||||
*
|
||||
* @var int Local File Header filename position
|
||||
*/
|
||||
public const LFH_FILENAME_LENGTH_POS = 26;
|
||||
|
||||
/**
|
||||
* The minimum length of the Local File Header record.
|
||||
*
|
||||
* local file header signature 4
|
||||
* version needed to extract 2
|
||||
* general purpose bit flag 2
|
||||
* compression method 2
|
||||
* last mod file time 2
|
||||
* last mod file date 2
|
||||
* crc-32 4
|
||||
* compressed size 4
|
||||
* uncompressed size 4
|
||||
* file name length 2
|
||||
* extra field length 2
|
||||
*/
|
||||
public const LFH_FILENAME_POS = 30;
|
||||
|
||||
/** @var int the length of the Zip64 End Of Central Directory Locator */
|
||||
public const ZIP64_END_CD_LOC_LEN = 20;
|
||||
|
||||
/** @var int the minimum length of the End Of Central Directory Record */
|
||||
public const END_CD_MIN_LEN = 22;
|
||||
|
||||
/**
|
||||
* The minimum length of the Zip64 End Of Central Directory Record.
|
||||
*
|
||||
* zip64 end of central dir
|
||||
* signature 4
|
||||
* size of zip64 end of central
|
||||
* directory record 8
|
||||
* version made by 2
|
||||
* version needed to extract 2
|
||||
* number of this disk 4
|
||||
* number of the disk with the
|
||||
* start of the central directory 4
|
||||
* total number of entries in the
|
||||
* central directory on this disk 8
|
||||
* total number of entries in
|
||||
* the central directory 8
|
||||
* size of the central directory 8
|
||||
* offset of start of central
|
||||
* directory with respect to
|
||||
* the starting disk number 8
|
||||
*
|
||||
* @var int ZIP64 End Of Central Directory length
|
||||
*/
|
||||
public const ZIP64_END_OF_CD_LEN = 56;
|
||||
}
|
||||
76
vendor/nelexa/zip/src/Constants/ZipEncryptionMethod.php
vendored
Normal file
76
vendor/nelexa/zip/src/Constants/ZipEncryptionMethod.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the nelexa/zip package.
|
||||
* (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PhpZip\Constants;
|
||||
|
||||
use PhpZip\Exception\InvalidArgumentException;
|
||||
|
||||
final class ZipEncryptionMethod
|
||||
{
|
||||
public const NONE = -1;
|
||||
|
||||
/** @var int Traditional PKWARE encryption. */
|
||||
public const PKWARE = 0;
|
||||
|
||||
/** @var int WinZip AES-256 */
|
||||
public const WINZIP_AES_256 = 1;
|
||||
|
||||
/** @var int WinZip AES-128 */
|
||||
public const WINZIP_AES_128 = 2;
|
||||
|
||||
/** @var int WinZip AES-192 */
|
||||
public const WINZIP_AES_192 = 3;
|
||||
|
||||
/** @var array<int, string> */
|
||||
private const ENCRYPTION_METHODS = [
|
||||
self::NONE => 'no encryption',
|
||||
self::PKWARE => 'Traditional PKWARE encryption',
|
||||
self::WINZIP_AES_128 => 'WinZip AES-128',
|
||||
self::WINZIP_AES_192 => 'WinZip AES-192',
|
||||
self::WINZIP_AES_256 => 'WinZip AES-256',
|
||||
];
|
||||
|
||||
public static function getEncryptionMethodName(int $value): string
|
||||
{
|
||||
return self::ENCRYPTION_METHODS[$value] ?? 'Unknown Encryption Method';
|
||||
}
|
||||
|
||||
public static function hasEncryptionMethod(int $encryptionMethod): bool
|
||||
{
|
||||
return isset(self::ENCRYPTION_METHODS[$encryptionMethod]);
|
||||
}
|
||||
|
||||
public static function isWinZipAesMethod(int $encryptionMethod): bool
|
||||
{
|
||||
return \in_array(
|
||||
$encryptionMethod,
|
||||
[
|
||||
self::WINZIP_AES_256,
|
||||
self::WINZIP_AES_192,
|
||||
self::WINZIP_AES_128,
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public static function checkSupport(int $encryptionMethod): void
|
||||
{
|
||||
if (!self::hasEncryptionMethod($encryptionMethod)) {
|
||||
throw new InvalidArgumentException(sprintf(
|
||||
'Encryption method %d is not supported.',
|
||||
$encryptionMethod
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
68
vendor/nelexa/zip/src/Constants/ZipOptions.php
vendored
Normal file
68
vendor/nelexa/zip/src/Constants/ZipOptions.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the nelexa/zip package.
|
||||
* (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PhpZip\Constants;
|
||||
|
||||
use PhpZip\IO\ZipReader;
|
||||
use PhpZip\ZipFile;
|
||||
|
||||
interface ZipOptions
|
||||
{
|
||||
/**
|
||||
* Boolean option for store just file names (skip directory names).
|
||||
*
|
||||
* @see ZipFile::addFromFinder()
|
||||
*/
|
||||
public const STORE_ONLY_FILES = 'only_files';
|
||||
|
||||
/**
|
||||
* Uses the specified compression method.
|
||||
*
|
||||
* @see ZipFile::addFromFinder()
|
||||
* @see ZipFile::addSplFile()
|
||||
*/
|
||||
public const COMPRESSION_METHOD = 'compression_method';
|
||||
|
||||
/**
|
||||
* Set the specified record modification time.
|
||||
* The value can be {@see \DateTimeInterface}, integer timestamp
|
||||
* or a string of any format.
|
||||
*
|
||||
* @see ZipFile::addFromFinder()
|
||||
* @see ZipFile::addSplFile()
|
||||
*/
|
||||
public const MODIFIED_TIME = 'mtime';
|
||||
|
||||
/**
|
||||
* Specifies the encoding of the record name for cases when the UTF-8
|
||||
* usage flag is not set.
|
||||
*
|
||||
* The most commonly used encodings are compiled into the constants
|
||||
* of the {@see DosCodePage} class.
|
||||
*
|
||||
* @see ZipFile::openFile()
|
||||
* @see ZipFile::openFromString()
|
||||
* @see ZipFile::openFromStream()
|
||||
* @see ZipReader::getDefaultOptions()
|
||||
* @see DosCodePage::getCodePages()
|
||||
*/
|
||||
public const CHARSET = 'charset';
|
||||
|
||||
/**
|
||||
* Allows ({@see true}) or denies ({@see false}) unpacking unix symlinks.
|
||||
*
|
||||
* This is a potentially dangerous operation for uncontrolled zip files.
|
||||
* By default is ({@see false}).
|
||||
*
|
||||
* @see https://josipfranjkovic.blogspot.com/2014/12/reading-local-files-from-facebooks.html
|
||||
*/
|
||||
public const EXTRACT_SYMLINKS = 'extract_symlinks';
|
||||
}
|
||||
54
vendor/nelexa/zip/src/Constants/ZipPlatform.php
vendored
Normal file
54
vendor/nelexa/zip/src/Constants/ZipPlatform.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the nelexa/zip package.
|
||||
* (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PhpZip\Constants;
|
||||
|
||||
final class ZipPlatform
|
||||
{
|
||||
/** @var int MS-DOS OS */
|
||||
public const OS_DOS = 0;
|
||||
|
||||
/** @var int Unix OS */
|
||||
public const OS_UNIX = 3;
|
||||
|
||||
/** @var int MacOS platform */
|
||||
public const OS_MAC_OSX = 19;
|
||||
|
||||
/** @var array Zip Platforms */
|
||||
private const PLATFORMS = [
|
||||
self::OS_DOS => 'MS-DOS',
|
||||
1 => 'Amiga',
|
||||
2 => 'OpenVMS',
|
||||
self::OS_UNIX => 'Unix',
|
||||
4 => 'VM/CMS',
|
||||
5 => 'Atari ST',
|
||||
6 => 'HPFS (OS/2, NT 3.x)',
|
||||
7 => 'Macintosh',
|
||||
8 => 'Z-System',
|
||||
9 => 'CP/M',
|
||||
10 => 'Windows NTFS or TOPS-20',
|
||||
11 => 'MVS or NTFS',
|
||||
12 => 'VSE or SMS/QDOS',
|
||||
13 => 'Acorn RISC OS',
|
||||
14 => 'VFAT',
|
||||
15 => 'alternate MVS',
|
||||
16 => 'BeOS',
|
||||
17 => 'Tandem',
|
||||
18 => 'OS/400',
|
||||
self::OS_MAC_OSX => 'OS/X (Darwin)',
|
||||
30 => 'AtheOS/Syllable',
|
||||
];
|
||||
|
||||
public static function getPlatformName(int $platform): string
|
||||
{
|
||||
return self::PLATFORMS[$platform] ?? 'Unknown';
|
||||
}
|
||||
}
|
||||
87
vendor/nelexa/zip/src/Constants/ZipVersion.php
vendored
Normal file
87
vendor/nelexa/zip/src/Constants/ZipVersion.php
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the nelexa/zip package.
|
||||
* (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PhpZip\Constants;
|
||||
|
||||
/**
|
||||
* Version needed to extract or software version.
|
||||
*
|
||||
* @see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT Section 4.4.3
|
||||
*/
|
||||
interface ZipVersion
|
||||
{
|
||||
/** @var int 1.0 - Default value */
|
||||
public const v10_DEFAULT_MIN = 10;
|
||||
|
||||
/** @var int 1.1 - File is a volume label */
|
||||
public const v11_FILE_VOLUME_LABEL = 11;
|
||||
|
||||
/**
|
||||
* 2.0 - File is a folder (directory)
|
||||
* 2.0 - File is compressed using Deflate compression
|
||||
* 2.0 - File is encrypted using traditional PKWARE encryption.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public const v20_DEFLATED_FOLDER_ZIPCRYPTO = 20;
|
||||
|
||||
/** @var int 2.1 - File is compressed using Deflate64(tm) */
|
||||
public const v21_DEFLATED64 = 21;
|
||||
|
||||
/** @var int 2.5 - File is compressed using PKWARE DCL Implode */
|
||||
public const v25_IMPLODED = 25;
|
||||
|
||||
/** @var int 2.7 - File is a patch data set */
|
||||
public const v27_PATCH_DATA = 27;
|
||||
|
||||
/** @var int 4.5 - File uses ZIP64 format extensions */
|
||||
public const v45_ZIP64_EXT = 45;
|
||||
|
||||
/** @var int 4.6 - File is compressed using BZIP2 compression */
|
||||
public const v46_BZIP2 = 46;
|
||||
|
||||
/**
|
||||
* 5.0 - File is encrypted using DES
|
||||
* 5.0 - File is encrypted using 3DES
|
||||
* 5.0 - File is encrypted using original RC2 encryption
|
||||
* 5.0 - File is encrypted using RC4 encryption.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public const v50_ENCR_DES_3DES_RC2_ORIG_RC4 = 50;
|
||||
|
||||
/**
|
||||
* 5.1 - File is encrypted using AES encryption
|
||||
* 5.1 - File is encrypted using corrected RC2 encryption**.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public const v51_ENCR_AES_RC2_CORRECT = 51;
|
||||
|
||||
/** @var int 5.2 - File is encrypted using corrected RC2-64 encryption** */
|
||||
public const v52_ENCR_RC2_64_CORRECT = 52;
|
||||
|
||||
/** @var int 6.1 - File is encrypted using non-OAEP key wrapping*** */
|
||||
public const v61_ENCR_NON_OAE_KEY_WRAP = 61;
|
||||
|
||||
/** @var int 6.2 - Central directory encryption */
|
||||
public const v62_ENCR_CENTRAL_DIR = 62;
|
||||
|
||||
/**
|
||||
* 6.3 - File is compressed using LZMA
|
||||
* 6.3 - File is compressed using PPMd+
|
||||
* 6.3 - File is encrypted using Blowfish
|
||||
* 6.3 - File is encrypted using Twofish.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public const v63_LZMA_PPMD_BLOWFISH_TWOFISH = 63;
|
||||
}
|
||||
Reference in New Issue
Block a user