return;
}
+ $this->initKeys();
+
$c = $this->lookup($a['module'], $a['name']);
- if($c) {
- return;
- }
- $this->initKeys();
+ $o = $c ? clone($c) : false;
- $s = DB_DataObject::factory('core_setting');
+ $c = $c ? $c : DB_DataObject::factory('core_setting');
- $s->setFrom(array(
+ $c->setFrom(array(
'module' => $a['module'],
'name' => $a['name'],
'description' => $a['description'],
'val' => (!isset($a['is_encrypt']) || $a['is_encrypt'] == 1) ?
$this->encrypt($a['val']) : $a['val'],
- 'is_encrypt' => isset($a['is_encrypt']) ? $a['is_encrypt'] : 1
+ 'is_encrypt' => isset($a['is_encrypt']) ? $a['is_encrypt'] : 1,
+ 'is_valid' => 1
));
- $s->insert();
+ $o ? $c->update($o) : $c->insert();
}
//one key for encrypting all the settings