aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-02-28 15:37:18 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-02-28 15:37:18 +0000
commitd833e18b68ee5c9845dc5759e51b3301811d9274 (patch)
tree2aae0bf36f6d867a58e5ff0b20cbafd63f27e4ad
parent4386a63ec18a96ab8bacdbdab2561561e9d35214 (diff)
downloadsemanticscuttle-d833e18b68ee5c9845dc5759e51b3301811d9274.tar.gz
semanticscuttle-d833e18b68ee5c9845dc5759e51b3301811d9274.tar.bz2
Bug fix: correct bug if updating a bookmark with the url of another existing bookmark.
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@303 b3834d28-1941-0410-a4f8-b48e95affb8f
-rw-r--r--services/bookmarkservice.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/services/bookmarkservice.php b/services/bookmarkservice.php
index 55562e2..1719b80 100644
--- a/services/bookmarkservice.php
+++ b/services/bookmarkservice.php
@@ -201,7 +201,7 @@ class BookmarkService {
function updateBookmark($bId, $address, $title, $description, $privateNote, $status, $categories, $date = NULL, $fromApi = false) {
if (!is_numeric($bId))
- return false;
+ return false;
// Get the client's IP address and the date; note that the date is in GMT.
if (getenv('HTTP_CLIENT_IP'))
@@ -213,6 +213,15 @@ class BookmarkService {
$ip = getenv('HTTP_X_FORWARDED_FOR');
$moddatetime = gmdate('Y-m-d H:i:s', time());
+
+ $address = $this->normalize($address);
+
+ //check if a new address ($address) doesn't already exist for another bookmark from the same user
+ $bookmark = $this->getBookmark($bId);
+ if($bookmark['bAddress'] != $address && $this->bookmarkExists($address, $bookmark['uId'])) {
+ message_die(GENERAL_ERROR, 'Could not update bookmark (URL already existing = '.$address.')', '', __LINE__, __FILE__);
+ return false;
+ }
// Set up the SQL update statement and execute it.
$updates = array('bModified' => $moddatetime, 'bTitle' => $title, 'bAddress' => $address, 'bDescription' => $description, 'bPrivateNote' => $privateNote, 'bStatus' => $status, 'bHash' => md5($address));