2007-12-12 17:29:16 +01:00
|
|
|
<?php
|
2010-01-16 11:03:30 +01:00
|
|
|
/**
|
|
|
|
* Implements the del.icio.us API request for a user's post counts by date
|
|
|
|
* (and optionally by tag).
|
|
|
|
*
|
|
|
|
* SemanticScuttle - your social bookmark manager.
|
|
|
|
*
|
|
|
|
* PHP version 5.
|
|
|
|
*
|
|
|
|
* @category Bookmarking
|
|
|
|
* @package SemanticScuttle
|
|
|
|
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
|
|
|
|
* @author Christian Weiske <cweiske@cweiske.de>
|
|
|
|
* @author Eric Dane <ericdane@users.sourceforge.net>
|
|
|
|
* @license GPL http://www.gnu.org/licenses/gpl.html
|
|
|
|
* @link http://sourceforge.net/projects/semanticscuttle
|
|
|
|
*/
|
2007-12-12 17:29:16 +01:00
|
|
|
|
|
|
|
// Force HTTP authentication first!
|
2010-01-16 11:03:30 +01:00
|
|
|
require_once 'httpauth.inc.php';
|
2007-12-12 17:29:16 +01:00
|
|
|
|
2008-12-05 08:25:04 +01:00
|
|
|
/* Service creation: only useful services are created */
|
2010-01-16 11:03:30 +01:00
|
|
|
$bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark');
|
2008-12-05 08:25:04 +01:00
|
|
|
|
2007-12-12 17:29:16 +01:00
|
|
|
|
|
|
|
// Check to see if a tag was specified.
|
2010-01-16 11:03:30 +01:00
|
|
|
if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) {
|
2007-12-12 17:29:16 +01:00
|
|
|
$tag = trim($_REQUEST['tag']);
|
2010-01-16 11:03:30 +01:00
|
|
|
} else {
|
|
|
|
$tag = null;
|
|
|
|
}
|
2007-12-12 17:29:16 +01:00
|
|
|
|
|
|
|
// Get the posts relevant to the passed-in variables.
|
2010-01-16 11:03:30 +01:00
|
|
|
$bookmarks = $bookmarkservice->getBookmarks(
|
|
|
|
0, null, $userservice->getCurrentUserId(), $tag
|
|
|
|
);
|
2007-12-12 17:29:16 +01:00
|
|
|
|
|
|
|
// Set up the XML file and output all the tags.
|
|
|
|
header('Content-Type: text/xml');
|
|
|
|
echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
|
2008-12-05 08:25:04 +01:00
|
|
|
echo '<dates tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n";
|
2007-12-12 17:29:16 +01:00
|
|
|
|
2010-01-16 11:03:30 +01:00
|
|
|
$lastdate = null;
|
|
|
|
foreach ($bookmarks['bookmarks'] as $row) {
|
2007-12-12 17:29:16 +01:00
|
|
|
$thisdate = gmdate('Y-m-d', strtotime($row['bDatetime']));
|
2010-01-16 11:03:30 +01:00
|
|
|
if ($thisdate != $lastdate && $lastdate != null) {
|
2007-12-12 17:29:16 +01:00
|
|
|
echo "\t<date count=\"". $count .'" date="'. $lastdate ."\" />\r\n";
|
|
|
|
$count = 1;
|
|
|
|
} else {
|
2010-01-16 11:03:30 +01:00
|
|
|
++$count;
|
2007-12-12 17:29:16 +01:00
|
|
|
}
|
|
|
|
$lastdate = $thisdate;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</dates>";
|
|
|
|
?>
|