first commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
class ModelSettingApi extends Model {
|
||||
public function login($username, $key) {
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "api a LEFT JOIN " . DB_PREFIX . "api_ip `ai` ON (a.api_id = ai.api_id) WHERE a.username = '" . $this->db->escape($username) . "' AND a.key = '" . $this->db->escape($key) . "'");
|
||||
|
||||
return $query->row;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
class ModelSettingEvent extends Model {
|
||||
function getEvents() {
|
||||
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "event` WHERE `trigger` LIKE 'catalog/%' AND status = '1' ORDER BY `sort_order` ASC");
|
||||
|
||||
return $query->rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
class ModelSettingExtension extends Model {
|
||||
public function getExtensions($type) {
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "extension WHERE `type` = '" . $this->db->escape($type) . "'");
|
||||
|
||||
return $query->rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class ModelSettingModule extends Model {
|
||||
public function getModule($module_id) {
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "module WHERE module_id = '" . (int)$module_id . "'");
|
||||
|
||||
if ($query->row) {
|
||||
return json_decode($query->row['setting'], true);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
class ModelSettingSetting extends Model {
|
||||
public function getSetting($code, $store_id = 0) {
|
||||
$data = array();
|
||||
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '" . (int)$store_id . "' AND `code` = '" . $this->db->escape($code) . "'");
|
||||
|
||||
foreach ($query->rows as $result) {
|
||||
if (!$result['serialized']) {
|
||||
$data[$result['key']] = $result['value'];
|
||||
} else {
|
||||
$data[$result['key']] = json_decode($result['value'], true);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getSettingValue($key, $store_id = 0) {
|
||||
$query = $this->db->query("SELECT value FROM " . DB_PREFIX . "setting WHERE store_id = '" . (int)$store_id . "' AND `key` = '" . $this->db->escape($key) . "'");
|
||||
|
||||
if ($query->num_rows) {
|
||||
return $query->row['value'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
class ModelSettingStore extends Model {
|
||||
public function getStores() {
|
||||
$store_data = $this->cache->get('store');
|
||||
|
||||
if (!$store_data) {
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "store ORDER BY url");
|
||||
|
||||
$store_data = $query->rows;
|
||||
|
||||
$this->cache->set('store', $store_data);
|
||||
}
|
||||
|
||||
return $store_data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user