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_IS_WINDOWS (bool) - mark if phpMyAdmin running on windows
13 * PMA_MYSQL_INT_VERSION (int) - eg: 32339 instead of 3.23.39
14 * PMA_USR_OS (string) - the plateform (os) of the user
15 * PMA_USR_BROWSER_AGENT (string) - the browser of the user
16 * PMA_USR_BROWSER_VER (double) - the version of this browser
19 if (!defined('PMA_VERSION')) {
20 define('PMA_VERSION', '2.2.4');
24 if (!defined('PMA_PHP_INT_VERSION')) {
25 if (!ereg('([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})', phpversion(), $match)) {
26 $result = ereg('([0-9]{1,2}).([0-9]{1,2})', phpversion(), $match);
28 if (isset($match) && !empty($match[1])) {
29 if (!isset($match[2])) {
32 if (!isset($match[3])) {
35 define('PMA_PHP_INT_VERSION', (int)sprintf('%d%02d%02d', $match[1], $match[2], $match[3]));
38 define('PMA_PHP_INT_VERSION', 0);
42 // Whether the os php is running on is windows or not
43 if (!defined('PMA_IS_WINDOWS')) {
44 if (defined('PHP_OS') && eregi('win', PHP_OS
)) {
45 define('PMA_IS_WINDOWS', 1);
47 define('PMA_IS_WINDOWS', 0);
52 if (!defined('PMA_MYSQL_INT_VERSION') && isset($userlink)) {
53 if (!empty($server)) {
54 $result = mysql_query('SELECT VERSION() AS version');
55 if ($result != FALSE && @mysql_num_rows
($result) > 0) {
56 $row = mysql_fetch_array($result);
57 $match = explode('.', $row['version']);
59 $result = @mysql_query
('SHOW VARIABLES LIKE \'version\'');
60 if ($result != FALSE && @mysql_num_rows
($result) > 0){
61 $row = mysql_fetch_row($result);
62 $match = explode('.', $row[1]);
65 } // end server id is defined case
67 if (!isset($match) ||
!isset($match[0])) {
70 if (!isset($match[1])) {
73 if (!isset($match[2])) {
77 define('PMA_MYSQL_INT_VERSION', (int)sprintf('%d%02d%02d', $match[0], $match[1], intval($match[2])));
82 // Determines platform (OS), browser and version of the user
83 // Based on a phpBuilder article:
84 // see http://www.phpbuilder.net/columns/tim20000821.php3
85 if (!defined('PMA_USR_OS')) {
86 // loic1 - 2001/25/11: use the new globals arrays defined with
88 if (!empty($_SERVER['HTTP_USER_AGENT'])) {
89 $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
90 } else if (!empty($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
91 $HTTP_USER_AGENT = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
92 } else if (!isset($HTTP_USER_AGENT)) {
93 $HTTP_USER_AGENT = '';
97 if (strstr($HTTP_USER_AGENT, 'Win')) {
98 define('PMA_USR_OS', 'Win');
99 } else if (strstr($HTTP_USER_AGENT, 'Mac')) {
100 define('PMA_USR_OS', 'Mac');
101 } else if (strstr($HTTP_USER_AGENT, 'Linux')) {
102 define('PMA_USR_OS', 'Linux');
103 } else if (strstr($HTTP_USER_AGENT, 'Unix')) {
104 define('PMA_USR_OS', 'Unix');
105 } else if (strstr($HTTP_USER_AGENT, 'OS/2')) {
106 define('PMA_USR_OS', 'OS/2');
108 define('PMA_USR_OS', 'Other');
111 // 2. browser and version
112 if (ereg('MSIE ([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
113 define('PMA_USR_BROWSER_VER', $log_version[1]);
114 define('PMA_USR_BROWSER_AGENT', 'IE');
115 } else if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
116 define('PMA_USR_BROWSER_VER', $log_version[2]);
117 define('PMA_USR_BROWSER_AGENT', 'OPERA');
118 } else if (ereg('OmniWeb/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
119 define('PMA_USR_BROWSER_VER', $log_version[1]);
120 define('PMA_USR_BROWSER_AGENT', 'OMNIWEB');
121 } else if (ereg('Mozilla/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
122 define('PMA_USR_BROWSER_VER', $log_version[1]);
123 define('PMA_USR_BROWSER_AGENT', 'MOZILLA');
124 } else if (ereg('Konqueror/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
125 define('PMA_USR_BROWSER_VER', $log_version[1]);
126 define('PMA_USR_BROWSER_AGENT', 'KONQUEROR');
128 define('PMA_USR_BROWSER_VER', 0);
129 define('PMA_USR_BROWSER_AGENT', 'OTHER');
131 } // $__PMA_DEFINES_LIB__