2 // Implements the del.icio.us API request for a user's post counts by date (and optionally
5 // Force HTTP authentication first!
6 require_once('httpauth.inc.php');
7 require_once('../header.inc.php');
9 $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
10 $userservice =& ServiceFactory::getServiceInstance('UserService');
12 // Check to see if a tag was specified.
13 if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
14 $tag = trim($_REQUEST['tag']);
18 // Get the posts relevant to the passed-in variables.
19 $bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag);
21 $currentuser = $userservice->getCurrentUser();
22 $currentusername = $currentuser[$userservice->getFieldName('username')];
24 // Set up the XML file and output all the tags.
25 header('Content-Type: text/xml');
26 echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
27 echo '<dates tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentusername, 'xml') ."\">\r\n";
30 foreach($bookmarks['bookmarks'] as $row) {
31 $thisdate = gmdate('Y-m-d', strtotime($row['bDatetime']));
32 if ($thisdate != $lastdate && $lastdate != NULL) {
33 echo "\t<date count=\"". $count .'" date="'. $lastdate ."\" />\r\n";
38 $lastdate = $thisdate;