From ddb0ff346d3d8063f88fdba8749e098a81b92d54 Mon Sep 17 00:00:00 2001 From: Roman Geber Date: Tue, 25 Jun 2013 12:24:14 +0200 Subject: Public upload feature --- apps/files/ajax/upload.php | 48 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) (limited to 'apps/files/ajax/upload.php') diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index e1263744e1b..12db682c1e2 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -1,17 +1,53 @@ array_merge(array('message' => $l->t('Unable to set upload directory.'))))); + die(); + } +} else { + $linkItem = OCP\Share::getShareByToken($_POST['dirToken']); + + if ($linkItem === false) { + OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Invalid Token'))))); + die(); + } + + if (!($linkItem['permissions'] & OCP\PERMISSION_CREATE)) { + OCP\JSON::checkLoggedIn(); + } else { + + // The token defines the target directory (security reasons) + $dir = sprintf( + "/%s/%s", + $linkItem['file_target'], + isset($_POST['subdir']) ? $_POST['subdir'] : '' + ); + + if (!$dir || empty($dir) || $dir === false) { + OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.'))))); + die(); + } + // Setup FS with owner + OC_Util::setupFS($linkItem['uid_owner']); + } +} + + +OCP\JSON::callCheck(); -$dir = $_POST['dir']; // get array with current storage stats (e.g. max file size) $storageStats = \OCA\files\lib\Helper::buildFileStorageStatistics($dir); -- cgit v1.2.3