From 8bf3591d673ecb07cc7fca2baf0dce21c9963169 Mon Sep 17 00:00:00 2001 From: mikelittle Date: Fri, 6 Jun 2003 23:21:45 +0000 Subject: [PATCH] Implemented, only ping weblogs, pingback and trackback when creating a published (not draft) post OR when editing a post from draft to published git-svn-id: http://svn.automattic.com/wordpress/trunk@178 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/b2edit.form.php | 2 ++ wp-admin/b2edit.php | 59 ++++++++++++++++++++++++----------- wp-admin/b2edit.showposts.php | 2 +- 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/wp-admin/b2edit.form.php b/wp-admin/b2edit.form.php index 50e6999d9d..ffac9b0f20 100644 --- a/wp-admin/b2edit.form.php +++ b/wp-admin/b2edit.form.php @@ -30,6 +30,7 @@ switch($action) { $form_extra = "' />\n'; + $form_prevstatus = ''; $form_trackback = ''; break; case "editcomment": @@ -143,6 +144,7 @@ if ($action != 'editcomment') {
+

diff --git a/wp-admin/b2edit.php b/wp-admin/b2edit.php index c339ca98de..4e071a6c64 100644 --- a/wp-admin/b2edit.php +++ b/wp-admin/b2edit.php @@ -81,23 +81,26 @@ switch($action) { if (isset($sleep_after_edit) && $sleep_after_edit > 0) { sleep($sleep_after_edit); } - - pingWeblogs($blog_ID); - pingCafelog($cafelogID, $post_title, $post_ID); - pingBlogs($blog_ID); - if ($post_pingback) { - pingback($content, $post_ID); - } - - if (!empty($HTTP_POST_VARS['trackback_url'])) { - $excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252).'...' : strip_tags($content); - $excerpt = stripslashes($excerpt); - $trackback_urls = explode(',', $HTTP_POST_VARS['trackback_url']); - foreach($trackback_urls as $tb_url) { - $tb_url = trim($tb_url); - trackback($tb_url, stripslashes($post_title), $excerpt, $post_ID); + + if ($post_status == 'publish') { + pingWeblogs($blog_ID); + pingCafelog($cafelogID, $post_title, $post_ID); + pingBlogs($blog_ID); + + if ($post_pingback) { + pingback($content, $post_ID); } - } + + if (!empty($HTTP_POST_VARS['trackback_url'])) { + $excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252).'...' : strip_tags($content); + $excerpt = stripslashes($excerpt); + $trackback_urls = explode(',', $HTTP_POST_VARS['trackback_url']); + foreach($trackback_urls as $tb_url) { + $tb_url = trim($tb_url); + trackback($tb_url, stripslashes($post_title), $excerpt, $post_ID); + } + } + } // end if publish if (!empty($HTTP_POST_VARS["mode"])) { switch($HTTP_POST_VARS["mode"]) { @@ -173,6 +176,7 @@ switch($action) { $excerpt = format_to_post($excerpt); $post_title = addslashes($HTTP_POST_VARS["post_title"]); $post_status = $HTTP_POST_VARS['post_status']; + $prev_status = $HTTP_POST_VARS['prev_status']; $comment_status = $HTTP_POST_VARS['comment_status']; $ping_status = $HTTP_POST_VARS['ping_status']; $post_password = addslashes($HTTP_POST_VARS['post_password']); @@ -200,7 +204,26 @@ switch($action) { sleep($sleep_after_edit); } - //pingWeblogs($blog_ID); + // are we going from unpublished to publishd? + if (($prev_status == 'draft') && ($post_status == 'publish')) { + pingWeblogs($blog_ID); + pingCafelog($cafelogID, $post_title, $post_ID); + pingBlogs($blog_ID); + + if ($post_pingback) { + pingback($content, $post_ID); + } + + if (!empty($HTTP_POST_VARS['trackback_url'])) { + $excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252).'...' : strip_tags($content); + $excerpt = stripslashes($excerpt); + $trackback_urls = explode(',', $HTTP_POST_VARS['trackback_url']); + foreach($trackback_urls as $tb_url) { + $tb_url = trim($tb_url); + trackback($tb_url, stripslashes($post_title), $excerpt, $post_ID); + } + } + } // end if publish $location = "Location: b2edit.php"; header ($location); @@ -233,7 +256,7 @@ switch($action) { sleep($sleep_after_edit); } - // pingWeblogs($blog_ID); + //pingWeblogs($blog_ID); header ('Location: b2edit.php'); diff --git a/wp-admin/b2edit.showposts.php b/wp-admin/b2edit.showposts.php index 088d283ffd..7ffd45ac3d 100644 --- a/wp-admin/b2edit.showposts.php +++ b/wp-admin/b2edit.showposts.php @@ -318,7 +318,7 @@ if ($i == "ASC")