Added original date and updated date to bookmark output if different.
[scuttle] / api / posts_update.php
1 <?php
2 // Implements the del.icio.us API request for a user's last update time and date.
3
4 // del.icio.us behavior:
5 // - doesn't set the Content-Type to text/xml (we do).
6
7 // Force HTTP authentication first!
8 require_once 'httpauth.inc.php';
9 require_once '../header.inc.php';
10
11 $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
12 $userservice     =& ServiceFactory::getServiceInstance('UserService');
13
14 // Get the posts relevant to the passed-in variables.
15 $bookmarks =& $bookmarkservice->getBookmarks(0, 1, $userservice->getCurrentUserId());
16
17 // Set up the XML file and output all the tags.
18 header('Content-Type: text/xml');
19 echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
20 foreach ($bookmarks['bookmarks'] as $row) {
21     echo '<update time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) .'" />';
22 }

Benjamin Mako Hill || Want to submit a patch?