1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 5                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2005 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: Derick Rethans <derick@php.net>                             |
16   +----------------------------------------------------------------------+
17 */
18 
19 /* $Id: timezonedb.c 337508 2015-08-16 21:57:34Z derick $ */
20 
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24 
25 #include "php.h"
26 #include "ext/standard/info.h"
27 
28 #include "php_timezonedb.h"
29 
30 #include "ext/date/php_date.h"
31 
32 #define  timezonedb_builtin timezonedb_external
33 #define  timezonedb_idx_builtin timezonedb_idx_external
34 #define  timelib_timezone_db_data_builtin timelib_timezone_db_data_external
35 
36 #if PHP_VERSION_ID >= 50441 && PHP_VERSION_ID <= 50499
37 # define TIMELIB_SUPPORTS_V2DATA
38 #endif
39 #if PHP_VERSION_ID >= 50525 && PHP_VERSION_ID <= 50599
40 # define TIMELIB_SUPPORTS_V2DATA
41 #endif
42 #if PHP_VERSION_ID >= 50609 && PHP_VERSION_ID <= 50699
43 # define TIMELIB_SUPPORTS_V2DATA
44 #endif
45 #if PHP_VERSION_ID >= 70000
46 # define TIMELIB_SUPPORTS_V2DATA
47 #endif
48 
49 #include "timezonedb.h"
50 
51 /* {{{ timezonedb_functions[]
52  */
53 zend_function_entry timezonedb_functions[] = {
54 	{NULL, NULL, NULL}
55 };
56 /* }}} */
57 
58 /* {{{ timezonedb dependencies */
59 #if ZEND_MODULE_API_NO >= 20050922
60 static const zend_module_dep timezonedb_module_deps[] = {
61 	ZEND_MOD_REQUIRED("standard")
62 	ZEND_MOD_REQUIRED("date")
63 	{NULL, NULL, NULL}
64 };
65 #endif
66 /* }}} */
67 /* {{{ timezonedb_module_entry
68  */
69 zend_module_entry timezonedb_module_entry = {
70 #if ZEND_MODULE_API_NO >= 20050922
71 	STANDARD_MODULE_HEADER_EX, NULL,
72 	timezonedb_module_deps,
73 #else
74 	STANDARD_MODULE_HEADER,
75 #endif
76 	"timezonedb",
77 	timezonedb_functions,
78 	PHP_MINIT(timezonedb),
79 	NULL,
80 	NULL,
81 	NULL,
82 	PHP_MINFO(timezonedb),
83 	PHP_TIMEZONEDB_VERSION,
84 	STANDARD_MODULE_PROPERTIES
85 };
86 /* }}} */
87 
88 #ifdef COMPILE_DL_TIMEZONEDB
89 ZEND_GET_MODULE(timezonedb)
90 #endif
91 
92 /* {{{ PHP_MINIT_FUNCTION
93  */
PHP_MINIT_FUNCTION(timezonedb)94 PHP_MINIT_FUNCTION(timezonedb)
95 {
96 	php_date_set_tzdb(&timezonedb_external);
97 	return SUCCESS;
98 }
99 /* }}} */
100 
101 /* {{{ PHP_MSHUTDOWN_FUNCTION
102  */
PHP_MSHUTDOWN_FUNCTION(timezonedb)103 PHP_MSHUTDOWN_FUNCTION(timezonedb)
104 {
105 	return SUCCESS;
106 }
107 /* }}} */
108 
109 /* {{{ PHP_MINFO_FUNCTION
110  */
PHP_MINFO_FUNCTION(timezonedb)111 PHP_MINFO_FUNCTION(timezonedb)
112 {
113 	timelib_tzdb *tzdb = &timezonedb_external;
114 
115 	php_info_print_table_start();
116 	php_info_print_table_row(2, "Alternative Timezone Database", "enabled");
117 	php_info_print_table_row(2, "Timezone Database Version", tzdb->version);
118 	php_info_print_table_end();
119 }
120 /* }}} */
121 
122 /*
123  * Local variables:
124  * tab-width: 4
125  * c-basic-offset: 4
126  * End:
127  * vim600: noet sw=4 ts=4 fdm=marker
128  * vim<600: noet sw=4 ts=4
129  */
130