summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib_share.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib_share.php')
-rw-r--r--apps/files_sharing/lib_share.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php
index 0aae45e54ce..f682e1a30f1 100644
--- a/apps/files_sharing/lib_share.php
+++ b/apps/files_sharing/lib_share.php
@@ -277,6 +277,29 @@ class OC_Share {
}
/**
+ * Get the token for a public link
+ * @return The token of the public link, a sha1 hash
+ */
+ public function getToken() {
+ return $this->token;
+ }
+
+ /**
+ * Get the token for a public link
+ * @param $source The source location of the item
+ * @return The token of the public link, a sha1 hash
+ */
+ public static function getTokenFromSource($source) {
+ $query = OC_DB::prepare("SELECT target FROM *PREFIX*sharing WHERE source = ? AND uid_shared_with = ? AND uid_owner = ? LIMIT 1");
+ $result = $query->execute(array($source, self::PUBLICLINK, OC_User::getUser()))->fetchAll();
+ if (count($result) > 0) {
+ return $result[0]['target'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
* Set the source location to a new value
* @param $oldSource The current source location
* @param $newTarget The new source location