diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/app.php | 2 | ||||
-rw-r--r-- | lib/archive/tar.php | 4 | ||||
-rw-r--r-- | lib/archive/zip.php | 2 | ||||
-rw-r--r-- | lib/filesystem.php | 10 | ||||
-rw-r--r-- | lib/filesystemview.php | 2 | ||||
-rw-r--r-- | lib/installer.php | 2 | ||||
-rw-r--r-- | lib/user/database.php | 2 |
7 files changed, 12 insertions, 12 deletions
diff --git a/lib/app.php b/lib/app.php index e8a5a1291d9..0c51e3c5532 100755 --- a/lib/app.php +++ b/lib/app.php @@ -469,7 +469,7 @@ class OC_App{ $apps=array(); $dh=opendir(OC::$APPSROOT.'/apps'); while($file=readdir($dh)){ - if(substr($file,0,1)!='.' and is_file(OC::$APPSROOT.'/apps/'.$file.'/appinfo/app.php')){ + if($file[0]!='.' and is_file(OC::$APPSROOT.'/apps/'.$file.'/appinfo/app.php')){ $apps[]=$file; } } diff --git a/lib/archive/tar.php b/lib/archive/tar.php index 4ff78779834..944a0ac4ba4 100644 --- a/lib/archive/tar.php +++ b/lib/archive/tar.php @@ -150,7 +150,7 @@ class OC_Archive_TAR extends OC_Archive{ $folderContent=array(); $pathLength=strlen($path); foreach($files as $file){ - if(substr($file,0,1)=='/'){ + if($file[0]=='/'){ $file=substr($file,1); } if(substr($file,0,$pathLength)==$path and $file!=$path){ @@ -241,7 +241,7 @@ class OC_Archive_TAR extends OC_Archive{ } } } - if(substr($path,0,1)!='/'){//not all programs agree on the use of a leading / + if($path[0]!='/'){//not all programs agree on the use of a leading / return $this->fileExists('/'.$path); }else{ return false; diff --git a/lib/archive/zip.php b/lib/archive/zip.php index 22ab48937eb..6631a649b16 100644 --- a/lib/archive/zip.php +++ b/lib/archive/zip.php @@ -191,7 +191,7 @@ class OC_Archive_ZIP extends OC_Archive{ } private function stripPath($path){ - if(substr($path,0,1)=='/'){ + if(!$path || $path[0]=='/'){ return substr($path,1); }else{ return $path; 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, '/') === '/..' ){ diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 8aa7b49f413..6e34257a460 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -51,7 +51,7 @@ class OC_FilesystemView { if(!$path){ $path='/'; } - if(substr($path,0,1)!=='/'){ + if($path[0]!=='/'){ $path='/'.$path; } return $this->fakeRoot.$path; diff --git a/lib/installer.php b/lib/installer.php index 5c030d2917d..34c6f8c7bb9 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -110,7 +110,7 @@ class OC_Installer{ //try to find it in a subdir $dh=opendir($extractDir); while($folder=readdir($dh)){ - if(substr($folder,0,1)!='.' and is_dir($extractDir.'/'.$folder)){ + if($folder[0]!='.' and is_dir($extractDir.'/'.$folder)){ if(is_file($extractDir.'/'.$folder.'/appinfo/info.xml')){ $extractDir.='/'.$folder; } diff --git a/lib/user/database.php b/lib/user/database.php index bb077c8364f..a48b8357d64 100644 --- a/lib/user/database.php +++ b/lib/user/database.php @@ -129,7 +129,7 @@ class OC_User_Database extends OC_User_Backend { $row=$result->fetchRow(); if($row){ $storedHash=$row['password']; - if (substr($storedHash,0,1)=='$'){//the new phpass based hashing + if ($storedHash[0]=='$'){//the new phpass based hashing $hasher=$this->getHasher(); if($hasher->CheckPassword($password.OC_Config::getValue('passwordsalt', ''), $storedHash)){ return $row['uid']; |