Correctly handle unix timestamp (RFE #1440386).

This commit is contained in:
Michal Čihař
2006-10-17 12:19:41 +00:00
parent cc2d695d8b
commit bc42b28304
2 changed files with 7 additions and 1 deletions

View File

@@ -11,6 +11,8 @@ $HeadURL$
for ON DUPLICATE KEY (bug #1576226). for ON DUPLICATE KEY (bug #1576226).
* Documentation.html, main.php, libraries/config.default.php: Add support * Documentation.html, main.php, libraries/config.default.php: Add support
for hiding server information. for hiding server information.
* libraries/transformations/text_plain__dateformat.inc.php: Correctly
handle unix timestamp (RFE #1440386).
2006-10-16 Michal Čihař <michal@cihar.com> 2006-10-16 Michal Čihař <michal@cihar.com>
* left.php, navigation.php, scripts/setup.php, js/querywindow.js, * left.php, navigation.php, scripts/setup.php, js/querywindow.js,

View File

@@ -39,9 +39,13 @@ function PMA_transformation_text_plain__dateformat($buffer, $options = array(),
$timestamp = mktime($d['hour'], $d['minute'], $d['second'], $d['month'], $d['day'], $d['year']); $timestamp = mktime($d['hour'], $d['minute'], $d['second'], $d['month'], $d['day'], $d['year']);
} }
// If all fails, assume one of the dozens of valid strtime() syntaxes (http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html) // If all fails, assume one of the dozens of valid strtime() syntaxes (http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html)
} else {
if (preg_match('/^[0-9]\d{1,9}$/', $buffer)) {
$timestamp = (int)$buffer;
} else { } else {
$timestamp = strtotime($buffer); $timestamp = strtotime($buffer);
} }
}
// If all above failed, maybe it's a Unix timestamp already? // If all above failed, maybe it's a Unix timestamp already?
if ($timestamp < 0 && preg_match('/^[1-9]\d{1,9}$/', $buffer)) { if ($timestamp < 0 && preg_match('/^[1-9]\d{1,9}$/', $buffer)) {