diff options
author | Andreas Gohr <andi@splitbrain.org> | 2006-07-11 21:14:33 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2006-07-11 21:14:33 +0200 |
commit | 7ec553c48c1288048a7e8e6d8d6a8ca9399a39ae (patch) | |
tree | d56a8c809ed871436f684cce0abf61b676e84ddd /inc | |
parent | d98d4540790616b0dc0e1f613e4c217d24038a97 (diff) | |
download | rpg-7ec553c48c1288048a7e8e6d8d6a8ca9399a39ae.tar.gz rpg-7ec553c48c1288048a7e8e6d8d6a8ca9399a39ae.tar.bz2 |
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
Diffstat (limited to 'inc')
-rw-r--r-- | inc/common.php | 22 |
1 files 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); |