From ee4c4a1b5a5840c1b9d2d8c74b3f4298dd52928b Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 11 Mar 2006 21:01:48 +0100 Subject: 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 --- inc/common.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'inc/common.php') 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; } -- cgit v1.2.3