From 717c009e81bb1d786d2d46e4f3d776bfba87a6c4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 10 Jul 2005 19:19:09 +0000 Subject: [PATCH] r297: Switching to new date formatting system; fixes problems that datelike() has. --- editcomment.php | 2 +- includes/init.php | 6 ++++++ index.php | 2 +- search.php | 2 +- showhistory.php | 2 +- showreport.php | 4 ++-- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/editcomment.php b/editcomment.php index ed5a7c6..dc3f105 100644 --- a/editcomment.php +++ b/editcomment.php @@ -96,7 +96,7 @@ if ($_POST['do'] == 'update') if ($_REQUEST['do'] == 'edit') { - $comment['posttime'] = datelike('standard', $comment['dateline']); + $comment['posttime'] = $datef->format($bugsys->options['dateformat'], $comment['dateline']); $comment['postby'] = construct_user_display($comment); $comment['comment'] = $bugsys->sanitize($comment['comment']); eval('$template->flush("' . $template->fetch('editcomment') . '");'); diff --git a/includes/init.php b/includes/init.php index 1d443d8..4c8a466 100755 --- a/includes/init.php +++ b/includes/init.php @@ -110,6 +110,12 @@ else require_once('./includes/class_language.php'); $bugsys->lang =& lang::init(); +// ################################################################### +// initialize the date system +$bugsys->load('date'); +$datef->usertz = $bugsys->userinfo['timezone']; +$datef->fetch_offset(); + // ################################################################### // Initialize usergroup system $_PERMISSION = array( diff --git a/index.php b/index.php index 812ed17..77ced64 100644 --- a/index.php +++ b/index.php @@ -52,7 +52,7 @@ while ($bug = $db->fetch_array($bugs_fetch)) $bug['lastposttime'] = (($bug['hiddendisplay']) ? $bug['hiddenlastposttime'] : $bug['lastposttime']); $bug['lastpost'] = (($bug['hiddendisplay']) ? $bug['hiddenlastpost'] : $bug['lastpost']); - $bug['lastpostinfo'] = datelike('standard', $bug['lastposttime']) . ' by ' . $bug['lastpost']; + $bug['lastpostinfo'] = $datef->format($bugsys->options['dateformat'], $bug['lastposttime']) . ' by ' . $bug['lastpost']; eval('$bugs .= "' . $template->fetch('trackerhome_bits') . '";'); } diff --git a/search.php b/search.php index 5b39df1..c550386 100644 --- a/search.php +++ b/search.php @@ -257,7 +257,7 @@ if ($_REQUEST['do'] == 'results') $bug['version'] = $bugsys->datastore['version']["$bug[versionid]"]['version']; $bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status']; $bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution']; - $bug['lastpostinfo'] = datelike('standard', $bug['lastposttime']) . ' by ' . $bug['lastpost']; + $bug['lastpostinfo'] = $datef->format($bugsys->options['dateformat'], $bug['lastposttime']) . ' by ' . $bug['lastpost']; $bug['urladd'] = "&hilight=$hilight"; eval('$bugs .= "' . $template->fetch('trackerhome_bits') . '";'); } diff --git a/showhistory.php b/showhistory.php index a90cc03..68195b8 100644 --- a/showhistory.php +++ b/showhistory.php @@ -57,7 +57,7 @@ $logs_fetch = $db->query(" while ($log = $db->fetch_array($logs_fetch)) { $log['formatted'] = call_user_func_array(array(lang, 'p'), array_merge(array($log['language']), unserialize($log['arguments']))); - $log['date'] = datelike('standard', $log['dateline']); + $log['date'] = $datef->format($bugsys->options['dateformat'], $log['dateline']); $log['user'] = construct_user_display($log); $logs["$log[dateline]"]["$log[historyid]"] = $log; diff --git a/showreport.php b/showreport.php index b39345f..5b2af36 100644 --- a/showreport.php +++ b/showreport.php @@ -172,7 +172,7 @@ if ($show['getattachments'] OR $show['putattachments']) while ($attachment = $db->fetch_array($attachments_fetch)) { $show['editattach'] = ((can_perform('caneditattach') OR ($attachment['userid'] == $bugsys->userinfo['userid'] AND can_perform('canputattach'))) ? true : false); - $attachment['date'] = datelike('standard', $attachment['dateline']); + $attachment['date'] = $datef->format($bugsys->options['dateformat'], $attachment['dateline']); $attachment['user'] = construct_user_display($attachment, false); eval('$attachments .= "' . $template->fetch('showreport_attachment') . '";'); } @@ -202,7 +202,7 @@ $comments_fetch = $db->query(" ); while ($comment = $db->fetch_array($comments_fetch)) { - $comment['posttime'] = datelike('standard', $comment['dateline']); + $comment['posttime'] = $datef->format($bugsys->options['dateformat'], $comment['dateline']); $comment['postby'] = construct_user_display($comment); $show['editcomment'] = (((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['userid']) OR can_perform('caneditothers')) ? true : false); -- 2.22.5