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
This commit is contained in:
mikelittle 2003-06-06 23:21:45 +00:00
parent fc0546cf02
commit 8bf3591d67
3 changed files with 44 additions and 19 deletions

View File

@ -30,6 +30,7 @@ switch($action) {
$form_extra = "' />\n<input type='hidden' name='post_ID' value='$post";
$colspan = 2;
$form_pingback = '<input type="hidden" name="post_pingback" value="0" />';
$form_prevstatus = '<input type="hidden" name="prev_status" value="'.$post_status.'" />';
$form_trackback = '';
break;
case "editcomment":
@ -143,6 +144,7 @@ if ($action != 'editcomment') {
<textarea rows="9" cols="40" style="width:100%" name="content" tabindex="4" wrap="virtual" id="content"><?php echo $content ?></textarea><br />
<?php echo $form_pingback ?>
<?php echo $form_prevstatus ?>
<p><input type="submit" name="submit" value="<?php echo $submitbutton_text ?>" class="search" style="font-weight: bold;" tabindex="5" /></p>

View File

@ -82,9 +82,11 @@ switch($action) {
sleep($sleep_after_edit);
}
if ($post_status == 'publish') {
pingWeblogs($blog_ID);
pingCafelog($cafelogID, $post_title, $post_ID);
pingBlogs($blog_ID);
if ($post_pingback) {
pingback($content, $post_ID);
}
@ -98,6 +100,7 @@ switch($action) {
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);

View File

@ -318,7 +318,7 @@ if ($i == "ASC")
<?php
}
} // end b2 loop
?>
</div>