public function __set($name, $value)
{
if (!array_key_exists($name, $this->vars)) {
dibi::insert("configs", array('name' => $name, 'value' => $value))->execute();
return $this->vars[$name] = $value;
} else {
if ($this->vars[$name] == $value) {
return $value;
}
dibi::update("configs", array('value' => $value))->where('name=%s', $name)->execute();
return $this->vars[$name] = $value;
}
}