]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
hide bookmarks below a configurable threshold
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Mon, 2 Nov 2009 09:42:53 +0000 (09:42 +0000)
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Mon, 2 Nov 2009 09:42:53 +0000 (09:42 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@507 b3834d28-1941-0410-a4f8-b48e95affb8f

data/config.default.php
doc/ChangeLog
doc/developers/TODO
src/SemanticScuttle/Service/Bookmark.php

index 76c8856d4bc471cc976781f437b8e43c39eb72dd..6eda4e75c0459b1ef99cf7e5e89d74f85774e444 100644 (file)
@@ -431,6 +431,14 @@ $enableVoting = true;
  */
 $votingMode = 2;
 
+/**
+ * Hide bookmarks below a certain voting from all users.
+ * Null to deactivate it.
+ *
+ * @var integer
+ */
+$hideBelowVoting = null;
+
 
 /****************************
  * Website Thumbnails
index 459ee8d823ab58594bf0033d7d5439a12a4cb7b8..6d27572c24fc7d4a17e98242ee2569aacb59e7da 100644 (file)
@@ -8,6 +8,7 @@ ChangeLog for SemantiScuttle
 - Configuration option to disable registration
 - Implement request #2874049: "Feeling lucky" button
   just add "?lucky=1" as parameter to search page
+- Hide bookmarks with vote < $threshold from users (not admins)
 
 
 0.94 - 2009-10-02
index 72ab582ba94af28ecae0fc0e880bcb72e5dd97c5..b56cfaa696a5114caa532e3c01893d57ea08e3e4 100644 (file)
@@ -6,7 +6,6 @@
   logged in anymore (name not shown on top right)
 - Make users inactive by default when registered newly
   - have to be activated by admins
-- Hide bookmarks with vote < 0 (or threshold) from unregistered users
 - Add RDFa to user profile page
 - use recaptcha or alike
 
index 949b073b1f49d26658a2df50f009af6516c9960a..afc4c89928ce7a13932a31369488b8e5d0207d5e 100644 (file)
@@ -550,9 +550,17 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
         }
         $query_1 .= 'B.*, U.'. $userservice->getFieldName('username');
 
-        $query_2 = ' FROM '. $userservice->getTableName() .' AS U, '. $this->getTableName() .' AS B';
+        $query_2 = ' FROM '. $userservice->getTableName() .' AS U'
+            . ', '. $this->getTableName() .' AS B';
 
         $query_3 = ' WHERE B.uId = U.'. $userservice->getFieldName('primary') . $privacy;
+
+        if ($GLOBALS['enableVoting'] && $GLOBALS['hideBelowVoting'] !== null
+            && !$userservice->isAdmin($userservice->getCurrentUserId())
+        ) {
+            $query_3 .= ' AND B.bVoting >= ' . (int)$GLOBALS['hideBelowVoting'];
+        }
+
         if (is_null($watched)) {
             if (!is_null($user)) {
                 $query_3 .= ' AND B.uId = '. $user;