reformat code

This commit is contained in:
O3-Shop 2023-04-10 22:47:06 +02:00
parent 24c4264d87
commit a55512cc6c
96 changed files with 589 additions and 542 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules/
node_modules/
.php_cs.cache

29
.php-cs-fixer.php Normal file
View File

@ -0,0 +1,29 @@
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* 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, version 3.
*
* 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 O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
$finder = PhpCsFixer\Finder::create()->in(__DIR__);
$config = new PhpCsFixer\Config();
return $config
->setRules([
'@PHP74Migration' => true,
'@PSR12' => true
])
->setFinder($finder);

View File

@ -1,30 +1,29 @@
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* 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, version 3.
*
* 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 O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
namespace O3\TinyMCE\Application\Controller\Admin;
use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
class TinyFileManager extends AdminController
{
protected $_sThisTemplate = "TinyFilemanager.tpl";
}
<?php
/**
* This file is part of O3-Shop TinyMCE editor module.
*
* 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, version 3.
*
* 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 O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
namespace O3\TinyMCE\Application\Controller\Admin;
use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
class TinyFileManager extends AdminController
{
protected $_sThisTemplate = "TinyFilemanager.tpl";
}

View File

@ -75,7 +75,9 @@ class Configuration
protected function addOption(OptionInterface $optionInstance): void
{
if (!$optionInstance->requireRegistration()) return;
if (!$optionInstance->requireRegistration()) {
return;
}
$option = $optionInstance->get();
@ -106,10 +108,10 @@ class Configuration
*/
protected function addIntegrateOptions(): void
{
$this->addOption(oxNew( Setup::class, $this->loader));
$this->addOption(oxNew( BaseUrl::class, $this->loader));
$this->addOption(oxNew( CacheSuffix::class, $this->loader));
$this->addOption(oxNew( Selector::class, $this->loader));
$this->addOption(oxNew(Setup::class, $this->loader));
$this->addOption(oxNew(BaseUrl::class, $this->loader));
$this->addOption(oxNew(CacheSuffix::class, $this->loader));
$this->addOption(oxNew(Selector::class, $this->loader));
}
protected function addGuiOptions(): void
@ -127,37 +129,37 @@ class Configuration
protected function addContentAppearance(): void
{
$this->addOption(oxNew(ContentCss::class,$this->loader));
$this->addOption(oxNew(ContentCss::class, $this->loader));
}
protected function addContentFiltering(): void
{
$this->addOption(oxNew(EntityEncoding::class,$this->loader));
$this->addOption(oxNew(Protect::class,$this->loader));
$this->addOption(oxNew(EntityEncoding::class, $this->loader));
$this->addOption(oxNew(Protect::class, $this->loader));
}
protected function addLocalizationOptions(): void
{
$this->addOption(oxNew( Language::class, $this->loader));
$this->addOption(oxNew(Language::class, $this->loader));
}
protected function addUrlHandling(): void
{
$this->addOption(oxNew( DocumentBaseUrl::class, $this->loader));
$this->addOption(oxNew( RelativeUrls::class, $this->loader));
$this->addOption(oxNew(DocumentBaseUrl::class, $this->loader));
$this->addOption(oxNew(RelativeUrls::class, $this->loader));
}
protected function addPlugins(): void
{
$this->addOption(oxNew( ImageAdvtab::class, $this->loader));
$this->addOption(oxNew( Plugins::class, $this->loader));
$this->addOption(oxNew( ExternalPlugins::class, $this->loader));
$this->addOption(oxNew( FilemanagerUrl::class, $this->loader));
$this->addOption(oxNew(ImageAdvtab::class, $this->loader));
$this->addOption(oxNew(Plugins::class, $this->loader));
$this->addOption(oxNew(ExternalPlugins::class, $this->loader));
$this->addOption(oxNew(FilemanagerUrl::class, $this->loader));
$this->addOption(oxNew(QuickbarsInsertToolbar::class, $this->loader));
}
protected function addToolbar(): void
{
$this->addOption(oxNew( Toolbar::class, $this->loader));
$this->addOption(oxNew(Toolbar::class, $this->loader));
}
}

View File

@ -47,7 +47,9 @@ class Loader
*/
public function getEditorCode(): string
{
if (!$this->isEnabledForCurrentController()) return '';
if (!$this->isEnabledForCurrentController()) {
return '';
}
if ($this->contentIsPlain()) {
/** @var string $message */
@ -71,9 +73,9 @@ class Loader
protected function isEnabledForCurrentController(): bool
{
/** @var string[] $aEnabledClasses */
$aEnabledClasses = $this->getShopConfig()->getConfigParam( "aTinyMCE_classes", []);
$aEnabledClasses = $this->getShopConfig()->getConfigParam("aTinyMCE_classes", []);
return in_array( $this->getShopConfig()->getActiveView()->getClassKey(), $aEnabledClasses);
return in_array($this->getShopConfig()->getActiveView()->getClassKey(), $aEnabledClasses);
}
/**
@ -82,7 +84,7 @@ class Loader
protected function contentIsPlain(): bool
{
/** @var BaseModel|Content $oEditObject */
$oEditObject = $this->getShopConfig()->getActiveView()->getViewDataElement( "edit" );
$oEditObject = $this->getShopConfig()->getActiveView()->getViewDataElement("edit");
return $oEditObject instanceof Content && $oEditObject->isPlain();
}
@ -160,4 +162,4 @@ class Loader
Registry::getConfig()->setGlobalParameter('includes' . $sSuffix, $aInclude);
}
}
}

