function render_comment_actual($settings) { if ($this->g->o["comments_active"] != 1) { return ""; } $post_id = intval($settings[1]); $comment_id = intval($settings[2]); $comment_author = intval($settings[3]); $rd_is_page = intval($settings[4]); $post_author = intval($settings[5]); $user_id = intval($settings[6]); $override["tpl"] = intval($settings[7]); $override["read_only"] = intval($settings[8]); $override["size"] = intval($settings[9]); $override["style"] = $this->g->g->stars[$settings[10]]->folder; $override["style_ie6"] = $this->g->g->stars[$settings[11]]->folder; $dbg_allow = "F"; $already_voted = false; $allow_vote = $override["read_only"] == 0; $allow_vote = apply_filters("gdsr_allow_vote_stars_comment", $allow_vote, $post_id); if ($this->g->is_ban && $this->g->o["ip_filtering"] == 1) { if ($this->g->o["ip_filtering_restrictive"] == 1) { return ""; } else { $allow_vote = false; } $dbg_allow = "B"; } $rd_unit_count = $this->g->o["cmm_stars"]; $rd_unit_width = $override["size"]; $rd_unit_style = $this->g->is_ie6 ? $override["style_ie6"] : $override["style"]; $rd_post_id = intval($post_id); $rd_user_id = intval($user_id); $rd_comment_id = intval($comment_id); $post_data = wp_gdget_post($rd_post_id); if (!is_object($post_data)) { GDSRDatabase::add_default_vote($rd_post_id, $rd_is_page); $post_data = wp_gdget_post($rd_post_id); $this->g->c[$rd_post_id] = 1; } $rules_comments = $post_data->rules_comments != "I" ? $post_data->rules_comments : $this->g->get_post_rule_value($rd_post_id, "rules_comments", "default_voterules_comments"); if ($rules_comments == "H") { return ""; } $comment_data = wp_gdget_comment($rd_comment_id); if (count($comment_data) == 0) { GDSRDatabase::add_empty_comment($rd_comment_id, $rd_post_id); $comment_data = wp_gdget_comment($rd_comment_id); } if ($allow_vote) { if ($this->g->o["cmm_author_vote"] == 1 && $rd_user_id == $comment_author && $rd_user_id > 0) { $allow_vote = false; $dbg_allow = "A"; } } if ($allow_vote) { if ($rules_comments == "" || $rules_comments == "A" || $rules_comments == "U" && $rd_user_id > 0 || $rules_comments == "V" && $rd_user_id == 0) { $allow_vote = true; } else { $allow_vote = false; $dbg_allow = "R_" . $rules_comments; } } $already_voted = !wp_gdget_commentlog($rd_comment_id); if ($allow_vote) { $allow_vote = !$already_voted; if (!$allow_vote) { $dbg_allow = "D"; } } if ($allow_vote) { $allow_vote = gdsrFrontHelp::check_cookie($rd_comment_id, "comment"); if (!$allow_vote) { $dbg_allow = "C"; } } $votes = 0; $score = 0; if ($rules_comments == "A" || $rules_comments == "N") { $votes = $comment_data->user_voters + $comment_data->visitor_voters; $score = $comment_data->user_votes + $comment_data->visitor_votes; } else { if ($rules_comments == "V") { $votes = $comment_data->visitor_voters; $score = $comment_data->visitor_votes; } else { $votes = $comment_data->user_voters; $score = $comment_data->user_votes; } } $debug = $rd_user_id == 0 ? "V" : "U"; $debug .= $rd_user_id == $comment_author ? "A" : "N"; $debug .= ":" . $dbg_allow . " [" . STARRATING_VERSION . "]"; $tags_css = array("CMM_CSS_BLOCK" => $this->g->o["cmm_class_block"], "CMM_CSS_HEADER" => $this->g->o["srb_class_header"], "CMM_CSS_STARS" => $this->g->o["cmm_class_stars"], "CMM_CSS_TEXT" => $this->g->o["cmm_class_text"]); $template_id = $override["tpl"]; $rating_block = GDSRRenderT2::render_crb($template_id, array("already_voted" => $already_voted, "cmm_id" => $rd_comment_id, "class" => "ratecmm", "type" => "c", "votes" => $votes, "score" => $score, "style" => $rd_unit_style, "unit_width" => $rd_unit_width, "unit_count" => $rd_unit_count, "allow_vote" => $allow_vote, "user_id" => $rd_user_id, "typecls" => "comment", "tags_css" => $tags_css, "header_text" => $this->g->o["cmm_header_text"], "debug" => $debug, "wait_msg" => $this->loader_comment)); return $rating_block; }
function render_comment($post, $comment, $user, $override = array()) { if ($this->o["comments_active"] != 1) { return ""; } if ($this->is_bot) { return ""; } $dbg_allow = "F"; $allow_vote = true; if ($this->is_ban && $this->o["ip_filtering"] == 1) { if ($this->o["ip_filtering_restrictive"] == 1) { return ""; } else { $allow_vote = false; } $dbg_allow = "B"; } $rd_unit_width = $this->o["cmm_size"]; $rd_unit_count = $this->o["cmm_stars"]; $rd_unit_style = $this->is_ie6 ? $this->o["cmm_style_ie6"] : $this->o["cmm_style"]; $rd_post_id = intval($post->ID); $rd_user_id = intval($user->ID); $rd_comment_id = intval($comment->comment_ID); $rd_is_page = $post->post_type == "page" ? "1" : "0"; if ($this->p) { $post_data = $this->p; } else { if (is_single() || is_page()) { $this->init_post(); $post_data = $this->p; } else { $post_data = GDSRDatabase::get_post_data($rd_post_id); if (count($post_data) == 0) { GDSRDatabase::add_default_vote($rd_post_id, $rd_is_page); $post_data = GDSRDatabase::get_post_data($rd_post_id); } } } if ($post_data->rules_comments == "H") { return ""; } $comment_data = GDSRDatabase::get_comment_data($rd_comment_id); if (count($comment_data) == 0) { GDSRDatabase::add_empty_comment($rd_comment_id, $rd_post_id); $comment_data = GDSRDatabase::get_comment_data($rd_comment_id); } if ($allow_vote) { if ($this->o["cmm_author_vote"] == 1 && $rd_user_id == $comment->user_id && $rd_user_id > 0) { $allow_vote = false; $dbg_allow = "A"; } } if ($allow_vote) { if ($post_data->rules_comments == "" || $post_data->rules_comments == "A" || $post_data->rules_comments == "U" && $rd_user_id > 0 || $post_data->rules_comments == "V" && $rd_user_id == 0) { $allow_vote = true; } else { $allow_vote = false; $dbg_allow = "R_" . $post_data->rules_comments; } } if ($allow_vote) { $allow_vote = GDSRDatabase::check_vote($rd_comment_id, $rd_user_id, 'comment', $_SERVER["REMOTE_ADDR"], $this->o["cmm_logged"] != 1, $this->o["cmm_allow_mixed_ip_votes"] == 1); if (!$allow_vote) { $dbg_allow = "D"; } } if ($allow_vote) { $allow_vote = $this->check_cookie($rd_comment_id, "comment"); if (!$allow_vote) { $dbg_allow = "C"; } } $votes = 0; $score = 0; if ($post_data->rules_comments == "A" || $post_data->rules_comments == "N") { $votes = $comment_data->user_voters + $comment_data->visitor_voters; $score = $comment_data->user_votes + $comment_data->visitor_votes; } else { if ($post_data->rules_comments == "V") { $votes = $comment_data->visitor_voters; $score = $comment_data->visitor_votes; } else { $votes = $comment_data->user_voters; $score = $comment_data->user_votes; } } $debug = $rd_user_id == 0 ? "V" : "U"; $debug .= $rd_user_id == $comment->user_id ? "A" : "N"; $debug .= ":" . $dbg_allow . " [" . STARRATING_VERSION . "]"; $tags_css = array(); $tags_css["CMM_CSS_BLOCK"] = $this->o["cmm_class_block"]; $tags_css["CMM_CSS_HEADER"] = $this->o["srb_class_header"]; $tags_css["CMM_CSS_STARS"] = $this->o["cmm_class_stars"]; $tags_css["CMM_CSS_TEXT"] = $this->o["cmm_class_text"]; if ($override["tpl"] > 0) { $template_id = $override["tpl"]; } else { $template_id = $this->o["default_crb_template"]; } $rating_block = GDSRRenderT2::render_crb($template_id, $rd_comment_id, "ratecmm", "c", $votes, $score, $rd_unit_style, $rd_unit_width, $rd_unit_count, $allow_vote, $rd_user_id, "comment", $tags_css, $this->o["cmm_header_text"], $debug, $this->loader_comment); return $rating_block; }