示例#1
0
$list->assign('downloadURL', OCP\Util::linkTo('files', 'download.php') . '?file=', false);
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '&dir=', false);
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
$freeSpace = OC_Filesystem::free_space('/');
$freeSpace = max($freeSpace, 0);
$maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
$permissions = OCP\Share::PERMISSION_READ;
if (OC_Filesystem::isUpdatable($dir . '/')) {
    $permissions |= OCP\Share::PERMISSION_UPDATE;
}
if (OC_Filesystem::isDeletable($dir . '/')) {
    $permissions |= OCP\Share::PERMISSION_DELETE;
}
if (OC_Filesystem::isSharable($dir . '/')) {
    $permissions |= OCP\Share::PERMISSION_SHARE;
}
$tmpl = new OCP\Template('files', 'index', 'user');
$tmpl->assign('fileList', $list->fetchPage(), false);
$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage(), false);
$tmpl->assign('dir', OC_Filesystem::normalizePath($dir));
$tmpl->assign('isCreatable', OC_Filesystem::isCreatable($dir . '/'));
$tmpl->assign('permissions', $permissions);
$tmpl->assign('files', $files);
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
$tmpl->printPage();