eq($key); $rst = $this->sql->query($sql); if($v_rst = $this->sql->fetch_assoc($rst)) $value = $v_rst["value"]; else $value = ""; $this->sql->free_result($rst); } else { $value = array(); $sql = "SELECT * FROM #--configuration"; $rst = $this->sql->query($sql); while($v_rst = $this->sql->fetch_assoc($rst)) $value[$v_rst["key"]] = $v_rst["value"]; $this->sql->free_result($rst); } } catch(Exception $_e) { $value = false; } return $value; } function config_exists($key) { $exists = false; try { $sql = "SELECT count(*) as n FROM #--configuration WHERE `key`=".$this->eq($key); $rst = $this->sql->query($sql); if($v_rst = $this->sql->fetch_assoc($rst)) $exists = $v_rst["n"]; $this->sql->free_result($rst); } catch(Exception $_e) {} return $exists; } function set_config($key, $value) { try { if($this->config_exists($key)) $sql = "UPDATE #--configuration" ." SET `value`=".$this->eq($value) ." WHERE `key`=".$this->eq($key); else $sql = "INSERT INTO #--configuration" ." VALUES(".$this->eq($key).", ".$this->eq($value).")"; $this->sql->query($sql); return true; } catch(Exception $_e) {} return false; } } ?>