- Enforce minimum elapsed time on registration form
[scuttle] / api / posts_delete.php
1 <?php
2 // Implements the del.icio.us API request to delete a post.
3
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).
8
9 // Force HTTP authentication first!
10 require_once 'httpauth.inc.php';
11 require_once '../header.inc.php';
12
13 $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
14 $userservice     =& ServiceFactory::getServiceInstance('UserService');
15
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.
18
19 // Error out if there's no address
20 if (is_null($_REQUEST['url'])) {
21     $deleted = FALSE;
22 }
23 else {
24     $bookmark = $bookmarkservice->getBookmarkByAddress($_REQUEST['url']);
25     $bid = $bookmark['bId'];
26     $delete = $bookmarkservice->deleteBookmark($bid);
27     $deleted = TRUE;
28 }
29
30 // Set up the XML file and output the result.
31 header('Content-Type: text/xml');
32 echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
33 echo '<result code="'. ($deleted ? 'done' : 'something went wrong') .'" />';

Benjamin Mako Hill || Want to submit a patch?