diff options
Diffstat (limited to 'modules/bloggerapi.module')
-rw-r--r-- | modules/bloggerapi.module | 105 |
1 files changed, 51 insertions, 54 deletions
diff --git a/modules/bloggerapi.module b/modules/bloggerapi.module index e0f00fe27..abfc2e3b8 100644 --- a/modules/bloggerapi.module +++ b/modules/bloggerapi.module @@ -156,62 +156,59 @@ function bloggerapi_driver($method, $params = 0, $error = 0) { } if ($user->uid && user_access("access Blogger API")) { - if (user_access("post content")) { - /* - ** Check for title tags, if not generate one. - */ + /* + ** Check for title tags, if not generate one. + */ - if (eregi("<title>(.*)</title>", $cparams[4], $title)) { - $title = strip_tags($title[0]); - $cparams[4] = ereg_replace("<title>.*</title>", "", $cparams[4]); - } - else { - $title = bloggerapi_title($cparams[4]); - } - - $teaser = node_teaser($cparams[4]); - - /* - ** Maps params to node array or call another function - */ + if (eregi("<title>(.*)</title>", $cparams[4], $title)) { + $title = strip_tags($title[0]); + $cparams[4] = ereg_replace("<title>.*</title>", "", $cparams[4]); + } + else { + $title = bloggerapi_title($cparams[4]); + } - switch ($method) { - case "newPost": - return array("type" => "blog", "title" => $title, "teaser" => $teaser, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0); - break; - case "editPost": - $node = node_load(array("nid" => $cparams[1])); - if ($node->uid == $user->uid) { - return array("nid" => $cparams[1], "type" => "blog", "title" => $title, "teaser" => $teaser, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0); - } - else { - return bloggerapi_error("Error updating node"); - } - break; - case "getUsersBlogs": - return bloggerapi_user_blogs(); - break; - case "getUserInfo": - return bloggerapi_user_info(); - break; - case "getPost": - return bloggerapi_node_load($cparams[1]); - break; - case "getRecentPosts": - return bloggerapi_node_recent($cparams[4]); - break; - case "deletePost": - return bloggerapi_node_delete($cparams[1]); - break; - case "distribute": - break; - default: - return bloggerapi_error("Error in the authentication process"); - break; - } + /* + ** Maps params to node array or call another function + */ + + switch ($method) { + case "newPost": + return array("type" => "blog", "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0); + break; + case "editPost": + $node = node_load(array("nid" => $cparams[1])); + if ($node->uid == $user->uid) { + return array("nid" => $cparams[1], "type" => "blog", "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0); + } + else { + return bloggerapi_error("Error updating node"); + } + break; + case "getUsersBlogs": + return bloggerapi_user_blogs(); + break; + case "getUserInfo": + return bloggerapi_user_info(); + break; + case "getPost": + return bloggerapi_node_load($cparams[1]); + break; + case "getRecentPosts": + return bloggerapi_node_recent($cparams[4]); + break; + case "deletePost": + return bloggerapi_node_delete($cparams[1]); + break; + case "distribute": + break; + default: + return bloggerapi_error("Error in the authentication process"); + break; } - } else { + } + else { return bloggerapi_error("Error in the authentication process"); } } @@ -381,7 +378,7 @@ function bloggerapi_help() { <h3>Introduction</h3> <p><a href="http://www.blogger.com">Blogger</a>, the well-known public weblog service, provides an application programing interface (API) to allow remote procedure calls (RPC) to the Blogger service. Drupal supports this <a href="http://plant.blogger.com/api/index.html">Blogger API</a>, which means that many remote clients (e.g. <a href="radio.userland.com">Radio</a>, <a href="http://simon.kittle.info/textrouter">TextRouter</a>, <a href="http://blogbuddy.sourceforge.net/">Blogbuddy</a>, <a href="http://www.wbloggar.com/">w.bloggar</a>, <a href="http://www.tswoam.co.uk/index.php?n_go=16">PerlyBlog</a>), may post to Drupal. These clients provide a bevy of interesting capabilities like offline composing, spellcheck, and WYSIWYG editing; many folks prefer to blog with a client application over typical web forms. By supporting the Blogger API, Drupal grows grander than a web site engine, it's a <i>content accepting machine</i>™. -<p>The <a href="http://plant.blogger.com/api/index.html">Blogger RPC API</a> uses the <a href="http://www.xmlrpc.com">XML-RPC</a> protocol for communicating with the outside world. XML-RPC, originally developed by Dave Winer of <a href="http://www.userland.com">UserLand Software</a>, is a simple XML-based RPC specification ideally suited to the web. Drupal also uses XML-RPC for several other tasks (e.g. notifiying <a href="http://www.weblogs.com">weblogs.com</a> of blog updates and making/accepting <? echo lm("Distributed Authentication", array("mod" => "user", "op" => "help")) ?> requests)</p> +<p>The <a href="http://plant.blogger.com/api/index.html">Blogger RPC API</a> uses the <a href="http://www.xmlrpc.com">XML-RPC</a> protocol for communicating with the outside world. XML-RPC, originally developed by Dave Winer of <a href="http://www.userland.com">UserLand Software</a>, is a simple XML-based RPC specification ideally suited to the web. Drupal also uses XML-RPC for several other tasks (e.g. notifiying <a href="http://www.weblogs.com">weblogs.com</a> of blog updates and making/accepting <?php echo lm("Distributed Authentication", array("mod" => "user", "op" => "help")) ?> requests)</p> <h3>Blogger API implementation</h3> @@ -404,7 +401,7 @@ function bloggerapi_help() { <h3>Installation and usage</h3> -<p>To install the Blogger API module, enable the module in the <i>site configuration - modules</i> tab in the administration pages. Also make sure you have your permissions set correctly for accessing the Blogger API, the relevant settings can be found under the <i>user management</i> tab in the administration menu. Check the checkbox behind the line "access Blogger API" for the roles that are allowed to use the Blogger API. Make sure those roles have the right to "post content" as well.</p> +<p>To install the Blogger API module, enable the module in the <i>site configuration - modules</i> tab in the administration pages. Also make sure you have your permissions set correctly for accessing the Blogger API, the relevant settings can be found under the <i>user management</i> tab in the administration menu. Check the checkbox behind the line "access Blogger API" for the roles that are allowed to use the Blogger API.</p> <p>Once the API is enabled you can download one of the above mentioned Blogger API clients and get blogging.</p> <h3>Setup of the client</h3> |