From a28ba8bfecd48515996cb7a977d33dad61dab92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Mon, 27 Jul 2026 01:54:42 +0400 Subject: [PATCH] fix(security): systematic output escaping with e() and video-card partial --- ajax/load-more-videos.php | 20 +---- categories.php | 35 +-------- includes/hero-section.php | 11 ++- includes/partials/video-card.php | 58 +++++++++++++++ includes/security.php | 92 ++++++++++++++++++++++- index.php | 111 +++------------------------- recherche.php | 35 +-------- tests/php/video-card-test.php | 123 +++++++++++++++++++++++++++++++ 8 files changed, 300 insertions(+), 185 deletions(-) create mode 100644 includes/partials/video-card.php create mode 100644 tests/php/video-card-test.php diff --git a/ajax/load-more-videos.php b/ajax/load-more-videos.php index 921e144..d0ac534 100644 --- a/ajax/load-more-videos.php +++ b/ajax/load-more-videos.php @@ -97,25 +97,7 @@ switch ($type) { $html = ''; foreach ($videos as $video) { - $html .= '
'; - $html .= '
'; - $html .= ' ' . htmlspecialchars($video['title']) . ''; - $html .= '
'; - $html .= ' '; - $html .= '
'; - $html .= '
' . formatDuration($video['duration']) . '
'; - $html .= '
'; - $html .= '
'; - $html .= '

' . htmlspecialchars($video['title']) . '

'; - $html .= '
' . htmlspecialchars($video['channel']) . '
'; - $html .= ' '; - $html .= '
'; - $html .= '
'; + $html .= renderVideoCard($video); } // Retourner la réponse diff --git a/categories.php b/categories.php index 159432c..a8b4cb5 100644 --- a/categories.php +++ b/categories.php @@ -59,8 +59,8 @@ if ($categoryId && isset($allCategories[$categoryId])) { - - + + @@ -69,7 +69,7 @@ if ($categoryId && isset($allCategories[$categoryId])) { - +
-
-
- <?php echo htmlspecialchars($video['title']); ?> -
- -
- -
-
-

-
- -
- -
- - <?php echo htmlspecialchars($video['channel']); ?> - - -
- -
-
+
diff --git a/includes/hero-section.php b/includes/hero-section.php index 92392a4..10ad024 100644 --- a/includes/hero-section.php +++ b/includes/hero-section.php @@ -45,7 +45,7 @@ if ($heroType === 'none') {