Updated PrivateKey to include Tag searches
This commit is contained in:
parent
10214c43b5
commit
920f7fc623
6 changed files with 58 additions and 21 deletions
|
@ -33,9 +33,7 @@ $this->includeTemplate($GLOBALS['top_include']);
|
||||||
<td><input type="checkbox" id="pEnablePrivateKey" name="pEnablePrivateKey" value="true" <?php echo $privateKeyIsEnabled;?> />
|
<td><input type="checkbox" id="pEnablePrivateKey" name="pEnablePrivateKey" value="true" <?php echo $privateKeyIsEnabled;?> />
|
||||||
<label for="pEnablePrivateKey"><?php echo T_('Enable'); ?></label>
|
<label for="pEnablePrivateKey"><?php echo T_('Enable'); ?></label>
|
||||||
<input type="text" id="pPrivateKey" name="pPrivateKey" size="40" value="<?php echo $privateKey;?>" readonly="readonly" />
|
<input type="text" id="pPrivateKey" name="pPrivateKey" size="40" value="<?php echo $privateKey;?>" readonly="readonly" />
|
||||||
<!--<input type="button" name="submittedPK" value="<?php echo T_('Generate New Key'); ?>" />-->
|
<a onclick="getNewPrivateKey(this); return false;"><button type="submit" name="submittedPK" value="1"><?php echo T_('Generate New Key'); ?></button></a>
|
||||||
|
|
||||||
<a onClick="getNewPrivateKey(this); return false;"><button type="submit" name="submittedPK" value="1"><?php echo T_('Generate New Key'); ?></button></a>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -821,23 +821,34 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||||
|
|
||||||
// Handle the parts of the query that depend on any tags that are present.
|
// Handle the parts of the query that depend on any tags that are present.
|
||||||
$query_4 = '';
|
$query_4 = '';
|
||||||
for ($i = 0; $i < $tagcount; $i ++) {
|
if ($tagcount > 0) {
|
||||||
$query_2 .= ', '. $b2tservice->getTableName() .' AS T'. $i;
|
$query_2 .= ', '. $b2tservice->getTableName() .' AS T0';
|
||||||
$query_4 .= ' AND (';
|
$query_4 .= ' AND (';
|
||||||
|
|
||||||
|
$tagArray = array();
|
||||||
|
for ($i = 0; $i < $tagcount; $i ++) {
|
||||||
|
$tmpTag = $this->db->sql_escape($tags[$i]);
|
||||||
$allLinkedTags = $tag2tagservice->getAllLinkedTags(
|
$allLinkedTags = $tag2tagservice->getAllLinkedTags(
|
||||||
$this->db->sql_escape($tags[$i]), '>', $user
|
$tmpTag, '>', $user
|
||||||
);
|
);
|
||||||
|
|
||||||
while (is_array($allLinkedTags) && count($allLinkedTags)>0) {
|
while (is_array($allLinkedTags) && count($allLinkedTags)>0) {
|
||||||
$query_4 .= ' T'. $i .'.tag = "'. array_pop($allLinkedTags) .'"';
|
$tmpValue = array_pop($allLinkedTags);
|
||||||
$query_4 .= ' OR';
|
if (in_array($tmpValue, $tagArray) == false) {
|
||||||
|
$tagArray[] = $tmpValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$query_4 .= ' T'. $i .'.tag = "'. $this->db->sql_escape($tags[$i]) .'"';
|
if (in_array($tmpTag, $tagArray) == false) {
|
||||||
|
$tagArray[] = $tmpTag;
|
||||||
$query_4 .= ') AND T'. $i .'.bId = B.bId';
|
}
|
||||||
//die($query_4);
|
}
|
||||||
|
// loop through array of possible tags
|
||||||
|
foreach ($tagArray as $k => $v) {
|
||||||
|
$query_4 .= ' T0.tag = "'. $v .'" OR';
|
||||||
|
}
|
||||||
|
$query_4 = substr($query_4,0,-3);
|
||||||
|
$query_4 .= ') AND T0.bId = B.bId';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search terms
|
// Search terms
|
||||||
|
|
|
@ -99,7 +99,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
||||||
$tags_count = is_array($tags)?count($tags):0;
|
$tags_count = is_array($tags)?count($tags):0;
|
||||||
|
|
||||||
for ($i = 0; $i < $tags_count; $i++) {
|
for ($i = 0; $i < $tags_count; $i++) {
|
||||||
$tags[$i] = trim(strtolower($tags[$i]));
|
$tags[$i] = trim(utf8_strtolower($tags[$i]));
|
||||||
if ($fromApi) {
|
if ($fromApi) {
|
||||||
include_once 'SemanticScuttle/functions.php';
|
include_once 'SemanticScuttle/functions.php';
|
||||||
$tags[$i] = convertTag($tags[$i], 'in');
|
$tags[$i] = convertTag($tags[$i], 'in');
|
||||||
|
|
|
@ -141,10 +141,10 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
|
||||||
|
|
||||||
//normalize
|
//normalize
|
||||||
if(!is_array($tags)) {
|
if(!is_array($tags)) {
|
||||||
$tags = strtolower(trim($tags));
|
$tags = utf8_strtolower(trim($tags));
|
||||||
} else {
|
} else {
|
||||||
for($i=0; $i<count($tags); $i++) {
|
for($i=0; $i<count($tags); $i++) {
|
||||||
$tags[$i] = strtolower(trim($tags[$i]));
|
$tags[$i] = utf8_strtolower(trim($tags[$i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $tags;
|
return $tags;
|
||||||
|
|
|
@ -229,12 +229,14 @@ if ($templatename == 'editbookmark.tpl') {
|
||||||
$tplVars['sidebar_blocks'] = array('watchstatus');
|
$tplVars['sidebar_blocks'] = array('watchstatus');
|
||||||
|
|
||||||
if (!$cat) { //user page without tags
|
if (!$cat) { //user page without tags
|
||||||
|
$rssTitle = ": My Bookmarks";
|
||||||
$cat = NULL;
|
$cat = NULL;
|
||||||
$tplVars['currenttag'] = NULL;
|
$tplVars['currenttag'] = NULL;
|
||||||
//$tplVars['sidebar_blocks'][] = 'menu2';
|
//$tplVars['sidebar_blocks'][] = 'menu2';
|
||||||
$tplVars['sidebar_blocks'][] = 'linked';
|
$tplVars['sidebar_blocks'][] = 'linked';
|
||||||
$tplVars['sidebar_blocks'][] = 'popular';
|
$tplVars['sidebar_blocks'][] = 'popular';
|
||||||
} else { //pages with tags
|
} else { //pages with tags
|
||||||
|
$rssTitle = ": Tags" . $catTitle;
|
||||||
$rssCat = '/'. filter($cat, 'url');
|
$rssCat = '/'. filter($cat, 'url');
|
||||||
$tplVars['currenttag'] = $cat;
|
$tplVars['currenttag'] = $cat;
|
||||||
$tplVars['sidebar_blocks'][] = 'tagactions';
|
$tplVars['sidebar_blocks'][] = 'tagactions';
|
||||||
|
@ -264,9 +266,22 @@ if ($templatename == 'editbookmark.tpl') {
|
||||||
|
|
||||||
// Set template vars
|
// Set template vars
|
||||||
$tplVars['rsschannels'] = array(
|
$tplVars['rsschannels'] = array(
|
||||||
array(filter($sitename .': '. $pagetitle), createURL('rss', filter($user, 'url') . $rssCat.'?sort='.getSortOrder()))
|
array(filter($sitename .$rssTitle), createURL('rss', filter($user, 'url') . $rssCat.'?sort='.getSortOrder()))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($userservice->isLoggedOn()) {
|
||||||
|
$currentUsername = $currentUser->getUsername();
|
||||||
|
if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
|
||||||
|
array_push(
|
||||||
|
$tplVars['rsschannels'],
|
||||||
|
array(
|
||||||
|
filter($sitename . $rssTitle. sprintf(T_(': (private) ')) . $currentUsername),
|
||||||
|
createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privatekey='.$currentUser->getPrivateKey())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$tplVars['page'] = $page;
|
$tplVars['page'] = $page;
|
||||||
$tplVars['start'] = $start;
|
$tplVars['start'] = $start;
|
||||||
$tplVars['bookmarkCount'] = $start + 1;
|
$tplVars['bookmarkCount'] = $start + 1;
|
||||||
|
|
15
www/tags.php
15
www/tags.php
|
@ -67,9 +67,22 @@ if ($usecache) {
|
||||||
$tplVars['pagetitle'] = T_('Tags') .': '. $cat;
|
$tplVars['pagetitle'] = T_('Tags') .': '. $cat;
|
||||||
$tplVars['loadjs'] = true;
|
$tplVars['loadjs'] = true;
|
||||||
$tplVars['rsschannels'] = array(
|
$tplVars['rsschannels'] = array(
|
||||||
array(filter($sitename .': '. $pagetitle), createURL('rss', 'all/'. filter($cat, 'url')).'?sort='.getSortOrder())
|
array(filter($sitename .': Tags: '. $cat), createURL('rss', 'all/'. filter($cat, 'url')).'?sort='.getSortOrder())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($userservice->isLoggedOn()) {
|
||||||
|
$currentUsername = $currentUser->getUsername();
|
||||||
|
if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
|
||||||
|
array_push(
|
||||||
|
$tplVars['rsschannels'],
|
||||||
|
array(
|
||||||
|
filter($sitename .': Tags: '. $cat . sprintf(T_(': (private) ')) . $currentUsername),
|
||||||
|
createURL('rss', filter($currentUsername, 'url') . '?sort='.getSortOrder().'&privatekey='.$currentUser->getPrivateKey())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Pagination
|
// Pagination
|
||||||
$perpage = getPerPageCount($currentUser);
|
$perpage = getPerPageCount($currentUser);
|
||||||
if (intval(GET_PAGE) > 1) {
|
if (intval(GET_PAGE) > 1) {
|
||||||
|
|
Loading…
Reference in a new issue