From c2b46ac9452b997ff61664e3f15a0f4e1367b1b2 Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Sat, 22 Nov 2003 20:57:48 +0000 Subject: [PATCH] Final batch of PHP3-Compatibility fixes. Please test. :-) --- ChangeLog | 3 + Documentation.html | 1 - browse_foreigners.php | 2 +- chk_rel.php | 2 +- db_create.php | 2 +- db_datadict.php | 48 ++++------- db_details.php | 4 +- db_details_common.php | 2 +- db_details_db_info.php | 87 +++++++++----------- db_details_export.php | 4 +- db_details_importdocsql.php | 31 ++----- db_details_links.php | 1 - db_details_qbe.php | 61 +++++--------- db_details_structure.php | 147 ++-------------------------------- db_printview.php | 129 ++++++++++------------------- db_search.php | 2 +- export.php | 18 ++--- footer.inc.php | 2 +- header.inc.php | 2 +- header_printview.inc.php | 2 +- index.php | 5 +- ldi_check.php | 47 ++++------- ldi_table.php | 2 +- left.php | 18 ++--- main.php | 40 ++++----- mult_submits.inc.php | 4 +- pdf_pages.php | 29 +++---- pdf_schema.php | 116 +++++++++------------------ phpinfo.php | 2 +- queryframe.php | 2 +- querywindow.php | 8 +- read_dump.php | 20 ++--- scripts/decode_bug.php | 3 - server_collations.php | 5 +- server_common.inc.php | 2 +- server_databases.php | 2 +- server_export.php | 6 +- server_links.inc.php | 2 +- server_privileges.php | 24 +----- server_processlist.php | 2 +- server_status.php | 4 +- sql.php | 50 ++++++------ tbl_addfield.php | 22 +++-- tbl_alter.php | 13 ++- tbl_change.php | 30 ++++--- tbl_create.php | 21 +++-- tbl_indexes.php | 32 ++++---- tbl_move_copy.php | 12 ++- tbl_printview.php | 50 +++++------- tbl_properties.inc.php | 97 +++++++++++----------- tbl_properties.php | 2 +- tbl_properties_common.php | 2 +- tbl_properties_export.php | 2 +- tbl_properties_links.php | 1 - tbl_properties_operations.php | 111 +++++++++++-------------- tbl_properties_structure.php | 33 ++++---- tbl_properties_table_info.php | 44 +++++----- tbl_query_box.php | 26 +++--- tbl_relation.php | 21 +++-- tbl_rename.php | 2 +- tbl_replace.php | 24 +++--- tbl_replace_fields.php | 26 ++---- tbl_row_delete.php | 2 +- tbl_select.php | 26 +++--- transformation_wrapper.php | 13 ++- user_password.php | 4 +- 66 files changed, 570 insertions(+), 989 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0a447e65..d3bb40876 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - Changelog $Id$ $Source$ +2003-11-22 Garvin Hicking + * ./*: More PHP3-compatibility removal, see 2003-11-20. + 2003-11-22 Marc Delisle * tbl_properties_operations.php: display "Add constraints" only if there are foreign keys in current table diff --git a/Documentation.html b/Documentation.html index bf42f267f..e78482888 100755 --- a/Documentation.html +++ b/Documentation.html @@ -3443,7 +3443,6 @@ To create a new, empty mimetype please see libraries/transformations/template_ge Your initial query which is going to be stored as a bookmark has to yield at least one result row so you can store the bookmark. You may have that to work around using well positioned "/**/" comments.
- Variable expansion with PHP-Versions prior to 4.0.3 may not work as expected due to a necessary extra-space after any [VARIABLE] usage

