/** * */ function insert() { xanth_db_start_transaction(); $field_names = "title,description"; $field_values = "'%s','%s'"; $values = array($this->title, $this->description); if (!empty($this->view_mode_id)) { $field_names .= ",view_mode_id"; $field_values .= ",'%d'"; $values[] = $this->view_mode_id; } if (!empty($this->parent_id)) { $field_names .= ",parent_id"; $field_values .= ",'%d'"; $values[] = $this->parent_id; } xanth_db_query("INSERT INTO category ({$field_names}) VALUES ({$field_values})", $values); $this->id = xanth_db_get_last_id(); if (!empty($this->entry_type_names)) { foreach ($this->entry_type_names as $type) { xanth_db_query("INSERT INTO category_to_entry_type (cat_id,entry_type) VALUES ('%s','%s')", $this->id, $type); } } xanth_db_commit(); }
/** * */ function insert() { xanth_db_start_transaction(); $this->creation_time = time(); xanth_db_query("INSERT INTO entry (title,type,author,content,content_format,published,description,keywords,creation_time)\r\n\t\t\tVALUES('%s','%s','%s','%s','%s',%d,'%s','%s','%s')", $this->title, $this->type, $this->author, $this->content, $this->content_format, $this->published, $this->description, $this->keywords, xanth_db_encode_timestamp($this->creation_time)); $this->id = xanth_db_get_last_id(); if (!empty($this->categories)) { foreach ($this->categories as $category) { xanth_db_query("INSERT INTO categorytoentry (entryId,catId) VALUES('%d','%d')", $this->id, $category->id); } } xanth_db_commit(); }
/** * */ function insert() { xanth_db_query("INSERT INTO view_mode (name,relative_visual_element,default_for_element,display_procedure) \r\n\t\t\tVALUES ('%s','%s',%d,'%s')", $this->name, $this->relative_visual_element, $this->default_for_element, $this->display_procedure); $this->id = xanth_db_get_last_id(); }
/** * */ function insert($password) { xanth_db_query("INSERT INTO user (username,password,email,cookie_token) VALUES ('%s','%s','%s','%s')", $this->username, xUser::password_hash($password), $this->email, md5(uniqid(rand(), true))); $this->id = xanth_db_get_last_id(); }