2 // Implements the del.icio.us API request to delete a post.
4 // del.icio.us behavior:
5 // - returns "done" even if the bookmark doesn't exist;
6 // - does NOT allow the hash for the url parameter;
7 // - doesn't set the Content-Type to text/xml (we do).
9 // Force HTTP authentication first!
10 require_once('httpauth.inc.php');
11 require_once('../header.inc.php');
13 $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
14 $userservice =& ServiceFactory::getServiceInstance('UserService');
16 // Note that del.icio.us only errors out if no URL was passed in; there's no error on attempting
17 // to delete a bookmark you don't have.
19 // Error out if there's no address
20 if (is_null($_REQUEST['url'])) {
23 $bookmark = $bookmarkservice->getBookmarkByAddress($_REQUEST['url']);
24 $bid = $bookmark['bId'];
25 $delete = $bookmarkservice->deleteBookmark($bid);
29 // Set up the XML file and output the result.
30 header('Content-Type: text/xml');
31 echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
32 echo '<result code="'. ($deleted ? 'done' : 'something went wrong') .'" />';