101 lines
3.6 KiB
PHP
101 lines
3.6 KiB
PHP
<?php
|
||
//Developer of this module (Разработчик): Malyutin R. A. (Малютин Р. А.), Developer Website: https://sitecreator.ru 2019-2021(c)
|
||
//jquery ver. 3.4.1 (JavaScript library), Developer Website: https://jquery.com/
|
||
//jquery ui ver. 1.12.1 (JavaScript library), Developer Website: https://jqueryui.com/
|
||
//elFinder ver. 2.1.49, Developer Website: https://jqueryui.com/
|
||
|
||
|
||
class ControllerCommonFileManager extends ControllerCommonFileManager__ {
|
||
public function index() {
|
||
$oc23 = (version_compare(VERSION, "2.3", ">="))? true:false;
|
||
$oc15 = (version_compare(VERSION, "2.0", "<"))? true:false;
|
||
$oc30 = (version_compare(VERSION, "3.0", ">="))? true:false;
|
||
|
||
$data = [];
|
||
$data['module_ver'] = '1.3.1';
|
||
|
||
if($oc30) $data['token'] = $this->session->data['user_token']; // opencart 3
|
||
else $data['token'] = $this->session->data['token'];
|
||
|
||
if (isset($this->request->get['target'])) {
|
||
$data['target'] = $this->request->get['target'];
|
||
} else {
|
||
$data['target'] = '';
|
||
}
|
||
|
||
if (isset($this->request->get['cke'])) {
|
||
$data['cke'] = $this->request->get['cke'];
|
||
} else {
|
||
$data['cke'] = '';
|
||
}
|
||
|
||
if (isset($this->request->get['summernote_id'])) {
|
||
$data['summernote_id'] = $this->request->get['summernote_id'];
|
||
} else {
|
||
$data['summernote_id'] = '';
|
||
}
|
||
|
||
if (isset($this->request->get['thumb'])) {
|
||
$data['thumb'] = $this->request->get['thumb'];
|
||
} else {
|
||
$data['thumb'] = '';
|
||
}
|
||
|
||
$tpl = "truefilemanager.tpl";
|
||
if($oc23) $tpl = "truefilemanager";
|
||
if($oc30) $tpl = "truefilemanager_for_oc3";
|
||
$tpl = 'extension/module/'. $tpl;
|
||
|
||
$this->response->setOutput($this->load->view($tpl, $data));
|
||
}
|
||
|
||
public function connector() {
|
||
|
||
require_once DIR_SYSTEM. "library/sitecreator/elFinder/php/elFinderConnector.class.php";
|
||
require_once DIR_SYSTEM. "library/sitecreator/elFinder/php/elFinder.class.php";
|
||
require_once DIR_SYSTEM. "library/sitecreator/elFinder/php/elFinderVolumeDriver.class.php";
|
||
require_once DIR_SYSTEM. "library/sitecreator/elFinder/php/elFinderVolumeLocalFileSystem.class.php";
|
||
|
||
if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1')))
|
||
$domain = (defined('HTTPS_CATALOG'))? HTTPS_CATALOG: HTTPS_SERVER;
|
||
else {$domain = (defined('HTTP_CATALOG'))? HTTP_CATALOG: HTTP_SERVER;}
|
||
|
||
$this->load->model('setting/setting');
|
||
$img_opti_status = $this->config->get('module_img_opti_status');
|
||
$upload_allow = array('image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/pjpeg', 'image/x-png');
|
||
if ($img_opti_status) {
|
||
$upload_allow[] = 'image/webp';
|
||
}
|
||
|
||
$opts = array(
|
||
'roots' => array(
|
||
array(
|
||
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
|
||
'path' => DIR_IMAGE. 'catalog/', // path to files (REQUIRED)
|
||
'URL' => $domain. 'image/catalog/',
|
||
'tmbPath'=> DIR_IMAGE. 'elfinder_tmb',
|
||
'tmbURL' => $domain. 'image/elfinder_tmb/',
|
||
'tmbSize' => 100,
|
||
'tmbCrop' => false,
|
||
'tmbBgColor' => '#ffffff',
|
||
'mimeDetect' => 'internal',
|
||
'imgLib' => 'auto',
|
||
'winHashFix' => DIRECTORY_SEPARATOR !== '/', // to make hash same to Linux one on windows too
|
||
'uploadAllow' => $upload_allow,
|
||
'uploadDeny' => array('all'),
|
||
'uploadOrder' => array('allow, deny'),
|
||
)
|
||
|
||
)
|
||
);
|
||
|
||
|
||
$connector = new elFinderConnector(new elFinder($opts), true);
|
||
$connector->run();
|
||
|
||
}
|
||
|
||
}
|
||
|
||
?>
|