Example #1
0
function defensio_commentlist()
{
    global $comment_row_class, $id, $pixelpost_db_prefix, $comment_meta_information, $comment_divider_header, $admin_lang_cmnt_commenter, $datetime, $admin_lang_cmnt_ip, $ip, $divide_somewhat, $divide_moderately, $divide_quite, $divide_extreme;
    // the headers have not been set
    if (isset($_GET['commentsview']) && $_GET['commentsview'] == 'defensio') {
        $query = "SELECT `spaminess` FROM {$pixelpost_db_prefix}comments WHERE `id`='" . $id . "'";
        $result = mysql_query($query) or die(mysql_error());
        while ($row = mysql_fetch_array($result)) {
            $spaminess = $row[0];
        }
        $comment_row_class = "defensio_" . defensio_class_for_spaminess($spaminess);
        if ($spaminess > 0) {
            $spaminess_show = $spaminess * 100 . "%";
        } else {
            // always clean the url
            $url_param = explode('&action=defensiorecheck', $_SERVER['QUERY_STRING']);
            $spaminess_show = "<span style='color:red;font-weight:bold;'>COMMENT NOT CHECKED WITH DEFENSIO <a href='" . $_SERVER['PHP_SELF'] . "?" . $url_param[0] . "&amp;action=defensiorecheck&amp;cid=" . $id . "'>CLICK HERE TO TRY AGAIN</a></span>";
        }
        // overide the comment meta information
        $comment_meta_information = "<i>{$admin_lang_cmnt_commenter} {$datetime}. {$admin_lang_cmnt_ip}  {$ip}. Spaminess: {$spaminess_show}.<br /></i>";
        if ($spaminess <= 0.55) {
            $comment_divider_header = $_SESSION['divide_somewhat'];
            $_SESSION['divide_somewhat'] = null;
        }
        if ($spaminess > 0.55 && $spaminess <= 0.77) {
            $comment_divider_header = $_SESSION['divide_moderately'];
            $_SESSION['divide_moderately'] = null;
        }
        if ($spaminess > 0.77 && $spaminess <= 0.9) {
            $comment_divider_header = $_SESSION['divide_quite'];
            $_SESSION['divide_quite'] = null;
        }
        if ($spaminess > 0.9) {
            $comment_divider_header = $_SESSION['divide_extreme'];
            $_SESSION['divide_extreme'] = null;
        }
    }
}
/**
 * defensio_commentlist()
 * 
 * @return
 */
function defensio_commentlist()
{
    global $comment_row_class, $id, $pixelpost_db_prefix, $comment_meta_information, $comment_divider_header, $admin_lang_cmnt_commenter, $datetime, $admin_lang_cmnt_ip, $ip, $divide_somewhat, $divide_moderately, $divide_quite, $divide_extreme;
    // the headers have not been set
    if (isset($_GET['commentsview']) && $_GET['commentsview'] == 'defensio') {
        $query = "SELECT `spaminess`, `status` FROM {$pixelpost_db_prefix}comments WHERE `id`='" . $id . "'";
        $defensio_result = mysql_query($query) or die(mysql_error());
        while ($row = mysql_fetch_array($defensio_result)) {
            $spaminess = $row[0];
            $status = $row[1];
        }
        $comment_row_class = "defensio_" . defensio_class_for_spaminess($spaminess);
        if ($spaminess > 0) {
            $spaminess_show = $spaminess * 100 . "%";
            $menu_items = null;
        } else {
            // always clean the url
            if ($status == 'pending') {
                $url_param = explode('&action=defensiorecheck', $_SERVER['QUERY_STRING']);
                $spaminess_show = "<span style='color:blue;font-weight:bold;'>PENDING (results are not in)</span>";
                $menu_items = "<a href='" . $_SERVER['PHP_SELF'] . "?" . $url_param[0] . "&amp;action=defensiogetresults&amp;cid=" . $id . "'><img style='border:none;height:32px;' src='../addons/_defensio2.0/images/get.png' alt='Click here to get the results of this comment.' /> </a>";
            } elseif ($status == 'fail') {
                $url_param = explode('&action=defensiorecheck', $_SERVER['QUERY_STRING']);
                $spaminess_show = "<span style='color:red;font-weight:bold;'>UNKNOWN (request failed)</span>";
                $menu_items = "<a href='" . $_SERVER['PHP_SELF'] . "?" . $url_param[0] . "&amp;action=defensiorecheck&amp;cid=" . $id . "'><img style='border:none;height:32px;' src='../addons/_defensio2.0/images/reload.png' alt='Click here to re-evaluate this comment.' /> </a>";
            }
        }
        // overide the comment meta information
        $comment_meta_information = "{$menu_items} <i>{$admin_lang_cmnt_commenter} {$datetime}. {$admin_lang_cmnt_ip}  {$ip}. Spaminess: {$spaminess_show}.<br /></i>";
        if ($spaminess <= 0.55) {
            $comment_divider_header = $_SESSION['divide_somewhat'];
            $_SESSION['divide_somewhat'] = null;
        }
        if ($spaminess > 0.55 && $spaminess <= 0.77) {
            $comment_divider_header = $_SESSION['divide_moderately'];
            $_SESSION['divide_moderately'] = null;
        }
        if ($spaminess > 0.77 && $spaminess <= 0.9) {
            $comment_divider_header = $_SESSION['divide_quite'];
            $_SESSION['divide_quite'] = null;
        }
        if ($spaminess > 0.9) {
            $comment_divider_header = $_SESSION['divide_extreme'];
            $_SESSION['divide_extreme'] = null;
        }
    }
}