8
0

use improved filename sanitizing methods of ModCfg

Dieser Commit ist enthalten in:
Daniel Seifert 2021-02-22 10:07:26 +01:00
Ursprung 64c1d3f398
Commit 293a8a9427
4 geänderte Dateien mit 14 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -10,6 +10,7 @@
namespace D3\PdfDocuments\Application\Model\AbstractClasses;
use D3\ModCfg\Application\Model\d3filesystem;
use D3\PdfDocuments\Application\Model\Exceptions\pdfGeneratorExceptionAbstract;
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsGenericInterface as genericInterface;
use OxidEsales\Eshop\Core\Base;
@ -218,15 +219,15 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
{
// forced filename from setFilename()
if ($this->filename) {
return $this->addFilenameExtension(
$this->makeValidFileName(
return $this->makeValidFileName(
$this->addFilenameExtension(
$this->filename
)
);
}
return $this->addFilenameExtension(
$this->makeValidFileName(
return $this->makeValidFileName(
$this->addFilenameExtension(
$this->getTypeForFilename()
)
);
@ -257,10 +258,8 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
*/
public function makeValidFileName($sFilename)
{
$sFilename = preg_replace('/[\s]+/', '_', $sFilename);
$sFilename = preg_replace('/[^a-zA-Z0-9_\.-]/', '', $sFilename);
return str_replace(' ', '_', $sFilename);
$fs = oxNew(d3filesystem::class);
return $fs->filterFilename($sFilename);
}
/**

Datei anzeigen

@ -63,8 +63,8 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
{
// forced filename from setFilename()
if ($this->filename) {
return $this->addFilenameExtension(
$this->makeValidFileName(
return $this->makeValidFileName(
$this->addFilenameExtension(
$this->filename
)
);
@ -72,8 +72,8 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
$sTrimmedBillName = trim($this->getOrder()->getFieldData('oxbilllname'));
return $this->addFilenameExtension(
$this->makeValidFileName(
return $this->makeValidFileName(
$this->addFilenameExtension(
implode(
'_',
[

Datei anzeigen

@ -33,7 +33,8 @@
"require": {
"php": "^7.0",
"oxid-esales/oxideshop-ce": "6.3 - 6.6",
"spipu/html2pdf": "^5.2"
"spipu/html2pdf": "^5.2",
"d3/modcfg": "^5.3.6.000"
},
"autoload": {
"psr-4": {

Datei anzeigen

@ -10,6 +10,7 @@ title: Systemanforderungen
* 6.2.x
* Themes
* Diese Modul bindet sich nicht in Frontendthemes ein und ist daher davon unabhängig
* (D3) Modul-Connector ([kostenfrei bei D3 erhältlich](https://www.oxidmodule.com/connector/)) ab Version 5.3.6.0
* Template-Engine
* Smarty
* Installation via [Composer](https://getcomposer.org)