diff options
author | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-06-09 15:26:26 +0200 |
---|---|---|
committer | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-06-10 13:19:10 +0200 |
commit | f1250a3867f482fd5bae6f16e3fb779c7323f947 (patch) | |
tree | f5bbc6539bc958a460a629d7389dab248de4945f /lib/filesystem.php | |
parent | e7d1af48fb4695c3fa0fe10b3f2d930e555a648e (diff) | |
download | nextcloud-server-f1250a3867f482fd5bae6f16e3fb779c7323f947.tar.gz nextcloud-server-f1250a3867f482fd5bae6f16e3fb779c7323f947.zip |
add function in filesystem to strip webroot
Diffstat (limited to 'lib/filesystem.php')
-rw-r--r-- | lib/filesystem.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/filesystem.php b/lib/filesystem.php index cac7e8648ef..198f00873c5 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -342,6 +342,20 @@ class OC_Filesystem{ } /** + * 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 * @return bool |