Commit 75ba74c0 authored by Michael@JTL's avatar Michael@JTL
Browse files

Merge branch 'master' into SHOP-4910

parents d1b5ed71 eb154576
......@@ -58,7 +58,11 @@
# other
/templates/NOVA/images/overlay/*
/admin/templates_c/*
!/admin/templates_c/.htaccess
!/admin/templates_c/.gitkeep
/templates_c/*
!/templates_c/.htaccess
!/templates_c/.gitkeep
/export/*
!/export/.htaccess
/jtllogs/*
......@@ -70,8 +74,6 @@
.DS_Store
.project
.settings
!/admin/templates_c/.gitkeep
!/templates_c/.gitkeep
!/dbeS/tmp/.gitkeep
!/dbeS/logs/.gitkeep
!/jtllogs/.gitkeep
......
......@@ -159,7 +159,7 @@ workflow:
echo "] remove default composer files.."
rm includes/composer.json includes/composer.lock
echo "] running phpcs install.."
./composer -q require squizlabs/php_codesniffer -d includes/
./composer -q require squizlabs/php_codesniffer:3.5.8 -d includes/
.CodeSnifferRunScript: &CodeSnifferRunScript |
# CODESNIFFER RUN
......@@ -336,4 +336,3 @@ tagsDeployment:
|| $CI_COMMIT_REF_NAME =~ /^release\/.*$/
tags:
- dev-checkout
......@@ -70,6 +70,7 @@
Header set X-UA-Compatible "IE=edge"
Header set X-Content-Type-Options "nosniff"
Header unset X-Powered-By
Header set X-Frame-Options "SAMEORIGIN"
<FilesMatch "\.(eot|otf|tt[cf]|woff2?)$">
Header set Access-Control-Allow-Origin "*"
......@@ -80,27 +81,6 @@
</FilesMatch>
</IfModule>
<Files dbeS/*>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order Deny,Allow
Deny from all
</IfModule>
</Files>
<Files dbeS/*.php>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order Allow,Deny
Allow from all
</IfModule>
</Files>
<IfModule mod_rewrite.c>
RewriteEngine on
......@@ -132,7 +112,9 @@
RewriteRule ^export/((sitemap_).*\.(xml|txt)(\.gz)?)$ $1 [L]
RewriteRule ^asset/(.*)$ includes/libs/minify/?g=$1 [QSA,L]
RewriteRule ^static/(.*)$ templates_c/min/$1 [QSA,L]
RewriteRule ^dbeS/tmp/(.*)$ - [F,L]
RewriteRule ^dbeS/(.*)\.php$ dbeS/index.php?id=$1 [QSA,L]
RewriteRule ^dbeS/(.*)$ - [F,L]
RewriteRule ^robots.txt$ robots.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
......
5.0.2-alpha
5.1.0-alpha
<?php
use JTL\Alert\Alert;
use JTL\DB\ReturnType;
use JTL\Extensions\SelectionWizard\Group;
use JTL\Extensions\SelectionWizard\Question;
use JTL\Extensions\SelectionWizard\Wizard;
......@@ -19,6 +18,7 @@ $step = '';
$nice = Nice::getInstance();
$tab = 'uebersicht';
$alertHelper = Shop::Container()->getAlertService();
$postData = Text::filterXSS($_POST);
Shop::Container()->getGetText()->loadConfigLocales();
setzeSprache();
......@@ -31,14 +31,14 @@ if ($nice->checkErweiterung(SHOP_ERWEITERUNG_AUSWAHLASSISTENT)) {
if (mb_strlen(Request::verifyGPDataString('tab')) > 0) {
$tab = Request::verifyGPDataString('tab');
}
if (isset($_POST['a']) && $csrfOK) {
if ($_POST['a'] === 'newGrp') {
if (isset($postData['a']) && $csrfOK) {
if ($postData['a'] === 'newGrp') {
$step = 'edit-group';
} elseif ($_POST['a'] === 'newQuest') {
} elseif ($postData['a'] === 'newQuest') {
$step = 'edit-question';
} elseif ($_POST['a'] === 'addQuest') {
} elseif ($postData['a'] === 'addQuest') {
$question->cFrage = htmlspecialchars(
$_POST['cFrage'],
$postData['cFrage'],
ENT_COMPAT | ENT_HTML401,
JTL_CHARSET
);
......@@ -60,9 +60,9 @@ if ($nice->checkErweiterung(SHOP_ERWEITERUNG_AUSWAHLASSISTENT)) {
$tab = 'uebersicht';
} elseif (is_array($checks) && count($checks) > 0) {
$alertHelper->addAlert(Alert::TYPE_ERROR, __('errorFillRequired'), 'errorFillRequired');
$smarty->assign('cPost_arr', Text::filterXSS($_POST))
$smarty->assign('cPost_arr', $postData)
->assign('cPlausi_arr', $checks)
->assign('kAuswahlAssistentFrage', (int)($_POST['kAuswahlAssistentFrage'] ?? 0));
->assign('kAuswahlAssistentFrage', (int)($postData['kAuswahlAssistentFrage'] ?? 0));
}
}
} elseif ($csrfOK && Request::getVar('a') === 'delQuest' && Request::getInt('q') > 0) {
......@@ -76,23 +76,23 @@ if ($nice->checkErweiterung(SHOP_ERWEITERUNG_AUSWAHLASSISTENT)) {
$smarty->assign('oFrage', new Question(Request::getInt('q'), false));
}
if (isset($_POST['a']) && $csrfOK) {
if ($_POST['a'] === 'addGrp') {
if (isset($postData['a']) && $csrfOK) {
if ($postData['a'] === 'addGrp') {
$group->kSprache = $languageID;
$group->cName = htmlspecialchars(
$_POST['cName'],
$postData['cName'],
ENT_COMPAT | ENT_HTML401,
JTL_CHARSET
);
$group->cBeschreibung = $_POST['cBeschreibung'];
$group->cBeschreibung = $postData['cBeschreibung'];
$group->nAktiv = Request::postInt('nAktiv');
$checks = [];
if (Request::postInt('kAuswahlAssistentGruppe') > 0) {
$group->kAuswahlAssistentGruppe = Request::postInt('kAuswahlAssistentGruppe');
$checks = $group->updateGroup($_POST);
$checks = $group->updateGroup($postData);
} else {
$checks = $group->saveGroup($_POST);
$checks = $group->saveGroup($postData);
}
if ((!is_array($checks) && $checks) || count($checks) === 0) {
$step = 'uebersicht';
......@@ -101,21 +101,21 @@ if ($nice->checkErweiterung(SHOP_ERWEITERUNG_AUSWAHLASSISTENT)) {
} elseif (is_array($checks) && count($checks) > 0) {
$step = 'edit-group';
$alertHelper->addAlert(Alert::TYPE_ERROR, __('errorFillRequired'), 'errorFillRequired');
$smarty->assign('cPost_arr', Text::filterXSS($_POST))
$smarty->assign('cPost_arr', $postData)
->assign('cPlausi_arr', $checks)
->assign('kAuswahlAssistentGruppe', Request::postInt('kAuswahlAssistentGruppe'));
}
} elseif ($_POST['a'] === 'delGrp') {
if ($group->deleteGroup($_POST['kAuswahlAssistentGruppe_arr'] ?? [])) {
} elseif ($postData['a'] === 'delGrp') {
if ($group->deleteGroup($postData['kAuswahlAssistentGruppe_arr'] ?? [])) {
$alertHelper->addAlert(Alert::TYPE_SUCCESS, __('successGroupDeleted'), 'successGroupDeleted');
} else {
$alertHelper->addAlert(Alert::TYPE_ERROR, __('errorGroupDeleted'), 'errorGroupDeleted');
}
} elseif ($_POST['a'] === 'saveSettings') {
} elseif ($postData['a'] === 'saveSettings') {
$step = 'uebersicht';
$alertHelper->addAlert(
Alert::TYPE_SUCCESS,
saveAdminSectionSettings(CONF_AUSWAHLASSISTENT, $_POST),
saveAdminSectionSettings(CONF_AUSWAHLASSISTENT, $postData),
'saveSettings'
);
}
......@@ -139,12 +139,11 @@ if ($nice->checkErweiterung(SHOP_ERWEITERUNG_AUSWAHLASSISTENT)) {
$join = ' JOIN tmerkmalsprache ON tmerkmalsprache.kMerkmal = tmerkmal.kMerkmal
AND tmerkmalsprache.kSprache = ' . $languageID;
}
$attributes = Shop::Container()->getDB()->query(
$attributes = Shop::Container()->getDB()->getObjects(
'SELECT ' . $select . '
FROM tmerkmal
' . $join . '
ORDER BY tmerkmal.nSort',
ReturnType::ARRAY_OF_OBJECTS
ORDER BY tmerkmal.nSort'
);
$smarty->assign('oMerkmal_arr', $attributes)
->assign(
......
......@@ -5,7 +5,9 @@ use JTL\Boxes\Admin\BoxAdmin;
use JTL\Customer\CustomerGroup;
use JTL\Helpers\Form;
use JTL\Helpers\Request;
use JTL\Helpers\Text;
use JTL\ImageMap;
use JTL\Media\Image;
use JTL\Pagination\Pagination;
use JTL\Shop;
......@@ -17,17 +19,18 @@ require_once PFAD_ROOT . PFAD_ADMIN . PFAD_INCLUDES . 'banner_inc.php';
$action = (isset($_REQUEST['action']) && Form::validateToken()) ? $_REQUEST['action'] : 'view';
$alertHelper = Shop::Container()->getAlertService();
$db = Shop::Container()->getDB();
if (!empty($_POST) && (isset($_POST['cName']) || isset($_POST['kImageMap'])) && Form::validateToken()) {
$postData = Text::filterXSS($_POST);
if ((isset($postData['cName']) || isset($postData['kImageMap'])) && Form::validateToken()) {
$checks = [];
$imageMap = new ImageMap($db);
$imageMapID = Request::postInt('kImageMap', null);
$name = htmlspecialchars($_POST['cName'], ENT_COMPAT | ENT_HTML401, JTL_CHARSET);
$name = htmlspecialchars($postData['cName'], ENT_COMPAT | ENT_HTML401, JTL_CHARSET);
if (mb_strlen($name) === 0) {
$checks['cName'] = 1;
}
$bannerPath = Request::postVar('cPath', '') !== '' ? $_POST['cPath'] : null;
$bannerPath = Request::postVar('cPath', '') !== '' ? $postData['cPath'] : null;
if (isset($_FILES['oFile'])
&& $_FILES['oFile']['error'] === UPLOAD_ERR_OK
&& Image::isImageUpload($_FILES['oFile'])
&& move_uploaded_file($_FILES['oFile']['tmp_name'], PFAD_ROOT . PFAD_BILDER_BANNER . $_FILES['oFile']['name'])
) {
$bannerPath = $_FILES['oFile']['name'];
......@@ -39,7 +42,7 @@ if (!empty($_POST) && (isset($_POST['cName']) || isset($_POST['kImageMap'])) &&
$dateUntil = null;
if (Request::postVar('vDatum') !== '') {
try {
$dateFrom = new DateTime($_POST['vDatum']);
$dateFrom = new DateTime($postData['vDatum']);
$dateFrom = $dateFrom->format('Y-m-d H:i:s');
} catch (Exception $e) {
$checks['vDatum'] = 1;
......@@ -47,7 +50,7 @@ if (!empty($_POST) && (isset($_POST['cName']) || isset($_POST['kImageMap'])) &&
}
if (Request::postVar('bDatum') !== '') {
try {
$dateUntil = new DateTime($_POST['bDatum']);
$dateUntil = new DateTime($postData['bDatum']);
$dateUntil = $dateUntil->format('Y-m-d H:i:s');
} catch (Exception $e) {
$checks['bDatum'] = 1;
......@@ -69,13 +72,13 @@ if (!empty($_POST) && (isset($_POST['cName']) || isset($_POST['kImageMap'])) &&
$languageID = Request::postInt('kSprache');
$customerGroupID = Request::postInt('kKundengruppe');
$pageType = Request::postInt('nSeitenTyp');
$key = $_POST['cKey'];
$key = $postData['cKey'];
$keyValue = '';
$value = '';
if ($pageType === PAGE_ARTIKEL) {
$key = 'kArtikel';
$keyValue = 'article_key';
$value = $_POST[$keyValue] ?? null;
$value = $postData[$keyValue] ?? null;
} elseif ($pageType === PAGE_ARTIKELLISTE) {
$filters = [
'kMerkmalWert' => 'attribute_key',
......@@ -84,11 +87,11 @@ if (!empty($_POST) && (isset($_POST['cName']) || isset($_POST['kImageMap'])) &&
'cSuche' => 'keycSuche'
];
$keyValue = $filters[$key];
$value = $_POST[$keyValue] ?? null;
$value = $postData[$keyValue] ?? null;
} elseif ($pageType === PAGE_EIGENE) {
$key = 'kLink';
$keyValue = 'link_key';
$value = $_POST[$keyValue] ?? null;
$value = $postData[$keyValue] ?? null;
}
if (!empty($keyValue) && empty($value)) {
......@@ -109,7 +112,7 @@ if (!empty($_POST) && (isset($_POST['cName']) || isset($_POST['kImageMap'])) &&
$ext->kInitial = $imageMapID;
$ins = $db->insert('textensionpoint', $ext);
Shop::Container()->getCache()->flushTags([CACHING_GROUP_CORE]);
if ($imageMapID && $ins > 0) {
$action = 'view';
$alertHelper->addAlert(Alert::TYPE_SUCCESS, __('successSave'), 'successSave');
......@@ -132,18 +135,18 @@ if (!empty($_POST) && (isset($_POST['cName']) || isset($_POST['kImageMap'])) &&
$alertHelper->addAlert(Alert::TYPE_ERROR, __('errorImageSizeTooLarge'), 'errorImageSizeTooLarge');
}
$smarty->assign('cName', $_POST['cName'] ?? null)
->assign('vDatum', $_POST['vDatum'] ?? null)
->assign('bDatum', $_POST['bDatum'] ?? null)
->assign('kSprache', $_POST['kSprache'] ?? null)
->assign('kKundengruppe', $_POST['kKundengruppe'] ?? null)
->assign('nSeitenTyp', $_POST['nSeitenTyp'] ?? null)
->assign('cKey', $_POST['cKey'] ?? null)
->assign('categories_key', $_POST['categories_key'] ?? null)
->assign('attribute_key', $_POST['attribute_key'] ?? null)
->assign('tag_key', $_POST['tag_key'] ?? null)
->assign('manufacturer_key', $_POST['manufacturer_key'] ?? null)
->assign('keycSuche', $_POST['keycSuche'] ?? null);
$smarty->assign('cName', $postData['cName'] ?? null)
->assign('vDatum', $postData['vDatum'] ?? null)
->assign('bDatum', $postData['bDatum'] ?? null)
->assign('kSprache', $postData['kSprache'] ?? null)
->assign('kKundengruppe', $postData['kKundengruppe'] ?? null)
->assign('nSeitenTyp', $postData['nSeitenTyp'] ?? null)
->assign('cKey', $postData['cKey'] ?? null)
->assign('categories_key', $postData['categories_key'] ?? null)
->assign('attribute_key', $postData['attribute_key'] ?? null)
->assign('tag_key', $postData['tag_key'] ?? null)
->assign('manufacturer_key', $postData['manufacturer_key'] ?? null)
->assign('keycSuche', $postData['keycSuche'] ?? null);
}
}
switch ($action) {
......@@ -159,7 +162,7 @@ switch ($action) {
break;
case 'edit':
$id = (int)($_POST['id'] ?? $_POST['kImageMap']);
$id = (int)($postData['id'] ?? $postData['kImageMap']);
$imageMap = holeBanner($id);
$smarty->assign('oExtension', holeExtension($id))
......@@ -183,6 +186,7 @@ switch ($action) {
case 'delete':
if (entferneBanner(Request::postInt('id'))) {
Shop::Container()->getCache()->flushTags([CACHING_GROUP_CORE]);
$alertHelper->addAlert(Alert::TYPE_SUCCESS, __('successDeleted'), 'successDeleted');
} else {
$alertHelper->addAlert(Alert::TYPE_ERROR, __('errorDeleted'), 'errorDeleted');
......
......@@ -29,7 +29,7 @@ if (Request::verifyGPCDataInt('zuruecksetzen') === 1 && Form::validateToken()) {
} else {
$alertHelper->addAlert(Alert::TYPE_ERROR, __('errorAtLeastOneOrder'), 'errorAtLeastOneOrder');
}
} elseif (Request::verifyGPCDataInt('Suche') === 1) { // Bestellnummer gesucht
} elseif (Request::verifyGPCDataInt('Suche') === 1 && Form::validateToken()) {
$query = Text::filterXSS(Request::verifyGPDataString('cSuche'));
if (mb_strlen($query) > 0) {
$searchFilter = $query;
......
......@@ -50,6 +50,10 @@ if (isset($_POST['speichern']) && Form::validateToken()) {
$cachesToClear[] = $media::getClass(Image::TYPE_CHARACTERISTIC);
continue;
}
if (strpos($item, 'opc') !== false) {
$cachesToClear[] = $media::getClass(Image::TYPE_OPC);
continue;
}
if (strpos($item, 'konfiggruppe') !== false) {
$cachesToClear[] = $media::getClass(Image::TYPE_CONFIGGROUP);
continue;
......@@ -85,6 +89,7 @@ $indices = [
'hersteller' => __('manufacturer'),
'merkmal' => __('attributes'),
'merkmalwert' => __('attributeValues'),
'opc' => 'OPC',
'konfiggruppe' => __('configGroups'),
'news' => __('news'),
'newskategorie' => __('newscategory')
......
......@@ -4,9 +4,9 @@ use JTL\Alert\Alert;
use JTL\Backend\Revision;
use JTL\Boxes\Admin\BoxAdmin;
use JTL\Boxes\Type;
use JTL\DB\ReturnType;
use JTL\Helpers\Form;
use JTL\Helpers\Request;
use JTL\Helpers\Text;
use JTL\Link\LinkGroupInterface;
use JTL\Shop;
use function Functional\map;
......@@ -20,7 +20,8 @@ $oAccount->permission('BOXES_VIEW', true, true);
$boxService = Shop::Container()->getBoxService();
$alertHelper = Shop::Container()->getAlertService();
$boxAdmin = new BoxAdmin(Shop::Container()->getDB());
$db = Shop::Container()->getDB();
$boxAdmin = new BoxAdmin($db);
$pageID = Request::verifyGPCDataInt('page');
$linkID = Request::verifyGPCDataInt('linkID');
$boxID = Request::verifyGPCDataInt('item');
......@@ -37,9 +38,8 @@ if (Request::postInt('einstellungen') > 0) {
case 'delete-invisible':
if (!empty($_POST['kInvisibleBox']) && count($_POST['kInvisibleBox']) > 0) {
$cnt = 0;
foreach ($_POST['kInvisibleBox'] as $box) {
$ok = $boxAdmin->delete((int)$box);
if ($box) {
foreach ($_POST['kInvisibleBox'] as $boxID) {
if ($boxAdmin->delete((int)$boxID)) {
++$cnt;
}
}
......@@ -48,7 +48,7 @@ if (Request::postInt('einstellungen') > 0) {
break;
case 'new':
$position = $_REQUEST['position'];
$position = Text::filterXSS($_REQUEST['position']);
$containerID = $_REQUEST['container'] ?? 0;
if ($boxID === 0) {
// Neuer Container
......@@ -78,10 +78,10 @@ if (Request::postInt('einstellungen') > 0) {
break;
case 'edit_mode':
$oBox = $boxAdmin->getByID($boxID);
$box = $boxAdmin->getByID($boxID);
// revisions need this as a different formatted array
$revisionData = [];
foreach ($oBox->oSprache_arr as $lang) {
foreach ($box->oSprache_arr as $lang) {
$revisionData[$lang->cISO] = $lang;
}
$links = Shop::Container()->getLinkService()->getAllLinkGroups()->filter(
......@@ -89,35 +89,35 @@ if (Request::postInt('einstellungen') > 0) {
return $e->isSpecial() === false;
}
);
$smarty->assign('oEditBox', $oBox)
$smarty->assign('oEditBox', $box)
->assign('revisionData', $revisionData)
->assign('oLink_arr', $links);
break;
case 'edit':
$cTitel = $_REQUEST['boxtitle'];
$type = $_REQUEST['typ'];
$title = Text::filterXSS($_REQUEST['boxtitle']);
$type = Text::filterXSS($_REQUEST['typ']);
if ($type === 'text') {
$oldBox = $boxAdmin->getByID($boxID);
if ($oldBox->supportsRevisions === true) {
$revision = new Revision(Shop::Container()->getDB());
$revision = new Revision($db);
$revision->addRevision('box', $boxID, true);
}
$ok = $boxAdmin->update($boxID, $cTitel);
$ok = $boxAdmin->update($boxID, $title);
if ($ok) {
foreach ($_REQUEST['title'] as $cISO => $cTitel) {
$cInhalt = $_REQUEST['text'][$cISO];
$ok = $boxAdmin->updateLanguage($boxID, $cISO, $cTitel, $cInhalt);
foreach ($_REQUEST['title'] as $iso => $title) {
$content = $_REQUEST['text'][$iso];
$ok = $boxAdmin->updateLanguage($boxID, $iso, $title, $content);
if (!$ok) {
break;
}
}
}
} elseif (($type === Type::LINK && $linkID > 0) || $type === Type::CATBOX) {
$ok = $boxAdmin->update($boxID, $cTitel, $linkID);
$ok = $boxAdmin->update($boxID, $title, $linkID);
if ($ok) {
foreach ($_REQUEST['title'] as $cISO => $cTitel) {
$ok = $boxAdmin->updateLanguage($boxID, $cISO, $cTitel, '');
foreach ($_REQUEST['title'] as $iso => $title) {
$ok = $boxAdmin->updateLanguage($boxID, $iso, $title, '');
if (!$ok) {
break;
}
......@@ -133,7 +133,7 @@ if (Request::postInt('einstellungen') > 0) {
break;
case 'resort':
$position = $_REQUEST['position'];
$position = Text::filterXSS($_REQUEST['position']);
$boxes = array_map('\intval', $_REQUEST['box'] ?? []);
$sort = array_map('\intval', $_REQUEST['sort'] ?? []);
$active = array_map('\intval', $_REQUEST['aktiv'] ?? []);
......@@ -141,10 +141,16 @@ if (Request::postInt('einstellungen') > 0) {
$boxCount = count($boxes);
$show = $_REQUEST['box_show'] ?? false;
$ok = $boxAdmin->setVisibility($pageID, $position, $show);
foreach ($boxes as $i => $box) {
$idx = 'box-filter-' . $box;
$boxAdmin->sort($box, $pageID, $sort[$i], in_array($box, $active, true), in_array($box, $ignore, true));
$boxAdmin->filterBoxVisibility((int)$box, $pageID, $_POST[$idx] ?? '');
foreach ($boxes as $i => $boxIDtoSort) {
$idx = 'box-filter-' . $boxIDtoSort;
$boxAdmin->sort(
$boxIDtoSort,
$pageID,
$sort[$i],
in_array($boxIDtoSort, $active, true),
in_array($boxIDtoSort, $ignore, true)
);
$boxAdmin->filterBoxVisibility($boxIDtoSort, $pageID, $_POST[$idx] ?? '');
}
// see jtlshop/jtl-shop/issues#544 && jtlshop/shop4#41
if ($position !== 'left' || $pageID > 0) {
......@@ -168,7 +174,7 @@ if (Request::postInt('einstellungen') > 0) {
break;
case 'container':
$position = $_REQUEST['position'];
$position = Text::filterXSS($_REQUEST['position']);
$show = (bool)$_GET['value'];
$ok = $boxAdmin->setVisibility(0, $position, $show);
if ($ok) {
......@@ -182,7 +188,7 @@ if (Request::postInt('einstellungen') > 0) {
break;
}
$flushres = Shop::Container()->getCache()->flushTags([CACHING_GROUP_OBJECT, CACHING_GROUP_BOX, 'boxes']);
Shop::Container()->getDB()->query('UPDATE tglobals SET dLetzteAenderung = NOW()', ReturnType::DEFAULT);
$db->query('UPDATE tglobals SET dLetzteAenderung = NOW()');
}
$boxList = $boxService->buildList($pageID, false);
$boxTemplates = $boxAdmin->getTemplates($pageID);
......@@ -190,25 +196,13 @@ $model = Shop::Container()->getTemplateService()->getActiveTemplate();
$boxContainer = $model->getBoxLayout();
$filterMapping = [];
if ($pageID === PAGE_ARTIKELLISTE) { //map category name
$filterMapping = Shop::Container()->getDB()->query(
'SELECT kKategorie AS id, cName AS name FROM tkategorie',
ReturnType::ARRAY_OF_OBJECTS
);
$filterMapping = $db->getObjects('SELECT kKategorie AS id, cName AS name FROM tkategorie');
} elseif ($pageID === PAGE_ARTIKEL) { //map article name
$filterMapping = Shop::Container()->getDB()->query(
'SELECT kArtikel AS id, cName AS name FROM tartikel',
ReturnType::ARRAY_OF_OBJECTS
);
$filterMapping = $db->getObjects('SELECT kArtikel AS id, cName AS name FROM tartikel');
} elseif ($pageID === PAGE_HERSTELLER) { //map manufacturer name
$filterMapping = Shop::Container()->getDB()->query(
'SELECT kHersteller AS id, cName AS name FROM thersteller',
ReturnType::ARRAY_OF_OBJECTS
);
$filterMapping = $db->getObjects('SELECT kHersteller AS id, cName AS name FROM thersteller');
} elseif ($pageID === PAGE_EIGENE) { //map page name
$filterMapping = Shop::Container()->getDB()->query(
'SELECT kLink AS id, cName AS name FROM tlink',
ReturnType::ARRAY_OF_OBJECTS
);
$filterMapping = $db->getObjects('SELECT kLink AS id, cName AS name FROM tlink');
}
$filterMapping = reindex($filterMapping, static function ($e) {
......
<?php
use JTL\Alert\Alert;
use JTL\DB\ReturnType;
use JTL\Helpers\Form;
use JTL\Helpers\Request;
use JTL\Media\Image;
use JTL\Media\Media;
use JTL\Shop;
......@@ -39,10 +39,10 @@ if (Request::verifyGPCDataInt('branding') === 1) {
}
$smarty->assign('cRnd', time())
->assign('oBranding_arr', gibBrandings())
->assign('PFAD_BRANDINGBILDER', PFAD_BRANDINGBILDER)
->assign('step', $step)
->display('branding.tpl');
->assign('oBranding_arr', gibBrandings())
->assign('PFAD_BRANDINGBILDER', PFAD_BRANDINGBILDER)
->assign('step', $step)
->display('branding.tpl');
/**
* @return mixed
......@@ -54,19 +54,18 @@ function gibBrandings()
/**
* @param int $brandingID
* @return mixed
* @return stdClass|null
*/
function gibBranding(int $brandingID)
function gibBranding(int $brandingID): ?stdClass
{
return Shop::Container()->getDB()->queryPrepared(
return Shop::Container()->getDB()->getSingleObject(
'SELECT tbranding.*, tbranding.kBranding AS kBrandingTMP, tbrandingeinstellung.*
FROM tbranding
LEFT JOIN tbrandingeinstellung
ON tbrandingeinstellung.kBranding = tbranding.kBranding
WHERE tbranding.kBranding = :bid
GROUP BY tbranding.kBranding',
['bid' => $brandingID],
ReturnType::SINGLE_OBJECT
['bid' => $brandingID]
);
}
......@@ -76,8 +75,11 @@ function gibBranding(int $brandingID)
* @param array $files
* @return bool
*/
function speicherEinstellung(int $brandingID, array $post, array $files)
function speicherEinstellung(int $brandingID, array $post, array $files): bool
{
if (!Image::isImageUpload($files['cBrandingBild'])) {
return false;
}
$db = Shop::Container()->getDB();
$conf = new stdClass();
$conf->dRandabstand = 0;
......@@ -124,27 +126,21 @@ function speicherEinstellung(int $brandingID, array $post, array $files)
* @param int $brandingID
* @return bool
*/
function speicherBrandingBild($files, int $brandingID)
function speicherBrandingBild(array $files, int $brandingID): bool