// Repeat comment vote. Must be from a double-click. Return false and $json_array = array('result' => $h->lang['comment_voting_already_voted']); echo json_encode($json_array); return false; } // get current status and down votes $sql = "SELECT comment_votes_down, comment_status FROM " . TABLE_COMMENTS . " WHERE comment_id = %d"; $c_row = $h->db->get_row($h->db->prepare($sql, $comment_id)); if ($cvote_rating > 0) { // Update comments table $sql = "UPDATE " . TABLE_COMMENTS . " SET comment_votes_up = comment_votes_up + 1 WHERE comment_id = %d"; $h->db->query($h->db->prepare($sql, $comment_id)); // Update commentvotes table $sql = "INSERT INTO " . TABLE_COMMENTVOTES . " (cvote_post_id, cvote_comment_id, cvote_user_id, cvote_user_ip, cvote_date, cvote_rating, cvote_updateby) VALUES (%d, %d, %d, %s, CURRENT_TIMESTAMP, %d, %d)"; $h->db->query($h->db->prepare($sql, $post_id, $comment_id, $user_id, $user_ip, $cvote_rating, $user_id)); $h->pluginHook('comment_voting_funcs_positive', '', array('user' => $user_id, 'comment' => $comment_id)); } else { if ($cvote_rating && $cvote_rating < 0) { // Increase down votes and set to buried if (isset($bury) && $c_row->comment_votes_down + 1 >= $bury && $c_row->comment_status != 'buried') { $sql = "UPDATE " . TABLE_COMMENTS . " SET comment_votes_down=comment_votes_down + 1, comment_status = %s WHERE comment_id = %d"; $h->db->query($h->db->prepare($sql, 'buried', $comment_id)); } else { // Just increase the down votes $sql = "UPDATE " . TABLE_COMMENTS . " SET comment_votes_down=comment_votes_down + 1 WHERE comment_id = %d"; $h->db->query($h->db->prepare($sql, $comment_id)); } // Update commentvotes table $sql = "INSERT INTO " . TABLE_COMMENTVOTES . " (cvote_post_id, cvote_comment_id, cvote_user_id, cvote_user_ip, cvote_date, cvote_rating, cvote_updateby) VALUES (%d, %d, %d, %s, CURRENT_TIMESTAMP, %d, %d)"; $h->db->query($h->db->prepare($sql, $post_id, $comment_id, $user_id, $user_ip, $cvote_rating, $user_id)); $h->pluginHook('comment_voting_funcs_negative', '', array('user' => $user_id, 'post' => $post_id, 'comment' => $comment_id));
/** * a function to filter HTML * * @return string */ protected function inspekt($text) { /* make_tag_strict is OFF because we don't want to convert <u>, etc. to css otherwise the strip_tags won't be able to allow them when requested in sanitize(). */ $config = array('safe' => 1, 'make_tag_strict' => 0); // Allow plugins to alter the value of $config/ // Plugins should return an array, e.g. array('safe' => 1); require_once BASE . 'Hotaru.php'; $h = new Hotaru(); $results = $h->pluginHook('hotaru_inspekt_htmlawed_config'); if (is_array($results)) { foreach ($results as $res) { // THIS LOOKS WEIRD. IT NEEDS A RETHINK /Nick $config = $res; // $config takes on the value returned from the last plugin using this hook. } } require_once EXTENSIONS . 'htmLawed/htmLawed.php'; if (!get_magic_quotes_gpc()) { return htmLawed($text, $config); } else { return htmLawed(stripslashes($text), $config); } return false; }