From 2347d3f93c19b7627589ff1859916ead450cb25c Mon Sep 17 00:00:00 2001
From: Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>
Date: Thu, 30 Mar 2006 14:17:12 +0000
Subject: [PATCH] #53834, validation was broken in blogapi, patch by samc

---
 modules/blogapi.module         | 11 ++++++-----
 modules/blogapi/blogapi.module | 11 ++++++-----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/modules/blogapi.module b/modules/blogapi.module
index 71d518f904bb..71c6cac05fbb 100644
--- a/modules/blogapi.module
+++ b/modules/blogapi.module
@@ -214,11 +214,6 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
     $edit['body'] = $content;
   }
 
-  node_validate($edit);
-  if ($errors = form_get_errors()) {
-    return blogapi_error(implode("\n", $errors));
-  }
-
   if (!node_access('create', $node)) {
     return blogapi_error(t('You do not have permission to create the type of post you wanted to create.'));
   }
@@ -226,6 +221,12 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
   if (user_access('administer nodes') && !isset($edit['date'])) {
     $edit['date'] = format_date(time(), 'custom', 'Y-m-d H:i:s O');
   }
+
+  node_validate($edit);
+  if ($errors = form_get_errors()) {
+    return blogapi_error(implode("\n", $errors));
+  }
+
   $node = node_submit($edit);
   node_save($node);
   if ($node->nid) {
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index 71d518f904bb..71c6cac05fbb 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -214,11 +214,6 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
     $edit['body'] = $content;
   }
 
-  node_validate($edit);
-  if ($errors = form_get_errors()) {
-    return blogapi_error(implode("\n", $errors));
-  }
-
   if (!node_access('create', $node)) {
     return blogapi_error(t('You do not have permission to create the type of post you wanted to create.'));
   }
@@ -226,6 +221,12 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
   if (user_access('administer nodes') && !isset($edit['date'])) {
     $edit['date'] = format_date(time(), 'custom', 'Y-m-d H:i:s O');
   }
+
+  node_validate($edit);
+  if ($errors = form_get_errors()) {
+    return blogapi_error(implode("\n", $errors));
+  }
+
   $node = node_submit($edit);
   node_save($node);
   if ($node->nid) {
-- 
GitLab