diff --git a/ChangeLog b/ChangeLog index fa5f62dee..046c01c10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ phpMyAdmin - ChangeLog $Id$ $HeadURL$ +2006-12-10 Marc Delisle + * many scripts: we were using "uva" in variables and function names, + this was code suggested by University of Virginia; I improved the code + by removing this uva prefix + 2006-12-07 Marc Delisle * libraries/ip_allow_deny.lib.php: checks that the header contains only one IP address, thanks to Christian Schmidt diff --git a/libraries/PMA_List_Database.class.php b/libraries/PMA_List_Database.class.php index 648f3c9b7..4d248e79e 100644 --- a/libraries/PMA_List_Database.class.php +++ b/libraries/PMA_List_Database.class.php @@ -456,9 +456,9 @@ require_once './libraries/PMA_List.class.php'; WHERE `Select_priv` = 'Y' AND `User` IN ('" . PMA_sqlAddslashes($GLOBALS['cfg']['Server']['user']) . "', '')"; - $uva_mydbs = PMA_DBI_fetch_result($local_query, null, null, + $tmp_mydbs = PMA_DBI_fetch_result($local_query, null, null, $GLOBALS['controllink']); - if ($uva_mydbs) { + if ($tmp_mydbs) { // Will use as associative array of the following 2 code // lines: // the 1st is the only line intact from before @@ -469,38 +469,38 @@ require_once './libraries/PMA_List.class.php'; // populating $dblist[], as previous code did. But it is // now populated with actual database names instead of // with regular expressions. - var_dump($uva_mydbs); - $uva_alldbs = PMA_DBI_query('SHOW DATABASES;', $GLOBALS['controllink']); + var_dump($tmp_mydbs); + $tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $GLOBALS['controllink']); // loic1: all databases cases - part 2 - if (isset($uva_mydbs['%'])) { - while ($uva_row = PMA_DBI_fetch_row($uva_alldbs)) { - $dblist[] = $uva_row[0]; + if (isset($tmp_mydbs['%'])) { + while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) { + $dblist[] = $tmp_row[0]; } // end while } else { - while ($uva_row = PMA_DBI_fetch_row($uva_alldbs)) { - $uva_db = $uva_row[0]; - if (isset($uva_mydbs[$uva_db]) && $uva_mydbs[$uva_db] == 1) { - $dblist[] = $uva_db; - $uva_mydbs[$uva_db] = 0; - } elseif (!isset($dblist[$uva_db])) { - foreach ($uva_mydbs as $uva_matchpattern => $uva_value) { + while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) { + $tmp_db = $tmp_row[0]; + if (isset($tmp_mydbs[$tmp_db]) && $tmp_mydbs[$tmp_db] == 1) { + $dblist[] = $tmp_db; + $tmp_mydbs[$tmp_db] = 0; + } elseif (!isset($dblist[$tmp_db])) { + foreach ($tmp_mydbs as $tmp_matchpattern => $tmp_value) { // loic1: fixed bad regexp // TODO: db names may contain characters // that are regexp instructions $re = '(^|(\\\\\\\\)+|[^\])'; - $uva_regex = ereg_replace($re . '%', '\\1.*', ereg_replace($re . '_', '\\1.{1}', $uva_matchpattern)); + $tmp_regex = ereg_replace($re . '%', '\\1.*', ereg_replace($re . '_', '\\1.{1}', $tmp_matchpattern)); // Fixed db name matching // 2000-08-28 -- Benjamin Gandon - if (ereg('^' . $uva_regex . '$', $uva_db)) { - $dblist[] = $uva_db; + if (ereg('^' . $tmp_regex . '$', $tmp_db)) { + $dblist[] = $tmp_db; break; } } // end while } // end if ... elseif ... } // end while } // end else - PMA_DBI_free_result($uva_alldbs); - unset($uva_mydbs); + PMA_DBI_free_result($tmp_alldbs); + unset($tmp_mydbs); } // end if // 2. get allowed dbs from the "mysql.tables_priv" table diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 009ea6e4b..ccda8b88c 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -2106,11 +2106,11 @@ window.parent.updateTableTitle('', '', 'unique_key > 0) { $unique_key .= $condition; } - $uva_nonprimary_condition .= $condition; + $nonprimary_condition .= $condition; } // end for - // Correction uva 19991216: prefer primary or unique keys - // for condition, but use conjunction of all values if no - // primary key + // Correction University of Virginia 19991216: + // prefer primary or unique keys for condition, + // but use conjunction of all values if no primary key if ($primary_key) { - $uva_condition = $primary_key; + $preferred_condition = $primary_key; } elseif ($unique_key) { - $uva_condition = $unique_key; + $preferred_condition = $unique_key; } else { - $uva_condition = $uva_nonprimary_condition; + $preferred_condition = $nonprimary_condition; } - return preg_replace('|\s?AND$|', '', $uva_condition); + return preg_replace('|\s?AND$|', '', $preferred_condition); } // end function /** - * Function to generate unique condition for specified row. + * Generate a button or image tag * * @param string name of button element * @param string class of button element diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 9bbad7520..cda621e05 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -1011,7 +1011,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { $vertical_display['data'] = array(); $vertical_display['row_delete'] = array(); - // Correction uva 19991216 in the while below + // Correction University of Virginia 19991216 in the while below // Previous code assumed that all tables have keys, specifically that // the phpMyAdmin GUI should support row delete/edit only for such // tables. @@ -1068,7 +1068,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { // 1. Prepares the row (gets primary keys to use) // 1.1 Results from a "SELECT" statement -> builds the // "primary" key to use in links - $uva_condition = urlencode(PMA_getUvaCondition($dt_result, $fields_cnt, $fields_meta, $row)); + $unique_condition = urlencode(PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row)); // 1.2 Defines the urls for the modify/delete link(s) $url_query = PMA_generate_common_url($db, $table) @@ -1093,7 +1093,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { $edit_url = 'tbl_change.php' . '?' . $url_query - . '&primary_key=' . $uva_condition + . '&primary_key=' . $unique_condition . '&sql_query=' . urlencode($url_sql_query) . '&goto=' . urlencode($lnk_goto); if ($GLOBALS['cfg']['PropertiesIconic'] === false) { @@ -1136,14 +1136,14 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { . '&sql_query=' . urlencode($url_sql_query) . '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted'])) . '&goto=' . (empty($goto) ? 'tbl_sql.php' : $goto); - $del_query = urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $uva_condition . '+LIMIT+1'; + $del_query = urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $unique_condition . '+LIMIT+1'; $del_url = 'sql.php' . '?' . $url_query . '&sql_query=' . $del_query . '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted'])) . '&goto=' . urlencode($lnk_goto); $js_conf = 'DELETE FROM ' . PMA_jsFormat($table) - . ' WHERE ' . trim(PMA_jsFormat(urldecode($uva_condition), false)) + . ' WHERE ' . trim(PMA_jsFormat(urldecode($unique_condition), false)) . ' LIMIT 1'; if ($GLOBALS['cfg']['PropertiesIconic'] === false) { $del_str = $GLOBALS['strDelete']; @@ -1236,7 +1236,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { $transform_options['wrapper_link'] = '?' . (isset($url_query) ? $url_query : '') - . '&primary_key=' . (isset($uva_condition) ? $uva_condition : '') + . '&primary_key=' . (isset($unique_condition) ? $unique_condition : '') . '&sql_query=' . (isset($sql_query) ? urlencode($url_sql_query) : '') . '&goto=' . (isset($sql_goto) ? urlencode($lnk_goto) : '') . '&transform_key=' . urlencode($meta->name); @@ -1485,7 +1485,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { if (!empty($del_url) && $is_display['del_lnk'] != 'kp') { $vertical_display['row_delete'][$row_no] .= ' ' . "\n" - . ' ' . "\n" . ' ' . "\n"; diff --git a/libraries/display_tbl_links.lib.php b/libraries/display_tbl_links.lib.php index 2264c1354..b02dbaf1e 100644 --- a/libraries/display_tbl_links.lib.php +++ b/libraries/display_tbl_links.lib.php @@ -12,7 +12,7 @@ if ( $doWriteModifyAt == 'left' ){ if (!empty($del_url) && $is_display['del_lnk'] != 'kp') { echo ' ' . "\n" - . ' ' . "\n" . ' ' . "\n"; @@ -42,7 +42,7 @@ if ( $doWriteModifyAt == 'left' ){ } if (!empty($del_url) && $is_display['del_lnk'] != 'kp') { echo ' ' . "\n" - . ' ' . "\n" . ' ' . "\n"; diff --git a/libraries/export/sql.php b/libraries/export/sql.php index 9cd79644a..b69782548 100644 --- a/libraries/export/sql.php +++ b/libraries/export/sql.php @@ -796,7 +796,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) $insert_line .= $field_set[$i] . ' = ' . $values[$i]; } - $insert_line .= ' WHERE ' . PMA_getUvaCondition($result, $fields_cnt, $fields_meta, $row); + $insert_line .= ' WHERE ' . PMA_getUniqueCondition($result, $fields_cnt, $fields_meta, $row); } else { diff --git a/tbl_replace.php b/tbl_replace.php index fa14c6a6b..11d99b2ba 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -70,7 +70,7 @@ if (isset($after_insert) && $after_insert == 'new_insert') { $res = PMA_DBI_query($local_query); $row = PMA_DBI_fetch_row($res); $meta = PMA_DBI_get_fields_meta($res); - $goto .= '&primary_key[]=' . urlencode(PMA_getUvaCondition($res, count($row), $meta, $row)); + $goto .= '&primary_key[]=' . urlencode(PMA_getUniqueCondition($res, count($row), $meta, $row)); } } } elseif ($goto == 'sql.php') {