aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-11-21 16:00:21 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2013-11-21 16:00:21 +0100
commit6443e570c2793954309f9541cd6a7a8c309644ac (patch)
tree5f9755857200a710c56e3bcf0271910059f15f49 /apps/files_encryption/lib
parent87f2696e6a1f8e992a2019212e6cc08c137cc90f (diff)
parentd2e6f7d9790d42faf9d79b7beb07b2d287fd2da3 (diff)
downloadnextcloud-server-6443e570c2793954309f9541cd6a7a8c309644ac.tar.gz
nextcloud-server-6443e570c2793954309f9541cd6a7a8c309644ac.zip
Merge branch 'encryption_work_with_public_gallery' into encryption_enable_public_upload
Diffstat (limited to 'apps/files_encryption/lib')
-rwxr-xr-xapps/files_encryption/lib/helper.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index e66a84d909f..897b5d46620 100755
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -225,7 +225,7 @@ class Helper {
* @return bool
*/
public static function isPublicAccess() {
- if (\OCP\USER::getUser() === false) {
+ if (strpos($_SERVER['HTTP_REFERER'], 'public.php') !== false) {
return true;
} else {
return false;
@@ -252,16 +252,22 @@ class Helper {
return $relPath;
}
+ /**
+ * @brief get user from the path, because we can't assume that \OCP\User::getUser()
+ * will always return the right result
+ * @param type $path
+ * @return boolean
+ */
public static function getUser($path) {
$user = \OCP\User::getUser();
- // if we are logged in, than we return the userid
- if ($user) {
+ // if we are logged in and if we don't come from a public URL, then we return the userid
+ if ($user && strpos($_SERVER['HTTP_REFERER'], 'public.php') === false) {
return $user;
}
- // if no user is logged in we try to access a publically shared files.
+ // ...otherwise we try to access a publically shared files.
// In this case we need to try to get the user from the path
$trimmed = ltrim($path, '/');