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:
$topic['time'] = formatTimestamp($arr['topic_time'],'m')." $tmpuser";
Insert after:
#*#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:
<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>
Find (two instances):
<td align="right"><{$topic.time}>td>
Replace (each instance) with:
<td align="right">
<script language="javascript" type="text/javascript">
document.write('J' + formatted_date(<{$topic.timestamp}>) + ' <{$topic.username}>');
script>
<noscript>
<b>Pb><{$topic.time}>
noscript>
td>
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.