From 7ec553c48c1288048a7e8e6d8d6a8ca9399a39ae Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Tue, 11 Jul 2006 21:14:33 +0200 Subject: [PATCH] bugfix for getRevisions This fixes a bug where the list of old revisions isn't build correctly if pagename exists within another one. darcs-hash:20060711191433-7ad00-d8d2a1f072e5874f63a5d82c905920a496d4212a.gz --- inc/common.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/inc/common.php b/inc/common.php index 564d1f666..609e0b077 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1178,19 +1178,23 @@ function notify($id,$who,$rev='',$summary='',$minor=false){ * @author Andreas Gohr <andi@splitbrain.org> */ function getRevisions($id){ + global $conf; + + $id = cleanID($id); $revd = dirname(wikiFN($id,'foo')); + $id = noNS($id); + $id = utf8_encodeFN($id); + $len = strlen($id); + $xlen = ($conf['usegzip']) ? -7 : -4; // length of extension (.txt.gz or .txt) + $revs = array(); - $clid = cleanID($id); - if(strrpos($clid,':')) $clid = substr($clid,strrpos($clid,':')+1); //remove path - $clid = utf8_encodeFN($clid); - $clid_len = strlen($clid); if (is_dir($revd) && $dh = opendir($revd)) { while (($file = readdir($dh)) !== false) { - if (substr($file, 0, $clid_len)===$clid) { - $p = @strpos($file, '.', $clid_len+1); - if (!$p===false) { - $revs[] = substr($file, $clid_len+1, $p-$clid_len-1); - } + if (substr($file,0,$len) === $id) { + $time = substr($file,$len+1,$xlen); + $time = str_replace('.','FOO',$time); // make sure a dot will make the next test fail + $time = (int) $time; + if($time) $revs[] = $time; } } closedir($dh); -- GitLab