summaryrefslogtreecommitdiff
path: root/src/SemanticScuttle/Service/Bookmark.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-28 22:16:37 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-28 22:16:37 +0000
commit80464e45e84ee7b7b3bb6217adb3649132d43708 (patch)
tree08c65601aea83ba40b8bbe8caa28cbe38e81d7e3 /src/SemanticScuttle/Service/Bookmark.php
parentbb5205053e9ae9e584df9715dafd85f9c576f248 (diff)
downloadsemanticscuttle-80464e45e84ee7b7b3bb6217adb3649132d43708.tar.gz
semanticscuttle-80464e45e84ee7b7b3bb6217adb3649132d43708.tar.bz2
test previously fixed bug: voting was updated for all bookmarks, not only the current one
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@449 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'src/SemanticScuttle/Service/Bookmark.php')
-rw-r--r--src/SemanticScuttle/Service/Bookmark.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php
index 1054360..54a1df6 100644
--- a/src/SemanticScuttle/Service/Bookmark.php
+++ b/src/SemanticScuttle/Service/Bookmark.php
@@ -81,7 +81,9 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
/**
- * Load a single bookmark and return it
+ * Load a single bookmark and return it.
+ * When a user is logged on, the returned array will contain
+ * keys "hasVoted" and "vote".
*
* @param integer $bid Bookmark ID
* @param boolean $include_tags If tags shall be loaded
@@ -97,18 +99,18 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
$userservice = SemanticScuttle_Service_Factory::get('User');
- $query_1 = '*';
+ $query_1 = 'B.*';
$query_2 = $this->getTableName() . ' as B';
//Voting system
//needs to be directly after FROM bookmarks
if ($GLOBALS['enableVoting'] && $userservice->isLoggedOn()) {
- $currentuser = $userservice->getCurrentUser();
+ $cuid = $userservice->getCurrentUserId();
$vs = SemanticScuttle_Service_Factory::get('Vote');
$query_1 .= ', !ISNULL(V.bId) as hasVoted, V.vote as vote';
$query_2 .= ' LEFT JOIN ' . $vs->getTableName() . ' AS V'
. ' ON B.bId = V.bId'
- . ' AND V.uId = ' . (int)$currentuser['uId'];
+ . ' AND V.uId = ' . (int)$cuid;
}
$sql = 'SELECT ' . $query_1 . ' FROM '
@@ -563,12 +565,12 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
//Voting system
//needs to be directly after FROM bookmarks
if ($GLOBALS['enableVoting'] && $userservice->isLoggedOn()) {
- $currentuser = $userservice->getCurrentUser();
- $vs = SemanticScuttle_Service_Factory::get('Vote');
+ $cuid = $userservice->getCurrentUserId();
+ $vs = SemanticScuttle_Service_Factory::get('Vote');
$query_1 .= ', !ISNULL(V.bId) as hasVoted, V.vote as vote';
$query_2 .= ' LEFT JOIN ' . $vs->getTableName() . ' AS V'
. ' ON B.bId = V.bId'
- . ' AND V.uId = ' . (int)$currentuser['uId'];
+ . ' AND V.uId = ' . (int)$cuid;
}
switch($sortOrder) {