public function save($name) { $temp = new configTemplate(); $temp->loadName($name); if ($_POST['default']) { if ($temp->id) { if (!$temp->default) { // Reset all other items $this->db->setQuery('UPDATE #__acctexp_config_templates' . ' SET `default` = 0' . ' WHERE `id` > 0'); $this->db->query(); } } else { // Reset all other items $this->db->setQuery('UPDATE #__acctexp_config_templates' . ' SET `default` = 0' . ' WHERE `id` > 0'); $this->db->query(); } $temp->default = 1; } else { $temp->default = 0; } unset($_POST['id']); unset($_POST['task']); unset($_POST['option']); unset($_POST['name']); unset($_POST['default']); $temp->template->cfg = $temp->settings; $temp->settings = $_POST; $temp->storeload(); }