diff options
author | Kate Arzamastseva <pshns@ukr.net> | 2011-08-21 07:50:05 -0700 |
---|---|---|
committer | Kate Arzamastseva <pshns@ukr.net> | 2011-08-21 07:50:05 -0700 |
commit | 1a75cea634d47c0fac768a8c12df4e49fe3860c2 (patch) | |
tree | 57c270e4435bf05a73fc283ff34c26e75b86cff6 /inc | |
parent | 9de3b5710719658ef75740c0bd930423cc7c209c (diff) | |
parent | 42025dfd31bb5f331c665ae7dbb016fac993d52d (diff) | |
download | rpg-1a75cea634d47c0fac768a8c12df4e49fe3860c2.tar.gz rpg-1a75cea634d47c0fac768a8c12df4e49fe3860c2.tar.bz2 |
Merge pull request #58 from michitux/media-revisions
Fix permission and existence check for the recent changes
Diffstat (limited to 'inc')
-rw-r--r-- | inc/changelog.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/inc/changelog.php b/inc/changelog.php index 395e793c1..fea39f9f7 100644 --- a/inc/changelog.php +++ b/inc/changelog.php @@ -188,14 +188,14 @@ function getRecents($first,$num,$ns='',$flags=0){ // handle lines while ($lines_position >= 0 || (($flags & RECENTS_MEDIA_PAGES_MIXED) && $media_lines_position >=0)) { if (empty($rec) && $lines_position >= 0) { - $rec = _handleRecent(@$lines[$lines_position], $ns, $flags, $seen); + $rec = _handleRecent(@$lines[$lines_position], $ns, $flags & ~RECENTS_MEDIA_CHANGES, $seen); if (!$rec) { $lines_position --; continue; } } if (($flags & RECENTS_MEDIA_PAGES_MIXED) && empty($media_rec) && $media_lines_position >= 0) { - $media_rec = _handleRecent(@$media_lines[$media_lines_position], $ns, $flags, $seen); + $media_rec = _handleRecent(@$media_lines[$media_lines_position], $ns, $flags | RECENTS_MEDIA_CHANGES, $seen); if (!$media_rec) { $media_lines_position --; continue; @@ -312,11 +312,16 @@ function _handleRecent($line,$ns,$flags,&$seen){ if (($flags & RECENTS_SKIP_SUBSPACES) && (getNS($recent['id']) != $ns)) return false; // check ACL - $recent['perms'] = auth_quickaclcheck($recent['id']); + if ($flags & RECENTS_MEDIA_CHANGES) { + $recent['perms'] = auth_quickaclcheck(getNS($recent['id']).':*'); + } else { + $recent['perms'] = auth_quickaclcheck($recent['id']); + } if ($recent['perms'] < AUTH_READ) return false; // check existance - if(!@file_exists(wikiFN($recent['id'])) && !@file_exists(mediaFN($recent['id'])) && $flags & RECENTS_SKIP_DELETED) return false; + $fn = (($flags & RECENTS_MEDIA_CHANGES) ? mediaFN($recent['id']) : wikiFN($recent['id'])); + if((!@file_exists($fn)) && ($flags & RECENTS_SKIP_DELETED)) return false; return $recent; } |