function html_recent($first=0){
global $conf;
global $lang;
global $ID;
$recents = getRecents($first,$conf['recent'] + 1,true,getNS($ID));
print p_locale_xhtml('recent');
// counter initialization
$cdate = '0000-00-00';
echo $recents[$id]['date'];
foreach($recents as $id => $val){
if(date("Y-m-d",$val['date']) != $cdate){
echo '',date($conf['dformat'],$val['date']),'
',"\n";
$cdate = date("Y-m-d",$val['date']);
}
$date = date($conf['dformat'],$val['date']);
print '';
print $date.' '.html_wikilink($id,$id);
print '';
$p = array();
$p['src'] = DOKU_BASE.'lib/images/diff.png';
$p['border'] = 0;
$p['width'] = 15;
$p['height'] = 11;
$p['title'] = $lang['diff'];
$p['alt'] = $lang['diff'];
$att = buildAttributes($p);
print "
";
print ' ';
print '';
$p = array();
$p['src'] = DOKU_BASE.'lib/images/history.png';
$p['border'] = 0;
$p['width'] = 12;
$p['height'] = 14;
$p['title'] = $lang['btn_revs'];
$p['alt'] = $lang['btn_revs'];
$att = buildAttributes($p);
print "
";
print ' ';
print html_wikilink(':'.$val['id'],$conf['useheading']?NULL:$val['id']);
print ' '.htmlspecialchars($val['sum']);
print ' ';
if($val['user']){
print $val['user'];
// if you prefer display the real name instead of the username
// comment the previous line "print $val['user'];"
// and decomment the 2 following lines
// $userdata = auth_getUserData($val['user']);
// print $userdata['name'];
}else{
print $val['ip'];
}
print '';
print '';
print "\n";
}
print '';
$last = $first + $conf['recent'];
if ($first > 0) {
$first -= $conf['recent'];
if ($first < 0) $first = 0;
print '';
print html_btn('newer','',"p",array('do' => 'recent', 'first' => $first));
print '';
}
if ($conf['recent'] < count($recents)) {
print '';
print html_btn('older','',"n",array('do' => 'recent', 'first' => $last));
print '';
}
print '';
}
===== Old version =====
I updated this script to work with the July 1st Revision.
function html_recent($first=0){
global $conf;
global $lang;
/* we need to get one additionally log entry to be able to
* decide if this is the last page or is there another one.
* This is the cheapest solution to get this information.
*/
$recents = getRecents($first,$conf['recent'] + 1,true);
if(count($recents) == 0 && $first != 0){
$first=0;
$recents = getRecents(0,$conf['recent'] + 1,true);
}
$cnt = count($recents) <= $conf['recent'] ? count($recents) : $conf['recent'];
print p_locale_xhtml('recent');
$cdate = '0000-00-00';
foreach($recents as $id => $val){
if(date("Y-m-d",$val['date']) != $cdate){
echo '',date("F d, Y",$val['date']),'
',"\n";
$cdate = date("Y-m-d",$val['date']);
}
$date = date('H:i',$val['date']);
print '';
print $date.' '.html_wikilink($id,$id);
print ' '.htmlspecialchars($val['sum']);
print ' (';
print $val['ip'];
if($val['user']) print ' '.$val['user'];
print ')';
print '';
print "\n";
}
}
====== Discussion ======
* Could it be included in the main source (perhaps as an option) ?
> If you want the real name instead of the username on each line, change the following:
if($val['user']){
print $val['user'];
> to:
if($val['user']){
$userdata = auth_getUserData($val['user']);
print $userdata['name'];
--- //[[chris@chrisarndt.de|ChristopherArndt]] 2005-10-17 13:22//
>> Thanks, I added your tip as an "option" in the code ;-) Sometimes, you don't want to have the real names appear on the web site. //[[mailto:jpgnews1 at ouvaton dot org|Jean-Philippe Georget]] 2005-10-17 21:37//