diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2010-09-29 20:49:14 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2010-09-29 20:49:14 +0000 |
commit | 70c39a8eea7896271c0ad3f0c435ec06c64074d1 (patch) | |
tree | f8a7935d6606d0c049c17dc38b7c95883894cda5 /www/api | |
parent | 22c9a01ee845d2b92fcab6b6cb10ac6ff0eec52e (diff) | |
download | semanticscuttle-70c39a8eea7896271c0ad3f0c435ec06c64074d1.tar.gz semanticscuttle-70c39a8eea7896271c0ad3f0c435ec06c64074d1.tar.bz2 |
delicious returns a proper error message when deleting non-existant items, which we do now, too
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@770 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'www/api')
-rw-r--r-- | www/api/posts_delete.php | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/www/api/posts_delete.php b/www/api/posts_delete.php index 982b686..03cc968 100644 --- a/www/api/posts_delete.php +++ b/www/api/posts_delete.php @@ -4,8 +4,6 @@ * The delicious API is implemented here. * * The delicious API behaves like that: - * - returns "done" even if the bookmark doesn't exist - * - we do it correctly * - does NOT allow the hash for the url parameter * - doesn't set the Content-Type to text/xml * - we do it correctly, too @@ -35,26 +33,24 @@ $uId = $userservice->getCurrentUserId(); if (!isset($_REQUEST['url']) || $_REQUEST['url'] == '' ) { - $deleted = false; + $msg = 'something went wrong'; } else if (!$bs->bookmarkExists($_REQUEST['url'], $uId)) { //the user does not have such a bookmark - // 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. - // this sucks, and I don't care about being different but correct here. header('HTTP/1.0 404 Not Found'); - $deleted = false; - + $msg = 'item not found'; } else { $bookmark = $bs->getBookmarkByAddress($_REQUEST['url'], false); $bId = $bookmark['bId']; $deleted = $bs->deleteBookmark($bId); + $msg = 'done'; if (!$deleted) { //something really went wrong header('HTTP/1.0 500 Internal Server Error'); + $msg = 'something really went wrong'; } } // Set up the XML file and output the result. echo '<?xml version="1.0" standalone="yes" ?' . ">\r\n"; -echo '<result code="' . ($deleted ? 'done' : 'something went wrong') . '" />'; +echo '<result code="' . $msg . '" />'; ?>
\ No newline at end of file |