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:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user