/libraries cleanup hopefully done. Double-Checked every change, my installation still works. ;)

Will continue working on remaining files tomorrow and hope to make it to the end of the next day.
This commit is contained in:
Garvin Hicking
2003-11-20 16:31:51 +00:00
parent 5936e8300f
commit f0da471ec3
50 changed files with 315 additions and 679 deletions

View File

@@ -21,7 +21,8 @@ $Source$
* lang/indonesian: Updated, thanks to Rachim Tamsjadi (tamsy). * lang/indonesian: Updated, thanks to Rachim Tamsjadi (tamsy).
2003-11-20 Garvin Hicking <me@supergarv.de> 2003-11-20 Garvin Hicking <me@supergarv.de>
* libraries/auth/*, libraries/dbg/*, libraries/export/* * libraries/auth/*, libraries/dbg/*, libraries/export/*, libraries/fpdf/*,
libraries/transformations/overview.php, libraries/*.php
(work in progress) (work in progress)
Lots of PHP < 4.1.0 / MySQL < 3.23.32 compatibility/performance changes: Lots of PHP < 4.1.0 / MySQL < 3.23.32 compatibility/performance changes:
@@ -30,9 +31,14 @@ $Source$
- Removed calls to $HTTP_*_VARS (using $_* now). - Removed calls to $HTTP_*_VARS (using $_* now).
- Replaced some TAB-characters with whitespace - Replaced some TAB-characters with whitespace
- Removed PHP4 < 4.1.0 compatibility code - Removed PHP4 < 4.1.0 compatibility code
- Removed MySQL < 3.23.32 compatibility code
- Replaced "for ($i=0; $i <= count(); $i++)" loops to - Replaced "for ($i=0; $i <= count(); $i++)" loops to
"$cnt = count(); for ($i=0; $i <= $cnt; $i++)" structures for better "$cnt = count(); for ($i=0; $i <= $cnt; $i++)" structures for better
performance performance
- Replace calls to eregi*/split functions to their preg* counterparts for
faster and binary-safe operation
- Replace regex-Calls to simple string functions where possible (speedup)
- Replace calls to substr($string, X, 1) to $string{X}
2003-11-19 Marc Delisle <lem9@users.sourceforge.net> 2003-11-19 Marc Delisle <lem9@users.sourceforge.net>
* libraries/display_tbl.lib.php: first group of headers was offset by * libraries/display_tbl.lib.php: first group of headers was offset by

View File

@@ -21,14 +21,6 @@ PMA_checkParameters(array('db'));
*/ */
$err_url = 'main.php?' . PMA_generate_common_url(); $err_url = 'main.php?' . PMA_generate_common_url();
/**
* Ensures the db name is valid
*/
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($db, $err_url);
}
/** /**
* Executes the db creation sql query * Executes the db creation sql query
*/ */

View File

@@ -150,16 +150,16 @@ h1 {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo
if (empty($PHP_AUTH_USER) && empty($PHP_AUTH_PW) if (empty($PHP_AUTH_USER) && empty($PHP_AUTH_PW)
&& function_exists('base64_decode')) { && function_exists('base64_decode')) {
if (!empty($HTTP_AUTHORIZATION) if (!empty($HTTP_AUTHORIZATION)
&& ereg('^Basic ', $HTTP_AUTHORIZATION)) { && substr($HTTP_AUTHORIZATION, 0, 6) == 'Basic ') {
list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr($HTTP_AUTHORIZATION, 6))); list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr($HTTP_AUTHORIZATION, 6)));
} }
else if (!empty($_ENV) else if (!empty($_ENV)
&& isset($_ENV['HTTP_AUTHORIZATION']) && isset($_ENV['HTTP_AUTHORIZATION'])
&& ereg('^Basic ', $_ENV['HTTP_AUTHORIZATION'])) { && substr($_ENV['HTTP_AUTHORIZATION'], 0, 6) == 'Basic ') {
list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr($_ENV['HTTP_AUTHORIZATION'], 6))); list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr($_ENV['HTTP_AUTHORIZATION'], 6)));
} }
else if (@getenv('HTTP_AUTHORIZATION') else if (@getenv('HTTP_AUTHORIZATION')
&& ereg('^Basic ', getenv('HTTP_AUTHORIZATION'))) { && substr(getenv('HTTP_AUTHORIZATION'), 0, 6) == 'Basic ') {
list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr(getenv('HTTP_AUTHORIZATION'), 6))); list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr(getenv('HTTP_AUTHORIZATION'), 6)));
} }
} // end IIS } // end IIS

View File

