示例#1
0
function comment_display_author_text($comment_id)
{
    $sql = "SELECT user, nick, email, url, added FROM " . PREFIX . "comment WHERE id=" . sql_safe($comment_id) . ";";
    if ($cc = mysql_query($sql)) {
        if ($c = mysql_fetch_assoc($cc)) {
            $comment_time = date("Y-m-d H:i", strtotime($c['added']));
            $comment_link = comment_get_link($comment_id);
            $user_link = NULL;
            if ($c['user'] !== NULL) {
                $user_name = user_get_name($c['user']);
                $user_link = user_get_link($c['user']);
            } else {
                if ($c['nick'] !== NULL) {
                    $user_name = $c['nick'];
                    $user_link = "<a href=\"" . $c['url'] . "\">" . $user_name . "</a>";
                }
            }
            //Kolla om författaren är admin
            if (user_get_admin($c['user']) > 1) {
                $admin = " " . _("(Admin)");
            } else {
                $admin = "";
            }
            if (!isset($user_name)) {
                echo sprintf(_("Posted at <a href=\"%s\">%s</a>"), $comment_link, $comment_time);
            } else {
                if ($user_link == NULL) {
                    echo sprintf(_("Posted by %s%s at <a href=\"%s\">%s</a>"), $user_name, $admin, $comment_link, $comment_time);
                } else {
                    echo sprintf(_("Posted by %s%s at <a href=\"%s\">%s</a>"), $user_link, $admin, $comment_link, $comment_time);
                }
            }
        }
    }
}
示例#2
0
function spam_admin_list($nr = 20)
{
    spam_calculate(20, "comment");
    spam_calculate(20, "feedback");
    spam_calculate(20, "FAQ");
    spam_remove_old("comment", "1 year");
    spam_remove_old("feedback", "1 year");
    spam_remove_old("FAQ", "1 year");
    //Visa en lista på kommentarer med lägst poäng
    echo "<h2>Comments</h2>";
    $sql = "SELECT id, spam_score, is_spam, comment FROM " . PREFIX . "comment WHERE is_spam>-02 AND is_spam<2 ORDER BY spam_score ASC, added ASC LIMIT 0," . sql_safe($nr) . ";";
    // echo "<br />DEBUG1018: $sql";
    if ($cc = mysql_query($sql)) {
        echo "<form method=\"post\">";
        echo "<input type=\"hidden\" name=\"type\" value=\"comment\">";
        while ($c = mysql_fetch_array($cc)) {
            echo "<p><input type=\"checkbox\" name=\"id[]\" value=\"" . $c['id'] . "\"> <a href=\"" . SITE_URL . "?page=individual_spam_score&amp;type=comment&amp;id=" . $c['id'] . "\">[" . $c['spam_score'] . "]</a>:  " . $c['comment'] . " <a href=\"" . comment_get_link($c['id']) . "\">[...]</a></p>";
        }
        echo "<input type=\"button\" value=\"Markera alla\" onclick=\"CheckAll(this.form);\"><br />";
        echo "<input type=\"submit\" name=\"this_is_spam\" value=\"Mark as spam\">";
        echo "<input type=\"submit\" name=\"this_is_not_spam\" value=\"Mark as not spam\">";
        echo "</form>";
    }
    //Visa en lista på feedback med lägst poäng
    echo "<h2>feedback</h2>";
    $sql = "SELECT id, spam_score, is_spam, subject, text FROM " . PREFIX . "feedback WHERE is_spam>-02 AND is_spam<2 ORDER BY spam_score ASC, created ASC LIMIT 0," . sql_safe($nr) . ";";
    // echo "<br />DEBUG1018: $sql";
    if ($cc = mysql_query($sql)) {
        echo "<form method=\"post\">";
        echo "<input type=\"hidden\" name=\"type\" value=\"feedback\">";
        while ($c = mysql_fetch_array($cc)) {
            echo "<p><input type=\"checkbox\" name=\"id[]\" value=\"" . $c['id'] . "\">\n\t\t\t<a href=\"" . SITE_URL . "?page=individual_spam_score&amp;type=feedback&amp;id=" . $c['id'] . "\">[" . $c['spam_score'] . "]</a>:  <strong>" . $c['subject'] . "</strong> - " . $c['text'] . " \n\t\t\t<a href=\"" . SITE_URL . "?page=feedback&amp;id=" . $c['id'] . "\">[...]</a></p>";
        }
        echo "<input type=\"button\" value=\"Markera alla\" onclick=\"CheckAll(this.form);\"><br />";
        echo "<input type=\"submit\" name=\"this_is_spam\" value=\"Mark as spam\">";
        echo "<input type=\"submit\" name=\"this_is_not_spam\" value=\"Mark as not spam\">";
        echo "</form>";
    }
    //Visa en lista på FAQ med lägst poäng
    echo "<h2>Help!</h2>";
    $sql = "SELECT id, spam_score, is_spam, subject, text FROM " . PREFIX . "FAQ WHERE is_spam>-02 AND is_spam<2 ORDER BY spam_score ASC, created ASC LIMIT 0," . sql_safe($nr) . ";";
    // echo "<br />DEBUG1018: $sql";
    if ($cc = mysql_query($sql)) {
        echo "<form method=\"post\">";
        echo "<input type=\"hidden\" name=\"type\" value=\"FAQ\">";
        while ($c = mysql_fetch_array($cc)) {
            echo "<p><input type=\"checkbox\" name=\"id[]\" value=\"" . $c['id'] . "\"> <a href=\"" . SITE_URL . "?page=individual_spam_score&amp;type=FAQ&amp;id=" . $c['id'] . "\">[" . $c['spam_score'] . "]</a>:  <strong>" . $c['subject'] . "</strong> - " . $c['text'] . " \n\t\t\t<a href=\"" . SITE_URL . "?page=FAQ&amp;id=" . $c['id'] . "\">[...]</a></p>";
        }
        echo "<input type=\"button\" value=\"Markera alla\" onclick=\"CheckAll(this.form);\"><br />";
        echo "<input type=\"submit\" name=\"this_is_spam\" value=\"Mark as spam\">";
        echo "<input type=\"submit\" name=\"this_is_not_spam\" value=\"Mark as not spam\">";
        echo "</form>";
    }
}