From 37a4099a4f0cb32df6de2ecee55b111fd8f18a7c Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Thu, 18 Oct 2007 08:51:19 +0000 Subject: [PATCH] cleanup --- libraries/display_tbl.lib.php | 6 +----- tbl_change.php | 14 +++++--------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 3419c12a3..e2d64d78d 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -1168,10 +1168,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { // 2. Displays the rows' values for ($i = 0; $i < $fields_cnt; ++$i) { $meta = $fields_meta[$i]; - // loic1: To fix bug #474943 under php4, the row pointer will - // depend on whether the "is_null" php4 function is - // available or not - $pointer = (function_exists('is_null') ? $i : $meta->name); + $pointer = $i; // garvin: See if this column should get highlight because it's used in the // where-query. if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) { @@ -1239,7 +1236,6 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { // with self-join queries, for example), using $meta->name // will show both fields NULL even if only one is NULL, // so use the $pointer - // (works only if function_exists('is_null') // PS: why not always work with the number ($i), since // the default second parameter of // mysql_fetch_array() is MYSQL_BOTH, so we always get diff --git a/tbl_change.php b/tbl_change.php index fe2d48e9d..8286986e3 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -399,15 +399,11 @@ foreach ($rows as $row_id => $vrow) { if ($field['Type'] == 'datetime' && ! isset($field['Default']) - && ! is_null($field['Default'])) { - // INSERT case - if ($insert_mode) { - $vrow[$field['Field']] = date('Y-m-d H:i:s', time()); - } - // UPDATE case with an empty and not NULL value under PHP4 - elseif (empty($vrow[$field['Field']]) && is_null($vrow[$field['Field']])) { - $vrow[$field['Field']] = date('Y-m-d H:i:s', time()); - } // end if... elseif... + && ! is_null($field['Default']) + && ($insert_mode || ! isset($vrow[$field['Field']]))) { + // INSERT case or + // UPDATE case with an NULL value + $vrow[$field['Field']] = date('Y-m-d H:i:s', time()); } ?>