00001 <?php
00002
00003
00004
00005 function PMA_transformation_text_plain__dateformat($buffer, $options = array(), $meta = '') {
00006
00007
00008
00009
00010 if (!isset($options[0]) || $options[0] == '') {
00011 $options[0] = 0;
00012 }
00013
00014 if (!isset($options[1]) || $options[1] == '') {
00015 $options[1] = $GLOBALS['datefmt'];
00016
00017 }
00018
00019 $timestamp = -1;
00020
00021
00022 if (preg_match('/^(\d{2}){3,7}$/', $buffer)) {
00023
00024 if (strlen($buffer) == 14 || strlen($buffer) == 8) {
00025 $offset = 4;
00026 } else {
00027 $offset = 2;
00028 }
00029
00030 $d = array();
00031 $d['year'] = substr($buffer, 0, $offset);
00032 $d['month'] = substr($buffer, $offset, 2);
00033 $d['day'] = substr($buffer, $offset + 2, 2);
00034 $d['hour'] = substr($buffer, $offset + 4, 2);
00035 $d['minute'] = substr($buffer, $offset + 6, 2);
00036 $d['second'] = substr($buffer, $offset + 8, 2);
00037
00038 if (checkdate($d['month'], $d['day'], $d['year'])) {
00039 $timestamp = mktime($d['hour'], $d['minute'], $d['second'], $d['month'], $d['day'], $d['year']);
00040 }
00041
00042 } else {
00043 $timestamp = strtotime($buffer);
00044 }
00045
00046
00047 if ($timestamp < 0 && preg_match('/^[1-9]\d{1,9}$/', $buffer)) {
00048 $timestamp = $buffer;
00049 }
00050
00051
00052 if ($timestamp >= 0) {
00053 $timestamp -= $options[0] * 60 * 60;
00054 $source = $buffer;
00055 $buffer = '<dfn onclick="alert(\'' . $source . '\');" title="' . $source . '">' . PMA_localisedDate($timestamp, $options[1]) . '</dfn>';
00056 }
00057
00058 return $buffer;
00059 }
00060
00061 ?>