3 // vim: expandtab sw=4 ts=4 sts=4:
6 * DEFINES VARIABLES & CONSTANTS
8 * PMA_VERSION (string) - phpMyAdmin version string
9 * PMA_PHP_INT_VERSION (int) - eg: 30017 instead of 3.0.17 or
10 * 40006 instead of 4.0.6RC3
11 * PMA_MYSQL_CLIENT_API (int) - the version number of the MySQL client
12 * API which php is built against.
13 * PMA_IS_WINDOWS (bool) - mark if phpMyAdmin running on windows
15 * PMA_IS_GD2 (bool) - true is GD2 is present
18 if (!defined('PMA_VERSION')) {
19 define('PMA_VERSION', '2.5.1');
23 if (!defined('PMA_PHP_INT_VERSION')) {
24 if (!ereg('([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})', phpversion(), $match)) {
25 $result = ereg('([0-9]{1,2}).([0-9]{1,2})', phpversion(), $match);
27 if (isset($match) && !empty($match[1])) {
28 if (!isset($match[2])) {
31 if (!isset($match[3])) {
34 define('PMA_PHP_INT_VERSION', (int)sprintf('%d%02d%02d', $match[1], $match[2], $match[3]));
37 define('PMA_PHP_INT_VERSION', 0);
39 define('PMA_PHP_STR_VERSION', phpversion());
43 if (!defined('PMA_MYSQL_CLIENT_API')) {
44 if (function_exists('mysql_get_client_info')) {
45 $client_api = mysql_get_client_info();
47 // for compatibility with php <= 4.0.5
49 $client_api = '3.21.0';
51 $client_api = explode('.', $client_api);
52 define('PMA_MYSQL_CLIENT_API', (int)sprintf('%d%02d%02d', $client_api[0], $client_api[1], intval($client_api[2])));
56 // Whether the os php is running on is windows or not
57 if (!defined('PMA_IS_WINDOWS')) {
58 if (defined('PHP_OS') && eregi('win', PHP_OS
)) {
59 define('PMA_IS_WINDOWS', 1);
61 define('PMA_IS_WINDOWS', 0);
65 // Whether GD2 is present
66 if (!defined('PMA_IS_GD2')) {
67 if ($cfg['GD2Available'] == 'yes') {
68 define('PMA_IS_GD2', 1);
69 } elseif ($cfg['GD2Available'] == 'no') {
70 define('PMA_IS_GD2', 0);
72 if (((PMA_PHP_INT_VERSION
>= 40000 && !@ini_get
('safe_mode') && @ini_get
('enable_dl'))
73 ||
(PMA_PHP_INT_VERSION
< 40000 && PMA_PHP_INT_VERSION
> 30009 && !@get_cfg_var
('safe_mode')))
74 && @function_exists
('dl')) {
80 if (!@extension_loaded
('gd')) {
84 if (!@function_exists
('imagecreatetruecolor')) {
85 define('PMA_IS_GD2', 0);
87 if (@function_exists
('gd_info')) {
89 if (strstr($gd_nfo["GD Version"], '2.')) {
90 define('PMA_IS_GD2', 1);
92 define('PMA_IS_GD2', 0);
95 /* We must do hard way... */
97 phpinfo(8); /* Only modules */
98 $a = ob_get_contents();
100 /* Get GD version string from phpinfo output */
101 if (ereg('<tr><td[^>]*>[^>]*GD Version[^<]*</td><td[^>]*>\([^<]*\)</td></tr>', $a, $v)) {
102 if (strstr($v, '2.')) {
103 define('PMA_IS_GD2', 1);
105 define('PMA_IS_GD2', 0);
108 define('PMA_IS_GD2', 0);
114 // $__PMA_DEFINES_PHP_LIB__