' . "\n";
echo '
' . "\n";
echo ' ' . "\n";
- while (list($key, $value) = each($bookmark_list)) {
+ foreach($bookmark_list AS $key => $value) {
echo ' ' . htmlspecialchars($key) . ' ' . "\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++) {
$val) {
echo ' ';
echo '' . htmlspecialchars($key) . ' ' . "\n";
}
@@ -714,8 +715,6 @@ if (!empty($qry_select)) {
// If we can use Relations we could make some left joins.
// First find out if relations are available in this database.
-// Debugging:
-//echo '';
// First we need the really needed Tables - those in TableList might still be
// all Tables.
if (isset($Field) && count($Field) > 0) {
@@ -730,21 +729,19 @@ if (isset($Field) && count($Field) > 0) {
$fromclause = '';
// We only start this if we have fields, otherwise it would be dumb
-// echo "get everything\n";
- while (list(, $value) = each($Field)) {
+ foreach($Field AS $value) {
$parts = explode('.', $value);
if (!empty($parts[0]) && !empty($parts[1])) {
$tab_raw = urldecode($parts[0]);
$tab = str_replace('`', '', $tab_raw);
-// echo 'new Tab: ' . $tab . "\n";
$tab_all[$tab] = $tab;
+
$col_raw = urldecode($parts[1]);
$col_all[] = $tab . '.' . str_replace('`', '', $col_raw);
-// echo 'new col: ' . $tab . '.' . str_replace('`', '', $col_raw) . "\n";
}
} // end while
-// echo "check where clauses\n";
+ // Check 'where' clauses
if ($cfgRelation['relwork'] && count($tab_all) > 0) {
// Now we need all tables that we have in the where clause
$crit_cnt = count($Criteria);
@@ -760,10 +757,9 @@ if (isset($Field) && count($Field) > 0) {
// Now we know that our array has the same numbers as $Criteria
// we can check which of our columns has a where clause
if (!empty($Criteria[$x])) {
- if (substr($Criteria[$x], 0, 1) == '=' || eregi('is', $Criteria[$x])) {
+ if (substr($Criteria[$x], 0, 1) == '=' || stristr($Criteria[$x], 'is')) {
$col_where[$col] = $col1;
$tab_wher[$tab] = $tab;
-// echo 'new where clause: ' . $tab_wher[$tab] . "||\n";
}
} // end if
} // end if
@@ -778,11 +774,9 @@ if (isset($Field) && count($Field) > 0) {
// If there is exactly one column that has a decent where-clause
// we will just use this
$master = key($tab_wher);
-// echo 'nur ein where: master = ' .$master . "||\n";
} else {
// Now let's find out which of the tables has an index
-// echo "prüfe indexe:\n";
- while (list(, $tab) = each($tab_all)) {
+ foreach($tab_all AS $tab) {
$ind_qry = 'SHOW INDEX FROM ' . PMA_backquote($tab);
$ind_rs = PMA_mysql_query($ind_qry);
while ($ind = PMA_mysql_fetch_array($ind_rs)) {
@@ -794,14 +788,12 @@ if (isset($Field) && count($Field) > 0) {
} else {
$col_unique[$col1] = 'N';
}
-//echo 'neuen unique index gefunden: ' . $col . "\n";
} else {
if (isset($col_where[$col1])) {
$col_index[$col1] = 'Y';
} else {
$col_index[$col1] = 'N';
}
-//echo 'neuen index gefunden: ' . $col . "\n";
}
}
} // end while (each col of tab)
@@ -809,20 +801,16 @@ if (isset($Field) && count($Field) > 0) {
// now we want to find the best.
if (isset($col_unique) && count($col_unique) > 0) {
$col_cand = $col_unique;
-//echo "Kandidaten sind jetzt alle mit unique index\n";
$needsort = 1;
} else if (isset($col_index) && count($col_index) > 0) {
$col_cand = $col_index;
$needsort = 1;
-//echo "Kandidaten sind jetzt alle mit index\n";
} else if (isset($col_where) && count($col_where) > 0) {
$col_cand = $tab_wher;
-//echo "Kandidaten sind jetzt alle im whereclause\n";
$needsort = 0;
} else {
$col_cand = $tab_all;
$needsort = 0;
-//echo "Kandidaten sind jetzt alle \n";
}
// If we came up with $col_unique (very good) or $col_index (still
@@ -830,7 +818,7 @@ if (isset($Field) && count($Field) > 0) {
// (that would mean that they were also found in the whereclauses
// which would be great). if yes, we take only those
if ($needsort == 1) {
- while (list($col, $is_where) = each($col_cand)) {
+ foreach($col_cand AS $col => $is_where) {
$tab = explode('.', $col);
$tab = $tab[0];
if ($is_where == 'Y') {
@@ -841,10 +829,10 @@ if (isset($Field) && count($Field) > 0) {
}
if (isset($vg)) {
$col_cand = $vg;
-//echo "Kandidaten konnten auf index+where beschränkt werden\n";
+ // Candidates restricted in index+where
} else {
$col_cand = $sg;
-//echo "keiner der Kandidaten mit Index ist im wherclause\n";
+ // None of the candidates where in a where-clause
}
}
@@ -854,38 +842,29 @@ if (isset($Field) && count($Field) > 0) {
// the Criteria which gives the smallest result set in its table,
// but it would take too much time to check this
if (count($col_cand) > 1) {
-//echo "wir haben immer noch mehr als einen Kandidaten. Prüfe Größe\n";
// Of course we only want to check each table once
$checked_tables = $col_cand;
- while (list(, $tab) = each($col_cand)) {
+ foreach($col_cand AS $tab) {
if ($checked_tables[$tab] != 1 ) {
-//echo 'prüfe jetzt: Tabelle ' . $tab . "\n";
$rows_qry = 'SELECT COUNT(1) AS anz '
. 'FROM ' . PMA_backquote($tab);
$rows_rs = PMA_mysql_query($rows_qry);
while ($res = PMA_mysql_fetch_array($rows_rs)) {
$tsize[$tab] = $res['anz'];
-//echo "$tab hat: " . $tsize[$tab] . "\n";
}
$checked_tables[$tab] = 1;
}
$csize[$tab] = $tsize[$tab];
-//echo 'erster csize: ' . $csize[$tab] . "\n";
}
asort($csize);
reset($csize);
- $master = key($csize);
-//echo 'kleinste Datei: ' . $master . "\n";
+ $master = key($csize); // Smallest
} else {
- //$master = $col_cand[0];
reset($col_cand);
- $master = current($col_cand);
-//echo 'master ist der einzige Kandidat: ' . $master . "\n";
+ $master = current($col_cand); // Only one single candidate
+ //
}
} // end if (exactly one where clause)
-//echo 'ich habe mich entschieden: ' . $master;
-//die;
-
/**
* Removes unwanted entries from an array (PHP3 compliant)
@@ -899,7 +878,7 @@ if (isset($Field) && count($Field) > 0) {
*/
function PMA_arrayShort($array, $key)
{
- while (list($k, $v) = each($array)) {
+ foreach($array AS $k => $v) {
if ($k != $key) {
$reta[$k] = $v;
}
@@ -986,7 +965,7 @@ if (isset($Field) && count($Field) > 0) {
$run++;
if ($run > 5) {
- while (list(, $tab) = each($tab_left)) {
+ foreach($tab_left AS $tab) {
$emerg .= ', ' . $tab;
$tab_left = PMA_arrayShort($tab_left, $tab);
}
@@ -1099,4 +1078,4 @@ if (!empty($qry_orderby)) {
* Displays the footer
*/
require('./footer.inc.php');
-?>
+?>
\ No newline at end of file
diff --git a/db_details_structure.php b/db_details_structure.php
index 3580b4dfe..3986c4806 100644
--- a/db_details_structure.php
+++ b/db_details_structure.php
@@ -148,8 +148,8 @@ if ($cfg['PropertiesIconic'] == true) {
if ($num_tables == 0) {
echo $strNoTablesFound . "\n";
}
-// 2. Shows table informations on mysql >= 3.23.03 - staybyte - 11 June 2001
-else if (PMA_MYSQL_INT_VERSION >= 32303) {
+// 2. Shows table informations - staybyte - 11 June 2001
+else {
// Get additional information about tables for tooltip
if ($cfg['ShowTooltip']) {
$tooltip_truename = array();
@@ -211,7 +211,7 @@ else if (PMA_MYSQL_INT_VERSION >= 32303) {
$checked = (!empty($checkall) ? ' checked="checked"' : '');
$num_columns = ($cfg['PropertiesNumColumns'] > 1 ? (ceil($num_tables / $cfg['PropertiesNumColumns']) + 1) : 0);
$row_count = 0;
- while (list($keyname, $sts_data) = each($tables)) {
+ foreach($tables AS $keyname => $sts_data) {
$table = $sts_data['Name'];
$table_encoded = urlencode($table);
$table_name = htmlspecialchars($table);
@@ -316,7 +316,7 @@ else if (PMA_MYSQL_INT_VERSION >= 32303) {
if (isset($sts_data['Rows'])) {
// MyISAM, ISAM or Heap table: Row count, data size and index size
// is accurate.
- if (isset($sts_data['Type']) && ereg('^(MyISAM|ISAM|HEAP)$', $sts_data['Type'])) {
+ if (isset($sts_data['Type']) && preg_match('@^(MyISAM|ISAM|HEAP)$@', $sts_data['Type'])) {
if ($cfg['ShowStats']) {
$tblsize = doubleval($sts_data['Data_length']) + doubleval($sts_data['Index_length']);
$sum_size += $tblsize;
@@ -356,7 +356,7 @@ else if (PMA_MYSQL_INT_VERSION >= 32303) {
}
// Merge or BerkleyDB table: Only row count is accurate.
- else if (isset($sts_data['Type']) && ereg('^(MRG_MyISAM|BerkeleyDB)$', $sts_data['Type'])) {
+ else if (isset($sts_data['Type']) && preg_match('@^(MRG_MyISAM|BerkeleyDB)$@', $sts_data['Type'])) {
if ($cfg['ShowStats']) {
$formated_size = ' - ';
$unit = '';
@@ -530,145 +530,12 @@ if ($cfg['PropertiesNumColumns'] > 1) {
?>
= 3.23.03
-
-// 3. Shows tables list mysql < 3.23.03
-else {
- if ($cfgRelation['commwork']) {
- $comment = PMA_getComments($db);
-
- /**
- * Displays table comment
- */
- if (is_array($comment)) {
- ?>
-
-
-
-
-
-
-
-
0) {
$val) {
echo '= 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);
- $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
- // Blending out tables in use
- if ($result != FALSE && mysql_num_rows($result) > 0) {
- while ($tmp = PMA_mysql_fetch_array($result)) {
- // if in use memorize tablename
- if (eregi('in_use=[1-9]+', $tmp[0])) {
- $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);
+ $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
+ // Blending out tables in use
+ if ($result != FALSE && mysql_num_rows($result) > 0) {
+ while ($tmp = PMA_mysql_fetch_array($result)) {
+ // if in use memorize tablename
+ if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
+ $sot_cache[$tmp[0]] = TRUE;
}
- mysql_free_result($result);
+ }
+ mysql_free_result($result);
- if (isset($sot_cache)) {
- $local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
- $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
- if ($result != FALSE && mysql_num_rows($result) > 0) {
- while ($tmp = PMA_mysql_fetch_array($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);
- $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);
+ $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
+ if ($result != FALSE && mysql_num_rows($result) > 0) {
+ while ($tmp = PMA_mysql_fetch_array($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);
+ $sts_tmp = PMA_mysql_fetch_array($sts_result);
+ $tables[] = $sts_tmp;
+ } else { // table in use
+ $tables[] = array('Name' => $tmp[0]);
}
- mysql_free_result($result);
- $sot_ready = TRUE;
}
+ mysql_free_result($result);
+ $sot_ready = TRUE;
}
}
}
- if (!isset($sot_ready)) {
- $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
- $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
- if ($result != FALSE && mysql_num_rows($result) > 0) {
- while ($sts_tmp = PMA_mysql_fetch_array($result)) {
- $tables[] = $sts_tmp;
- }
- mysql_free_result($result);
- }
- }
- $num_tables = (isset($tables) ? count($tables) : 0);
-} // end if (PMA_MYSQL_INT_VERSION >= 32303)
-else {
- $result = PMA_mysql_list_tables($db);
- $num_tables = ($result) ? @mysql_numrows($result) : 0;
- for ($i = 0; $i < $num_tables; $i++) {
- $tables[] = PMA_mysql_tablename($result, $i);
- }
- mysql_free_result($result);
}
+if (!isset($sot_ready)) {
+ $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
+ $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
+ if ($result != FALSE && mysql_num_rows($result) > 0) {
+ while ($sts_tmp = PMA_mysql_fetch_array($result)) {
+ $tables[] = $sts_tmp;
+ }
+ mysql_free_result($result);
+ }
+}
+$num_tables = (isset($tables) ? count($tables) : 0);
if ($cfgRelation['commwork']) {
$comment = PMA_getComments($db);
@@ -114,7 +104,7 @@ if ($num_tables == 0) {
echo $strNoTablesFound;
}
// 2. Shows table informations on mysql >= 3.23.03 - staybyte - 11 June 2001
-else if (PMA_MYSQL_INT_VERSION >= 32303) {
+else {
?>
@@ -133,7 +123,7 @@ else if (PMA_MYSQL_INT_VERSION >= 32303) {
$sts_data) {
$table = $sts_data['Name'];
$bgcolor = ($i++ % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
echo "\n";
@@ -149,7 +139,7 @@ else if (PMA_MYSQL_INT_VERSION >= 32303) {
if (isset($sts_data['Type'])) {
if ($sts_data['Type'] == 'MRG_MyISAM') {
$mergetable = TRUE;
- } else if (!eregi('ISAM|HEAP', $sts_data['Type'])) {
+ } else if (!preg_match('@ISAM|HEAP@i', $sts_data['Type'])) {
$nonisam = TRUE;
}
}
@@ -295,42 +285,7 @@ else if (PMA_MYSQL_INT_VERSION >= 32303) {
= 3.23.03
-
-// 3. Shows tables list mysql < 3.23.03
-else {
- $i = 0;
- echo "\n";
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ' . "\n";
require('./footer.inc.php');
-?>
+?>
\ No newline at end of file
diff --git a/db_search.php b/db_search.php
index 4dfc43937..ad78f46e8 100644
--- a/db_search.php
+++ b/db_search.php
@@ -380,4 +380,4 @@ echo"\n";
*/
echo "\n";
require('./footer.inc.php');
-?>
+?>
\ No newline at end of file
diff --git a/export.php b/export.php
index 9d947c617..017587acb 100644
--- a/export.php
+++ b/export.php
@@ -157,7 +157,7 @@ $output_charset_conversion = $asfile &&
$buffer_needed = isset($compression) && ($compression == 'zip' | $compression == 'gzip' | $compression == 'bzip');
// Use on fly compression?
-$onfly_compression = $GLOBALS['cfg']['CompressOnFly'] && PMA_PHP_INT_VERSION >= 40004 && isset($compression) && ($compression == 'gzip' | $compression == 'bzip');
+$onfly_compression = $GLOBALS['cfg']['CompressOnFly'] && isset($compression) && ($compression == 'gzip' | $compression == 'bzip');
if ($onfly_compression) {
$memory_limit = trim(@ini_get('memory_limit'));
// 2 MB as default
@@ -248,7 +248,7 @@ if ($save_on_server) {
if (substr($cfg['SaveDir'], -1) != '/') {
$cfg['SaveDir'] .= '/';
}
- $save_filename = $cfg['SaveDir'] . ereg_replace('[/\\]','_',$filename);
+ $save_filename = $cfg['SaveDir'] . preg_replace('@[/\\]@','_',$filename);
unset($message);
if (file_exists($save_filename) && empty($onserverover)) {
$message = sprintf($strFileAlreadyExists, htmlspecialchars($save_filename));
@@ -364,8 +364,7 @@ if ($export_type == 'server') {
$tmp_select = '|' . $tmp_select . '|';
}
// Walk over databases
- reset($dblist);
- while (list(, $current_db) = each($dblist)) {
+ foreach($dblist AS $current_db) {
if ((isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))
|| !isset($tmp_select)) {
PMA_exportDBHeader($current_db);
@@ -438,7 +437,7 @@ if (!empty($asfile)) {
// Do the compression
// 1. as a gzipped file
if (isset($compression) && $compression == 'zip') {
- if (PMA_PHP_INT_VERSION >= 40000 && @function_exists('gzcompress')) {
+ if (@function_exists('gzcompress')) {
if ($type == 'csv' ) {
$extbis = '.csv';
} else if ($type == 'xml') {
@@ -453,10 +452,9 @@ if (!empty($asfile)) {
}
// 2. as a bzipped file
else if (isset($compression) && $compression == 'bzip') {
- if (PMA_PHP_INT_VERSION >= 40004 && @function_exists('bzcompress')) {
+ if (@function_exists('bzcompress')) {
$dump_buffer = bzcompress($dump_buffer);
- // nijel: eval in next line is because otherwise === causes syntax error on php3
- if (eval('return($dump_buffer === -8);')) {
+ if ($dump_buffer === -8) {
include('./header.inc.php');
echo sprintf($strBzError, '17300 ');
include('./footer.inc.php');
@@ -466,7 +464,7 @@ if (!empty($asfile)) {
}
// 3. as a gzipped file
else if (isset($compression) && $compression == 'gzip') {
- if (PMA_PHP_INT_VERSION >= 40004 && @function_exists('gzencode')) {
+ if (@function_exists('gzencode')) {
// without the optional parameter level because it bug
$dump_buffer = gzencode($dump_buffer);
}
@@ -511,4 +509,4 @@ else {
echo "\n";
include('./footer.inc.php');
} // end if
-?>
+?>
\ No newline at end of file
diff --git a/footer.inc.php b/footer.inc.php
index 701dc03f3..31beba6fd 100644
--- a/footer.inc.php
+++ b/footer.inc.php
@@ -153,4 +153,4 @@ if (isset($GLOBALS['cfg']['OBGzip']) && $GLOBALS['cfg']['OBGzip']
PMA_outBufferPost($GLOBALS['ob_mode']);
}
-?>
+?>
\ No newline at end of file
diff --git a/header.inc.php b/header.inc.php
index fb9961389..86202f0c9 100644
--- a/header.inc.php
+++ b/header.inc.php
@@ -159,4 +159,4 @@ if (!defined('PMA_HEADER_INC_INCLUDED')) {
*/
$GLOBALS['is_header_sent'] = TRUE;
} // PMA_HEADER_INC_INCLUDED
-?>
+?>
\ No newline at end of file
diff --git a/header_printview.inc.php b/header_printview.inc.php
index 044afb05e..3d86ba7ea 100644
--- a/header_printview.inc.php
+++ b/header_printview.inc.php
@@ -68,4 +68,4 @@ if ($text_dir == 'ltr') {
* Sets a variable to remember headers have been sent
*/
$is_header_sent = TRUE;
-?>
+?>
\ No newline at end of file
diff --git a/index.php b/index.php
index a2e626e2e..0925c27e8 100644
--- a/index.php
+++ b/index.php
@@ -18,9 +18,6 @@ if (empty($HTTP_HOST)) {
if (!empty($_ENV) && isset($_ENV['HTTP_HOST'])) {
$HTTP_HOST = $_ENV['HTTP_HOST'];
}
- else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['HTTP_HOST'])) {
- $HTTP_HOST = $HTTP_ENV_VARS['HTTP_HOST'];
- }
else if (@getenv('HTTP_HOST')) {
$HTTP_HOST = getenv('HTTP_HOST');
}
@@ -115,4 +112,4 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
}
?>
-