From 79b28ed45cd0f5e2fcc043bf716d011c6571642e Mon Sep 17 00:00:00 2001 From: cweiske Date: Mon, 2 Nov 2009 09:42:53 +0000 Subject: [PATCH] hide bookmarks below a configurable threshold git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@507 b3834d28-1941-0410-a4f8-b48e95affb8f --- data/config.default.php | 8 ++++++++ doc/ChangeLog | 1 + doc/developers/TODO | 1 - src/SemanticScuttle/Service/Bookmark.php | 10 +++++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/data/config.default.php b/data/config.default.php index 76c8856..6eda4e7 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -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 diff --git a/doc/ChangeLog b/doc/ChangeLog index 459ee8d..6d27572 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -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 diff --git a/doc/developers/TODO b/doc/developers/TODO index 72ab582..b56cfaa 100644 --- a/doc/developers/TODO +++ b/doc/developers/TODO @@ -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 diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php index 949b073..afc4c89 100644 --- a/src/SemanticScuttle/Service/Bookmark.php +++ b/src/SemanticScuttle/Service/Bookmark.php @@ -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;