- Patch #41276 by walkah/chx: blog api fixes for new forms api.

4.7.x
Dries Buytaert 2005-12-16 18:08:58 +00:00
parent 2132883524
commit 93d496bad8
2 changed files with 10 additions and 8 deletions

View File

@ -214,8 +214,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
$edit['body'] = $content;
}
$node = node_validate($edit);
node_validate($edit);
if ($errors = form_get_errors()) {
return blogapi_error(implode("\n", $errors));
}
@ -224,6 +223,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
return blogapi_error(t('You do not have permission to create the type of post you wanted to create.'));
}
$node = node_submit($edit);
node_save($node);
if ($node->nid) {
watchdog('content', t('%type: added %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
@ -269,8 +269,7 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont
$node->body = $content;
}
$node = node_validate($node);
node_validate($node);
if ($errors = form_get_errors()) {
return blogapi_error(implode("\n", $errors));
}
@ -279,6 +278,8 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont
foreach ($terms as $term) {
$node->taxonomy[] = $term->tid;
}
$node = node_submit($node);
node_save($node);
if ($node->nid) {
watchdog('content', t('%type: updated %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));

View File

@ -214,8 +214,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
$edit['body'] = $content;
}
$node = node_validate($edit);
node_validate($edit);
if ($errors = form_get_errors()) {
return blogapi_error(implode("\n", $errors));
}
@ -224,6 +223,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
return blogapi_error(t('You do not have permission to create the type of post you wanted to create.'));
}
$node = node_submit($edit);
node_save($node);
if ($node->nid) {
watchdog('content', t('%type: added %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
@ -269,8 +269,7 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont
$node->body = $content;
}
$node = node_validate($node);
node_validate($node);
if ($errors = form_get_errors()) {
return blogapi_error(implode("\n", $errors));
}
@ -279,6 +278,8 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont
foreach ($terms as $term) {
$node->taxonomy[] = $term->tid;
}
$node = node_submit($node);
node_save($node);
if ($node->nid) {
watchdog('content', t('%type: updated %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));