View File

@ -55,4 +55,4 @@ abstract class AbstractOption implements OptionInterface
{
return true;
}
}
}

View File

@ -43,4 +43,4 @@ class BaseUrl extends AbstractOption
{
return true;
}
}
}

View File

@ -40,4 +40,4 @@ class CacheSuffix extends AbstractOption
{
return true;
}
}
}

View File

@ -44,7 +44,7 @@ class ContentCss extends AbstractOption
[
$this->darkMode ?
'dark' :
'/out/'.strtolower($theme).'/src/css/styles.min.css'
'/out/'.strtolower($theme).'/src/css/styles.min.css',
]
);
}

View File

@ -36,4 +36,4 @@ class ContextMenu extends AbstractOption
{
return true;
}
}
}

View File

@ -38,4 +38,4 @@ class DocumentBaseUrl extends AbstractOption
{
return true;
}
}
}

View File

@ -40,4 +40,4 @@ class EntityEncoding extends AbstractOption
{
return true;
}
}
}

View File

@ -35,21 +35,24 @@ class ExternalPlugins extends AbstractOption
{
$pluginList = oxNew(PluginList::class);
$list = implode(', ', array_filter(
$list = implode(
', ',
array_filter(
array_map(
function (PluginInterface $plugin) {
return $plugin->getScriptPath() ? implode(
':',
[
(oxNew(Utils::class))->quote($plugin->getPluginName()),
(oxNew(Utils::class))->quote($plugin->getScriptPath())
(oxNew(Utils::class))->quote($plugin->getScriptPath()),
]
) : null;
},
$pluginList->get()
))
)
)
);
return '{ '.$list.' }';
}
}
}

View File

@ -58,4 +58,4 @@ class FilemanagerUrl extends AbstractOption
{
return (bool) $this->loader->getShopConfig()->getConfigParam("blTinyMCE_filemanager");
}
}
}

View File

@ -31,4 +31,4 @@ class ImageAdvtab extends AbstractOption
{
return 'true';
}
}
}

View File

@ -36,7 +36,7 @@ class Language extends AbstractOption
$oLang = $this->loader->getLanguage();
$aLang = array(
$aLang = [
"cs" => "cs",
"da" => "da",
"de" => "de",
@ -44,13 +44,13 @@ class Language extends AbstractOption
"fr" => "fr_FR",
"it" => "it_IT",
"nl" => "nl",
"ru" => "ru"
);
return $aLang[ $oLang->getLanguageAbbr( (int) $oLang->getTplLanguage() ) ] ?? "en";
"ru" => "ru",
];
return $aLang[ $oLang->getLanguageAbbr((int) $oLang->getTplLanguage()) ] ?? "en";
}
public function mustQuote(): bool
{
return true;
}
}
}

View File

@ -36,4 +36,4 @@ class MaxHeight extends AbstractOption
{
return true;
}
}
}

View File

@ -36,4 +36,4 @@ class MaxWidth extends AbstractOption
{
return true;
}
}
}

View File

@ -36,4 +36,4 @@ class Menubar extends AbstractOption
{
return true;
}
}
}

View File

@ -39,4 +39,4 @@ class MinHeight extends AbstractOption
return '350';
}
}
}

View File

@ -36,4 +36,4 @@ interface OptionInterface
public function mustQuote(): bool;
public function requireRegistration(): bool;
}
}

View File

@ -35,15 +35,15 @@ class Plugins extends AbstractOption
$pluginList = oxNew(PluginList::class);
return implode(' ', array_filter(
array_map(
function (PluginInterface $plugin) {
array_map(
function (PluginInterface $plugin) {
return $plugin->requireRegistration() ?
$plugin->getPluginName() :
null
;
},
$pluginList->get()
)
$pluginList->get()
)
));
}
@ -51,4 +51,4 @@ class Plugins extends AbstractOption
{
return true;
}
}
}

View File

@ -38,4 +38,4 @@ class Protect extends AbstractOption
return '[ '.implode(', ', $protect).' ]';
}
}
}

View File

@ -34,17 +34,17 @@ class QuickbarsInsertToolbar extends AbstractOption
public function get(): string
{
return 'false';
/*
return implode(
' | ',
[
// 'quickimage', // disabled, as images are only inserted inline. This is too much for a typical database field length.
'quicktable',
'hr',
'pagebreak'
]
);
*/
/*
return implode(
' | ',
[
// 'quickimage', // disabled, as images are only inserted inline. This is too much for a typical database field length.
'quicktable',
'hr',
'pagebreak'
]
);
*/
}
public function mustQuote(): bool

View File

@ -31,4 +31,4 @@ class RelativeUrls extends AbstractOption
{
return 'true';
}
}
}

View File

@ -30,10 +30,10 @@ class Setup extends AbstractOption
public function get(): string
{
$js = <<<JS
(editor) => {
editor.options.register("filemanager_url", { processor: "string" });
}
JS;
(editor) => {
editor.options.register("filemanager_url", { processor: "string" });
}
JS;
return trim((string) preg_replace('!\s+!', ' ', $js));
}

View File

