diff --git a/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/filemanager/connectors/php/filemanager.class.php b/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/filemanager/connectors/php/filemanager.class.php index 71625974a0a..bb8a428d4ab 100644 --- a/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/filemanager/connectors/php/filemanager.class.php +++ b/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/filemanager/connectors/php/filemanager.class.php @@ -79,16 +79,18 @@ public function __construct($extraConfig = '') // else it takes $_SERVER['DOCUMENT_ROOT'] default value if ($this->config['options']['fileRoot'] !== false) { if ($this->config['options']['serverRoot'] === true) { - $this->doc_root = $_SERVER['DOCUMENT_ROOT']; + // modif DDC pour coller a la config des server wmk + $this->doc_root = substr(__DIR__, 0, strpos(__DIR__, '/app/')); $this->separator = basename($this->config['options']['fileRoot']); - $this->path_to_files = $_SERVER['DOCUMENT_ROOT'].'/'.$this->config['options']['fileRoot']; + $this->path_to_files = substr(__DIR__, 0, strpos(__DIR__, '/app/')).'/'.$this->config['options']['fileRoot']; } else { $this->doc_root = $this->config['options']['fileRoot']; $this->separator = basename($this->config['options']['fileRoot']); $this->path_to_files = $this->config['options']['fileRoot']; } } else { - $this->doc_root = $_SERVER['DOCUMENT_ROOT']; + // modif DDC pour coller a la config des server wmk + $this->doc_root = substr(__DIR__, 0, strpos(__DIR__, '/app/')); $this->path_to_files = $this->root.$this->separator.'/'; } @@ -112,9 +114,8 @@ public function setup($extraconfig) // allow Filemanager to be used with dynamic folders public function setFileRoot($path, $documentRoot = null) { - if ($documentRoot == null) { - $documentRoot = $_SERVER['DOCUMENT_ROOT']; - } + // modif pour coller au server wmk + $documentRoot = substr(__DIR__, 0, strpos(__DIR__, '/app/')); // Paths are bit complex to handle - kind of nightmare actually .... // 3 parts are availables @@ -971,7 +972,7 @@ public function preview($thumbnail) header('Content-Transfer-Encoding: Binary'); header('Content-length: '.filesize($returned_path)); header('Content-Disposition: inline; filename="'.basename($returned_path).'"'); - + usleep(rand(500000, 1000000)); readfile($returned_path); exit(); diff --git a/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/filemanager/connectors/php/user.config.php b/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/filemanager/connectors/php/user.config.php index d60c3e0898b..d97aa3873b7 100644 --- a/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/filemanager/connectors/php/user.config.php +++ b/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/filemanager/connectors/php/user.config.php @@ -44,8 +44,13 @@ $container->get('event_dispatcher')->dispatch(KernelEvents::REQUEST, $event); $session = $container->get('session'); + $userDir = $session->get('mautic.imagepath', false); + $baseDir = $session->get('mautic.basepath', false); + $docRoot = $session->get('mautic.docroot', false); + $securityToken = $container->get('security.token_storage'); $token = $securityToken->getToken(); + session_abort(); $authenticated = ($token instanceof TokenInterface) ? count($token->getRoles()) : false; } catch (\Exception $exception) { error_log($exception); @@ -81,10 +86,6 @@ function auth() $fm = new Filemanager(); if ($authenticated) { - $userDir = $session->get('mautic.imagepath', false); - $baseDir = $session->get('mautic.basepath', false); - $docRoot = $session->get('mautic.docroot', false); - if (substr($userDir, -1) !== '/') { $userDir .= '/'; }