public function getSkinSettings($skin_id) { /* get parent */ $parent_id = $skin_id; if ($skin_id >= 100) { $query = $this->db->query("SELECT parent_id FROM " . DB_PREFIX . "journal2_skins WHERE `skin_id` = '" . (int) $skin_id . "'"); if ($query->num_rows) { $parent_id = $query->row['parent_id']; } else { $parent_id = 1; } } $settings = array(); if ($parent_id !== $skin_id) { $journal_skin = new Journal2Skin($this->db, $parent_id); $settings = array_merge($settings, $journal_skin->load()); } $journal_skin = new Journal2Skin($this->db, $skin_id); $settings = array_merge($settings, $journal_skin->load()); return $settings; }
public function export() { if (!$this->user->hasPermission('modify', 'module/journal2')) { throw new Exception('You do not have permissions to modify Journal2 module'); } if (!defined('J2ENV')) { throw new Exception('You shouldn\'t be here!'); } Journal2Skin::exportAll($this->db); }
private function loadFromDb($category) { if ($category !== null) { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "journal2_settings WHERE `category` = '" . $this->db->escape($category) . "' AND `theme_id` = '" . $this->skin_id . "'"); } else { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "journal2_settings WHERE `theme_id` = '" . $this->skin_id . "'"); } $settings = array(); $parent_id = $this->getParentId(); if ($parent_id !== -1) { $parent = new Journal2Skin($this->db, $parent_id); $parent_settings = $parent->load($category); foreach ($parent_settings as $key => $value) { $settings[$key] = $value; } } foreach ($query->rows as $row) { $settings[$row['key']] = $row['serialized'] ? json_decode($row['value'], true) : $row['value']; } return $settings; }