Make WordPress Core


Ignore:
Timestamp:
12/22/2003 02:46:40 AM (21 years ago)
Author:
saxmatt
Message:

Trackback on edit done.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/post.php

    r631 r636  
    6363            $post_password = addslashes($HTTP_POST_VARS['post_password']);
    6464            $post_name = sanitize_title($post_title);
     65            $trackback = $HTTP_POST_VARS['trackback_url'];
     66        // Format trackbacks
     67        $trackback = preg_replace('|\s+|', '\n', $trackback);
    6568
    6669        if ($user_level == 0)
     
    8790        if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) {
    8891        $postquery ="INSERT INTO $tableposts
    89                 (ID, post_author, post_date, post_content, post_title, post_lat, post_lon, post_excerpt,  post_status, comment_status, ping_status, post_password, post_name)
     92                (ID, post_author, post_date, post_content, post_title, post_lat, post_lon, post_excerpt,  post_status, comment_status, ping_status, post_password, post_name, to_ping)
    9093                VALUES
    91                 ('0', '$user_ID', '$now', '$content', '$post_title', $post_latf, $post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name')
     94                ('0', '$user_ID', '$now', '$content', '$post_title', $post_latf, $post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback')
    9295                ";
    9396        } else {
    9497        $postquery ="INSERT INTO $tableposts
    95                 (ID, post_author, post_date, post_content, post_title, post_excerpt,  post_status, comment_status, ping_status, post_password, post_name)
     98                (ID, post_author, post_date, post_content, post_title, post_excerpt,  post_status, comment_status, ping_status, post_password, post_name, to_ping)
    9699                VALUES
    97                 ('0', '$user_ID', '$now', '$content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name')
     100                ('0', '$user_ID', '$now', '$content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback')
    98101                ";
    99102        }
     
    141144       
    142145        if ('' != $HTTP_POST_VARS['save']) $location = "post.php?action=edit&post=$post_ID";
    143         header("Location: $location");
     146       
     147        header("Location: $location");
    144148
    145149        if ($post_status == 'publish') {
     
    154158            }
    155159
    156             if (!empty($HTTP_POST_VARS['trackback_url'])) {
     160            // Time for trackbacks
     161            $to_ping = $wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID");
     162            $pinged = $wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID");
     163            $pinged = explode("\n", $pinged);
     164            if ('' != $to_ping) {
    157165                if (strlen($excerpt) > 0) {
    158166                    $the_excerpt = (strlen(strip_tags($excerpt)) > 255) ? substr(strip_tags($excerpt), 0, 252) . '...' : strip_tags($excerpt)   ;
     
    160168                    $the_excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252) . '...' : strip_tags($content);
    161169                }
    162                 $excerpt = stripslashes($the_excerpt);
    163                 $trackback_urls = explode(',', $HTTP_POST_VARS['trackback_url']);
    164                 foreach($trackback_urls as $tb_url) {
    165                     $tb_url = trim($tb_url);
    166                     trackback($tb_url, stripslashes($post_title), $excerpt, $post_ID);
    167                 }
    168             }
     170                $excerpt = stripslashes($the_excerpt);
     171                $to_pings = explode("\n", $to_ping);
     172                foreach ($to_pings as $tb_ping) {
     173                    $tb_ping = trim($tb_ping);
     174                    if (!in_array($tb_ping, $pinged)) {
     175                     trackback($tb_ping, stripslashes($post_title), $excerpt, $post_ID);
     176                    }
     177                }
     178            }
     179
    169180        } // end if publish
    170181
     
    196207            $ping_status = $postdata['ping_status'];
    197208            $post_password = $postdata['post_password'];
     209            $to_ping = $postdata['to_ping'];
     210            $pinged = $postdata['pinged'];
    198211
    199212            include('edit-form.php');
     
    246259            $post_password = addslashes($HTTP_POST_VARS['post_password']);
    247260            $post_name = sanitize_title($post_title);
     261            $trackback = $HTTP_POST_VARS['trackback_url'];
     262        // Format trackbacks
     263        $trackback = preg_replace('|\s+|', '\n', $trackback);
    248264
    249265        if (($user_level > 4) && (!empty($HTTP_POST_VARS['edit_date']))) {
     
    274290                ping_status = '$ping_status',
    275291                post_password = '$post_password',
    276                 post_name = '$post_name'
     292                post_name = '$post_name',
     293                to_ping = '$trackback'
    277294            WHERE ID = $post_ID ");
    278295
     
    302319            pingWeblogs($blog_ID);
    303320            pingBlogs($blog_ID);
    304 
    305             if ($post_pingback) {
    306                 pingback($content, $post_ID);
    307             }
    308 
    309             if (!empty($HTTP_POST_VARS['trackback_url'])) {
    310                 $excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252) . '...' : strip_tags($content);
    311                 $excerpt = stripslashes($excerpt);
    312                 $trackback_urls = explode(',', $HTTP_POST_VARS['trackback_url']);
    313                 foreach($trackback_urls as $tb_url) {
    314                     $tb_url = trim($tb_url);
    315                     trackback($tb_url, stripslashes($post_title), $excerpt, $post_ID);
    316                 }
    317             }
     321        } // end if moving from draft/private to published
     322        if ($post_status == 'publish') {
     323            // Trackback time.
     324            $to_ping = trim($wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID"));
     325            $pinged = trim($wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID"));
     326            $pinged = explode("\n", $pinged);
     327            if ('' != $to_ping) {
     328                if (strlen($excerpt) > 0) {
     329                    $the_excerpt = (strlen(strip_tags($excerpt)) > 255) ? substr(strip_tags($excerpt), 0, 252) . '...' : strip_tags($excerpt)   ;
     330                } else {
     331                    $the_excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252) . '...' : strip_tags($content);
     332                }
     333                $excerpt = stripslashes($the_excerpt);
     334                $to_pings = explode("\n", $to_ping);
     335                foreach ($to_pings as $tb_ping) {
     336                    $tb_ping = trim($tb_ping);
     337                    if (!in_array($tb_ping, $pinged)) {
     338                     trackback($tb_ping, stripslashes($post_title), $excerpt, $post_ID);
     339                    }
     340                }
     341            }
    318342        } // end if publish
     343       
    319344
    320345        $location = "Location: post.php";
     
    358383        }
    359384
    360         // pingWeblogs($blog_ID);
    361385        $sendback = $HTTP_SERVER_VARS['HTTP_REFERER'];
    362386        if (strstr($sendback, 'post.php')) $sendback = $siteurl .'/wp-admin/post.php';
Note: See TracChangeset for help on using the changeset viewer.