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 <?php
/** /**
* This file is part of O3-Shop TinyMCE editor module. * This file is part of O3-Shop TinyMCE editor module.
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3. * the Free Software Foundation, version 3.
* *
* This program is distributed in the hope that it will be useful, but * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with O3-Shop. If not, see <http://www.gnu.org/licenses/> * along with O3-Shop. If not, see <http://www.gnu.org/licenses/>
* *
* @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG * @copyright Copyright (c) 2022 Marat Bedoev, bestlife AG
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com) * @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) * @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/ */
namespace O3\TinyMCE\Application\Controller\Admin; namespace O3\TinyMCE\Application\Controller\Admin;
use OxidEsales\Eshop\Application\Controller\Admin\AdminController; use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
class TinyFileManager extends AdminController class TinyFileManager extends AdminController
{ {
protected $_sThisTemplate = "TinyFilemanager.tpl"; protected $_sThisTemplate = "TinyFilemanager.tpl";
}
}

View File

@ -75,7 +75,9 @@ class Configuration
protected function addOption(OptionInterface $optionInstance): void protected function addOption(OptionInterface $optionInstance): void
{ {
if (!$optionInstance->requireRegistration()) return; if (!$optionInstance->requireRegistration()) {
return;
}
$option = $optionInstance->get(); $option = $optionInstance->get();
@ -106,10 +108,10 @@ class Configuration
*/ */
protected function addIntegrateOptions(): void protected function addIntegrateOptions(): void
{ {
$this->addOption(oxNew( Setup::class, $this->loader)); $this->addOption(oxNew(Setup::class, $this->loader));
$this->addOption(oxNew( BaseUrl::class, $this->loader)); $this->addOption(oxNew(BaseUrl::class, $this->loader));
$this->addOption(oxNew( CacheSuffix::class, $this->loader)); $this->addOption(oxNew(CacheSuffix::class, $this->loader));
$this->addOption(oxNew( Selector::class, $this->loader)); $this->addOption(oxNew(Selector::class, $this->loader));
} }
protected function addGuiOptions(): void protected function addGuiOptions(): void
@ -127,37 +129,37 @@ class Configuration
protected function addContentAppearance(): void protected function addContentAppearance(): void
{ {
$this->addOption(oxNew(ContentCss::class,$this->loader)); $this->addOption(oxNew(ContentCss::class, $this->loader));
} }
protected function addContentFiltering(): void protected function addContentFiltering(): void
{ {
$this->addOption(oxNew(EntityEncoding::class,$this->loader)); $this->addOption(oxNew(EntityEncoding::class, $this->loader));
$this->addOption(oxNew(Protect::class,$this->loader)); $this->addOption(oxNew(Protect::class, $this->loader));
} }
protected function addLocalizationOptions(): void protected function addLocalizationOptions(): void
{ {
$this->addOption(oxNew( Language::class, $this->loader)); $this->addOption(oxNew(Language::class, $this->loader));
} }
protected function addUrlHandling(): void protected function addUrlHandling(): void
{ {
$this->addOption(oxNew( DocumentBaseUrl::class, $this->loader)); $this->addOption(oxNew(DocumentBaseUrl::class, $this->loader));
$this->addOption(oxNew( RelativeUrls::class, $this->loader)); $this->addOption(oxNew(RelativeUrls::class, $this->loader));
} }
protected function addPlugins(): void protected function addPlugins(): void
{ {
$this->addOption(oxNew( ImageAdvtab::class, $this->loader)); $this->addOption(oxNew(ImageAdvtab::class, $this->loader));
$this->addOption(oxNew( Plugins::class, $this->loader)); $this->addOption(oxNew(Plugins::class, $this->loader));
$this->addOption(oxNew( ExternalPlugins::class, $this->loader)); $this->addOption(oxNew(ExternalPlugins::class, $this->loader));
$this->addOption(oxNew( FilemanagerUrl::class, $this->loader)); $this->addOption(oxNew(FilemanagerUrl::class, $this->loader));
$this->addOption(oxNew(QuickbarsInsertToolbar::class, $this->loader)); $this->addOption(oxNew(QuickbarsInsertToolbar::class, $this->loader));
} }
protected function addToolbar(): void 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 public function getEditorCode(): string
{ {
if (!$this->isEnabledForCurrentController()) return ''; if (!$this->isEnabledForCurrentController()) {
return '';
}
if ($this->contentIsPlain()) { if ($this->contentIsPlain()) {
/** @var string $message */ /** @var string $message */
@ -71,9 +73,9 @@ class Loader
protected function isEnabledForCurrentController(): bool protected function isEnabledForCurrentController(): bool
{ {
/** @var string[] $aEnabledClasses */ /** @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 protected function contentIsPlain(): bool
{ {
/** @var BaseModel|Content $oEditObject */ /** @var BaseModel|Content $oEditObject */
$oEditObject = $this->getShopConfig()->getActiveView()->getViewDataElement( "edit" ); $oEditObject = $this->getShopConfig()->getActiveView()->getViewDataElement("edit");
return $oEditObject instanceof Content && $oEditObject->isPlain(); return $oEditObject instanceof Content && $oEditObject->isPlain();
} }
@ -160,4 +162,4 @@ class Loader
Registry::getConfig()->setGlobalParameter('includes' . $sSuffix, $aInclude); Registry::getConfig()->setGlobalParameter('includes' . $sSuffix, $aInclude);
} }
} }

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ class ContentCss extends AbstractOption
[ [
$this->darkMode ? $this->darkMode ?
'dark' : '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; return true;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,5 +23,7 @@ declare(strict_types=1);
function checkAccess(string $action): void 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 <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license For licensing, see LICENSE.txt or http://RoxyFileman.com/license
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License. the Free Software Foundation, either version 3 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/ */
include '../system.inc.php'; include '../system.inc.php';
include 'functions.inc.php'; include 'functions.inc.php';
verifyAction('COPYDIR'); verifyAction('COPYDIR');
checkAccess('COPYDIR'); checkAccess('COPYDIR');
$path = RoxyFile::FixPath(trim(empty($_POST['d']) ? '' : $_POST['d'])); $path = RoxyFile::FixPath(trim(empty($_POST['d']) ? '' : $_POST['d']));
$newPath = RoxyFile::FixPath(trim(empty($_POST['n']) ? '' : $_POST['n'])); $newPath = RoxyFile::FixPath(trim(empty($_POST['n']) ? '' : $_POST['n']));
verifyPath($path); verifyPath($path);
verifyPath($newPath); verifyPath($newPath);
function copyDir(string $path, string $newPath): void function copyDir(string $path, string $newPath): void
{ {
$items = listDirectory($path); $items = listDirectory($path);
if (!is_dir($newPath)) { if (!is_dir($newPath)) {
mkdir($newPath, (int) octdec(DIRPERMISSIONS)); mkdir($newPath, (int) octdec(DIRPERMISSIONS));
} }
foreach ($items as $item) { foreach ($items as $item) {
if ($item == '.' || $item == '..') { if ($item == '.' || $item == '..') {
continue; continue;
} }
$oldPath = RoxyFile::FixPath($path . '/' . $item); $oldPath = RoxyFile::FixPath($path . '/' . $item);
$tmpNewPath = RoxyFile::FixPath($newPath . '/' . $item); $tmpNewPath = RoxyFile::FixPath($newPath . '/' . $item);
if (is_file($oldPath)) { if (is_file($oldPath)) {
copy($oldPath, $tmpNewPath); copy($oldPath, $tmpNewPath);
} elseif (is_dir($oldPath)) { } elseif (is_dir($oldPath)) {
copyDir($oldPath, $tmpNewPath); copyDir($oldPath, $tmpNewPath);
} }
} }
} }
if (is_dir(fixPath($path))) { if (is_dir(fixPath($path))) {
copyDir(fixPath($path . '/'), fixPath($newPath . '/' . basename($path))); copyDir(fixPath($path . '/'), fixPath($newPath . '/' . basename($path)));
echo getSuccessRes(); echo getSuccessRes();
} else { } else {
echo getErrorRes(t('E_CopyDirInvalidPath')); echo getErrorRes(t('E_CopyDirInvalidPath'));
} }

View File

@ -1,47 +1,47 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license For licensing, see LICENSE.txt or http://RoxyFileman.com/license
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License. the Free Software Foundation, either version 3 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/ */
include '../system.inc.php'; include '../system.inc.php';
include 'functions.inc.php'; include 'functions.inc.php';
verifyAction('COPYFILE'); verifyAction('COPYFILE');
checkAccess('COPYFILE'); checkAccess('COPYFILE');
$path = RoxyFile::FixPath(trim(empty($_POST['f']) ? '' : $_POST['f'])); $path = RoxyFile::FixPath(trim(empty($_POST['f']) ? '' : $_POST['f']));
$newPath = RoxyFile::FixPath(trim(empty($_POST['n']) ? '' : $_POST['n'])); $newPath = RoxyFile::FixPath(trim(empty($_POST['n']) ? '' : $_POST['n']));
if (!$newPath) { if (!$newPath) {
$newPath = getFilesPath(); $newPath = getFilesPath();
} }
verifyPath($path); verifyPath($path);
verifyPath($newPath); verifyPath($newPath);
if (is_file(fixPath($path))) { if (is_file(fixPath($path))) {
$newPath = $newPath . '/' . RoxyFile::MakeUniqueFilename(fixPath($newPath), basename($path)); $newPath = $newPath . '/' . RoxyFile::MakeUniqueFilename(fixPath($newPath), basename($path));
if (copy(fixPath($path), fixPath($newPath))) { if (copy(fixPath($path), fixPath($newPath))) {
echo getSuccessRes(); echo getSuccessRes();
} else { } else {
echo getErrorRes(t('E_CopyFile')); echo getErrorRes(t('E_CopyFile'));
} }
} else { } else {
echo getErrorRes(t('E_CopyFileInvalisPath')); echo getErrorRes(t('E_CopyFileInvalisPath'));
} }

View File

@ -1,6 +1,6 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -38,4 +38,4 @@ if (is_dir(fixPath($path))) {
} }
} else { } else {
echo getErrorRes(t('E_CreateDirInvalidPath')); echo getErrorRes(t('E_CreateDirInvalidPath'));
} }

View File

@ -1,6 +1,6 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -41,4 +41,4 @@ if (is_dir(fixPath($path))) {
} }
} else { } else {
echo getErrorRes(t('E_DeleteDirInvalidPath') . ' ' . $path); echo getErrorRes(t('E_DeleteDirInvalidPath') . ' ' . $path);
} }

