Index: modules/blogapi.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi.module,v retrieving revision 1.20 diff -u -r1.20 blogapi.module --- modules/blogapi.module 14 Aug 2004 07:00:27 -0000 1.20 +++ modules/blogapi.module 14 Aug 2004 21:26:10 -0000 @@ -102,10 +102,10 @@ return blogapi_error($user); } - $promote = variable_get('node_promote_blog', 0); - $comment = variable_get('node_comment_blog', 2); - $moderate = variable_get('node_moderate_blog', 0); - $revision = variable_get('node_revision_blog', 0); + $promote = variable_get('node_promote_' . variable_get('blogapi_nodetype', 'blog'), 0); + $comment = variable_get('node_comment_' . variable_get('blogapi_nodetype', 'blog'), 2); + $moderate = variable_get('node_moderate_' . variable_get('blogapi_nodetype', 'blog'), 0); + $revision = variable_get('node_revision_' . variable_get('blogapi_nodetype', 'blog'), 0); // check for bloggerAPI vs. metaWeblogAPI if (is_array($params[3])) { @@ -121,7 +121,7 @@ return blogapi_error(t('Terminated request because of suspicious input data.')); } - $node = node_validate(array('type' => 'blog', + $node = node_validate(array('type' => variable_get('blogapi_nodetype', 'blog'), 'uid' => $user->uid, 'name' => $user->name, 'title' => $title, @@ -279,7 +279,7 @@ * associated with a blog node. */ function blogapi_get_category_list($req_params) { - $vocabularies = module_invoke('taxonomy', 'get_vocabularies', 'blog', 'vid'); + $vocabularies = module_invoke('taxonomy', 'get_vocabularies', variable_get('blogapi_nodetype', 'blog'), 'vid'); $categories = array(); if ($vocabularies) { foreach ($vocabularies as $vocabulary) { @@ -360,7 +360,7 @@ return blogapi_error($user); } - $result = db_query_range('SELECT n.nid, n.title,'. ($bodies ? ' n.body,' : '') ." n.created, u.name FROM {node} n, {users} u WHERE n.uid=u.uid AND n.type = 'blog' AND n.uid = %d ORDER BY n.created DESC", $user->uid, 0, $params[3]); + $result = db_query_range('SELECT n.nid, n.title,'. ($bodies ? ' n.body,' : '') ." n.created, u.name FROM {node} n, {users} u WHERE n.uid=u.uid AND n.type = ' . variable_get('blogapi_nodetype', 'blog') . ' AND n.uid = %d ORDER BY n.created DESC", $user->uid, 0, $params[3]); while ($blog = db_fetch_object($result)) { $xmlrpcval = array ( 'userid' => new xmlrpcval($blog->name, 'string'), @@ -425,7 +425,18 @@ $user = user_authenticate($username, $password); if ($user->uid) { - if (user_access('edit own blog')) { + switch(variable_get('blogapi_nodetype', 'blog')) { + case 'blog': + $access = 'edit own blog'; + break; + case 'page': + $access = 'edit own pages'; + break; + case 'story': + $access = 'edit own stories'; + break; + } + if (user_access($access)) { return $user; } else { @@ -453,6 +464,8 @@ function blogapi_settings() { $output = form_select(t('XML-RPC Engine'), 'blogapi_engine', variable_get('blogapi_engine', 0), array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'), t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.')); + $types = array("blog" => "blog", "page" => "page", "story" => "story"); + $output .= form_select(t("Node type for blog entries"), "blogapi_nodetype", variable_get('blogapi_nodetype', 'blog'), $types, t("New nodes added through the blog api will be of this node type.")); return $output; }