ver. 0.293: Code review fixes — 6 repositories, 16 fixes

- ArticleRepository: SQL injection fix (addslashes→parameterized), DRY refactor topArticles/newsListArticles
- AttributeRepository: dead class_exists('\S') blocking cache/temp clear
- CategoryRepository: dead class_exists('\S') blocking SEO link generation (critical)
- BannerRepository: parameterize $today in SQL + null guard on query()
- BasketCalculator: null guard checkProductQuantityInStock + optional DI params
- PromotionRepository: null guard on $basket (production fatal)
- OrderRepository/ShopBasketController/ajax.php: explicit DI in BasketCalculator callers

614 tests, 1821 assertions (+4 new)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 01:07:39 +01:00
parent 29821bccf2
commit 054b1b4a34
19 changed files with 297 additions and 218 deletions

View File

@@ -331,13 +331,15 @@ class BannerRepository
}
$today = date('Y-m-d');
$results = $this->db->query(
$stmt = $this->db->query(
"SELECT id, name FROM pp_banners "
. "WHERE status = 1 "
. "AND (date_start <= '{$today}' OR date_start IS NULL) "
. "AND (date_end >= '{$today}' OR date_end IS NULL) "
. "AND home_page = 0"
)->fetchAll();
. "AND (date_start <= :today1 OR date_start IS NULL) "
. "AND (date_end >= :today2 OR date_end IS NULL) "
. "AND home_page = 0",
[':today1' => $today, ':today2' => $today]
);
$results = $stmt ? $stmt->fetchAll() : [];
$banners = null;
if (is_array($results) && !empty($results)) {
@@ -370,15 +372,17 @@ class BannerRepository
}
$today = date('Y-m-d');
$results = $this->db->query(
$stmt = $this->db->query(
"SELECT * FROM pp_banners "
. "WHERE status = 1 "
. "AND (date_start <= '{$today}' OR date_start IS NULL) "
. "AND (date_end >= '{$today}' OR date_end IS NULL) "
. "AND (date_start <= :today1 OR date_start IS NULL) "
. "AND (date_end >= :today2 OR date_end IS NULL) "
. "AND home_page = 1 "
. "ORDER BY date_end ASC "
. "LIMIT 1"
)->fetchAll();
. "LIMIT 1",
[':today1' => $today, ':today2' => $today]
);
$results = $stmt ? $stmt->fetchAll() : [];
$banner = null;
if (is_array($results) && !empty($results)) {