1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #ifndef PHP_ZIP_H
21 #define PHP_ZIP_H
22
23 extern zend_module_entry zip_module_entry;
24 #define phpext_zip_ptr &zip_module_entry
25
26 #ifdef ZTS
27 #include "TSRM.h"
28 #endif
29
30 #if defined(HAVE_LIBZIP)
31 #include <zip.h>
32 #else
33 #include "lib/zip.h"
34 #endif
35
36 #ifndef ZIP_OVERWRITE
37 #define ZIP_OVERWRITE ZIP_TRUNCATE
38 #endif
39
40 #define PHP_ZIP_VERSION "1.12.5"
41
42 #if ((PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 2) || PHP_MAJOR_VERSION >= 6)
43 # define PHP_ZIP_USE_OO 1
44 #endif
45
46 #ifndef Z_SET_REFCOUNT_P
47 # if PHP_MAJOR_VERSION < 6 && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 3)
48 # define Z_SET_REFCOUNT_P(pz, rc) pz->refcount = rc
49 # define Z_UNSET_ISREF_P(pz) pz->is_ref = 0
50 # endif
51 #endif
52
53
54 #if PHP_API_VERSION < 20100412
55 # define ZIP_OPENBASEDIR_CHECKPATH(filename) \
56 (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)
57 #else
58 #define ZIP_OPENBASEDIR_CHECKPATH(filename) \
59 php_check_open_basedir(filename TSRMLS_CC)
60 #endif
61
62
63 typedef struct _ze_zip_rsrc {
64 struct zip *za;
65 int index_current;
66 int num_files;
67 } zip_rsrc;
68
69 typedef zip_rsrc * zip_rsrc_ptr;
70
71 typedef struct _ze_zip_read_rsrc {
72 struct zip_file *zf;
73 struct zip_stat sb;
74 } zip_read_rsrc;
75
76 #ifdef PHP_ZIP_USE_OO
77 #define ZIPARCHIVE_ME(name, arg_info, flags) {#name, c_ziparchive_ ##name, arg_info,(zend_uint) (sizeof(arg_info)/sizeof(struct _zend_arg_info)-1), flags },
78 #define ZIPARCHIVE_METHOD(name) ZEND_NAMED_FUNCTION(c_ziparchive_ ##name)
79
80
81
82 typedef struct _ze_zip_object {
83 zend_object zo;
84 struct zip *za;
85 int buffers_cnt;
86 char **buffers;
87 HashTable *prop_handler;
88 char *filename;
89 int filename_len;
90 } ze_zip_object;
91
92 php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
93 php_stream *php_stream_zip_open(const char *filename, const char *path, const char *mode STREAMS_DC TSRMLS_DC);
94
95 extern php_stream_wrapper php_stream_zip_wrapper;
96 #endif
97
98 #endif
99
100
101
102
103
104
105
106
107