View File

@ -1,6 +1,6 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -37,4 +37,4 @@ if (is_file(fixPath($path))) {
} }
} else { } else {
echo getErrorRes(t('E_DeleteFileInvalidPath')); echo getErrorRes(t('E_DeleteFileInvalidPath'));
} }

View File

@ -1,85 +1,85 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license For licensing, see LICENSE.txt or http://RoxyFileman.com/license
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License. the Free Software Foundation, either version 3 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/ */
include '../system.inc.php'; include '../system.inc.php';
include 'functions.inc.php'; include 'functions.inc.php';
verifyAction('DIRLIST'); verifyAction('DIRLIST');
checkAccess('DIRLIST'); checkAccess('DIRLIST');
/** /**
* @param string $path * @param string $path
* @param string $type * @param string $type
* @return int[] * @return int[]
*/ */
function getFilesNumber(string $path, string $type): array function getFilesNumber(string $path, string $type): array
{ {
$files = 0; $files = 0;
$dirs = 0; $dirs = 0;
$tmp = listDirectory($path); $tmp = listDirectory($path);
foreach ($tmp as $ff) { foreach ($tmp as $ff) {
if ($ff == '.' || $ff == '..') { if ($ff == '.' || $ff == '..') {
continue; continue;
} elseif ( } elseif (
is_file($path . '/' . $ff) && is_file($path . '/' . $ff) &&
($type == '' || ($type == 'image' && RoxyFile::IsImage($ff)) || ($type == 'flash' && RoxyFile::IsFlash($ff))) ($type == '' || ($type == 'image' && RoxyFile::IsImage($ff)) || ($type == 'flash' && RoxyFile::IsFlash($ff)))
) { ) {
$files++; $files++;
} elseif (is_dir($path . '/' . $ff)) { } elseif (is_dir($path . '/' . $ff)) {
$dirs++; $dirs++;
} }
} }
return array('files' => $files, 'dirs' => $dirs); return ['files' => $files, 'dirs' => $dirs];
} }
function GetDirs(string $path, string $type): void function GetDirs(string $path, string $type): void
{ {
$ret = $sort = array(); $ret = $sort = [];
$files = listDirectory(fixPath($path)); $files = listDirectory(fixPath($path));
foreach ($files as $f) { foreach ($files as $f) {
$fullPath = $path . '/' . $f; $fullPath = $path . '/' . $f;
if (!is_dir(fixPath($fullPath)) || $f == '.' || $f == '..') { if (!is_dir(fixPath($fullPath)) || $f == '.' || $f == '..') {
continue; continue;
} }
$tmp = getFilesNumber(fixPath($fullPath), $type); $tmp = getFilesNumber(fixPath($fullPath), $type);
$ret[$fullPath] = array('path' => $fullPath, 'files' => $tmp['files'], 'dirs' => $tmp['dirs']); $ret[$fullPath] = ['path' => $fullPath, 'files' => $tmp['files'], 'dirs' => $tmp['dirs']];
$sort[$fullPath] = $f; $sort[$fullPath] = $f;
} }
natcasesort($sort); natcasesort($sort);
foreach ($sort as $k => $v) { foreach ($sort as $k => $v) {
$tmp = $ret[$k]; $tmp = $ret[$k];
echo ',{"p":"' . mb_ereg_replace('"', '\\"', $tmp['path']) . '","f":"' . $tmp['files'] . '","d":"' . $tmp['dirs'] . '"}'; echo ',{"p":"' . mb_ereg_replace('"', '\\"', $tmp['path']) . '","f":"' . $tmp['files'] . '","d":"' . $tmp['dirs'] . '"}';
GetDirs($tmp['path'], $type); GetDirs($tmp['path'], $type);
} }
} }
$type = (empty($_GET['type']) ? '' : strtolower($_GET['type'])); $type = (empty($_GET['type']) ? '' : strtolower($_GET['type']));
if ($type != 'image' && $type != 'flash') { if ($type != 'image' && $type != 'flash') {
$type = ''; $type = '';
} }
echo "[\n"; echo "[\n";
$tmp = getFilesNumber(fixPath(getFilesPath()), $type); $tmp = getFilesNumber(fixPath(getFilesPath()), $type);
echo '{"p":"' . mb_ereg_replace('"', '\\"', getFilesPath()) . '","f":"' . $tmp['files'] . '","d":"' . $tmp['dirs'] . '"}'; echo '{"p":"' . mb_ereg_replace('"', '\\"', getFilesPath()) . '","f":"' . $tmp['files'] . '","d":"' . $tmp['dirs'] . '"}';
GetDirs(getFilesPath(), $type); GetDirs(getFilesPath(), $type);
echo "\n]"; echo "\n]";

