Changeset 407
- Timestamp:
- 10/03/2003 10:31:47 PM (22 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
b2comments.php (modified) (4 diffs)
-
b2comments.post.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2comments.php
r396 r407 11 11 } 12 12 13 $comment_author = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "name" : $HTTP_COOKIE_VARS["comment_author"];14 $comment_author_email = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "email" :trim($HTTP_COOKIE_VARS["comment_author_email"]);15 $comment_author_url = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "url" :trim($HTTP_COOKIE_VARS["comment_author_url"]);13 $comment_author = trim($HTTP_COOKIE_VARS["comment_author"]); 14 $comment_author_email = trim($HTTP_COOKIE_VARS["comment_author_email"]); 15 $comment_author_url = trim($HTTP_COOKIE_VARS["comment_author_url"]); 16 16 17 17 $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date"); 18 18 ?> 19 19 20 <!-- you can start editing here-->20 <!-- You can start editing here. --> 21 21 22 22 <h2>Comments</h2> … … 25 25 26 26 <?php if ('open' == $post->ping_status) { ?> 27 <p>The URL to TrackBack this entry is:</p> 28 <p><em><?php trackback_url() ?></em></p> 27 <p>The <acronym title="Uniform Resource Identifier">URI</acronym> to TrackBack this entry is: <em><?php trackback_url() ?></em></p> 29 28 <?php } ?> 30 29 … … 49 48 <h2>Leave a Comment</h2> 50 49 <?php if ('open' == $post->comment_status) { ?> 51 <p>Line and paragraph breaks automatic, website trumps email, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: < ?php echo htmlentities($comment_allowed_tags); ?></p>50 <p>Line and paragraph breaks automatic, website trumps email, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo htmlentities(str_replace('<', ' <', $comment_allowed_tags)); ?></code></p> 52 51 53 52 … … 67 66 <p> 68 67 <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" /> 69 <label for="url"><acronym title="Uniform Resource Locator">URL</acronym></label>68 <label for="url"><acronym title="Uniform Resource Identifier">URI</acronym></label> 70 69 </p> 71 70 -
trunk/b2comments.post.php
r357 r407 22 22 } 23 23 24 $author = trim($HTTP_POST_VARS['author']); 25 $email = trim($HTTP_POST_VARS['email']); 26 $url = trim($HTTP_POST_VARS['url']); 24 $author = trim(strip_tags($HTTP_POST_VARS['author'])); 25 26 $email = trim(strip_tags($HTTP_POST_VARS['email'])); 27 if (strlen($email) < 6) 28 $email = ''; 29 30 $url = trim(strip_tags($HTTP_POST_VARS['url'])); 31 $url = ((!stristr($url, '://')) && ($url != '')) ? 'http://'.$url : $url; 32 if (strlen($url) < 7) 33 $url = ''; 34 27 35 $comment = trim($HTTP_POST_VARS['comment']); 28 36 $original_comment = $comment; 29 $comment_autobr = $HTTP_POST_VARS['comment_autobr']; 30 $comment_post_ID = $HTTP_POST_VARS['comment_post_ID']; 37 $comment_post_ID = intval($HTTP_POST_VARS['comment_post_ID']); 38 $user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR']; 39 $user_domain = gethostbyaddr($user_ip); 31 40 32 41 $commentstatus = $wpdb->get_var("SELECT comment_status FROM $tableposts WHERE ID = $comment_post_ID"); … … 44 53 } 45 54 46 $user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];47 $user_domain = gethostbyaddr($user_ip);48 55 $time_difference = get_settings('time_difference'); 49 56 $now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600))); 50 57 51 $author = trim(strip_tags($author)); 52 $email = trim(strip_tags($email)); 53 if (strlen($email) < 6) 54 $email = ''; 55 56 $url = trim(strip_tags($url)); 57 $url = ((!stristr($url, '://')) && ($url != '')) ? 'http://'.$url : $url; 58 if (strlen($url) < 7) 59 $url = ''; 60 61 $comment = trim(strip_tags($comment, $comment_allowed_tags)); 58 $comment = strip_tags($comment, $comment_allowed_tags); 62 59 $comment = balanceTags($comment, 1); 63 60 $comment = convert_chars($comment); … … 74 71 /* flood-protection */ 75 72 $lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1"); 76 $ok = 1;73 $ok = true; 77 74 if (!empty($lasttime)) { 78 75 $time_lastcomment= mysql2date('U', $lasttime); 79 76 $time_newcomment= mysql2date('U', "$now"); 80 77 if (($time_newcomment - $time_lastcomment) < 10) 81 $ok = 0;78 $ok = false; 82 79 } 83 80 /* end flood-protection */ … … 87 84 if ($ok) { // if there was no comment from this IP in the last 10 seconds 88 85 89 $wpdb->query("INSERT INTO $tablecomments VALUES ('0', '$comment_post_ID','$author','$email','$url','$user_ip','$now','$comment','0')");86 $wpdb->query("INSERT INTO $tablecomments VALUES ('0', '$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$comment', '0')"); 90 87 91 88 if ($comments_notify) {
Note: See TracChangeset
for help on using the changeset viewer.