summaryrefslogtreecommitdiffstats
path: root/lib/filesystem.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-06-08 21:23:25 +0200
committerBart Visscher <bartv@thisnet.nl>2012-06-19 23:16:17 +0200
commitcff1b6e69901c84aadbb7d9f9677756f4c813837 (patch)
tree12ea6c806626927955c13678fd0d1d98f5a13c00 /lib/filesystem.php
parentbb649dd0d5accbdf1d993cdfbf0e10fd2e4f9f0b (diff)
downloadnextcloud-server-cff1b6e69901c84aadbb7d9f9677756f4c813837.tar.gz
nextcloud-server-cff1b6e69901c84aadbb7d9f9677756f4c813837.zip
Don't use substr to get first char of string
Diffstat (limited to 'lib/filesystem.php')
-rw-r--r--lib/filesystem.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 198f00873c5..813590b00bb 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -150,7 +150,7 @@ class OC_Filesystem{
if(!$path){
$path='/';
}
- if(substr($path,0,1)!=='/'){
+ if($path[0]!=='/'){
$path='/'.$path;
}
$foundMountPoint='';
@@ -311,12 +311,12 @@ class OC_Filesystem{
* @param string mountpoint
*/
static public function mount($class,$arguments,$mountpoint){
+ if($mountpoint[0]!='/'){
+ $mountpoint='/'.$mountpoint;
+ }
if(substr($mountpoint,-1)!=='/'){
$mountpoint=$mountpoint.'/';
}
- if(substr($mountpoint,0,1)!=='/'){
- $mountpoint='/'.$mountpoint;
- }
self::$mounts[$mountpoint]=array('class'=>$class,'arguments'=>$arguments);
}
@@ -361,7 +361,7 @@ class OC_Filesystem{
* @return bool
*/
static public function isValidPath($path){
- if(substr($path,0,1)!=='/'){
+ if(!$path || $path[0]!=='/'){
$path='/'.$path;
}
if(strstr($path,'/../') || strrchr($path, '/') === '/..' ){