@@ -155,8 +155,7 @@ if (!defined('PMA_CHARSET_CONVERSION_LIB_INCLUDED')){
} }
else if (is_array($what)) { else if (is_array($what)) {
$result = array(); $result = array();
reset($what); foreach($what AS $key => $val) {
while (list($key, $val) = each($what)) {
if (is_string($val) || is_array($val)) { if (is_string($val) || is_array($val)) {
if (is_string($key)) { if (is_string($key)) {
$result[PMA_convert_display_charset($key)] = PMA_convert_display_charset($val); $result[PMA_convert_display_charset($key)] = PMA_convert_display_charset($val);

View File

@@ -63,7 +63,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')) {
} }
/** /**
* Avoids undefined variables in PHP3 * Avoids undefined variables
*/ */
if (!isset($use_backquotes)) { if (!isset($use_backquotes)) {
$use_backquotes = 0; $use_backquotes = 0;
@@ -173,30 +173,12 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
/** /**
* Define $is_upload * Define $is_upload
*/ */
//$is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
// ? ((strtolower(ini_get('file_uploads')) == 'on' || ini_get('file_uploads') == 1) && intval(ini_get('upload_max_filesize')))
// loic1: php 3.0.15 and lower bug -> always enabled
// : (PMA_PHP_INT_VERSION < 30016 || intval(@get_cfg_var('upload_max_filesize')));
// Note: PHP <40300 returns TRUE for function_exists, even
// if the function is disabled;
// PHP < 30016 had problems with get_cfg_var;
// so if we cannot detect that uploads
// are disabled, we assume they are enabled
$is_upload = TRUE; $is_upload = TRUE;
if (PMA_PHP_INT_VERSION >= 40000 if (strtolower(@ini_get('file_uploads')) == 'off'
&& function_exists('ini_get') || @ini_get('file_uploads') == 0) {
&& (strtolower(@ini_get('file_uploads')) == 'off'
|| @ini_get('file_uploads') == 0)) {
$is_upload = FALSE; $is_upload = FALSE;
} }
if (PMA_PHP_INT_VERSION >= 30016
&& PMA_PHP_INT_VERSION < 40000
&& !intval(@get_cfg_var('upload_max_filesize'))) {
$is_upload = FALSE;
}
/** /**
* Charset conversion. * Charset conversion.
@@ -242,8 +224,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
// If zlib output compression is set in the php configuration file, no // If zlib output compression is set in the php configuration file, no
// output buffering should be run // output buffering should be run
if (PMA_PHP_INT_VERSION < 40000 if (@ini_get('zlib.output_compression')) {
|| (PMA_PHP_INT_VERSION >= 40005 && @ini_get('zlib.output_compression'))) {
$cfg['OBGzip'] = FALSE; $cfg['OBGzip'] = FALSE;
} }
@@ -262,17 +243,11 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
*/ */
include('./libraries/url_generating.lib.php'); include('./libraries/url_generating.lib.php');
/** /**
* Loads the mysql extensions if it is not loaded yet * Loads the mysql extensions if it is not loaded yet
*/ */
if (!@function_exists('mysql_connect')) { if (!@function_exists('mysql_connect')) {
if (PMA_PHP_INT_VERSION < 40000) { PMA_dl('mysql');
$extension = 'MySQL';
} else {
$extension = 'mysql';
}
PMA_dl($extension);
} }
// check whether mysql is available // check whether mysql is available
@@ -320,26 +295,6 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
} // end of the 'PMA_sqlAddslashes()' function } // end of the 'PMA_sqlAddslashes()' function
if (!function_exists('in_array')) {
/**
* Searches $haystack for $needle and returns TRUE if it is found in
* the array, FALSE otherwise.
*
* @param mixed the 'needle'
* @param array the 'haystack'
*
* @return boolean has $needle been found or not?
*/
function in_array($needle, $haystack) {
while (list(, $value) = each($haystack)) {
if ($value == $haystack) {
return TRUE;
}
}
return FALSE;
}
}
/** /**
* Add slashes before "_" and "%" characters for using them in MySQL * Add slashes before "_" and "%" characters for using them in MySQL
* database, table and field names. * database, table and field names.
@@ -527,7 +482,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
} // end if } // end if
if (!empty($error_message)) { if (!empty($error_message)) {
$error_message = htmlspecialchars($error_message); $error_message = htmlspecialchars($error_message);
$error_message = ereg_replace("((\015\012)|(\015)|(\012)){3,}", "\n\n", $error_message); $error_message = preg_replace("@((\015\012)|(\015)|(\012)){3,}@", "\n\n", $error_message);
} }
echo '<p>' . "\n" echo '<p>' . "\n"
. ' ' . $GLOBALS['strMySQLSaid'] . '<br />' . "\n" . ' ' . $GLOBALS['strMySQLSaid'] . '<br />' . "\n"
@@ -603,7 +558,6 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
if ($only_db_check == FALSE) { if ($only_db_check == FALSE) {
// ... first checks whether the "safe_show_database" is on or not // ... first checks whether the "safe_show_database" is on or not
// (if MYSQL supports this) // (if MYSQL supports this)
if (PMA_MYSQL_INT_VERSION >= 32330) {
$is_safe_show_dbs = FALSE; $is_safe_show_dbs = FALSE;
if (PMA_MYSQL_INT_VERSION >= 40002) { if (PMA_MYSQL_INT_VERSION >= 40002) {
$is_safe_show_dbs = 'ON'; $is_safe_show_dbs = 'ON';
@@ -624,7 +578,6 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$dblist_cnt = count($dblist); $dblist_cnt = count($dblist);
unset($uva_alldbs); unset($uva_alldbs);
} // end if ($is_safe_show_dbs) } // end if ($is_safe_show_dbs)
} //end if (PMA_MYSQL_INT_VERSION)
// ... else checks for available databases in the "mysql" db // ... else checks for available databases in the "mysql" db
if (!$dblist_cnt) { if (!$dblist_cnt) {
@@ -694,16 +647,15 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$dblist[] = $uva_db; $dblist[] = $uva_db;
$uva_mydbs[$uva_db] = 0; $uva_mydbs[$uva_db] = 0;
} else if (!isset($dblist[$uva_db])) { } else if (!isset($dblist[$uva_db])) {
reset($uva_mydbs); foreach($uva_mydbs AS $uva_matchpattern => $uva_value) {
while (list($uva_matchpattern, $uva_value) = each($uva_mydbs)) {
// loic1: fixed bad regexp // loic1: fixed bad regexp
// TODO: db names may contain characters // TODO: db names may contain characters
// that are regexp instructions // that are regexp instructions
$re = '(^|(\\\\\\\\)+|[^\])'; $re = '@(^|(\\\\\\\\)+|[^\])';
$uva_regex = ereg_replace($re . '%', '\\1.*', ereg_replace($re . '_', '\\1.{1}', $uva_matchpattern)); $uva_regex = preg_replace($re . '%@', '\\1.*', preg_replace($re . '_@', '\\1.{1}', $uva_matchpattern));
// Fixed db name matching // Fixed db name matching
// 2000-08-28 -- Benjamin Gandon // 2000-08-28 -- Benjamin Gandon
if (ereg('^' . $uva_regex . '$', $uva_db)) { if (preg_match('@^' . $uva_regex . '$@', $uva_db)) {
$dblist[] = $uva_db; $dblist[] = $uva_db;
break; break;
} }
@@ -834,8 +786,6 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
if (empty($cfg['PmaAbsoluteUri'])) { if (empty($cfg['PmaAbsoluteUri'])) {
if (!empty($_SERVER)) { if (!empty($_SERVER)) {
$SERVER_ARRAY = '_SERVER'; $SERVER_ARRAY = '_SERVER';
} else if (!empty($HTTP_SERVER_VARS)) {
$SERVER_ARRAY = 'HTTP_SERVER_VARS';
} else { } else {
$SERVER_ARRAY = 'GLOBALS'; $SERVER_ARRAY = 'GLOBALS';
} // end if } // end if
@@ -906,8 +856,6 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
if (substr($cfg['PmaAbsoluteUri'], 0, 7) != 'http://' && substr($cfg['PmaAbsoluteUri'], 0, 8) != 'https://') { if (substr($cfg['PmaAbsoluteUri'], 0, 7) != 'http://' && substr($cfg['PmaAbsoluteUri'], 0, 8) != 'https://') {
if (!empty($_SERVER)) { if (!empty($_SERVER)) {
$SERVER_ARRAY = '_SERVER'; $SERVER_ARRAY = '_SERVER';
} else if (!empty($HTTP_SERVER_VARS)) {
$SERVER_ARRAY = 'HTTP_SERVER_VARS';
} else { } else {
$SERVER_ARRAY = 'GLOBALS'; $SERVER_ARRAY = 'GLOBALS';
} // end if } // end if
@@ -932,8 +880,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
/** /**
* Gets the valid servers list and parameters * Gets the valid servers list and parameters
*/ */
reset($cfg['Servers']); foreach($cfg['Servers'] AS $key => $val) {
while (list($key, $val) = each($cfg['Servers'])) {
// Don't use servers with no hostname // Don't use servers with no hostname
if ( ($val['connect_type'] == 'tcp') && empty($val['host'])) { if ( ($val['connect_type'] == 'tcp') && empty($val['host'])) {
unset($cfg['Servers'][$key]); unset($cfg['Servers'][$key]);
@@ -980,10 +927,10 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
if (strtolower($cfg['Server']['connect_type']) == 'tcp') { if (strtolower($cfg['Server']['connect_type']) == 'tcp') {
$cfg['Server']['socket'] = ''; $cfg['Server']['socket'] = '';
} }
$server_socket = (empty($cfg['Server']['socket']) || PMA_PHP_INT_VERSION < 30010) $server_socket = (empty($cfg['Server']['socket']))
? '' ? ''
: ':' . $cfg['Server']['socket']; : ':' . $cfg['Server']['socket'];
if (PMA_PHP_INT_VERSION >= 40300 && PMA_MYSQL_CLIENT_API >= 32349) { if (PMA_MYSQL_CLIENT_API >= 32349) {
$client_flags = $cfg['Server']['compress'] && defined('MYSQL_CLIENT_COMPRESS') ? MYSQL_CLIENT_COMPRESS : 0; $client_flags = $cfg['Server']['compress'] && defined('MYSQL_CLIENT_COMPRESS') ? MYSQL_CLIENT_COMPRESS : 0;
} }
@@ -1050,9 +997,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
} }
} // end if } // end if
if (PMA_PHP_INT_VERSION >= 40000) {
$bkp_track_err = @ini_set('track_errors', 1); $bkp_track_err = @ini_set('track_errors', 1);
}
// Try to connect MySQL with the control user profile (will be used to // Try to connect MySQL with the control user profile (will be used to
// get the privileges list for the current user but the true user link // get the privileges list for the current user but the true user link
@@ -1122,9 +1067,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
// Pass #2 of DB-Config to read in user level DB-Config will go here // Pass #2 of DB-Config to read in user level DB-Config will go here
// Robbat2 - May 11, 2002 // Robbat2 - May 11, 2002
if (PMA_PHP_INT_VERSION >= 40000) {
@ini_set('track_errors', $bkp_track_err); @ini_set('track_errors', $bkp_track_err);
}
// If controluser isn't defined, use the current user settings to get // If controluser isn't defined, use the current user settings to get
// his rights // his rights
@@ -1150,7 +1093,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
if ($dblist[$i] == '*' && $dblist_asterisk_bool == FALSE) { if ($dblist[$i] == '*' && $dblist_asterisk_bool == FALSE) {
$dblist_asterisk_bool = TRUE; $dblist_asterisk_bool = TRUE;
$dblist_full = PMA_safe_db_list(FALSE, $dbh, FALSE, $rs, $userlink, $cfg, $dblist); $dblist_full = PMA_safe_db_list(FALSE, $dbh, FALSE, $rs, $userlink, $cfg, $dblist);
while(list($dbl_key, $dbl_val) = each($dblist_full)) { foreach($dblist_full AS $dbl_key => $dbl_val) {
if (!in_array($dbl_val, $dblist)) { if (!in_array($dbl_val, $dblist)) {
$true_dblist[] = $dbl_val; $true_dblist[] = $dbl_val;
} }
@@ -1162,7 +1105,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
continue; continue;
} }
if ($is_show_dbs && ereg('(^|[^\])(_|%)', $dblist[$i])) { if ($is_show_dbs && preg_match('@(^|[^\])(_|%)@', $dblist[$i])) {
$local_query = 'SHOW DATABASES LIKE \'' . $dblist[$i] . '\''; $local_query = 'SHOW DATABASES LIKE \'' . $dblist[$i] . '\'';
$rs = PMA_mysql_query($local_query, $dbh); $rs = PMA_mysql_query($local_query, $dbh);
// "SHOW DATABASES" statement is disabled // "SHOW DATABASES" statement is disabled
@@ -1286,13 +1229,11 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
function PMA_backquote($a_name, $do_it = TRUE) function PMA_backquote($a_name, $do_it = TRUE)
{ {
if ($do_it if ($do_it
&& PMA_MYSQL_INT_VERSION >= 32306
&& !empty($a_name) && $a_name != '*') { && !empty($a_name) && $a_name != '*') {
if (is_array($a_name)) { if (is_array($a_name)) {
$result = array(); $result = array();
reset($a_name); foreach($a_name AS $key => $val) {
while(list($key, $val) = each($a_name)) {
$result[$key] = '`' . $val . '`'; $result[$key] = '`' . $val . '`';
} }
return $result; return $result;
@@ -1378,14 +1319,13 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
function PMA_countRecords($db, $table, $ret = FALSE) function PMA_countRecords($db, $table, $ret = FALSE)
{ {
global $err_url, $cfg; global $err_url, $cfg;
if (PMA_MYSQL_INT_VERSION >= 32303) {
$local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''; $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'';
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$showtable = PMA_mysql_fetch_array($result); $showtable = PMA_mysql_fetch_array($result);
$num = (isset($showtable['Rows']) ? $showtable['Rows'] : 0); $num = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
if ($num < $cfg['MaxExactCount']) unset($num); if ($num < $cfg['MaxExactCount']) unset($num);
mysql_free_result($result); mysql_free_result($result);
}
if (!isset($num)) { if (!isset($num)) {
$result = PMA_mysql_query('SELECT COUNT(*) AS num FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table)) or PMA_mysqlDie('', $local_query, '', $err_url); $result = PMA_mysql_query('SELECT COUNT(*) AS num FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table)) or PMA_mysqlDie('', $local_query, '', $err_url);
$num = ($result) ? PMA_mysql_result($result, 0, 'num') : 0; $num = ($result) ? PMA_mysql_result($result, 0, 'num') : 0;
@@ -1431,7 +1371,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
} }
// Corrects the tooltip text via JS if required // Corrects the tooltip text via JS if required
else if (!empty($GLOBALS['table']) && $cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303) { else if (!empty($GLOBALS['table']) && $cfg['ShowTooltip']) {
$result = @PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\''); $result = @PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
if ($result) { if ($result) {
$tbl_status = PMA_mysql_fetch_array($result, MYSQL_ASSOC); $tbl_status = PMA_mysql_fetch_array($result, MYSQL_ASSOC);
@@ -1460,8 +1400,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
} // end if... else if } // end if... else if
// Checks if the table needs to be repaired after a TRUNCATE query. // Checks if the table needs to be repaired after a TRUNCATE query.
if (PMA_MYSQL_INT_VERSION >= 40000 if (isset($GLOBALS['table']) && isset($GLOBALS['sql_query'])
&& isset($GLOBALS['table']) && isset($GLOBALS['sql_query'])
&& $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) { && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
if (!isset($tbl_status)) { if (!isset($tbl_status)) {
$result = @PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\''); $result = @PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
@@ -1509,7 +1448,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
/* SQL-Parser-Analyzer */ /* SQL-Parser-Analyzer */
$query_base = PMA_sqlAddslashes(htmlspecialchars($local_query)); $query_base = PMA_sqlAddslashes(htmlspecialchars($local_query));
/* SQL-Parser-Analyzer */ /* SQL-Parser-Analyzer */
$query_base = ereg_replace("((\015\012)|(\015)|(\012))+", $new_line, $query_base); $query_base = preg_replace("@((\015\012)|(\015)|(\012))+@", $new_line, $query_base);
} else { } else {
$query_base = $local_query; $query_base = $local_query;
} }
@@ -1572,9 +1511,9 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
. $explain_link_validate . $explain_link_validate
. '&amp;sql_query='; . '&amp;sql_query=';
if (eregi('^SELECT[[:space:]]+', $local_query)) { if (preg_match('@^SELECT[[:space:]]+@i', $local_query)) {
$explain_link .= urlencode('EXPLAIN ' . $local_query) . '">' . $GLOBALS['strExplain']; $explain_link .= urlencode('EXPLAIN ' . $local_query) . '">' . $GLOBALS['strExplain'];
} else if (eregi('^EXPLAIN[[:space:]]+SELECT[[:space:]]+', $local_query)) { } else if (preg_match('@^EXPLAIN[[:space:]]+SELECT[[:space:]]+@i', $local_query)) {
$explain_link .= urlencode(substr($local_query, 8)) . '">' . $GLOBALS['strNoExplain']; $explain_link .= urlencode(substr($local_query, 8)) . '">' . $GLOBALS['strNoExplain'];
} else { } else {
$explain_link = ''; $explain_link = '';
@@ -1732,48 +1671,6 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
return $options; return $options;
} // end of the 'PMA_getEnumSetOptions' function } // end of the 'PMA_getEnumSetOptions' function
/**
* Ensures a database/table/field's name is not a reserved word (for MySQL
* releases < 3.23.6)
*
* @param string the name to check
* @param string the url to go back in case of error
*
* @return boolean true if the name is valid (no return else)
*
* @access public
*
* @author Dell'Aiera Pol; Olivier Blin
*/
function PMA_checkReservedWords($the_name, $error_url)
{
// The name contains caracters <> a-z, A-Z and "_" -> not a reserved
// word
if (!ereg('^[a-zA-Z_]+$', $the_name)) {
return TRUE;
}
// Else do the work
$filename = 'badwords.txt';
if (file_exists($filename)) {
// Builds the reserved words array
$fd = fopen($filename, 'r');
$contents = fread($fd, filesize($filename) - 1);
fclose ($fd);
$word_list = explode("\n", $contents);
// Do the checking
$word_cnt = count($word_list);
for ($i = 0; $i < $word_cnt; $i++) {
if (strtolower($the_name) == $word_list[$i]) {
PMA_mysqlDie(sprintf($GLOBALS['strInvalidName'], $the_name), '', FALSE, $error_url);
} // end if
} // end for
} // end if
} // end of the 'PMA_checkReservedWords' function
/** /**
* Writes localised date * Writes localised date
* *
@@ -1795,8 +1692,8 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$timestamp = time(); $timestamp = time();
} }
$date = ereg_replace('%[aA]', $day_of_week[(int)strftime('%w', $timestamp)], $format); $date = preg_replace('@%[aA]@', $day_of_week[(int)strftime('%w', $timestamp)], $format);
$date = ereg_replace('%[bB]', $month[(int)strftime('%m', $timestamp)-1], $date); $date = preg_replace('@%[bB]@', $month[(int)strftime('%m', $timestamp)-1], $date);
return strftime($date, $timestamp); return strftime($date, $timestamp);
} // end of the 'PMA_localisedDate()' function } // end of the 'PMA_localisedDate()' function
@@ -1897,15 +1794,14 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$link_or_button = ' <form action="' $link_or_button = ' <form action="'
. $edit_url_parts['path'] . $edit_url_parts['path']
. '" method="post">' . "\n"; . '" method="post">' . "\n";
reset ($query_parts); foreach($query_parts AS $query_pair) {
while (list(, $query_pair) = each($query_parts)) {
list($eachvar, $eachval) = explode('=', $query_pair); list($eachvar, $eachval) = explode('=', $query_pair);
$link_or_button .= ' <input type="hidden" name="' . str_replace('amp;', '', $eachvar) . '" value="' . htmlspecialchars(urldecode($eachval)) . '" />' . "\n"; $link_or_button .= ' <input type="hidden" name="' . str_replace('amp;', '', $eachvar) . '" value="' . htmlspecialchars(urldecode($eachval)) . '" />' . "\n";
} // end while } // end while
if (stristr($message, '<img')) { if (stristr($message, '<img')) {
$link_or_button .= ' <input type="image" src="' . eregi_replace('^.*src="(.*)".*$', '\1', $message) . '" value="' $link_or_button .= ' <input type="image" src="' . preg_replace('@^.*src="(.*)".*$@i', '\1', $message) . '" value="'
. htmlspecialchars(eregi_replace('^.*alt="(.*)".*$', '\1', $message)) . '" />' . "\n" . '</form>' . "\n"; . htmlspecialchars(preg_replace('@^.*alt="(.*)".*$@i', '\1', $message)) . '" />' . "\n" . '</form>' . "\n";
} else { } else {
$link_or_button .= ' <input type="submit" value="' $link_or_button .= ' <input type="submit" value="'
. htmlspecialchars($message) . '" />' . "\n" . '</form>' . "\n"; . htmlspecialchars($message) . '" />' . "\n" . '</form>' . "\n";
@@ -1958,7 +1854,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$charbuff = false; $charbuff = false;
for ($i = 0; $i <= strlen($string); $i++) { for ($i = 0; $i <= strlen($string); $i++) {
$char = substr($string, $i, 1); $char = $string{$i};
$append = false; $append = false;
if ($char == '&') { if ($char == '&') {
@@ -1971,9 +1867,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$format_string .= $charbuff; $format_string .= $charbuff;
$charbuff = false; $charbuff = false;
$append = true; $append = true;
} } else {
else
{
$format_string .= $char; $format_string .= $char;
$append = true; $append = true;
} }
@@ -2008,7 +1902,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
$found_error = FALSE; $found_error = FALSE;
$error_message = ''; $error_message = '';
while (list(, $param) = each($params)) { foreach($params AS $param) {
if (!isset($GLOBALS[$param])) { if (!isset($GLOBALS[$param])) {
$error_message .= $reported_script_name . ': Missing ' . $param . '<br />'; $error_message .= $reported_script_name . ': Missing ' . $param . '<br />';
$found_error = TRUE; $found_error = TRUE;
@@ -2025,40 +1919,13 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
// Kanji encoding convert feature appended by Y.Kawada (2002/2/20) // Kanji encoding convert feature appended by Y.Kawada (2002/2/20)
if (PMA_PHP_INT_VERSION >= 40006 if (@function_exists('mb_convert_encoding')
&& @function_exists('mb_convert_encoding')
&& strpos(' ' . $lang, 'ja-') && strpos(' ' . $lang, 'ja-')
&& file_exists('./libraries/kanji-encoding.lib.php')) { && file_exists('./libraries/kanji-encoding.lib.php')) {
include('./libraries/kanji-encoding.lib.php'); include('./libraries/kanji-encoding.lib.php');
define('PMA_MULTIBYTE_ENCODING', 1); define('PMA_MULTIBYTE_ENCODING', 1);
} // end if } // end if
// garvin: moved from read_dump.php because this should be used in tbl_replace_fields.php as well.
if (!function_exists('is_uploaded_file')) {
/**
* Emulates the 'is_uploaded_file()' function for old php versions.
* Grabbed at the php manual:
* http://www.php.net/manual/en/features.file-upload.php
*
* @param string the name of the file to check
*
* @return boolean wether the file has been uploaded or not
*
* @access public
*/
function is_uploaded_file($filename) {
if (!$tmp_file = @get_cfg_var('upload_tmp_dir')) {
$tmp_file = tempnam('','');
$deleted = @unlink($tmp_file);
$tmp_file = dirname($tmp_file);
}
$tmp_file .= '/' . basename($filename);
// User might have trailing slash in php.ini...
return (ereg_replace('/+', '/', $tmp_file) == $filename);
} // end of the 'is_uploaded_file()' emulated function
} // end if
/** /**
* Function to check valid extension of file. It accepts entered * Function to check valid extension of file. It accepts entered
* extensions and bz2 and gz if supported. * extensions and bz2 and gz if supported.

View File

@@ -32,7 +32,7 @@ if (!defined('PMA_DB_CONFIG_LIB_INCLUDED')) {
// Check for __attr // Check for __attr
if (is_object($val->__attr)) { if (is_object($val->__attr)) {
while (list($key2, $val2) = each($val->__attr)) { foreach($val->__attr AS $key2 => $val2) {
$attr .= " $key2=\"$val2\""; $attr .= " $key2=\"$val2\"";
} }
} else { } else {

View File

@@ -55,8 +55,6 @@ if (!defined('PMA_USR_OS')) {
// php 4.1+ // php 4.1+
if (!empty($_SERVER['HTTP_USER_AGENT'])) { if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
} else if (!empty($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
$HTTP_USER_AGENT = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
} else if (!isset($HTTP_USER_AGENT)) { } else if (!isset($HTTP_USER_AGENT)) {
$HTTP_USER_AGENT = ''; $HTTP_USER_AGENT = '';
} }
@@ -79,26 +77,26 @@ if (!defined('PMA_USR_OS')) {
// 2. browser and version // 2. browser and version
// (must check everything else before Mozilla) // (must check everything else before Mozilla)
if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) { if (preg_match('@Opera(/| )([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) {
define('PMA_USR_BROWSER_VER', $log_version[2]); define('PMA_USR_BROWSER_VER', $log_version[2]);
define('PMA_USR_BROWSER_AGENT', 'OPERA'); define('PMA_USR_BROWSER_AGENT', 'OPERA');
} else if (ereg('MSIE ([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) { } else if (preg_match('@MSIE ([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) {
define('PMA_USR_BROWSER_VER', $log_version[1]); define('PMA_USR_BROWSER_VER', $log_version[1]);
define('PMA_USR_BROWSER_AGENT', 'IE'); define('PMA_USR_BROWSER_AGENT', 'IE');
} else if (ereg('OmniWeb/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) { } else if (preg_match('@OmniWeb/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) {
define('PMA_USR_BROWSER_VER', $log_version[1]); define('PMA_USR_BROWSER_VER', $log_version[1]);
define('PMA_USR_BROWSER_AGENT', 'OMNIWEB'); define('PMA_USR_BROWSER_AGENT', 'OMNIWEB');
//} else if (ereg('Konqueror/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) { //} else if (ereg('Konqueror/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {
// Konqueror 2.2.2 says Konqueror/2.2.2 // Konqueror 2.2.2 says Konqueror/2.2.2
// Konqueror 3.0.3 says Konqueror/3 // Konqueror 3.0.3 says Konqueror/3
} else if (ereg('(Konqueror/)(.*)(;)', $HTTP_USER_AGENT, $log_version)) { } else if (preg_match('@(Konqueror/)(.*)(;)@', $HTTP_USER_AGENT, $log_version)) {
define('PMA_USR_BROWSER_VER', $log_version[2]); define('PMA_USR_BROWSER_VER', $log_version[2]);
define('PMA_USR_BROWSER_AGENT', 'KONQUEROR'); define('PMA_USR_BROWSER_AGENT', 'KONQUEROR');
} else if (ereg('Mozilla/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version) } else if (preg_match('@Mozilla/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)
&& ereg('Safari/([0-9]*)', $HTTP_USER_AGENT, $log_version2)) { && preg_match('@Safari/([0-9]*)@', $HTTP_USER_AGENT, $log_version2)) {
define('PMA_USR_BROWSER_VER', $log_version[1] . '.' . $log_version2[1]); define('PMA_USR_BROWSER_VER', $log_version[1] . '.' . $log_version2[1]);
define('PMA_USR_BROWSER_AGENT', 'SAFARI'); define('PMA_USR_BROWSER_AGENT', 'SAFARI');
} else if (ereg('Mozilla/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) { } else if (preg_match('@Mozilla/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) {
define('PMA_USR_BROWSER_VER', $log_version[1]); define('PMA_USR_BROWSER_VER', $log_version[1]);
define('PMA_USR_BROWSER_AGENT', 'MOZILLA'); define('PMA_USR_BROWSER_AGENT', 'MOZILLA');
} else { } else {

View File

@@ -21,8 +21,8 @@ if (!defined('PMA_VERSION')) {
// php version // php version
if (!defined('PMA_PHP_INT_VERSION')) { if (!defined('PMA_PHP_INT_VERSION')) {
if (!ereg('([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})', phpversion(), $match)) { if (!preg_match('@([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})@', phpversion(), $match)) {
$result = ereg('([0-9]{1,2}).([0-9]{1,2})', phpversion(), $match); $result = preg_match('@([0-9]{1,2}).([0-9]{1,2})@', phpversion(), $match);
} }
if (isset($match) && !empty($match[1])) { if (isset($match) && !empty($match[1])) {
if (!isset($match[2])) { if (!isset($match[2])) {
@@ -41,21 +41,14 @@ if (!defined('PMA_PHP_INT_VERSION')) {
// MySQL client API // MySQL client API
if (!defined('PMA_MYSQL_CLIENT_API')) { if (!defined('PMA_MYSQL_CLIENT_API')) {
if (function_exists('mysql_get_client_info')) { $client_api = explode('.', mysql_get_client_info());
$client_api = mysql_get_client_info();
} else {
// for compatibility with php <= 4.0.5
// expect the worst!
$client_api = '3.21.0';
}
$client_api = explode('.', $client_api);
define('PMA_MYSQL_CLIENT_API', (int)sprintf('%d%02d%02d', $client_api[0], $client_api[1], intval($client_api[2]))); define('PMA_MYSQL_CLIENT_API', (int)sprintf('%d%02d%02d', $client_api[0], $client_api[1], intval($client_api[2])));
unset($client_api); unset($client_api);
} }
// Whether the os php is running on is windows or not // Whether the os php is running on is windows or not
if (!defined('PMA_IS_WINDOWS')) { if (!defined('PMA_IS_WINDOWS')) {
if (defined('PHP_OS') && eregi('win', PHP_OS)) { if (defined('PHP_OS') && stristr(PHP_OS, 'win')) {
define('PMA_IS_WINDOWS', 1); define('PMA_IS_WINDOWS', 1);
} else { } else {
define('PMA_IS_WINDOWS', 0); define('PMA_IS_WINDOWS', 0);
@@ -64,20 +57,14 @@ if (!defined('PMA_IS_WINDOWS')) {
function PMA_dl($module) { function PMA_dl($module) {
if (!isset($GLOBALS['PMA_dl_allowed'])) { if (!isset($GLOBALS['PMA_dl_allowed'])) {
if (((PMA_PHP_INT_VERSION >= 40000 && !@ini_get('safe_mode') && @ini_get('enable_dl')) if (!@ini_get('safe_mode') && @ini_get('enable_dl') && @function_exists('dl')) {
|| (PMA_PHP_INT_VERSION < 40000 && PMA_PHP_INT_VERSION > 30009 && !@get_cfg_var('safe_mode')))
&& @function_exists('dl')) {
if (PMA_PHP_INT_VERSION < 40000) {
$GLOBALS['PMA_dl_allowed'] = TRUE;
} else {
ob_start(); ob_start();
phpinfo(INFO_GENERAL); /* Only general info */ phpinfo(INFO_GENERAL); /* Only general info */
$a = strip_tags(ob_get_contents()); $a = strip_tags(ob_get_contents());
ob_end_clean(); ob_end_clean();
/* Get GD version string from phpinfo output */ /* Get GD version string from phpinfo output */
if (ereg('Thread Safety[[:space:]]*enabled', $a)) { if (preg_match('@Thread Safety[[:space:]]*enabled@', $a)) {
if (ereg('Server API[[:space:]]*\(CGI\|CLI\)', $a)) { if (preg_match('@Server API[[:space:]]*\(CGI\|CLI\)@', $a)) {
$GLOBALS['PMA_dl_allowed'] = TRUE; $GLOBALS['PMA_dl_allowed'] = TRUE;
} else { } else {
$GLOBALS['PMA_dl_allowed'] = FALSE; $GLOBALS['PMA_dl_allowed'] = FALSE;
@@ -85,7 +72,6 @@ function PMA_dl($module) {
} else { } else {
$GLOBALS['PMA_dl_allowed'] = TRUE; $GLOBALS['PMA_dl_allowed'] = TRUE;
} }
}
} else { } else {
$GLOBALS['PMA_dl_allowed'] = FALSE; $GLOBALS['PMA_dl_allowed'] = FALSE;
} }
@@ -100,7 +86,6 @@ function PMA_dl($module) {
} else { } else {
return FALSE; return FALSE;
} }
} }
// Whether GD2 is present // Whether GD2 is present
@@ -123,14 +108,14 @@ if (!defined('PMA_IS_GD2')) {
} else { } else {
define('PMA_IS_GD2', 0); define('PMA_IS_GD2', 0);
} }
} elseif (PMA_PHP_INT_VERSION >= 40000) { } else {
/* We must do hard way... */ /* We must do hard way... */
ob_start(); ob_start();
phpinfo(INFO_MODULES); /* Only modules */ phpinfo(INFO_MODULES); /* Only modules */
$a = strip_tags(ob_get_contents()); $a = strip_tags(ob_get_contents());
ob_end_clean(); ob_end_clean();
/* Get GD version string from phpinfo output */ /* Get GD version string from phpinfo output */
if (ereg('GD Version[[:space:]]*\(.*\)', $a, $v)) { if (preg_match('@GD Version[[:space:]]*\(.*\)@', $a, $v)) {
if (strstr($v, '2.')) { if (strstr($v, '2.')) {
define('PMA_IS_GD2', 1); define('PMA_IS_GD2', 1);
} else { } else {
@@ -139,9 +124,6 @@ if (!defined('PMA_IS_GD2')) {
} else { } else {
define('PMA_IS_GD2', 0); define('PMA_IS_GD2', 0);
} }
} else {
// This is PHP 3 version, it probably doesn't have GD2
define('PMA_IS_GD2', 0);
} }
} }
} }

View File

@@ -162,25 +162,13 @@ if ($export_type == 'server') {
<label for="checkbox_dump_drop"><?php echo $strStrucDrop; ?></label><br /> <label for="checkbox_dump_drop"><?php echo $strStrucDrop; ?></label><br />
<input type="checkbox" name="auto_increment" value="1" id="checkbox_auto_increment" <?php PMA_exportCheckboxCheck('sql_auto_increment'); ?> /> <input type="checkbox" name="auto_increment" value="1" id="checkbox_auto_increment" <?php PMA_exportCheckboxCheck('sql_auto_increment'); ?> />
<label for="checkbox_auto_increment"><?php echo $strAddAutoIncrement; ?></label><br /> <label for="checkbox_auto_increment"><?php echo $strAddAutoIncrement; ?></label><br />
<?php
// Add backquotes checkbox
if (PMA_MYSQL_INT_VERSION >= 32306) {
?>
<input type="checkbox" name="use_backquotes" value="1" id="checkbox_dump_use_backquotes" <?php PMA_exportCheckboxCheck('sql_backquotes'); ?> /> <input type="checkbox" name="use_backquotes" value="1" id="checkbox_dump_use_backquotes" <?php PMA_exportCheckboxCheck('sql_backquotes'); ?> />
<label for="checkbox_dump_use_backquotes"><?php echo $strUseBackquotes; ?></label><br /> <label for="checkbox_dump_use_backquotes"><?php echo $strUseBackquotes; ?></label><br />
<?php
} // end backquotes feature
?>
<fieldset> <fieldset>
<legend><?php echo $strAddIntoComments; ?></legend> <legend><?php echo $strAddIntoComments; ?></legend>
<?php
if (PMA_MYSQL_INT_VERSION >= 32321) {
?>
<input type="checkbox" name="sql_dates" value="yes" id="checkbox_sql_dates" <?php PMA_exportCheckboxCheck('sql_dates'); ?> /> <input type="checkbox" name="sql_dates" value="yes" id="checkbox_sql_dates" <?php PMA_exportCheckboxCheck('sql_dates'); ?> />
<label for="checkbox_sql_dates"><?php echo $strCreationDates; ?></label><br /> <label for="checkbox_sql_dates"><?php echo $strCreationDates; ?></label><br />
<?php <?php
} // end MySQL >= 3.23.21
if (!empty($cfgRelation['relation'])) { if (!empty($cfgRelation['relation'])) {
?> ?>
<input type="checkbox" name="sql_relation" value="yes" id="checkbox_sql_use_relation" <?php PMA_exportCheckboxCheck('sql_relation'); ?> /> <input type="checkbox" name="sql_relation" value="yes" id="checkbox_sql_use_relation" <?php PMA_exportCheckboxCheck('sql_relation'); ?> />
@@ -477,24 +465,18 @@ if (isset($table) && !empty($table) && !isset($num_tables)) {
if ($export_type == 'database') { if ($export_type == 'database') {
if (isset($_COOKIE) && !empty($_COOKIE['pma_db_filename_template'])) { if (isset($_COOKIE) && !empty($_COOKIE['pma_db_filename_template'])) {
echo $_COOKIE['pma_db_filename_template']; echo $_COOKIE['pma_db_filename_template'];
} elseif (isset($HTTP_COOKIE_VARS) && !empty($HTTP_COOKIE_VARS['pma_db_filename_template'])) {
echo $HTTP_COOKIE_VARS['pma_db_filename_template'];
} else { } else {
echo '__DB__'; echo '__DB__';
} }
} elseif ($export_type == 'table') { } elseif ($export_type == 'table') {
if (isset($_COOKIE) && !empty($_COOKIE['pma_table_filename_template'])) { if (isset($_COOKIE) && !empty($_COOKIE['pma_table_filename_template'])) {
echo $_COOKIE['pma_table_filename_template']; echo $_COOKIE['pma_table_filename_template'];
} elseif (isset($HTTP_COOKIE_VARS) && !empty($HTTP_COOKIE_VARS['pma_table_filename_template'])) {
echo $HTTP_COOKIE_VARS['pma_table_filename_template'];
} else { } else {
echo '__TABLE__'; echo '__TABLE__';
} }
} else { } else {
if (isset($_COOKIE) && !empty($_COOKIE['pma_server_filename_template'])) { if (isset($_COOKIE) && !empty($_COOKIE['pma_server_filename_template'])) {
echo $_COOKIE['pma_server_filename_template']; echo $_COOKIE['pma_server_filename_template'];
} elseif (isset($HTTP_COOKIE_VARS) && !empty($HTTP_COOKIE_VARS['pma_server_filename_template'])) {
echo $HTTP_COOKIE_VARS['pma_server_filename_template'];
} else { } else {
echo '__SERVER__'; echo '__SERVER__';
} }
@@ -541,11 +523,10 @@ if (isset($table) && !empty($table) && !isset($num_tables)) {
<?php <?php
// zip, gzip and bzip2 encode features // zip, gzip and bzip2 encode features
if (PMA_PHP_INT_VERSION >= 40004) { $is_zip = (isset($cfg['ZipDump']) && $cfg['ZipDump'] && @function_exists('gzcompress'));
$is_zip = (isset($cfg['ZipDump']) && $cfg['ZipDump'] && @function_exists('gzcompress')); $is_gzip = (isset($cfg['GZipDump']) && $cfg['GZipDump'] && @function_exists('gzencode'));
$is_gzip = (isset($cfg['GZipDump']) && $cfg['GZipDump'] && @function_exists('gzencode')); $is_bzip = (isset($cfg['BZipDump']) && $cfg['BZipDump'] && @function_exists('bzcompress'));
$is_bzip = (isset($cfg['BZipDump']) && $cfg['BZipDump'] && @function_exists('bzcompress')); if ($is_zip || $is_gzip || $is_bzip) {
if ($is_zip || $is_gzip || $is_bzip) {
if ($is_zip) { if ($is_zip) {
?> ?>
<input type="radio" name="compression" value="zip" id="radio_compression_zip" onclick="getElement('checkbox_dump_asfile').checked = true;" <?php PMA_exportIsActive('compression', 'zip'); ?> /> <input type="radio" name="compression" value="zip" id="radio_compression_zip" onclick="getElement('checkbox_dump_asfile').checked = true;" <?php PMA_exportIsActive('compression', 'zip'); ?> />
@@ -566,7 +547,6 @@ if (PMA_PHP_INT_VERSION >= 40004) {
<label for="radio_compression_bzip"><?php echo $strBzip; ?></label> <label for="radio_compression_bzip"><?php echo $strBzip; ?></label>
<?php <?php
} }
}
} }
echo "\n"; echo "\n";
?> ?>

View File

@@ -95,7 +95,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// 2.2 Statement is a "SHOW..." // 2.2 Statement is a "SHOW..."
else if ($GLOBALS['is_show']) { else if ($GLOBALS['is_show']) {
// 2.2.1 TODO : defines edit/delete links depending on show statement // 2.2.1 TODO : defines edit/delete links depending on show statement
$tmp = eregi('^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS)', $GLOBALS['sql_query'], $which); $tmp = preg_match('@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS)@i', $GLOBALS['sql_query'], $which);
if (strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) { if (strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) {
$do_display['edit_lnk'] = 'nn'; // no edit link $do_display['edit_lnk'] = 'nn'; // no edit link
$do_display['del_lnk'] = 'kp'; // "kill process" type edit link $do_display['del_lnk'] = 'kp'; // "kill process" type edit link
@@ -460,22 +460,22 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// Defines the url used to append/modify a sorting order // Defines the url used to append/modify a sorting order
// Nijel: This was originally done inside loop below, but I see // Nijel: This was originally done inside loop below, but I see
// no reason to do this for each column. // no reason to do this for each column.
if (eregi('(.*)([[:space:]]ORDER[[:space:]]*BY[[:space:]](.*))', $sql_query, $regs1)) { if (preg_match('@(.*)([[:space:]]ORDER[[:space:]]*BY[[:space:]](.*))@i', $sql_query, $regs1)) {
if (eregi('((.*)([[:space:]]ASC|[[:space:]]DESC)([[:space:]]|$))(.*)', $regs1[2], $regs2)) { if (preg_match('@((.*)([[:space:]]ASC|[[:space:]]DESC)([[:space:]]|$))(.*)@i', $regs1[2], $regs2)) {
$unsorted_sql_query = trim($regs1[1] . ' ' . $regs2[5]); $unsorted_sql_query = trim($regs1[1] . ' ' . $regs2[5]);
$sql_order = trim($regs2[1]); $sql_order = trim($regs2[1]);
eregi('(ORDER[[:space:]]*BY[[:space:]]*)(.*)([[:space:]]*ASC|[[:space:]]*DESC)',$sql_order,$after_order); preg_match('@(ORDER[[:space:]]*BY[[:space:]]*)(.*)([[:space:]]*ASC|[[:space:]]*DESC)@i',$sql_order,$after_order);
$sort_expression = trim($after_order[2]); $sort_expression = trim($after_order[2]);
} }
else if (eregi('((.*))[[:space:]]+(LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE)', $regs1[2], $regs3)) { else if (preg_match('@((.*))[[:space:]]+(LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE)@i', $regs1[2], $regs3)) {
$unsorted_sql_query = trim($regs1[1] . ' ' . $regs3[3]); $unsorted_sql_query = trim($regs1[1] . ' ' . $regs3[3]);
$sql_order = trim($regs3[1]) . ' ASC'; $sql_order = trim($regs3[1]) . ' ASC';
eregi('(ORDER[[:space:]]*BY[[:space:]]*)(.*)([[:space:]]*ASC|[[:space:]]*DESC)',$sql_order,$after_order); preg_match('@(ORDER[[:space:]]*BY[[:space:]]*)(.*)([[:space:]]*ASC|[[:space:]]*DESC)@i',$sql_order,$after_order);
$sort_expression = trim($after_order[2]); $sort_expression = trim($after_order[2]);
} else { } else {
$unsorted_sql_query = trim($regs1[1]); $unsorted_sql_query = trim($regs1[1]);
$sql_order = trim($regs1[2]) . ' ASC'; $sql_order = trim($regs1[2]) . ' ASC';
eregi('(ORDER[[:space:]]*BY[[:space:]]*)(.*)([[:space:]]*ASC|[[:space:]]*DESC)',$sql_order,$after_order); preg_match('@(ORDER[[:space:]]*BY[[:space:]]*)(.*)([[:space:]]*ASC|[[:space:]]*DESC)@i',$sql_order,$after_order);
$sort_expression = trim($after_order[2]); $sort_expression = trim($after_order[2]);
} }
} else { } else {
@@ -545,10 +545,10 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
echo $GLOBALS['strSortByKey'] . ': <select name="sql_query">&nbsp;'; echo $GLOBALS['strSortByKey'] . ': <select name="sql_query">&nbsp;';
$used_index = false; $used_index = false;
$local_order = (isset($sql_order) ? str_replace(' ', ' ', $sql_order) : ''); $local_order = (isset($sql_order) ? str_replace(' ', ' ', $sql_order) : '');
while (list($key, $val) = each($indexes_data)) { foreach($indexes_data AS $key => $val) {
$asc_sort = 'ORDER BY '; $asc_sort = 'ORDER BY ';
$desc_sort = 'ORDER BY '; $desc_sort = 'ORDER BY ';
while (list($key2, $val2) = each($val)) { foreach($val AS $key2 => $val2) {
$asc_sort .= PMA_backquote($val2['Column_name']) . ' ASC , '; $asc_sort .= PMA_backquote($val2['Column_name']) . ' ASC , ';
$desc_sort .= PMA_backquote($val2['Column_name']) . ' DESC , '; $desc_sort .= PMA_backquote($val2['Column_name']) . ' DESC , ';
} }
@@ -704,9 +704,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
$GLOBALS['mime_map'] = PMA_getMIME($db, $table); $GLOBALS['mime_map'] = PMA_getMIME($db, $table);
} }
if ($is_display['sort_lnk'] == '1') { if ($is_display['sort_lnk'] == '1') {
$is_join = eregi('(.*)[[:space:]]+FROM[[:space:]]+.*[[:space:]]+JOIN', $sql_query, $select_stt); $is_join = preg_match('@(.*)[[:space:]]+FROM[[:space:]]+.*[[:space:]]+JOIN@i', $sql_query, $select_stt);
} else { } else {
$is_join = FALSE; $is_join = FALSE;
} }
@@ -719,12 +718,12 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
$wi = 0; $wi = 0;
if (isset($analyzed_sql[0]['where_clause_identifiers']) && is_array($analyzed_sql[0]['where_clause_identifiers'])) { if (isset($analyzed_sql[0]['where_clause_identifiers']) && is_array($analyzed_sql[0]['where_clause_identifiers'])) {
reset($analyzed_sql[0]['where_clause_identifiers']); foreach($analyzed_sql[0]['where_clause_identifiers'] AS $wci_nr => $wci) {
while(list($wci_nr, $wci) = each($analyzed_sql[0]['where_clause_identifiers'])) {
$highlight_columns[$wci] = 'true'; $highlight_columns[$wci] = 'true';
} }
} }
} }
for ($i = 0; $i < $fields_cnt; $i++) { for ($i = 0; $i < $fields_cnt; $i++) {
// garvin: See if this column should get highlight because it's used in the // garvin: See if this column should get highlight because it's used in the
// where-query. // where-query.
@@ -769,7 +768,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// for a query with a "JOIN" statement and if the column // for a query with a "JOIN" statement and if the column
// isn't aliased) // isn't aliased)
if ($is_join if ($is_join
&& !eregi('([^[:space:],]|`[^`]`)[[:space:]]+(as[[:space:]]+)?' . $fields_meta[$i]->name, $select_stt[1], $parts)) { && !preg_match('~([^[:space:],]|`[^`]`)[[:space:]]+(as[[:space:]]+)?' . $fields_meta[$i]->name . '~i', $select_stt[1], $parts)) {
$sort_tbl = PMA_backquote($fields_meta[$i]->table) . '.'; $sort_tbl = PMA_backquote($fields_meta[$i]->table) . '.';
} else { } else {
$sort_tbl = ''; $sort_tbl = '';
@@ -787,20 +786,20 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// loic1: patch #455484 ("Smart" order) // loic1: patch #455484 ("Smart" order)
$cfg['Order'] = strtoupper($GLOBALS['cfg']['Order']); $cfg['Order'] = strtoupper($GLOBALS['cfg']['Order']);
if ($cfg['Order'] == 'SMART') { if ($cfg['Order'] == 'SMART') {
$cfg['Order'] = (eregi('time|date', $fields_meta[$i]->type)) ? 'DESC' : 'ASC'; $cfg['Order'] = (preg_match('@time|date@i', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
} }
$sort_order .= $cfg['Order']; $sort_order .= $cfg['Order'];
$order_img = ''; $order_img = '';
} }
else if (eregi('[[:space:]]ASC$', $sql_order)) { else if (preg_match('@[[:space:]]ASC$@i', $sql_order)) {
$sort_order .= ' DESC'; $sort_order .= ' DESC';
$order_img = '&nbsp;<img src="./images/asc_order.png" border="0" width="7" height="7" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" />'; $order_img = '&nbsp;<img src="./images/asc_order.png" border="0" width="7" height="7" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" />';
} }
else if (eregi('[[:space:]]DESC$', $sql_order)) { else if (preg_match('@[[:space:]]DESC$@i', $sql_order)) {
$sort_order .= ' ASC'; $sort_order .= ' ASC';
$order_img = '&nbsp;<img src="./images/desc_order.png" border="0" width="7" height="7" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" />'; $order_img = '&nbsp;<img src="./images/desc_order.png" border="0" width="7" height="7" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" />';
} }
if (eregi('(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))', $unsorted_sql_query, $regs3)) { if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@i', $unsorted_sql_query, $regs3)) {
$sorted_sql_query = $regs3[1] . $sort_order . $regs3[2]; $sorted_sql_query = $regs3[1] . $sort_order . $regs3[2];
} else { } else {
$sorted_sql_query = $unsorted_sql_query . $sort_order; $sorted_sql_query = $unsorted_sql_query . $sort_order;
@@ -1038,8 +1037,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// do not use an alias in a condition // do not use an alias in a condition
$column_for_condition = $meta->name; $column_for_condition = $meta->name;
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) { if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
reset($analyzed_sql[0]['select_expr']); foreach($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
while (list ($select_expr_position, $select_expr) = each ($analyzed_sql[0]['select_expr'])) {
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias']; $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
if (!empty($alias)) { if (!empty($alias)) {
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column']; $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
@@ -1071,7 +1069,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
} else { } else {
if ($meta->type == 'blob' if ($meta->type == 'blob'
// hexify only if this is a true not empty BLOB // hexify only if this is a true not empty BLOB
&& eregi('BINARY', $field_flags) && stristr($field_flags, 'BINARY')
&& !empty($row[$pointer])) { && !empty($row[$pointer])) {
$condition .= 'LIKE 0x' . bin2hex($row[$pointer]). ' AND'; $condition .= 'LIKE 0x' . bin2hex($row[$pointer]). ' AND';
} else { } else {
@@ -1170,7 +1168,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
. '&sql_query=' . urlencode($sql_query) . '&sql_query=' . urlencode($sql_query)
. '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted'])) . '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted']))
. '&goto=' . (empty($goto) ? 'tbl_properties.php' : $goto); . '&goto=' . (empty($goto) ? 'tbl_properties.php' : $goto);
$del_query = urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $uva_condition . ((PMA_MYSQL_INT_VERSION >= 32207) ? urlencode(' LIMIT 1') : ''); $del_query = urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $uva_condition . '+LIMIT+1';
$del_url = 'sql.php' $del_url = 'sql.php'
. '?' . $url_query . '?' . $url_query
. '&amp;sql_query=' . $del_query . '&amp;sql_query=' . $del_query
@@ -1178,7 +1176,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
. '&amp;goto=' . urlencode($lnk_goto); . '&amp;goto=' . urlencode($lnk_goto);
$js_conf = 'DELETE FROM ' . PMA_jsFormat($table) $js_conf = 'DELETE FROM ' . PMA_jsFormat($table)
. ' WHERE ' . trim(PMA_jsFormat(urldecode($uva_condition), FALSE)) . ' WHERE ' . trim(PMA_jsFormat(urldecode($uva_condition), FALSE))
. ((PMA_MYSQL_INT_VERSION >= 32207) ? ' LIMIT 1' : ''); . ' LIMIT 1';
if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) { if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) {
$del_str = $GLOBALS['strDelete']; $del_str = $GLOBALS['strDelete'];
} else { } else {
@@ -1241,7 +1239,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) { if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) {
// garvin: for security, never allow to break out from transformations directory // garvin: for security, never allow to break out from transformations directory
$include_file = eregi_replace('\.\.*', '.', $GLOBALS['mime_map'][$meta->name]['transformation']); $include_file = preg_replace('@\.\.*@', '.', $GLOBALS['mime_map'][$meta->name]['transformation']);
if (file_exists('./libraries/transformations/' . $include_file)) { if (file_exists('./libraries/transformations/' . $include_file)) {
$transformfunction_name = str_replace('.inc.php', '', $GLOBALS['mime_map'][$meta->name]['transformation']); $transformfunction_name = str_replace('.inc.php', '', $GLOBALS['mime_map'][$meta->name]['transformation']);
@@ -1286,8 +1284,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
$vertical_display['data'][$row_no][$i] = ' <td align="right" valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '" nowrap="nowrap">'; $vertical_display['data'][$row_no][$i] = ' <td align="right" valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '" nowrap="nowrap">';
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) { if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
reset($analyzed_sql[0]['select_expr']); foreach($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
while (list ($select_expr_position, $select_expr) = each ($analyzed_sql[0]['select_expr'])) {
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias']; $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
if (!empty($alias)) { if (!empty($alias)) {
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column']; $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
@@ -1338,13 +1335,13 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// b l o b // b l o b
} else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && eregi('BLOB', $meta->type)) { } else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && stristr($meta->type, 'BLOB')) {
// loic1 : PMA_mysql_fetch_fields returns BLOB in place of // loic1 : PMA_mysql_fetch_fields returns BLOB in place of
// TEXT fields type, however TEXT fields must be displayed // TEXT fields type, however TEXT fields must be displayed
// even if $cfg['ShowBlob'] is false -> get the true type // even if $cfg['ShowBlob'] is false -> get the true type
// of the fields. // of the fields.
$field_flags = PMA_mysql_field_flags($dt_result, $i); $field_flags = PMA_mysql_field_flags($dt_result, $i);
if (eregi('BINARY', $field_flags)) { if (stristr($field_flags, 'BINARY')) {
$blobtext = '[BLOB'; $blobtext = '[BLOB';
if (isset($row[$pointer])) { if (isset($row[$pointer])) {
$blob_size = PMA_formatByteDown(strlen($row[$pointer]), 3, 1); $blob_size = PMA_formatByteDown(strlen($row[$pointer]), 3, 1);
@@ -1391,7 +1388,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// loic1: displays special characters from binaries // loic1: displays special characters from binaries
$field_flags = PMA_mysql_field_flags($dt_result, $i); $field_flags = PMA_mysql_field_flags($dt_result, $i);
if (eregi('BINARY', $field_flags)) { if (stristr($field_flags, 'BINARY')) {
$row[$pointer] = str_replace("\x00", '\0', $row[$pointer]); $row[$pointer] = str_replace("\x00", '\0', $row[$pointer]);
$row[$pointer] = str_replace("\x08", '\b', $row[$pointer]); $row[$pointer] = str_replace("\x08", '\b', $row[$pointer]);
$row[$pointer] = str_replace("\x0a", '\n', $row[$pointer]); $row[$pointer] = str_replace("\x0a", '\n', $row[$pointer]);
@@ -1410,12 +1407,11 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
$bool_nowrap = (($default_function != $transform_function && function_exists($function_nowrap)) ? $function_nowrap($transform_options) : false); $bool_nowrap = (($default_function != $transform_function && function_exists($function_nowrap)) ? $function_nowrap($transform_options) : false);
// loic1: do not wrap if date field type // loic1: do not wrap if date field type
$nowrap = ((eregi('DATE|TIME', $meta->type) || $bool_nowrap) ? ' nowrap="nowrap"' : ''); $nowrap = ((preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap) ? ' nowrap="nowrap"' : '');
$vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"' . $nowrap . '>'; $vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"' . $nowrap . '>';
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) { if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
reset($analyzed_sql[0]['select_expr']); foreach($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
while (list ($select_expr_position, $select_expr) = each ($analyzed_sql[0]['select_expr'])) {
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias']; $alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
if (!empty($alias)) { if (!empty($alias)) {
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column']; $true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
@@ -1554,9 +1550,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) { if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) {
echo '<tr>' . "\n"; echo '<tr>' . "\n";
echo $vertical_display['textbtn']; echo $vertical_display['textbtn'];
reset($vertical_display['row_delete']);
$foo_counter = 0; $foo_counter = 0;
while (list($key, $val) = each($vertical_display['row_delete'])) { foreach($vertical_display['row_delete'] AS $key => $val) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo '<td>&nbsp;</td>' . "\n"; echo '<td>&nbsp;</td>' . "\n";
} }
@@ -1573,9 +1568,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
if (!is_array($vertical_display['row_delete'])) { if (!is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn']; echo $vertical_display['textbtn'];
} }
reset($vertical_display['edit']);
$foo_counter = 0; $foo_counter = 0;
while (list($key, $val) = each($vertical_display['edit'])) { foreach($vertical_display['edit'] AS $key => $val) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo ' <td>&nbsp;</td>' . "\n"; echo ' <td>&nbsp;</td>' . "\n";
} }
@@ -1592,9 +1586,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) { if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn']; echo $vertical_display['textbtn'];
} }
reset($vertical_display['delete']);
$foo_counter = 0; $foo_counter = 0;
while (list($key, $val) = each($vertical_display['delete'])) { foreach($vertical_display['delete'] AS $key => $val) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo '<td>&nbsp;</td>' . "\n"; echo '<td>&nbsp;</td>' . "\n";
} }
@@ -1606,9 +1599,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
} // end if } // end if
// Displays data // Displays data
reset($vertical_display['desc']);
$row_no = 0; $row_no = 0;
while (list($key, $val) = each($vertical_display['desc'])) { foreach($vertical_display['desc'] AS $key => $val) {
$row_no++; $row_no++;
if (isset($GLOBALS['printview']) && ($GLOBALS['printview'] == '1')) { if (isset($GLOBALS['printview']) && ($GLOBALS['printview'] == '1')) {
@@ -1632,7 +1624,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
echo $val; echo $val;
$foo_counter = 0; $foo_counter = 0;
while (list($subkey, $subval) = each($vertical_display['rowdata'][$key])) { foreach($vertical_display['rowdata'][$key] AS $subkey => $subval) {
if (($foo_counter != 0) && ($repeat_cells != 0) and !($foo_counter % $repeat_cells)) { if (($foo_counter != 0) && ($repeat_cells != 0) and !($foo_counter % $repeat_cells)) {
echo $val; echo $val;
} }
@@ -1648,9 +1640,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) { if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['row_delete']) && (count($vertical_display['row_delete']) > 0 || !empty($vertical_display['textbtn']))) {
echo '<tr>' . "\n"; echo '<tr>' . "\n";
echo $vertical_display['textbtn']; echo $vertical_display['textbtn'];
reset($vertical_display['row_delete']);
$foo_counter = 0; $foo_counter = 0;
while (list($key, $val) = each($vertical_display['row_delete'])) { foreach($vertical_display['row_delete'] AS $key => $val) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo '<td>&nbsp;</td>' . "\n"; echo '<td>&nbsp;</td>' . "\n";
} }
@@ -1667,9 +1658,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
if (!is_array($vertical_display['row_delete'])) { if (!is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn']; echo $vertical_display['textbtn'];
} }
reset($vertical_display['edit']);
$foo_counter = 0; $foo_counter = 0;
while (list($key, $val) = each($vertical_display['edit'])) { foreach($vertical_display['edit'] AS $key => $val) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo '<td>&nbsp;</td>' . "\n"; echo '<td>&nbsp;</td>' . "\n";
} }
@@ -1686,9 +1676,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) { if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn']; echo $vertical_display['textbtn'];
} }
reset($vertical_display['delete']);
$foo_counter = 0; $foo_counter = 0;
while (list($key, $val) = each($vertical_display['delete'])) { foreach($vertical_display['delete'] AS $key => $val) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) { if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo '<td>&nbsp;</td>' . "\n"; echo '<td>&nbsp;</td>' . "\n";
} }
@@ -1818,8 +1807,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
$target=array(); $target=array();
if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) { if (isset($analyzed_sql[0]['table_ref']) && is_array($analyzed_sql[0]['table_ref'])) {
reset($analyzed_sql[0]['table_ref']); foreach($analyzed_sql[0]['table_ref'] AS $table_ref_position => $table_ref) {
while (list ($table_ref_position, $table_ref) = each ($analyzed_sql[0]['table_ref'])) {
$target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name']; $target[] = $analyzed_sql[0]['table_ref'][$table_ref_position]['table_true_name'];
} }
} }
@@ -1831,7 +1819,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
} else { } else {
$exist_rel = PMA_getForeigners($db, $table, '', 'both'); $exist_rel = PMA_getForeigners($db, $table, '', 'both');
if ($exist_rel) { if ($exist_rel) {
while (list($master_field,$rel) = each($exist_rel)) { foreach($exist_rel AS $master_field => $rel) {
$display_field = PMA_getDisplayField($rel['foreign_db'],$rel['foreign_table']); $display_field = PMA_getDisplayField($rel['foreign_db'],$rel['foreign_table']);
$map[$master_field] = array($rel['foreign_table'], $map[$master_field] = array($rel['foreign_table'],
$rel['foreign_field'], $rel['foreign_field'],
@@ -1910,7 +1898,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
function default_function($buffer) { function default_function($buffer) {
$buffer = htmlspecialchars($buffer); $buffer = htmlspecialchars($buffer);
$buffer = str_replace("\011", ' &nbsp;&nbsp;&nbsp;', str_replace(' ', ' &nbsp;', $buffer)); $buffer = str_replace("\011", ' &nbsp;&nbsp;&nbsp;', str_replace(' ', ' &nbsp;', $buffer));
$buffer = ereg_replace("((\015\012)|(\015)|(\012))", '<br />', $buffer); $buffer = preg_replace("@((\015\012)|(\015)|(\012))@", '<br />', $buffer);
return $buffer; return $buffer;
} }

View File

@@ -14,8 +14,6 @@
****************************************************************************/ ****************************************************************************/
// loic1: PHP3 compatibility
// define('FPDF_VERSION', '1.51');
$FPDF_version = (string) '1.51'; $FPDF_version = (string) '1.51';
@@ -312,8 +310,7 @@ class FPDF
{ {
$nf = $this->n; $nf = $this->n;
reset($this->diffs); foreach($this->diffs AS $diff) {
while (list(, $diff) = each($this->diffs)) {
// Encodings // Encodings
$this->_newobj(); $this->_newobj();
$this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>'); $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>');
@@ -323,15 +320,10 @@ class FPDF
$mqr = get_magic_quotes_runtime(); $mqr = get_magic_quotes_runtime();
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
reset($this->FontFiles); foreach($this->FontFiles AS $file => $info) {
while (list($file, $info) = each($this->FontFiles)) {
// Font file embedding // Font file embedding
$this->_newobj(); $this->_newobj();
$this->FontFiles[$file]['n'] = $this->n; $this->FontFiles[$file]['n'] = $this->n;
// loic1: PHP3 compatibility
// if (defined('FPDF_FONTPATH')) {
// $file = FPDF_FONTPATH . $file;
// }
if (isset($GLOBALS['FPDF_font_path'])) { if (isset($GLOBALS['FPDF_font_path'])) {
$file = $GLOBALS['FPDF_font_path'] . $file; $file = $GLOBALS['FPDF_font_path'] . $file;
} }
@@ -355,8 +347,7 @@ class FPDF
} // end while } // end while
set_magic_quotes_runtime($mqr); set_magic_quotes_runtime($mqr);
reset($this->fonts); foreach($this->fonts AS $k => $font) {
while (list($k, $font) = each($this->fonts)) {
// Font objects // Font objects
$this->_newobj(); $this->_newobj();
$this->fonts[$k]['n'] = $this->n; $this->fonts[$k]['n'] = $this->n;
@@ -390,8 +381,6 @@ class FPDF
if ($font['type'] != 'core') { if ($font['type'] != 'core') {
// Widths // Widths
$this->_newobj(); $this->_newobj();
// loic1: PHP3 compatibility
// $cw = &$font['cw'];
$s = '['; $s = '[';
for ($i = 32; $i <= 255; $i++) { for ($i = 32; $i <= 255; $i++) {
$s .= $font['cw'][chr($i)] . ' '; $s .= $font['cw'][chr($i)] . ' ';
@@ -401,8 +390,7 @@ class FPDF
// Descriptor // Descriptor
$this->_newobj(); $this->_newobj();
$s = '<</Type /FontDescriptor /FontName /' . $name; $s = '<</Type /FontDescriptor /FontName /' . $name;
reset($font['desc']); foreach($font['desc'] AS $k => $v) {
while (list($k, $v) = each($font['desc'])) {
$s .= ' /' . $k . ' ' . $v; $s .= ' /' . $k . ' ' . $v;
} }
$file = $font['file']; $file = $font['file'];
@@ -425,8 +413,7 @@ class FPDF
{ {
$filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; $filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->images); foreach($this->images AS $file => $info) {
while (list($file, $info) = each($this->images)) {
$this->_newobj(); $this->_newobj();
$this->images[$file]['n'] = $this->n; $this->images[$file]['n'] = $this->n;
$this->_out('<</Type /XObject'); $this->_out('<</Type /XObject');
@@ -485,15 +472,13 @@ class FPDF
$this->_out('2 0 obj'); $this->_out('2 0 obj');
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
$this->_out('/Font <<'); $this->_out('/Font <<');
reset($this->fonts); foreach($this->fonts AS $font) {
while (list(, $font) = each($this->fonts)) {
$this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
} }
$this->_out('>>'); $this->_out('>>');
if (count($this->images)) { if (count($this->images)) {
$this->_out('/XObject <<'); $this->_out('/XObject <<');
reset($this->images); foreach($this->images AS $image) {
while (list(, $image) = each($this->images)) {
$this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
} }
$this->_out('>>'); $this->_out('>>');
@@ -1432,10 +1417,6 @@ class FPDF
$file .= strtolower($style); $file .= strtolower($style);
} }
$file .= '.php'; $file .= '.php';
// loic1: PHP3 compatibility
// if (defined('FPDF_FONTPATH')) {
// $file = FPDF_FONTPATH . $file;
// }
if (isset($GLOBALS['FPDF_font_path'])) { if (isset($GLOBALS['FPDF_font_path'])) {
$file = $GLOBALS['FPDF_font_path'] . $file; $file = $GLOBALS['FPDF_font_path'] . $file;
} }
@@ -1462,9 +1443,7 @@ class FPDF
$this->FontStyle = $style; $this->FontStyle = $style;
$this->FontSizePt = $size; $this->FontSizePt = $size;
$this->FontSize = $size / $this->k; $this->FontSize = $size / $this->k;
// loic1: PHP3 compatibility $this->CurrentFont = &$this->fonts[$fontkey];
// $this->CurrentFont = &$this->fonts[$fontkey];
eval('$this->CurrentFont = ' . ($GLOBALS['FPDF_is_php4'] ? '&' : '') . '$this->fonts[\'' . $fontkey . '\'];');
if ($this->page > 0) { if ($this->page > 0) {
$this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); $this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
} }
@@ -1776,10 +1755,6 @@ class FPDF
if ($file == '') { if ($file == '') {
$file = str_replace(' ', '', $family) . strtolower($style) . '.php'; $file = str_replace(' ', '', $family) . strtolower($style) . '.php';
} }
// loic1: PHP3 compatibility
// if (defined('FPDF_FONTPATH')) {
// $file = FPDF_FONTPATH . $file;
// }
if (isset($GLOBALS['FPDF_font_path'])) { if (isset($GLOBALS['FPDF_font_path'])) {
$file = $GLOBALS['FPDF_font_path'] . $file; $file = $GLOBALS['FPDF_font_path'] . $file;
} }
@@ -2128,9 +2103,6 @@ class FPDF
$ns++; $ns++;
} // end if } // end if
// Other character
// loic1: PHP3 compatibility
// $l += $cw[$c];
$l += $this->CurrentFont['cw'][$c]; $l += $this->CurrentFont['cw'][$c];
if ($l > $wmax) { if ($l > $wmax) {
// Automatic line break // Automatic line break
@@ -2194,8 +2166,6 @@ class FPDF
*/ */
function Write($h, $txt, $link = '') function Write($h, $txt, $link = '')
{ {
// loic1: PHP3 compatibility
// $cw = &$this->CurrentFont['cw'];
$w = $this->w - $this->rMargin - $this->x; $w = $this->w - $this->rMargin - $this->x;
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
$s = str_replace("\r", '', $txt); $s = str_replace("\r", '', $txt);
@@ -2232,9 +2202,6 @@ class FPDF
$ls = $l; $ls = $l;
} // end if } // end if
// Other character
// loic1: PHP3 compatibility
// $l += $cw[$c];
$l += $this->CurrentFont['cw'][$c]; $l += $this->CurrentFont['cw'][$c];
if ($l > $wmax) { if ($l > $wmax) {
// Automatic line break // Automatic line break
@@ -2513,9 +2480,6 @@ if (!empty($_ENV) && isset($_ENV['HTTP_USER_AGENT'])) {
else if (!empty($_SERVER) && isset($_SERVER['HTTP_USER_AGENT'])) { else if (!empty($_SERVER) && isset($_SERVER['HTTP_USER_AGENT'])) {
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
} }
else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['HTTP_USER_AGENT'])) {
$HTTP_USER_AGENT = $HTTP_ENV_VARS['HTTP_USER_AGENT'];
}
else if (@getenv('HTTP_USER_AGENT')) { else if (@getenv('HTTP_USER_AGENT')) {
$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT'); $HTTP_USER_AGENT = getenv('HTTP_USER_AGENT');
} }
@@ -2524,10 +2488,4 @@ if ($HTTP_USER_AGENT == 'contype') {
header('Content-Type: application/pdf'); header('Content-Type: application/pdf');
exit(); exit();
} }
/**
* Gets PHP version (PHP3 or PHP4)
*/
$FPDF_is_php4 = (floor(phpversion()) >= 4);
?> ?>

View File

@@ -18,8 +18,7 @@ if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
return FALSE; return FALSE;
} }
$is_magic_quotes = get_magic_quotes_gpc(); $is_magic_quotes = get_magic_quotes_gpc();
reset($array); foreach($array AS $key => $value) {
while (list($key, $value) = each($array)) {
if (is_array($value)) { if (is_array($value)) {
// there could be a variable coming from a cookie of // there could be a variable coming from a cookie of
// another application, with the same name as this array // another application, with the same name as this array
@@ -45,7 +44,7 @@ if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
} // end if } // end if
if (!empty($_FILES)) { if (!empty($_FILES)) {
while (list($name, $value) = each($_FILES)) { foreach($_FILES AS $name => $value) {
$$name = $value['tmp_name']; $$name = $value['tmp_name'];
${$name . '_name'} = $value['name']; ${$name . '_name'} = $value['name'];
} }

View File

@@ -11,34 +11,6 @@
if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) { if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
define('PMA_ALLOW_DENY_LIB_INCLUDED', 1); define('PMA_ALLOW_DENY_LIB_INCLUDED', 1);
if (PMA_PHP_INT_VERSION < 40000) {
/**
* Emulates the "ip2long" function under PHP3
*
* Based on a piece of code from
* richard lithvall <richard at lithvall dot nu>
*
* @param string an IP in Internet standard format
*
* @return string its IPv4 Internet network address
*
* @access private
*/
function ip2long($dotted)
{
$dotted = split('\.', $dotted);
$ip = (double)0;
$y = 0x1000000;
for ($i = 0; $i < 4; $i++) {
$ip += ($dotted[$i] * $y);
$y = ($y >> 8);
} // end for
return $ip;
} // end of the "ip2long" function
} // end if
/** /**
* Gets the "true" IP address of the current user * Gets the "true" IP address of the current user
* *
@@ -51,7 +23,6 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
global $REMOTE_ADDR; global $REMOTE_ADDR;
global $HTTP_X_FORWARDED_FOR, $HTTP_X_FORWARDED, $HTTP_FORWARDED_FOR, $HTTP_FORWARDED; global $HTTP_X_FORWARDED_FOR, $HTTP_X_FORWARDED, $HTTP_FORWARDED_FOR, $HTTP_FORWARDED;
global $HTTP_VIA, $HTTP_X_COMING_FROM, $HTTP_COMING_FROM; global $HTTP_VIA, $HTTP_X_COMING_FROM, $HTTP_COMING_FROM;
global $HTTP_SERVER_VARS, $HTTP_ENV_VARS;
// Get some server/environment variables values // Get some server/environment variables values
if (empty($REMOTE_ADDR)) { if (empty($REMOTE_ADDR)) {
@@ -61,12 +32,6 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
else if (!empty($_ENV) && isset($_ENV['REMOTE_ADDR'])) { else if (!empty($_ENV) && isset($_ENV['REMOTE_ADDR'])) {
$REMOTE_ADDR = $_ENV['REMOTE_ADDR']; $REMOTE_ADDR = $_ENV['REMOTE_ADDR'];
} }
else if (!empty($HTTP_SERVER_VARS) && isset($HTTP_SERVER_VARS['REMOTE_ADDR'])) {
$REMOTE_ADDR = $HTTP_SERVER_VARS['REMOTE_ADDR'];
}
else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['REMOTE_ADDR'])) {
$REMOTE_ADDR = $HTTP_ENV_VARS['REMOTE_ADDR'];
}
else if (@getenv('REMOTE_ADDR')) { else if (@getenv('REMOTE_ADDR')) {
$REMOTE_ADDR = getenv('REMOTE_ADDR'); $REMOTE_ADDR = getenv('REMOTE_ADDR');
} }
@@ -78,12 +43,6 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
else if (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED_FOR'])) { else if (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED_FOR'])) {
$HTTP_X_FORWARDED_FOR = $_ENV['HTTP_X_FORWARDED_FOR']; $HTTP_X_FORWARDED_FOR = $_ENV['HTTP_X_FORWARDED_FOR'];
} }
else if (!empty($HTTP_SERVER_VARS) && isset($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'])) {
$HTTP_X_FORWARDED_FOR = $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'];
}
else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['HTTP_X_FORWARDED_FOR'])) {
$HTTP_X_FORWARDED_FOR = $HTTP_ENV_VARS['HTTP_X_FORWARDED_FOR'];
}
else if (@getenv('HTTP_X_FORWARDED_FOR')) { else if (@getenv('HTTP_X_FORWARDED_FOR')) {
$HTTP_X_FORWARDED_FOR = getenv('HTTP_X_FORWARDED_FOR'); $HTTP_X_FORWARDED_FOR = getenv('HTTP_X_FORWARDED_FOR');
} }
@@ -95,12 +54,6 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
else if (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED'])) { else if (!empty($_ENV) && isset($_ENV['HTTP_X_FORWARDED'])) {
$HTTP_X_FORWARDED = $_ENV['HTTP_X_FORWARDED']; $HTTP_X_FORWARDED = $_ENV['HTTP_X_FORWARDED'];
} }
else if (!empty($HTTP_SERVER_VARS) && isset($HTTP_SERVER_VARS['HTTP_X_FORWARDED'])) {
$HTTP_X_FORWARDED = $HTTP_SERVER_VARS['HTTP_X_FORWARDED'];
}
else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['HTTP_X_FORWARDED'])) {
$HTTP_X_FORWARDED = $HTTP_ENV_VARS['HTTP_X_FORWARDED'];
}
else if (@getenv('HTTP_X_FORWARDED')) { else if (@getenv('HTTP_X_FORWARDED')) {
$HTTP_X_FORWARDED = getenv('HTTP_X_FORWARDED'); $HTTP_X_FORWARDED = getenv('HTTP_X_FORWARDED');
} }
@@ -112,12 +65,6 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
else if (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED_FOR'])) { else if (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED_FOR'])) {
$HTTP_FORWARDED_FOR = $_ENV['HTTP_FORWARDED_FOR']; $HTTP_FORWARDED_FOR = $_ENV['HTTP_FORWARDED_FOR'];
} }
else if (!empty($HTTP_SERVER_VARS) && isset($HTTP_SERVER_VARS['HTTP_FORWARDED_FOR'])) {
$HTTP_FORWARDED_FOR = $HTTP_SERVER_VARS['HTTP_FORWARDED_FOR'];
}
else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['HTTP_FORWARDED_FOR'])) {
$HTTP_FORWARDED_FOR = $HTTP_ENV_VARS['HTTP_FORWARDED_FOR'];
}
else if (@getenv('HTTP_FORWARDED_FOR')) { else if (@getenv('HTTP_FORWARDED_FOR')) {
$HTTP_FORWARDED_FOR = getenv('HTTP_FORWARDED_FOR'); $HTTP_FORWARDED_FOR = getenv('HTTP_FORWARDED_FOR');
} }
@@ -129,12 +76,6 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
else if (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED'])) { else if (!empty($_ENV) && isset($_ENV['HTTP_FORWARDED'])) {
$HTTP_FORWARDED = $_ENV['HTTP_FORWARDED']; $HTTP_FORWARDED = $_ENV['HTTP_FORWARDED'];
} }
else if (!empty($HTTP_SERVER_VARS) && isset($HTTP_SERVER_VARS['HTTP_FORWARDED'])) {
$HTTP_FORWARDED = $HTTP_SERVER_VARS['HTTP_FORWARDED'];
}
else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['HTTP_FORWARDED'])) {
$HTTP_FORWARDED = $HTTP_ENV_VARS['HTTP_FORWARDED'];
}
else if (@getenv('HTTP_FORWARDED')) { else if (@getenv('HTTP_FORWARDED')) {
$HTTP_FORWARDED = getenv('HTTP_FORWARDED'); $HTTP_FORWARDED = getenv('HTTP_FORWARDED');
} }
@@ -146,12 +87,6 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
else if (!empty($_ENV) && isset($_ENV['HTTP_VIA'])) { else if (!empty($_ENV) && isset($_ENV['HTTP_VIA'])) {
$HTTP_VIA = $_ENV['HTTP_VIA']; $HTTP_VIA = $_ENV['HTTP_VIA'];
} }
else if (!empty($HTTP_SERVER_VARS) && isset($HTTP_SERVER_VARS['HTTP_VIA'])) {
$HTTP_VIA = $HTTP_SERVER_VARS['HTTP_VIA'];
}
else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['HTTP_VIA'])) {
$HTTP_VIA = $HTTP_ENV_VARS['HTTP_VIA'];
}
else if (@getenv('HTTP_VIA')) { else if (@getenv('HTTP_VIA')) {
$HTTP_VIA = getenv('HTTP_VIA'); $HTTP_VIA = getenv('HTTP_VIA');
} }
@@ -163,12 +98,6 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
else if (!empty($_ENV) && isset($_ENV['HTTP_X_COMING_FROM'])) { else if (!empty($_ENV) && isset($_ENV['HTTP_X_COMING_FROM'])) {
$HTTP_X_COMING_FROM = $_ENV['HTTP_X_COMING_FROM']; $HTTP_X_COMING_FROM = $_ENV['HTTP_X_COMING_FROM'];
} }
else if (!empty($HTTP_SERVER_VARS) && isset($HTTP_SERVER_VARS['HTTP_X_COMING_FROM'])) {
$HTTP_X_COMING_FROM = $HTTP_SERVER_VARS['HTTP_X_COMING_FROM'];
}
else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['HTTP_X_COMING_FROM'])) {
$HTTP_X_COMING_FROM = $HTTP_ENV_VARS['HTTP_X_COMING_FROM'];
}
else if (@getenv('HTTP_X_COMING_FROM')) { else if (@getenv('HTTP_X_COMING_FROM')) {
$HTTP_X_COMING_FROM = getenv('HTTP_X_COMING_FROM'); $HTTP_X_COMING_FROM = getenv('HTTP_X_COMING_FROM');
} }
@@ -180,12 +109,6 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
else if (!empty($_ENV) && isset($_ENV['HTTP_COMING_FROM'])) { else if (!empty($_ENV) && isset($_ENV['HTTP_COMING_FROM'])) {
$HTTP_COMING_FROM = $_ENV['HTTP_COMING_FROM']; $HTTP_COMING_FROM = $_ENV['HTTP_COMING_FROM'];
} }
else if (!empty($HTTP_COMING_FROM) && isset($HTTP_SERVER_VARS['HTTP_COMING_FROM'])) {
$HTTP_COMING_FROM = $HTTP_SERVER_VARS['HTTP_COMING_FROM'];
}
else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['HTTP_COMING_FROM'])) {
$HTTP_COMING_FROM = $HTTP_ENV_VARS['HTTP_COMING_FROM'];
}
else if (@getenv('HTTP_COMING_FROM')) { else if (@getenv('HTTP_COMING_FROM')) {
$HTTP_COMING_FROM = getenv('HTTP_COMING_FROM'); $HTTP_COMING_FROM = getenv('HTTP_COMING_FROM');
} }
@@ -219,7 +142,7 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
// True IP without proxy // True IP without proxy
return $direct_ip; return $direct_ip;
} else { } else {
$is_ip = ereg('^([0-9]{1,3}\.){3,3}[0-9]{1,3}', $proxy_ip, $regs); $is_ip = preg_match('|^([0-9]{1,3}\.){3,3}[0-9]{1,3}|', $proxy_ip, $regs);
if ($is_ip && (count($regs) > 0)) { if ($is_ip && (count($regs) > 0)) {
// True IP behind a proxy // True IP behind a proxy
return $regs[0]; return $regs[0];
@@ -257,7 +180,7 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
{ {
$result = TRUE; $result = TRUE;
if (ereg('([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/([0-9]+)', $testRange, $regs)) { if (preg_match('|([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/([0-9]+)|', $testRange, $regs)) {
// performs a mask match // performs a mask match
$ipl = ip2long($ipToTest); $ipl = ip2long($ipToTest);
$rangel = ip2long($regs[1] . '.' . $regs[2] . '.' . $regs[3] . '.' . $regs[4]); $rangel = ip2long($regs[1] . '.' . $regs[2] . '.' . $regs[3] . '.' . $regs[4]);
@@ -277,12 +200,12 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
} }
} else { } else {
// range based // range based
$maskocts = split('\.', $testRange); $maskocts = explode('.', $testRange);
$ipocts = split('\.', $ipToTest); $ipocts = explode('.', $ipToTest);
// perform a range match // perform a range match
for ($i = 0; $i < 4; $i++) { for ($i = 0; $i < 4; $i++) {
if (ereg('\[([0-9]+)\-([0-9]+)\]', $maskocts[$i], $regs)) { if (preg_match('|\[([0-9]+)\-([0-9]+)\]|', $maskocts[$i], $regs)) {
if (($ipocts[$i] > $regs[2]) if (($ipocts[$i] > $regs[2])
|| ($ipocts[$i] < $regs[1])) { || ($ipocts[$i] < $regs[1])) {
$result = FALSE; $result = FALSE;
@@ -332,8 +255,7 @@ if (!defined('PMA_ALLOW_DENY_LIB_INCLUDED')) {
'localhost' => '127.0.0.1/8' 'localhost' => '127.0.0.1/8'
); );
reset($rules); // used instead of a foreach look for PHP3 support foreach($rules AS $rule) {
while (list(, $rule) = each($rules)) {
// extract rule data // extract rule data
$rule_data = explode(' ', $rule); $rule_data = explode(' ', $rule);

View File

@@ -50,7 +50,7 @@ if (!defined('PMA_ENCODING_LIB_INCLUDED')) {
function PMA_change_enc_order() { function PMA_change_enc_order() {
global $enc_list; global $enc_list;
$p = split(',', $enc_list); $p = explode(',', $enc_list);
if ($p[1] == 'EUC-JP') { if ($p[1] == 'EUC-JP') {
$enc_list = 'ASCII,SJIS,EUC-JP,JIS'; $enc_list = 'ASCII,SJIS,EUC-JP,JIS';
} else { } else {

View File

@@ -21,11 +21,7 @@ if (!defined('PMA_MYSQL_CHARSETS_LIB_INCLUDED')){
$res = PMA_mysql_query('SHOW COLLATION;', $userlink) $res = PMA_mysql_query('SHOW COLLATION;', $userlink)
or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW COLLATION;'); or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW COLLATION;');
if (PMA_PHP_INT_VERSION >= 40000) {
sort($mysql_charsets, SORT_STRING); sort($mysql_charsets, SORT_STRING);
} else {
sort($mysql_charsets);
}
$mysql_collations = array_flip($mysql_charsets); $mysql_collations = array_flip($mysql_charsets);
$mysql_default_collations = array();; $mysql_default_collations = array();;
@@ -44,11 +40,7 @@ if (!defined('PMA_MYSQL_CHARSETS_LIB_INCLUDED')){
$mysql_collations_count = 0; $mysql_collations_count = 0;
while (list($key, $value) = each($mysql_collations)) { while (list($key, $value) = each($mysql_collations)) {
$mysql_collations_count += count($mysql_collations[$key]); $mysql_collations_count += count($mysql_collations[$key]);
if (PMA_PHP_INT_VERSION >= 40000) {
sort($mysql_collations[$key], SORT_STRING); sort($mysql_collations[$key], SORT_STRING);
} else {
sort($mysql_collations[$key]);
}
reset($mysql_collations[$key]); reset($mysql_collations[$key]);
} }
reset($mysql_collations); reset($mysql_collations);

View File

@@ -57,7 +57,7 @@ if (!defined('PMA_MYSQL_WRAPPERS_LIB_INCLUDED')){
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = PMA_convert_display_charset($data[$name]); if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = PMA_convert_display_charset($data[$name]);
} else { } else {
/* Meta information available -> check type of field and convert it according to the type */ /* Meta information available -> check type of field and convert it according to the type */
if ($meta->blob || eregi('BINARY', $meta->type)) { if ($meta->blob || stristr($meta->type, 'BINARY')) {
if (isset($data[$i])) $ret[$i] = $data[$i]; if (isset($data[$i])) $ret[$i] = $data[$i];
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = $data[$name]; if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = $data[$name];
} else { } else {

View File

@@ -23,7 +23,7 @@ if (!defined('PMA_OB_LIB_INCLUDED')) {
*/ */
function PMA_outBufferModeGet() function PMA_outBufferModeGet()
{ {
if (PMA_PHP_INT_VERSION >= 40000 && @function_exists('ob_start')) { if (@function_exists('ob_start')) {
$mode = 1; $mode = 1;
} else { } else {
$mode = 0; $mode = 0;
@@ -35,15 +35,12 @@ if (!defined('PMA_OB_LIB_INCLUDED')) {
// PMA_outBufferModeGet() function. // PMA_outBufferModeGet() function.
// //
// (Patch by Garth Gillespie, modified by Marc Delisle) // (Patch by Garth Gillespie, modified by Marc Delisle)
if (PMA_PHP_INT_VERSION >= 40000 && @ini_get('output_handler')) {
if (@ini_get('output_handler') == 'ob_gzhandler') { if (@ini_get('output_handler') == 'ob_gzhandler') {
$mode = 0; $mode = 0;
} }
} else if (PMA_PHP_INT_VERSION >= 40000) {
if (@get_cfg_var('output_handler') == 'ob_gzhandler') { if (@get_cfg_var('output_handler') == 'ob_gzhandler') {
$mode = 0; $mode = 0;
} }
}
// End patch // End patch
// If output buffering is enabled in php.ini it's not possible to // If output buffering is enabled in php.ini it's not possible to
@@ -51,7 +48,7 @@ if (!defined('PMA_OB_LIB_INCLUDED')) {
// Being better safe than sorry, check for any existing output handler // Being better safe than sorry, check for any existing output handler
// instead of just checking the 'output_buffering' setting. // instead of just checking the 'output_buffering' setting.
// //
if (PMA_PHP_INT_VERSION >= 40300 && @function_exists('ob_get_level')) { if (@function_exists('ob_get_level')) {
if (ob_get_level() > 0) { if (ob_get_level() > 0) {
$mode = 0; $mode = 0;
} }

View File

@@ -133,7 +133,7 @@ if (!defined('PMA_READ_DUMP_INCLUDED')) {
} // end for } // end for
// add any rest to the returned array // add any rest to the returned array
if (!empty($sql) && ereg('[^[:space:]]+', $sql)) { if (!empty($sql) && preg_match('@[^[:space:]]+@', $sql)) {
$ret[] = $sql; $ret[] = $sql;
} }

View File

@@ -249,8 +249,6 @@ if (!defined('PMA_RELATION_LIB_INCLUDED')){
echo '<tr><td colspan=2 align="left">' . $GLOBALS['strUpdComTab'] . '</td></tr>' . "\n"; echo '<tr><td colspan=2 align="left">' . $GLOBALS['strUpdComTab'] . '</td></tr>' . "\n";
} }
// . '<br />(MIME: ' . (($cfgRelation['mimework'] == TRUE) ? $enabled : $disabled) . ')'
echo ' <tr><th align="left">$cfg[\'Servers\'][$i][\'history\'] ... </th><td align="right">' echo ' <tr><th align="left">$cfg[\'Servers\'][$i][\'history\'] ... </th><td align="right">'
. ((isset($cfgRelation['history'])) ? $hit : sprintf($shit, 'history')) . ((isset($cfgRelation['history'])) ? $hit : sprintf($shit, 'history'))
. '</td></tr>' . "\n"; . '</td></tr>' . "\n";
@@ -305,18 +303,19 @@ if (!defined('PMA_RELATION_LIB_INCLUDED')){
} // end while } // end while
} }
if (PMA_MYSQL_INT_VERSION >= 32320 && ($source == 'both' || $source == 'innodb') && !empty($table)) { if (($source == 'both' || $source == 'innodb') && !empty($table)) {
$show_create_table_query = 'SHOW CREATE TABLE ' $show_create_table_query = 'SHOW CREATE TABLE '
. PMA_backquote($db) . '.' . PMA_backquote($table); . PMA_backquote($db) . '.' . PMA_backquote($table);
$show_create_table_res = PMA_mysql_query($show_create_table_query); $show_create_table_res = PMA_mysql_query($show_create_table_query);
list(,$show_create_table) = PMA_mysql_fetch_row($show_create_table_res); list(,$show_create_table) = PMA_mysql_fetch_row($show_create_table_res);
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
while (list(,$one_key) = each ($analyzed_sql[0]['foreign_keys'])) {
foreach($analyzed_sql[0]['foreign_keys'] AS $one_key) {
// the analyzer may return more than one column name in the // the analyzer may return more than one column name in the
// index list or the ref_index_list // index list or the ref_index_list
while (list($i,$field) = each($one_key['index_list'])) { foreach($one_key['index_list'] AS $i => $field) {
// If a foreign key is defined in the 'internal' source (pmadb) // If a foreign key is defined in the 'internal' source (pmadb)
// and in 'innodb', we won't get it twice if $source='both' // and in 'innodb', we won't get it twice if $source='both'

View File

@@ -171,12 +171,11 @@ if (!defined('PMA_SELECT_LANG_LIB_INCLUDED')) {
global $available_languages; global $available_languages;
global $lang; global $lang;
reset($available_languages); foreach($available_languages AS $key => $value) {
while (list($key, $value) = each($available_languages)) {
// $envType = 1 for the 'HTTP_ACCEPT_LANGUAGE' environment variable, // $envType = 1 for the 'HTTP_ACCEPT_LANGUAGE' environment variable,
// 2 for the 'HTTP_USER_AGENT' one // 2 for the 'HTTP_USER_AGENT' one
if (($envType == 1 && eregi('^(' . $value[0] . ')(;q=[0-9]\\.[0-9])?$', $str)) if (($envType == 1 && preg_match('@^(' . $value[0] . ')(;q=[0-9]\\.[0-9])?$@i', $str))
|| ($envType == 2 && eregi('(\(|\[|;[[:space:]])(' . $value[0] . ')(;|\]|\))', $str))) { || ($envType == 2 && preg_match('@(\(|\[|;[[:space:]])(' . $value[0] . ')(;|\]|\))@i', $str))) {
$lang = $key; $lang = $key;
break; break;
} }
@@ -193,36 +192,21 @@ if (!defined('PMA_SELECT_LANG_LIB_INCLUDED')) {
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$HTTP_ACCEPT_LANGUAGE = $_SERVER['HTTP_ACCEPT_LANGUAGE']; $HTTP_ACCEPT_LANGUAGE = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
} }
else if (!empty($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'])) {
$HTTP_ACCEPT_LANGUAGE = $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'];
}
if (!empty($_SERVER['HTTP_USER_AGENT'])) { if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
} }
else if (!empty($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
$HTTP_USER_AGENT = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
}
if (!isset($lang)) { if (!isset($lang)) {
if (isset($_GET) && !empty($_GET['lang'])) { if (isset($_GET) && !empty($_GET['lang'])) {
$lang = $_GET['lang']; $lang = $_GET['lang'];
} }
else if (isset($HTTP_GET_VARS) && !empty($HTTP_GET_VARS['lang'])) {
$lang = $HTTP_GET_VARS['lang'];
}
else if (isset($_POST) && !empty($_POST['lang'])) { else if (isset($_POST) && !empty($_POST['lang'])) {
$lang = $_POST['lang']; $lang = $_POST['lang'];
} }
else if (isset($HTTP_POST_VARS) && !empty($HTTP_POST_VARS['lang'])) {
$lang = $HTTP_POST_VARS['lang'];
}
else if (isset($_COOKIE) && !empty($_COOKIE['lang'])) { else if (isset($_COOKIE) && !empty($_COOKIE['lang'])) {
$lang = $_COOKIE['lang']; $lang = $_COOKIE['lang'];
} }
else if (isset($HTTP_COOKIE_VARS) && !empty($HTTP_COOKIE_VARS['lang'])) {
$lang = $HTTP_COOKIE_VARS['lang'];
}
} }
@@ -244,7 +228,7 @@ if (!defined('PMA_SELECT_LANG_LIB_INCLUDED')) {
if (!isset($cfg['AllowAnywhereRecoding']) || !$cfg['AllowAnywhereRecoding']) { if (!isset($cfg['AllowAnywhereRecoding']) || !$cfg['AllowAnywhereRecoding']) {
$available_language_files = $available_languages; $available_language_files = $available_languages;
$available_languages = array(); $available_languages = array();
while (list($tmp_lang, $tmp_lang_data) = each($available_language_files)) { foreach($available_language_files AS $tmp_lang => $tmp_lang_data) {
if (substr($tmp_lang, -5) != 'utf-8') { if (substr($tmp_lang, -5) != 'utf-8') {
$available_languages[$tmp_lang] = $tmp_lang_data; $available_languages[$tmp_lang] = $tmp_lang_data;
} }
@@ -270,7 +254,6 @@ if (!defined('PMA_SELECT_LANG_LIB_INCLUDED')) {
if (empty($lang) && !empty($HTTP_ACCEPT_LANGUAGE)) { if (empty($lang) && !empty($HTTP_ACCEPT_LANGUAGE)) {
$accepted = explode(',', $HTTP_ACCEPT_LANGUAGE); $accepted = explode(',', $HTTP_ACCEPT_LANGUAGE);
$acceptedCnt = count($accepted); $acceptedCnt = count($accepted);
reset($accepted);
for ($i = 0; $i < $acceptedCnt && empty($lang); $i++) { for ($i = 0; $i < $acceptedCnt && empty($lang); $i++) {
PMA_langDetect($accepted[$i], 1); PMA_langDetect($accepted[$i], 1);
} }

View File

@@ -134,13 +134,6 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
. 'SQL: ' . htmlspecialchars($sql) . "\n" . 'SQL: ' . htmlspecialchars($sql) . "\n"
. '</pre>' . "\n"; . '</pre>' . "\n";
/*
// Removed to solve bug #641765 - Robbat2 - 12 January 2003, 9:46PM
flush();
if (PMA_PHP_INT_VERSION >= 40200 && @function_exists('ob_flush')) {
ob_flush();
}
*/
} // end of the "PMA_SQP_throwError()" function } // end of the "PMA_SQP_throwError()" function
@@ -165,7 +158,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
$debugstr .= 'SQL: ' . htmlspecialchars($sql); $debugstr .= 'SQL: ' . htmlspecialchars($sql);
$encodedstr = $debugstr; $encodedstr = $debugstr;
if (PMA_PHP_INT_VERSION >= 40001 && @function_exists('gzcompress')) { if (@function_exists('gzcompress')) {
$encodedstr = gzcompress($debugstr, 9); $encodedstr = gzcompress($debugstr, 9);
} }
$encodedstr = preg_replace("/(\015\012)|(\015)|(\012)/", '<br />' . "\n", chunk_split(base64_encode($encodedstr))); $encodedstr = preg_replace("/(\015\012)|(\015)|(\012)/", '<br />' . "\n", chunk_split(base64_encode($encodedstr)));
@@ -1968,9 +1961,10 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
global $cfg; global $cfg;
$css_string = ''; $css_string = '';
while (list($key, $col) = each($cfg['SQP']['fmtColor'])) { foreach($cfg['SQP']['fmtColor'] AS $key => $col) {
$css_string .= PMA_SQP_buildCssRule('syntax_' . $key, 'color', $col); $css_string .= PMA_SQP_buildCssRule('syntax_' . $key, 'color', $col);
} }
for ($i = 0; $i < 8; $i++) { for ($i = 0; $i < 8; $i++) {
$css_string .= PMA_SQP_buildCssRule('syntax_indent' . $i, 'margin-left', ($i * $cfg['SQP']['fmtInd']) . $cfg['SQP']['fmtIndUnit']); $css_string .= PMA_SQP_buildCssRule('syntax_indent' . $i, 'margin-left', ($i * $cfg['SQP']['fmtInd']) . $cfg['SQP']['fmtIndUnit']);
} }
@@ -1991,7 +1985,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
function PMA_SQP_formatNone($arr) function PMA_SQP_formatNone($arr)
{ {
$formatted_sql = htmlspecialchars($arr['raw']); $formatted_sql = htmlspecialchars($arr['raw']);
$formatted_sql = ereg_replace("((\015\012)|(\015)|(\012)){3,}", "\n\n", $formatted_sql); $formatted_sql = preg_replace("@((\015\012)|(\015)|(\012)){3,}@", "\n\n", $formatted_sql);
return $formatted_sql; return $formatted_sql;
} // end of the "PMA_SQP_formatNone()" function } // end of the "PMA_SQP_formatNone()" function

View File

@@ -14,8 +14,8 @@ if (!defined('PMA_TRANSFORMATION_LIB_INCLUDED')){
$transform_options = array(); $transform_options = array();
if ($string != '') { if ($string != '') {
if (eregi('^\'.*\'$', $string)) { if ($string{0} == "'" && $string{strlen($string)-1} == "'") {
$transform_options = explode('\',\'', eregi_replace('^\'(.*)\'$', '\1', $string)); $transform_options = explode('\',\'', substr($string, 1, strlen($string)-2));
} else { } else {
$transform_options = array(0 => $string); $transform_options = array(0 => $string);
} }
@@ -47,25 +47,24 @@ if (!defined('PMA_TRANSFORMATION_LIB_INCLUDED')){
if (is_array($filestack)) { if (is_array($filestack)) {
@ksort($filestack); @ksort($filestack);
@reset($filestack); foreach($filestack AS $key => $file) {
while(list($key, $file) = each($filestack)) {
if (eregi('^.*__.*\.inc\.php$', trim($file))) { if (preg_match('|^.*__.*\.inc\.php$|', trim($file))) {
// File contains transformation functions. // File contains transformation functions.
$base = explode("__", str_replace(".inc.php", "", $file)); $base = explode('__', str_replace('.inc.php', '', $file));
$mimetype = str_replace("_", "/", $base[0]); $mimetype = str_replace('_', '/', $base[0]);
$stack['mimetype'][$mimetype] = $mimetype; $stack['mimetype'][$mimetype] = $mimetype;
$stack['transformation'][] = $mimetype . ': ' . $base[1]; $stack['transformation'][] = $mimetype . ': ' . $base[1];
$stack['transformation_file'][] = $file; $stack['transformation_file'][] = $file;
} else if (eregi('^.*\.inc\.php$', trim($file))) { } else if (preg_match('|^.*\.inc\.php$|', trim($file))) {
// File is a plain mimetype, no functions. // File is a plain mimetype, no functions.
$base = str_replace(".inc.php", "", $file); $base = str_replace('.inc.php', '', $file);
if ($base != 'global') { if ($base != 'global') {
$mimetype = str_replace("_", "/", $base); $mimetype = str_replace('_', '/', $base);
$stack['mimetype'][$mimetype] = $mimetype; $stack['mimetype'][$mimetype] = $mimetype;
$stack['empty_mimetype'][$mimetype] = $mimetype; $stack['empty_mimetype'][$mimetype] = $mimetype;
} }

View File

@@ -40,7 +40,7 @@ if (!defined('PMA_TRANSFORMATION_LIB_GLOBAL')){
} }
if (isset($options['regex']) && isset($options['regex_replace'])) { if (isset($options['regex']) && isset($options['regex_replace'])) {
$buffer = eregi_replace($options['regex'], $options['regex_replace'], $buffer); $buffer = preg_replace('@' . str_replace('@', '\@', $options['regex']) . '@i', $options['regex_replace'], $buffer);
} }
// Replace occurences of [__BUFFER__] with actual text // Replace occurences of [__BUFFER__] with actual text

View File

@@ -34,8 +34,7 @@ $types = PMA_getAvailableMIMEtypes();
<h2><?php echo $strMIME_available_mime; ?></h2> <h2><?php echo $strMIME_available_mime; ?></h2>
<?php <?php
@reset($types); foreach($types['mimetype'] AS $key => $mimetype) {
while(list($key, $mimetype) = each($types['mimetype'])) {
if (isset($types['empty_mimetype'][$mimetype])) { if (isset($types['empty_mimetype'][$mimetype])) {
echo '<i>' . $mimetype . '</i><br />'; echo '<i>' . $mimetype . '</i><br />';
@@ -61,7 +60,7 @@ while(list($key, $mimetype) = each($types['mimetype'])) {
<?php <?php
@reset($types); @reset($types);
$i = 0; $i = 0;
while(list($key, $transform) = each($types['transformation'])) { foreach($types['transformation'] AS $key => $transform) {
$i++; $i++;
$func = strtolower(str_replace('.inc.php', '', $types['transformation_file'][$key])); $func = strtolower(str_replace('.inc.php', '', $types['transformation_file'][$key]));
$desc = 'strTransformation_' . $func; $desc = 'strTransformation_' . $func;

View File

@@ -47,9 +47,6 @@ if (isset($submit)) {
if (empty($field_name[$i])) { if (empty($field_name[$i])) {
continue; continue;
} }
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($field_name[$i], $err_url);
}
$query .= PMA_backquote($field_name[$i]) . ' ' . $field_type[$i]; $query .= PMA_backquote($field_name[$i]) . ' ' . $field_type[$i];
if ($field_length[$i] != '' if ($field_length[$i] != ''

View File

@@ -26,11 +26,6 @@ $abort = false;
if (isset($submit)) { if (isset($submit)) {
$field_cnt = count($field_orig); $field_cnt = count($field_orig);
for ($i = 0; $i < $field_cnt; $i++) { for ($i = 0; $i < $field_cnt; $i++) {
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($field_name[$i], $err_url);
}
// Some fields have been urlencoded or double quotes have been translated
// to "&quot;" in tbl_properties.php // to "&quot;" in tbl_properties.php
$field_orig[$i] = urldecode($field_orig[$i]); $field_orig[$i] = urldecode($field_orig[$i]);
if (strcmp(str_replace('"', '&quot;', $field_orig[$i]), $field_name[$i]) == 0) { if (strcmp(str_replace('"', '&quot;', $field_orig[$i]), $field_name[$i]) == 0) {

View File

@@ -57,9 +57,6 @@ if (isset($submit)) {
if (empty($field_name[$i])) { if (empty($field_name[$i])) {
continue; continue;
} }
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($field_name[$i], $err_url);
}
$query = PMA_backquote($field_name[$i]) . ' ' . $field_type[$i]; $query = PMA_backquote($field_name[$i]) . ' ' . $field_type[$i];
if ($field_length[$i] != '') { if ($field_length[$i] != '') {
$query .= '(' . $field_length[$i] . ')'; $query .= '(' . $field_length[$i] . ')';
@@ -238,10 +235,6 @@ if ($abort == FALSE) {
} }
// Table name and number of fields are valid -> show the form // Table name and number of fields are valid -> show the form
else { else {
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($table, $err_url);
}
$action = 'tbl_create.php'; $action = 'tbl_create.php';
include('./tbl_properties.inc.php'); include('./tbl_properties.inc.php');
// Diplays the footer // Diplays the footer

View File

@@ -29,9 +29,6 @@ if (isset($new_name) && trim($new_name) != '') {
if (count($dblist) > 0 && PMA_isInto($db, $dblist) == -1) { if (count($dblist) > 0 && PMA_isInto($db, $dblist) == -1) {
exit(); exit();
} }
if (PMA_MYSQL_INT_VERSION < 32306) {
PMA_checkReservedWords($new_name, $err_url);
}
include('./header.inc.php'); include('./header.inc.php');
PMA_mysql_select_db($db); PMA_mysql_select_db($db);