8
0
Fork 0
Dieser Commit ist enthalten in:
O3-Shop 2023-04-10 22:47:06 +02:00
Ursprung 24c4264d87
Commit a55512cc6c
96 geänderte Dateien mit 589 neuen und 542 gelöschten Zeilen

1
.gitignore vendored
Datei anzeigen

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

29
.php-cs-fixer.php Normale Datei
Datei anzeigen

@ -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);

Datei anzeigen

@ -26,5 +26,4 @@ use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
class TinyFileManager extends AdminController class TinyFileManager extends AdminController
{ {
protected $_sThisTemplate = "TinyFilemanager.tpl"; protected $_sThisTemplate = "TinyFilemanager.tpl";
} }

Datei anzeigen

@ -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));
} }
} }

Datei anzeigen

@ -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();
} }

Datei anzeigen

@ -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',
] ]
); );
} }

Datei anzeigen

@ -35,19 +35,22 @@ 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.' }';

Datei anzeigen

@ -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,9 +44,9 @@ 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

Datei anzeigen

@ -34,7 +34,7 @@ class QuickbarsInsertToolbar extends AbstractOption
public function get(): string public function get(): string
{ {
return 'false'; return 'false';
/* /*
return implode( return implode(
' | ', ' | ',
[ [
@ -44,7 +44,7 @@ class QuickbarsInsertToolbar extends AbstractOption
'pagebreak' 'pagebreak'
] ]
); );
*/ */
} }
public function mustQuote(): bool public function mustQuote(): bool

Datei anzeigen

@ -33,7 +33,7 @@ class Setup extends AbstractOption
(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));
} }

Datei anzeigen

@ -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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -35,7 +35,7 @@ class FullPage extends AbstractPlugin
public function getToolbarElements(): array public function getToolbarElements(): array
{ {
return [ return [
'fullpage' 'fullpage',
]; ];
} }

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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),
] ],
]; ];
} }
} }

Datei anzeigen

@ -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!!');
}
} }

Datei anzeigen

@ -49,12 +49,12 @@ function getFilesNumber(string $path, string $type): array
} }
} }
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;
@ -62,7 +62,7 @@ function GetDirs(string $path, string $type): void
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);

Datei anzeigen

@ -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);

Datei anzeigen

@ -23,5 +23,7 @@
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.');
}
} }

Datei anzeigen

@ -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);
}

Datei anzeigen

@ -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'])) {

Datei anzeigen

@ -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());
?>

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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',
); ];

Datei anzeigen

@ -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',
); ];

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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,
] ],
] ],
]; ];