' . "\n";
echo '
' . "
\n";
@@ -201,4 +201,4 @@ if (function_exists('PMA_set_enc_form')) {
*/
echo "\n";
require('./footer.inc.php');
-?>
+?>
\ No newline at end of file
diff --git a/db_details_common.php b/db_details_common.php
index 824a7528e..f96e3d6e2 100644
--- a/db_details_common.php
+++ b/db_details_common.php
@@ -63,4 +63,4 @@ window.parent.frames['nav'].location.replace('./left.php?
+?>
\ No newline at end of file
diff --git a/db_details_db_info.php b/db_details_db_info.php
index c9403c60b..39579ac7f 100644
--- a/db_details_db_info.php
+++ b/db_details_db_info.php
@@ -18,62 +18,51 @@ PMA_checkParameters(array('db'));
*/
// staybyte: speedup view on locked tables - 11 June 2001
$tables = array();
-if (PMA_MYSQL_INT_VERSION >= 32303) {
- // Special speedup for newer MySQL Versions (in 4.0 format changed)
- if ($cfg['SkipLockedTables'] == TRUE && PMA_MYSQL_INT_VERSION >= 32330) {
- $local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db);
- $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
- // Blending out tables in use
- if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
- while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
- // if in use memorize tablename
- if (eregi('in_use=[1-9]+', $tmp[1])) {
- $sot_cache[$tmp[0]] = TRUE;
- }
+// Special speedup for newer MySQL Versions (in 4.0 format changed)
+if ($cfg['SkipLockedTables'] == TRUE) {
+ $local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db);
+ $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
+ // Blending out tables in use
+ if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
+ while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
+ // if in use memorize tablename
+ if (preg_match('@in_use=[1-9]+@i', $tmp[1])) {
+ $sot_cache[$tmp[0]] = TRUE;
}
- mysql_free_result($db_info_result);
+ }
+ mysql_free_result($db_info_result);
- if (isset($sot_cache)) {
- $local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
- $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
- if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
- while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
- if (!isset($sot_cache[$tmp[0]])) {
- $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
- $sts_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
- $sts_tmp = PMA_mysql_fetch_array($sts_result);
- $tables[] = $sts_tmp;
- } else { // table in use
- $tables[] = array('Name' => $tmp[0]);
- }
+ if (isset($sot_cache)) {
+ $local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
+ $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
+ if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
+ while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
+ if (!isset($sot_cache[$tmp[0]])) {
+ $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
+ $sts_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
+ $sts_tmp = PMA_mysql_fetch_array($sts_result);
+ $tables[] = $sts_tmp;
+ } else { // table in use
+ $tables[] = array('Name' => $tmp[0]);
}
- mysql_free_result($db_info_result);
- $sot_ready = TRUE;
}
+ mysql_free_result($db_info_result);
+ $sot_ready = TRUE;
}
}
}
- if (!isset($sot_ready)) {
- $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
- $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
- if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
- while ($sts_tmp = PMA_mysql_fetch_array($db_info_result)) {
- $tables[] = $sts_tmp;
- }
- mysql_free_result($db_info_result);
- }
- }
- $num_tables = (isset($tables) ? count($tables) : 0);
-} // end if (PMA_MYSQL_INT_VERSION >= 32303)
-else {
- $db_info_result = PMA_mysql_list_tables($db);
- $num_tables = ($db_info_result) ? @mysql_numrows($db_info_result) : 0;
- for ($i = 0; $i < $num_tables; $i++) {
- $tables[] = PMA_mysql_tablename($db_info_result, $i);
- }
- mysql_free_result($db_info_result);
}
-
+if (!isset($sot_ready)) {
+ $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
+ $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
+ if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
+ while ($sts_tmp = PMA_mysql_fetch_array($db_info_result)) {
+ $tables[] = $sts_tmp;
+ }
+ mysql_free_result($db_info_result);
+ }
+}
+$num_tables = (isset($tables) ? count($tables) : 0);
/**
* Displays top menu links
@@ -81,4 +70,4 @@ else {
echo '' . "\n";
require('./db_details_links.php');
-?>
+?>
\ No newline at end of file
diff --git a/db_details_export.php b/db_details_export.php
index 38920d024..d8afd7eac 100644
--- a/db_details_export.php
+++ b/db_details_export.php
@@ -28,7 +28,7 @@ if ($num_tables > 1) {
$i = 0;
while ($i < $num_tables) {
- $table = (PMA_MYSQL_INT_VERSION >= 32303) ? $tables[$i]['Name'] : $tables[$i];
+ $table = $tables[$i]['Name'];
if (!empty($selectall) || (isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $table . '|'))) {
$is_selected = ' selected="selected"';
} else {
@@ -63,4 +63,4 @@ require('./libraries/display_export.lib.php');
* Displays the footer
*/
require('./footer.inc.php');
-?>
+?>
\ No newline at end of file
diff --git a/db_details_importdocsql.php b/db_details_importdocsql.php
index 6d8ed2922..bc54ad1d2 100644
--- a/db_details_importdocsql.php
+++ b/db_details_importdocsql.php
@@ -46,8 +46,8 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
function docsql_check($docpath = '', $file = '', $filename = '', $content = 'none') {
global $GLOBALS;
- if (eregi('^(.*)_field_comment\.(txt|zip|bz2|bzip).*$', $filename)) {
- $tab = eregi_replace('^(.*)_field_comment\.(txt|zip|bz2|bzip).*', '\1', $filename);
+ if (preg_match('@^(.*)_field_comment\.(txt|zip|bz2|bzip).*$@i', $filename)) {
+ $tab = preg_replace('@^(.*)_field_comment\.(txt|zip|bz2|bzip).*@i', '\1', $filename);
//echo '
Working on Table ' . $_tab . '
';
if ($content == 'none') {
$lines = array();
@@ -64,8 +64,7 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
}
if (isset($lines) && is_array($lines) && count($lines) > 0) {
- @reset($lines);
- while(list($lkey, $line) = each($lines)) {
+ foreach($lines AS $lkey => $line) {
//echo '
' . $line . '
';
$inf = explode('|',$line);
if (!empty($inf[1]) && strlen(trim($inf[1])) > 0) {
@@ -127,15 +126,9 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
if (!empty($_SERVER) && isset($_SERVER['DOCUMENT_ROOT'])) {
$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
}
- else if (!empty($HTTP_SERVER_VARS) && isset($HTTP_SERVER_VARS['DOCUMENT_ROOT'])) {
- $DOCUMENT_ROOT = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];
- }
else if (!empty($_ENV) && isset($_ENV['DOCUMENT_ROOT'])) {
$DOCUMENT_ROOT = $_ENV['DOCUMENT_ROOT'];
}
- else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['DOCUMENT_ROOT'])) {
- $DOCUMENT_ROOT = $HTTP_ENV_VARS['DOCUMENT_ROOT'];
- }
else if (@getenv('DOCUMENT_ROOT')) {
$DOCUMENT_ROOT = getenv('DOCUMENT_ROOT');
}
@@ -163,13 +156,7 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
if (file_exists($sql_file)
&& is_uploaded_file($sql_file)) {
- $open_basedir = '';
- if (PMA_PHP_INT_VERSION >= 40000) {
- $open_basedir = @ini_get('open_basedir');
- }
- if (empty($open_basedir)) {
- $open_basedir = @get_cfg_var('open_basedir');
- }
+ $open_basedir = @ini_get('open_basedir');
// If we are on a server with open_basedir, we must move the file
// before opening it. The doc explains how to create the "./tmp"
@@ -189,11 +176,7 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
}
else {
$sql_file_new = $tmp_subdir . basename($sql_file);
- if (PMA_PHP_INT_VERSION < 40003) {
- copy($sql_file, $sql_file_new);
- } else {
- move_uploaded_file($sql_file, $sql_file_new);
- }
+ move_uploaded_file($sql_file, $sql_file_new);
$docsql_text = PMA_readFile($sql_file_new, $sql_file_compression);
unlink($sql_file_new);
}
@@ -218,7 +201,7 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
} else {
// echo '
Starting Import
';
- $docpath = $cfg['docSQLDir'] . eregi_replace('\.\.*', '.', $docpath);
+ $docpath = $cfg['docSQLDir'] . preg_replace('@\.\.*@', '.', $docpath);
if (substr($docpath, -1) != '/') {
$docpath .= '/';
}
@@ -318,4 +301,4 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
echo "\n";
require('./footer.inc.php');
-?>
+?>
\ No newline at end of file
diff --git a/db_details_links.php b/db_details_links.php
index 889dab7bf..61257662e 100644
--- a/db_details_links.php
+++ b/db_details_links.php
@@ -86,4 +86,3 @@ if (!$cfg['LightTabs']) {
}
?>
-
diff --git a/db_details_qbe.php b/db_details_qbe.php
index 2fd942fc7..c2d52e0ff 100644
--- a/db_details_qbe.php
+++ b/db_details_qbe.php
@@ -21,7 +21,7 @@ $cfgRelation = PMA_getRelationsParam();
/**
* A query has been submitted -> execute it, else display the headers
*/
-if (isset($submit_sql) && eregi('^SELECT', $encoded_sql_query)) {
+if (isset($submit_sql) && preg_match('@^SELECT@i', $encoded_sql_query)) {
$goto = 'db_details.php';
$zero_rows = htmlspecialchars($strSuccess);
$sql_query = urldecode($encoded_sql_query);
@@ -34,7 +34,7 @@ if (isset($submit_sql) && eregi('^SELECT', $encoded_sql_query)) {
include('./db_details_db_info.php');
}
-if (isset($submit_sql) && !eregi('^SELECT', $encoded_sql_query)) {
+if (isset($submit_sql) && !preg_match('@^SELECT@i', $encoded_sql_query)) {
echo '
' . $strHaveToShow . '
';
}
@@ -121,7 +121,8 @@ $k = 0;
// The tables list sent by a previously submitted form
if (!empty($TableList)) {
- for ($x = 0; $x < count($TableList); $x++) {
+ $cnt_table_list = count($TableList);
+ for ($x = 0; $x < $cnt_table_list; $x++) {
$tbl_names[urldecode($TableList[$x])] = ' selected="selected"';
}
} // end if
@@ -627,7 +628,7 @@ for ($x = 0; $x < $col; $x++) {