-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redesign and allow people to upload in the multiple locations #31
Closed
Closed
Changes from 33 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
7ee9ba4
Handle translation
NastuzziSamy 8a3c86a
Merge pull request #14 from NastuzziSamy/master
e-alfred 494f898
Updated ng-flow version (2.7.7), fixed regex for character sanitation
e-alfred 96f42df
Improved santitation of directory paths
e-alfred 434dfed
Fix deprecated API call \OCP\addNavigationEntry()
e-alfred 5003da0
Remove deprecated PHP requirements
e-alfred b253fb0
Remove deprecated file appinfo/version
e-alfred 31bb5aa
Added German translation
e-alfred 6636bbd
Bump supported version and remove Owncloud
e-alfred bdb2657
Improve translations
e-alfred 0a467c1
Create pl.js
mzary 1e0b525
Create pl.json
mzary 2d85345
Merge pull request #19 from mzary/patch-1
e-alfred 3b97d1f
Merge pull request #18 from mzary/patch-2
e-alfred dee4e37
Add files via upload
f0c6bee
add one string
b8c83d8
better ..
e83920a
Merge pull request #21 from CHazz/master
e-alfred 259120f
Fixed missing "Select folder" translation
e-alfred d8bc52e
Add issue template
e-alfred 1cf3a59
Update fr.js
Larsene 7a4441b
Update fr.json
Larsene c522af6
Merge pull request #27 from Larsene/patch-1
e-alfred 6ac767f
Merge pull request #28 from Larsene/patch-2
e-alfred 7df5374
Removed deprecated \OCP\Util methods
e-alfred 0f843fe
Remove deprecated methods
e-alfred 3aec537
Merge remote-tracking branch 'origin/master'
NastuzziSamy 603b35a
Redesign
NastuzziSamy 919129d
Preparation of the location feature
NastuzziSamy 12ec459
Possibility to upload in diferent locations in the same time
NastuzziSamy 0dfd866
Add me as author and update the version
NastuzziSamy 2d53cc0
Merge branch 'master' into master
NastuzziSamy fab627e
Merge branch 'master' into master
NastuzziSamy c40285a
Merge remote-tracking branch 'e-alfred/master'
NastuzziSamy 0766698
Fix deprecated calls for NC14+ compatibliity
e-alfred 43f3b0b
Merge branch 'master' into master
e-alfred File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
// Restrict access // ToDo: Enabled for current user? | ||
if (!\OCP\User::isLoggedIn() || !\OCP\App::isEnabled('flowupload')) { | ||
\OC_Response::setStatus(403); | ||
} | ||
|
||
function getAllLocations() { | ||
// ToDo: Return locations from database | ||
return array( | ||
array( | ||
'id' => 0, | ||
'location' => '/flowupload/', | ||
'pause' => 0, | ||
'uploading' => 0, | ||
'completed' => 0, | ||
'aborted' => 0 | ||
) | ||
); | ||
} | ||
|
||
function addNewLocation($location) { | ||
// ToDo: Add to database | ||
$location = preg_replace('/(\.\.\/|~|\/\/)/i', '', '/'.$location.'/'); | ||
$location = preg_replace('/[^a-z0-9äöüß \(\)\.\-_\/]/i', '', $location); | ||
$location = trim($location); | ||
|
||
return $location; | ||
} | ||
|
||
if ($_SERVER['REQUEST_METHOD'] === 'POST') { | ||
$_POST = json_decode(file_get_contents('php://input'), true); | ||
|
||
if (isset($_POST['location']) && \OC\Files\Filesystem::isValidPath($_POST['location'])) { | ||
$locations = getAllLocations(); | ||
|
||
foreach ($locations as $location) { | ||
if ($location['location'] === $_POST['location']) { | ||
\OC_Response::setStatus(409); | ||
die(); | ||
} | ||
} | ||
|
||
\OC_Response::setStatus(201); | ||
|
||
$location = addNewLocation($_POST['location']); | ||
|
||
echo json_encode(array( | ||
'id' => preg_replace('#/#', '', $location), | ||
'location' => $location, | ||
'pause' => 0, | ||
'uploading' => 0, | ||
'completed' => 0, | ||
'aborted' => 0 | ||
)); | ||
} | ||
else { | ||
\OC_Response::setStatus(400); | ||
} | ||
|
||
die(); | ||
} | ||
|
||
echo json_encode(array( | ||
"locations" => getAllLocations() | ||
)); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will have to change this function because both calls are deprecated.