diff options
author | Mark Pemberton <mpemberton5@gmail.com> | 2011-05-19 19:40:22 -0400 |
---|---|---|
committer | Mark Pemberton <mpemberton5@gmail.com> | 2011-05-19 19:40:22 -0400 |
commit | 5203848b12ccda0009409e08165bfa2d9d34a837 (patch) | |
tree | 0e88cb4d6e2ce09bb7b371d458ea3141c8436811 /src/SemanticScuttle/Service | |
parent | 1c6ff8cea61502a39887885847b4c320eee5c46b (diff) | |
download | semanticscuttle-5203848b12ccda0009409e08165bfa2d9d34a837.tar.gz semanticscuttle-5203848b12ccda0009409e08165bfa2d9d34a837.tar.bz2 |
revert getBookmarks() back to original
Diffstat (limited to 'src/SemanticScuttle/Service')
-rw-r--r-- | src/SemanticScuttle/Service/Bookmark.php | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php index 232f9d0..17ab7ba 100644 --- a/src/SemanticScuttle/Service/Bookmark.php +++ b/src/SemanticScuttle/Service/Bookmark.php @@ -718,7 +718,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService // All public bookmarks, user's own bookmarks // and any shared with user $privacy = ' AND ((B.bStatus = 0) OR (B.uId = '. $sId .')'; - $watchnames = $userservice->getWatchNames($sId); + $watchnames = $userservice->getWatchNames($sId, true); foreach ($watchnames as $watchuser) { $privacy .= ' OR (U.username = "'. $watchuser .'" AND B.bStatus = 1)'; } @@ -728,15 +728,14 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService $privacy = ' AND B.bStatus = 0'; } - $tagcount = 0; // Set up the tags, if need be. - if (!is_array($tags) && !is_null($tags) && $tags<>"") { + if (!is_array($tags) && !is_null($tags)) { $tags = explode('+', trim($tags)); + } - $tagcount = count($tags); - for ($i = 0; $i < $tagcount; $i ++) { - $tags[$i] = trim($tags[$i]); - } + $tagcount = count($tags); + for ($i = 0; $i < $tagcount; $i ++) { + $tags[$i] = trim($tags[$i]); } // Set up the SQL query. @@ -821,34 +820,23 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService // Handle the parts of the query that depend on any tags that are present. $query_4 = ''; - if ($tagcount > 0) { - $query_2 .= ', '. $b2tservice->getTableName() .' AS T0'; + for ($i = 0; $i < $tagcount; $i ++) { + $query_2 .= ', '. $b2tservice->getTableName() .' AS T'. $i; $query_4 .= ' AND ('; - - $tagArray = array(); - for ($i = 0; $i < $tagcount; $i ++) { - $tmpTag = $this->db->sql_escape($tags[$i]); - $allLinkedTags = $tag2tagservice->getAllLinkedTags( - $tmpTag, '>', $user - ); - while (is_array($allLinkedTags) && count($allLinkedTags)>0) { - $tmpValue = array_pop($allLinkedTags); - if (in_array($tmpValue, $tagArray) == false) { - $tagArray[] = $tmpValue; - } - } + $allLinkedTags = $tag2tagservice->getAllLinkedTags( + $this->db->sql_escape($tags[$i]), '>', $user + ); - if (in_array($tmpTag, $tagArray) == false) { - $tagArray[] = $tmpTag; - } - } - // loop through array of possible tags - foreach ($tagArray as $k => $v) { - $query_4 .= ' T0.tag = "'. $v .'" OR'; + while (is_array($allLinkedTags) && count($allLinkedTags)>0) { + $query_4 .= ' T'. $i .'.tag = "'. array_pop($allLinkedTags) .'"'; + $query_4 .= ' OR'; } - $query_4 = substr($query_4,0,-3); - $query_4 .= ') AND T0.bId = B.bId'; + + $query_4 .= ' T'. $i .'.tag = "'. $this->db->sql_escape($tags[$i]) .'"'; + + $query_4 .= ') AND T'. $i .'.bId = B.bId'; + //die($query_4); } // Search terms |