summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-02-03 20:02:09 +0100
committerandi <andi@splitbrain.org>2005-02-03 20:02:09 +0100
commit652610a2c1fbc4fceb692d4aba7012c0eaddae3e (patch)
tree33c908a562aee2d1476637760b0be528afba93b8
parentdfd3db4a6baedc8ab9f22ed6bf413d5577bf7664 (diff)
downloadrpg-652610a2c1fbc4fceb692d4aba7012c0eaddae3e.tar.gz
rpg-652610a2c1fbc4fceb692d4aba7012c0eaddae3e.tar.bz2
editor names for old revisions #85
darcs-hash:20050203190209-9977f-e246ffa72e9eded86aaaf3502efbee75c608ec3b.gz
-rw-r--r--images/diff.pngbin0 -> 219 bytes
-rw-r--r--inc/common.php37
-rw-r--r--inc/html.php28
-rw-r--r--lang/de/lang.php1
-rw-r--r--lang/en/lang.php1
5 files changed, 62 insertions, 5 deletions
diff --git a/images/diff.png b/images/diff.png
new file mode 100644
index 000000000..0b98d79ac
--- /dev/null
+++ b/images/diff.png
Binary files differ
diff --git a/inc/common.php b/inc/common.php
index 94dfd03a0..6be27570a 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'];
@@ -686,6 +698,25 @@ function getRecents($num=0,$incdel=false){
}
/**
+ * 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
*
* @author Andreas Gohr <andi@splitbrain.org>
@@ -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 e6e1e7e8c..6da31045a 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 ' &middot; ';
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 442f23194..47be58abc 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 34b305723..06ee1e9ae 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';