2012-04-26 15:48:43 +00:00
|
|
|
<?php
|
2015-03-26 10:44:34 +00:00
|
|
|
/**
|
|
|
|
* @author Bart Visscher <bartv@thisnet.nl>
|
|
|
|
* @author Björn Schießle <schiessle@owncloud.com>
|
|
|
|
* @author Frank Karlitschek <frank@owncloud.org>
|
|
|
|
* @author Lukas Reschke <lukas@owncloud.com>
|
|
|
|
* @author Sam Tuke <mail@samtuke.com>
|
2015-10-05 18:54:56 +00:00
|
|
|
* @author Vincent Petry <pvince81@owncloud.com>
|
2015-03-26 10:44:34 +00:00
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
|
|
|
*/
|
2015-01-09 10:50:17 +00:00
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::callCheck();
|
2012-05-03 10:23:29 +00:00
|
|
|
OCP\JSON::checkAppEnabled('files_versions');
|
2012-05-11 12:17:37 +00:00
|
|
|
|
2015-02-13 12:33:20 +00:00
|
|
|
$source = (string)$_GET['source'];
|
2015-02-16 11:01:05 +00:00
|
|
|
$start = (int)$_GET['start'];
|
2013-02-21 13:40:16 +00:00
|
|
|
list ($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($source);
|
2013-01-11 13:23:28 +00:00
|
|
|
$count = 5; //show the newest revisions
|
2014-01-22 10:10:32 +00:00
|
|
|
$versions = OCA\Files_Versions\Storage::getVersions($uid, $filename, $source);
|
|
|
|
if( $versions ) {
|
2012-04-26 15:48:43 +00:00
|
|
|
|
2013-07-25 08:35:19 +00:00
|
|
|
$endReached = false;
|
|
|
|
if (count($versions) <= $start+$count) {
|
|
|
|
$endReached = true;
|
2012-04-26 17:45:17 +00:00
|
|
|
}
|
2012-04-26 15:48:43 +00:00
|
|
|
|
2013-07-25 08:35:19 +00:00
|
|
|
$versions = array_slice($versions, $start, $count);
|
2012-08-29 06:42:49 +00:00
|
|
|
|
2013-07-25 08:35:19 +00:00
|
|
|
\OCP\JSON::success(array('data' => array('versions' => $versions, 'endReached' => $endReached)));
|
2012-08-29 06:42:49 +00:00
|
|
|
|
2012-05-11 12:17:37 +00:00
|
|
|
} else {
|
2012-04-26 15:48:43 +00:00
|
|
|
|
2015-09-01 17:29:55 +00:00
|
|
|
\OCP\JSON::success(array('data' => array('versions' => [], 'endReached' => true)));
|
2012-08-29 06:42:49 +00:00
|
|
|
|
2012-04-26 15:48:43 +00:00
|
|
|
}
|