Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Sanitization for html content for component save in page builder

givanz02c087fd4335
diff --git a/app/component/breadcrumb.php b/app/component/breadcrumb.php
index 481605c..f043441 100755
--- a/app/component/breadcrumb.php
+++ b/app/component/breadcrumb.php
@@ -120,18 +120,25 @@ class Breadcrumb extends ComponentBase {
break;
//post page
case 'content/post/index':
- $post_id = $request->get['post_id'] ?? false;
+ $post_id = $request->get['post_id'] ?? false;
+ $breadcrumb = [
+ ['text' => $homeText, 'url' => '/'],
+ ];
if ($post_id) {
$category = new CategorySQL();
$result = $category->getCategory(
['post_id' => $post_id, 'limit' => 1, 'type' => 'categories', 'post_type' => 'post']
+ self :: $global);
+
+ if ($result && isset($result['category'])) {
+ $breadcrumb += [
+ ['text' => $result['name'], 'url' => url('content/category/index', $result)],
+ ];
+ }
}
- $breadcrumb = [
- ['text' => $homeText, 'url' => '/'],
- ['text' => $result['name'], 'url' => url('content/category/index', $result)],
+ $breadcrumb += [
['text' => $slug, 'url' => false],
];
diff --git a/app/component/post.php b/app/component/post.php
index b5838c5..a5b159d 100755
--- a/app/component/post.php
+++ b/app/component/post.php
@@ -23,6 +23,7 @@
namespace Vvveb\Component;
use function Vvveb\__;
+use function Vvveb\sanitizeHTML;
use Vvveb\Sql\PostSQL;
use Vvveb\System\Component\ComponentBase;
use Vvveb\System\Event;
@@ -91,10 +92,10 @@ class Post extends ComponentBase {
$value = $field['value'];
if ($name == 'content') {
- $post_content[$name] = $value;
+ $post_content[$name] = sanitizeHTML($value);
} else {
if ($name == 'excerpt') {
- $post_content[$name] = $value;
+ $post_content[$name] = sanitizeHTML($value);
} else {
if ($name == 'name') {
$post_content[$name] = strip_tags($value);
diff --git a/app/component/product.php b/app/component/product.php
index 94ce8b2..4bc5bb6 100755
--- a/app/component/product.php
+++ b/app/component/product.php
@@ -22,6 +22,7 @@
namespace Vvveb\Component;
+use function Vvveb\sanitizeHTML;
use Vvveb\Sql\ProductSQL;
use Vvveb\System\Cart\Currency;
use Vvveb\System\Cart\Tax;
@@ -49,6 +50,8 @@ class Product extends ComponentBase {
$product = new ProductSQL();
$results = $product->get($this->options);
+ $results['images'] = [];
+
if (isset($results['product_image'])) {
$results['images'] = Images::images($results['product_image'], 'product', $this->options['image_size']);
}
@@ -78,8 +81,6 @@ class Product extends ComponentBase {
$results['promotion_discount'] = 100 - ceil($results['promotion'] * 100 / $results['price']);
}
- //$data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_type_id'], $this->config->get('config_tax')), $this->session->data['currency']);
-
list($results) = Event :: trigger(__CLASS__,__FUNCTION__, $results);
return $results;
@@ -100,7 +101,7 @@ class Product extends ComponentBase {
$product_content[$name] = strip_tags($value);
} else {
if ($name == 'content' || $name == 'excerpt') {
- $product_content[$name] = $value;
+ $product_content[$name] = sanitizeHTML($value);
} else {
if ($name == 'image') {
$value = str_replace($publicPath,'', $value);