-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Depend on elFinder repo itself instead of fmelfinder-php-connector * Updated namespaces and class names to be consistent with studio-42/elfinder, added studio-42 as dependency * Added ability to parse MySQL driver * Added all options for mysql driver * Added array for mysql_settings * Coveralls removed src_dir * Tests summernote configuration * Attempt to pass tests * Tweaked settings for mysql * Added default data to expected configuration * Added basic test for mysql driver * Removed session statement * Removed two statements * Basic configuration for permissions handling * Added security_voter option to DI configuration * Added security_voter option to tests * Added encoding option * Added additional options to DI configuration * Fixed misprint, rewrite docblock * Rewritten some docblocks, added getter for volumes * Updated readme
- Loading branch information
Showing
23 changed files
with
663 additions
and
70 deletions.
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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
service_name: travis-ci | ||
src_dir: ./ | ||
coverage_clover: clover.xml | ||
json_path: coveralls.json | ||
coverage_clover: build/logs/clover.xml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
namespace FM\ElfinderBundle\Connector; | ||
|
||
use elFinder; | ||
|
||
/** | ||
* Class ElFinderConnector. | ||
*/ | ||
class ElFinderConnector extends \elFinderConnector | ||
{ | ||
public function run($queryParameters = null) | ||
{ | ||
if (null === $queryParameters) { | ||
$queryParameters = $_GET; | ||
} | ||
exit(json_encode($this->execute($queryParameters))); | ||
} | ||
|
||
public function execute($queryParameters) | ||
{ | ||
$isPost = 'POST' == $_SERVER['REQUEST_METHOD']; | ||
$src = 'POST' == $_SERVER['REQUEST_METHOD'] ? array_merge($_POST, $queryParameters) : $queryParameters; | ||
if ($isPost && !$src && $rawPostData = @file_get_contents('php://input')) { | ||
// for support IE XDomainRequest() | ||
$parts = explode('&', $rawPostData); | ||
foreach ($parts as $part) { | ||
list($key, $value) = array_pad(explode('=', $part), 2, ''); | ||
$src[$key] = rawurldecode($value); | ||
} | ||
$_POST = $src; | ||
$_REQUEST = array_merge_recursive($src, $_REQUEST); | ||
} | ||
$cmd = isset($src['cmd']) ? $src['cmd'] : ''; | ||
$args = array(); | ||
|
||
if (!function_exists('json_encode')) { | ||
$error = $this->elFinder->error(elFinder::ERROR_CONF, elFinder::ERROR_CONF_NO_JSON); | ||
|
||
return $this->output(array('error' => '{"error":["'.implode('","', $error).'"]}', 'raw' => true)); | ||
} | ||
|
||
if (!$this->elFinder->loaded()) { | ||
return $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_CONF, elFinder::ERROR_CONF_NO_VOL), 'debug' => $this->elFinder->mountErrors)); | ||
} | ||
|
||
// telepat_mode: on | ||
if (!$cmd && $isPost) { | ||
return $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_UPLOAD, elFinder::ERROR_UPLOAD_TOTAL_SIZE), 'header' => 'Content-Type: text/html')); | ||
} | ||
// telepat_mode: off | ||
|
||
if (!$this->elFinder->commandExists($cmd)) { | ||
return $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_UNKNOWN_CMD))); | ||
} | ||
|
||
// collect required arguments to exec command | ||
foreach ($this->elFinder->commandArgsList($cmd) as $name => $req) { | ||
$arg = 'FILES' == $name | ||
? $_FILES | ||
: (isset($src[$name]) ? $src[$name] : ''); | ||
|
||
if (!is_array($arg)) { | ||
$arg = trim($arg); | ||
} | ||
if ($req && (!isset($arg) || '' === $arg)) { | ||
return $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_INV_PARAMS, $cmd))); | ||
} | ||
$args[$name] = $arg; | ||
} | ||
|
||
$args['debug'] = isset($src['debug']) ? (bool) $src['debug'] : false; | ||
|
||
return $this->output($this->elFinder->exec($cmd, $this->input_filter($args))); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
namespace FM\ElfinderBundle\Controller; | ||
|
||
use Exception; | ||
use FM\ElfinderBundle\Loader\ElFinderLoader; | ||
use FM\ElfinderBundle\Session\ElFinderSession; | ||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
|
@@ -12,12 +14,7 @@ | |
use FM\ElfinderBundle\Event\ElFinderPostExecutionEvent; | ||
|
||
/** | ||
* Loader service for Elfinder backend | ||
* displays Elfinder. | ||
* | ||
* @author Al Ganiev <[email protected]> | ||
* @copyright 2012-2015 Al Ganiev | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT License | ||
* Class ElFinderController. | ||
*/ | ||
class ElFinderController extends Controller | ||
{ | ||
|
@@ -29,6 +26,8 @@ class ElFinderController extends Controller | |
* @param string $homeFolder | ||
* | ||
* @return Response | ||
* | ||
* @throws Exception | ||
*/ | ||
public function showAction(Request $request, $instance, $homeFolder) | ||
{ | ||
|
@@ -217,7 +216,9 @@ public function loadAction(Request $request, $instance, $homeFolder) | |
{ | ||
$loader = $this->get('fm_elfinder.loader'); | ||
$loader->initBridge($instance); // builds up the Bridge object for the loader with the given instance | ||
|
||
if ($loader instanceof ElFinderLoader) { | ||
$loader->setSession(new ElFinderSession($this->get('session'))); | ||
} | ||
$httpKernel = $this->get('http_kernel'); | ||
$preExecutionEvent = new ElFinderPreExecutionEvent($request, $httpKernel, $instance, $homeFolder); | ||
$this->get('event_dispatcher')->dispatch(ElFinderEvents::PRE_EXECUTION, $preExecutionEvent); | ||
|
Oops, something went wrong.