1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 5 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1997-2013 The PHP Group | 6 +----------------------------------------------------------------------+ 7 | This source file is subject to version 3.01 of the PHP license, | 8 | that is bundled with this package in the file LICENSE, and is | 9 | available through the world-wide-web at the following url: | 10 | http://www.php.net/license/3_01.txt | 11 | If you did not receive a copy of the PHP license and are unable to | 12 | obtain it through the world-wide-web, please send a note to | 13 | license@php.net so we can mail you a copy immediately. | 14 +----------------------------------------------------------------------+ 15 | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | 16 +----------------------------------------------------------------------+ 17 */ 18 19 /* $Id$ */ 20 21 /* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */ 22 23 #ifndef FILE_H 24 #define FILE_H 25 26 PHP_MINIT_FUNCTION(file); 27 PHP_MSHUTDOWN_FUNCTION(file); 28 29 PHP_FUNCTION(tempnam); 30 PHP_NAMED_FUNCTION(php_if_tmpfile); 31 PHP_NAMED_FUNCTION(php_if_fopen); 32 PHPAPI PHP_FUNCTION(fclose); 33 PHP_FUNCTION(popen); 34 PHP_FUNCTION(pclose); 35 PHPAPI PHP_FUNCTION(feof); 36 PHPAPI PHP_FUNCTION(fread); 37 PHPAPI PHP_FUNCTION(fgetc); 38 PHPAPI PHP_FUNCTION(fgets); 39 PHP_FUNCTION(fscanf); 40 PHPAPI PHP_FUNCTION(fgetss); 41 PHP_FUNCTION(fgetcsv); 42 PHP_FUNCTION(fputcsv); 43 PHPAPI PHP_FUNCTION(fwrite); 44 PHPAPI PHP_FUNCTION(fflush); 45 PHPAPI PHP_FUNCTION(rewind); 46 PHPAPI PHP_FUNCTION(ftell); 47 PHPAPI PHP_FUNCTION(fseek); 48 PHP_FUNCTION(mkdir); 49 PHP_FUNCTION(rmdir); 50 PHPAPI PHP_FUNCTION(fpassthru); 51 PHP_FUNCTION(readfile); 52 PHP_FUNCTION(umask); 53 PHP_FUNCTION(rename); 54 PHP_FUNCTION(unlink); 55 PHP_FUNCTION(copy); 56 PHP_FUNCTION(file); 57 PHP_FUNCTION(file_get_contents); 58 PHP_FUNCTION(file_put_contents); 59 PHP_FUNCTION(get_meta_tags); 60 PHP_FUNCTION(flock); 61 PHP_FUNCTION(fd_set); 62 PHP_FUNCTION(fd_isset); 63 #if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS) 64 PHP_FUNCTION(realpath); 65 #endif 66 #ifdef HAVE_FNMATCH 67 PHP_FUNCTION(fnmatch); 68 #endif 69 PHP_NAMED_FUNCTION(php_if_ftruncate); 70 PHP_NAMED_FUNCTION(php_if_fstat); 71 PHP_FUNCTION(sys_get_temp_dir); 72 73 PHP_MINIT_FUNCTION(user_streams); 74 75 PHPAPI int php_le_stream_context(void); 76 PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC); 77 PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC); 78 PHPAPI int php_copy_file_ex(char *src, char *dest, int src_chk TSRMLS_DC); 79 PHPAPI int php_copy_file_ctx(char *src, char *dest, int src_chk, php_stream_context *context TSRMLS_DC); 80 PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC); 81 PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC); 82 PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC); 83 84 #define META_DEF_BUFSIZE 8192 85 86 #define PHP_FILE_USE_INCLUDE_PATH 1 87 #define PHP_FILE_IGNORE_NEW_LINES 2 88 #define PHP_FILE_SKIP_EMPTY_LINES 4 89 #define PHP_FILE_APPEND 8 90 #define PHP_FILE_NO_DEFAULT_CONTEXT 16 91 92 typedef enum _php_meta_tags_token { 93 TOK_EOF = 0, 94 TOK_OPENTAG, 95 TOK_CLOSETAG, 96 TOK_SLASH, 97 TOK_EQUAL, 98 TOK_SPACE, 99 TOK_ID, 100 TOK_STRING, 101 TOK_OTHER 102 } php_meta_tags_token; 103 104 typedef struct _php_meta_tags_data { 105 php_stream *stream; 106 int ulc; 107 int lc; 108 char *input_buffer; 109 char *token_data; 110 int token_len; 111 int in_meta; 112 } php_meta_tags_data; 113 114 php_meta_tags_token php_next_meta_token(php_meta_tags_data * TSRMLS_DC); 115 116 typedef struct { 117 int pclose_ret; 118 size_t def_chunk_size; 119 long auto_detect_line_endings; 120 long default_socket_timeout; 121 char *user_agent; /* for the http wrapper */ 122 char *user_stream_current_filename; /* for simple recursion protection */ 123 php_stream_context *default_context; 124 HashTable *stream_wrappers; /* per-request copy of url_stream_wrappers_hash */ 125 HashTable *stream_filters; /* per-request copy of stream_filters_hash */ 126 HashTable *wrapper_errors; /* key: wrapper address; value: linked list of char* */ 127 } php_file_globals; 128 129 #ifdef ZTS 130 #define FG(v) TSRMG(file_globals_id, php_file_globals *, v) 131 extern PHPAPI int file_globals_id; 132 #else 133 #define FG(v) (file_globals.v) 134 extern PHPAPI php_file_globals file_globals; 135 #endif 136 137 138 #endif /* FILE_H */ 139 140