コード例 #1
0
 /**
  * check if a file is encrypted
  * @param string $path
  * @return bool
  */
 private static function isEncrypted($path)
 {
     $metadata = OC_FileCache::getCached($path);
     return isset($metadata['encrypted']) and (bool) $metadata['encrypted'];
 }
コード例 #2
0
ファイル: proxy.php プロジェクト: noci2012/owncloud
 public function postFileSize($path, $size)
 {
     if (self::isEncrypted($path)) {
         $cached = OC_FileCache::getCached($path, '/');
         return $cached['size'];
     } else {
         return $size;
     }
 }
コード例 #3
0
        OCP\JSON::error(array("data" => array("message" => $errors[$error])));
        exit;
    }
}
$files = $_FILES['files'];
$dir = $_POST['dir'];
$error = '';
$totalSize = 0;
foreach ($files['size'] as $size) {
    $totalSize += $size;
}
if ($totalSize > OC_Filesystem::free_space('/')) {
    OCP\JSON::error(array("data" => array("message" => "Not enough space available")));
    exit;
}
$result = array();
if (strpos($dir, '..') === false) {
    $fileCount = count($files['name']);
    for ($i = 0; $i < $fileCount; $i++) {
        $target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]);
        if (is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) {
            $meta = OC_FileCache::getCached($target);
            $result[] = array("status" => "success", 'mime' => $meta['mimetype'], 'size' => $meta['size'], 'name' => basename($target));
        }
    }
    OCP\JSON::encodedPrint($result);
    exit;
} else {
    $error = 'invalid dir';
}
OCP\JSON::error(array('data' => array('error' => $error, "file" => $fileName)));