summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/ajax/list.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2014-05-04 15:51:08 +0200
committerLukas Reschke <lukas@statuscode.ch>2014-05-04 15:51:08 +0200
commit0b7d9e2668e3a2e2049eb84f9c49fac41d71d35e (patch)
treee68c70c2143dfbfa5be20af7efac929ce2ca034c /apps/files_sharing/ajax/list.php
parent9385b97b5f38ebf2ed85e740fe3c52f1e6117d49 (diff)
downloadnextcloud-server-0b7d9e2668e3a2e2049eb84f9c49fac41d71d35e.tar.gz
nextcloud-server-0b7d9e2668e3a2e2049eb84f9c49fac41d71d35e.zip
Cleanup code a little bit
- Use OCP\Response constants instead of the HTTP error code - Use checkAppEnabled() instead of OC_App::isEnabled with an if statement - Remove uneeded variable $baseURL - Rename $isvalid to $isValid
Diffstat (limited to 'apps/files_sharing/ajax/list.php')
-rw-r--r--apps/files_sharing/ajax/list.php16
1 files changed, 4 insertions, 12 deletions
diff --git a/apps/files_sharing/ajax/list.php b/apps/files_sharing/ajax/list.php
index 4b645496253..76926d84b22 100644
--- a/apps/files_sharing/ajax/list.php
+++ b/apps/files_sharing/ajax/list.php
@@ -20,17 +20,10 @@
*
*/
-// only need filesystem apps
-$RUNTIME_APPTYPES=array('filesystem');
-
-// Init owncloud
-
-if(!\OC_App::isEnabled('files_sharing')){
- exit;
-}
+OCP\JSON::checkAppEnabled('files_sharing');
if(!isset($_GET['t'])){
- \OC_Response::setStatus(400); //400 Bad Request
+ \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST);
\OC_Log::write('core-preview', 'No token parameter was passed', \OC_Log::DEBUG);
exit;
}
@@ -55,13 +48,12 @@ $dir = $data['realPath'];
$dir = \OC\Files\Filesystem::normalizePath($dir);
if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
- \OC_Response::setStatus(404);
+ \OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
\OCP\JSON::error(array('success' => false));
exit();
}
$data = array();
-$baseUrl = OCP\Util::linkTo('files_sharing', 'index.php') . '?t=' . urlencode($token) . '&dir=';
// make filelist
$files = \OCA\Files\Helper::getFiles($dir);
@@ -88,4 +80,4 @@ if (OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes') === 'n
$data['permissions'] = $permissions;
-OCP\JSON::success(array('data' => $data));
+OCP\JSON::success(array('data' => $data)); \ No newline at end of file