Patch #697541
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2003-03-10 Garvin Hicking <me@supergarv.de>
|
||||||
|
* tbl_change.php3: Patch #697541 to prevent non-associative MySQL
|
||||||
|
fieldnames to be mapped to false keys for display.
|
||||||
|
|
||||||
2003-03-10 Marc Delisle <lem9@users.sourceforge.net>
|
2003-03-10 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* transformation_wrapper.php3, lang/*,
|
* transformation_wrapper.php3, lang/*,
|
||||||
libraries/transformations/image_png__inline.inc.php3:
|
libraries/transformations/image_png__inline.inc.php3:
|
||||||
|
@@ -84,6 +84,7 @@ if (isset($primary_key)) {
|
|||||||
$local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
|
$local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
|
||||||
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
|
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
|
||||||
$row = PMA_mysql_fetch_array($result);
|
$row = PMA_mysql_fetch_array($result);
|
||||||
|
|
||||||
// No row returned
|
// No row returned
|
||||||
if (!$row) {
|
if (!$row) {
|
||||||
unset($row);
|
unset($row);
|
||||||
@@ -199,6 +200,16 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
|
|
||||||
$row_table_def = PMA_mysql_fetch_array($table_def);
|
$row_table_def = PMA_mysql_fetch_array($table_def);
|
||||||
$field = $row_table_def['Field'];
|
$field = $row_table_def['Field'];
|
||||||
|
|
||||||
|
// garvin: possible workaround. If current field is numerical, do not try to
|
||||||
|
// access the result-array with its 'associative' key but with its numerical
|
||||||
|
// represantation.
|
||||||
|
if ((PMA_PHP_INT_VERSION > 40000 && is_numeric($field)) || eregi('^[0-9]*$', $field)) {
|
||||||
|
$rowfield = $i;
|
||||||
|
} else {
|
||||||
|
$rowfield = $field;
|
||||||
|
}
|
||||||
|
|
||||||
// loic1: current date should not be set as default if the field is NULL
|
// loic1: current date should not be set as default if the field is NULL
|
||||||
// for the current row
|
// for the current row
|
||||||
// lem9: but do not put here the current datetime if there is a default
|
// lem9: but do not put here the current datetime if there is a default
|
||||||
@@ -208,15 +219,15 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
&& (!isset($row_table_def['Default']))) {
|
&& (!isset($row_table_def['Default']))) {
|
||||||
// INSERT case
|
// INSERT case
|
||||||
if ($insert_mode) {
|
if ($insert_mode) {
|
||||||
$row[$field] = date('Y-m-d H:i:s', time());
|
$row[$rowfield] = date('Y-m-d H:i:s', time());
|
||||||
}
|
}
|
||||||
// UPDATE case with an empty and not NULL value under PHP4
|
// UPDATE case with an empty and not NULL value under PHP4
|
||||||
else if (empty($row[$field]) && function_exists('is_null')) {
|
else if (empty($row[$rowfield]) && function_exists('is_null')) {
|
||||||
$row[$field] = (is_null($row[$field]) ? $row[$field] : date('Y-m-d H:i:s', time()));
|
$row[$rowfield] = (is_null($row[$rowfield]) ? $row[$rowfield] : date('Y-m-d H:i:s', time()));
|
||||||
}
|
}
|
||||||
// UPDATE case with an empty value under PHP3
|
// UPDATE case with an empty value under PHP3
|
||||||
else if (empty($row[$field])) {
|
else if (empty($row[$rowfield])) {
|
||||||
$row[$field] = date('Y-m-d H:i:s', time());
|
$row[$rowfield] = date('Y-m-d H:i:s', time());
|
||||||
} // end if... else if... else if...
|
} // end if... else if... else if...
|
||||||
}
|
}
|
||||||
$len = (eregi('float|double', $row_table_def['Type']))
|
$len = (eregi('float|double', $row_table_def['Type']))
|
||||||
@@ -269,27 +280,27 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
// Prepares the field value
|
// Prepares the field value
|
||||||
if (isset($row)) {
|
if (isset($row)) {
|
||||||
// loic1: null field value
|
// loic1: null field value
|
||||||
if (!isset($row[$field])) {
|
if (!isset($row[$rowfield])) {
|
||||||
$row[$field] = 'NULL';
|
$row[$rowfield] = 'NULL';
|
||||||
$special_chars = '';
|
$special_chars = '';
|
||||||
$data = $row[$field];
|
$data = $row[$rowfield];
|
||||||
} else {
|
} else {
|
||||||
// loic1: special binary "characters"
|
// loic1: special binary "characters"
|
||||||
if ($is_binary || $is_blob) {
|
if ($is_binary || $is_blob) {
|
||||||
$row[$field] = str_replace("\x00", '\0', $row[$field]);
|
$row[$rowfield] = str_replace("\x00", '\0', $row[$rowfield]);
|
||||||
$row[$field] = str_replace("\x08", '\b', $row[$field]);
|
$row[$rowfield] = str_replace("\x08", '\b', $row[$rowfield]);
|
||||||
$row[$field] = str_replace("\x0a", '\n', $row[$field]);
|
$row[$rowfield] = str_replace("\x0a", '\n', $row[$rowfield]);
|
||||||
$row[$field] = str_replace("\x0d", '\r', $row[$field]);
|
$row[$rowfield] = str_replace("\x0d", '\r', $row[$rowfield]);
|
||||||
$row[$field] = str_replace("\x1a", '\Z', $row[$field]);
|
$row[$rowfield] = str_replace("\x1a", '\Z', $row[$rowfield]);
|
||||||
} // end if
|
} // end if
|
||||||
$special_chars = htmlspecialchars($row[$field]);
|
$special_chars = htmlspecialchars($row[$rowfield]);
|
||||||
$data = $row[$field];
|
$data = $row[$rowfield];
|
||||||
} // end if... else...
|
} // end if... else...
|
||||||
// loic1: if a timestamp field value is not included in an update
|
// loic1: if a timestamp field value is not included in an update
|
||||||
// statement MySQL auto-update it to the current timestamp
|
// statement MySQL auto-update it to the current timestamp
|
||||||
$backup_field = ($row_table_def['True_Type'] == 'timestamp')
|
$backup_field = ($row_table_def['True_Type'] == 'timestamp')
|
||||||
? ''
|
? ''
|
||||||
: '<input type="hidden" name="fields_prev[' . urlencode($field) . ']" value="' . urlencode($row[$field]) . '" />';
|
: '<input type="hidden" name="fields_prev[' . urlencode($field) . ']" value="' . urlencode($row[$rowfield]) . '" />';
|
||||||
} else {
|
} else {
|
||||||
// loic1: display default values
|
// loic1: display default values
|
||||||
if (!isset($row_table_def['Default'])) {
|
if (!isset($row_table_def['Default'])) {
|
||||||
|
Reference in New Issue
Block a user