diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-03 14:00:33 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-03 14:00:33 +0000 |
commit | 29422fa55379aa61a61019b832c83dab6d450264 (patch) | |
tree | e5884ce6fed2cf1d02165a1b5667b99cd80262e5 /www/api/posts_delete.php | |
parent | b8b1d06b2d899658fae64d0de506439ca0ea067c (diff) | |
download | semanticscuttle-29422fa55379aa61a61019b832c83dab6d450264.tar.gz semanticscuttle-29422fa55379aa61a61019b832c83dab6d450264.tar.bz2 |
move files to new locations
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@386 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'www/api/posts_delete.php')
-rw-r--r-- | www/api/posts_delete.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/www/api/posts_delete.php b/www/api/posts_delete.php new file mode 100644 index 0000000..d24ba59 --- /dev/null +++ b/www/api/posts_delete.php @@ -0,0 +1,34 @@ +<?php +// Implements the del.icio.us API request to delete a post. + +// del.icio.us behavior: +// - returns "done" even if the bookmark doesn't exist; +// - does NOT allow the hash for the url parameter; +// - doesn't set the Content-Type to text/xml (we do). + +// Force HTTP authentication first! +require_once('httpauth.inc.php'); +require_once('../header.inc.php'); + +/* Service creation: only useful services are created */ +$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); + + +// Note that del.icio.us only errors out if no URL was passed in; there's no error on attempting +// to delete a bookmark you don't have. + +// Error out if there's no address +if (is_null($_REQUEST['url'])) { + $deleted = false; +} else { + $bookmark = $bookmarkservice->getBookmarkByAddress($_REQUEST['url']); + $bid = $bookmark['bId']; + $delete = $bookmarkservice->deleteBookmark($bid); + $deleted = true; +} + +// Set up the XML file and output the result. +header('Content-Type: text/xml'); +echo '<?xml version="1.0" standalone="yes" ?'.">\r\n"; +echo '<result code="'. ($deleted ? 'done' : 'something went wrong') .'" />'; +?>
\ No newline at end of file |