summaryrefslogtreecommitdiffstats
path: root/apps/files_external
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 /apps/files_external
parentb9a152450837c90ab3463c0d00ff05219d4b875e (diff)
downloadnextcloud-server-ac365121022f8b03ac47c41f8b3e32f9ba3f90e6.tar.gz
nextcloud-server-ac365121022f8b03ac47c41f8b3e32f9ba3f90e6.zip
Don't use substr to get first char of string
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/ftp.php2
-rw-r--r--apps/files_external/lib/smb.php8
-rw-r--r--apps/files_external/lib/swift.php2
-rw-r--r--apps/files_external/lib/webdav.php4
4 files changed, 8 insertions, 8 deletions
diff --git a/apps/files_external/lib/ftp.php b/apps/files_external/lib/ftp.php
index e9655ebf3a5..4d5ae670de5 100644
--- a/apps/files_external/lib/ftp.php
+++ b/apps/files_external/lib/ftp.php
@@ -21,7 +21,7 @@ class OC_FileStorage_FTP extends OC_FileStorage_StreamWrapper{
$this->password=$params['password'];
$this->secure=isset($params['secure'])?(bool)$params['secure']:false;
$this->root=isset($params['root'])?$params['root']:'/';
- if(substr($this->root,0,1)!='/'){
+ if(!$this->root || $this->root[0]!='/'){
$this->root='/'.$this->root;
}
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index f594fbb880d..9112655194a 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -23,13 +23,13 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
$this->password=$params['password'];
$this->share=$params['share'];
$this->root=isset($params['root'])?$params['root']:'/';
+ if(!$this->root || $this->root[0]!='/'){
+ $this->root='/'.$this->root;
+ }
if(substr($this->root,-1,1)!='/'){
$this->root.='/';
}
- if(substr($this->root,0,1)!='/'){
- $this->root='/'.$this->root;
- }
- if(substr($this->share,0,1)!='/'){
+ if(!$this->share || $this->share[0]!='/'){
$this->share='/'.$this->share;
}
if(substr($this->share,-1,1)=='/'){
diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php
index e3ba9c240cf..58b95a6ae01 100644
--- a/apps/files_external/lib/swift.php
+++ b/apps/files_external/lib/swift.php
@@ -269,7 +269,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
$this->user=$params['user'];
$this->root=isset($params['root'])?$params['root']:'/';
$this->secure=isset($params['secure'])?(bool)$params['secure']:true;
- if(substr($this->root,0,1)!='/'){
+ if(!$this->root || $this->root[0]!='/'){
$this->root='/'.$this->root;
}
$this->auth = new CF_Authentication($this->user, $this->token, null, $this->host);
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 07c90d4878e..d136f04f3eb 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -25,7 +25,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$this->password=$params['password'];
$this->secure=isset($params['secure'])?(bool)$params['secure']:false;
$this->root=isset($params['root'])?$params['root']:'/';
- if(substr($this->root,0,1)!='/'){
+ if(!$this->root || $this->root[0]!='/'){
$this->root='/'.$this->root;
}
if(substr($this->root,-1,1)!='/'){
@@ -273,7 +273,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
}
private function cleanPath($path){
- if(substr($path,0,1)=='/'){
+ if(!$path || $path[0]=='/'){
return substr($path,1);
}else{
return $path;