From c705d707d91da1b545fe60cc34c49edc18d120ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Tue, 21 Aug 2001 09:27:41 +0000 Subject: [PATCH] * ensures each constant isn't already defined before to define it * renamed PMA_INT_VERSION to PHP_INT_VERSION --- db_details.php3 | 2 +- defines.inc.php3 | 91 +++++++++++++++++++++++++-------------------- tbl_properties.php3 | 2 +- 3 files changed, 53 insertions(+), 42 deletions(-) diff --git a/db_details.php3 b/db_details.php3 index 1327fedb6..ec92be98a 100755 --- a/db_details.php3 +++ b/db_details.php3 @@ -484,7 +484,7 @@ if ($num_tables > 0) { = 40004) { + if (PHP_INT_VERSION >= 40004) { $is_gzip = (isset($cfgGZipDump) && $cfgGZipDump && @function_exists('gzencode')); $is_bzip = (isset($cfgBZipDump) && $cfgBZipDump && @function_exists('bzcompress')); if ($is_gzip || $is_bzip) { diff --git a/defines.inc.php3 b/defines.inc.php3 index 8628a4acf..2cdc2c5bc 100755 --- a/defines.inc.php3 +++ b/defines.inc.php3 @@ -8,53 +8,64 @@ * MYSQL_MAJOR_VERSION (double) - eg: 3.23 * MYSQL_MINOR_VERSION (double) - eg: 39 * PHPMYADMIN_VERSION (string) - phpMyAdmin version string - * PMA_INT_VERSION (int) - eg: 30017 instead of 3.0.17 or + * PHP_INT_VERSION (int) - eg: 30017 instead of 3.0.17 or * 40006 instead of 4.0.6RC3 * PMA_WINDOWS (bool) - mark if phpMyAdmin running on windows * server */ -define('PHPMYADMIN_VERSION', '2.2.0rc5'); - -if (!ereg('([0-9]).([0-9]).([0-9])', phpversion(), $match)) { - $result = ereg('([0-9]).([0-9])', phpversion(), $match); +// phpMyAdmin release +if (!defined('PHPMYADMIN_VERSION')) { + define('PHPMYADMIN_VERSION', '2.2.0rc5'); } -if (isset($match) && !empty($match[1])) { - if (!isset($match[2])) { - $match[2] = 0; + +// php version +if (!defined('PHP_INT_VERSION')) { + if (!ereg('([0-9]).([0-9]).([0-9])', phpversion(), $match)) { + $result = ereg('([0-9]).([0-9])', phpversion(), $match); } - if (!isset($match[3])) { - $match[3] = 0; - } - define('PMA_INT_VERSION', (int)sprintf('%d%02d%02d', $match[1], $match[2], $match[3])); - unset($match); -} else { - define('PMA_INT_VERSION', FALSE); -} - -if (defined('PHP_OS') && eregi('win', PHP_OS)) { - define('PMA_WINDOWS', TRUE); -} else { - define('PMA_WINDOWS', FALSE); -} - -// MySQL Version -if (!empty($server)) { - $result = mysql_query('SELECT VERSION() AS version'); - if ($result != FALSE && @mysql_num_rows($result) > 0) { - $row = mysql_fetch_array($result); - define('MYSQL_MAJOR_VERSION', (double)substr($row['version'], 0, 4)); - define('MYSQL_MINOR_VERSION', (double)substr($row['version'], 5)); - } else { - $result = @mysql_query('SHOW VARIABLES LIKE \'version\''); - if ($result != FALSE && @mysql_num_rows($result) > 0){ - $row = mysql_fetch_row($result); - define('MYSQL_MAJOR_VERSION', (double)substr($row[1], 0, 4)); - define('MYSQL_MINOR_VERSION', (double)substr($row[1], 5)); + if (isset($match) && !empty($match[1])) { + if (!isset($match[2])) { + $match[2] = 0; } + if (!isset($match[3])) { + $match[3] = 0; + } + define('PHP_INT_VERSION', (int)sprintf('%d%02d%02d', $match[1], $match[2], $match[3])); + unset($match); + } else { + define('PHP_INT_VERSION', FALSE); } -} // end server id is defined case +} + +// Whether the os php is running on is windows or not +if (!defined('PMA_WINDOWS')) { + if (defined('PHP_OS') && eregi('win', PHP_OS)) { + define('PMA_WINDOWS', TRUE); + } else { + define('PMA_WINDOWS', FALSE); + } +} + +// MySQL Version if (!defined('MYSQL_MAJOR_VERSION')) { - define('MYSQL_MAJOR_VERSION', 3.21); - define('MYSQL_MINOR_VERSION', 0); -} // end if + if (!empty($server)) { + $result = mysql_query('SELECT VERSION() AS version'); + if ($result != FALSE && @mysql_num_rows($result) > 0) { + $row = mysql_fetch_array($result); + define('MYSQL_MAJOR_VERSION', (double)substr($row['version'], 0, 4)); + define('MYSQL_MINOR_VERSION', (double)substr($row['version'], 5)); + } else { + $result = @mysql_query('SHOW VARIABLES LIKE \'version\''); + if ($result != FALSE && @mysql_num_rows($result) > 0){ + $row = mysql_fetch_row($result); + define('MYSQL_MAJOR_VERSION', (double)substr($row[1], 0, 4)); + define('MYSQL_MINOR_VERSION', (double)substr($row[1], 5)); + } + } + } // end server id is defined case + if (!defined('MYSQL_MAJOR_VERSION')) { + define('MYSQL_MAJOR_VERSION', 3.21); + define('MYSQL_MINOR_VERSION', 0); + } // end if +} ?> diff --git a/tbl_properties.php3 b/tbl_properties.php3 index 3aa72f6d9..9f82921c5 100755 --- a/tbl_properties.php3 +++ b/tbl_properties.php3 @@ -708,7 +708,7 @@ echo "\n"; = 40004) { +if (PHP_INT_VERSION >= 40004) { $is_gzip = (isset($cfgGZipDump) && $cfgGZipDump && @function_exists('gzencode')); $is_bzip = (isset($cfgBZipDump) && $cfgBZipDump && @function_exists('bzcompress')); if ($is_gzip || $is_bzip) {