mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Merge remote-tracking branch 'upstream/master' into 20150306-elastic-indexer
Conflicts: bin/console bower.json composer.json composer.lock lib/Alchemy/Phrasea/Application.php lib/Alchemy/Phrasea/Border/Manager.php lib/Alchemy/Phrasea/Controller/Api/V1.php lib/Alchemy/Phrasea/Core/PhraseaEvents.php lib/Alchemy/Phrasea/SearchEngine/SearchEngineOptions.php lib/classes/caption/field.php lib/classes/record/Interface.php templates/web/prod/index.html.twig www/skins/prod/000000/prodcolor.css
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -159,32 +159,29 @@ class Root implements ControllerProviderInterface
|
||||
})->bind('admin_display_tree');
|
||||
|
||||
$controllers->get('/test-paths/', function (Application $app, Request $request) {
|
||||
|
||||
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
if (!$request->isXmlHttpRequest()) {
|
||||
$app->abort(400);
|
||||
}
|
||||
if (!array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, $app->trans('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
if (0 !== count($tests = $request->query->get('tests', []))) {
|
||||
if (0 === count($tests = $request->query->get('tests', []))) {
|
||||
$app->abort(400, $app->trans('Missing tests parameter'));
|
||||
}
|
||||
|
||||
if (null !== $path = $request->query->get('path')) {
|
||||
if (null === $path = $request->query->get('path')) {
|
||||
$app->abort(400, $app->trans('Missing path parameter'));
|
||||
}
|
||||
|
||||
foreach ($tests as $test) {
|
||||
switch ($test) {
|
||||
case 'writeable':
|
||||
if (!is_writable($path)) {
|
||||
$result = false;
|
||||
}
|
||||
$result = is_writable($path);
|
||||
break;
|
||||
case 'readable':
|
||||
default:
|
||||
if (!is_readable($path)) {
|
||||
$result = true;
|
||||
}
|
||||
break;
|
||||
$result = is_readable($path);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user