Make WordPress Core

Changeset 1011


Ignore:
Timestamp:
03/25/2004 10:11:58 AM (22 years ago)
Author:
saxmatt
Message:

If more than X links in a comment, moderate that sucker.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-discussion.php

    r993 r1011  
    6969    <form name="form1" method="post" action="options.php">
    7070        <input type="hidden" name="action" value="update" />
    71         <input type="hidden" name="page_options" value="'default_pingback_flag','default_ping_status','default_comment_status','comments_notify','moderation_notify','comment_moderation','require_name_email','moderation_keys'" />
    72         <p>Usual settings for an article: <em>(These settings may be overidden for individual articles.)</em></p>
     71        <input type="hidden" name="page_options" value="'default_pingback_flag','default_ping_status','default_comment_status','comments_notify','moderation_notify','comment_moderation','require_name_email','comment_max_links','moderation_keys'" />
     72        <h3>Usual settings for an article: <em>(These settings may be overidden for individual articles.)</em></h3>
    7373        <ul>
    7474            <li>
     
    8888            </li>
    8989        </ul>
    90         <p>Email me whenever:</p>
     90        <h3>Email me whenever:</h3>
    9191        <ul>
    9292            <li>
     
    101101            </li>
    102102        </ul>
    103         <p>Before a comment appears:</p>
     103        <h3>Before a comment appears:</h3>
    104104        <ul>
    105105            <li>
     
    114114            </li>
    115115        </ul>
    116         <p>When a comment contains any of these words in its content, name, URI,  email, or IP, hold it in the moderation queue: (Seperate multiple words with new lines.) <a href="http://wiki.wordpress.org/index.php/SpamWords">Common spam words</a>.</p>
     116        <h3>Comment Moderation:</h3>
     117        <p>Hold a comment in the queue if it contains more than
     118            <input name="comment_max_links" type="text" id="comment_max_links" size="3" value="<?php echo get_settings('comment_max_links'); ?>" />
     119        links. (A common characteristic of comment spam is a large number of hyperlinks.)</p>
     120        <p>When a comment contains any of these words in its content, name, URI,  email, or IP, hold it in the moderation queue: (Seperate multiple words with new lines.) <a href="http://wiki.wordpress.org/index.php/SpamWords">Common spam words</a>.</p>
    117121        <p>
    118122            <textarea name="moderation_keys" cols="60" rows="4" id="moderation_keys" style="width: 98%;"><?php echo get_settings('moderation_keys'); ?></textarea>
  • trunk/wp-admin/upgrade-functions.php

    r1008 r1011  
    795795    }
    796796
     797    // Option for max # of links per comment
     798    if(!$wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'comment_max_links'")) {
     799        $wpdb->query("INSERT INTO $tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('comment_max_links', 3, '5', 8)");
     800    }
     801
    797802}
    798803
  • trunk/wp-includes/functions.php

    r1009 r1011  
    15781578        if ( preg_match($pattern, $user_ip) ) return false;
    15791579    }
     1580
     1581    preg_match_all('|([\n ])([a-z]+?)://([^, <>{}\n\r]+)|i', $comment, $all_links);
     1582    $number = count($all_links[0]);
     1583    if ($number >= get_settings('comment_max_links')) return false;
     1584
    15801585return true;
    15811586}
Note: See TracChangeset for help on using the changeset viewer.