diff --git a/browse_foreigners.php b/browse_foreigners.php index addd13d80..b702384c4 100644 --- a/browse_foreigners.php +++ b/browse_foreigners.php @@ -109,7 +109,7 @@ if ($the_total > $per_page) { if ($i == $pageNow) { $selected = 'selected="selected"'; } else { - $selected = ""; + $selected = ''; } $gotopage .= ' ' . "\n"; } diff --git a/chk_rel.php b/chk_rel.php index 5e0058bea..206af9d7f 100644 --- a/chk_rel.php +++ b/chk_rel.php @@ -23,4 +23,4 @@ $cfgRelation = PMA_getRelationsParam(TRUE); */ echo "\n"; require('./footer.inc.php'); -?> +?> \ No newline at end of file diff --git a/db_create.php b/db_create.php index b01c88eb6..a15ca13d9 100644 --- a/db_create.php +++ b/db_create.php @@ -34,4 +34,4 @@ $result = PMA_mysql_query('CREATE DATABASE ' . PMA_backquote($db)) or PMA_m $message = $strDatabase . ' ' . htmlspecialchars($db) . ' ' . $strHasBeenCreated; require('./' . $cfg['DefaultTabDatabase']); -?> +?> \ No newline at end of file diff --git a/db_datadict.php b/db_datadict.php index 5601a99db..8e1024df2 100644 --- a/db_datadict.php +++ b/db_datadict.php @@ -61,12 +61,7 @@ if (!$rowset) { } $count = 0; while ($row = mysql_fetch_array($rowset)) { - if (PMA_MYSQL_INT_VERSION >= 32303) { - $myfieldname = 'Tables_in_' . htmlspecialchars($db); - } - else { - $myfieldname = 'Tables in ' . htmlspecialchars($db); - } + $myfieldname = 'Tables_in_' . htmlspecialchars($db); $table = $row[$myfieldname]; if ($cfgRelation['commwork']) { $comments = PMA_getComments($db, $table); @@ -81,19 +76,11 @@ while ($row = mysql_fetch_array($rowset)) { * Gets table informations */ // The 'show table' statement works correct since 3.23.03 - if (PMA_MYSQL_INT_VERSION >= 32303) { - $local_query = 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''; - $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); - $showtable = PMA_mysql_fetch_array($result); - $num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0); - $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : ''); - } else { - $local_query = 'SELECT COUNT(*) AS count FROM ' . PMA_backquote($table); - $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); - $showtable = array(); - $num_rows = PMA_mysql_result($result, 0, 'count'); - $show_comment = ''; - } // end display comments + $local_query = 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''; + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); + $showtable = PMA_mysql_fetch_array($result); + $num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0); + $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : ''); if ($result) { mysql_free_result($result); } @@ -130,10 +117,7 @@ while ($row = mysql_fetch_array($rowset)) { // I don't know what does following column mean.... // $indexes_info[$row['Key_name']]['Packed'] = $row['Packed']; - if (PMA_MYSQL_INT_VERSION >= 32300) { - // rabus: The 'Comment' field was added in MySQL 3.23.0. - $indexes_info[$row['Key_name']]['Comment'] = $row['Comment']; - } + $indexes_info[$row['Key_name']]['Comment'] = $row['Comment']; $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name']; if (isset($row['Sub_part'])) { @@ -214,8 +198,8 @@ while ($row = mysql_fetch_array($rowset)) { $type = $row['Type']; // reformat mysql query output - staybyte - 9. June 2001 // loic1: set or enum types: slashes single quotes inside options - if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { - $tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1); + if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) { + $tmp[2] = substr(preg_replace('@([^,])\'\'', '\\1\\\'@', ',' . $tmp[2]), 1); $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $type_nowrap = ''; @@ -223,13 +207,13 @@ while ($row = mysql_fetch_array($rowset)) { $unsigned = 0; $zerofill = 0; } else { - $binary = eregi('BINARY', $row['Type'], $test); - $unsigned = eregi('UNSIGNED', $row['Type'], $test); - $zerofill = eregi('ZEROFILL', $row['Type'], $test); + $binary = stristr($row['Type'], 'binary'); + $unsigned = stristr($row['Type'], 'unsigned'); + $zerofill = stristr($row['Type'], 'zerofill'); $type_nowrap = ' nowrap="nowrap"'; - $type = eregi_replace('BINARY', '', $type); - $type = eregi_replace('ZEROFILL', '', $type); - $type = eregi_replace('UNSIGNED', '', $type); + $type = preg_replace('@BINARY@i', '', $type); + $type = preg_replace('@ZEROFILL@i', '', $type); + $type = preg_replace('@UNSIGNED@i', '', $type); if (empty($type)) { $type = ' '; } @@ -334,4 +318,4 @@ function printPage() echo '

 ' . "\n"; require('./footer.inc.php'); -?> +?> \ No newline at end of file diff --git a/db_details.php b/db_details.php index 884f30653..532ae93da 100644 --- a/db_details.php +++ b/db_details.php @@ -173,7 +173,7 @@ if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) { echo '
' . "\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++) {
/> - - -    - - - - - - - - - - - - - - - - - - - - - - - - - - - <?php echo $strWithChecked; ?> - - -  /  - - - - - - - - -    - -    - - - - - 1) { -?> - - - - - -
- 0) { ' . "\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']) { } ?> - + \ No newline at end of file diff --git a/ldi_check.php b/ldi_check.php index 107f3200d..70d4c5ccc 100644 --- a/ldi_check.php +++ b/ldi_check.php @@ -34,15 +34,9 @@ if (isset($btnLDI) && isset($local_textfile) && $local_textfile != '') { 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'); } @@ -54,15 +48,9 @@ if (isset($btnLDI) && isset($local_textfile) && $local_textfile != '') { if (substr($cfg['UploadDir'], -1) != '/') { $cfg['UploadDir'] .= '/'; } - $textfile = $DOCUMENT_ROOT . dirname($PHP_SELF) . '/' . eregi_replace('^./', '', $cfg['UploadDir']) . eregi_replace('\.\.*', '.', $local_textfile); + $textfile = $DOCUMENT_ROOT . dirname($PHP_SELF) . '/' . preg_replace('@^./@', '', $cfg['UploadDir']) . preg_replace('@\.\.*@', '.', $local_textfile); if (file_exists($textfile)) { - $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" @@ -79,11 +67,7 @@ if (isset($btnLDI) && isset($local_textfile) && $local_textfile != '') { exit(); } else { $textfile_new = $tmp_subdir . basename($textfile); - if (PMA_PHP_INT_VERSION < 40003) { - copy($textfile, $textfile_new); - } else { - move_uploaded_file($textfile, $textfile_new); - } + move_uploaded_file($textfile, $textfile_new); $textfile = $textfile_new; $unlink_local_textfile = true; } @@ -158,19 +142,16 @@ if (isset($btnLDI) && empty($textfile)) { $sql_query .= ' LINES TERMINATED BY \'' . $line_terminator . '\''; } if (strlen($column_name) > 0) { - if (PMA_MYSQL_INT_VERSION >= 32306) { - $sql_query .= ' ('; - $tmp = split(',( ?)', $column_name); - for ($i = 0; $i < count($tmp); $i++) { - if ($i > 0) { - $sql_query .= ', '; - } - $sql_query .= PMA_backquote(trim($tmp[$i])); - } // end for - $sql_query .= ')'; - } else { - $sql_query .= ' (' . $column_name . ')'; - } + $sql_query .= ' ('; + $tmp = split(',( ?)', $column_name); + $cnt_tmp = count($tmp); + for ($i = 0; $i < $cnt_tmp; $i++) { + if ($i > 0) { + $sql_query .= ', '; + } + $sql_query .= PMA_backquote(trim($tmp[$i])); + } // end for + $sql_query .= ')'; } // We could rename the ldi* scripts to tbl_properties_ldi* to improve @@ -191,4 +172,4 @@ if (isset($btnLDI) && empty($textfile)) { else { include('./ldi_table.php'); } -?> +?> \ No newline at end of file diff --git a/ldi_table.php b/ldi_table.php index f6bb48492..11a8a40a5 100644 --- a/ldi_table.php +++ b/ldi_table.php @@ -195,4 +195,4 @@ if (PMA_MYSQL_INT_VERSION > 40003) { * Displays the footer */ require('./footer.inc.php'); -?> +?> \ No newline at end of file diff --git a/left.php b/left.php index 93b8776a6..703c3e98d 100644 --- a/left.php +++ b/left.php @@ -69,7 +69,7 @@ function PMA_indent($spaces) { function PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val, $childout = true) { $name = $key; - $id = eregi_replace('[^a-z0-9]*', '', $baseid . $keyhistory . $key) . $indent; + $id = preg_replace('@[^a-z0-9]*@i', '', $baseid . $keyhistory . $key) . $indent; $on_mouse = (($GLOBALS['cfg']['LeftPointerColor'] == '') ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $id . '\', \'' . $GLOBALS['cfg']['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $id . '\', \'' . $GLOBALS['cfg']['LeftBgColor'] . '\')}"'); @@ -103,7 +103,7 @@ function PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent $indent++; } - while(list($key, $val) = each($tablestack)) { + foreach($tablestack AS $key => $val) { if ($key != 'pma_name' && $key != 'pma_list_item') { if ($headerOut) { PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val); @@ -153,11 +153,11 @@ function PMA_nestedSet($baseid, $tablestack, $key = '__protected__', $keyhistory $on_mouse = (($GLOBALS['cfg']['LeftPointerColor'] == '') ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $keyhistory . $key . '\', \'' . $GLOBALS['cfg']['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $keyhistory . $key . '\', \'' . $GLOBALS['cfg']['LeftBgColor'] . '\')}"'); $loops = 0; - while(list($tkey, $tval) = each($tablestack['pma_name'])) { + foreach($tablestack['pma_name'] AS $tkey => $tval) { echo PMA_indent($indent * 5) . ''; $items = explode("\n", $tablestack['pma_list_item'][$tkey]); - while(list($ikey, $ival) = each($items)) { + foreach($items AS $ikey => $ival) { echo "\n"; echo PMA_indent(($indent * 5)) . $ival; } @@ -307,8 +307,7 @@ if ($cfg['LeftDisplayServers']) { $val) { if (!empty($val['host'])) { echo '