Skip to content

Commit

Permalink
new validations functions
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkerr committed Feb 9, 2024
1 parent 34440dd commit 1037286
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion upload/admin/controller/catalog/attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public function save(): void {
}

foreach ($this->request->post['attribute_description'] as $language_id => $value) {
if ((oc_strlen(trim($value['name'])) < 1) || (oc_strlen($value['name']) > 64)) {
if (!oc_validate_length($value['name'], 1, 64)) {
$json['error']['name_' . $language_id] = $this->language->get('error_name');
}
}
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/controller/catalog/attribute_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function save(): void {
}

foreach ($this->request->post['attribute_group_description'] as $language_id => $value) {
if ((oc_strlen(trim($value['name'])) < 1) || (oc_strlen($value['name']) > 64)) {
if (!oc_validate_length($value['name'], 1, 64)) {
$json['error']['name_' . $language_id] = $this->language->get('error_name');
}
}
Expand Down
4 changes: 2 additions & 2 deletions upload/admin/controller/catalog/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,11 @@ public function save(): void {
}

foreach ($this->request->post['category_description'] as $language_id => $value) {
if ((oc_strlen(trim($value['name'])) < 1) || (oc_strlen($value['name']) > 255)) {
if (!oc_validate_length($value['name'], 1, 255)) {
$json['error']['name_' . $language_id] = $this->language->get('error_name');
}

if ((oc_strlen(trim($value['meta_title'])) < 1) || (oc_strlen($value['meta_title']) > 255)) {
if (!oc_validate_length($value['meta_title'], 1, 255)) {
$json['error']['meta_title_' . $language_id] = $this->language->get('error_meta_title');
}
}
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/controller/catalog/download.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public function save(): void {
}

foreach ($this->request->post['download_description'] as $language_id => $value) {
if ((oc_strlen(trim($value['name'])) < 3) || (oc_strlen($value['name']) > 64)) {
if (!oc_validate_length($value['name'], 3, 64)) {
$json['error']['name_' . $language_id] = $this->language->get('error_name');
}
}
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/controller/catalog/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ public function save(): void {
}

foreach ($this->request->post['product_description'] as $language_id => $value) {
if ((oc_strlen(trim($value['name'])) < 1) || (oc_strlen($value['name']) > 255)) {
if (!oc_validate_length($value['name'], 1, 255)) {
$json['error']['name_' . $language_id] = $this->language->get('error_name');
}

Expand Down
2 changes: 1 addition & 1 deletion upload/admin/controller/catalog/subscription_plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public function save(): void {
}

foreach ($this->request->post['subscription_plan_description'] as $language_id => $value) {
if ((oc_strlen(trim($value['name'])) < 3) || (oc_strlen($value['name']) > 255)) {
if (!oc_validate_length($value['name'], 3, 255)) {
$json['error']['name_' . $language_id] = $this->language->get('error_name');
}
}
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/controller/cms/antispam.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public function save(): void {
$json['error']['warning'] = $this->language->get('error_permission');
}

if ((oc_strlen($this->request->post['keyword']) < 1) || (oc_strlen($this->request->post['keyword']) > 64)) {
if (!oc_validate_length($this->request->post['keyword'], 1, 64)) {
$json['error']['keyword'] = $this->language->get('error_keyword');
}

Expand Down

0 comments on commit 1037286

Please sign in to comment.