fixed some date/time display bugs when database_store_gmt is yes.
added codepot_unixtimetodispdate() minimized use of strftime() in favor of codepot_unixtimetodispdate() and codepot_dbdatetodispdate()
This commit is contained in:
parent
750db30352
commit
d86921ba28
@ -58,19 +58,38 @@ if ( ! function_exists('codepot_unixtimetodbdate'))
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('codepot_unixtimetodispdate'))
|
||||
{
|
||||
function codepot_unixtimetodispdate($unixtime, $format = NULL, $timezone = NULL)
|
||||
{
|
||||
if ($timezone != NULL && function_exists('date_create'))
|
||||
{
|
||||
$d = @date_create ('@' . $unixtime);
|
||||
if ($d !== FALSE)
|
||||
{
|
||||
$tz = @timezone_open ($timezone);
|
||||
if ($tz !== FALSE)
|
||||
{
|
||||
@date_timezone_set ($d, $tz);
|
||||
$ts = @date_format ($d, ($format == NULL? 'Y-m-d H:i:s O': $format));
|
||||
if ($ts !== FALSE) return $ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// display time is in the local time zone or in the given time zone.
|
||||
// if DateTime is not available, $timezone is ignored.
|
||||
return date(($format == NULL? 'Y-m-d H:i:s O': $format), $unixtime);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('codepot_dbdatetodispdate'))
|
||||
{
|
||||
function codepot_dbdatetodispdate($dbdate, $format = NULL)
|
||||
function codepot_dbdatetodispdate($dbdate, $format = NULL, $timezone = NULL)
|
||||
{
|
||||
// display time is in the local time zone.
|
||||
if (CODEPOT_DATABASE_STORE_GMT)
|
||||
{
|
||||
return strftime(($format == NULL? '%Y-%m-%d %H:%M:%S %z': $format), strtotime($dbdate . ' +0000'));
|
||||
}
|
||||
else
|
||||
{
|
||||
return strftime(($format == NULL? '%Y-%m-%d %H:%M:%S %z': $format), strtotime($dbdate));
|
||||
}
|
||||
if (CODEPOT_DATABASE_STORE_GMT) $dbdate .= ' +0000';
|
||||
$unixtime = strtotime($dbdate);
|
||||
return codepot_unixtimetodispdate ($unixtime, $format, $timezone);
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,8 +295,6 @@ if ( !function_exists ('codepot_unzip_file'))
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open ($path) === FALSE) return FALSE;
|
||||
|
||||
|
||||
|
||||
if ($zip->extractTo ($output_dir) === FALSE)
|
||||
{
|
||||
$zip->close ();
|
||||
@ -404,7 +421,6 @@ if ( !function_exists ('codepot_find_matching_sequences'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -588,6 +604,4 @@ if ( ! function_exists('codepot_readfile'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ $this->load->view (
|
||||
|
||||
print '<div class="metadata-commit-date">';
|
||||
printf ('[%s] ', $file['created_rev']);
|
||||
print strftime ('%Y-%m-%d %H:%M:%S %z', $file['time_t']);
|
||||
print codepot_unixtimetodispdate ($file['time_t']);
|
||||
print '</div>';
|
||||
?>
|
||||
<div style='clear: both'></div>
|
||||
|
@ -242,7 +242,7 @@ $this->load->view (
|
||||
|
||||
print '<div class="metadata-commit-date">';
|
||||
printf ('[%s] ', $file['against']['created_rev']);
|
||||
print strftime ('%Y-%m-%d %H:%M:%S %z', $file['against']['time_t']);
|
||||
print codepot_unixtimetodispdate ($file['against']['time_t']);
|
||||
print '</div>'
|
||||
?>
|
||||
|
||||
@ -280,7 +280,7 @@ $this->load->view (
|
||||
|
||||
print '<div class="metadata-commit-date">';
|
||||
printf ('[%s] ', $file['created_rev']);
|
||||
print strftime ('%Y-%m-%d %H:%M:%S %z', $file['time_t']);
|
||||
print codepot_unixtimetodispdate ($file['time_t']);
|
||||
print '</div>'
|
||||
?>
|
||||
|
||||
|
@ -623,7 +623,7 @@ $this->load->view (
|
||||
|
||||
print '<div class="metadata-commit-date">';
|
||||
printf ('[%s] ', $file['created_rev']);
|
||||
print strftime ('%Y-%m-%d %H:%M:%S %z', $file['time_t']);
|
||||
print codepot_unixtimetodispdate ($file['time_t']);
|
||||
print '</div>';
|
||||
?>
|
||||
<div style='clear: both'></div>
|
||||
|
@ -1002,7 +1002,7 @@ $this->load->view (
|
||||
|
||||
print '<div class="metadata-commit-date">';
|
||||
printf ('[%s] ', $file['created_rev']);
|
||||
print strftime ('%Y-%m-%d %H:%M:%S %z', strtotime($file['last_changed_date']));
|
||||
print codepot_unixtimetodispdate(strtotime($file['last_changed_date']));
|
||||
print '</div>';
|
||||
?>
|
||||
<div style='clear: both;'></div>
|
||||
@ -1207,7 +1207,7 @@ $this->load->view (
|
||||
print htmlspecialchars($f['last_author']);
|
||||
print '</td>';
|
||||
print '<td><tt>';
|
||||
print strftime('%Y-%m-%d', $f['time_t']);
|
||||
print codepot_unixtimetodispdate ($f['time_t'], 'Y-m-d');
|
||||
print '</tt></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
@ -1243,7 +1243,7 @@ $this->load->view (
|
||||
print htmlspecialchars($f['last_author']);
|
||||
print '</td>';
|
||||
print '<td><tt>';
|
||||
print strftime('%Y-%m-%d', $f['time_t']);
|
||||
print codepot_unixtimetodispdate ($f['time_t'], 'Y-m-d');
|
||||
print '</tt></td>';
|
||||
|
||||
print '<td>';
|
||||
|
@ -154,7 +154,7 @@ $this->load->view (
|
||||
print '</td>';
|
||||
|
||||
print '<td class="commit-date-td"><tt>';
|
||||
print strftime('%Y-%m-%d', strtotime($h['date']));
|
||||
print codepot_unixtimetodispdate(strtotime($h['date']), 'Y-m-d');
|
||||
print '</tt></td>';
|
||||
|
||||
print '<td class="commit-message-td">';
|
||||
|
@ -665,7 +665,7 @@ $history = $file['history'];
|
||||
|
||||
print '<div class="metadata-commit-date">';
|
||||
printf ('[%s] ', $history['rev']);
|
||||
print strftime ('%Y-%m-%d %H:%M:%S %z', strtotime($history['date']));
|
||||
print codepot_unixtimetodispdate (strtotime($history['date']));
|
||||
print '</div>';
|
||||
?>
|
||||
|
||||
|
@ -177,14 +177,9 @@ $this->load->view (
|
||||
{
|
||||
if ($log['type'] == 'code') $code = $log['message'];
|
||||
|
||||
if (CODEPOT_DATABASE_STORE_GMT)
|
||||
$createdon = $log['createdon'] . ' +0000';
|
||||
else
|
||||
$createdon = $log['createdon'];
|
||||
|
||||
$tzoff = strftime ('%z', strtotime($createdon));
|
||||
$date = strftime ('%Y-%m-%d', strtotime($createdon));
|
||||
$time = strftime ('%H:%M:%S', strtotime($createdon));
|
||||
$tzoff = codepot_dbdatetodispdate ($log['createdon'], 'O');
|
||||
$date = codepot_dbdatetodispdate ($log['createdon'], 'Y-m-d');
|
||||
$time = codepot_dbdatetodispdate ($log['createdon'], 'H:i:s');
|
||||
|
||||
if ($curdate != $date)
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ foreach ($urls as $url)
|
||||
foreach ($log_entries as $log)
|
||||
{
|
||||
|
||||
$createdon_mmdd = codepot_dbdatetodispdate ($log['createdon'], '%m-%d');
|
||||
$createdon_mmdd = codepot_dbdatetodispdate ($log['createdon'], 'm-d');
|
||||
|
||||
if ($log['type'] == 'code')
|
||||
{
|
||||
|
@ -357,18 +357,13 @@ $this->load->view (
|
||||
$xdot = $this->converter->AsciiToHex ('.');
|
||||
foreach ($log_entries as $log)
|
||||
{
|
||||
if (CODEPOT_DATABASE_STORE_GMT)
|
||||
$createdon = $log['createdon'] . ' +0000';
|
||||
else
|
||||
$createdon = $log['createdon'];
|
||||
|
||||
if ($log['type'] == 'code')
|
||||
{
|
||||
$x = $log['message'];
|
||||
|
||||
print '<tr class="odd">';
|
||||
print '<td class="date">';
|
||||
print strftime ('%m-%d', strtotime($createdon));
|
||||
print codepot_dbdatetodispdate ($log['createdon'], 'Y-m-d');
|
||||
print '</td>';
|
||||
print '<td class="projectid">';
|
||||
/*
|
||||
@ -428,7 +423,7 @@ $this->load->view (
|
||||
{
|
||||
print '<tr class="odd">';
|
||||
print '<td class="date">';
|
||||
print strftime ('%m-%d', strtotime($createdon));
|
||||
print codepot_dbdatetodispdate ($log['createdon'], 'Y-m-d');
|
||||
print '</td>';
|
||||
|
||||
print '<td class="project">';
|
||||
|
Loading…
Reference in New Issue
Block a user