You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
6.2 KiB

27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
26 years ago
27 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2004 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.0 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_0.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. | Authors: Andi Gutmans <andi@zend.com> |
  16. | Zeev Suraski <zeev@zend.com> |
  17. +----------------------------------------------------------------------+
  18. */
  19. /* $Id$ */
  20. #ifndef BASIC_FUNCTIONS_H
  21. #define BASIC_FUNCTIONS_H
  22. #include <sys/stat.h>
  23. #ifdef HAVE_WCHAR_H
  24. #include <wchar.h>
  25. #endif
  26. #include "php_filestat.h"
  27. #include "zend_highlight.h"
  28. #include "url_scanner.h"
  29. #include "url_scanner_ex.h"
  30. extern zend_module_entry basic_functions_module;
  31. #define basic_functions_module_ptr &basic_functions_module
  32. PHP_MINIT_FUNCTION(basic);
  33. PHP_MSHUTDOWN_FUNCTION(basic);
  34. PHP_RINIT_FUNCTION(basic);
  35. PHP_RSHUTDOWN_FUNCTION(basic);
  36. PHP_MINFO_FUNCTION(basic);
  37. PHP_FUNCTION(constant);
  38. PHP_FUNCTION(toggle_short_open_tag);
  39. PHP_FUNCTION(sleep);
  40. PHP_FUNCTION(usleep);
  41. #if HAVE_NANOSLEEP
  42. PHP_FUNCTION(time_nanosleep);
  43. #endif
  44. PHP_FUNCTION(flush);
  45. PHP_FUNCTION(ip2long);
  46. PHP_FUNCTION(long2ip);
  47. /* system functions */
  48. PHP_FUNCTION(getenv);
  49. PHP_FUNCTION(putenv);
  50. PHP_FUNCTION(getopt);
  51. PHP_FUNCTION(get_current_user);
  52. PHP_FUNCTION(set_time_limit);
  53. PHP_FUNCTION(get_cfg_var);
  54. PHP_FUNCTION(set_magic_quotes_runtime);
  55. PHP_FUNCTION(get_magic_quotes_runtime);
  56. PHP_FUNCTION(get_magic_quotes_gpc);
  57. PHP_FUNCTION(import_request_variables);
  58. PHP_FUNCTION(error_log);
  59. PHP_FUNCTION(call_user_func);
  60. PHP_FUNCTION(call_user_func_array);
  61. PHP_FUNCTION(call_user_method);
  62. PHP_FUNCTION(call_user_method_array);
  63. PHP_FUNCTION(register_shutdown_function);
  64. PHP_FUNCTION(highlight_file);
  65. PHP_FUNCTION(highlight_string);
  66. PHP_FUNCTION(php_strip_whitespace);
  67. PHP_FUNCTION(php_check_syntax);
  68. ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini);
  69. PHP_FUNCTION(ini_get);
  70. PHP_FUNCTION(ini_get_all);
  71. PHP_FUNCTION(ini_set);
  72. PHP_FUNCTION(ini_restore);
  73. PHP_FUNCTION(get_include_path);
  74. PHP_FUNCTION(set_include_path);
  75. PHP_FUNCTION(restore_include_path);
  76. PHP_FUNCTION(print_r);
  77. PHP_FUNCTION(fprintf);
  78. PHP_FUNCTION(vfprintf);
  79. PHP_FUNCTION(connection_aborted);
  80. PHP_FUNCTION(connection_status);
  81. PHP_FUNCTION(ignore_user_abort);
  82. PHP_FUNCTION(getservbyname);
  83. PHP_FUNCTION(getservbyport);
  84. PHP_FUNCTION(getprotobyname);
  85. PHP_FUNCTION(getprotobynumber);
  86. PHP_NAMED_FUNCTION(php_if_crc32);
  87. PHP_FUNCTION(register_tick_function);
  88. PHP_FUNCTION(unregister_tick_function);
  89. PHP_FUNCTION(is_uploaded_file);
  90. PHP_FUNCTION(move_uploaded_file);
  91. /* From the INI parser */
  92. PHP_FUNCTION(parse_ini_file);
  93. PHP_FUNCTION(str_rot13);
  94. PHP_FUNCTION(stream_get_filters);
  95. PHP_FUNCTION(stream_filter_register);
  96. PHP_FUNCTION(stream_bucket_make_writeable);
  97. PHP_FUNCTION(stream_bucket_prepend);
  98. PHP_FUNCTION(stream_bucket_append);
  99. PHP_FUNCTION(stream_bucket_new);
  100. PHP_MINIT_FUNCTION(user_filters);
  101. PHP_RSHUTDOWN_FUNCTION(user_filters);
  102. PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC);
  103. #if SIZEOF_INT == 4
  104. /* Most 32-bit and 64-bit systems have 32-bit ints */
  105. typedef unsigned int php_uint32;
  106. typedef signed int php_int32;
  107. #elif SIZEOF_LONG == 4
  108. /* 16-bit systems? */
  109. typedef unsigned long php_uint32;
  110. typedef signed int php_int32;
  111. #else
  112. #error Need type which holds 32 bits
  113. #endif
  114. #define MT_N (624)
  115. typedef struct _php_basic_globals {
  116. HashTable *user_shutdown_function_names;
  117. HashTable putenv_ht;
  118. zval *strtok_zval;
  119. char *strtok_string;
  120. char *locale_string;
  121. char *strtok_last;
  122. char strtok_table[256];
  123. ulong strtok_len;
  124. char str_ebuf[40];
  125. zval **array_walk_func_name;
  126. zend_fcall_info_cache array_walk_fci_cache;
  127. zval **user_compare_func_name;
  128. zend_fcall_info_cache user_compare_fci_cache;
  129. zend_llist *user_tick_functions;
  130. zval *active_ini_file_section;
  131. HashTable sm_protected_env_vars;
  132. char *sm_allowed_env_vars;
  133. /* pageinfo.c */
  134. long page_uid;
  135. long page_gid;
  136. long page_inode;
  137. long page_mtime;
  138. /* filestat.c && main/streams/streams.c */
  139. char *CurrentStatFile, *CurrentLStatFile;
  140. php_stream_statbuf ssb, lssb;
  141. /* rand.c */
  142. php_uint32 state[MT_N+1]; /* state vector + 1 extra to not violate ANSI C */
  143. php_uint32 *next; /* next random value is computed from here */
  144. int left; /* can *next++ this many times before reloading */
  145. unsigned int rand_seed; /* Seed for rand(), in ts version */
  146. zend_bool rand_is_seeded; /* Whether rand() has been seeded */
  147. zend_bool mt_rand_is_seeded; /* Whether mt_rand() has been seeded */
  148. /* syslog.c */
  149. int syslog_started;
  150. char *syslog_device;
  151. /* var.c */
  152. zend_class_entry *incomplete_class;
  153. /* url_scanner.c */
  154. url_adapt_state_t url_adapt_state;
  155. /* url_scanner_ex.re */
  156. url_adapt_state_ex_t url_adapt_state_ex;
  157. #ifdef HAVE_MMAP
  158. void *mmap_file;
  159. size_t mmap_len;
  160. #endif
  161. HashTable *user_filter_map;
  162. /* file.c */
  163. #if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
  164. mbstate_t mblen_state;
  165. #endif
  166. } php_basic_globals;
  167. #ifdef ZTS
  168. #define BG(v) TSRMG(basic_globals_id, php_basic_globals *, v)
  169. extern int basic_globals_id;
  170. #else
  171. #define BG(v) (basic_globals.v)
  172. extern php_basic_globals basic_globals;
  173. #endif
  174. #if HAVE_PUTENV
  175. typedef struct {
  176. char *putenv_string;
  177. char *previous_value;
  178. char *key;
  179. int key_len;
  180. } putenv_entry;
  181. #endif
  182. /* Values are comma-delimited
  183. */
  184. #define SAFE_MODE_PROTECTED_ENV_VARS "LD_LIBRARY_PATH"
  185. #define SAFE_MODE_ALLOWED_ENV_VARS "PHP_"
  186. PHPAPI double php_get_nan();
  187. PHPAPI double php_get_inf();
  188. #endif /* BASIC_FUNCTIONS_H */