View File

@ -1,37 +1,37 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license For licensing, see LICENSE.txt or http://RoxyFileman.com/license
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License. the Free Software Foundation, either version 3 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/ */
include '../system.inc.php'; include '../system.inc.php';
include 'functions.inc.php'; include 'functions.inc.php';
verifyAction('DOWNLOAD'); verifyAction('DOWNLOAD');
checkAccess('DOWNLOAD'); checkAccess('DOWNLOAD');
$path = RoxyFile::FixPath(trim($_GET['f'])); $path = RoxyFile::FixPath(trim($_GET['f']));
verifyPath($path); verifyPath($path);
if (is_file(fixPath($path))) { if (is_file(fixPath($path))) {
$file = urldecode(basename($path)); $file = urldecode(basename($path));
header('Content-Disposition: attachment; filename="' . $file . '"'); header('Content-Disposition: attachment; filename="' . $file . '"');
header('Content-Type: application/force-download'); header('Content-Type: application/force-download');
readfile(fixPath($path)); readfile(fixPath($path));
} }

View File

@ -1,54 +1,54 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license For licensing, see LICENSE.txt or http://RoxyFileman.com/license
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License. the Free Software Foundation, either version 3 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/ */
include '../system.inc.php'; include '../system.inc.php';
include 'functions.inc.php'; include 'functions.inc.php';
@ini_set('memory_limit', '-1'); @ini_set('memory_limit', '-1');
verifyAction('DOWNLOADDIR'); verifyAction('DOWNLOADDIR');
checkAccess('DOWNLOADDIR'); checkAccess('DOWNLOADDIR');
$path = RoxyFile::FixPath(trim($_GET['d'])); $path = RoxyFile::FixPath(trim($_GET['d']));
verifyPath($path); verifyPath($path);
$path = fixPath($path); $path = fixPath($path);
if (!class_exists('ZipArchive')) { if (!class_exists('ZipArchive')) {
echo '<script>alert("Cannot create zip archive - ZipArchive class is missing. Check your PHP version and configuration");</script>'; echo '<script>alert("Cannot create zip archive - ZipArchive class is missing. Check your PHP version and configuration");</script>';
} else { } else {
try { try {
$filename = basename($path); $filename = basename($path);
$zipFile = $filename . '.zip'; $zipFile = $filename . '.zip';
$zipPath = BASE_PATH . '/tmp/' . $zipFile; $zipPath = BASE_PATH . '/tmp/' . $zipFile;
RoxyFile::ZipDir($path, $zipPath); RoxyFile::ZipDir($path, $zipPath);
header('Content-Disposition: attachment; filename="' . $zipFile . '"'); header('Content-Disposition: attachment; filename="' . $zipFile . '"');
header('Content-Type: application/force-download'); header('Content-Type: application/force-download');
readfile($zipPath); readfile($zipPath);
function deleteTmp(string $zipPath): void function deleteTmp(string $zipPath): void
{ {
@unlink($zipPath); @unlink($zipPath);
} }
register_shutdown_function('deleteTmp', $zipPath); register_shutdown_function('deleteTmp', $zipPath);
} catch (Exception $ex) { } catch (Exception $ex) {
echo '<script>alert("' . addslashes(t('E_CreateArchive')) . '");</script>'; echo '<script>alert("' . addslashes(t('E_CreateArchive')) . '");</script>';
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -57,4 +57,4 @@ foreach ($files as $f) {
} }
$str = mb_substr($str, 0, -1); $str = mb_substr($str, 0, -1);
echo $str; echo $str;
echo ']'; echo ']';

View File

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

View File

@ -1,6 +1,6 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -43,4 +43,4 @@ if (is_dir(fixPath($path))) {
} }
} else { } else {
echo getErrorRes(t('E_MoveDirInvalisPath')); echo getErrorRes(t('E_MoveDirInvalisPath'));
} }

