Restructure repository
[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 $currentuser = $userservice->getCurrentUser();
18 $currentusername = $currentuser[$userservice->getFieldName('username')];
19
20 // Set up the XML file and output all the tags.
21 header('Content-Type: text/xml');
22 echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
23 foreach($bookmarks['bookmarks'] as $row) {
24     echo '<update time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) .'" />';
25 }
26 ?>

Benjamin Mako Hill || Want to submit a patch?