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-08 21:38:10 +0200
commitac365121022f8b03ac47c41f8b3e32f9ba3f90e6 (patch)
tree6be1b33ec22dad1f74c46f97728362288176206b /lib/filesystem.php
parentb9a152450837c90ab3463c0d00ff05219d4b875e (diff)
downloadnextcloud-server-ac365121022f8b03ac47c41f8b3e32f9ba3f90e6.tar.gz
nextcloud-server-ac365121022f8b03ac47c41f8b3e32f9ba3f90e6.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 43d743b639d..337b0f1464b 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='';
@@ -313,12 +313,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);
}
@@ -349,7 +349,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, '/') === '/..' ){