diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-05-03 17:29:08 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-05-03 17:33:57 +0200 |
commit | b6ea57c8b6fac904f97f456463a52e509de51733 (patch) | |
tree | 2508cca2ca16619dadb20e7ccecfff47432cdeb3 /apps/bookmarks/lib | |
parent | 8076b1e12dec3e3861b7024c74873ea330d052c3 (diff) | |
download | nextcloud-server-b6ea57c8b6fac904f97f456463a52e509de51733.tar.gz nextcloud-server-b6ea57c8b6fac904f97f456463a52e509de51733.zip |
Bookmarks: Move delete code to Bookmarks class, also change to use id
Diffstat (limited to 'apps/bookmarks/lib')
-rwxr-xr-x | apps/bookmarks/lib/bookmarks.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/bookmarks/lib/bookmarks.php b/apps/bookmarks/lib/bookmarks.php index 67b8e2f780e..e0005968f31 100755 --- a/apps/bookmarks/lib/bookmarks.php +++ b/apps/bookmarks/lib/bookmarks.php @@ -113,5 +113,37 @@ class OC_Bookmarks_Bookmarks{ $bookmarks = $query->execute($params)->fetchAll(); return $bookmarks; } + + public static function deleteUrl($id) + { + $user = OCP\USER::getUser(); + + $query = OCP\DB::prepare(" + SELECT id FROM *PREFIX*bookmarks + WHERE id = ? + AND user_id = ? + "); + + $result = $query->execute(array($id, $user)); + $id = $result->fetchOne(); + if ($id === false) { + return false; + } + + $query = OCP\DB::prepare(" + DELETE FROM *PREFIX*bookmarks + WHERE id = $id + "); + + $result = $query->execute(); + + $query = OCP\DB::prepare(" + DELETE FROM *PREFIX*bookmarks_tags + WHERE bookmark_id = $id + "); + + $result = $query->execute(); + return true; + } } ?> |