View File

@ -1,6 +1,6 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -46,4 +46,4 @@ if (!RoxyFile::CanUploadFile(basename($newPath))) {
} }
} else { } else {
echo getErrorRes(t('E_MoveFileInvalisPath')); echo getErrorRes(t('E_MoveFileInvalisPath'));
} }

View File

@ -1,6 +1,6 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -40,4 +40,4 @@ if (is_dir(fixPath($path))) {
} }
} else { } else {
echo getErrorRes(t('E_RenameDirInvalidPath')); echo getErrorRes(t('E_RenameDirInvalidPath'));
} }

View File

@ -1,6 +1,6 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
@ -40,4 +40,4 @@ if (is_file(fixPath($path))) {
} }
} else { } else {
echo getErrorRes(t('E_RenameFileInvalidPath')); echo getErrorRes(t('E_RenameFileInvalidPath'));
} }

View File

@ -1,27 +1,29 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved.
For licensing, see LICENSE.txt or http://RoxyFileman.com/license For licensing, see LICENSE.txt or http://RoxyFileman.com/license
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License. the Free Software Foundation, either version 3 of the License.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Lyubomir Arsov, liubo (at) web-lobby.com Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/ */
function checkAccess(string $action): void function checkAccess(string $action): void
{ {
unset($action); unset($action);
if($_COOKIE['filemanagerkey'] !== md5_file("../../../../../../config.inc.php")) die('nice try, noob.'); if ($_COOKIE['filemanagerkey'] !== md5_file("../../../../../../config.inc.php")) {
} die('nice try, noob.');
}
}

