Merge pull request #1827 from owncloud/fix_getVersions

fix getVersions(), we need to get the correct user and filename
This commit is contained in:
Bernhard Posselt 2013-02-25 04:59:47 -08:00
commit 3f48bebe92
2 changed files with 3 additions and 3 deletions

View File

@ -1,11 +1,11 @@
<?php <?php
OCP\JSON::checkAppEnabled('files_versions'); OCP\JSON::checkAppEnabled('files_versions');
$userDirectory = "/".OCP\USER::getUser()."/files";
$source = $_GET['source']; $source = $_GET['source'];
list ($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($source);
$count = 5; //show the newest revisions $count = 5; //show the newest revisions
if( ($versions = OCA\Files_Versions\Storage::getVersions( $source, $count)) ) { if( ($versions = OCA\Files_Versions\Storage::getVersions($uid, $filename, $count)) ) {
$versionsFormatted = array(); $versionsFormatted = array();

View File

@ -35,7 +35,7 @@ class Storage {
6 => array('intervalEndsAfter' => -1, 'step' => 604800), 6 => array('intervalEndsAfter' => -1, 'step' => 604800),
); );
private static function getUidAndFilename($filename) { public static function getUidAndFilename($filename) {
$uid = \OC\Files\Filesystem::getOwner($filename); $uid = \OC\Files\Filesystem::getOwner($filename);
\OC\Files\Filesystem::initMountPoints($uid); \OC\Files\Filesystem::initMountPoints($uid);
if ( $uid != \OCP\User::getUser() ) { if ( $uid != \OCP\User::getUser() ) {