]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
fix user-specific tags
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Tue, 27 Oct 2009 20:26:24 +0000 (20:26 +0000)
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Tue, 27 Oct 2009 20:26:24 +0000 (20:26 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@435 b3834d28-1941-0410-a4f8-b48e95affb8f

src/SemanticScuttle/Service/Bookmark.php

index 34a819c861a7c56a386610bd8d920e90952fa491..3a7edd9f55523a6d0a9522c2c49797c62e9e0011 100644 (file)
@@ -527,6 +527,18 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
             $query_5.= ' GROUP BY B.bHash';
         }
 
+
+        //Voting system
+        //needs to be directly after FROM bookmarks
+        if ($GLOBALS['enableVoting'] && $userservice->isLoggedOn()) {
+            $currentuser = $userservice->getCurrentUser();
+            $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'];
+        }
+
         switch($sortOrder) {
             case 'date_asc':
                 $query_5.= ' ORDER BY B.bModified ASC ';
@@ -606,16 +618,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
             $query_4 .= ' AND B.bHash = "'. $hash .'"';
         }
 
-        //Voting system
-        if ($GLOBALS['enableVoting'] && $userservice->isLoggedOn()) {
-            $currentuser = $userservice->getCurrentUser();
-            $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'];
-        }
-
 
         $query = $query_1 . $query_2 . $query_3 . $query_4 . $query_5;