@ -34,9 +34,9 @@ class Toolbar extends AbstractOption
protected bool $forceSingleLineToolbar = true;
public function __construct( Loader $loader )
public function __construct(Loader $loader)
{
parent::__construct( $loader );
parent::__construct($loader);
}
public function get(): string
@ -142,4 +142,4 @@ class Toolbar extends AbstractOption
{
return true;
}
}
}

View File

@ -36,4 +36,4 @@ class ToolbarMode extends AbstractOption
{
return true;
}
}
}

View File

@ -31,4 +31,4 @@ class ToolbarSticky extends AbstractOption
{
return 'true';
}
}
}

View File

@ -46,4 +46,4 @@ abstract class AbstractPlugin implements PluginInterface
{
return true;
}
}
}

View File

@ -33,7 +33,7 @@ class Anchor extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'anchor'
'anchor',
];
}
}
}

View File

@ -29,4 +29,4 @@ class AutoResize extends AbstractPlugin
{
return 'autoresize';
}
}
}

View File

@ -29,4 +29,4 @@ class Autolink extends AbstractPlugin
{
return 'autolink';
}
}
}

View File

@ -33,7 +33,7 @@ class Charmap extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'charmap'
'charmap',
];
}
}
}

View File

@ -33,7 +33,7 @@ class Code extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'code'
'code',
];
}
}
}

View File

@ -35,7 +35,7 @@ class FullPage extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'fullpage'
'fullpage',
];
}
@ -43,4 +43,4 @@ class FullPage extends AbstractPlugin
{
return strtolower(Registry::getConfig()->getActiveView()->getClassKey()) === 'newsletter_main';
}
}
}

View File

@ -36,7 +36,7 @@ class FullScreen extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'fullscreen'
'fullscreen',
];
}
@ -51,4 +51,4 @@ class FullScreen extends AbstractPlugin
'out/plugins/oxfullscreen/plugin.js'
);
}
}
}

View File

@ -33,7 +33,7 @@ class Image extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'image'
'image',
];
}
}
}

View File

@ -36,4 +36,4 @@ class Legacyoutput extends AbstractPlugin
{
return strtolower(Registry::getConfig()->getActiveView()->getClassKey()) === 'newsletter_main';
}
}
}

View File

@ -34,7 +34,7 @@ class Link extends AbstractPlugin
{
return [
'link',
'unlink'
'unlink',
];
}
}
}

View File

@ -34,4 +34,4 @@ class Lists extends AbstractPlugin
{
return [];
}
}
}

View File

@ -33,7 +33,7 @@ class Media extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'media'
'media',
];
}
}
}

View File

@ -36,7 +36,7 @@ class Nonbreaking extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'nonbreaking'
'nonbreaking',
];
}
}
}

View File

@ -36,7 +36,7 @@ class Pagebreak extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'pagebreak'
'pagebreak',
];
}
}
}

View File

@ -37,4 +37,4 @@ interface PluginInterface
public function requireRegistration(): bool;
public function requireScript(): bool;
}
}

View File

@ -36,7 +36,7 @@ class Preview extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'preview'
'preview',
];
}
}
}

View File

@ -29,4 +29,4 @@ class Quickbars extends AbstractPlugin
{
return 'quickbars';
}
}
}

View File

@ -54,4 +54,4 @@ class Roxy extends AbstractPlugin
{
return (bool) Registry::getConfig()->getConfigParam("blTinyMCE_filemanager");
}
}
}

View File

@ -36,7 +36,7 @@ class SearchReplace extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'searchreplace'
'searchreplace',
];
}
}
}

View File

@ -36,7 +36,7 @@ class Table extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'table'
'table',
];
}
}
}

View File

@ -36,7 +36,7 @@ class Visualblocks extends AbstractPlugin
public function getToolbarElements(): array
{
return [
'visualblocks'
'visualblocks',
];
}
}
}

View File

@ -37,4 +37,4 @@ class WordCount extends AbstractPlugin
{
return [];
}
}
}

View File

@ -26,4 +26,4 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
abstract class AbstractToolbar implements ToolbarInterface
{
abstract public function getButtons(): array;
}
}

View File

@ -34,4 +34,4 @@ class Align extends AbstractToolbar
'alignjustify',
];
}
}
}

View File

@ -31,4 +31,4 @@ class Blockquote extends AbstractToolbar
'blockquote',
];
}
}
}

View File

@ -31,4 +31,4 @@ class Blocks extends AbstractToolbar
'blocks',
];
}
}
}

View File

@ -29,7 +29,7 @@ class Color extends AbstractToolbar
{
return [
'forecolor',
'backcolor'
'backcolor',
];
}
}
}

View File

@ -30,7 +30,7 @@ class CopyPaste extends AbstractToolbar
return [
'cut',
'copy',
'paste'
'paste',
];
}
}
}

View File

@ -37,4 +37,4 @@ class Font extends AbstractToolbar
'strikethrough',
];
}
}
}

View File

@ -32,4 +32,4 @@ class Indent extends AbstractToolbar
'indent',
];
}
}
}

View File

@ -32,4 +32,4 @@ class Lists extends AbstractToolbar
'numlist',
];
}
}
}

View File

@ -31,4 +31,4 @@ class RemoveFormat extends AbstractToolbar
'removeformat',
];
}
}
}

View File

@ -31,4 +31,4 @@ class Subscript extends AbstractToolbar
'subscript',
];
}
}
}

View File

@ -31,4 +31,4 @@ class Superscript extends AbstractToolbar
'superscript',
];
}
}
}

