diff options
author | Andreas Gohr <andi@splitbrain.org> | 2006-03-11 21:01:48 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2006-03-11 21:01:48 +0100 |
commit | ee4c4a1b5a5840c1b9d2d8c74b3f4298dd52928b (patch) | |
tree | ec7011afc97d0159819e8b334709fe0680cab9b1 /inc/common.php | |
parent | 6d8affe6a4c62d13d1cd6051c23ab305145f9db6 (diff) | |
download | rpg-ee4c4a1b5a5840c1b9d2d8c74b3f4298dd52928b.tar.gz rpg-ee4c4a1b5a5840c1b9d2d8c74b3f4298dd52928b.tar.bz2 |
Automatic draft saving
DokuWiki now automatically creates a draft file of the currently edited
page. In case of an editing interuption (eg. Browsercrash) the draftfile
can be continued later.
darcs-hash:20060311200148-7ad00-919337a51e001136178d175a1755cd26122e9726.gz
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/inc/common.php b/inc/common.php index ffb78f432..a2facee90 100644 --- a/inc/common.php +++ b/inc/common.php @@ -36,14 +36,17 @@ function pageinfo(){ $info['userinfo'] = $USERINFO; $info['perm'] = auth_quickaclcheck($ID); $info['subscribed'] = is_subscribed($ID,$_SERVER['REMOTE_USER']); + $info['client'] = $_SERVER['REMOTE_USER']; // if some outside auth were used only REMOTE_USER is set if(!$info['userinfo']['name']){ $info['userinfo']['name'] = $_SERVER['REMOTE_USER']; } + }else{ $info['perm'] = auth_aclcheck($ID,'',null); $info['subscribed'] = false; + $info['client'] = clientIP(true); } $info['namespace'] = getNS($ID); @@ -86,6 +89,17 @@ function pageinfo(){ $info['editor'] = $revinfo['ip']; } + // draft + $draft = getCacheName($info['client'].$ID,'.draft'); + if(@file_exists($draft)){ + if(@filemtime($draft) < @filemtime(wikiFN($ID))){ + // remove stale draft + @unlink($draft); + }else{ + $info['draft'] = $draft; + } + } + return $info; } |