From dea0d20a9ad0270896e57a7459d6276798658d7c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 27 Oct 2012 12:18:01 +0200 Subject: [PATCH] fix delete and sort files --- apps/files/ajax/delete.php | 17 +++++++---------- apps/files/ajax/scan.php | 2 ++ apps/files/index.php | 12 ++++++++++++ apps/files_sharing/public.php | 4 ++-- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php index ae6158a05a..fdd0c0c491 100644 --- a/apps/files/ajax/delete.php +++ b/apps/files/ajax/delete.php @@ -12,18 +12,15 @@ $files = isset($_POST["file"]) ? stripslashes($_POST["file"]) : stripslashes($_P $files = explode(';', $files); $filesWithError = ''; -if (OC_User::isLoggedIn()) { - $success = true; - //Now delete - foreach ($files as $file) { - if ($dir != '' || $file != 'Shared' && !\OC\Files\Filesystem::unlink($dir . '/' . $file)) { - $filesWithError .= $file . "\n"; - $success = false; - } +$success = true; + +//Now delete +foreach ($files as $file) { + if (($dir === '' && $file === 'Shared') || !\OC\Files\Filesystem::unlink($dir . '/' . $file)) { + $filesWithError .= $file . "\n"; + $success = false; } -} else { - $success = false; } if ($success) { diff --git a/apps/files/ajax/scan.php b/apps/files/ajax/scan.php index 5cd9572d7f..91b20fa836 100644 --- a/apps/files/ajax/scan.php +++ b/apps/files/ajax/scan.php @@ -1,5 +1,7 @@ assign('uidOwner', $uidOwner); $tmpl->assign('dir', basename($dir)); $tmpl->assign('filename', basename($path)); - $tmpl->assign('mimetype', OC_Filesystem::getMimeType($path)); + $tmpl->assign('mimetype', \OC\Files\Filesystem::getMimeType($path)); $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); if (isset($_GET['path'])) { $getPath = $_GET['path']; @@ -200,7 +200,7 @@ if (isset($_GET['file']) || isset($_GET['dir'])) { $tmpl->assign('uidOwner', $uidOwner); $tmpl->assign('dir', dirname($path)); $tmpl->assign('filename', basename($path)); - $tmpl->assign('mimetype', OC_Filesystem::getMimeType($path)); + $tmpl->assign('mimetype', \OC\Files\Filesystem::getMimeType($path)); if ($type == 'file') { $tmpl->assign('downloadURL', OCP\Util::linkToPublic('files').'&file='.urlencode($_GET['file']).'&download', false); } else {