View File

@ -29,4 +29,4 @@ interface ToolbarInterface
* @return string[]
*/
public function getButtons(): array;
}
}

View File

@ -32,7 +32,7 @@ class Undo extends AbstractToolbar
{
return [
'undo',
'redo'
'redo',
];
}
}
}

View File

@ -56,7 +56,7 @@ class ToolbarList
'indent' => oxNew(Indent::class),
'blockquote' => oxNew(Blockquote::class),
'removeformat' => oxNew(RemoveFormat::class),
]
],
];
}
}

View File

@ -29,4 +29,4 @@ class Utils
{
return '"'.addslashes($string).'"';
}
}
}

View File

@ -23,5 +23,7 @@ declare(strict_types=1);
function checkAccess(string $action): void
{
if($_COOKIE['filemanagerkey'] !== md5($_SERVER['DOCUMENT_ROOT'].$_COOKIE['admin_sid'])) die('Access Denied!!');
}
if ($_COOKIE['filemanagerkey'] !== md5($_SERVER['DOCUMENT_ROOT'].$_COOKIE['admin_sid'])) {
die('Access Denied!!');
}
}

View File

@ -1,60 +1,60 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('COPYDIR');
checkAccess('COPYDIR');
$path = RoxyFile::FixPath(trim(empty($_POST['d']) ? '' : $_POST['d']));
$newPath = RoxyFile::FixPath(trim(empty($_POST['n']) ? '' : $_POST['n']));
verifyPath($path);
verifyPath($newPath);
function copyDir(string $path, string $newPath): void
{
$items = listDirectory($path);
if (!is_dir($newPath)) {
mkdir($newPath, (int) octdec(DIRPERMISSIONS));
}
foreach ($items as $item) {
if ($item == '.' || $item == '..') {
continue;
}
$oldPath = RoxyFile::FixPath($path . '/' . $item);
$tmpNewPath = RoxyFile::FixPath($newPath . '/' . $item);
if (is_file($oldPath)) {
copy($oldPath, $tmpNewPath);
} elseif (is_dir($oldPath)) {
copyDir($oldPath, $tmpNewPath);
}
}
}
if (is_dir(fixPath($path))) {
copyDir(fixPath($path . '/'), fixPath($newPath . '/' . basename($path)));
echo getSuccessRes();
} else {
echo getErrorRes(t('E_CopyDirInvalidPath'));
}
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('COPYDIR');
checkAccess('COPYDIR');
$path = RoxyFile::FixPath(trim(empty($_POST['d']) ? '' : $_POST['d']));
$newPath = RoxyFile::FixPath(trim(empty($_POST['n']) ? '' : $_POST['n']));
verifyPath($path);
verifyPath($newPath);
function copyDir(string $path, string $newPath): void
{
$items = listDirectory($path);
if (!is_dir($newPath)) {
mkdir($newPath, (int) octdec(DIRPERMISSIONS));
}
foreach ($items as $item) {
if ($item == '.' || $item == '..') {
continue;
}
$oldPath = RoxyFile::FixPath($path . '/' . $item);
$tmpNewPath = RoxyFile::FixPath($newPath . '/' . $item);
if (is_file($oldPath)) {
copy($oldPath, $tmpNewPath);
} elseif (is_dir($oldPath)) {
copyDir($oldPath, $tmpNewPath);
}
}
}
if (is_dir(fixPath($path))) {
copyDir(fixPath($path . '/'), fixPath($newPath . '/' . basename($path)));
echo getSuccessRes();
} else {
echo getErrorRes(t('E_CopyDirInvalidPath'));
}

View File

@ -1,47 +1,47 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('COPYFILE');
checkAccess('COPYFILE');
$path = RoxyFile::FixPath(trim(empty($_POST['f']) ? '' : $_POST['f']));
$newPath = RoxyFile::FixPath(trim(empty($_POST['n']) ? '' : $_POST['n']));
if (!$newPath) {
$newPath = getFilesPath();
}
verifyPath($path);
verifyPath($newPath);
if (is_file(fixPath($path))) {
$newPath = $newPath . '/' . RoxyFile::MakeUniqueFilename(fixPath($newPath), basename($path));
if (copy(fixPath($path), fixPath($newPath))) {
echo getSuccessRes();
} else {
echo getErrorRes(t('E_CopyFile'));
}
} else {
echo getErrorRes(t('E_CopyFileInvalisPath'));
}
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('COPYFILE');
checkAccess('COPYFILE');
$path = RoxyFile::FixPath(trim(empty($_POST['f']) ? '' : $_POST['f']));
$newPath = RoxyFile::FixPath(trim(empty($_POST['n']) ? '' : $_POST['n']));
if (!$newPath) {
$newPath = getFilesPath();
}
verifyPath($path);
verifyPath($newPath);
if (is_file(fixPath($path))) {
$newPath = $newPath . '/' . RoxyFile::MakeUniqueFilename(fixPath($newPath), basename($path));
if (copy(fixPath($path), fixPath($newPath))) {
echo getSuccessRes();
} else {
echo getErrorRes(t('E_CopyFile'));
}
} else {
echo getErrorRes(t('E_CopyFileInvalisPath'));
}

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -38,4 +38,4 @@ if (is_dir(fixPath($path))) {
}
} else {
echo getErrorRes(t('E_CreateDirInvalidPath'));
}
}

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -41,4 +41,4 @@ if (is_dir(fixPath($path))) {
}
} else {
echo getErrorRes(t('E_DeleteDirInvalidPath') . ' ' . $path);
}
}

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -37,4 +37,4 @@ if (is_file(fixPath($path))) {
}
} else {
echo getErrorRes(t('E_DeleteFileInvalidPath'));
}
}

