Make WordPress Core


Ignore:
Timestamp:
11/15/2003 08:58:18 AM (22 years ago)
Author:
saxmatt
Message:

Cleaning up comment moderation and the comment code in general. More to do tomorrow with regards to wp-moderation.php.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/b2comments.post.php

    r546 r549  
    4444    die('Sorry, comments are closed for this item.');
    4545
    46 if ($require_name_email && ($email == '' || $email == '@' || $author == '' || $author == 'name')) { //original fix by Dodo, and then Drinyth
    47     echo 'Error: please fill the required fields (name, email).';
    48     exit;
     46if ($require_name_email && ($email == '' || $author == '')) { //original fix by Dodo, and then Drinyth
     47    die('Error: please fill the required fields (name, email).');
    4948}
    5049if ($comment == 'comment' || $comment == '') {
    51     echo "Error: please type a comment";
    52     exit;
     50    die('Error: please type a comment.');
    5351}
    5452
    55 $time_difference = get_settings('time_difference');
    56 $now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600)));
     53
     54$now = current_time('mysql');
    5755
    5856$comment = strip_tags($comment, $comment_allowed_tags);
     
    6967$url = addslashes($url);
    7068
    71 /* flood-protection */
     69/* Flood-protection */
    7270$lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1");
    7371$ok = true;
     
    7876        $ok = false;
    7977}
    80 /* end flood-protection */
     78/* End flood-protection */
    8179
    8280
    8381
    8482if ($ok) { // if there was no comment from this IP in the last 10 seconds
    85     $comment_moderation = get_settings("comment_moderation");
    86     $moderation_notify = get_settings("moderation_notify");
     83    $comment_moderation = get_settings('comment_moderation');
     84    $moderation_notify = get_settings('moderation_notify');
    8785   
    8886    // o42: this place could be the hook for further comment spam checking
     
    9896    $wpdb->query("INSERT INTO $tablecomments (comment_ID,comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content,comment_karma,comment_approved) VALUES ('0', '$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$comment', '0', '$approved')");
    9997
    100     // o42: this should be changed as soon as other sql dbs are supported
    101     // as it's proprietary to mysql
    102     $comment_ID = $wpdb->get_var("SELECT last_insert_id()");
     98/*
     99    $comment_ID = $wpdb->get_var('SELECT last_insert_id()');
    103100
    104101    $fp = fopen("/tmp/wpdebug.txt", "w+");
     
    118115    fclose($fp);
    119116
     117*/
    120118    if ($email == '')
    121119        $email = ' '; // this to make sure a cookie is set for 'no email'
     
    128126    setcookie('comment_author_url_'.$cookiehash, $url, time()+30000000);
    129127
    130         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
    131         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     128    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     129    header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    132130    header('Cache-Control: no-cache, must-revalidate');
    133131    header('Pragma: no-cache');
    134     $location = (!empty($HTTP_POST_VARS['redirect_to'])) ? $HTTP_POST_VARS['redirect_to'] : $HTTP_SERVER_VARS["HTTP_REFERER"];
     132    $location = (empty($HTTP_POST_VARS['redirect_to'])) ? $HTTP_SERVER_VARS["HTTP_REFERER"] : $HTTP_POST_VARS['redirect_to'];
    135133    if ($is_IIS) {
    136134        header("Refresh: 0;url=$location");
Note: See TracChangeset for help on using the changeset viewer.