diff options
Diffstat (limited to 'lib/files.php')
-rw-r--r-- | lib/files.php | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/lib/files.php b/lib/files.php index b4d4de1c995..3e15c68d885 100644 --- a/lib/files.php +++ b/lib/files.php @@ -45,13 +45,16 @@ class OC_Files { if (($path == '/Shared' || substr($path, 0, 8) == '/Shared/') && OC_App::isEnabled('files_sharing')) { if ($path == '/Shared') { list($info) = OCP\Share::getItemsSharedWith('file', OC_Share_Backend_File::FORMAT_FILE_APP_ROOT); - }else{ - $info['size'] = OC_Filesystem::filesize($path); - $info['mtime'] = OC_Filesystem::filemtime($path); - $info['ctime'] = OC_Filesystem::filectime($path); - $info['mimetype'] = OC_Filesystem::getMimeType($path); - $info['encrypted'] = false; - $info['versioned'] = false; + } else { + $info = array(); + if (OC_Filesystem::file_exists($path)) { + $info['size'] = OC_Filesystem::filesize($path); + $info['mtime'] = OC_Filesystem::filemtime($path); + $info['ctime'] = OC_Filesystem::filectime($path); + $info['mimetype'] = OC_Filesystem::getMimeType($path); + $info['encrypted'] = false; + $info['versioned'] = false; + } } } else { $info = OC_FileCache::get($path); @@ -135,7 +138,7 @@ class OC_Files { * @param file $file ; seperated list of files to download * @param boolean $only_header ; boolean to only send header of the request */ - public static function get($dir,$files, $only_header = false) { + public static function get($dir, $files, $only_header = false) { if(strpos($files, ';')) { $files=explode(';', $files); } @@ -224,7 +227,7 @@ class OC_Files { } } - public static function zipAddDir($dir,$zip,$internalDir='') { + public static function zipAddDir($dir, $zip, $internalDir='') { $dirname=basename($dir); $zip->addEmptyDir($internalDir.$dirname); $internalDir.=$dirname.='/'; @@ -249,7 +252,7 @@ class OC_Files { * @param dir $targetDir * @param file $target */ - public static function move($sourceDir,$source,$targetDir,$target) { + public static function move($sourceDir, $source, $targetDir, $target) { if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared')) { $targetFile=self::normalizePath($targetDir.'/'.$target); $sourceFile=self::normalizePath($sourceDir.'/'.$source); @@ -267,7 +270,7 @@ class OC_Files { * @param dir $targetDir * @param file $target */ - public static function copy($sourceDir,$source,$targetDir,$target) { + public static function copy($sourceDir, $source, $targetDir, $target) { if(OC_User::isLoggedIn()) { $targetFile=$targetDir.'/'.$target; $sourceFile=$sourceDir.'/'.$source; @@ -282,7 +285,7 @@ class OC_Files { * @param file $name * @param type $type */ - public static function newFile($dir,$name,$type) { + public static function newFile($dir, $name, $type) { if(OC_User::isLoggedIn()) { $file=$dir.'/'.$name; if($type=='dir') { @@ -305,7 +308,7 @@ class OC_Files { * @param dir $dir * @param file $name */ - public static function delete($dir,$file) { + public static function delete($dir, $file) { if(OC_User::isLoggedIn() && ($dir!= '' || $file != 'Shared')) { $file=$dir.'/'.$file; return OC_Filesystem::unlink($file); @@ -389,9 +392,9 @@ class OC_Files { * @param string file * @return string guessed mime type */ - static function pull($source,$token,$dir,$file) { + static function pull($source, $token, $dir, $file) { $tmpfile=tempnam(get_temp_dir(), 'remoteCloudFile'); - $fp=fopen($tmpfile,'w+'); + $fp=fopen($tmpfile, 'w+'); $url=$source.="/files/pull.php?token=$token"; $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, $url); @@ -480,7 +483,7 @@ class OC_Files { } } -function fileCmp($a,$b) { +function fileCmp($a, $b) { if($a['type']=='dir' and $b['type']!='dir') { return -1; }elseif($a['type']!='dir' and $b['type']=='dir') { |