content = ""; } /** @see BuildingBlock::install() */ //----------------------------------------------- function install(){ //----------------------------------------------- $query = sprintf("CREATE TABLE IF NOT EXISTS bruckm_htmlblock ( id INT not null AUTO_INCREMENT, content TEXT not null, PRIMARY KEY(id) )"); dbQuery($query); } /** @see BuildingBlock::load() */ //------------------------------------------------- function load(){ //------------------------------------------------- $query = sprintf("SELECT * FROM bruckm_htmlblock WHERE id = %d", $this->id); $result = dbQuery($query); $line = mysqli_fetch_array($result, MYSQLI_ASSOC); $this->content = $line['content']; } /** @see BuildingBlock::doSave() */ //----------------------------------------------- function doSave(){ //----------------------------------------------- $query = sprintf("UPDATE bruckm_htmlblock SET content = %s WHERE id = %d", sqlstring($this->content), $this->id); dbQuery($query); } /** @see BuildingBlock::doCreate() */ //----------------------------------------------- function doCreate(){ //----------------------------------------------- $query = sprintf("INSERT INTO bruckm_htmlblock (content) VALUES (%s)", sqlstring($this->content)); dbQuery($query); return mysql_insert_id(); } /** @see BuildingBlock::delete() */ //------------------------------------------------- function delete(){ //------------------------------------------------- $query = sprintf("DELETE FROM bruckm_htmlblock WHERE id = %d", $this->id); dbQuery($query); } /** @see BuildingBlock::update() */ //----------------------------------------------- function update(){ //----------------------------------------------- if(isset($_POST["htmlblock_content".$this->id])){ $this->content = html_entity_decode($_POST["htmlblock_content".$this->id]); } } /** @see BuildingBlock::printContent() */ //----------------------------------------------- function printContent($position){ //----------------------------------------------- $t = new Template(CMS_TEMPLATE_DIR."htmlblock.html"); $c = htmlentities($this->content); $c = str_replace("&#", "&#", $c); $t->setVar("CONTENT", $c); $t->setVar("ID", $this->id); $t->setVar("POSITION", $position); if($_SESSION['userlevel'] == USER_ADMIN){ $t->setVar("DISABLED", ""); } else{ $t->setVar("DISABLED", "disabled=\"disabled\""); } return $t->toString(); } /** @see BuildingBlock::publish() */ //---------------------------------------------- function publish(){ //---------------------------------------------- return $this->content; } }; ?>