From a55512cc6cb5258ae61aa154d31b2a901949b3d7 Mon Sep 17 00:00:00 2001 From: O3-Shop Date: Mon, 10 Apr 2023 22:47:06 +0200 Subject: [PATCH] reformat code --- .gitignore | 3 +- .php-cs-fixer.php | 29 +++ .../Controller/Admin/TinyFileManager.php | 59 +++--- Application/Core/TinyMCE/Configuration.php | 34 ++-- Application/Core/TinyMCE/Loader.php | 12 +- .../Core/TinyMCE/Options/AbstractOption.php | 2 +- Application/Core/TinyMCE/Options/BaseUrl.php | 2 +- .../Core/TinyMCE/Options/CacheSuffix.php | 2 +- .../Core/TinyMCE/Options/ContentCss.php | 2 +- .../Core/TinyMCE/Options/ContextMenu.php | 2 +- .../Core/TinyMCE/Options/DocumentBaseUrl.php | 2 +- .../Core/TinyMCE/Options/EntityEncoding.php | 2 +- .../Core/TinyMCE/Options/ExternalPlugins.php | 11 +- .../Core/TinyMCE/Options/FilemanagerUrl.php | 2 +- .../Core/TinyMCE/Options/ImageAdvtab.php | 2 +- Application/Core/TinyMCE/Options/Language.php | 10 +- .../Core/TinyMCE/Options/MaxHeight.php | 2 +- Application/Core/TinyMCE/Options/MaxWidth.php | 2 +- Application/Core/TinyMCE/Options/Menubar.php | 2 +- .../Core/TinyMCE/Options/MinHeight.php | 2 +- .../Core/TinyMCE/Options/OptionInterface.php | 2 +- Application/Core/TinyMCE/Options/Plugins.php | 10 +- Application/Core/TinyMCE/Options/Protect.php | 2 +- .../Options/QuickbarsInsertToolbar.php | 22 +-- .../Core/TinyMCE/Options/RelativeUrls.php | 2 +- Application/Core/TinyMCE/Options/Setup.php | 8 +- Application/Core/TinyMCE/Options/Toolbar.php | 6 +- .../Core/TinyMCE/Options/ToolbarMode.php | 2 +- .../Core/TinyMCE/Options/ToolbarSticky.php | 2 +- .../Core/TinyMCE/Plugins/AbstractPlugin.php | 2 +- Application/Core/TinyMCE/Plugins/Anchor.php | 4 +- .../Core/TinyMCE/Plugins/AutoResize.php | 2 +- Application/Core/TinyMCE/Plugins/Autolink.php | 2 +- Application/Core/TinyMCE/Plugins/Charmap.php | 4 +- Application/Core/TinyMCE/Plugins/Code.php | 4 +- Application/Core/TinyMCE/Plugins/FullPage.php | 4 +- .../Core/TinyMCE/Plugins/FullScreen.php | 4 +- Application/Core/TinyMCE/Plugins/Image.php | 4 +- .../Core/TinyMCE/Plugins/Legacyoutput.php | 2 +- Application/Core/TinyMCE/Plugins/Link.php | 4 +- Application/Core/TinyMCE/Plugins/Lists.php | 2 +- Application/Core/TinyMCE/Plugins/Media.php | 4 +- .../Core/TinyMCE/Plugins/Nonbreaking.php | 4 +- .../Core/TinyMCE/Plugins/Pagebreak.php | 4 +- .../Core/TinyMCE/Plugins/PluginInterface.php | 2 +- Application/Core/TinyMCE/Plugins/Preview.php | 4 +- .../Core/TinyMCE/Plugins/Quickbars.php | 2 +- Application/Core/TinyMCE/Plugins/Roxy.php | 2 +- .../Core/TinyMCE/Plugins/SearchReplace.php | 4 +- Application/Core/TinyMCE/Plugins/Table.php | 4 +- .../Core/TinyMCE/Plugins/Visualblocks.php | 4 +- .../Core/TinyMCE/Plugins/WordCount.php | 2 +- .../Core/TinyMCE/Toolbar/AbstractToolbar.php | 2 +- Application/Core/TinyMCE/Toolbar/Align.php | 2 +- .../Core/TinyMCE/Toolbar/Blockquote.php | 2 +- Application/Core/TinyMCE/Toolbar/Blocks.php | 2 +- Application/Core/TinyMCE/Toolbar/Color.php | 4 +- .../Core/TinyMCE/Toolbar/CopyPaste.php | 4 +- Application/Core/TinyMCE/Toolbar/Font.php | 2 +- Application/Core/TinyMCE/Toolbar/Indent.php | 2 +- Application/Core/TinyMCE/Toolbar/Lists.php | 2 +- .../Core/TinyMCE/Toolbar/RemoveFormat.php | 2 +- .../Core/TinyMCE/Toolbar/Subscript.php | 2 +- .../Core/TinyMCE/Toolbar/Superscript.php | 2 +- .../Core/TinyMCE/Toolbar/ToolbarInterface.php | 2 +- Application/Core/TinyMCE/Toolbar/Undo.php | 4 +- Application/Core/TinyMCE/ToolbarList.php | 2 +- Application/Core/TinyMCE/Utils.php | 2 +- Application/Core/config.php | 6 +- Application/fileman/php/copydir.php | 120 ++++++------- Application/fileman/php/copyfile.php | 94 +++++----- Application/fileman/php/createdir.php | 4 +- Application/fileman/php/deletedir.php | 4 +- Application/fileman/php/deletefile.php | 4 +- Application/fileman/php/dirtree.php | 170 +++++++++--------- Application/fileman/php/download.php | 74 ++++---- Application/fileman/php/downloaddir.php | 108 +++++------ Application/fileman/php/fileslist.php | 4 +- Application/fileman/php/functions.inc.php | 63 +++---- Application/fileman/php/movedir.php | 4 +- Application/fileman/php/movefile.php | 4 +- Application/fileman/php/renamedir.php | 4 +- Application/fileman/php/renamefile.php | 4 +- Application/fileman/php/security.inc.php | 56 +++--- Application/fileman/php/thumb.php | 9 +- Application/fileman/php/upload.php | 4 +- Application/fileman/system.inc.php | 5 +- Application/views/admin/cs/module_options.php | 1 + Application/views/admin/da/module_options.php | 1 + Application/views/admin/de/module_options.php | 4 +- Application/views/admin/en/module_options.php | 4 +- Application/views/admin/fr/module_options.php | 1 + Application/views/admin/it/module_options.php | 1 + Application/views/admin/nl/module_options.php | 1 + Application/views/admin/ru/module_options.php | 1 + metadata.php | 24 +-- 96 files changed, 589 insertions(+), 542 deletions(-) create mode 100644 .php-cs-fixer.php diff --git a/.gitignore b/.gitignore index 40b878d..af8d44b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -node_modules/ \ No newline at end of file +node_modules/ +.php_cs.cache diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..c8c2223 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,29 @@ + + * + * @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); \ No newline at end of file diff --git a/Application/Controller/Admin/TinyFileManager.php b/Application/Controller/Admin/TinyFileManager.php index 3a2505f..45dff0a 100755 --- a/Application/Controller/Admin/TinyFileManager.php +++ b/Application/Controller/Admin/TinyFileManager.php @@ -1,30 +1,29 @@ - - * - * @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"; - -} \ No newline at end of file + + * + * @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"; +} diff --git a/Application/Core/TinyMCE/Configuration.php b/Application/Core/TinyMCE/Configuration.php index 0b246f5..58be635 100644 --- a/Application/Core/TinyMCE/Configuration.php +++ b/Application/Core/TinyMCE/Configuration.php @@ -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)); } } diff --git a/Application/Core/TinyMCE/Loader.php b/Application/Core/TinyMCE/Loader.php index 5996c4e..ddb4215 100644 --- a/Application/Core/TinyMCE/Loader.php +++ b/Application/Core/TinyMCE/Loader.php @@ -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); } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/AbstractOption.php b/Application/Core/TinyMCE/Options/AbstractOption.php index 3b50fa8..a660ff6 100644 --- a/Application/Core/TinyMCE/Options/AbstractOption.php +++ b/Application/Core/TinyMCE/Options/AbstractOption.php @@ -55,4 +55,4 @@ abstract class AbstractOption implements OptionInterface { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/BaseUrl.php b/Application/Core/TinyMCE/Options/BaseUrl.php index ce65f25..3414112 100644 --- a/Application/Core/TinyMCE/Options/BaseUrl.php +++ b/Application/Core/TinyMCE/Options/BaseUrl.php @@ -43,4 +43,4 @@ class BaseUrl extends AbstractOption { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/CacheSuffix.php b/Application/Core/TinyMCE/Options/CacheSuffix.php index 33e8807..3756261 100644 --- a/Application/Core/TinyMCE/Options/CacheSuffix.php +++ b/Application/Core/TinyMCE/Options/CacheSuffix.php @@ -40,4 +40,4 @@ class CacheSuffix extends AbstractOption { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/ContentCss.php b/Application/Core/TinyMCE/Options/ContentCss.php index c9bde1a..8f63fa9 100644 --- a/Application/Core/TinyMCE/Options/ContentCss.php +++ b/Application/Core/TinyMCE/Options/ContentCss.php @@ -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', ] ); } diff --git a/Application/Core/TinyMCE/Options/ContextMenu.php b/Application/Core/TinyMCE/Options/ContextMenu.php index d4c55d1..6bc9e6e 100644 --- a/Application/Core/TinyMCE/Options/ContextMenu.php +++ b/Application/Core/TinyMCE/Options/ContextMenu.php @@ -36,4 +36,4 @@ class ContextMenu extends AbstractOption { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/DocumentBaseUrl.php b/Application/Core/TinyMCE/Options/DocumentBaseUrl.php index 33bf913..34b9a16 100644 --- a/Application/Core/TinyMCE/Options/DocumentBaseUrl.php +++ b/Application/Core/TinyMCE/Options/DocumentBaseUrl.php @@ -38,4 +38,4 @@ class DocumentBaseUrl extends AbstractOption { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/EntityEncoding.php b/Application/Core/TinyMCE/Options/EntityEncoding.php index 8765c3c..049adb4 100644 --- a/Application/Core/TinyMCE/Options/EntityEncoding.php +++ b/Application/Core/TinyMCE/Options/EntityEncoding.php @@ -40,4 +40,4 @@ class EntityEncoding extends AbstractOption { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/ExternalPlugins.php b/Application/Core/TinyMCE/Options/ExternalPlugins.php index fa1563e..26fe9f5 100644 --- a/Application/Core/TinyMCE/Options/ExternalPlugins.php +++ b/Application/Core/TinyMCE/Options/ExternalPlugins.php @@ -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.' }'; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/FilemanagerUrl.php b/Application/Core/TinyMCE/Options/FilemanagerUrl.php index 25f242a..0a88062 100644 --- a/Application/Core/TinyMCE/Options/FilemanagerUrl.php +++ b/Application/Core/TinyMCE/Options/FilemanagerUrl.php @@ -58,4 +58,4 @@ class FilemanagerUrl extends AbstractOption { return (bool) $this->loader->getShopConfig()->getConfigParam("blTinyMCE_filemanager"); } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/ImageAdvtab.php b/Application/Core/TinyMCE/Options/ImageAdvtab.php index 3b9567e..d29482f 100644 --- a/Application/Core/TinyMCE/Options/ImageAdvtab.php +++ b/Application/Core/TinyMCE/Options/ImageAdvtab.php @@ -31,4 +31,4 @@ class ImageAdvtab extends AbstractOption { return 'true'; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/Language.php b/Application/Core/TinyMCE/Options/Language.php index acd0031..0ea4e8b 100644 --- a/Application/Core/TinyMCE/Options/Language.php +++ b/Application/Core/TinyMCE/Options/Language.php @@ -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; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/MaxHeight.php b/Application/Core/TinyMCE/Options/MaxHeight.php index 14ef249..bed0cf4 100644 --- a/Application/Core/TinyMCE/Options/MaxHeight.php +++ b/Application/Core/TinyMCE/Options/MaxHeight.php @@ -36,4 +36,4 @@ class MaxHeight extends AbstractOption { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/MaxWidth.php b/Application/Core/TinyMCE/Options/MaxWidth.php index a37f182..deb4e91 100644 --- a/Application/Core/TinyMCE/Options/MaxWidth.php +++ b/Application/Core/TinyMCE/Options/MaxWidth.php @@ -36,4 +36,4 @@ class MaxWidth extends AbstractOption { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/Menubar.php b/Application/Core/TinyMCE/Options/Menubar.php index d9698bf..8b61351 100644 --- a/Application/Core/TinyMCE/Options/Menubar.php +++ b/Application/Core/TinyMCE/Options/Menubar.php @@ -36,4 +36,4 @@ class Menubar extends AbstractOption { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/MinHeight.php b/Application/Core/TinyMCE/Options/MinHeight.php index b08cbee..934c7ca 100644 --- a/Application/Core/TinyMCE/Options/MinHeight.php +++ b/Application/Core/TinyMCE/Options/MinHeight.php @@ -39,4 +39,4 @@ class MinHeight extends AbstractOption return '350'; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/OptionInterface.php b/Application/Core/TinyMCE/Options/OptionInterface.php index a2dd403..c7326f6 100644 --- a/Application/Core/TinyMCE/Options/OptionInterface.php +++ b/Application/Core/TinyMCE/Options/OptionInterface.php @@ -36,4 +36,4 @@ interface OptionInterface public function mustQuote(): bool; public function requireRegistration(): bool; -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/Plugins.php b/Application/Core/TinyMCE/Options/Plugins.php index 1d5dcd3..300eef4 100644 --- a/Application/Core/TinyMCE/Options/Plugins.php +++ b/Application/Core/TinyMCE/Options/Plugins.php @@ -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; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/Protect.php b/Application/Core/TinyMCE/Options/Protect.php index a46c25e..48d6a83 100644 --- a/Application/Core/TinyMCE/Options/Protect.php +++ b/Application/Core/TinyMCE/Options/Protect.php @@ -38,4 +38,4 @@ class Protect extends AbstractOption return '[ '.implode(', ', $protect).' ]'; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/QuickbarsInsertToolbar.php b/Application/Core/TinyMCE/Options/QuickbarsInsertToolbar.php index 5489b2b..597c6ca 100644 --- a/Application/Core/TinyMCE/Options/QuickbarsInsertToolbar.php +++ b/Application/Core/TinyMCE/Options/QuickbarsInsertToolbar.php @@ -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 diff --git a/Application/Core/TinyMCE/Options/RelativeUrls.php b/Application/Core/TinyMCE/Options/RelativeUrls.php index a8cbd86..e31035a 100644 --- a/Application/Core/TinyMCE/Options/RelativeUrls.php +++ b/Application/Core/TinyMCE/Options/RelativeUrls.php @@ -31,4 +31,4 @@ class RelativeUrls extends AbstractOption { return 'true'; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/Setup.php b/Application/Core/TinyMCE/Options/Setup.php index 7f48baf..f6a127c 100644 --- a/Application/Core/TinyMCE/Options/Setup.php +++ b/Application/Core/TinyMCE/Options/Setup.php @@ -30,10 +30,10 @@ class Setup extends AbstractOption public function get(): string { $js = << { - editor.options.register("filemanager_url", { processor: "string" }); - } -JS; + (editor) => { + editor.options.register("filemanager_url", { processor: "string" }); + } + JS; return trim((string) preg_replace('!\s+!', ' ', $js)); } diff --git a/Application/Core/TinyMCE/Options/Toolbar.php b/Application/Core/TinyMCE/Options/Toolbar.php index cc43d88..207dfb7 100644 --- a/Application/Core/TinyMCE/Options/Toolbar.php +++ b/Application/Core/TinyMCE/Options/Toolbar.php @@ -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; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/ToolbarMode.php b/Application/Core/TinyMCE/Options/ToolbarMode.php index 08eb232..ed4d0bb 100644 --- a/Application/Core/TinyMCE/Options/ToolbarMode.php +++ b/Application/Core/TinyMCE/Options/ToolbarMode.php @@ -36,4 +36,4 @@ class ToolbarMode extends AbstractOption { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Options/ToolbarSticky.php b/Application/Core/TinyMCE/Options/ToolbarSticky.php index dbea9a3..5fc8525 100644 --- a/Application/Core/TinyMCE/Options/ToolbarSticky.php +++ b/Application/Core/TinyMCE/Options/ToolbarSticky.php @@ -31,4 +31,4 @@ class ToolbarSticky extends AbstractOption { return 'true'; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/AbstractPlugin.php b/Application/Core/TinyMCE/Plugins/AbstractPlugin.php index ce1cc36..07b4d9e 100644 --- a/Application/Core/TinyMCE/Plugins/AbstractPlugin.php +++ b/Application/Core/TinyMCE/Plugins/AbstractPlugin.php @@ -46,4 +46,4 @@ abstract class AbstractPlugin implements PluginInterface { return true; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Anchor.php b/Application/Core/TinyMCE/Plugins/Anchor.php index 888f469..d79e2f7 100644 --- a/Application/Core/TinyMCE/Plugins/Anchor.php +++ b/Application/Core/TinyMCE/Plugins/Anchor.php @@ -33,7 +33,7 @@ class Anchor extends AbstractPlugin public function getToolbarElements(): array { return [ - 'anchor' + 'anchor', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/AutoResize.php b/Application/Core/TinyMCE/Plugins/AutoResize.php index d99ba34..bb10652 100644 --- a/Application/Core/TinyMCE/Plugins/AutoResize.php +++ b/Application/Core/TinyMCE/Plugins/AutoResize.php @@ -29,4 +29,4 @@ class AutoResize extends AbstractPlugin { return 'autoresize'; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Autolink.php b/Application/Core/TinyMCE/Plugins/Autolink.php index 2e999c4..566c3d3 100644 --- a/Application/Core/TinyMCE/Plugins/Autolink.php +++ b/Application/Core/TinyMCE/Plugins/Autolink.php @@ -29,4 +29,4 @@ class Autolink extends AbstractPlugin { return 'autolink'; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Charmap.php b/Application/Core/TinyMCE/Plugins/Charmap.php index dd01df5..7dcae4c 100644 --- a/Application/Core/TinyMCE/Plugins/Charmap.php +++ b/Application/Core/TinyMCE/Plugins/Charmap.php @@ -33,7 +33,7 @@ class Charmap extends AbstractPlugin public function getToolbarElements(): array { return [ - 'charmap' + 'charmap', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Code.php b/Application/Core/TinyMCE/Plugins/Code.php index 1f36276..260efb5 100644 --- a/Application/Core/TinyMCE/Plugins/Code.php +++ b/Application/Core/TinyMCE/Plugins/Code.php @@ -33,7 +33,7 @@ class Code extends AbstractPlugin public function getToolbarElements(): array { return [ - 'code' + 'code', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/FullPage.php b/Application/Core/TinyMCE/Plugins/FullPage.php index 36b4dbf..f1aa5ad 100644 --- a/Application/Core/TinyMCE/Plugins/FullPage.php +++ b/Application/Core/TinyMCE/Plugins/FullPage.php @@ -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'; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/FullScreen.php b/Application/Core/TinyMCE/Plugins/FullScreen.php index e33ea34..aa4f7da 100644 --- a/Application/Core/TinyMCE/Plugins/FullScreen.php +++ b/Application/Core/TinyMCE/Plugins/FullScreen.php @@ -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' ); } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Image.php b/Application/Core/TinyMCE/Plugins/Image.php index d8fff75..7a0f65b 100644 --- a/Application/Core/TinyMCE/Plugins/Image.php +++ b/Application/Core/TinyMCE/Plugins/Image.php @@ -33,7 +33,7 @@ class Image extends AbstractPlugin public function getToolbarElements(): array { return [ - 'image' + 'image', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Legacyoutput.php b/Application/Core/TinyMCE/Plugins/Legacyoutput.php index 4374be7..1501f5e 100644 --- a/Application/Core/TinyMCE/Plugins/Legacyoutput.php +++ b/Application/Core/TinyMCE/Plugins/Legacyoutput.php @@ -36,4 +36,4 @@ class Legacyoutput extends AbstractPlugin { return strtolower(Registry::getConfig()->getActiveView()->getClassKey()) === 'newsletter_main'; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Link.php b/Application/Core/TinyMCE/Plugins/Link.php index 236b5f0..6b67dbf 100644 --- a/Application/Core/TinyMCE/Plugins/Link.php +++ b/Application/Core/TinyMCE/Plugins/Link.php @@ -34,7 +34,7 @@ class Link extends AbstractPlugin { return [ 'link', - 'unlink' + 'unlink', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Lists.php b/Application/Core/TinyMCE/Plugins/Lists.php index ee03bc8..8c3b286 100644 --- a/Application/Core/TinyMCE/Plugins/Lists.php +++ b/Application/Core/TinyMCE/Plugins/Lists.php @@ -34,4 +34,4 @@ class Lists extends AbstractPlugin { return []; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Media.php b/Application/Core/TinyMCE/Plugins/Media.php index 4683095..4c5d6b8 100644 --- a/Application/Core/TinyMCE/Plugins/Media.php +++ b/Application/Core/TinyMCE/Plugins/Media.php @@ -33,7 +33,7 @@ class Media extends AbstractPlugin public function getToolbarElements(): array { return [ - 'media' + 'media', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Nonbreaking.php b/Application/Core/TinyMCE/Plugins/Nonbreaking.php index 0e7db21..edbeb10 100644 --- a/Application/Core/TinyMCE/Plugins/Nonbreaking.php +++ b/Application/Core/TinyMCE/Plugins/Nonbreaking.php @@ -36,7 +36,7 @@ class Nonbreaking extends AbstractPlugin public function getToolbarElements(): array { return [ - 'nonbreaking' + 'nonbreaking', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Pagebreak.php b/Application/Core/TinyMCE/Plugins/Pagebreak.php index ce2f91d..48cfed1 100644 --- a/Application/Core/TinyMCE/Plugins/Pagebreak.php +++ b/Application/Core/TinyMCE/Plugins/Pagebreak.php @@ -36,7 +36,7 @@ class Pagebreak extends AbstractPlugin public function getToolbarElements(): array { return [ - 'pagebreak' + 'pagebreak', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/PluginInterface.php b/Application/Core/TinyMCE/Plugins/PluginInterface.php index 400a079..7060841 100644 --- a/Application/Core/TinyMCE/Plugins/PluginInterface.php +++ b/Application/Core/TinyMCE/Plugins/PluginInterface.php @@ -37,4 +37,4 @@ interface PluginInterface public function requireRegistration(): bool; public function requireScript(): bool; -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Preview.php b/Application/Core/TinyMCE/Plugins/Preview.php index 9408767..97abafa 100644 --- a/Application/Core/TinyMCE/Plugins/Preview.php +++ b/Application/Core/TinyMCE/Plugins/Preview.php @@ -36,7 +36,7 @@ class Preview extends AbstractPlugin public function getToolbarElements(): array { return [ - 'preview' + 'preview', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Quickbars.php b/Application/Core/TinyMCE/Plugins/Quickbars.php index d8b7a9c..4445826 100644 --- a/Application/Core/TinyMCE/Plugins/Quickbars.php +++ b/Application/Core/TinyMCE/Plugins/Quickbars.php @@ -29,4 +29,4 @@ class Quickbars extends AbstractPlugin { return 'quickbars'; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Roxy.php b/Application/Core/TinyMCE/Plugins/Roxy.php index 397f1a4..b8659b8 100644 --- a/Application/Core/TinyMCE/Plugins/Roxy.php +++ b/Application/Core/TinyMCE/Plugins/Roxy.php @@ -54,4 +54,4 @@ class Roxy extends AbstractPlugin { return (bool) Registry::getConfig()->getConfigParam("blTinyMCE_filemanager"); } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/SearchReplace.php b/Application/Core/TinyMCE/Plugins/SearchReplace.php index 6c4f9fa..57d50c8 100644 --- a/Application/Core/TinyMCE/Plugins/SearchReplace.php +++ b/Application/Core/TinyMCE/Plugins/SearchReplace.php @@ -36,7 +36,7 @@ class SearchReplace extends AbstractPlugin public function getToolbarElements(): array { return [ - 'searchreplace' + 'searchreplace', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Table.php b/Application/Core/TinyMCE/Plugins/Table.php index bb10b0f..c47c457 100644 --- a/Application/Core/TinyMCE/Plugins/Table.php +++ b/Application/Core/TinyMCE/Plugins/Table.php @@ -36,7 +36,7 @@ class Table extends AbstractPlugin public function getToolbarElements(): array { return [ - 'table' + 'table', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/Visualblocks.php b/Application/Core/TinyMCE/Plugins/Visualblocks.php index b56e03c..39ce27b 100644 --- a/Application/Core/TinyMCE/Plugins/Visualblocks.php +++ b/Application/Core/TinyMCE/Plugins/Visualblocks.php @@ -36,7 +36,7 @@ class Visualblocks extends AbstractPlugin public function getToolbarElements(): array { return [ - 'visualblocks' + 'visualblocks', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Plugins/WordCount.php b/Application/Core/TinyMCE/Plugins/WordCount.php index af77516..76d8a76 100644 --- a/Application/Core/TinyMCE/Plugins/WordCount.php +++ b/Application/Core/TinyMCE/Plugins/WordCount.php @@ -37,4 +37,4 @@ class WordCount extends AbstractPlugin { return []; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/AbstractToolbar.php b/Application/Core/TinyMCE/Toolbar/AbstractToolbar.php index 73a2bf2..0866017 100644 --- a/Application/Core/TinyMCE/Toolbar/AbstractToolbar.php +++ b/Application/Core/TinyMCE/Toolbar/AbstractToolbar.php @@ -26,4 +26,4 @@ namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar; abstract class AbstractToolbar implements ToolbarInterface { abstract public function getButtons(): array; -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/Align.php b/Application/Core/TinyMCE/Toolbar/Align.php index de69701..2f9372d 100644 --- a/Application/Core/TinyMCE/Toolbar/Align.php +++ b/Application/Core/TinyMCE/Toolbar/Align.php @@ -34,4 +34,4 @@ class Align extends AbstractToolbar 'alignjustify', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/Blockquote.php b/Application/Core/TinyMCE/Toolbar/Blockquote.php index d0a9de1..941a9ac 100644 --- a/Application/Core/TinyMCE/Toolbar/Blockquote.php +++ b/Application/Core/TinyMCE/Toolbar/Blockquote.php @@ -31,4 +31,4 @@ class Blockquote extends AbstractToolbar 'blockquote', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/Blocks.php b/Application/Core/TinyMCE/Toolbar/Blocks.php index 085fbc3..0cb9bdd 100644 --- a/Application/Core/TinyMCE/Toolbar/Blocks.php +++ b/Application/Core/TinyMCE/Toolbar/Blocks.php @@ -31,4 +31,4 @@ class Blocks extends AbstractToolbar 'blocks', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/Color.php b/Application/Core/TinyMCE/Toolbar/Color.php index 0c1c04e..921ade3 100644 --- a/Application/Core/TinyMCE/Toolbar/Color.php +++ b/Application/Core/TinyMCE/Toolbar/Color.php @@ -29,7 +29,7 @@ class Color extends AbstractToolbar { return [ 'forecolor', - 'backcolor' + 'backcolor', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/CopyPaste.php b/Application/Core/TinyMCE/Toolbar/CopyPaste.php index 809fc7d..a9b9c3b 100644 --- a/Application/Core/TinyMCE/Toolbar/CopyPaste.php +++ b/Application/Core/TinyMCE/Toolbar/CopyPaste.php @@ -30,7 +30,7 @@ class CopyPaste extends AbstractToolbar return [ 'cut', 'copy', - 'paste' + 'paste', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/Font.php b/Application/Core/TinyMCE/Toolbar/Font.php index eab1b26..e1ffcfe 100644 --- a/Application/Core/TinyMCE/Toolbar/Font.php +++ b/Application/Core/TinyMCE/Toolbar/Font.php @@ -37,4 +37,4 @@ class Font extends AbstractToolbar 'strikethrough', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/Indent.php b/Application/Core/TinyMCE/Toolbar/Indent.php index 493fe4b..a42f7eb 100644 --- a/Application/Core/TinyMCE/Toolbar/Indent.php +++ b/Application/Core/TinyMCE/Toolbar/Indent.php @@ -32,4 +32,4 @@ class Indent extends AbstractToolbar 'indent', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/Lists.php b/Application/Core/TinyMCE/Toolbar/Lists.php index eb016bc..eb2abe9 100644 --- a/Application/Core/TinyMCE/Toolbar/Lists.php +++ b/Application/Core/TinyMCE/Toolbar/Lists.php @@ -32,4 +32,4 @@ class Lists extends AbstractToolbar 'numlist', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/RemoveFormat.php b/Application/Core/TinyMCE/Toolbar/RemoveFormat.php index 2b6d053..d007d8d 100644 --- a/Application/Core/TinyMCE/Toolbar/RemoveFormat.php +++ b/Application/Core/TinyMCE/Toolbar/RemoveFormat.php @@ -31,4 +31,4 @@ class RemoveFormat extends AbstractToolbar 'removeformat', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/Subscript.php b/Application/Core/TinyMCE/Toolbar/Subscript.php index 8c29e29..54e8aee 100644 --- a/Application/Core/TinyMCE/Toolbar/Subscript.php +++ b/Application/Core/TinyMCE/Toolbar/Subscript.php @@ -31,4 +31,4 @@ class Subscript extends AbstractToolbar 'subscript', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/Superscript.php b/Application/Core/TinyMCE/Toolbar/Superscript.php index 047a06d..98874d4 100644 --- a/Application/Core/TinyMCE/Toolbar/Superscript.php +++ b/Application/Core/TinyMCE/Toolbar/Superscript.php @@ -31,4 +31,4 @@ class Superscript extends AbstractToolbar 'superscript', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/ToolbarInterface.php b/Application/Core/TinyMCE/Toolbar/ToolbarInterface.php index 5106c68..ea205f5 100644 --- a/Application/Core/TinyMCE/Toolbar/ToolbarInterface.php +++ b/Application/Core/TinyMCE/Toolbar/ToolbarInterface.php @@ -29,4 +29,4 @@ interface ToolbarInterface * @return string[] */ public function getButtons(): array; -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/Toolbar/Undo.php b/Application/Core/TinyMCE/Toolbar/Undo.php index bb450a9..adc97d8 100644 --- a/Application/Core/TinyMCE/Toolbar/Undo.php +++ b/Application/Core/TinyMCE/Toolbar/Undo.php @@ -32,7 +32,7 @@ class Undo extends AbstractToolbar { return [ 'undo', - 'redo' + 'redo', ]; } -} \ No newline at end of file +} diff --git a/Application/Core/TinyMCE/ToolbarList.php b/Application/Core/TinyMCE/ToolbarList.php index fd2c518..72cc2be 100644 --- a/Application/Core/TinyMCE/ToolbarList.php +++ b/Application/Core/TinyMCE/ToolbarList.php @@ -56,7 +56,7 @@ class ToolbarList 'indent' => oxNew(Indent::class), 'blockquote' => oxNew(Blockquote::class), 'removeformat' => oxNew(RemoveFormat::class), - ] + ], ]; } } diff --git a/Application/Core/TinyMCE/Utils.php b/Application/Core/TinyMCE/Utils.php index a3ff6d6..5804f49 100644 --- a/Application/Core/TinyMCE/Utils.php +++ b/Application/Core/TinyMCE/Utils.php @@ -29,4 +29,4 @@ class Utils { return '"'.addslashes($string).'"'; } -} \ No newline at end of file +} diff --git a/Application/Core/config.php b/Application/Core/config.php index fe26963..9dc713f 100755 --- a/Application/Core/config.php +++ b/Application/Core/config.php @@ -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!!'); -} \ No newline at end of file + if ($_COOKIE['filemanagerkey'] !== md5($_SERVER['DOCUMENT_ROOT'].$_COOKIE['admin_sid'])) { + die('Access Denied!!'); + } +} diff --git a/Application/fileman/php/copydir.php b/Application/fileman/php/copydir.php index 63936b0..6956bea 100755 --- a/Application/fileman/php/copydir.php +++ b/Application/fileman/php/copydir.php @@ -1,60 +1,60 @@ -. - - 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')); -} \ No newline at end of file +. + + 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')); +} diff --git a/Application/fileman/php/copyfile.php b/Application/fileman/php/copyfile.php index 047ccda..f8da6da 100755 --- a/Application/fileman/php/copyfile.php +++ b/Application/fileman/php/copyfile.php @@ -1,47 +1,47 @@ -. - - 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')); -} \ No newline at end of file +. + + 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')); +} diff --git a/Application/fileman/php/createdir.php b/Application/fileman/php/createdir.php index 41cea7c..16370b0 100755 --- a/Application/fileman/php/createdir.php +++ b/Application/fileman/php/createdir.php @@ -1,6 +1,6 @@ . - - 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]"; \ No newline at end of file +. + + 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]"; diff --git a/Application/fileman/php/download.php b/Application/fileman/php/download.php index 8db641d..9bad9f6 100755 --- a/Application/fileman/php/download.php +++ b/Application/fileman/php/download.php @@ -1,37 +1,37 @@ -. - - 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)); -} \ No newline at end of file +. + + 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)); +} diff --git a/Application/fileman/php/downloaddir.php b/Application/fileman/php/downloaddir.php index e12c8a0..569d7a3 100755 --- a/Application/fileman/php/downloaddir.php +++ b/Application/fileman/php/downloaddir.php @@ -1,54 +1,54 @@ -. - - 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 ''; -} 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 ''; - } -} \ No newline at end of file +. + + 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 ''; +} 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 ''; + } +} diff --git a/Application/fileman/php/fileslist.php b/Application/fileman/php/fileslist.php index 080f559..f66c776 100755 --- a/Application/fileman/php/fileslist.php +++ b/Application/fileman/php/fileslist.php @@ -1,6 +1,6 @@ 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)); -} \ No newline at end of file +} diff --git a/Application/fileman/php/movedir.php b/Application/fileman/php/movedir.php index 7902cd6..4594b2c 100755 --- a/Application/fileman/php/movedir.php +++ b/Application/fileman/php/movedir.php @@ -1,6 +1,6 @@ . - - 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.'); -} \ No newline at end of file +. + + 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.'); + } +} diff --git a/Application/fileman/php/thumb.php b/Application/fileman/php/thumb.php index 66099ab..a1b1126 100755 --- a/Application/fileman/php/thumb.php +++ b/Application/fileman/php/thumb.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/Application/views/admin/cs/module_options.php b/Application/views/admin/cs/module_options.php index df5140d..b929ccc 100644 --- a/Application/views/admin/cs/module_options.php +++ b/Application/views/admin/cs/module_options.php @@ -1,2 +1,3 @@ 'UTF-8', 'TINYMCE_TOGGLE' => 'Editor zeigen/verstecken', 'TINYMCE_PLAINCMS' => 'Der Editor wurde für diese Seite deaktiviert, weil sie keine HTML Formatierung enthalten darf ', @@ -33,4 +33,4 @@ $aLang = array( 'SHOP_MODULE_aTinyMCE_extjs' => '

Externe JS Abhängigkeiten

', 'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'Komplette URL mit https://.', 'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Einstellungen & Plugins', -); +]; diff --git a/Application/views/admin/en/module_options.php b/Application/views/admin/en/module_options.php index 2ed852e..38e79e4 100644 --- a/Application/views/admin/en/module_options.php +++ b/Application/views/admin/en/module_options.php @@ -20,7 +20,7 @@ */ $sLangName = 'English'; -$aLang = array( +$aLang = [ 'charset' => 'UTF-8', 'TINYMCE_TOGGLE' => 'toggle editor', 'TINYMCE_PLAINCMS' => 'The editor was disabled for this page because it may not contain HTML code', @@ -33,4 +33,4 @@ $aLang = array( 'SHOP_MODULE_aTinyMCE_extjs' => '

external JS dependencies

(e.g. for plugins)', 'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'Full URL with https://.', 'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Settings & Plugins', -); \ No newline at end of file +]; diff --git a/Application/views/admin/fr/module_options.php b/Application/views/admin/fr/module_options.php index df5140d..b929ccc 100644 --- a/Application/views/admin/fr/module_options.php +++ b/Application/views/admin/fr/module_options.php @@ -1,2 +1,3 @@ '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, + ], + ], ];