Changeset 408
- Timestamp:
- 10/03/2003 10:52:59 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2trackback.php
r258 r408 1 <?php if (!empty($tb)) { ?> 2 <!-- you can START editing here --> 1 <?php if (!empty($tb)) { 3 2 4 <?php // don't touch these 2 lines5 $resultc = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_content LIKE '%<trackback />%' ORDER BY comment_date"); if ($resultc) {6 ?>7 8 <h2>Trackbacks</h2>9 10 <p>The URL to TrackBack this entry is:</p>11 <p><em><?php trackback_url() ?></em></p>12 13 <ol id="trackbacks">14 <?php /* this line is b2's motor, do not delete it */ foreach ($resultc as $rowc) { $commentdata = get_commentdata($rowc->comment_ID); ?>15 <li id="trackback-<?php comment_ID() ?>">16 <?php comment_text() ?>17 18 <p><cite>Tracked on <a href="<?php comment_author_url(); ?>" title="<?php comment_author() ?>"><?php comment_author() ?></a> on <?php comment_date() ?> @ <?php comment_time() ?></cite></p>19 </li>20 21 <?php /* end of the loop, don't delete */ } if (!$wxcvbn_c) { ?>22 23 <!-- this is displayed if there are no trackbacks so far -->24 <li>No trackbacks yet.</li>25 26 <?php /* if you delete this the sky will fall on your head */ } ?>27 </ol>28 <div><a href="javascript:history.go(-1)">Go back</a></div>29 <?php /* if you delete this the sky will fall on your head */ } ?>30 <!-- STOP editing there -->31 32 <?php33 34 3 } else { 35 4 36 5 if (!empty($HTTP_GET_VARS['tb_id'])) { 37 6 // trackback is done by a GET 38 $tb_id = $HTTP_GET_VARS['tb_id'];7 $tb_id = intval($HTTP_GET_VARS['tb_id']); 39 8 $tb_url = $HTTP_GET_VARS['url']; 40 9 $title = $HTTP_GET_VARS['title']; … … 45 14 $request_array = 'HTTP_POST_VARS'; 46 15 $tb_id = explode('/', $HTTP_SERVER_VARS['REQUEST_URI']); 47 $tb_id = $tb_id[count($tb_id)-1];16 $tb_id = inval($tb_id[count($tb_id)-1]); 48 17 $tb_url = $HTTP_POST_VARS['url']; 49 18 $title = $HTTP_POST_VARS['title']; … … 85 54 $original_comment = $comment; 86 55 $comment_post_ID = $tb_id; 87 $autobr = 1;88 56 89 57 $user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR']; … … 101 69 $author = addslashes($author); 102 70 103 $query = "INSERT INTO $tablecomments VALUES ('0','$comment_post_ID','$author','$email','$tb_url','$user_ip','$now','$comment','0')"; 104 $result = $wpdb->query($query); 71 $result = $wpdb->query("INSERT INTO $tablecomments VALUES ('0', '$comment_post_ID', '$author', '$email', '$tb_url', '$user_ip', '$now', '$comment', '0')"); 105 72 if (!$result) { 106 73 die ("There is an error with the database, it can't store your comment...<br />Contact the <a href=\"mailto:$admin_email\">webmaster</a>"); 107 74 } else { 108 109 if ($comments_notify) { 75 $postdata = get_postdata($comment_post_ID); 76 $authordata = get_userdata($postdata["Author_ID"]); 77 if ($comments_notify && '' != $authordata->user_email) { 110 78 111 79 $notify_message = "New trackback on your post #$comment_post_ID.\r\n\r\n"; 112 $notify_message .= " website: $comment_author (IP: $user_ip , $user_domain)\r\n";113 $notify_message .= " url: $comment_author_url\r\n";114 $notify_message .= " excerpt: \n".stripslashes($original_comment)."\r\n\r\n";115 $notify_message .= "You can see all trackbacks on this post there: \r\n";116 $notify_message .= "$siteurl/$blogfilename?p=$comment_post_ID& tb=1\r\n\r\n";80 $notify_message .= "Website: $comment_author (IP: $user_ip , $user_domain)\r\n"; 81 $notify_message .= "URI : $comment_author_url\r\n"; 82 $notify_message .= "Excerpt: \n".stripslashes($original_comment)."\r\n\r\n"; 83 $notify_message .= "You can see all trackbacks on this post here: \r\n"; 84 $notify_message .= "$siteurl/$blogfilename?p=$comment_post_ID&c=1\r\n\r\n"; 117 85 118 $postdata = get_postdata($comment_post_ID); 119 $authordata = get_userdata($postdata["Author_ID"]); 120 $recipient = $authordata["user_email"]; 121 $subject = "trackback on post #$comment_post_ID \"".$postdata["Title"]."\""; 86 $subject = '[' . stripslashes($blogname) . '] Trackback: "' .stripslashes($postdata['Title']).'"'; 122 87 123 @mail($recipient, $subject, $notify_message, "From: wordpress@".$HTTP_SERVER_VARS['SERVER_NAME']."\r\n"."X-Mailer: WordPress $b2_version - PHP/" . phpversion()); 124 88 $from = "From: wordpress@".$HTTP_SERVER_VARS['SERVER_NAME']; 89 $from .= "X-Mailer: WordPress $b2_version with PHP/" . phpversion(); 90 91 @mail($authordata->user_email, $subject, $notify_message, $from); 125 92 } 126 127 93 trackback_response(0); 128 94 } 129 130 }/* elseif (empty($HTTP_GET_VARS['__mode'])) {131 132 header('Content-type: application/xml');133 echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">\n<response>\n<error>1</error>\n";134 echo "<message>Tell me a lie. \nOr just a __mode or url parameter ?</message>\n";135 echo "</response>";136 137 }*/138 139 140 95 } 141 96 } 142 97 ?>
Note: See TracChangeset
for help on using the changeset viewer.