diff --git a/upload/admin/model/design/layout.php b/upload/admin/model/design/layout.php index 1cd3bff3..99b4f93a 100644 --- a/upload/admin/model/design/layout.php +++ b/upload/admin/model/design/layout.php @@ -13,7 +13,9 @@ public function addLayout($data) { if (isset($data['layout_module'])) { foreach ($data['layout_module'] as $layout_module) { - $this->db->query("INSERT INTO " . DB_PREFIX . "layout_module SET layout_id = '" . (int)$layout_id . "', code = '" . $this->db->escape($layout_module['code']) . "', position = '" . $this->db->escape($layout_module['position']) . "', sort_order = '" . (int)$layout_module['sort_order'] . "'"); + if (!empty($layout_module['code'])) { + $this->db->query("INSERT INTO " . DB_PREFIX . "layout_module SET layout_id = '" . (int)$layout_id . "', code = '" . $this->db->escape($layout_module['code']) . "', position = '" . $this->db->escape($layout_module['position']) . "', sort_order = '" . (int)$layout_module['sort_order'] . "'"); + } } } @@ -35,7 +37,9 @@ public function editLayout($layout_id, $data) { if (isset($data['layout_module'])) { foreach ($data['layout_module'] as $layout_module) { - $this->db->query("INSERT INTO " . DB_PREFIX . "layout_module SET layout_id = '" . (int)$layout_id . "', code = '" . $this->db->escape($layout_module['code']) . "', position = '" . $this->db->escape($layout_module['position']) . "', sort_order = '" . (int)$layout_module['sort_order'] . "'"); + if (!empty($layout_module['code'])) { + $this->db->query("INSERT INTO " . DB_PREFIX . "layout_module SET layout_id = '" . (int)$layout_id . "', code = '" . $this->db->escape($layout_module['code']) . "', position = '" . $this->db->escape($layout_module['position']) . "', sort_order = '" . (int)$layout_module['sort_order'] . "'"); + } } } }