View File

@ -1,85 +1,85 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('DIRLIST');
checkAccess('DIRLIST');
/**
* @param string $path
* @param string $type
* @return int[]
*/
function getFilesNumber(string $path, string $type): array
{
$files = 0;
$dirs = 0;
$tmp = listDirectory($path);
foreach ($tmp as $ff) {
if ($ff == '.' || $ff == '..') {
continue;
} elseif (
is_file($path . '/' . $ff) &&
($type == '' || ($type == 'image' && RoxyFile::IsImage($ff)) || ($type == 'flash' && RoxyFile::IsFlash($ff)))
) {
$files++;
} elseif (is_dir($path . '/' . $ff)) {
$dirs++;
}
}
return array('files' => $files, 'dirs' => $dirs);
}
function GetDirs(string $path, string $type): void
{
$ret = $sort = array();
$files = listDirectory(fixPath($path));
foreach ($files as $f) {
$fullPath = $path . '/' . $f;
if (!is_dir(fixPath($fullPath)) || $f == '.' || $f == '..') {
continue;
}
$tmp = getFilesNumber(fixPath($fullPath), $type);
$ret[$fullPath] = array('path' => $fullPath, 'files' => $tmp['files'], 'dirs' => $tmp['dirs']);
$sort[$fullPath] = $f;
}
natcasesort($sort);
foreach ($sort as $k => $v) {
$tmp = $ret[$k];
echo ',{"p":"' . mb_ereg_replace('"', '\\"', $tmp['path']) . '","f":"' . $tmp['files'] . '","d":"' . $tmp['dirs'] . '"}';
GetDirs($tmp['path'], $type);
}
}
$type = (empty($_GET['type']) ? '' : strtolower($_GET['type']));
if ($type != 'image' && $type != 'flash') {
$type = '';
}
echo "[\n";
$tmp = getFilesNumber(fixPath(getFilesPath()), $type);
echo '{"p":"' . mb_ereg_replace('"', '\\"', getFilesPath()) . '","f":"' . $tmp['files'] . '","d":"' . $tmp['dirs'] . '"}';
GetDirs(getFilesPath(), $type);
echo "\n]";
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('DIRLIST');
checkAccess('DIRLIST');
/**
* @param string $path
* @param string $type
* @return int[]
*/
function getFilesNumber(string $path, string $type): array
{
$files = 0;
$dirs = 0;
$tmp = listDirectory($path);
foreach ($tmp as $ff) {
if ($ff == '.' || $ff == '..') {
continue;
} elseif (
is_file($path . '/' . $ff) &&
($type == '' || ($type == 'image' && RoxyFile::IsImage($ff)) || ($type == 'flash' && RoxyFile::IsFlash($ff)))
) {
$files++;
} elseif (is_dir($path . '/' . $ff)) {
$dirs++;
}
}
return ['files' => $files, 'dirs' => $dirs];
}
function GetDirs(string $path, string $type): void
{
$ret = $sort = [];
$files = listDirectory(fixPath($path));
foreach ($files as $f) {
$fullPath = $path . '/' . $f;
if (!is_dir(fixPath($fullPath)) || $f == '.' || $f == '..') {
continue;
}
$tmp = getFilesNumber(fixPath($fullPath), $type);
$ret[$fullPath] = ['path' => $fullPath, 'files' => $tmp['files'], 'dirs' => $tmp['dirs']];
$sort[$fullPath] = $f;
}
natcasesort($sort);
foreach ($sort as $k => $v) {
$tmp = $ret[$k];
echo ',{"p":"' . mb_ereg_replace('"', '\\"', $tmp['path']) . '","f":"' . $tmp['files'] . '","d":"' . $tmp['dirs'] . '"}';
GetDirs($tmp['path'], $type);
}
}
$type = (empty($_GET['type']) ? '' : strtolower($_GET['type']));
if ($type != 'image' && $type != 'flash') {
$type = '';
}
echo "[\n";
$tmp = getFilesNumber(fixPath(getFilesPath()), $type);
echo '{"p":"' . mb_ereg_replace('"', '\\"', getFilesPath()) . '","f":"' . $tmp['files'] . '","d":"' . $tmp['dirs'] . '"}';
GetDirs(getFilesPath(), $type);
echo "\n]";

View File

@ -1,37 +1,37 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('DOWNLOAD');
checkAccess('DOWNLOAD');
$path = RoxyFile::FixPath(trim($_GET['f']));
verifyPath($path);
if (is_file(fixPath($path))) {
$file = urldecode(basename($path));
header('Content-Disposition: attachment; filename="' . $file . '"');
header('Content-Type: application/force-download');
readfile(fixPath($path));
}
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('DOWNLOAD');
checkAccess('DOWNLOAD');
$path = RoxyFile::FixPath(trim($_GET['f']));
verifyPath($path);
if (is_file(fixPath($path))) {
$file = urldecode(basename($path));
header('Content-Disposition: attachment; filename="' . $file . '"');
header('Content-Type: application/force-download');
readfile(fixPath($path));
}

View File

