function delete() { global $db, $config_vars, $userdata; // remove from content table // check is user is allowed $content = new album_content(); $content->generate_from_id($this->owner_id); if ($userdata['user_id'] == $this->user_id or check_content_action_allowed($content->get_contentgroup_id(), $userdata['user_id'], 'content_edit')) { // check wether the comment has child comments if (is_array($this->get_childs())) { // comment has childs $this->set_feedback('DELETED'); $this->commit(); } else { // comment has no childs $sql = "DELETE FROM " . $config_vars['table_prefix'] . "content_comments WHERE id = " . $this->id; if (!($result = $db->sql_query($sql))) { error_report(SQL_ERROR, 'delete', __LINE__, __FILE__, $sql); } $content->dec_comments_amount(); $content->commit(); unset($this->id); } } }