diff --git a/images/diff.png b/images/diff.png new file mode 100644 index 0000000000000000000000000000000000000000..0b98d79ace182dced94e8774feeede3b2f5280d8 Binary files /dev/null and b/images/diff.png differ diff --git a/inc/common.php b/inc/common.php index 94dfd03a00be354fa17842cb1d6fe63cef3bd6eb..6be27570a936af99bebbbede4e4d58f59e742e4b 100644 --- a/inc/common.php +++ b/inc/common.php @@ -147,6 +147,18 @@ function pageinfo(){ $info['editable'] = ($info['writable'] && empty($info['lock'])); $info['lastmod'] = @filemtime($info['filepath']); + //who's the editor + if($REV){ + $revinfo = getRevisionInfo($ID,$REV); + }else{ + $revinfo = getRevisionInfo($ID,$info['lastmod']); + } + $info['ip'] = $revinfo['ip']; + $info['user'] = $revinfo['user']; + $info['sum'] = $revinfo['sum']; + $info['editor'] = $revinfo['ip']; + if($revinfo['user']) $info['editor'].= ' ('.$revinfo['user'].')'; + return $info; } @@ -633,10 +645,10 @@ function dbg($msg,$hidden=false){ * * @author Andreas Gohr <andi@splitbrain.org> */ -function addLogEntry($id,$summary=""){ +function addLogEntry($date,$id,$summary=""){ global $conf; $id = cleanID($id); - $date = time(); + if(!$date) $date = time(); //use current time if none supplied $remote = $_SERVER['REMOTE_ADDR']; $user = $_SERVER['REMOTE_USER']; @@ -685,6 +697,25 @@ function getRecents($num=0,$incdel=false){ return $recent; } +/** + * gets additonal informations for a certain pagerevison + * from the changelog + * + * @author Andreas Gohr <andi@splitbrain.org> + */ +function getRevisionInfo($id,$rev){ + global $conf; + $loglines = file($conf['changelog']); + $loglines = preg_grep("/$rev\t\d+\.\d+\.\d+\.\d+\t$id\t/",$loglines); + rsort($loglines); //reverse sort on timestamp (shouldn't be needed) + $line = split("\t",$loglines[0]); + $info['date'] = $line[0]; + $info['ip'] = $line[1]; + $info['user'] = $line[3]; + $info['sum'] = $line[4]; + return $info; +} + /** * Saves a wikitext by calling io_saveFile * @@ -713,7 +744,7 @@ function saveWikiText($id,$text,$summary){ $del = false; } - addLogEntry($id,$summary); + addLogEntry(@filemtime($file),$id,$summary); notify($id,$old,$summary); //purge cache on add by updating the purgefile diff --git a/inc/html.php b/inc/html.php index e6e1e7e8c7fc9cc5dc361e0d4247b1e62857e2f9..6da31045a31b7bc22ae3f83711e5177865ae4fc8 100644 --- a/inc/html.php +++ b/inc/html.php @@ -380,6 +380,10 @@ function html_metainfo(){ print $lang['lastmod']; print ': '; print $date; + if($INFO['editor']){ + print ' '.$lang['by'].' '; + print $INFO['editor']; + } if($INFO['locked']){ print ' · '; print $lang['lockedby']; @@ -606,14 +610,34 @@ function html_revisions(){ print parsedLocale('revisions'); print '<ul>'; if($INFO['exists']){ - print '<li>'.$date.' <a class="wikilink1" href="'.wl($ID).'">'.$ID.'</a> ('.$lang['current'].')</li>'; + print '<li>'; + print $date.' <a class="wikilink1" href="'.wl($ID).'">'.$ID.'</a> '; + + print $INFO['sum']; + print ' <span class="user">('; + print $INFO['ip']; + if($INFO['user']) print ' '.$INFO['user']; + print ')</span> '; + + print '('.$lang['current'].')'; + print '</li>'; } foreach($revisions as $rev){ $date = date($conf['dformat'],$rev); + $info = getRevisionInfo($ID,$rev); + print '<li>'; print $date.' <a class="wikilink1" href="'.wl($ID,"rev=$rev").'">'.$ID.'</a> '; - print '<a href="'.wl($ID,"rev=$rev,do=diff").'">['.$lang['diff'].']</a>'; + print $info['sum']; + print ' <span class="user">('; + print $info['ip']; + if($info['user']) print ' '.$info['user']; + print ')</span> '; + + print '<a href="'.wl($ID,"rev=$rev,do=diff").'">'; + print '<img src="'.getBaseURL().'images/diff.png" border="0" width="15" height="11" title="'.$lang['diff'].'" />'; + print '</a>'; print '</li>'; } print '</ul>'; diff --git a/lang/de/lang.php b/lang/de/lang.php index 442f23194f029065d896db0a975c6c0fa14445ee..47be58abcacccc074f988c419f4ace140848220b 100644 --- a/lang/de/lang.php +++ b/lang/de/lang.php @@ -71,6 +71,7 @@ $lang['diff'] = 'Zeige Unterschiede zu aktueller Version'; $lang['line'] = 'Zeile'; $lang['breadcrumb'] = 'Spur'; $lang['lastmod'] = 'Zuletzt geändert'; +$lang['by'] = 'von'; $lang['deleted'] = 'gelöscht'; $lang['created'] = 'angelegt'; $lang['restored'] = 'alte Version wieder hergestellt'; diff --git a/lang/en/lang.php b/lang/en/lang.php index 34b3057232bd23b78ebe30b0fd01de09f0e3579f..06ee1e9ae94cf526a87cf20768ae3ea1dce4cda1 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -69,6 +69,7 @@ $lang['diff'] = 'show differences to current version'; $lang['line'] = 'Line'; $lang['breadcrumb'] = 'Trace'; $lang['lastmod'] = 'Last modified'; +$lang['by'] = 'by'; $lang['deleted'] = 'removed'; $lang['created'] = 'created'; $lang['restored'] = 'old revision restored';