From LifeType Wiki
Name: atom
Latest version: 20070226
Download link: http://prdownloads.sourceforge.net/lifetype/1.2_atom.zip?download
License: GPL
Author: The LifeType Project
[edit] Description
This plugin allows Atom 0.3 clients to add, update and remove posts and images from any LifeType blog. The plugin requires PHP 4.3.0 or greater.
Even though the Atom specification defines REST and SOAP as the transport mechanism, this plugin only implements the REST version. The plugin has been successfully tested with Ecto and Nokia's Lifeblog mobile client.
[edit] Configuration
Please make sure that the file atom.php is placed in the root folder of LifeType, since it is the entry point to the Atom server.
In order to use the Atom plugin, a password needs to be set in the plugin settings page which can be found in the "Control Centre" section. The Atom implementation of LifeType does not use the real user password but a different one, which is blog-wide. This means that different users from the same blog will have to use the same password.
In the plugin settings page several other options can also be configured:
- Category in which posts sent via Atom will be included. Current Atom clients do not offer the possibility to assign posts to categories so we will have to choose one from the ones available in our blog. This category can be changed later on if needed.
- Since it is also possible to post images and other files via Atom to our blog, we must choose to which album the files will be assigned. As with post categories, this can be changed later on.
- When embedding images in posts sent via Atom, we can also choose which image will be embedded in the post: the small size thumbmail with a link to the full size image, the medium size thumbnail with a link to the full size image or the full size image itself.
In case our user has administrator permissions, there will be two additional options in the plugin settings page, under the Advanced Features" title:
- Logging enabled: if we're debugging Atom, this will probably be useful. It uses the standard logging mechanism sending all its output to the lifetype.log file, so please make sure that the "default" logger is properly configured in the config/logging.properties.php file.
- Don't set headers: some servers are known to cause HTTP 500 error messages when trying to set response headers so please enable this feature if this is your case. Even though the Atom specification mandates that certain HTTP headers must be used when communicating with clients via Atom, most of them will work just fine without.
[edit] Posting via Atom
The entry point to the Atom server is atom.php. Your username is the same but your password is the same that was set in the plugin settings page.
[edit] Posting via Lifeblog
Nokia's Lifeblog is a mobile blogging client for Series60 phones that is built on top of the Atom API, and which has support for posting text as well as pictures to any blog. LifeType's Atom plugin has full support for Lifeblog as of version 1.0.
In order to configure Lifeblog to work with LifeType, please follow the same configuration steps that you would follow with any other service. Set the username and password to the correct username and passwords, and the "Server address" field to the atom.php script in your installation.
Lifeblog supports more than one blog per user so you can choose to which blog you are posting the content.
When posting images, all the images will be automatically added to the album that was selected in the plugin settings page. Additionally, a new post will be added. The contents of this post will be the text and topic that was typed in the Lifeblog interface and links to each one of the pictures that was included in the post. Depending on how we chose to embed images in posts, the post will contain small thumbnails, medium size thumbnails or whole image in it.
[edit] Notes
The code of the plugin itself is based on the isoTope Atom server, specially all the heavy work concerning the parsing of the Atom XML messages. The idea of implementing extensible Atom services is also borrowed from isoTope.
The plugin needs PHP 4.3.0 at least because of the necessity to be able to read raw POST streams. PHP does provide this feature via the php://input stream which was introduced in PHP 4.3.0. Unfortunately, there is no way around this limitation and hosts with earlier versions of PHP will not be able to run the plugin.
IMPORTANT: If you are running Apache 2.x, please add the following directive to your httpd.conf file:
AcceptPathInfo on
Or else the Apache server will not be able to send the Lifeblog requests to atom.php!
[edit] Services available
The current implementation of the plugin offers the following services:
- service.post - service.feed - service.upload - service.categories
If you send a normal POST request to atom.php you should get a message like this, defining the entry points for each one of these services:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://purl.org/atom/ns#">
<link xmlns="http://purl.org/atom/ns#" type="application/x.atom+xml" rel="service.post" href="http://host/lifetype/atom.php/post/1" title="Development Blog"/>
<link xmlns="http://purl.org/atom/ns#" type="application/x.atom+xml" rel="service.feed" href="http://host/lifetype/atom.php/feed/1" title="Development Blog"/>
<link xmlns="http://purl.org/atom/ns#" type="application/x.atom+xml" rel="service.upload" href="http://host/lifetype/atom.php/upload/1" title="Development Blog"/>
<link xmlns="http://purl.org/atom/ns#" type="application/x.atom+xml" rel="service.categories" href="http://host/lifetype/atom.php/categories/1" title="Development Blog"/>
<link xmlns="http://purl.org/atom/ns#" type="text/html" rel="alternate" href="http://host/lifetype/index.php?blogId=1" title="Development Blog"/>
</feed>
Use service.post to manage your posts. Send a POST request in order to add a new post (or image), a PUT request to update a post and a DELETE request to remove a post. Use service.categories to obtain a list of the categories available in the blog and service.feed to retrieve a valid Atom feed from the blog. service.upload has not been implemented yet.
