Permalink
Browse files

escape XML in Google Sitemap output (#6532)

  • Loading branch information...
miklcct committed Apr 9, 2018
1 parent 2da62da commit 728e555144da41c1591592c895962ae007255b4b
Showing with 9 additions and 9 deletions.
  1. +9 −9 upload/catalog/controller/extension/feed/google_sitemap.php
@@ -13,14 +13,14 @@ public function index() {
foreach ($products as $product) {
if ($product['image']) {
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&product_id=' . $product['product_id']) . '</loc>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&product_id=' . $product['product_id']), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <lastmod>' . date('Y-m-d\TH:i:sP', strtotime($product['date_modified'])) . '</lastmod>';
$output .= ' <priority>1.0</priority>';
$output .= ' <image:image>';
$output .= ' <image:loc>' . $this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height')) . '</image:loc>';
$output .= ' <image:caption>' . $product['name'] . '</image:caption>';
$output .= ' <image:title>' . $product['name'] . '</image:title>';
$output .= ' <image:loc>' . htmlspecialchars($this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height')), ENT_COMPAT | ENT_XML1) . '</image:loc>';
$output .= ' <image:caption>' . htmlspecialchars($product['name'], ENT_COMPAT | ENT_XML1) . '</image:caption>';
$output .= ' <image:title>' . htmlspecialchars($product['name'], ENT_COMPAT | ENT_XML1) . '</image:title>';
$output .= ' </image:image>';
$output .= '</url>';
}
@@ -36,7 +36,7 @@ public function index() {
foreach ($manufacturers as $manufacturer) {
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('product/manufacturer/info', 'language=' . $this->config->get('config_language') . '&manufacturer_id=' . $manufacturer['manufacturer_id']) . '</loc>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('product/manufacturer/info', 'language=' . $this->config->get('config_language') . '&manufacturer_id=' . $manufacturer['manufacturer_id']), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>0.7</priority>';
$output .= '</url>';
@@ -45,7 +45,7 @@ public function index() {
foreach ($products as $product) {
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&manufacturer_id=' . $manufacturer['manufacturer_id'] . '&product_id=' . $product['product_id']) . '</loc>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&manufacturer_id=' . $manufacturer['manufacturer_id'] . '&product_id=' . $product['product_id']), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>1.0</priority>';
$output .= '</url>';
@@ -58,7 +58,7 @@ public function index() {
foreach ($informations as $information) {
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('information/information', 'language=' . $this->config->get('config_language') . '&information_id=' . $information['information_id']) . '</loc>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('information/information', 'language=' . $this->config->get('config_language') . '&information_id=' . $information['information_id']), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>0.5</priority>';
$output .= '</url>';
@@ -84,7 +84,7 @@ protected function getCategories($parent_id, $current_path = '') {
}
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('product/category', 'language=' . $this->config->get('config_language') . '&path=' . $new_path) . '</loc>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('product/category', 'language=' . $this->config->get('config_language') . '&path=' . $new_path), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>0.7</priority>';
$output .= '</url>';
@@ -93,7 +93,7 @@ protected function getCategories($parent_id, $current_path = '') {
foreach ($products as $product) {
$output .= '<url>';
$output .= ' <loc>' . $this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&path=' . $new_path . '&product_id=' . $product['product_id']) . '</loc>';
$output .= ' <loc>' . htmlspecialchars($this->url->link('product/product', 'language=' . $this->config->get('config_language') . '&path=' . $new_path . '&product_id=' . $product['product_id']), ENT_COMPAT | ENT_XML1) . '</loc>';
$output .= ' <changefreq>weekly</changefreq>';
$output .= ' <priority>1.0</priority>';
$output .= '</url>';

0 comments on commit 728e555

Please sign in to comment.