server/apps/files_versions/ajax/getVersions.php
Bjoern Schiessle 8d36ddcf03 code clean-up
2014-01-22 11:10:32 +01:00

24 lines
668 B
PHP

<?php
OCP\JSON::checkAppEnabled('files_versions');
$source = $_GET['source'];
$start = $_GET['start'];
list ($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($source);
$count = 5; //show the newest revisions
$versions = OCA\Files_Versions\Storage::getVersions($uid, $filename, $source);
if( $versions ) {
$endReached = false;
if (count($versions) <= $start+$count) {
$endReached = true;
}
$versions = array_slice($versions, $start, $count);
\OCP\JSON::success(array('data' => array('versions' => $versions, 'endReached' => $endReached)));
} else {
\OCP\JSON::success(array('data' => array('versions' => false, 'endReached' => true)));
}