2007-12-12 17:29:16 +01:00
|
|
|
<?php
|
2010-09-29 00:14:31 +02:00
|
|
|
/**
|
|
|
|
* API for deleting a bookmark.
|
|
|
|
* The delicious API is implemented here.
|
|
|
|
*
|
|
|
|
* The delicious API behaves like that:
|
|
|
|
* - does NOT allow the hash for the url parameter
|
|
|
|
* - doesn't set the Content-Type to text/xml
|
|
|
|
* - we do it correctly, too
|
|
|
|
*
|
|
|
|
* 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
|
2010-09-29 22:50:38 +02:00
|
|
|
* @link http://www.delicious.com/help/api
|
2010-09-29 00:14:31 +02:00
|
|
|
*/
|
2007-12-12 17:29:16 +01:00
|
|
|
|
|
|
|
// Force HTTP authentication first!
|
2010-03-17 21:11:21 +01:00
|
|
|
$httpContentType = 'text/xml';
|
|
|
|
require_once 'httpauth.inc.php';
|
2007-12-12 17:29:16 +01:00
|
|
|
|
2010-09-29 00:14:31 +02:00
|
|
|
$bs = SemanticScuttle_Service_Factory::get('Bookmark');
|
|
|
|
$uId = $userservice->getCurrentUserId();
|
2007-12-12 17:29:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
// Error out if there's no address
|
2010-09-29 00:14:31 +02:00
|
|
|
if (!isset($_REQUEST['url'])
|
|
|
|
|| $_REQUEST['url'] == ''
|
|
|
|
) {
|
2010-09-29 22:49:14 +02:00
|
|
|
$msg = 'something went wrong';
|
2010-09-29 00:14:31 +02:00
|
|
|
} else if (!$bs->bookmarkExists($_REQUEST['url'], $uId)) {
|
|
|
|
//the user does not have such a bookmark
|
|
|
|
header('HTTP/1.0 404 Not Found');
|
2010-09-29 22:49:14 +02:00
|
|
|
$msg = 'item not found';
|
2007-12-12 17:29:16 +01:00
|
|
|
} else {
|
2010-09-29 00:14:31 +02:00
|
|
|
$bookmark = $bs->getBookmarkByAddress($_REQUEST['url'], false);
|
|
|
|
$bId = $bookmark['bId'];
|
|
|
|
$deleted = $bs->deleteBookmark($bId);
|
2010-09-29 22:49:14 +02:00
|
|
|
$msg = 'done';
|
2010-09-29 00:14:31 +02:00
|
|
|
if (!$deleted) {
|
|
|
|
//something really went wrong
|
|
|
|
header('HTTP/1.0 500 Internal Server Error');
|
2010-09-29 22:49:14 +02:00
|
|
|
$msg = 'something really went wrong';
|
2010-09-29 00:14:31 +02:00
|
|
|
}
|
2007-12-12 17:29:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Set up the XML file and output the result.
|
2010-09-29 00:14:31 +02:00
|
|
|
echo '<?xml version="1.0" standalone="yes" ?' . ">\r\n";
|
2010-09-29 22:49:14 +02:00
|
|
|
echo '<result code="' . $msg . '" />';
|
2007-12-12 17:29:16 +01:00
|
|
|
?>
|