barrel = $alias; $this->readOptions(); } /** Read options from database. */ function readOptions() { global $globals; // we only accept options which already exist in this class $res = $globals->db->query("select name,value from {$this->table_option} where barrel='{$this->barrel}'"); while (list($key,$value) = mysql_fetch_row($res)) { if (isset($this->$key) && ($key != "table_option")) $this->$key = $value; } mysql_free_result($res); } /** Update an option's value and write the new value to database. */ function updateOption($name, $value) { global $globals; $this->$name = stripslashes($value); $globals->db->query("replace into {$this->table_option} set barrel='{$this->barrel}',name='$name',value='$value'"); } } ?>