uawdijnntqw1x1x1
IP : 13.58.7.43
Hostname : ns1.eurodns.top
Kernel : Linux ns1.eurodns.top 4.18.0-553.5.1.lve.1.el7h.x86_64 #1 SMP Fri Jun 14 14:24:52 UTC 2024 x86_64
Disable Function : mail,sendmail,exec,passthru,shell_exec,system,popen,curl_multi_exec,show_source,eval,open_base
OS : Linux
PATH:
/
home
/
sudancam
/
public_html
/
..
/
.trash
/
wp-pagenavi.1
/
..
/
admin.1
/
model
/
localisation
/
geo_zone.php
/
/
<?php namespace Opencart\Admin\Model\Localisation; class GeoZone extends \Opencart\System\Engine\Model { public function addGeoZone(array $data): int { $this->db->query("INSERT INTO `" . DB_PREFIX . "geo_zone` SET `name` = '" . $this->db->escape((string)$data['name']) . "', `description` = '" . $this->db->escape((string)$data['description']) . "', `date_added` = NOW()"); $geo_zone_id = $this->db->getLastId(); if (isset($data['zone_to_geo_zone'])) { foreach ($data['zone_to_geo_zone'] as $value) { $this->db->query("DELETE FROM `" . DB_PREFIX . "zone_to_geo_zone` WHERE `geo_zone_id` = '" . (int)$geo_zone_id . "' AND `country_id` = '" . (int)$value['country_id'] . "' AND `zone_id` = '" . (int)$value['zone_id'] . "'"); $this->db->query("INSERT INTO `" . DB_PREFIX . "zone_to_geo_zone` SET `country_id` = '" . (int)$value['country_id'] . "', `zone_id` = '" . (int)$value['zone_id'] . "', `geo_zone_id` = '" . (int)$geo_zone_id . "', `date_added` = NOW()"); } } $this->cache->delete('geo_zone'); return $geo_zone_id; } public function editGeoZone(int $geo_zone_id, array $data): void { $this->db->query("UPDATE `" . DB_PREFIX . "geo_zone` SET `name` = '" . $this->db->escape((string)$data['name']) . "', `description` = '" . $this->db->escape((string)$data['description']) . "', `date_modified` = NOW() WHERE `geo_zone_id` = '" . (int)$geo_zone_id . "'"); $this->db->query("DELETE FROM `" . DB_PREFIX . "zone_to_geo_zone` WHERE `geo_zone_id` = '" . (int)$geo_zone_id . "'"); if (isset($data['zone_to_geo_zone'])) { foreach ($data['zone_to_geo_zone'] as $value) { $this->db->query("DELETE FROM `" . DB_PREFIX . "zone_to_geo_zone` WHERE `geo_zone_id` = '" . (int)$geo_zone_id . "' AND `country_id` = '" . (int)$value['country_id'] . "' AND `zone_id` = '" . (int)$value['zone_id'] . "'"); $this->db->query("INSERT INTO `" . DB_PREFIX . "zone_to_geo_zone` SET `country_id` = '" . (int)$value['country_id'] . "', `zone_id` = '" . (int)$value['zone_id'] . "', `geo_zone_id` = '" . (int)$geo_zone_id . "', `date_added` = NOW()"); } } $this->cache->delete('geo_zone'); } public function deleteGeoZone(int $geo_zone_id): void { $this->db->query("DELETE FROM `" . DB_PREFIX . "geo_zone` WHERE `geo_zone_id` = '" . (int)$geo_zone_id . "'"); $this->db->query("DELETE FROM `" . DB_PREFIX . "zone_to_geo_zone` WHERE `geo_zone_id` = '" . (int)$geo_zone_id . "'"); $this->cache->delete('geo_zone'); } public function getGeoZone(int $geo_zone_id): array { $query = $this->db->query("SELECT DISTINCT * FROM `" . DB_PREFIX . "geo_zone` WHERE `geo_zone_id` = '" . (int)$geo_zone_id . "'"); return $query->row; } public function getGeoZones(array $data = []): array { if ($data) { $sql = "SELECT * FROM `" . DB_PREFIX . "geo_zone`"; $sort_data = [ 'name', 'description' ]; if (isset($data['sort']) && in_array($data['sort'], $sort_data)) { $sql .= " ORDER BY `" . $data['sort'] . "`"; } else { $sql .= " ORDER BY `name`"; } if (isset($data['order']) && ($data['order'] == 'DESC')) { $sql .= " DESC"; } else { $sql .= " ASC"; } if (isset($data['start']) || isset($data['limit'])) { if ($data['start'] < 0) { $data['start'] = 0; } if ($data['limit'] < 1) { $data['limit'] = 20; } $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit']; } $query = $this->db->query($sql); return $query->rows; } else { $geo_zone_data = $this->cache->get('geo_zone'); if (!$geo_zone_data) { $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "geo_zone` ORDER BY `name` ASC"); $geo_zone_data = $query->rows; $this->cache->set('geo_zone', $geo_zone_data); } return $geo_zone_data; } } public function getTotalGeoZones(): int { $query = $this->db->query("SELECT COUNT(*) AS `total` FROM `" . DB_PREFIX . "geo_zone`"); return (int)$query->row['total']; } public function getZoneToGeoZones(int $geo_zone_id): array { $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "zone_to_geo_zone` WHERE `geo_zone_id` = '" . (int)$geo_zone_id . "'"); return $query->rows; } public function getTotalZoneToGeoZoneByGeoZoneId(int $geo_zone_id): int { $query = $this->db->query("SELECT COUNT(*) AS `total` FROM `" . DB_PREFIX . "zone_to_geo_zone` WHERE `geo_zone_id` = '" . (int)$geo_zone_id . "'"); return (int)$query->row['total']; } public function getTotalZoneToGeoZoneByCountryId(int $country_id): int { $query = $this->db->query("SELECT COUNT(*) AS `total` FROM `" . DB_PREFIX . "zone_to_geo_zone` WHERE `country_id` = '" . (int)$country_id . "'"); return (int)$query->row['total']; } public function getTotalZoneToGeoZoneByZoneId(int $zone_id): int { $query = $this->db->query("SELECT COUNT(*) AS `total` FROM `" . DB_PREFIX . "zone_to_geo_zone` WHERE `zone_id` = '" . (int)$zone_id . "'"); return (int)$query->row['total']; } }
/home/sudancam/public_html/../.trash/wp-pagenavi.1/../admin.1/model/localisation/geo_zone.php