Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

XML-RPC Interface for Vanilla Commands

edited October 2007 in Vanilla 1.0 Help
I'm actually in the process of writing an Add On for Vanilla using the PEAR XML-RPC Client/Server. The Add On will create an XML-RPC interface for creating/deleting/etc categories, discussions, comments, etc. I have two concerns though: 1. This Add On does not follow the traditional Order of Execution, at least not as far as I understand it. I'd like to end page processing as soon a request hits my extension. Is there anyway to force page rendering within an extension? 2. Any suggestions on how to secure this application? Again, an issue with the OoE, I basically need some way of validating user information within the XML-RPC message. I have installed the Janine Add On, it inspired me to create this Add On because I was looking for a way to handle all kinds of XML-RPC messages, not just WordPress related ones.

Comments

  • Options
    Forgive my ignorance, but what will this extension enable us to do?
  • Options
    edited August 2007
    interesting....
  • Options
    i... don't think so.
  • Options
    APIs are always good, especially if you aim to integrate your board and not have an island solution. I can see that you could retrieve discussions/comments, you could authenticate users (remotely) against the boards database and so on.

    Many webservices (blogger, Flickr, Wordpress, delicious, ...) offer this kind of thing where you post data to an endpoint (essentially a URL) to for example retrieve data, or add/edit/delete. If you have a blog and use some software on your desktop to add entries on your blog, then this software will most likely use an API which is exposed via XML-RPC.

    For those interested in XML-RPC:
    http://en.wikipedia.org/wiki/Xmlrpc
  • Options
    In Janine, a Controller is bound to the Init_Page Event. When successfully fired, the controller runs die(), essentially usurping the OoE so that the only output is a valid XML-RPC message. This works fine for Janine, because A. It only supports a very specific set of messages (3 I think) and B. It does it's own message validation. I'm looking for something a little more robust. What I'm attempting to do is map a handful of Vanilla commands to fire on receipt of a given XML-RPC message and send a XML-RPC reply. I plan on using the PEAR XML-RPC extension, as it offers automatic message validation and message mapping to user created object methods. I'd like it to follow the extension guidelines because I think it will be a very useful extension. I will primarily be using the extension to automate user / category / discussion creation and the assignment of user roles from a separate server. I'll keep the community informed on my progress.
  • Options
    I couldn't see the need for this until I just read a WP post about a plugin that use WP's XML-RPC Api that will notify you of new comments awaiting moderation on your blog. Now I start to see the potential uses. Keep up the good work.
  • Options
    My dilemma: An XML-RPC request will hit my extension like such: Request -> path/to/vanilla/extension.php?PostBackAction=XML_RPC_Response -> Server Process Request -> Send Response -> die(); Is this okay? Is "PostBackAction" reserved for anything special? I'm using it to detect when my particular extension is being called.
  • Options
    I don't think that it is reserved for anything "Special" to be honest, I think it was originally conceived to apply to receiving posted form information (i.e. the posted information is to create a user, or to edit one), though I have seen it used outside of this context many times. I may be wrong though xD.

    Adam.
  • Options
    edited August 2007
    Quick update, I just finished version 0.1.0 of this and will be commiting it this weekend. For now we're limited to creating Categories and SubCategories (works perfectly with SubCategories Add-On) via XML_RPC. Also requires the PEAR XML_RPC Package and PHP 5.2.3 (will work on support for 4).
  • Options

    Alternatively you could save yourself a but load of time and slap this logo on it ;)Support GoPHP5.org

  • Options
    Like that idea, got side tracked this weekend, still working on it though and will submit soon.
  • Options
    edited October 2007
    Well, it's been awhile, but I'm almost ready to release this, though I have a question: Who should I contact about modifications to the core? I needed to make a slight change to Vanilla.Class.Category.php. Specifically, the GetPropertiesFromDataSet function did not allow modifications to $this->AllowedRoles, so I added the following code: if (array_key_exists('CategoryRoleBlock',$DataSet)) { $this->AllowedRoles = ForceArray(@$DataSet['CategoryRoleBlock'], array()); } I don't understand why this wasn't included in the first place, because you can load the AllowedRoles within the GetPropertiesFromForm: $this->AllowedRoles = ForceIncomingArray('CategoryRoleBlock', array());
This discussion has been closed.