summaryrefslogtreecommitdiff
path: root/inc/common.php
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 /inc/common.php
parentdfd3db4a6baedc8ab9f22ed6bf413d5577bf7664 (diff)
downloadrpg-652610a2c1fbc4fceb692d4aba7012c0eaddae3e.tar.gz
rpg-652610a2c1fbc4fceb692d4aba7012c0eaddae3e.tar.bz2
editor names for old revisions #85
darcs-hash:20050203190209-9977f-e246ffa72e9eded86aaaf3502efbee75c608ec3b.gz
Diffstat (limited to 'inc/common.php')
-rw-r--r--inc/common.php37
1 files changed, 34 insertions, 3 deletions
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