function dec_comments_amount() { $this->comments_amount--; if (!is_array($this->cat_ids)) { $this->generate_content_in_cat_data(); } if (is_array($this->cat_ids)) { foreach ($this->cat_ids as $cat_id) { $cat = new categorie(); $cat->generate_from_id($cat_id); $cat->dec_child_comments_amount(); $this->commit_parent_cats[] = $cat; } } }
function delete() { global $db, $config_vars, $userdata; // remove from content table // check is user is allowed $cat = new categorie(); $cat->generate_from_id($this->owner_id); if ($userdata['user_id'] == $this->user_id or check_cat_action_allowed($cat->get_catgroup_id(), $userdata['user_id'], 'content_edit')) { $sql = "DELETE FROM " . $config_vars['table_prefix'] . "cat_comments WHERE id = " . $this->id; if (!($result = $db->sql_query($sql))) { error_report(SQL_ERROR, 'delete', __LINE__, __FILE__, $sql); } $cat->dec_child_comments_amount(); $cat->commit(); unset($this->id); } }