summaryrefslogtreecommitdiff
path: root/www/api/posts_update.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-09-29 20:50:38 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-09-29 20:50:38 +0000
commit20ec8b4958dc2d6a4a08f9b0dcae27c90f0155ef (patch)
treedfc7aa9aa48058fa2ae9cecb8f6042cb09657e86 /www/api/posts_update.php
parent70c39a8eea7896271c0ad3f0c435ec06c64074d1 (diff)
downloadsemanticscuttle-20ec8b4958dc2d6a4a08f9b0dcae27c90f0155ef.tar.gz
semanticscuttle-20ec8b4958dc2d6a4a08f9b0dcae27c90f0155ef.tar.bz2
test for api/posts/update
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@771 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'www/api/posts_update.php')
-rw-r--r--www/api/posts_update.php46
1 files changed, 33 insertions, 13 deletions
diff --git a/www/api/posts_update.php b/www/api/posts_update.php
index 4aeedc3..4b080e2 100644
--- a/www/api/posts_update.php
+++ b/www/api/posts_update.php
@@ -1,24 +1,44 @@
<?php
-// Implements the del.icio.us API request for a user's last update time and date.
-
-// del.icio.us behavior:
-// - doesn't set the Content-Type to text/xml (we do).
+/**
+ * API for retrieving a user's last update time.
+ * That is the time the user changed a bookmark lastly.
+ * The delicious API is implemented here.
+ *
+ * Delicious also returns "the number of new items in
+ * the user's inbox since it was last visited." - we do
+ * that too, so we are as close at the API as possible,
+ * not breaking delicious clients.
+ *
+ * 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
+ * @link http://www.delicious.com/help/api
+ */
// Force HTTP authentication first!
$httpContentType = 'text/xml';
require_once 'httpauth.inc.php';
-/* Service creation: only useful services are created */
-$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
-
-
-// Get the posts relevant to the passed-in variables.
-$bookmarks =& $bookmarkservice->getBookmarks(0, 1, $userservice->getCurrentUserId());
+$bs = SemanticScuttle_Service_Factory::get('Bookmark');
+$bookmarks = $bs->getBookmarks(0, 1, $userservice->getCurrentUserId());
// Set up the XML file and output all the tags.
-echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
-foreach($bookmarks['bookmarks'] as $row) {
- echo '<update time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) .'" />';
+echo '<?xml version="1.0" standalone="yes" ?' . ">\r\n";
+//foreach is used in case there are no bookmarks
+foreach ($bookmarks['bookmarks'] as $row) {
+ echo '<update time="'
+ . gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime']))
+ . '"'
+ . ' inboxnew="0"'
+ . ' />';
}
?> \ No newline at end of file