@ -1,54 +1,54 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
@ini_set('memory_limit', '-1');
verifyAction('DOWNLOADDIR');
checkAccess('DOWNLOADDIR');
$path = RoxyFile::FixPath(trim($_GET['d']));
verifyPath($path);
$path = fixPath($path);
if (!class_exists('ZipArchive')) {
echo '<script>alert("Cannot create zip archive - ZipArchive class is missing. Check your PHP version and configuration");</script>';
} else {
try {
$filename = basename($path);
$zipFile = $filename . '.zip';
$zipPath = BASE_PATH . '/tmp/' . $zipFile;
RoxyFile::ZipDir($path, $zipPath);
header('Content-Disposition: attachment; filename="' . $zipFile . '"');
header('Content-Type: application/force-download');
readfile($zipPath);
function deleteTmp(string $zipPath): void
{
@unlink($zipPath);
}
register_shutdown_function('deleteTmp', $zipPath);
} catch (Exception $ex) {
echo '<script>alert("' . addslashes(t('E_CreateArchive')) . '");</script>';
}
}
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
@ini_set('memory_limit', '-1');
verifyAction('DOWNLOADDIR');
checkAccess('DOWNLOADDIR');
$path = RoxyFile::FixPath(trim($_GET['d']));
verifyPath($path);
$path = fixPath($path);
if (!class_exists('ZipArchive')) {
echo '<script>alert("Cannot create zip archive - ZipArchive class is missing. Check your PHP version and configuration");</script>';
} else {
try {
$filename = basename($path);
$zipFile = $filename . '.zip';
$zipPath = BASE_PATH . '/tmp/' . $zipFile;
RoxyFile::ZipDir($path, $zipPath);
header('Content-Disposition: attachment; filename="' . $zipFile . '"');
header('Content-Type: application/force-download');
readfile($zipPath);
function deleteTmp(string $zipPath): void
{
@unlink($zipPath);
}
register_shutdown_function('deleteTmp', $zipPath);
} catch (Exception $ex) {
echo '<script>alert("' . addslashes(t('E_CreateArchive')) . '");</script>';
}
}

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -57,4 +57,4 @@ foreach ($files as $f) {
}
$str = mb_substr($str, 0, -1);
echo $str;
echo ']';
echo ']';

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -32,8 +32,9 @@ function t(string $key): string
if (defined('LANG')) {
if (LANG == 'auto') {
$lang = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));
if (is_file($langPath . $lang . '.json'))
if (is_file($langPath . $lang . '.json')) {
$file = $lang . '.json';
}
} elseif (is_file($langPath . LANG . '.json')) {
$file = LANG . '.json';
}
@ -116,8 +117,9 @@ function getFilesPath(): string
if (!$ret) {
$ret = RoxyFile::FixPath(BASE_PATH . '/Uploads');
$tmp = $_SERVER['DOCUMENT_ROOT'];
if (mb_substr($tmp, -1) == '/' || mb_substr($tmp, -1) == '\\')
if (mb_substr($tmp, -1) == '/' || mb_substr($tmp, -1) == '\\') {
$tmp = mb_substr($tmp, 0, -1);
}
$ret = str_replace(RoxyFile::FixPath($tmp), '', $ret);
}
return $ret;
@ -146,7 +148,7 @@ function listDirectory(string $path): array
class RoxyFile
{
static public function CheckWritable(string $dir): bool
public static function CheckWritable(string $dir): bool
{
$ret = false;
if (self::CreatePath($dir)) {
@ -167,16 +169,17 @@ class RoxyFile
* @param $path
* @return bool
*/
static public function CreatePath(string $path): bool
public static function CreatePath(string $path): bool
{
if (is_dir($path))
if (is_dir($path)) {
return true;
$prev_path = substr($path, 0, strrpos($path, '/', -2) + 1 );
}
$prev_path = substr($path, 0, strrpos($path, '/', -2) + 1);
$return = self::createPath($prev_path);
return $return && is_writable($prev_path) && mkdir($path);
}
static function CanUploadFile(string $filename): bool
public static function CanUploadFile(string $filename): bool
{
$forbidden = array_filter((array) preg_split('/[^\d\w]+/', strtolower(FORBIDDEN_UPLOADS)));
$allowed = array_filter((array) preg_split('/[^\d\w]+/', strtolower(ALLOWED_UPLOADS)));
@ -189,7 +192,7 @@ class RoxyFile
return false;
}
static public function ZipAddDir(string $path, ZipArchive $zip, string $zipPath): void
public static function ZipAddDir(string $path, ZipArchive $zip, string $zipPath): void
{
$d = opendir($path);
$zipPath = str_replace('//', '/', $zipPath);
@ -198,8 +201,9 @@ class RoxyFile
}
if (is_resource($d)) {
while (($f = readdir($d)) !== false) {
if ($f == '.' || $f == '..')
if ($f == '.' || $f == '..') {
continue;
}
$filePath = $path . '/' . $f;
if (is_file($filePath)) {
$zip->addFile($filePath, ($zipPath ? $zipPath . '/' : '') . $f);
@ -213,7 +217,7 @@ class RoxyFile
}
}
static public function ZipDir(string $path, string $zipFile, string $zipPath = ''): void
public static function ZipDir(string $path, string $zipFile, string $zipPath = ''): void
{
$zip = new ZipArchive();
$zip->open($zipFile, ZIPARCHIVE::CREATE);
@ -221,7 +225,7 @@ class RoxyFile
$zip->close();
}
static public function IsImage(string $fileName): bool
public static function IsImage(string $fileName): bool
{
$ext = strtolower(self::GetExtension($fileName));
@ -230,7 +234,7 @@ class RoxyFile
return in_array($ext, $imageExtensions);
}
static public function IsFlash(string $fileName): bool
public static function IsFlash(string $fileName): bool
{
$ext = strtolower(self::GetExtension($fileName));
@ -245,7 +249,7 @@ class RoxyFile
* @param int $filesize
* @return string
*/
static public function FormatFileSize(int $filesize): string
public static function FormatFileSize(int $filesize): string
{
$unit = 'B';
if ($filesize > 1024) {
@ -271,7 +275,7 @@ class RoxyFile
* @param string $filename
* @return string
*/
static public function GetMIMEType(string $filename): string
public static function GetMIMEType(string $filename): string
{
$ext = self::GetExtension($filename);
@ -313,7 +317,7 @@ class RoxyFile
* @param string $sep
* @return string
*/
static public function CleanupFilename(string $filename, string $sep = '_'): string
public static function CleanupFilename(string $filename, string $sep = '_'): string
{
$str = '';
if (strpos($filename, '.')) {
@ -340,7 +344,7 @@ class RoxyFile
* @param string $filename
* @return string
*/
static public function GetExtension(string $filename): string
public static function GetExtension(string $filename): string
{
$ext = '';
@ -357,7 +361,7 @@ class RoxyFile
* @param string $filename
* @return string
*/
static public function GetName(string $filename): string
public static function GetName(string $filename): string
{
$tmp = mb_strpos($filename, '?');
if ($tmp !== false) {
@ -373,7 +377,7 @@ class RoxyFile
return $name;
}
static public function GetFullName(string $filename): string
public static function GetFullName(string $filename): string
{
$tmp = mb_strpos($filename, '?');
if ($tmp !== false) {
@ -382,7 +386,7 @@ class RoxyFile
return basename($filename);
}
static public function FixPath(string $path): string
public static function FixPath(string $path): string
{
$path = (string) mb_ereg_replace('[\\\/]+', '/', $path);
$path = (string) mb_ereg_replace('\.\.\/', '', $path);
@ -397,7 +401,7 @@ class RoxyFile
* @param string $filename
* @return string
*/
static public function MakeUniqueFilename(string $dir, string $filename): string
public static function MakeUniqueFilename(string $dir, string $filename): string
{
;
$dir .= '/';
@ -429,7 +433,7 @@ class RoxyFile
* @param string $name
* @return string
*/
static public function MakeUniqueDirname(string $dir, string $name): string
public static function MakeUniqueDirname(string $dir, string $name): string
{
$dir = self::FixPath($dir . '/');
$name = mb_ereg_replace(' - Copy \\d+$', '', $name);
@ -463,11 +467,11 @@ class RoxyImage
public static function OutputImage($img, string $type, ?string $destination = '', int $quality = 90)
{
if(is_string($img)) {
if (is_string($img)) {
$img = self::GetImage($img);
}
switch(strtolower($type)){
switch (strtolower($type)) {
case 'png':
imagepng($img, $destination);
break;
@ -497,8 +501,7 @@ class RoxyImage
int $width = 150,
int $height = 0,
int $quality = 90
): void
{
): void {
$tmp = (array) getimagesize($source);
$w = $tmp[0];
$h = $tmp[1];
@ -534,8 +537,7 @@ class RoxyImage
int $width,
int $height,
int $quality = 90
): void
{
): void {
$tmp = (array) getimagesize($source);
$w = $tmp[0];
$h = $tmp[1];
@ -576,8 +578,7 @@ class RoxyImage
int $width,
int $height,
int $quality = 90
): void
{
): void {
$thumbImg = imagecreatetruecolor($width, $height);
$img = self::GetImage($source);
@ -602,4 +603,4 @@ foreach ($tmp as $k => $v) {
$FilesRoot = fixPath(getFilesPath());
if (!is_dir($FilesRoot)) {
@mkdir($FilesRoot, (int) octdec(DIRPERMISSIONS));
}
}

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -43,4 +43,4 @@ if (is_dir(fixPath($path))) {
}
} else {
echo getErrorRes(t('E_MoveDirInvalisPath'));
}
}

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -46,4 +46,4 @@ if (!RoxyFile::CanUploadFile(basename($newPath))) {
}
} else {
echo getErrorRes(t('E_MoveFileInvalisPath'));
}
}

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -40,4 +40,4 @@ if (is_dir(fixPath($path))) {
}
} else {
echo getErrorRes(t('E_RenameDirInvalidPath'));
}
}

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -40,4 +40,4 @@ if (is_file(fixPath($path))) {
}
} else {
echo getErrorRes(t('E_RenameFileInvalidPath'));
}
}

View File

@ -1,27 +1,29 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
function checkAccess(string $action): void
{
unset($action);
if($_COOKIE['filemanagerkey'] !== md5_file("../../../../../../config.inc.php")) die('nice try, noob.');
}
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license
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/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
function checkAccess(string $action): void
{
unset($action);
if ($_COOKIE['filemanagerkey'] !== md5_file("../../../../../../config.inc.php")) {
die('nice try, noob.');
}
}

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -39,7 +39,8 @@ $w = intval(empty($_GET['width']) ? '100' : $_GET['width']);
$h = intval(empty($_GET['height']) ? '0' : $_GET['height']);
header('Content-type: '.RoxyFile::GetMIMEType(basename($path)));
if($w && $h)
if ($w && $h) {
RoxyImage::CropCenter(fixPath($path), null, $w, $h);
else
RoxyImage::Resize(fixPath($path), null, $w, $h);
} else {
RoxyImage::Resize(fixPath($path), null, $w, $h);
}

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -30,7 +30,7 @@ $isAjax = (isset($_POST['method']) && $_POST['method'] == 'ajax');
$path = RoxyFile::FixPath(trim(empty($_POST['d']) ? getFilesPath() : $_POST['d']));
verifyPath($path);
$res = '';
$errors = $errorsExt = array();
$errors = $errorsExt = [];
if (is_dir(fixPath($path))) {
if (!empty($_FILES['files']) && is_array($_FILES['files']['tmp_name'])) {

View File

@ -1,6 +1,6 @@
<?php
/*
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
RoxyFileman - web based file manager. Ready to use with CKEditor, TinyMCE.
Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman - Lyubomir Arsov. All rights reserved.
@ -23,8 +23,7 @@
error_reporting(0);
ini_set('display_errors', 'off');
// You DON'T have to make any changes to this file. For Roxy Fileman user configuration see conf.json file.
define('BASE_PATH', dirname (__FILE__));
define('BASE_PATH', dirname(__FILE__));
date_default_timezone_set('UTC');
mb_internal_encoding("UTF-8");
mb_regex_encoding(mb_internal_encoding());
?>

View File

@ -1,2 +1,3 @@
<?php
include("../en/module_options.php");

View File

@ -1,2 +1,3 @@
<?php
include("../en/module_options.php");

View File

@ -20,7 +20,7 @@
*/
$sLangName = 'Deutsch';
$aLang = array(
$aLang = [
'charset' => 'UTF-8',
'TINYMCE_TOGGLE' => 'Editor zeigen/verstecken',
'TINYMCE_PLAINCMS' => '<b class="errorbox">Der Editor wurde für diese Seite deaktiviert, weil sie keine HTML Formatierung enthalten darf </b>',
@ -33,4 +33,4 @@ $aLang = array(
'SHOP_MODULE_aTinyMCE_extjs' => '<h3>Externe JS Abhängigkeiten</h3>',
'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'Komplette URL mit https://.',
'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Einstellungen &amp; Plugins',
);
];

View File

@ -20,7 +20,7 @@
*/
$sLangName = 'English';
$aLang = array(
$aLang = [
'charset' => 'UTF-8',
'TINYMCE_TOGGLE' => 'toggle editor',
'TINYMCE_PLAINCMS' => '<b class="errorbox">The editor was disabled for this page because it may not contain HTML code</b>',
@ -33,4 +33,4 @@ $aLang = array(
'SHOP_MODULE_aTinyMCE_extjs' => '<h3>external JS dependencies</h3> (e.g. for plugins)',
'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'Full URL with https://.',
'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Settings &amp; Plugins',
);
];

View File

@ -1,2 +1,3 @@
<?php
include("../en/module_options.php");

View File

@ -1,2 +1,3 @@
<?php
include("../en/module_options.php");

View File

@ -1,2 +1,3 @@
<?php
include("../en/module_options.php");

View File

@ -1,2 +1,3 @@
<?php
include("../en/module_options.php");

View File

@ -29,21 +29,21 @@ $aModule = [
'author' => 'Marat Bedoev, O3-Shop',
'url' => 'https://www.o3-shop.com/',
'extend' => [
OxidEsales\Eshop\Core\ViewConfig::class => O3\TinyMCE\Application\Core\ViewConfig::class
OxidEsales\Eshop\Core\ViewConfig::class => O3\TinyMCE\Application\Core\ViewConfig::class,
],
'controllers' => [
'tinyfilemanager' => O3\TinyMCE\Application\Controller\Admin\TinyFileManager::class
'tinyfilemanager' => O3\TinyMCE\Application\Controller\Admin\TinyFileManager::class,
],
'templates' => [
'TinyFilemanager.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/filemanager.tpl',
'EditorSwitch.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/editorswitch.tpl'
'EditorSwitch.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/editorswitch.tpl',
],
'blocks' => [
[
'template' => 'bottomnaviitem.tpl',
'block' => 'admin_bottomnaviitem',
'file' => 'Application/views/blocks/admin/bottomnaviitem_admin_bottomnaviitem.tpl'
]
'file' => 'Application/views/blocks/admin/bottomnaviitem_admin_bottomnaviitem.tpl',
],
],
'settings' => [
/* enabling tinyMCE for these classes */
@ -56,30 +56,30 @@ $aModule = [
"category_text",
"content_main",
"newsletter_main",
"news_text"
"news_text",
],
'position' => 0
'position' => 0,
],
[
'group' => 'tinyMceMain',
'name' => 'blTinyMCE_filemanager',
'type' => 'bool',
'value' => true,
'position' => 2
'position' => 2,
],
[
'group' => 'tinyMceMain',
'name' => 'sTinyMCE_apikey',
'type' => 'str',
'value' => '',
'position' => 3
'position' => 3,
],
[
'group' => 'tinyMceMain',
'name' => 'aTinyMCE_extjs',
'type' => 'arr',
'value' => [],
'position' => 4
]
]
'position' => 4,
],
],
];