5
I've finished the initial version of a hack. I'd like to get a couple of others to confirm that it works before I try to get it incorporated into the base code.
1) modules/newbb/blocks/newbb_new.php, function b_newbb_new_show
Find:
le="color: #000000"><?php $topic['time'] = formatTimestamp($arr['topic_time'],'m')." $tmpuser";
Insert after:
le="color: #000000"><?php #*#RETOPS_UNCACHE_TS# - start $topic['timestamp'] = $arr['topic_time']; $topic['username'] = $tmpuser; #*#RETOPS_UNCACHE_TS# - end
2) Template for Recent Topics block
Insert at beginning:
le="color: #000000"><?php <!-- #*#RETOPS_UNCACHE_TS# - start --> <script language="javascript" type="text/javascript"> // emulate PHP function call date(timestamp, 'Y/n/j G:i') // timestamp = seconds since 1970-01-01 00:00:00 GMT function formatted_date(timestamp) { var date = new Date(timestamp * 1000); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hours = date.getHours(); var min = date.getMinutes(); var minutes = (min < 10) ? '0' + min : min; return year + '/' + month + '/' + day + ' ' + hours + ':' + minutes; } </script> <!-- #*#RETOPS_UNCACHE_TS# - end -->
Find (two instances):
le="color: #000000"><?php <td align="right"><{$topic.time}></td>
Replace (each instance) with:
le="color: #000000"><?php <!-- #*#RETOPS_UNCACHE_TS# - start --> <td align="right"> <script language="javascript" type="text/javascript"> document.write('<b>J</b>' + formatted_date(<{$topic.timestamp}>) + ' <{$topic.username}>'); </script> <noscript> <b>P</b><{$topic.time}> </noscript> </td> <!-- #*#RETOPS_UNCACHE_TS# - end -->
For testing purposes only, I've prefixed the dates with
J if the date/time is generated by Javascript, and by
P if the date/time is generated by PHP. The latter occurs if Javascript is disabled on the client's browser.