1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #ifndef FILE_H
24 #define FILE_H
25
26 #include "php_network.h"
27
28 PHP_MINIT_FUNCTION(file);
29 PHP_MSHUTDOWN_FUNCTION(file);
30
31 PHP_FUNCTION(tempnam);
32 PHP_NAMED_FUNCTION(php_if_tmpfile);
33 PHP_NAMED_FUNCTION(php_if_fopen);
34 PHPAPI PHP_FUNCTION(fclose);
35 PHP_FUNCTION(popen);
36 PHP_FUNCTION(pclose);
37 PHPAPI PHP_FUNCTION(feof);
38 PHPAPI PHP_FUNCTION(fread);
39 PHPAPI PHP_FUNCTION(fgetc);
40 PHPAPI PHP_FUNCTION(fgets);
41 PHP_FUNCTION(fscanf);
42 PHPAPI PHP_FUNCTION(fgetss);
43 PHP_FUNCTION(fgetcsv);
44 PHP_FUNCTION(fputcsv);
45 PHPAPI PHP_FUNCTION(fwrite);
46 PHPAPI PHP_FUNCTION(fflush);
47 PHPAPI PHP_FUNCTION(rewind);
48 PHPAPI PHP_FUNCTION(ftell);
49 PHPAPI PHP_FUNCTION(fseek);
50 PHP_FUNCTION(mkdir);
51 PHP_FUNCTION(rmdir);
52 PHPAPI PHP_FUNCTION(fpassthru);
53 PHP_FUNCTION(readfile);
54 PHP_FUNCTION(umask);
55 PHP_FUNCTION(rename);
56 PHP_FUNCTION(unlink);
57 PHP_FUNCTION(copy);
58 PHP_FUNCTION(file);
59 PHP_FUNCTION(file_get_contents);
60 PHP_FUNCTION(file_put_contents);
61 PHP_FUNCTION(get_meta_tags);
62 PHP_FUNCTION(flock);
63 PHP_FUNCTION(fd_set);
64 PHP_FUNCTION(fd_isset);
65 #if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
66 PHP_FUNCTION(realpath);
67 #endif
68 #ifdef HAVE_FNMATCH
69 PHP_FUNCTION(fnmatch);
70 #endif
71 PHP_NAMED_FUNCTION(php_if_ftruncate);
72 PHP_NAMED_FUNCTION(php_if_fstat);
73 PHP_FUNCTION(sys_get_temp_dir);
74
75 PHP_MINIT_FUNCTION(user_streams);
76
77 PHPAPI int php_le_stream_context(void);
78 PHPAPI int php_set_sock_blocking(php_socket_t socketd, int block);
79 PHPAPI int php_copy_file(const char *src, const char *dest);
80 PHPAPI int php_copy_file_ex(const char *src, const char *dest, int src_chk);
81 PHPAPI int php_copy_file_ctx(const char *src, const char *dest, int src_chk, php_stream_context *ctx);
82 PHPAPI int php_mkdir_ex(const char *dir, zend_long mode, int options);
83 PHPAPI int php_mkdir(const char *dir, zend_long mode);
84 PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value);
85 PHPAPI size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char);
86
87 #define META_DEF_BUFSIZE 8192
88
89 #define PHP_FILE_USE_INCLUDE_PATH 1
90 #define PHP_FILE_IGNORE_NEW_LINES 2
91 #define PHP_FILE_SKIP_EMPTY_LINES 4
92 #define PHP_FILE_APPEND 8
93 #define PHP_FILE_NO_DEFAULT_CONTEXT 16
94
95 typedef enum _php_meta_tags_token {
96 TOK_EOF = 0,
97 TOK_OPENTAG,
98 TOK_CLOSETAG,
99 TOK_SLASH,
100 TOK_EQUAL,
101 TOK_SPACE,
102 TOK_ID,
103 TOK_STRING,
104 TOK_OTHER
105 } php_meta_tags_token;
106
107 typedef struct _php_meta_tags_data {
108 php_stream *stream;
109 int ulc;
110 int lc;
111 char *input_buffer;
112 char *token_data;
113 int token_len;
114 int in_meta;
115 } php_meta_tags_data;
116
117 php_meta_tags_token php_next_meta_token(php_meta_tags_data *);
118
119 typedef struct {
120 int pclose_ret;
121 size_t def_chunk_size;
122 zend_long auto_detect_line_endings;
123 zend_long default_socket_timeout;
124 char *user_agent;
125 char *from_address;
126 const char *user_stream_current_filename;
127 php_stream_context *default_context;
128 HashTable *stream_wrappers;
129 HashTable *stream_filters;
130 HashTable *wrapper_errors;
131 int pclose_wait;
132 } php_file_globals;
133
134 #ifdef ZTS
135 #define FG(v) ZEND_TSRMG(file_globals_id, php_file_globals *, v)
136 extern PHPAPI int file_globals_id;
137 #else
138 #define FG(v) (file_globals.v)
139 extern PHPAPI php_file_globals file_globals;
140 #endif
141
142
143 #endif
144