function render_article($post_gd, $user_gd, $override = array("tpl" => 0)) { 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"; } if (is_single() || is_page() && $this->o["display_comment_page"] == 1) { $this->init_post(); } $rd_unit_width = $this->o["size"]; $rd_unit_count = $this->o["stars"]; $rd_unit_style = $this->is_ie6 ? $this->o["style_ie6"] : $this->o["style"]; $rd_post_id = intval($post_gd->ID); $rd_user_id = intval($user_gd->ID); $rd_is_page = $post_gd->post_type == "page" ? "1" : "0"; if ($this->p) { $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_articles == "H") { return ""; } if ($allow_vote) { if ($this->o["author_vote"] == 1 && $rd_user_id == $post_gd->post_author) { $allow_vote = false; $dbg_allow = "A"; } } if ($allow_vote) { if ($post_data->rules_articles == "" || $post_data->rules_articles == "A" || $post_data->rules_articles == "U" && $rd_user_id > 0 || $post_data->rules_articles == "V" && $rd_user_id == 0) { $allow_vote = true; } else { $allow_vote = false; $dbg_allow = "R_" . $post_data->rules_articles; } } $remaining = 0; $deadline = ''; if ($allow_vote && ($post_data->expiry_type == 'D' || $post_data->expiry_type == 'T')) { switch ($post_data->expiry_type) { case "D": $remaining = GDSRHelper::expiration_date($post_data->expiry_value); $deadline = $post_data->expiry_value; break; case "T": $remaining = GDSRHelper::expiration_countdown($post_gd->post_date, $post_data->expiry_value); $deadline = GDSRHelper::calculate_deadline($remaining); break; } if ($remaining < 1) { GDSRDatabase::lock_post($rd_post_id); $allow_vote = false; $dbg_allow = "T"; } } if ($allow_vote) { $allow_vote = GDSRDatabase::check_vote($rd_post_id, $rd_user_id, 'article', $_SERVER["REMOTE_ADDR"], $this->o["logged"] != 1, $this->o["allow_mixed_ip_votes"] == 1); if (!$allow_vote) { $dbg_allow = "D"; } } if ($allow_vote) { $allow_vote = $this->check_cookie($rd_post_id); if (!$allow_vote) { $dbg_allow = "C"; } } $votes = 0; $score = 0; if ($post_data->rules_articles == "A" || $post_data->rules_articles == "N") { $votes = $post_data->user_voters + $post_data->visitor_voters; $score = $post_data->user_votes + $post_data->visitor_votes; } else { if ($post_data->rules_articles == "V") { $votes = $post_data->visitor_voters; $score = $post_data->visitor_votes; } else { $votes = $post_data->user_voters; $score = $post_data->user_votes; } } $debug = $rd_user_id == 0 ? "V" : "U"; $debug .= $rd_user_id == $post_gd->post_author ? "A" : "N"; $debug .= ":" . $dbg_allow . " [" . STARRATING_VERSION . "]"; $tags_css = array(); $tags_css["CSS_BLOCK"] = $this->o["srb_class_block"]; $tags_css["CSS_HEADER"] = $this->o["srb_class_header"]; $tags_css["CSS_STARS"] = $this->o["srb_class_stars"]; $tags_css["CSS_TEXT"] = $this->o["srb_class_text"]; if ($override["tpl"] > 0) { $template_id = $override["tpl"]; } else { $template_id = $this->o["default_srb_template"]; } $rating_block = GDSRRenderT2::render_srb($template_id, $rd_post_id, "ratepost", "a", $votes, $score, $rd_unit_style, $rd_unit_width, $rd_unit_count, $allow_vote, $rd_user_id, "article", $tags_css, $this->o["header_text"], $debug, $this->loader_article, $post_data->expiry_type, $remaining, $deadline); return $rating_block; }