From 43501309e336ac0268b6e9b4b3c6f5b0f05f7056 Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Sat, 9 Jun 2012 15:26:26 +0200 Subject: add function in filesystem to strip webroot --- lib/filesystem.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/filesystem.php') diff --git a/lib/filesystem.php b/lib/filesystem.php index 337b0f1464b..454bb1aa81a 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -343,6 +343,20 @@ class OC_Filesystem{ return self::$defaultInstance->getLocalFile($path); } + /** + * return path to file which reflects one visible in browser + * @param string path + * @return string + */ + static public function getLocalPath($path) { + $datadir = \OCP\Config::getSystemValue('datadirectory').'/'.\OC_User::getUser().'/files'; + $newpath = $path; + if (strncmp($newpath, $datadir, strlen($datadir)) == 0) { + $newpath = substr($path, strlen($datadir)); + } + return $newpath; + } + /** * check if the requested path is valid * @param string path -- cgit v1.2.3