summaryrefslogtreecommitdiffstats
path: root/apps/files_versions/ajax/getVersions.php
diff options
context:
space:
mode:
authorSam Tuke <sam@donttravelempty.com>2012-04-26 16:48:43 +0100
committerSam Tuke <sam@donttravelempty.com>2012-04-26 16:48:43 +0100
commitc693ee2adb1b8b251d7905791eeca0946c31c68b (patch)
tree10adcf853dff62b6a842728ce023b49c54eba9e2 /apps/files_versions/ajax/getVersions.php
parent6312067ab58b3d7121ed8e3211030f77eda699bd (diff)
downloadnextcloud-server-c693ee2adb1b8b251d7905791eeca0946c31c68b.tar.gz
nextcloud-server-c693ee2adb1b8b251d7905791eeca0946c31c68b.zip
added available version names to files dropdown menu via new ajax script
Diffstat (limited to 'apps/files_versions/ajax/getVersions.php')
-rw-r--r--apps/files_versions/ajax/getVersions.php54
1 files changed, 54 insertions, 0 deletions
diff --git a/apps/files_versions/ajax/getVersions.php b/apps/files_versions/ajax/getVersions.php
new file mode 100644
index 00000000000..fbe65146acc
--- /dev/null
+++ b/apps/files_versions/ajax/getVersions.php
@@ -0,0 +1,54 @@
+<?php
+
+require_once('../../../lib/base.php');
+OC_JSON::checkAppEnabled('files_versions');
+require_once('../versions.php');
+
+$userDirectory = "/".OC_User::getUser()."/files";
+$source = $_GET['source'];
+$source = strip_tags( $source );
+
+if( OCA_Versions\Storage::isversioned( $source ) ) {
+
+ $count=5; //show the newest revisions
+ $versions=OCA_Versions\Storage::getversions( $source, $count);
+
+ $versionsSorted = array_reverse( $versions );
+
+ if ( !empty( $versionsSorted ) ) {
+ OC_JSON::encodedPrint($versionsSorted);
+ }
+
+}else{
+
+ return;
+
+}
+
+// $path = $source;
+// $users = array();
+// if ($users = OC_Share::getMySharedItem($source)) {
+// for ($i = 0; $i < count($users); $i++) {
+// if ($users[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
+// $users[$i]['token'] = OC_Share::getTokenFromSource($source);
+// }
+// }
+// }
+// $source = dirname($source);
+// while ($source != "" && $source != "/" && $source != "." && $source != $userDirectory) {
+// if ($values = OC_Share::getMySharedItem($source)) {
+// $values = array_values($values);
+// $parentUsers = array();
+// for ($i = 0; $i < count($values); $i++) {
+// if ($values[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
+// $values[$i]['token'] = OC_Share::getTokenFromSource($source)."&path=".substr($path, strlen($source));
+// }
+// $parentUsers[basename($source)."-".$i] = $values[$i];
+// }
+// $users = array_merge($users, $parentUsers);
+// }
+// $source = dirname($source);
+// }
+// if (!empty($users)) {
+// OC_JSON::encodedPrint($users);
+// }