remove uva prefix
This commit is contained in:
@@ -5,6 +5,11 @@ phpMyAdmin - ChangeLog
|
||||
$Id$
|
||||
$HeadURL$
|
||||
|
||||
2006-12-10 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* 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 <lem9@users.sourceforge.net>
|
||||
* libraries/ip_allow_deny.lib.php: checks that the header contains
|
||||
only one IP address, thanks to Christian Schmidt
|
||||
|
@@ -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
|
||||
|
@@ -2106,11 +2106,11 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
|
||||
* @author Michal Cihar (michal@cihar.com)
|
||||
* @return string calculated condition
|
||||
*/
|
||||
function PMA_getUvaCondition($handle, $fields_cnt, $fields_meta, $row)
|
||||
function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row)
|
||||
{
|
||||
$primary_key = '';
|
||||
$unique_key = '';
|
||||
$uva_nonprimary_condition = '';
|
||||
$primary_key = '';
|
||||
$unique_key = '';
|
||||
$nonprimary_condition = '';
|
||||
|
||||
for ($i = 0; $i < $fields_cnt; ++$i) {
|
||||
$field_flags = PMA_DBI_field_flags($handle, $i);
|
||||
@@ -2185,25 +2185,25 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
|
||||
} elseif ($meta->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
|
||||
|
@@ -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] .= ' <td align="center" class="' . $class . '" ' . $column_style_vertical . '>' . "\n"
|
||||
. ' <input type="checkbox" id="id_rows_to_delete' . $row_no . '[%_PMA_CHECKBOX_DIR_%]" name="rows_to_delete[' . $uva_condition . ']"'
|
||||
. ' <input type="checkbox" id="id_rows_to_delete' . $row_no . '[%_PMA_CHECKBOX_DIR_%]" name="rows_to_delete[' . $unique_condition . ']"'
|
||||
. ' onclick="' . $column_marker_vertical . 'copyCheckboxesRange(\'rowsDeleteForm\', \'id_rows_to_delete' . $row_no . '\',\'[%_PMA_CHECKBOX_DIR_%]\');"'
|
||||
. ' value="' . $del_query . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n"
|
||||
. ' </td>' . "\n";
|
||||
|
@@ -12,7 +12,7 @@ if ( $doWriteModifyAt == 'left' ){
|
||||
|
||||
if (!empty($del_url) && $is_display['del_lnk'] != 'kp') {
|
||||
echo ' <td align="center">' . "\n"
|
||||
. ' <input type="checkbox" id="id_rows_to_delete' . $row_no . '" name="rows_to_delete[' . $uva_condition . ']"'
|
||||
. ' <input type="checkbox" id="id_rows_to_delete' . $row_no . '" name="rows_to_delete[' . $unique_condition . ']"'
|
||||
. ' onclick="copyCheckboxesRange(\'rowsDeleteForm\', \'id_rows_to_delete' . $row_no . '\',\'l\');"'
|
||||
. ' value="' . $del_query . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n"
|
||||
. ' </td>' . "\n";
|
||||
@@ -42,7 +42,7 @@ if ( $doWriteModifyAt == 'left' ){
|
||||
}
|
||||
if (!empty($del_url) && $is_display['del_lnk'] != 'kp') {
|
||||
echo ' <td align="center">' . "\n"
|
||||
. ' <input type="checkbox" id="id_rows_to_delete' . $row_no . 'r" name="rows_to_delete[' . $uva_condition . ']"'
|
||||
. ' <input type="checkbox" id="id_rows_to_delete' . $row_no . 'r" name="rows_to_delete[' . $unique_condition . ']"'
|
||||
. ' onclick="copyCheckboxesRange(\'rowsDeleteForm\', \'id_rows_to_delete' . $row_no . '\',\'r\');"'
|
||||
. ' value="' . $del_query . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n"
|
||||
. ' </td>' . "\n";
|
||||
|
@@ -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 {
|
||||
|
||||
|
@@ -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') {
|
||||
|
Reference in New Issue
Block a user