Make WordPress Core

Changeset 408


Ignore:
Timestamp:
10/03/2003 10:52:59 PM (22 years ago)
Author:
saxmatt
Message:

Bring trackback notification up to date with comment notification stuff.

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)) {
    32
    4     <?php // don't touch these 2 lines
    5     $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 <?php
    33    
    343} else {
    354
    365if (!empty($HTTP_GET_VARS['tb_id'])) {
    376    // trackback is done by a GET
    38     $tb_id = $HTTP_GET_VARS['tb_id'];
     7    $tb_id = intval($HTTP_GET_VARS['tb_id']);
    398    $tb_url = $HTTP_GET_VARS['url'];
    409    $title = $HTTP_GET_VARS['title'];
     
    4514    $request_array = 'HTTP_POST_VARS';
    4615    $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]);
    4817    $tb_url = $HTTP_POST_VARS['url'];
    4918    $title = $HTTP_POST_VARS['title'];
     
    8554    $original_comment = $comment;
    8655    $comment_post_ID = $tb_id;
    87     $autobr = 1;
    8856
    8957    $user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
     
    10169    $author = addslashes($author);
    10270
    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')");
    10572    if (!$result) {
    10673        die ("There is an error with the database, it can't store your comment...<br />Contact the <a href=\"mailto:$admin_email\">webmaster</a>");
    10774    } 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) {
    11078
    11179            $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";
    11785
    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']).'"';
    12287
    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);
    12592        }
    126 
    12793        trackback_response(0);
    12894    }
    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 
    14095}
    141 
     96}
    14297?>
Note: See TracChangeset for help on using the changeset viewer.