summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorBen Coburn <btcoburn@silicodon.net>2006-12-07 04:28:25 +0100
committerBen Coburn <btcoburn@silicodon.net>2006-12-07 04:28:25 +0100
commit5aa52fafe8be8e728c0d2c9ff12c999e80766127 (patch)
tree7a7de279d3cc45d91154bbcf01701bbc1c933706 /inc
parentcd00a03445c6b5dcdaba4631150c3c7e1370f526 (diff)
downloadrpg-5aa52fafe8be8e728c0d2c9ff12c999e80766127.tar.gz
rpg-5aa52fafe8be8e728c0d2c9ff12c999e80766127.tar.bz2
identify external edits in UI
Some changes to clearly identify when wiki pages have been edited outside Dokuwiki. Also correctly attributes external changes from an unknown author. Avoids sending extra emails when recording old external edits. Adds a new language string: $lang['external_edit'] darcs-hash:20061207032825-05dcb-3234bee57cb165c848b33abb9251502589b0f3cb.gz
Diffstat (limited to 'inc')
-rw-r--r--inc/changelog.php10
-rw-r--r--inc/common.php5
-rw-r--r--inc/html.php2
-rw-r--r--inc/lang/en/lang.php1
-rw-r--r--inc/template.php2
5 files changed, 12 insertions, 8 deletions
diff --git a/inc/changelog.php b/inc/changelog.php
index 85de8e2aa..43d18f148 100644
--- a/inc/changelog.php
+++ b/inc/changelog.php
@@ -33,9 +33,13 @@ function parseChangelogLine($line) {
* @author Esther Brunner <wikidesign@gmail.com>
* @author Ben Coburn <btcoburn@silicodon.net>
*/
-function addLogEntry($date, $id, $type='E', $summary='', $extra=''){
+function addLogEntry($date, $id, $type='E', $summary='', $extra='', $flags=null){
global $conf, $INFO;
+ // check for special flags as keys
+ if (!is_array($flags)) { $flags = array(); }
+ $flagExternalEdit = isset($flags['ExternalEdit']);
+
$id = cleanid($id);
$file = wikiFN($id);
$created = @filectime($file);
@@ -43,8 +47,8 @@ function addLogEntry($date, $id, $type='E', $summary='', $extra=''){
$wasRemoved = ($type==='D');
if(!$date) $date = time(); //use current time if none supplied
- $remote = $_SERVER['REMOTE_ADDR'];
- $user = $_SERVER['REMOTE_USER'];
+ $remote = (!$flagExternalEdit)?$_SERVER['REMOTE_ADDR']:'127.0.0.1';
+ $user = (!$flagExternalEdit)?$_SERVER['REMOTE_USER']:'';
$strip = array("\t", "\n");
$logline = array(
diff --git a/inc/common.php b/inc/common.php
index 26a0526b8..93e2df34f 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -736,10 +736,7 @@ function saveWikiText($id,$text,$summary,$minor=false){
saveOldRevision($id);
// add a changelog entry if this edit came from outside dokuwiki
if ($old>$oldRev) {
- addLogEntry($old, $id);
- // send notify mails
- notify($id,'admin',$oldRev,'',false);
- notify($id,'subscribers',$oldRev,'',false);
+ addLogEntry($old, $id, 'E', $lang['external_edit'], '', array('ExternalEdit'=>true));
// remove soon to be stale instructions
$cache = new cache_instructions($id, $file);
$cache->removeCache();
diff --git a/inc/html.php b/inc/html.php
index d5a7a232e..dc11b17d7 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -481,7 +481,7 @@ function html_revisions($first=0){
print ' &ndash; ';
print $INFO['sum'];
print ' <span class="user">';
- print $INFO['editor'];
+ print (empty($INFO['editor']))?('('.$lang['external_edit'].')'):$INFO['editor'];
print '</span> ';
print '('.$lang['current'].')';
diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php
index 2a28b720a..27211605a 100644
--- a/inc/lang/en/lang.php
+++ b/inc/lang/en/lang.php
@@ -131,6 +131,7 @@ $lang['by'] = 'by';
$lang['deleted'] = 'removed';
$lang['created'] = 'created';
$lang['restored'] = 'old revision restored';
+$lang['external_edit'] = 'external edit';
$lang['summary'] = 'Edit summary';
$lang['mail_newpage'] = 'page added:';
diff --git a/inc/template.php b/inc/template.php
index 27923f404..fc351e939 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -761,6 +761,8 @@ function tpl_pageinfo(){
if($INFO['editor']){
print ' '.$lang['by'].' ';
print $INFO['editor'];
+ }else{
+ print ' ('.$lang['external_edit'].')';
}
if($INFO['locked']){
print ' &middot; ';