Initial commit
5
local/modules/Tinymce/CHANGELOG.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# 2.3.0
|
||||
|
||||
- Add the possibility to choose the text areas where the module editor will be shown
|
||||
- The available text areas are description, summary and conclusion in the updating pages of brands, products, categories, folder and contents
|
||||
- The default configuration activates the module for all the descriptions
|
||||
25
local/modules/Tinymce/Config/config.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<services>
|
||||
<service id="smarty.plugin.tinymce_lang" class="Tinymce\Smarty\TinyMCELanguage">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="request"/>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<hooks>
|
||||
<hook id="tinymce.hook" class="Tinymce\Hook\HookManager">
|
||||
<tag name="hook.event_listener" event="module.configuration" type="back" templates="render:module_configuration.html" />
|
||||
<tag name="hook.event_listener" event="wysiwyg.js" type="back" method="onJsWysiwyg" />
|
||||
</hook>
|
||||
</hooks>
|
||||
|
||||
<forms>
|
||||
<form name="tinymce.configure" class="Tinymce\Form\ConfigurationForm" />
|
||||
</forms>
|
||||
|
||||
</config>
|
||||
18
local/modules/Tinymce/Config/module.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module>
|
||||
<fullnamespace>Tinymce\Tinymce</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>TinyMCE WYSIWYG editor</title>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>Editeur visuel TinyMCE</title>
|
||||
</descriptive>
|
||||
<version>2.4.3</version>
|
||||
<author>
|
||||
<name>Manuel Raynaud</name>
|
||||
<email>manu@raynaud.io</email>
|
||||
</author>
|
||||
<type>classic</type>
|
||||
<thelia>2.4.3</thelia>
|
||||
<stability>alpha</stability>
|
||||
</module>
|
||||
9
local/modules/Tinymce/Config/routing.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="tinymce.configure" path="/admin/tinymce/configure" methods="post">
|
||||
<default key="_controller">Tinymce\Controller\ConfigureController::configure</default>
|
||||
</route>
|
||||
</routes>
|
||||
128
local/modules/Tinymce/Controller/ConfigureController.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Tinymce\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Tools\URL;
|
||||
use Tinymce\Form\ConfigurationForm;
|
||||
use Tinymce\Tinymce;
|
||||
|
||||
/**
|
||||
* Class SetTransferConfig
|
||||
* @package WireTransfer\Controller
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class ConfigureController extends BaseAdminController
|
||||
{
|
||||
public function configure()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'Tinymce', AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
// Initialize the potential exception
|
||||
$ex = null;
|
||||
|
||||
// Create the Form from the request
|
||||
$configurationForm = new ConfigurationForm($this->getRequest());
|
||||
|
||||
try {
|
||||
// Check the form against constraints violations
|
||||
$form = $this->validateForm($configurationForm, "POST");
|
||||
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
Tinymce::setConfigValue('product_summary', $data['product_summary']);
|
||||
Tinymce::setConfigValue('product_conclusion', $data['product_conclusion']);
|
||||
|
||||
Tinymce::setConfigValue('content_summary', $data['content_summary']);
|
||||
Tinymce::setConfigValue('content_conclusion', $data['content_conclusion']);
|
||||
|
||||
Tinymce::setConfigValue('category_summary', $data['category_summary']);
|
||||
Tinymce::setConfigValue('category_conclusion', $data['category_conclusion']);
|
||||
|
||||
Tinymce::setConfigValue('folder_summary', $data['folder_summary']);
|
||||
Tinymce::setConfigValue('folder_conclusion', $data['folder_conclusion']);
|
||||
|
||||
Tinymce::setConfigValue('brand_summary', $data['brand_summary']);
|
||||
Tinymce::setConfigValue('brand_conclusion', $data['brand_conclusion']);
|
||||
|
||||
Tinymce::setConfigValue('show_menu_bar', $data['show_menu_bar']);
|
||||
Tinymce::setConfigValue('force_pasting_as_text', $data['force_pasting_as_text']);
|
||||
Tinymce::setConfigValue('editor_height', $data['editor_height']);
|
||||
Tinymce::setConfigValue('custom_css', $data['custom_css']);
|
||||
|
||||
// Save Custom CSS in default assets
|
||||
$customCss = __DIR__ .DS.'..'.DS.'templates'.DS.'backOffice'.DS.'default'.DS.'assets'.DS.'css'.DS.'custom-css.less';
|
||||
|
||||
if (false === file_put_contents($customCss, $data['custom_css'])) {
|
||||
throw new TheliaProcessException(
|
||||
$this->getTranslator()->trans(
|
||||
"Failed to update custom CSS file \"%file\". Please check this file or parent folder write permissions.",
|
||||
[ '%file' => $customCss ]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Log configuration modification
|
||||
$this->adminLogAppend(
|
||||
"tinymce.configuration.message",
|
||||
AccessManager::UPDATE,
|
||||
sprintf("Tinymce configuration updated")
|
||||
);
|
||||
|
||||
// Everything is OK.
|
||||
return new RedirectResponse(URL::getInstance()->absoluteUrl('/admin/module/Tinymce'));
|
||||
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated. Create the error message using
|
||||
// the BaseAdminController helper method.
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
|
||||
// At this point, the form has errors, and should be redisplayed. We don not redirect,
|
||||
// just redisplay the same template.
|
||||
// Setup the Form error context, to make error information available in the template.
|
||||
$this->setupFormErrorContext(
|
||||
$this->getTranslator()->trans("Tinymce configuration", [], Tinymce::MODULE_DOMAIN),
|
||||
$error_msg,
|
||||
$configurationForm,
|
||||
$ex
|
||||
);
|
||||
|
||||
// Do not redirect at this point, or the error context will be lost.
|
||||
// Just redisplay the current template.
|
||||
return $this->render('module-configure', array('module_code' => 'Tinymce'));
|
||||
}
|
||||
}
|
||||
161
local/modules/Tinymce/Form/ConfigurationForm.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Tinymce\Form;
|
||||
|
||||
use Thelia\Form\BaseForm;
|
||||
use Tinymce\Tinymce;
|
||||
|
||||
/**
|
||||
* Class ConfigurationForm
|
||||
* @package Cheque\Form
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class ConfigurationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'editor_height',
|
||||
'integer',
|
||||
[
|
||||
'required' => false,
|
||||
'data' => Tinymce::getConfigValue('editor_height', 0),
|
||||
'label' => $this->translator->trans('Height of the editor area, in pixels. Enter 0 for default ', [], Tinymce::MODULE_DOMAIN),
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'show_menu_bar',
|
||||
'checkbox',
|
||||
[
|
||||
'required' => false,
|
||||
'data' =>intval(Tinymce::getConfigValue('show_menu_bar', 0)) != 0,
|
||||
'label' => $this->translator->trans('Show the TinyMCE menu bar', [], Tinymce::MODULE_DOMAIN),
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'force_pasting_as_text',
|
||||
'checkbox',
|
||||
[
|
||||
'required' => false,
|
||||
'data' => intval(Tinymce::getConfigValue('force_pasting_as_text', 0)) != 0,
|
||||
'label' => $this->translator->trans('Force pasting as text', [], Tinymce::MODULE_DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('If checked, all pasted data will be converted as plain text, removing tags and styles.', [], Tinymce::MODULE_DOMAIN)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'set_images_as_responsive',
|
||||
'checkbox',
|
||||
[
|
||||
'required' => false,
|
||||
'data' => intval(Tinymce::getConfigValue('set_images_as_responsive', 1)) != 0,
|
||||
'label' => $this->translator->trans('Add responsive class to images', [], Tinymce::MODULE_DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('If checked, the "img-responsive" class is added by default to inserted images', [], Tinymce::MODULE_DOMAIN)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'custom_css',
|
||||
'textarea',
|
||||
[
|
||||
'required' => false,
|
||||
'data' => Tinymce::getConfigValue('custom_css', '/* Enter here CSS or LESS code */'),
|
||||
'label' => $this->translator->trans('Custom CSS available in the editor', [], Tinymce::MODULE_DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('Enter CSS or LESS code. You may also customize the editor.less file in the plugin template directory.', [], Tinymce::MODULE_DOMAIN)
|
||||
],
|
||||
'attr' => [
|
||||
'rows' => 10,
|
||||
'style' => 'font-family: \'Courier New\', Courier, monospace;'
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'test_zone',
|
||||
'textarea',
|
||||
[
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Sample editor', [], Tinymce::MODULE_DOMAIN),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('This is a sample text editor, to view actual configuration.', [], Tinymce::MODULE_DOMAIN)
|
||||
]
|
||||
]
|
||||
)->add(
|
||||
'available_text_areas',
|
||||
'text',
|
||||
[
|
||||
'disabled' => true,
|
||||
'required' => false,
|
||||
'label_attr' => [],
|
||||
'data' => Tinymce::getConfigValue('available_text_areas')
|
||||
]
|
||||
);
|
||||
|
||||
foreach ($this->getFieldsKeys() as $key) {
|
||||
$this->addConfigField($key);
|
||||
}
|
||||
}
|
||||
|
||||
public function getFieldsKeys()
|
||||
{
|
||||
return array(
|
||||
'product_summary',
|
||||
'product_conclusion',
|
||||
'brand_summary',
|
||||
'brand_conclusion',
|
||||
'content_summary',
|
||||
'content_conclusion',
|
||||
'folder_summary',
|
||||
'folder_conclusion',
|
||||
'category_summary',
|
||||
'category_conclusion',
|
||||
);
|
||||
}
|
||||
|
||||
protected function addConfigField($key)
|
||||
{
|
||||
$this->formBuilder->add(
|
||||
$key,
|
||||
"checkbox",
|
||||
array(
|
||||
"label_attr" => [],
|
||||
"required" => false,
|
||||
"constraints" => array(),
|
||||
"data" => intval(Tinymce::getConfigValue($key, 0)) != 0,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of you form. This name must be unique
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'timymce_configuration';
|
||||
}
|
||||
}
|
||||
31
local/modules/Tinymce/Hook/HookManager.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Tinymce\Hook;
|
||||
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
/**
|
||||
* Class HookManager
|
||||
*
|
||||
* @package Tinymce\Hook
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class HookManager extends BaseHook
|
||||
{
|
||||
public function onJsWysiwyg(HookRenderEvent $event)
|
||||
{
|
||||
$content = $this->render("tinymce_init.tpl");
|
||||
$event->add($content);
|
||||
}
|
||||
}
|
||||
5
local/modules/Tinymce/I18n/backOffice/default/de_DE.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'None' => 'Keine Angabe',
|
||||
];
|
||||
7
local/modules/Tinymce/I18n/backOffice/default/en_US.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'File manager' => 'File manager',
|
||||
'None' => 'None',
|
||||
'Responsive' => 'Responsive',
|
||||
);
|
||||
17
local/modules/Tinymce/I18n/backOffice/default/fr_FR.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Brand' => 'Marque',
|
||||
'Category' => 'Catégorie',
|
||||
'Conclusion' => 'Conclusion',
|
||||
'Content' => 'Contenu',
|
||||
'File manager' => 'Explorateur de fichiers',
|
||||
'Folder' => 'Dossier',
|
||||
'List of the text area where the wysiwyg editor will be used' => 'Liste des zones de texte dans lesquelles l\'éditeur wysiwyg sera utilisé',
|
||||
'None' => 'Aucun',
|
||||
'Product' => 'Produit',
|
||||
'Responsive' => 'Responsive',
|
||||
'Summary' => 'Résumé',
|
||||
'This is a <strong>critical</strong> data, to update it you have to inform the ids (#timymce_configuration-id-test_zone for example) or the classes (.wysiwyg for example) , <strong>separated with comas</strong>, of the text areas you want to have the wysiwyg editor <strong>directly in the data base</strong>.' => '<strong>Donnée critique</strong>. Pour la modifier vous devez renseigner <strong>directement en base de données</strong> et en les <strong>séparant par des virgules</strong> les id (#id) ou les classes (.classe) des zones de texte pour lesquelles vous voulez utiliser l\'éditeur wysiwyg.',
|
||||
'TinyMCE configuration' => 'Configuration de TinyMCE',
|
||||
];
|
||||
17
local/modules/Tinymce/I18n/backOffice/default/ru_RU.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Brand' => 'Бренд',
|
||||
'Category' => 'Категория',
|
||||
'Conclusion' => 'Заключение',
|
||||
'Content' => 'Контент',
|
||||
'File manager' => 'Менеджер файлов',
|
||||
'Folder' => 'Папка',
|
||||
'List of the text area where the wysiwyg editor will be used' => 'Список областей вводе где будет использоваться WYSIWYG редактор',
|
||||
'None' => 'Нет',
|
||||
'Product' => 'Товар',
|
||||
'Responsive' => 'Адаптивный',
|
||||
'Summary' => 'Краткое описание',
|
||||
'This is a <strong>critical</strong> data, to update it you have to inform the ids (#timymce_configuration-id-test_zone for example) or the classes (.wysiwyg for example) , <strong>separated with comas</strong>, of the text areas you want to have the wysiwyg editor <strong>directly in the data base</strong>.' => 'Это <strong>критичные</strong> данные. Для обновления их вам необходимо указать идентификаторы (например #timymce_configuration-id-test_zone) или классы (например .wysiwyg) , <strong>разделенные запятыми</strong>, областей редактирования которые вы хотите использовать с WYSIWYG редактором. <strong>Изменения необходимо вносить напрямую в базу.</strong>',
|
||||
'TinyMCE configuration' => 'Конфигурация TinyMCE',
|
||||
);
|
||||
7
local/modules/Tinymce/I18n/backOffice/default/tr_TR.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'File manager' => 'Dosya Yöneticisi',
|
||||
'None' => 'Yok',
|
||||
'Responsive' => 'Duyarlı',
|
||||
];
|
||||
15
local/modules/Tinymce/I18n/en_US.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Add responsive class to images' => 'Add responsive class to images',
|
||||
'Custom CSS available in the editor' => 'Custom CSS available in the editor',
|
||||
'Enter CSS or LESS code. You may also customize the editor.less file in the plugin template directory.' => 'Enter CSS or LESS code. You may also customize the editor.less file in the plugin template directory.',
|
||||
'Force pasting as text' => 'Force pasting as text',
|
||||
'Height of the editor area, in pixels. Enter 0 for default ' => 'Height of the editor area, in pixels. Enter 0 for default ',
|
||||
'If checked, all pasted data will be converted as plain text, removing tags and styles.' => 'If checked, all pasted data will be converted as plain text, removing tags and styles.',
|
||||
'If checked, the "img-responsive" class is added by default to inserted images' => 'If checked, the "img-responsive" class is added by default to inserted images',
|
||||
'Sample editor' => 'Sample editor',
|
||||
'Show the TinyMCE menu bar' => 'Show the TinyMCE menu bar',
|
||||
'This is a sample text editor, to view actual configuration.' => 'This is a sample text editor, to view actual configuration.',
|
||||
'Tinymce configuration' => 'Tinymce configuration',
|
||||
);
|
||||
15
local/modules/Tinymce/I18n/fr_FR.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Add responsive class to images' => 'Rendre les images responsives',
|
||||
'Custom CSS available in the editor' => 'CSS personnalisé à proposer dans l\'éditeur',
|
||||
'Enter CSS or LESS code. You may also customize the editor.less file in the plugin template directory.' => 'Indiquez du code CSS ou LESS. Vous pouvez aussi modifier le fichier "editor.less" dans les assets du plugin',
|
||||
'Force pasting as text' => 'Forcer le collage en mode texte',
|
||||
'Height of the editor area, in pixels. Enter 0 for default ' => 'Hauteur de la zone d\'édition (en pixels, 0 pour la valeur par défaut)',
|
||||
'If checked, all pasted data will be converted as plain text, removing tags and styles.' => 'Si cette case est cochée tous les styles et balises HTML seront supprimées lorsque du texte sera collé.',
|
||||
'If checked, the "img-responsive" class is added by default to inserted images' => 'Si cette case est cochée, la classe \'img-responsive\' sera ajoutée aux images.',
|
||||
'Sample editor' => 'Editeur de test',
|
||||
'Show the TinyMCE menu bar' => 'Afficher la barre de menu TinyMCE',
|
||||
'This is a sample text editor, to view actual configuration.' => 'Il s\'agit d\'une zone de test de votre configuration',
|
||||
'Tinymce configuration' => 'Configuration de TinyMCE',
|
||||
];
|
||||
6
local/modules/Tinymce/I18n/it_IT.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Enter CSS or LESS code. You may also customize the editor.less file in the plugin template directory.' => 'Inserire il codice CSS o LESS. Si può anche personalizzare il file editor.less nella directory plugin del template.',
|
||||
'Tinymce configuration' => 'Configurazione di TinyMCE',
|
||||
];
|
||||
16
local/modules/Tinymce/I18n/ru_RU.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Add responsive class to images' => 'Добавить адаптивный класс к изображениям',
|
||||
'Custom CSS available in the editor' => 'Пользовательский CSS доступный в редакторе',
|
||||
'Enter CSS or LESS code. You may also customize the editor.less file in the plugin template directory.' => 'Введите CSS или LESS код. Вы так же можете настроить файл editor.less file в директории шаблона плагина.',
|
||||
'Failed to update custom CSS file "%file". Please check this file or parent folder write permissions.' => 'Ошибка обновления пользовательского CSS файла "%file". Пожалуйста проверьте права на этот файл и родидельскую директорию.',
|
||||
'Force pasting as text' => 'Принудительно вставлять как текст',
|
||||
'Height of the editor area, in pixels. Enter 0 for default ' => 'Высота зоны редактора в пикселях. Введите 0 для стандартной',
|
||||
'If checked, all pasted data will be converted as plain text, removing tags and styles.' => 'Если выбрано, весь вставляемый текст будет сконвертирован в обычный текст без оформления.',
|
||||
'If checked, the "img-responsive" class is added by default to inserted images' => 'Если выбрано, класс "img-responsive" будет добавлен к вставляемым изображениям',
|
||||
'Sample editor' => 'Пример редактора',
|
||||
'Show the TinyMCE menu bar' => 'Показывать панель меню TinyMCE',
|
||||
'This is a sample text editor, to view actual configuration.' => 'Это пример редактора с актуальной конфигурацией.',
|
||||
'Tinymce configuration' => 'Конфигурация Tinymce',
|
||||
);
|
||||
15
local/modules/Tinymce/I18n/tr_TR.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Add responsive class to images' => 'Resimlere duyarlı sınıf ekleme',
|
||||
'Custom CSS available in the editor' => 'Özel CSS Düzenleyicisi içinde kullanılabilir',
|
||||
'Enter CSS or LESS code. You may also customize the editor.less file in the plugin template directory.' => 'CSS veya daha az kod girin. Ayrıca eklenti şablonu dizinindeki editor.less dosyasını özelleştirebilir.',
|
||||
'Force pasting as text' => 'Kuvvet yapıştırma metin olarak',
|
||||
'Height of the editor area, in pixels. Enter 0 for default ' => 'Editör alanının piksel cinsinden yüksekliği. Varsayılan için 0 girin ',
|
||||
'If checked, all pasted data will be converted as plain text, removing tags and styles.' => 'İşaretli değilse, tüm yapıştırılan veri etiketleri ve stilleri kaldırma düz metin olarak dönüştürülür.',
|
||||
'If checked, the "img-responsive" class is added by default to inserted images' => 'İşaretli değilse, "img-duyarlı" sınıf varsayılan olarak eklenen resimlere eklenir',
|
||||
'Sample editor' => 'Örnek Düzenleyicisi',
|
||||
'Show the TinyMCE menu bar' => 'TinyMCE menü çubuğunu göster',
|
||||
'This is a sample text editor, to view actual configuration.' => 'Bu gerçek yapılandırmasını görüntülemek için bir örnek metin editörü olan.',
|
||||
'Tinymce configuration' => 'TinyMCE yapılandırma',
|
||||
];
|
||||
165
local/modules/Tinymce/LICENSE.txt
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
719
local/modules/Tinymce/Resources/js/tinymce/filemanager/ajax_calls.php
Executable file
@@ -0,0 +1,719 @@
|
||||
<?php
|
||||
|
||||
$config = include 'config/config.php';
|
||||
//TODO switch to array
|
||||
extract($config, EXTR_OVERWRITE);
|
||||
|
||||
require_once 'include/utils.php';
|
||||
|
||||
if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager")
|
||||
{
|
||||
response(trans('forbiden').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
$languages = include 'lang/languages.php';
|
||||
|
||||
if (isset($_SESSION['RF']['language']) && file_exists('lang/' . basename($_SESSION['RF']['language']) . '.php'))
|
||||
{
|
||||
if(array_key_exists($_SESSION['RF']['language'],$languages)){
|
||||
include 'lang/' . basename($_SESSION['RF']['language']) . '.php';
|
||||
}else{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
$ftp = ftp_con($config);
|
||||
|
||||
if(isset($_GET['action']))
|
||||
{
|
||||
switch($_GET['action'])
|
||||
{
|
||||
case 'new_file_form':
|
||||
echo trans('Filename') . ': <input type="text" id="create_text_file_name" style="height:30px"> <select id="create_text_file_extension" style="margin:0;width:100px;">';
|
||||
foreach($config['editable_text_file_exts'] as $ext){
|
||||
echo '<option value=".'.$ext.'">.'.$ext.'</option>';
|
||||
}
|
||||
echo '</select><br><hr><textarea id="textfile_create_area" style="width:100%;height:150px;"></textarea>';
|
||||
break;
|
||||
case 'view':
|
||||
if(isset($_GET['type']))
|
||||
{
|
||||
$_SESSION['RF']["view_type"] = $_GET['type'];
|
||||
}
|
||||
else
|
||||
{
|
||||
response(trans('view type number missing').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
case 'filter':
|
||||
if (isset($_GET['type']))
|
||||
{
|
||||
if (isset($remember_text_filter) && $remember_text_filter)
|
||||
{
|
||||
$_SESSION['RF']["filter"] = $_GET['type'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
response(trans('view type number missing').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
case 'sort':
|
||||
if (isset($_GET['sort_by']))
|
||||
{
|
||||
$_SESSION['RF']["sort_by"] = $_GET['sort_by'];
|
||||
}
|
||||
|
||||
if (isset($_GET['descending']))
|
||||
{
|
||||
$_SESSION['RF']["descending"] = $_GET['descending'];
|
||||
}
|
||||
break;
|
||||
case 'image_size': // not used
|
||||
$pos = strpos($_POST['path'], $upload_dir);
|
||||
if ($pos !== false)
|
||||
{
|
||||
$info = getimagesize(substr_replace($_POST['path'], $current_path, $pos, strlen($upload_dir)));
|
||||
response($info)->send();
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
case 'save_img':
|
||||
$info = pathinfo($_POST['name']);
|
||||
|
||||
if (
|
||||
strpos($_POST['path'], '/') === 0
|
||||
|| strpos($_POST['path'], '../') !== false
|
||||
|| strpos($_POST['path'], '..\\') !== false
|
||||
|| strpos($_POST['path'], './') === 0
|
||||
|| (strpos($_POST['url'], 'http://s3.amazonaws.com/feather') !== 0 && strpos($_POST['url'], 'https://s3.amazonaws.com/feather') !== 0)
|
||||
|| $_POST['name'] != fix_filename($_POST['name'], $config)
|
||||
|| ! in_array(strtolower($info['extension']), array( 'jpg', 'jpeg', 'png' ))
|
||||
)
|
||||
{
|
||||
response(trans('wrong data').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
$image_data = get_file_by_url($_POST['url']);
|
||||
if ($image_data === false)
|
||||
{
|
||||
response(trans('Aviary_No_Save').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!checkresultingsize(strlen($image_data))) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if($ftp){
|
||||
|
||||
$temp = tempnam('/tmp','RF');
|
||||
unlink($temp);
|
||||
$temp .=".".substr(strrchr($_POST['url'],'.'),1);
|
||||
file_put_contents($temp,$image_data);
|
||||
|
||||
$ftp->put($ftp_base_folder.$upload_dir . $_POST['path'] . $_POST['name'], $temp, FTP_BINARY);
|
||||
|
||||
create_img($temp,$temp,122,91);
|
||||
$ftp->put($ftp_base_folder.$ftp_thumbs_dir. $_POST['path'] . $_POST['name'], $temp, FTP_BINARY);
|
||||
|
||||
unlink($temp);
|
||||
}else{
|
||||
|
||||
file_put_contents($current_path . $_POST['path'] . $_POST['name'],$image_data);
|
||||
create_img($current_path . $_POST['path'] . $_POST['name'], $thumbs_base_path.$_POST['path'].$_POST['name'], 122, 91);
|
||||
// TODO something with this function cause its blowing my mind
|
||||
new_thumbnails_creation(
|
||||
$current_path.$_POST['path'],
|
||||
$current_path.$_POST['path'].$_POST['name'],
|
||||
$_POST['name'],
|
||||
$current_path,
|
||||
$relative_image_creation,
|
||||
$relative_path_from_current_pos,
|
||||
$relative_image_creation_name_to_prepend,
|
||||
$relative_image_creation_name_to_append,
|
||||
$relative_image_creation_width,
|
||||
$relative_image_creation_height,
|
||||
$relative_image_creation_option,
|
||||
$fixed_image_creation,
|
||||
$fixed_path_from_filemanager,
|
||||
$fixed_image_creation_name_to_prepend,
|
||||
$fixed_image_creation_to_append,
|
||||
$fixed_image_creation_width,
|
||||
$fixed_image_creation_height,
|
||||
$fixed_image_creation_option
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'extract':
|
||||
if ( strpos($_POST['path'], '/') === 0
|
||||
|| strpos($_POST['path'], '../') !== false
|
||||
|| strpos($_POST['path'], '..\\') !== false
|
||||
|| strpos($_POST['path'], './') === 0)
|
||||
{
|
||||
response(trans('wrong path'.AddErrorLocation()))->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if($ftp){
|
||||
$path = $ftp_base_url.$upload_dir . $_POST['path'];
|
||||
$base_folder = $ftp_base_url.$upload_dir . fix_dirname($_POST['path']) . "/";
|
||||
}else{
|
||||
$path = $current_path . $_POST['path'];
|
||||
$base_folder = $current_path . fix_dirname($_POST['path']) . "/";
|
||||
}
|
||||
|
||||
$info = pathinfo($path);
|
||||
|
||||
if($ftp){
|
||||
$tempDir = tempdir();
|
||||
$temp = tempnam($tempDir,'RF');
|
||||
unlink($temp);
|
||||
$temp .=".".$info['extension'];
|
||||
$handle = fopen($temp, "w");
|
||||
fwrite($handle, file_get_contents($path));
|
||||
fclose($handle);
|
||||
$path = $temp;
|
||||
$base_folder = $tempDir."/";
|
||||
}
|
||||
|
||||
$info = pathinfo($path);
|
||||
|
||||
switch ($info['extension'])
|
||||
{
|
||||
case "zip":
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open($path) === true)
|
||||
{
|
||||
//get total size
|
||||
$sizeTotalFinal = 0;
|
||||
for ($i = 0; $i < $zip->numFiles; $i++)
|
||||
{
|
||||
$aStat = $zip->statIndex($i);
|
||||
$sizeTotalFinal += $aStat['size'];
|
||||
}
|
||||
if (!checkresultingsize($sizeTotalFinal)) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
//make all the folders
|
||||
for ($i = 0; $i < $zip->numFiles; $i++)
|
||||
{
|
||||
$OnlyFileName = $zip->getNameIndex($i);
|
||||
$FullFileName = $zip->statIndex($i);
|
||||
if (substr($FullFileName['name'], -1, 1) == "/")
|
||||
{
|
||||
create_folder($base_folder . $FullFileName['name']);
|
||||
}
|
||||
}
|
||||
//unzip into the folders
|
||||
for ($i = 0; $i < $zip->numFiles; $i++)
|
||||
{
|
||||
$OnlyFileName = $zip->getNameIndex($i);
|
||||
$FullFileName = $zip->statIndex($i);
|
||||
|
||||
if ( ! (substr($FullFileName['name'], -1, 1) == "/"))
|
||||
{
|
||||
$fileinfo = pathinfo($OnlyFileName);
|
||||
if (in_array(strtolower($fileinfo['extension']), $ext))
|
||||
{
|
||||
copy('zip://' . $path . '#' . $OnlyFileName, $base_folder . $FullFileName['name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$zip->close();
|
||||
} else {
|
||||
response(trans('Zip_No_Extract').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "gz":
|
||||
// No resulting size pre-control available
|
||||
$p = new PharData($path);
|
||||
$p->decompress(); // creates files.tar
|
||||
|
||||
break;
|
||||
|
||||
case "tar":
|
||||
// No resulting size pre-control available
|
||||
// unarchive from the tar
|
||||
$phar = new PharData($path);
|
||||
$phar->decompressFiles();
|
||||
$files = array();
|
||||
check_files_extensions_on_phar($phar, $files, '', $ext);
|
||||
$phar->extractTo($base_folder, $files, true);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
response(trans('Zip_Invalid').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if($ftp){
|
||||
unlink($path);
|
||||
$ftp->putAll($base_folder, "/".$ftp_base_folder . $upload_dir . fix_dirname($_POST['path']), FTP_BINARY);
|
||||
deleteDir($base_folder);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'media_preview':
|
||||
if($ftp){
|
||||
$preview_file = $ftp_base_url.$upload_dir . $_GET['file'];
|
||||
}else{
|
||||
$preview_file = $current_path . $_GET["file"];
|
||||
}
|
||||
$info = pathinfo($preview_file);
|
||||
ob_start();
|
||||
?>
|
||||
<div id="jp_container_1" class="jp-video " style="margin:0 auto;">
|
||||
<div class="jp-type-single">
|
||||
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
|
||||
<div class="jp-gui">
|
||||
<div class="jp-video-play">
|
||||
<a href="javascript:;" class="jp-video-play-icon" tabindex="1">play</a>
|
||||
</div>
|
||||
<div class="jp-interface">
|
||||
<div class="jp-progress">
|
||||
<div class="jp-seek-bar">
|
||||
<div class="jp-play-bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-current-time"></div>
|
||||
<div class="jp-duration"></div>
|
||||
<div class="jp-controls-holder">
|
||||
<ul class="jp-controls">
|
||||
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
|
||||
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
|
||||
<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
|
||||
<li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
|
||||
<li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
|
||||
<li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
|
||||
</ul>
|
||||
<div class="jp-volume-bar">
|
||||
<div class="jp-volume-bar-value"></div>
|
||||
</div>
|
||||
<ul class="jp-toggles">
|
||||
<li><a href="javascript:;" class="jp-full-screen" tabindex="1" title="full screen">full screen</a></li>
|
||||
<li><a href="javascript:;" class="jp-restore-screen" tabindex="1" title="restore screen">restore screen</a></li>
|
||||
<li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>
|
||||
<li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="jp-title" style="display:none;">
|
||||
<ul>
|
||||
<li></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-no-solution">
|
||||
<span>Update Required</span>
|
||||
To play the media you will need to either update your browser to a recent version or update your <a href="https://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(in_array(strtolower($info['extension']), $ext_music)): ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
$("#jquery_jplayer_1").jPlayer({
|
||||
ready: function () {
|
||||
$(this).jPlayer("setMedia", {
|
||||
title:"<?php $_GET['title']; ?>",
|
||||
mp3: "<?php echo $preview_file; ?>",
|
||||
m4a: "<?php echo $preview_file; ?>",
|
||||
oga: "<?php echo $preview_file; ?>",
|
||||
wav: "<?php echo $preview_file; ?>"
|
||||
});
|
||||
},
|
||||
swfPath: "js",
|
||||
solution:"html,flash",
|
||||
supplied: "mp3, m4a, midi, mid, oga,webma, ogg, wav",
|
||||
smoothPlayBar: true,
|
||||
keyEnabled: false
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php elseif(in_array(strtolower($info['extension']), $ext_video)): ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
$("#jquery_jplayer_1").jPlayer({
|
||||
ready: function () {
|
||||
$(this).jPlayer("setMedia", {
|
||||
title:"<?php $_GET['title']; ?>",
|
||||
m4v: "<?php echo $preview_file; ?>",
|
||||
ogv: "<?php echo $preview_file; ?>",
|
||||
flv: "<?php echo $preview_file; ?>"
|
||||
});
|
||||
},
|
||||
swfPath: "js",
|
||||
solution:"html,flash",
|
||||
supplied: "mp4, m4v, ogv, flv, webmv, webm",
|
||||
smoothPlayBar: true,
|
||||
keyEnabled: false
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php endif;
|
||||
|
||||
$content = ob_get_clean();
|
||||
|
||||
response($content)->send();
|
||||
exit;
|
||||
|
||||
break;
|
||||
case 'copy_cut':
|
||||
if ($_POST['sub_action'] != 'copy' && $_POST['sub_action'] != 'cut')
|
||||
{
|
||||
response(trans('wrong sub-action').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (strpos($_POST['path'],'../') !== FALSE
|
||||
|| strpos($_POST['path'],'./') !== FALSE
|
||||
|| strpos($_POST['path'],'..\\') !== FALSE
|
||||
|| strpos($_POST['path'],'.\\') !== FALSE )
|
||||
{
|
||||
response(trans('wrong path'.AddErrorLocation()))->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (trim($_POST['path']) == '')
|
||||
{
|
||||
response(trans('no path').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$msg_sub_action = ($_POST['sub_action'] == 'copy' ? trans('Copy') : trans('Cut'));
|
||||
$path = $current_path . $_POST['path'];
|
||||
|
||||
if (is_dir($path))
|
||||
{
|
||||
// can't copy/cut dirs
|
||||
if ($copy_cut_dirs === false)
|
||||
{
|
||||
response(sprintf(trans('Copy_Cut_Not_Allowed'), $msg_sub_action, trans('Folders')).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
list($sizeFolderToCopy,$fileNum,$foldersCount) = folder_info($path,false);
|
||||
// size over limit
|
||||
if ($copy_cut_max_size !== false && is_int($copy_cut_max_size)) {
|
||||
if (($copy_cut_max_size * 1024 * 1024) < $sizeFolderToCopy) {
|
||||
response(sprintf(trans('Copy_Cut_Size_Limit'), $msg_sub_action, $copy_cut_max_size).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// file count over limit
|
||||
if ($copy_cut_max_count !== false && is_int($copy_cut_max_count))
|
||||
{
|
||||
if ($copy_cut_max_count < $fileNum)
|
||||
{
|
||||
response(sprintf(trans('Copy_Cut_Count_Limit'), $msg_sub_action, $copy_cut_max_count).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!checkresultingsize($sizeFolderToCopy)) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
// can't copy/cut files
|
||||
if ($copy_cut_files === false)
|
||||
{
|
||||
response(sprintf(trans('Copy_Cut_Not_Allowed'), $msg_sub_action, trans('Files')).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['RF']['clipboard']['path'] = $_POST['path'];
|
||||
$_SESSION['RF']['clipboard_action'] = $_POST['sub_action'];
|
||||
break;
|
||||
case 'clear_clipboard':
|
||||
$_SESSION['RF']['clipboard'] = null;
|
||||
$_SESSION['RF']['clipboard_action'] = null;
|
||||
break;
|
||||
case 'chmod':
|
||||
if($ftp){
|
||||
$path = $ftp_base_url . $upload_dir . $_POST['path'];
|
||||
if (
|
||||
($_POST['folder']==1 && $chmod_dirs === false)
|
||||
|| ($_POST['folder']==0 && $chmod_files === false)
|
||||
|| (is_function_callable("chmod") === false) )
|
||||
{
|
||||
response(sprintf(trans('File_Permission_Not_Allowed'), (is_dir($path) ? trans('Folders') : trans('Files')), 403).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
$info = $_POST['permissions'];
|
||||
}else{
|
||||
$path = $current_path . $_POST['path'];
|
||||
if (
|
||||
(is_dir($path) && $chmod_dirs === false)
|
||||
|| (is_file($path) && $chmod_files === false)
|
||||
|| (is_function_callable("chmod") === false) )
|
||||
{
|
||||
response(sprintf(trans('File_Permission_Not_Allowed'), (is_dir($path) ? trans('Folders') : trans('Files')), 403).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$perms = fileperms($path) & 0777;
|
||||
|
||||
$info = '-';
|
||||
|
||||
// Owner
|
||||
$info .= (($perms & 0x0100) ? 'r' : '-');
|
||||
$info .= (($perms & 0x0080) ? 'w' : '-');
|
||||
$info .= (($perms & 0x0040) ?
|
||||
(($perms & 0x0800) ? 's' : 'x' ) :
|
||||
(($perms & 0x0800) ? 'S' : '-'));
|
||||
|
||||
// Group
|
||||
$info .= (($perms & 0x0020) ? 'r' : '-');
|
||||
$info .= (($perms & 0x0010) ? 'w' : '-');
|
||||
$info .= (($perms & 0x0008) ?
|
||||
(($perms & 0x0400) ? 's' : 'x' ) :
|
||||
(($perms & 0x0400) ? 'S' : '-'));
|
||||
|
||||
// World
|
||||
$info .= (($perms & 0x0004) ? 'r' : '-');
|
||||
$info .= (($perms & 0x0002) ? 'w' : '-');
|
||||
$info .= (($perms & 0x0001) ?
|
||||
(($perms & 0x0200) ? 't' : 'x' ) :
|
||||
(($perms & 0x0200) ? 'T' : '-'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
$ret = '<div id="files_permission_start">
|
||||
<form id="chmod_form">
|
||||
<table class="table file-perms-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>r </td>
|
||||
<td>w </td>
|
||||
<td>x </td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>'.trans('User').'</td>
|
||||
<td><input id="u_4" type="checkbox" data-value="4" data-group="user" '.(substr($info, 1,1)=='r' ? " checked" : "").'></td>
|
||||
<td><input id="u_2" type="checkbox" data-value="2" data-group="user" '.(substr($info, 2,1)=='w' ? " checked" : "").'></td>
|
||||
<td><input id="u_1" type="checkbox" data-value="1" data-group="user" '.(substr($info, 3,1)=='x' ? " checked" : "").'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>'.trans('Group').'</td>
|
||||
<td><input id="g_4" type="checkbox" data-value="4" data-group="group" '.(substr($info, 4,1)=='r' ? " checked" : "").'></td>
|
||||
<td><input id="g_2" type="checkbox" data-value="2" data-group="group" '.(substr($info, 5,1)=='w' ? " checked" : "").'></td>
|
||||
<td><input id="g_1" type="checkbox" data-value="1" data-group="group" '.(substr($info, 6,1)=='x' ? " checked" : "").'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>'.trans('All').'</td>
|
||||
<td><input id="a_4" type="checkbox" data-value="4" data-group="all" '.(substr($info, 7,1)=='r' ? " checked" : "").'></td>
|
||||
<td><input id="a_2" type="checkbox" data-value="2" data-group="all" '.(substr($info, 8,1)=='w' ? " checked" : "").'></td>
|
||||
<td><input id="a_1" type="checkbox" data-value="1" data-group="all" '.(substr($info, 9,1)=='x' ? " checked" : "").'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="3"><input type="text" class="input-block-level" name="chmod_value" id="chmod_value" value="" data-def-value=""></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>';
|
||||
|
||||
if ((!$ftp && is_dir($path)) )
|
||||
{
|
||||
$ret .= '<div class="hero-unit" style="padding:10px;">'.trans('File_Permission_Recursive').'<br/><br/>
|
||||
<ul class="unstyled">
|
||||
<li><label class="radio"><input value="none" name="apply_recursive" type="radio" checked> '.trans('No').'</label></li>
|
||||
<li><label class="radio"><input value="files" name="apply_recursive" type="radio"> '.trans('Files').'</label></li>
|
||||
<li><label class="radio"><input value="folders" name="apply_recursive" type="radio"> '.trans('Folders').'</label></li>
|
||||
<li><label class="radio"><input value="both" name="apply_recursive" type="radio"> '.trans('Files').' & '.trans('Folders').'</label></li>
|
||||
</ul>
|
||||
</div>';
|
||||
}
|
||||
|
||||
$ret .= '</form></div>';
|
||||
|
||||
response($ret)->send();
|
||||
exit;
|
||||
|
||||
break;
|
||||
case 'get_lang':
|
||||
if ( ! file_exists('lang/languages.php'))
|
||||
{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$languages = include 'lang/languages.php';
|
||||
if ( ! isset($languages) || ! is_array($languages))
|
||||
{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$curr = $_SESSION['RF']['language'];
|
||||
|
||||
$ret = '<select id="new_lang_select">';
|
||||
foreach ($languages as $code => $name)
|
||||
{
|
||||
$ret .= '<option value="' . $code . '"' . ($code == $curr ? ' selected' : '') . '>' . $name . '</option>';
|
||||
}
|
||||
$ret .= '</select>';
|
||||
|
||||
response($ret)->send();
|
||||
exit;
|
||||
|
||||
break;
|
||||
case 'change_lang':
|
||||
$choosen_lang = (!empty($_POST['choosen_lang']))? $_POST['choosen_lang']:"en_EN";
|
||||
|
||||
if(array_key_exists($choosen_lang,$languages)){
|
||||
if ( ! file_exists('lang/' . $choosen_lang . '.php'))
|
||||
{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}else{
|
||||
$_SESSION['RF']['language'] = $choosen_lang;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'cad_preview':
|
||||
if($ftp){
|
||||
$selected_file = $ftp_base_url.$upload_dir . $_GET['file'];
|
||||
}else{
|
||||
$selected_file = $current_path . $_GET['file'];
|
||||
|
||||
if ( ! file_exists($selected_file))
|
||||
{
|
||||
response(trans('File_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($ftp){
|
||||
$url_file = $selected_file;
|
||||
}else{
|
||||
$url_file = $base_url . $upload_dir . str_replace($current_path, '', $_GET["file"]);
|
||||
}
|
||||
|
||||
$cad_url = urlencode($url_file);
|
||||
$cad_html = "<iframe src=\"//sharecad.org/cadframe/load?url=" . $url_file . "\" class=\"google-iframe\" scrolling=\"no\"></iframe>";
|
||||
$ret = $cad_html;
|
||||
response($ret)->send();
|
||||
break;
|
||||
case 'get_file': // preview or edit
|
||||
$sub_action = $_GET['sub_action'];
|
||||
$preview_mode = $_GET["preview_mode"];
|
||||
|
||||
if ($sub_action != 'preview' && $sub_action != 'edit')
|
||||
{
|
||||
response(trans('wrong action').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if($ftp){
|
||||
$selected_file = ($sub_action == 'preview' ? $ftp_base_url.$upload_dir . $_GET['file'] : $ftp_base_url.$upload_dir . $_POST['path']);
|
||||
}else{
|
||||
$selected_file = ($sub_action == 'preview' ? $current_path . $_GET['file'] : $current_path . $_POST['path']);
|
||||
|
||||
if ( ! file_exists($selected_file))
|
||||
{
|
||||
response(trans('File_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$info = pathinfo($selected_file);
|
||||
|
||||
if ($preview_mode == 'text')
|
||||
{
|
||||
$is_allowed = ($sub_action == 'preview' ? $preview_text_files : $edit_text_files);
|
||||
$allowed_file_exts = ($sub_action == 'preview' ? $previewable_text_file_exts : $editable_text_file_exts);
|
||||
} elseif ($preview_mode == 'viewerjs') {
|
||||
$is_allowed = $viewerjs_enabled;
|
||||
$allowed_file_exts = $viewerjs_file_exts;
|
||||
} elseif ($preview_mode == 'google') {
|
||||
$is_allowed = $googledoc_enabled;
|
||||
$allowed_file_exts = $googledoc_file_exts;
|
||||
}
|
||||
|
||||
if ( ! isset($allowed_file_exts) || ! is_array($allowed_file_exts))
|
||||
{
|
||||
$allowed_file_exts = array();
|
||||
}
|
||||
|
||||
if ( ! in_array($info['extension'], $allowed_file_exts)
|
||||
|| ! isset($is_allowed)
|
||||
|| $is_allowed === false
|
||||
|| (!$ftp && ! is_readable($selected_file))
|
||||
)
|
||||
{
|
||||
response(sprintf(trans('File_Open_Edit_Not_Allowed'), ($sub_action == 'preview' ? strtolower(trans('Open')) : strtolower(trans('Edit')))).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if ($sub_action == 'preview')
|
||||
{
|
||||
if ($preview_mode == 'text')
|
||||
{
|
||||
// get and sanities
|
||||
$data = file_get_contents($selected_file);
|
||||
$data = htmlspecialchars(htmlspecialchars_decode($data));
|
||||
$ret = '';
|
||||
|
||||
if ( ! in_array($info['extension'],$previewable_text_file_exts_no_prettify))
|
||||
{
|
||||
$ret .= '<script src="https://rawgit.com/google/code-prettify/master/loader/run_prettify.js?autoload=true&skin=sunburst"></script>';
|
||||
$ret .= '<?prettify lang='.$info['extension'].' linenums=true?><pre class="prettyprint"><code class="language-'.$info['extension'].'">'.$data.'</code></pre>';
|
||||
} else {
|
||||
$ret .= '<pre class="no-prettify">'.$data.'</pre>';
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($preview_mode == 'google' || $preview_mode == 'viewerjs') {
|
||||
if($ftp){
|
||||
$url_file = $selected_file;
|
||||
}else{
|
||||
$url_file = $base_url . $upload_dir . str_replace($current_path, '', $_GET["file"]);
|
||||
}
|
||||
|
||||
$googledoc_url = urlencode($url_file);
|
||||
$googledoc_html = "<iframe src=\"https://docs.google.com/viewer?url=" . $url_file . "&embedded=true\" class=\"google-iframe\"></iframe>";
|
||||
$ret = $googledoc_html;
|
||||
}
|
||||
} else {
|
||||
$data = stripslashes(htmlspecialchars(file_get_contents($selected_file)));
|
||||
$ret = '<textarea id="textfile_edit_area" style="width:100%;height:300px;">'.$data.'</textarea>';
|
||||
}
|
||||
|
||||
response($ret)->send();
|
||||
exit;
|
||||
|
||||
break;
|
||||
default:
|
||||
response(trans('no action passed').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
response(trans('no action passed').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
1
local/modules/Tinymce/Resources/js/tinymce/filemanager/config/.htaccess
Executable file
@@ -0,0 +1 @@
|
||||
Deny from all
|
||||
602
local/modules/Tinymce/Resources/js/tinymce/filemanager/config/config.php
Executable file
@@ -0,0 +1,602 @@
|
||||
<?php
|
||||
//if (session_id() == '') session_start();
|
||||
|
||||
mb_internal_encoding('UTF-8');
|
||||
mb_http_output('UTF-8');
|
||||
mb_http_input('UTF-8');
|
||||
mb_language('uni');
|
||||
mb_regex_encoding('UTF-8');
|
||||
ob_start('mb_output_handler');
|
||||
//date_default_timezone_set('Europe/Rome');
|
||||
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\Thelia;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
function generateFolder($env)
|
||||
{
|
||||
$webMediaPath = THELIA_WEB_DIR.'media';
|
||||
$webMediaEnvPath = null;
|
||||
if ($env !== "prod") {
|
||||
//Remove separtion between dev and prod in particular environment
|
||||
$env = str_replace('_dev', '', $env);
|
||||
$webMediaEnvPath = $webMediaPath.DS.$env;
|
||||
}
|
||||
|
||||
$fileSystem = new Filesystem();
|
||||
|
||||
// Create the media directory in the web root , if required
|
||||
if (null !== $webMediaEnvPath) {
|
||||
if (false === $fileSystem->exists($webMediaEnvPath)) {
|
||||
$fileSystem->mkdir($webMediaEnvPath.DS.'upload');
|
||||
$fileSystem->mkdir($webMediaEnvPath.DS.'thumbs');
|
||||
}
|
||||
} else {
|
||||
if (false === $fileSystem->exists($webMediaPath)) {
|
||||
$fileSystem->mkdir($webMediaPath.DS.'upload');
|
||||
$fileSystem->mkdir($webMediaPath.DS.'thumbs');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$env = getenv('THELIA_ENV') ?: 'prod';
|
||||
|
||||
if (file_exists(__DIR__.'/../../../../../../../../core/vendor/autoload.php')) {
|
||||
// Symlinked with std install
|
||||
require_once __DIR__.'/../../../../../../../../core/vendor/autoload.php';
|
||||
} elseif (file_exists(__DIR__.'/../../../../core/vendor/autoload.php')) {
|
||||
// Hard copy with std install
|
||||
require_once __DIR__.'/../../../../core/vendor/autoload.php';
|
||||
} elseif (file_exists(__DIR__.'/../../../../../../../../bootstrap.php')) {
|
||||
// Symlinked with thelia-project
|
||||
require_once __DIR__.'/../../../../../../../../bootstrap.php';
|
||||
} elseif (file_exists(__DIR__.'/../../../../bootstrap.php')) {
|
||||
// Hard copy with thelia-project
|
||||
require_once __DIR__.'/../../../../bootstrap.php';
|
||||
}
|
||||
|
||||
/** @var Request $request */
|
||||
$request = Request::createFromGlobals();
|
||||
|
||||
$thelia = new Thelia($env, false);
|
||||
|
||||
$thelia->boot();
|
||||
|
||||
/** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */
|
||||
$container = $thelia->getContainer();
|
||||
|
||||
$eventDispatcher = $container->get('event_dispatcher');
|
||||
$container->get('thelia.translator');
|
||||
$container->get('thelia.url.manager');
|
||||
$container->set('request', $request);
|
||||
$container->get('request_stack')->push($request);
|
||||
$event = new \Thelia\Core\Event\SessionEvent(THELIA_CACHE_DIR.$env, false, $env);
|
||||
|
||||
$eventDispatcher->dispatch(\Thelia\Core\TheliaKernelEvents::SESSION, $event);
|
||||
$session = $event->getSession();
|
||||
$session->start();
|
||||
$request->setSession($session);
|
||||
|
||||
/** @var \Thelia\Core\Security\SecurityContext $securityContext */
|
||||
$securityContext = $container->get('thelia.securityContext');
|
||||
|
||||
// We just check the current user has the ADMIN role.
|
||||
$isGranted = $securityContext->isGranted(['ADMIN'], [], [], []);
|
||||
|
||||
if (false === $isGranted) {
|
||||
echo "Sorry, it seems that you're not allowed to use this function. ADMIN role is required.";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// DO NOT COPY THESE VARIABLES IN FOLDERS config.php FILES
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//**********************
|
||||
//Path configuration
|
||||
//**********************
|
||||
|
||||
// In this configuration the media folder is located in the /web directory.
|
||||
|
||||
// base url of site (without final /). if you prefer relative urls leave empty.
|
||||
$base_url = rtrim(ConfigQuery::getConfiguredShopUrl(), '/');
|
||||
|
||||
// Argh, url_site is not defined ?!
|
||||
if (empty($base_url)) {
|
||||
// A we did not used the router to access this dialog, we cannot use the URL class. Use the good old method.
|
||||
$base_url = $request->getSchemeAndHttpHost().preg_replace('!/tinymce/filemanager/dialog.php.*$!', '', $_SERVER['REQUEST_URI']);
|
||||
}
|
||||
|
||||
//Check for backward compatibility
|
||||
if ($env !== "prod") {
|
||||
// path from base_url to base of upload folder for current env (with start and final /)
|
||||
$upload_dir = '/media/'.$env.'/upload/';
|
||||
|
||||
// path from base_url to base of upload folder for current env (with start and final /)
|
||||
$thumbs_dir = '/media/'.$env.'/thumbs/';
|
||||
|
||||
// path to file manager folder to upload folder for current env (with final /)
|
||||
$current_path = THELIA_WEB_DIR.'media'.DS.$env.DS.'upload'.DS;
|
||||
|
||||
// path to file manager folder to thumbs folder for current env (with final /)
|
||||
// WARNING: thumbs folder should not be inside the upload folder
|
||||
$thumbs_base_path = THELIA_WEB_DIR.'media'.DS.$env.DS.'thumbs'.DS;
|
||||
} else {
|
||||
// path from base_url to base of upload folder (with start and final /)
|
||||
$upload_dir = '/media/upload/';
|
||||
|
||||
// path from base_url to base of upload folder (with start and final /)
|
||||
$thumbs_dir = '/media/thumbs/';
|
||||
|
||||
// path to file manager folder to upload folder (with final /)
|
||||
$current_path = THELIA_WEB_DIR.'media'.DS.'upload'.DS;
|
||||
|
||||
// path to file manager folder to thumbs folder (with final /)
|
||||
// WARNING: thumbs folder should not be inside the upload folder
|
||||
$thumbs_base_path = THELIA_WEB_DIR.'media'.DS.'thumbs'.DS;
|
||||
}
|
||||
|
||||
generateFolder($env);
|
||||
|
||||
// path from base_url to filemanager folder (with start and final /)
|
||||
$filemanager_dir = '/tinymce/filemanager/';
|
||||
|
||||
// Set the language to the back-office current language, if it is available
|
||||
$current_locale = $request->getSession()->getLang()->getLocale();
|
||||
|
||||
if (file_exists(__DIR__.DS.'..'.DS.'lang.'.DS.$current_locale.'.php')) {
|
||||
$default_language = $current_locale;
|
||||
} else {
|
||||
$default_language = 'en_EN';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Optional security
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| if set to true only those will access RF whose url contains the access key(akey) like:
|
||||
| <input type="button" href="../filemanager/dialog.php?field_id=imgField&lang=en_EN&akey=myPrivateKey" value="Files">
|
||||
| in tinymce a new parameter added: filemanager_access_key:"myPrivateKey"
|
||||
| example tinymce config:
|
||||
|
|
||||
| tiny init ...
|
||||
| external_filemanager_path:"../filemanager/",
|
||||
| filemanager_title:"Filemanager" ,
|
||||
| filemanager_access_key:"myPrivateKey" ,
|
||||
| ...
|
||||
|
|
||||
*/
|
||||
|
||||
define('USE_ACCESS_KEYS', false); // TRUE or FALSE
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DON'T COPY THIS VARIABLES IN FOLDERS config.php FILES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
define('DEBUG_ERROR_MESSAGE', false); // TRUE or FALSE
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Path configuration
|
||||
|--------------------------------------------------------------------------
|
||||
| In this configuration the folder tree is
|
||||
| root
|
||||
| |- source <- upload folder
|
||||
| |- thumbs <- thumbnail folder [must have write permission (755)]
|
||||
| |- filemanager
|
||||
| |- js
|
||||
| | |- tinymce
|
||||
| | | |- plugins
|
||||
| | | | |- responsivefilemanager
|
||||
| | | | | |- plugin.min.js
|
||||
*/
|
||||
|
||||
$config = array(
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DON'T TOUCH (base url (only domain) of site).
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| without final / (DON'T TOUCH)
|
||||
|
|
||||
*/
|
||||
'base_url' => $base_url,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| path from base_url to base of upload folder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| with start and final /
|
||||
|
|
||||
*/
|
||||
'upload_dir' => $upload_dir,
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| relative path from filemanager folder to upload folder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| with final /
|
||||
|
|
||||
*/
|
||||
'current_path' => $current_path,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| relative path from filemanager folder to thumbs folder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| with final /
|
||||
| DO NOT put inside upload folder
|
||||
|
|
||||
*/
|
||||
'thumbs_base_path' => $thumbs_base_path,
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FTP configuration BETA VERSION
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you want enable ftp use write these parametres otherwise leave empty
|
||||
| Remember to set base_url properly to point in the ftp server domain and
|
||||
| upload dir will be ftp_base_folder + upload_dir so without final /
|
||||
|
|
||||
*/
|
||||
'ftp_host' => false,
|
||||
'ftp_user' => "user",
|
||||
'ftp_pass' => "pass",
|
||||
'ftp_base_folder' => "base_folder",
|
||||
'ftp_base_url' => "http://site to ftp root",
|
||||
/* --------------------------------------------------------------------------
|
||||
| path from ftp_base_folder to base of thumbs folder with start and final |
|
||||
|--------------------------------------------------------------------------*/
|
||||
'ftp_thumbs_dir' => '/thumbs/',
|
||||
'ftp_ssl' => false,
|
||||
'ftp_port' => 21,
|
||||
|
||||
|
||||
// 'ftp_host' => "s108707.gridserver.com",
|
||||
// 'ftp_user' => "test@responsivefilemanager.com",
|
||||
// 'ftp_pass' => "Test.1234",
|
||||
// 'ftp_base_folder' => "/domains/responsivefilemanager.com/html",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Access keys
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| add access keys eg: array('myPrivateKey', 'someoneElseKey');
|
||||
| keys should only containt (a-z A-Z 0-9 \ . _ -) characters
|
||||
| if you are integrating lets say to a cms for admins, i recommend making keys randomized something like this:
|
||||
| $username = 'Admin';
|
||||
| $salt = 'dsflFWR9u2xQa' (a hard coded string)
|
||||
| $akey = md5($username.$salt);
|
||||
| DO NOT use 'key' as access key!
|
||||
| Keys are CASE SENSITIVE!
|
||||
|
|
||||
*/
|
||||
|
||||
'access_keys' => array(),
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// YOU CAN COPY AND CHANGE THESE VARIABLES INTO FOLDERS config.php FILES TO CUSTOMIZE EACH FOLDER OPTIONS
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maximum size of all files in source folder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| in Megabytes
|
||||
|
|
||||
*/
|
||||
'MaxSizeTotal' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maximum upload size
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| in Megabytes
|
||||
|
|
||||
*/
|
||||
'MaxSizeUpload' => 100,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File and Folder permission
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
*/
|
||||
'fileFolderPermission' => 0755,
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| default language file name
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'default_language' => $default_language,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Icon theme
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Default available: ico and ico_dark
|
||||
| Can be set to custom icon inside filemanager/img
|
||||
|
|
||||
*/
|
||||
'icon_theme' => "ico",
|
||||
|
||||
|
||||
//Show or not total size in filemanager (is possible to greatly increase the calculations)
|
||||
'show_total_size' => false,
|
||||
//Show or not show folder size in list view feature in filemanager (is possible, if there is a large folder, to greatly increase the calculations)
|
||||
'show_folder_size' => false,
|
||||
//Show or not show sorting feature in filemanager
|
||||
'show_sorting_bar' => true,
|
||||
//Show or not show filters button in filemanager
|
||||
'show_filter_buttons' => true,
|
||||
//Show or not language selection feature in filemanager
|
||||
'show_language_selection' => true,
|
||||
//active or deactive the transliteration (mean convert all strange characters in A..Za..z0..9 characters)
|
||||
'transliteration' => false,
|
||||
//convert all spaces on files name and folders name with $replace_with variable
|
||||
'convert_spaces' => false,
|
||||
//convert all spaces on files name and folders name this value
|
||||
'replace_with' => "_",
|
||||
//convert to lowercase the files and folders name
|
||||
'lower_case' => false,
|
||||
|
||||
//Add ?484899493349 (time value) to returned images to prevent cache
|
||||
'add_time_to_img' => false,
|
||||
|
||||
// -1: There is no lazy loading at all, 0: Always lazy-load images, 0+: The minimum number of the files in a directory
|
||||
// when lazy loading should be turned on.
|
||||
'lazy_loading_file_number_threshold' => -1,
|
||||
|
||||
|
||||
//*******************************************
|
||||
//Images limit and resizing configuration
|
||||
//*******************************************
|
||||
|
||||
// set maximum pixel width and/or maximum pixel height for all images
|
||||
// If you set a maximum width or height, oversized images are converted to those limits. Images smaller than the limit(s) are unaffected
|
||||
// if you don't need a limit set both to 0
|
||||
'image_max_width' => 0,
|
||||
'image_max_height' => 0,
|
||||
'image_max_mode' => 'auto',
|
||||
/*
|
||||
# $option: 0 / exact = defined size;
|
||||
# 1 / portrait = keep aspect set height;
|
||||
# 2 / landscape = keep aspect set width;
|
||||
# 3 / auto = auto;
|
||||
# 4 / crop= resize and crop;
|
||||
*/
|
||||
|
||||
//Automatic resizing //
|
||||
// If you set $image_resizing to TRUE the script converts all uploaded images exactly to image_resizing_width x image_resizing_height dimension
|
||||
// If you set width or height to 0 the script automatically calculates the other dimension
|
||||
// Is possible that if you upload very big images the script not work to overcome this increase the php configuration of memory and time limit
|
||||
'image_resizing' => false,
|
||||
'image_resizing_width' => 0,
|
||||
'image_resizing_height' => 0,
|
||||
'image_resizing_mode' => 'auto', // same as $image_max_mode
|
||||
'image_resizing_override' => false,
|
||||
// If set to TRUE then you can specify bigger images than $image_max_width & height otherwise if image_resizing is
|
||||
// bigger than $image_max_width or height then it will be converted to those values
|
||||
|
||||
|
||||
//******************
|
||||
//
|
||||
// WATERMARK IMAGE
|
||||
//
|
||||
//Watermark url or false
|
||||
'image_watermark' => false,
|
||||
# Could be a pre-determined position such as:
|
||||
# tl = top left,
|
||||
# t = top (middle),
|
||||
# tr = top right,
|
||||
# l = left,
|
||||
# m = middle,
|
||||
# r = right,
|
||||
# bl = bottom left,
|
||||
# b = bottom (middle),
|
||||
# br = bottom right
|
||||
# Or, it could be a co-ordinate position such as: 50x100
|
||||
'image_watermark_position' => 'br',
|
||||
# padding: If using a pre-determined position you can
|
||||
# adjust the padding from the edges by passing an amount
|
||||
# in pixels. If using co-ordinates, this value is ignored.
|
||||
'image_watermark_padding' => 0,
|
||||
|
||||
//******************
|
||||
// Default layout setting
|
||||
//
|
||||
// 0 => boxes
|
||||
// 1 => detailed list (1 column)
|
||||
// 2 => columns list (multiple columns depending on the width of the page)
|
||||
// YOU CAN ALSO PASS THIS PARAMETERS USING SESSION VAR => $_SESSION['RF']["VIEW"]=
|
||||
//
|
||||
//******************
|
||||
'default_view' => 0,
|
||||
|
||||
//set if the filename is truncated when overflow first row
|
||||
'ellipsis_title_after_first_row' => true,
|
||||
|
||||
//*************************
|
||||
//Permissions configuration
|
||||
//******************
|
||||
'delete_files' => true,
|
||||
'create_folders' => true,
|
||||
'delete_folders' => true,
|
||||
'upload_files' => true,
|
||||
'rename_files' => true,
|
||||
'rename_folders' => true,
|
||||
'duplicate_files' => true,
|
||||
'copy_cut_files' => true, // for copy/cut files
|
||||
'copy_cut_dirs' => true, // for copy/cut directories
|
||||
'chmod_files' => true, // change file permissions
|
||||
'chmod_dirs' => true, // change folder permissions
|
||||
'preview_text_files' => true, // eg.: txt, log etc.
|
||||
'edit_text_files' => true, // eg.: txt, log etc.
|
||||
'create_text_files' => true, // only create files with exts. defined in $editable_text_file_exts
|
||||
|
||||
// you can preview these type of files if $preview_text_files is true
|
||||
'previewable_text_file_exts' => array( "bsh", "c","css", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html", "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh", "xhtml", "xml","xsl" ),
|
||||
'previewable_text_file_exts_no_prettify' => array( 'txt', 'log' ),
|
||||
|
||||
// you can edit these type of files if $edit_text_files is true (only text based files)
|
||||
// you can create these type of files if $create_text_files is true (only text based files)
|
||||
// if you want you can add html,css etc.
|
||||
// but for security reasons it's NOT RECOMMENDED!
|
||||
'editable_text_file_exts' => array( 'txt', 'log', 'xml', 'html', 'css', 'htm', 'js' ),
|
||||
|
||||
// Preview with Google Documents
|
||||
'googledoc_enabled' => true,
|
||||
'googledoc_file_exts' => array( 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx' ),
|
||||
|
||||
// Preview with Viewer.js
|
||||
'viewerjs_enabled' => true,
|
||||
'viewerjs_file_exts' => array( 'pdf', 'odt', 'odp', 'ods' ),
|
||||
|
||||
// defines size limit for paste in MB / operation
|
||||
// set 'FALSE' for no limit
|
||||
'copy_cut_max_size' => 100,
|
||||
// defines file count limit for paste / operation
|
||||
// set 'FALSE' for no limit
|
||||
'copy_cut_max_count' => 200,
|
||||
//IF any of these limits reached, operation won't start and generate warning
|
||||
|
||||
//**********************
|
||||
//Allowed extensions (lowercase insert)
|
||||
//**********************
|
||||
'ext_img' => array( 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'svg' ), //Images
|
||||
'ext_file' => array( 'doc', 'docx', 'rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv', 'html', 'xhtml', 'psd', 'sql', 'log', 'fla', 'xml', 'ade', 'adp', 'mdb', 'accdb', 'ppt', 'pptx', 'odt', 'ots', 'ott', 'odb', 'odg', 'otp', 'otg', 'odf', 'ods', 'odp', 'css', 'ai', 'kmz','dwg', 'dxf', 'hpgl', 'plt', 'spl', 'step', 'stp', 'iges', 'igs', 'sat', 'cgm'), //Files
|
||||
'ext_video' => array( 'mov', 'mpeg', 'm4v', 'mp4', 'avi', 'mpg', 'wma', "flv", "webm" ), //Video
|
||||
'ext_music' => array( 'mp3', 'mpga', 'm4a', 'ac3', 'aiff', 'mid', 'ogg', 'wav' ), //Audio
|
||||
'ext_misc' => array( 'zip', 'rar', 'gz', 'tar', 'iso', 'dmg' ), //Archives
|
||||
|
||||
/******************
|
||||
* AVIARY config
|
||||
*******************/
|
||||
'aviary_active' => true,
|
||||
'aviary_apiKey' => "2444282ef4344e3dacdedc7a78f8877d",
|
||||
'aviary_language' => "en",
|
||||
'aviary_theme' => "light",
|
||||
'aviary_tools' => "all",
|
||||
'aviary_maxSize' => "1400",
|
||||
// Add or modify the Aviary options below as needed - they will be json encoded when added to the configuration so arrays can be utilized as needed
|
||||
|
||||
//The filter and sorter are managed through both javascript and php scripts because if you have a lot of
|
||||
//file in a folder the javascript script can't sort all or filter all, so the filemanager switch to php script.
|
||||
//The plugin automatic swich javascript to php when the current folder exceeds the below limit of files number
|
||||
'file_number_limit_js' => 500,
|
||||
|
||||
//**********************
|
||||
// Hidden files and folders
|
||||
//**********************
|
||||
// set the names of any folders you want hidden (eg "hidden_folder1", "hidden_folder2" ) Remember all folders with these names will be hidden (you can set any exceptions in config.php files on folders)
|
||||
'hidden_folders' => array(),
|
||||
// set the names of any files you want hidden. Remember these names will be hidden in all folders (eg "this_document.pdf", "that_image.jpg" )
|
||||
'hidden_files' => array( 'config.php' ),
|
||||
|
||||
/*******************
|
||||
* URL upload
|
||||
*******************/
|
||||
'url_upload' => true,
|
||||
|
||||
/*******************
|
||||
* JAVA upload
|
||||
*******************/
|
||||
'java_upload' => true,
|
||||
'JAVAMaxSizeUpload' => 200, //Gb
|
||||
|
||||
|
||||
//************************************
|
||||
//Thumbnail for external use creation
|
||||
//************************************
|
||||
|
||||
|
||||
// New image resized creation with fixed path from filemanager folder after uploading (thumbnails in fixed mode)
|
||||
// If you want create images resized out of upload folder for use with external script you can choose this method,
|
||||
// You can create also more than one image at a time just simply add a value in the array
|
||||
// Remember than the image creation respect the folder hierarchy so if you are inside source/test/test1/ the new image will create at
|
||||
// path_from_filemanager/test/test1/
|
||||
// PS if there isn't write permission in your destination folder you must set it
|
||||
//
|
||||
'fixed_image_creation' => false, //activate or not the creation of one or more image resized with fixed path from filemanager folder
|
||||
'fixed_path_from_filemanager' => array( '../test/', '../test1/' ), //fixed path of the image folder from the current position on upload folder
|
||||
'fixed_image_creation_name_to_prepend' => array( '', 'test_' ), //name to prepend on filename
|
||||
'fixed_image_creation_to_append' => array( '_test', '' ), //name to appendon filename
|
||||
'fixed_image_creation_width' => array( 300, 400 ), //width of image (you can leave empty if you set height)
|
||||
'fixed_image_creation_height' => array( 200, '' ), //height of image (you can leave empty if you set width)
|
||||
/*
|
||||
# $option: 0 / exact = defined size;
|
||||
# 1 / portrait = keep aspect set height;
|
||||
# 2 / landscape = keep aspect set width;
|
||||
# 3 / auto = auto;
|
||||
# 4 / crop= resize and crop;
|
||||
*/
|
||||
'fixed_image_creation_option' => array( 'crop', 'auto' ), //set the type of the crop
|
||||
|
||||
|
||||
// New image resized creation with relative path inside to upload folder after uploading (thumbnails in relative mode)
|
||||
// With Responsive filemanager you can create automatically resized image inside the upload folder, also more than one at a time
|
||||
// just simply add a value in the array
|
||||
// The image creation path is always relative so if i'm inside source/test/test1 and I upload an image, the path start from here
|
||||
//
|
||||
'relative_image_creation' => false, //activate or not the creation of one or more image resized with relative path from upload folder
|
||||
'relative_path_from_current_pos' => array( './', './' ), //relative path of the image folder from the current position on upload folder
|
||||
'relative_image_creation_name_to_prepend' => array( '', '' ), //name to prepend on filename
|
||||
'relative_image_creation_name_to_append' => array( '_thumb', '_thumb1' ), //name to append on filename
|
||||
'relative_image_creation_width' => array( 300, 400 ), //width of image (you can leave empty if you set height)
|
||||
'relative_image_creation_height' => array( 200, '' ), //height of image (you can leave empty if you set width)
|
||||
/*
|
||||
# $option: 0 / exact = defined size;
|
||||
# 1 / portrait = keep aspect set height;
|
||||
# 2 / landscape = keep aspect set width;
|
||||
# 3 / auto = auto;
|
||||
# 4 / crop= resize and crop;
|
||||
*/
|
||||
'relative_image_creation_option' => array( 'crop', 'crop' ), //set the type of the crop
|
||||
|
||||
|
||||
// Remember text filter after close filemanager for future session
|
||||
'remember_text_filter' => false,
|
||||
|
||||
);
|
||||
|
||||
return array_merge(
|
||||
$config,
|
||||
array(
|
||||
'MaxSizeUpload' => ((int)(ini_get('post_max_size')) < $config['MaxSizeUpload'])
|
||||
? (int)(ini_get('post_max_size')) : $config['MaxSizeUpload'],
|
||||
'ext'=> array_merge(
|
||||
$config['ext_img'],
|
||||
$config['ext_file'],
|
||||
$config['ext_misc'],
|
||||
$config['ext_video'],
|
||||
$config['ext_music']
|
||||
),
|
||||
// For a list of options see: https://developers.aviary.com/docs/web/setup-guide#constructor-config
|
||||
'aviary_defaults_config' => array(
|
||||
'apiKey' => $config['aviary_apiKey'],
|
||||
'language' => $config['aviary_language'],
|
||||
'theme' => $config['aviary_theme'],
|
||||
'tools' => $config['aviary_tools'],
|
||||
'maxSize' => $config['aviary_maxSize']
|
||||
),
|
||||
)
|
||||
);
|
||||
?>
|
||||
1161
local/modules/Tinymce/Resources/js/tinymce/filemanager/dialog.php
Executable file
524
local/modules/Tinymce/Resources/js/tinymce/filemanager/execute.php
Executable file
@@ -0,0 +1,524 @@
|
||||
<?php
|
||||
$config = include 'config/config.php';
|
||||
//TODO switch to array
|
||||
extract($config, EXTR_OVERWRITE);
|
||||
|
||||
include 'include/utils.php';
|
||||
|
||||
if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager")
|
||||
{
|
||||
response(trans('forbiden').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (strpos($_POST['path'],'/')===0
|
||||
|| strpos($_POST['path'],'../')!==FALSE
|
||||
|| strpos($_POST['path'],'./')===0
|
||||
|| strpos($_POST['path'],'..\\')!==FALSE
|
||||
|| strpos($_POST['path'],'.\\')===0)
|
||||
{
|
||||
response(trans('wrong path'.AddErrorLocation()))->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_SESSION['RF']['language']) && file_exists('lang/' . basename($_SESSION['RF']['language']) . '.php'))
|
||||
{
|
||||
$languages = include 'lang/languages.php';
|
||||
if(array_key_exists($_SESSION['RF']['language'],$languages)){
|
||||
include 'lang/' . basename($_SESSION['RF']['language']) . '.php';
|
||||
}else{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$ftp = ftp_con($config);
|
||||
|
||||
$base = $current_path;
|
||||
$path = $base.$_POST['path'];
|
||||
$cycle = TRUE;
|
||||
$max_cycles = 50;
|
||||
$i = 0;
|
||||
while($cycle && $i<$max_cycles)
|
||||
{
|
||||
$i++;
|
||||
if ($path == $base) $cycle=FALSE;
|
||||
|
||||
if (file_exists($path."config.php"))
|
||||
{
|
||||
require_once $path."config.php";
|
||||
$cycle = FALSE;
|
||||
}
|
||||
$path = fix_dirname($path)."/";
|
||||
}
|
||||
|
||||
$path = $current_path.$_POST['path'];
|
||||
$path_thumb = $thumbs_base_path.$_POST['path'];
|
||||
|
||||
if($ftp){
|
||||
$path = $ftp_base_folder.$upload_dir.$_POST['path'];
|
||||
$path_thumb = $ftp_base_folder.$ftp_thumbs_dir.$_POST['path'];
|
||||
}
|
||||
|
||||
if (isset($_POST['name']))
|
||||
{
|
||||
$name = fix_filename($_POST['name'],$config);
|
||||
if (strpos($name,'../') !== FALSE || strpos($name,'..\\') !== FALSE)
|
||||
{
|
||||
response(trans('wrong name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$info = pathinfo($path);
|
||||
if (isset($info['extension']) && !(isset($_GET['action']) && $_GET['action']=='delete_folder') && !in_array(strtolower($info['extension']), $ext) && $_GET['action'] != 'create_file')
|
||||
{
|
||||
response(trans('wrong extension').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['action']))
|
||||
{
|
||||
switch($_GET['action'])
|
||||
{
|
||||
case 'delete_file':
|
||||
if ($delete_files){
|
||||
if($ftp){
|
||||
try{
|
||||
$ftp->delete("/".$path);
|
||||
@$ftp->delete("/".$path_thumb);
|
||||
}catch(FtpClient\FtpException $e){
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
|
||||
unlink($path);
|
||||
if (file_exists($path_thumb)){
|
||||
unlink($path_thumb);
|
||||
}
|
||||
}
|
||||
|
||||
$info=pathinfo($path);
|
||||
if (!$ftp && $relative_image_creation){
|
||||
foreach($relative_path_from_current_pos as $k=>$path)
|
||||
{
|
||||
if ($path!="" && $path[strlen($path)-1]!="/") $path.="/";
|
||||
|
||||
if (file_exists($info['dirname']."/".$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension']))
|
||||
{
|
||||
unlink($info['dirname']."/".$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$ftp && $fixed_image_creation)
|
||||
{
|
||||
foreach($fixed_path_from_filemanager as $k=>$path)
|
||||
{
|
||||
if ($path!="" && $path[strlen($path)-1] != "/") $path.="/";
|
||||
|
||||
$base_dir=$path.substr_replace($info['dirname']."/", '', 0, strlen($current_path));
|
||||
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension']))
|
||||
{
|
||||
unlink($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'delete_folder':
|
||||
if ($delete_folders){
|
||||
|
||||
if($ftp){
|
||||
deleteDir($path,$ftp,$config);
|
||||
deleteDir($path_thumb,$ftp,$config);
|
||||
}else{
|
||||
if (is_dir($path_thumb))
|
||||
{
|
||||
deleteDir($path_thumb);
|
||||
}
|
||||
|
||||
if (is_dir($path))
|
||||
{
|
||||
deleteDir($path);
|
||||
if ($fixed_image_creation)
|
||||
{
|
||||
foreach($fixed_path_from_filemanager as $k=>$paths){
|
||||
if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.="/";
|
||||
|
||||
$base_dir=$paths.substr_replace($path, '', 0, strlen($current_path));
|
||||
if (is_dir($base_dir)) deleteDir($base_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'create_folder':
|
||||
if ($create_folders)
|
||||
{
|
||||
|
||||
$name = fix_filename($_POST['name'],$config);
|
||||
$path .= $name;
|
||||
$path_thumb .= $name;
|
||||
create_folder(fix_path($path,$config),fix_path($path_thumb,$config),$ftp,$config);
|
||||
}
|
||||
break;
|
||||
case 'rename_folder':
|
||||
if ($rename_folders){
|
||||
$name=fix_filename($name,$config);
|
||||
$name=str_replace('.','',$name);
|
||||
|
||||
if (!empty($name)){
|
||||
if (!rename_folder($path,$name,$ftp,$config))
|
||||
{
|
||||
response(trans('Rename_existing_folder').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
rename_folder($path_thumb,$name,$ftp,$config);
|
||||
if (!$ftp && $fixed_image_creation){
|
||||
foreach($fixed_path_from_filemanager as $k=>$paths){
|
||||
if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.="/";
|
||||
|
||||
$base_dir=$paths.substr_replace($path, '', 0, strlen($current_path));
|
||||
rename_folder($base_dir,$name,$ftp,$config);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'create_file':
|
||||
if ($create_text_files === FALSE) {
|
||||
response(sprintf(trans('File_Open_Edit_Not_Allowed'), strtolower(trans('Edit'))).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!isset($editable_text_file_exts) || !is_array($editable_text_file_exts)){
|
||||
$editable_text_file_exts = array();
|
||||
}
|
||||
|
||||
// check if user supplied extension
|
||||
if (strpos($name, '.') === FALSE){
|
||||
response(trans('No_Extension').' '.sprintf(trans('Valid_Extensions'), implode(', ', $editable_text_file_exts)).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// correct name
|
||||
$old_name = $name;
|
||||
$name=fix_filename($name,$config);
|
||||
if (empty($name))
|
||||
{
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// check extension
|
||||
$parts = explode('.', $name);
|
||||
if (!in_array(end($parts), $editable_text_file_exts)) {
|
||||
response(trans('Error_extension').' '.sprintf(trans('Valid_Extensions'), implode(', ', $editable_text_file_exts)), 400)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$content = $_POST['new_content'];
|
||||
|
||||
if($ftp){
|
||||
$tmp = time().$name;
|
||||
file_put_contents($tmp, $content);
|
||||
$ftp->put("/".$path.$name, $tmp, FTP_BINARY);
|
||||
unlink($tmp);
|
||||
response(trans('File_Save_OK'))->send();
|
||||
}else{
|
||||
if (!checkresultingsize(strlen($content))) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// file already exists
|
||||
if (file_exists($path.$name)) {
|
||||
response(trans('Rename_existing_file').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (@file_put_contents($path.$name, $content) === FALSE) {
|
||||
response(trans('File_Save_Error').AddErrorLocation())->send();
|
||||
exit;
|
||||
} else {
|
||||
if (is_function_callable('chmod') !== FALSE){
|
||||
chmod($path.$name, 0644);
|
||||
}
|
||||
response(trans('File_Save_OK'))->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'rename_file':
|
||||
if ($rename_files){
|
||||
$name=fix_filename($name,$config);
|
||||
if (!empty($name))
|
||||
{
|
||||
if (!rename_file($path,$name,$ftp,$config))
|
||||
{
|
||||
response(trans('Rename_existing_file').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
rename_file($path_thumb,$name,$ftp,$config);
|
||||
|
||||
if ($fixed_image_creation)
|
||||
{
|
||||
$info=pathinfo($path);
|
||||
|
||||
foreach($fixed_path_from_filemanager as $k=>$paths)
|
||||
{
|
||||
if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.="/";
|
||||
|
||||
$base_dir = $paths.substr_replace($info['dirname']."/", '', 0, strlen($current_path));
|
||||
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension']))
|
||||
{
|
||||
rename_file($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'],$fixed_image_creation_name_to_prepend[$k].$name.$fixed_image_creation_to_append[$k],$ftp,$config);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'duplicate_file':
|
||||
if ($duplicate_files)
|
||||
{
|
||||
$name=fix_filename($name,$config);
|
||||
if (!empty($name))
|
||||
{
|
||||
if (!$ftp && !checkresultingsize(filesize($path))) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if (!duplicate_file($path,$name,$ftp,$config))
|
||||
{
|
||||
response(trans('Rename_existing_file').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
duplicate_file($path_thumb,$name,$ftp,$config);
|
||||
|
||||
if (!$ftp && $fixed_image_creation)
|
||||
{
|
||||
$info=pathinfo($path);
|
||||
foreach($fixed_path_from_filemanager as $k=>$paths)
|
||||
{
|
||||
if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.= "/";
|
||||
|
||||
$base_dir=$paths.substr_replace($info['dirname']."/", '', 0, strlen($current_path));
|
||||
|
||||
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension']))
|
||||
{
|
||||
duplicate_file($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'],$fixed_image_creation_name_to_prepend[$k].$name.$fixed_image_creation_to_append[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'paste_clipboard':
|
||||
if ( ! isset($_SESSION['RF']['clipboard_action'], $_SESSION['RF']['clipboard']['path'])
|
||||
|| $_SESSION['RF']['clipboard_action'] == ''
|
||||
|| $_SESSION['RF']['clipboard']['path'] == '')
|
||||
{
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$action = $_SESSION['RF']['clipboard_action'];
|
||||
$data = $_SESSION['RF']['clipboard'];
|
||||
|
||||
|
||||
if($ftp){
|
||||
if($_POST['path']!=""){
|
||||
$path.=DIRECTORY_SEPARATOR;
|
||||
$path_thumb.=DIRECTORY_SEPARATOR;
|
||||
}
|
||||
$path_thumb .= basename($data['path']);
|
||||
$path .= basename($data['path']) ;
|
||||
$data['path_thumb'] = DIRECTORY_SEPARATOR.$config['ftp_base_folder'].$config['ftp_thumbs_dir'].$data['path'];
|
||||
$data['path'] = DIRECTORY_SEPARATOR.$config['ftp_base_folder'].$config['upload_dir'].$data['path'];
|
||||
}else{
|
||||
$data['path_thumb'] = $thumbs_base_path.$data['path'];
|
||||
$data['path'] = $current_path.$data['path'];
|
||||
}
|
||||
|
||||
$pinfo = pathinfo($data['path']);
|
||||
|
||||
// user wants to paste to the same dir. nothing to do here...
|
||||
if ($pinfo['dirname'] == rtrim($path, DIRECTORY_SEPARATOR)) {
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// user wants to paste folder to it's own sub folder.. baaaah.
|
||||
if (is_dir($data['path']) && strpos($path, $data['path']) !== FALSE){
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// something terribly gone wrong
|
||||
if ($action != 'copy' && $action != 'cut'){
|
||||
response(trans('wrong action').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if($ftp){
|
||||
if ($action == 'copy')
|
||||
{
|
||||
$tmp = time().basename($data['path']);
|
||||
$ftp->get($tmp, $data['path'], FTP_BINARY);
|
||||
$ftp->put(DIRECTORY_SEPARATOR.$path, $tmp, FTP_BINARY);
|
||||
unlink($tmp);
|
||||
|
||||
if(url_exists($data['path_thumb'])){
|
||||
$tmp = time().basename($data['path_thumb']);
|
||||
@$ftp->get($tmp, $data['path_thumb'], FTP_BINARY);
|
||||
@$ftp->put(DIRECTORY_SEPARATOR.$path_thumb, $tmp, FTP_BINARY);
|
||||
unlink($tmp);
|
||||
}
|
||||
|
||||
} elseif ($action == 'cut') {
|
||||
$ftp->rename($data['path'], DIRECTORY_SEPARATOR.$path);
|
||||
if(url_exists($data['path_thumb'])){
|
||||
@$ftp->rename($data['path_thumb'], DIRECTORY_SEPARATOR.$path_thumb);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// check for writability
|
||||
if (is_really_writable($path) === FALSE || is_really_writable($path_thumb) === FALSE){
|
||||
response(trans('Dir_No_Write').'<br/>'.str_replace('../','',$path).'<br/>'.str_replace('../','',$path_thumb).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// check if server disables copy or rename
|
||||
if (is_function_callable(($action == 'copy' ? 'copy' : 'rename')) === FALSE){
|
||||
response(sprintf(trans('Function_Disabled'), ($action == 'copy' ? (trans('Copy')) : (trans('Cut')))).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if ($action == 'copy')
|
||||
{
|
||||
list($sizeFolderToCopy,$fileNum,$foldersCount) = folder_info($path,false);
|
||||
if (!checkresultingsize($sizeFolderToCopy)) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
rcopy($data['path'], $path);
|
||||
rcopy($data['path_thumb'], $path_thumb);
|
||||
} elseif ($action == 'cut') {
|
||||
rrename($data['path'], $path);
|
||||
rrename($data['path_thumb'], $path_thumb);
|
||||
|
||||
// cleanup
|
||||
if (is_dir($data['path']) === TRUE){
|
||||
rrename_after_cleaner($data['path']);
|
||||
rrename_after_cleaner($data['path_thumb']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cleanup
|
||||
$_SESSION['RF']['clipboard']['path'] = NULL;
|
||||
$_SESSION['RF']['clipboard_action'] = NULL;
|
||||
|
||||
break;
|
||||
case 'chmod':
|
||||
$mode = $_POST['new_mode'];
|
||||
$rec_option = $_POST['is_recursive'];
|
||||
$valid_options = array('none', 'files', 'folders', 'both');
|
||||
$chmod_perm = ($_POST['folder'] ? $chmod_dirs : $chmod_files);
|
||||
|
||||
// check perm
|
||||
if ($chmod_perm === FALSE) {
|
||||
response(sprintf(trans('File_Permission_Not_Allowed'), (is_dir($path) ? (trans('Folders')) : (trans('Files')) )).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check mode
|
||||
if (!preg_match("/^[0-7]{3}$/", $mode)){
|
||||
response(trans('File_Permission_Wrong_Mode').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check recursive option
|
||||
if (!in_array($rec_option, $valid_options)){
|
||||
response(trans("wrong option").AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check if server disabled chmod
|
||||
if (!$ftp && is_function_callable('chmod') === FALSE){
|
||||
response(sprintf(trans('Function_Disabled'), 'chmod').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$mode = "0".$mode;
|
||||
$mode = octdec($mode);
|
||||
if($ftp){
|
||||
$ftp->chmod($mode, "/".$path);
|
||||
}else{
|
||||
rchmod($path, $mode, $rec_option);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'save_text_file':
|
||||
$content = $_POST['new_content'];
|
||||
// $content = htmlspecialchars($content); not needed
|
||||
// $content = stripslashes($content);
|
||||
|
||||
if($ftp){
|
||||
$tmp = time();
|
||||
file_put_contents($tmp, $content);
|
||||
try{
|
||||
$ftp->put("/".$path, $tmp, FTP_BINARY);
|
||||
}catch(FtpClient\FtpException $e){
|
||||
echo $e->getMessage();
|
||||
}
|
||||
unlink($tmp);
|
||||
response(trans('File_Save_OK'))->send();
|
||||
}else{
|
||||
// no file
|
||||
if (!file_exists($path)) {
|
||||
response(trans('File_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// not writable or edit not allowed
|
||||
if (!is_writable($path) || $edit_text_files === FALSE) {
|
||||
response(sprintf(trans('File_Open_Edit_Not_Allowed'), strtolower(trans('Edit'))).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!checkresultingsize(strlen($content))) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if (@file_put_contents($path, $content) === FALSE) {
|
||||
response(trans('File_Save_Error').AddErrorLocation())->send();
|
||||
exit;
|
||||
} else {
|
||||
response(trans('File_Save_OK'))->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
response(trans('wrong action').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
151
local/modules/Tinymce/Resources/js/tinymce/filemanager/force_download.php
Executable file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
$config = include 'config/config.php';
|
||||
|
||||
|
||||
//TODO switch to array
|
||||
extract($config, EXTR_OVERWRITE);
|
||||
|
||||
include 'include/utils.php';
|
||||
|
||||
$ftp = ftp_con($config);
|
||||
|
||||
if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager")
|
||||
{
|
||||
response(trans('forbiden').AddErrorLocation(), 403)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
include 'include/mime_type_lib.php';
|
||||
|
||||
|
||||
if (
|
||||
strpos($_POST['path'], '/') === 0
|
||||
|| strpos($_POST['path'], '../') !== false
|
||||
|| strpos($_POST['path'], './') === 0
|
||||
|| strpos($_POST['path'], '..\\') !== false
|
||||
|| strpos($_POST['path'], '.\\') === 0
|
||||
)
|
||||
{
|
||||
response(trans('wrong path'.AddErrorLocation()), 400)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if (strpos($_POST['name'], '/') !== false)
|
||||
{
|
||||
response(trans('wrong path'.AddErrorLocation()), 400)->send();
|
||||
exit;
|
||||
}
|
||||
if($ftp){
|
||||
$path = $ftp_base_url . $upload_dir . $_POST['path'];
|
||||
}else{
|
||||
$path = $current_path . $_POST['path'];
|
||||
}
|
||||
|
||||
$name = $_POST['name'];
|
||||
|
||||
$info = pathinfo($name);
|
||||
|
||||
if ( ! in_array(fix_strtolower($info['extension']), $ext))
|
||||
{
|
||||
response(trans('wrong extension'.AddErrorLocation()), 400)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$file_name = $info['basename'];
|
||||
$file_ext = $info['extension'];
|
||||
$file_path = $path . $name;
|
||||
|
||||
// make sure the file exists
|
||||
if($ftp){
|
||||
$file_url = 'http://www.myremoteserver.com/file.exe';
|
||||
header('Content-Type: application/octet-stream');
|
||||
header("Content-Transfer-Encoding: Binary");
|
||||
header("Content-disposition: attachment; filename=\"" . $file_name . "\"");
|
||||
readfile($file_path);
|
||||
}elseif (is_file($file_path) && is_readable($file_path))
|
||||
{
|
||||
if ( ! file_exists($path . $name))
|
||||
{
|
||||
response(trans('File_Not_Found'.AddErrorLocation()), 404)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$size = filesize($file_path);
|
||||
$file_name = rawurldecode($file_name);
|
||||
if (function_exists('mime_content_type')){
|
||||
$mime_type = mime_content_type($file_path);
|
||||
}elseif(function_exists('finfo_open')){
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mime_type = finfo_file($finfo, $file_path);
|
||||
}else{
|
||||
include 'include/mime_type_lib.php';
|
||||
$mime_type = get_file_mime_type($file_path);
|
||||
}
|
||||
|
||||
@ob_end_clean();
|
||||
if(ini_get('zlib.output_compression')){
|
||||
ini_set('zlib.output_compression', 'Off');
|
||||
}
|
||||
header('Content-Type: ' . $mime_type);
|
||||
header('Content-Disposition: attachment; filename="'.$file_name.'"');
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
header('Accept-Ranges: bytes');
|
||||
|
||||
if(isset($_SERVER['HTTP_RANGE']))
|
||||
{
|
||||
list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2);
|
||||
list($range) = explode(",",$range,2);
|
||||
list($range, $range_end) = explode("-", $range);
|
||||
$range=intval($range);
|
||||
if(!$range_end) {
|
||||
$range_end=$size-1;
|
||||
} else {
|
||||
$range_end=intval($range_end);
|
||||
}
|
||||
|
||||
$new_length = $range_end-$range+1;
|
||||
header("HTTP/1.1 206 Partial Content");
|
||||
header("Content-Length: $new_length");
|
||||
header("Content-Range: bytes $range-$range_end/$size");
|
||||
} else {
|
||||
$new_length=$size;
|
||||
header("Content-Length: ".$size);
|
||||
}
|
||||
|
||||
$chunksize = 1*(1024*1024);
|
||||
$bytes_send = 0;
|
||||
if ($file = fopen($file_path, 'r'))
|
||||
{
|
||||
if(isset($_SERVER['HTTP_RANGE']))
|
||||
fseek($file, $range);
|
||||
|
||||
while(!feof($file) &&
|
||||
(!connection_aborted()) &&
|
||||
($bytes_send<$new_length)
|
||||
)
|
||||
{
|
||||
$buffer = fread($file, $chunksize);
|
||||
echo($buffer);
|
||||
flush();
|
||||
$bytes_send += strlen($buffer);
|
||||
}
|
||||
fclose($file);
|
||||
} else {
|
||||
die('Error - can not open file.');
|
||||
}
|
||||
|
||||
die();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// file does not exist
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
|
||||
exit;
|
||||
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 195 B |
|
After Width: | Height: | Size: 238 B |
BIN
local/modules/Tinymce/Resources/js/tinymce/filemanager/img/cut.png
Executable file
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 611 B |
BIN
local/modules/Tinymce/Resources/js/tinymce/filemanager/img/dimension.png
Executable file
|
After Width: | Height: | Size: 489 B |
|
After Width: | Height: | Size: 163 B |
BIN
local/modules/Tinymce/Resources/js/tinymce/filemanager/img/download.png
Executable file
|
After Width: | Height: | Size: 674 B |
|
After Width: | Height: | Size: 245 B |
|
After Width: | Height: | Size: 673 B |
|
After Width: | Height: | Size: 764 B |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 737 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.7 KiB |