diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/common.php | 6 | ||||
-rw-r--r-- | inc/html.php | 2 | ||||
-rw-r--r-- | inc/pageutils.php | 11 |
3 files changed, 15 insertions, 4 deletions
diff --git a/inc/common.php b/inc/common.php index e47b4e7a3..b1246ba7f 100644 --- a/inc/common.php +++ b/inc/common.php @@ -523,7 +523,7 @@ function clientIP($single=false){ */ function checklock($id){ global $conf; - $lock = wikiFN($id).'.lock'; + $lock = wikiLockFN($id); //no lockfile if(!@file_exists($lock)) return false; @@ -549,7 +549,7 @@ function checklock($id){ * @author Andreas Gohr <andi@splitbrain.org> */ function lock($id){ - $lock = wikiFN($id).'.lock'; + $lock = wikiLockFN($id); if($_SERVER['REMOTE_USER']){ io_saveFile($lock,$_SERVER['REMOTE_USER']); }else{ @@ -564,7 +564,7 @@ function lock($id){ * @return bool true if a lock was removed */ function unlock($id){ - $lock = wikiFN($id).'.lock'; + $lock = wikiLockFN($id); if(@file_exists($lock)){ $ip = io_readFile($lock); if( ($ip == clientIP()) || ($ip == $_SERVER['REMOTE_USER']) ){ diff --git a/inc/html.php b/inc/html.php index 2a02b8c34..7f5050b8d 100644 --- a/inc/html.php +++ b/inc/html.php @@ -422,7 +422,7 @@ function html_locked(){ global $lang; global $INFO; - $locktime = filemtime(wikiFN($ID).'.lock'); + $locktime = filemtime(wikiLockFN($ID)); $expire = @date($conf['dformat'], $locktime + $conf['locktime'] ); $min = round(($conf['locktime'] - (time() - $locktime) )/60); diff --git a/inc/pageutils.php b/inc/pageutils.php index f9d182aac..c10c1c4e8 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -152,6 +152,17 @@ function wikiFN($id,$rev=''){ } /** + * Returns the full path to the file for locking the page while editing. + * + * @author Ben Coburn <btcoburn@silicodon.net> + */ +function wikiLockFN($id) { + global $conf; + return $conf['lockdir'].'/'.sha1(cleanID($id)).'.lock'; +} + + +/** * returns the full path to the meta file specified by ID and extension * * The filename is URL encoded to protect Unicode chars |