View File

@ -1,6 +1,6 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. 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']); $h = intval(empty($_GET['height']) ? '0' : $_GET['height']);
header('Content-type: '.RoxyFile::GetMIMEType(basename($path))); header('Content-type: '.RoxyFile::GetMIMEType(basename($path)));
if($w && $h) if ($w && $h) {
RoxyImage::CropCenter(fixPath($path), null, $w, $h); RoxyImage::CropCenter(fixPath($path), null, $w, $h);
else } else {
RoxyImage::Resize(fixPath($path), null, $w, $h); RoxyImage::Resize(fixPath($path), null, $w, $h);
}

View File

@ -1,6 +1,6 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman.com - Lyubomir Arsov. All rights reserved. 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'])); $path = RoxyFile::FixPath(trim(empty($_POST['d']) ? getFilesPath() : $_POST['d']));
verifyPath($path); verifyPath($path);
$res = ''; $res = '';
$errors = $errorsExt = array(); $errors = $errorsExt = [];
if (is_dir(fixPath($path))) { if (is_dir(fixPath($path))) {
if (!empty($_FILES['files']) && is_array($_FILES['files']['tmp_name'])) { if (!empty($_FILES['files']) && is_array($_FILES['files']['tmp_name'])) {

View File

@ -1,6 +1,6 @@
<?php <?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. Can be easily integrated with any other WYSIWYG editor or CMS.
Copyright (C) 2013, RoxyFileman - Lyubomir Arsov. All rights reserved. Copyright (C) 2013, RoxyFileman - Lyubomir Arsov. All rights reserved.
@ -23,8 +23,7 @@
error_reporting(0); error_reporting(0);
ini_set('display_errors', 'off'); 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. // 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'); date_default_timezone_set('UTC');
mb_internal_encoding("UTF-8"); mb_internal_encoding("UTF-8");
mb_regex_encoding(mb_internal_encoding()); mb_regex_encoding(mb_internal_encoding());
?>

View File

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

View File

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

View File

@ -20,7 +20,7 @@
*/ */
$sLangName = 'Deutsch'; $sLangName = 'Deutsch';
$aLang = array( $aLang = [
'charset' => 'UTF-8', 'charset' => 'UTF-8',
'TINYMCE_TOGGLE' => 'Editor zeigen/verstecken', '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>', '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>', 'SHOP_MODULE_aTinyMCE_extjs' => '<h3>Externe JS Abhängigkeiten</h3>',
'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'Komplette URL mit https://.', 'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'Komplette URL mit https://.',
'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Einstellungen &amp; Plugins', 'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Einstellungen &amp; Plugins',
); ];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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