Batch tagging (first pass but working).
Search will now look in bookmarks addresses too. Some bugfixes.
This commit is contained in:
parent
e567e30ce0
commit
4b5059bfc4
@ -162,6 +162,14 @@ default:
|
|||||||
<a href="?sort=<?php echo $votingSort ?>"><?php echo T_("Voting").$votingArrow; ?></a>
|
<a href="?sort=<?php echo $votingSort ?>"><?php echo T_("Voting").$votingArrow; ?></a>
|
||||||
<span>/</span>
|
<span>/</span>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<?php
|
||||||
|
if ($userservice->isLoggedOn() && $_SERVER['PHP_SELF'] !== "/index.php") {
|
||||||
|
echo '<form method="get" action="'. $_SERVER['REQUEST_URI'] .'">';
|
||||||
|
echo '<input type="hidden" name="batch" value="1"/>';
|
||||||
|
echo '<input type="submit" value="Batch tagging"/>';
|
||||||
|
echo "</form>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($currenttag!= '') {
|
if ($currenttag!= '') {
|
||||||
@ -178,7 +186,6 @@ if ($currenttag!= '') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
?></p>
|
?></p>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// PAGINATION
|
// PAGINATION
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ $ajaxUrl = ROOT . 'ajax/'
|
|||||||
: 'getcontacttags'
|
: 'getcontacttags'
|
||||||
) . '.php';
|
) . '.php';
|
||||||
?>
|
?>
|
||||||
<form onsubmit="var ind = 0; var cb = document.getElementById('checkbox'+ind); while (cb !== undefined) {var title = document.getElementById('titleField'+ind); var address = document.getElementById('address'+ind); if(cb.checked) {cb.parentNode.removeChild(cb);} else {cb.parentNode.removeChild(cb); title.parentNode.removeChild(title); address.parentNode.removeChild(address);} ind++; cb = document.getElementById('checkbox'+ind);}" action="<?php echo $formaction; ?>" method="post">
|
<form onsubmit="var ind = 0; var cb = document.getElementById('checkbox'+ind); while (cb !== null) {var title = document.getElementById('titleField'+ind); var address = document.getElementById('address'+ind); if(cb.checked) {cb.parentNode.removeChild(cb);} else {cb.parentNode.removeChild(cb); title.parentNode.removeChild(title); address.parentNode.removeChild(address);} ind++; cb = document.getElementById('checkbox'+ind);}" action="<?php echo $formaction; ?>" method="post">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left">
|
<th align="left">
|
||||||
@ -75,13 +75,44 @@ $ajaxUrl = ROOT . 'ajax/'
|
|||||||
<td>← <?php echo T_('Just visible by you and your contacts.'); ?>
|
<td>← <?php echo T_('Just visible by you and your contacts.'); ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php if(! isset($batch)): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left"><?php echo T_('Tags'); ?></th>
|
<th align="left"><?php echo T_('Tags'); ?></th>
|
||||||
<td class="scuttletheme">
|
<td class="scuttletheme">
|
||||||
<input type="text" id="tags" name="tags" size="75" value="<?php echo filter($row['tags'], 'xml'); ?>"/>
|
<input type="text" id="tags" class="tags" name="tags" size="75" value="<?php echo filter($row['tags'], 'xml'); ?>"/>
|
||||||
</td>
|
</td>
|
||||||
<td>← <?php echo T_('Comma-separated'); ?></td>
|
<td>← <?php echo T_('Comma-separated'); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<tr>
|
||||||
|
<th align="left"><?php echo 'Common tags'; ?></th>
|
||||||
|
<td class="scuttletheme">
|
||||||
|
<span><?php echo filter($commontags, 'xml'); ?></span>
|
||||||
|
</td>
|
||||||
|
<td>← <?php echo 'Tags common to all those bookmarks'; ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th align="left"><?php echo 'Associated tags'; ?></th>
|
||||||
|
<td class="scuttletheme">
|
||||||
|
<span><?php echo filter($alltags, 'xml'); ?></span>
|
||||||
|
</td>
|
||||||
|
<td>← <?php echo 'All tags associated to those bookmarks'; ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th align="left"><?php echo 'Add those tags'; ?></th>
|
||||||
|
<td class="scuttletheme">
|
||||||
|
<input type="text" id="tags" class="tags" name="tags" size="75" value="<?php echo filter($row['tags'], 'xml'); ?>"/>
|
||||||
|
</td>
|
||||||
|
<td>← <?php echo T_('Comma-separated'); ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th align="left"><?php echo 'Remove those tags'; ?></th>
|
||||||
|
<td class="scuttletheme">
|
||||||
|
<input type="text" id="removetags" class="tags" name="removetags" size="75" value="<?php echo filter($row['tags'], 'xml'); ?>"/>
|
||||||
|
</td>
|
||||||
|
<td>← <?php echo T_('Comma-separated'); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endif; ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
<td align="right"><small><?php echo htmlspecialchars(T_('Note: use ">" to include one tag in another. e.g.: europe>france>paris'))?></small></td>
|
<td align="right"><small><?php echo htmlspecialchars(T_('Note: use ">" to include one tag in another. e.g.: europe>france>paris'))?></small></td>
|
||||||
@ -112,6 +143,9 @@ $ajaxUrl = ROOT . 'ajax/'
|
|||||||
<input type="submit" name="delete" value="<?php echo T_('Delete Bookmark'); ?>" />
|
<input type="submit" name="delete" value="<?php echo T_('Delete Bookmark'); ?>" />
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
<button type="button" id="button" title="Invert selection" onclick="var ind = 0; var cb = document.getElementById('checkbox'+ind); while (cb !== null) {var title = document.getElementById('titleField'+ind); var address = document.getElementById('address'+ind); if(cb.checked) {cb.checked=false;} else {cb.checked=true;} ind++; cb = document.getElementById('checkbox'+ind);}">Invert selection</button>
|
||||||
|
<?php
|
||||||
if (isset($showdelete) && $showdelete) {
|
if (isset($showdelete) && $showdelete) {
|
||||||
echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $row['bHash']).'">';
|
echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $row['bHash']).'">';
|
||||||
echo T_('edit common description').'</a>)';
|
echo T_('edit common description').'</a>)';
|
||||||
@ -131,21 +165,22 @@ $ajaxUrl = ROOT . 'ajax/'
|
|||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
|
$ind = 0;
|
||||||
foreach($row['bAddress'] as $index => $address) {
|
foreach($row['bAddress'] as $index => $address) {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td height="20px"></td>
|
<td height="20px"></td>
|
||||||
<td><input type="checkbox" id="checkbox<?php echo $index; ?>" checked /></td>
|
<td><input type="checkbox" id="checkbox<?php echo $ind; ?>" checked="checked" /></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left"><?php echo T_('Address'); ?></th>
|
<th align="left"><?php echo T_('Address'); ?></th>
|
||||||
<td><input type="text" id="address<?php echo $index; ?>" name="address[<?php echo $index; ?>]" size="75" maxlength="65535" value="<?php echo filter($address, 'xml'); ?>" onblur="useAddress(this)" /></td>
|
<td><input type="text" id="address<?php echo $ind; ?>" name="address[<?php echo $index; ?>]" size="75" maxlength="65535" value="<?php echo filter($address, 'xml'); ?>" onblur="useAddress(this)" /></td>
|
||||||
<td>← <?php echo T_('Required'); ?></td>
|
<td>← <?php echo T_('Required'); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left"><?php echo T_('Title'); ?></th>
|
<th align="left"><?php echo T_('Title'); ?></th>
|
||||||
<td><input type="text" id="titleField<?php echo $index; ?>" name="title[<?php echo $index; ?>]" size="75" maxlength="255" value="<?php echo filter($row['bTitle'][$index], 'xml'); ?>" onkeypress="this.style.backgroundImage = 'none';" /></td>
|
<td><input type="text" id="titleField<?php echo $ind; ?>" name="title[<?php echo $index; ?>]" size="75" maxlength="255" value="<?php echo filter($row['bTitle'][$index], 'xml'); ?>" onkeypress="this.style.backgroundImage = 'none';" /></td>
|
||||||
<td>← <?php echo T_('Required'); ?></td>
|
<td>← <?php echo T_('Required'); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -154,6 +189,7 @@ foreach($row['bAddress'] as $index => $address) {
|
|||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
|
$ind++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
@ -179,7 +215,8 @@ jQuery(document).ready(function() {
|
|||||||
}
|
}
|
||||||
//var availableTags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"];
|
//var availableTags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"];
|
||||||
|
|
||||||
jQuery("input#tags").autocomplete({
|
//jQuery("input#tags").autocomplete({
|
||||||
|
jQuery("input.tags").autocomplete({
|
||||||
autoFocus: true,
|
autoFocus: true,
|
||||||
minLength: 1,
|
minLength: 1,
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ if ($userservice->isLoggedOn() && is_object($currentUser)) {
|
|||||||
<?php if (isset($loadjs)) :?>
|
<?php if (isset($loadjs)) :?>
|
||||||
<div id="password-form" style="background:white; z-index: 2; position:absolute; top:55px; right:10px; visibility:hidden;">
|
<div id="password-form" style="background:white; z-index: 2; position:absolute; top:55px; right:10px; visibility:hidden;">
|
||||||
<form id="noshoulderSurfingProtectionPassword">
|
<form id="noshoulderSurfingProtectionPassword">
|
||||||
<input type="password" name="password" id="password" size="40" placeholder="Type your password then press Enter to unprotect.">
|
<input type="password" name="password" id="password" size="40" placeholder="Type your password then press Enter to unprotect."/>
|
||||||
<!-- Allow form submission with keyboard without duplicating the dialog button -->
|
<!-- Allow form submission with keyboard without duplicating the dialog button -->
|
||||||
<input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
|
<input type="submit" tabindex="-1" style="position:absolute; top:-1000px"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
@ -888,10 +888,13 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
|||||||
// but private notes won't appear if not allowed.
|
// but private notes won't appear if not allowed.
|
||||||
$query_4 .= ' OR B.bPrivateNote LIKE "'
|
$query_4 .= ' OR B.bPrivateNote LIKE "'
|
||||||
. $this->db->sql_escape($aTerms[$i])
|
. $this->db->sql_escape($aTerms[$i])
|
||||||
.'%"';
|
. '%"';
|
||||||
$query_4 .= ' OR U.username = "'
|
$query_4 .= ' OR U.username = "'
|
||||||
. $this->db->sql_escape($aTerms[$i])
|
. $this->db->sql_escape($aTerms[$i])
|
||||||
. '"'; //exact match for username
|
. '"'; //exact match for username
|
||||||
|
$query_4 .= ' OR B.bAddress LIKE "%'
|
||||||
|
. $this->db->sql_escape($aTerms[$i])
|
||||||
|
. '%"';
|
||||||
if ($dotags) {
|
if ($dotags) {
|
||||||
$query_4 .= ' OR T.tag LIKE "'
|
$query_4 .= ' OR T.tag LIKE "'
|
||||||
. $this->db->sql_escape($aTerms[$i])
|
. $this->db->sql_escape($aTerms[$i])
|
||||||
@ -940,10 +943,10 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
|||||||
'', __LINE__, __FILE__, $query, $this->db
|
'', __LINE__, __FILE__, $query, $this->db
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// Disabled because breaks when in debug mode…
|
||||||
if (SQL_LAYER == 'mysql4') {
|
//if (SQL_LAYER == 'mysql4') {
|
||||||
$totalquery = 'SELECT FOUND_ROWS() AS total';
|
// $totalquery = 'SELECT FOUND_ROWS() AS total';
|
||||||
} else {
|
//} else {
|
||||||
if ($hash) {
|
if ($hash) {
|
||||||
$totalquery = 'SELECT COUNT(*) AS total'. $query_2
|
$totalquery = 'SELECT COUNT(*) AS total'. $query_2
|
||||||
. $query_3 . $query_4;
|
. $query_3 . $query_4;
|
||||||
@ -951,7 +954,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
|||||||
$totalquery = 'SELECT COUNT(DISTINCT bAddress) AS total'
|
$totalquery = 'SELECT COUNT(DISTINCT bAddress) AS total'
|
||||||
. $query_2 . $query_3 . $query_4;
|
. $query_2 . $query_3 . $query_4;
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (!($totalresult = $this->db->sql_query($totalquery))
|
if (!($totalresult = $this->db->sql_query($totalquery))
|
||||||
|| (!($row = $this->db->sql_fetchrow($totalresult)))
|
|| (!($row = $this->db->sql_fetchrow($totalresult)))
|
||||||
@ -980,7 +983,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
|||||||
|
|
||||||
$this->db->sql_freeresult($dbresult);
|
$this->db->sql_freeresult($dbresult);
|
||||||
$output = array ('bookmarks' => $bookmarks, 'total' => $total);
|
$output = array ('bookmarks' => $bookmarks, 'total' => $total);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
|||||||
foreach ($tags as $key => $tag) {
|
foreach ($tags as $key => $tag) {
|
||||||
if (strpos($tag, '=')) {
|
if (strpos($tag, '=')) {
|
||||||
// case "="
|
// case "="
|
||||||
$pieces = explode('=', $tag);
|
$pieces = $tagservice->normalize(explode('=', $tag));
|
||||||
$nbPieces = count($pieces);
|
$nbPieces = count($pieces);
|
||||||
if ($nbPieces <= 1) {
|
if ($nbPieces <= 1) {
|
||||||
continue;
|
continue;
|
||||||
@ -163,7 +163,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
|||||||
$tags[$key] = $pieces[0];
|
$tags[$key] = $pieces[0];
|
||||||
} else {
|
} else {
|
||||||
// case ">"
|
// case ">"
|
||||||
$pieces = explode('>', $tag);
|
$pieces = $tagservice->normalize(explode('>', $tag));
|
||||||
$nbPieces = count($pieces);
|
$nbPieces = count($pieces);
|
||||||
if ($nbPieces <= 1) {
|
if ($nbPieces <= 1) {
|
||||||
continue;
|
continue;
|
||||||
@ -374,6 +374,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$output = $this->db->sql_fetchrowset($dbresult);
|
$output = $this->db->sql_fetchrowset($dbresult);
|
||||||
|
|
||||||
$this->db->sql_freeresult($dbresult);
|
$this->db->sql_freeresult($dbresult);
|
||||||
return $this->filterShoulderSurfingProtectedTags($output);
|
return $this->filterShoulderSurfingProtectedTags($output);
|
||||||
}
|
}
|
||||||
|
@ -281,13 +281,14 @@ class sql_db
|
|||||||
|
|
||||||
if ($query_id)
|
if ($query_id)
|
||||||
{
|
{
|
||||||
unset($this->rowset[$query_id]);
|
$id = (int) $query_id;
|
||||||
unset($this->row[$query_id]);
|
unset($this->rowset[$id]);
|
||||||
|
unset($this->row[$id]);
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
while ($this->rowset[$query_id] = $this->sql_fetchrow($query_id))
|
while ($this->rowset[$id] = $this->sql_fetchrow($query_id))
|
||||||
{
|
{
|
||||||
$result[] = $this->rowset[$query_id];
|
$result[] = $this->rowset[$id];
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ require_once 'SemanticScuttle/constants.php';
|
|||||||
|
|
||||||
// Debug Management using constants
|
// Debug Management using constants
|
||||||
if (DEBUG_MODE) {
|
if (DEBUG_MODE) {
|
||||||
ini_set('display_errors', '1');
|
ini_set('display_errors', '0');
|
||||||
ini_set('mysql.trace_mode', '1');
|
ini_set('mysql.trace_mode', '1');
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
} else {
|
} else {
|
||||||
|
@ -72,7 +72,6 @@ if (isset($userid)) {
|
|||||||
} else {
|
} else {
|
||||||
$tplVars['cat_url'] = createURL('tags', '%2$s');
|
$tplVars['cat_url'] = createURL('tags', '%2$s');
|
||||||
}
|
}
|
||||||
|
|
||||||
$tplVars['sidebar_blocks'] = array('linked');
|
$tplVars['sidebar_blocks'] = array('linked');
|
||||||
$tplVars['userid'] = $userid;
|
$tplVars['userid'] = $userid;
|
||||||
$tplVars['loadjs'] = true;
|
$tplVars['loadjs'] = true;
|
||||||
|
@ -54,10 +54,14 @@ isset($_POST['popup']) ? define('POST_POPUP', $_POST['popup']): define('POST_POP
|
|||||||
|
|
||||||
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
|
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
|
||||||
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
|
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
|
||||||
|
isset($_GET['batch']) ? define('GET_BATCH', $_GET['batch']): define('GET_BATCH', 0);
|
||||||
|
|
||||||
if (!isset($_POST['tags'])) {
|
if (!isset($_POST['tags'])) {
|
||||||
$_POST['tags'] = array();
|
$_POST['tags'] = array();
|
||||||
}
|
}
|
||||||
|
if (!isset($_POST['removetags'])) {
|
||||||
|
$_POST['removetags'] = array();
|
||||||
|
}
|
||||||
//echo '<p>' . var_export($_POST, true) . '</p>';die();
|
//echo '<p>' . var_export($_POST, true) . '</p>';die();
|
||||||
if (! is_array($ADDRESS)) {
|
if (! is_array($ADDRESS)) {
|
||||||
$ADDRESS = array($ADDRESS);
|
$ADDRESS = array($ADDRESS);
|
||||||
@ -162,7 +166,8 @@ if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
|
|||||||
$description = trim(POST_DESCRIPTION);
|
$description = trim(POST_DESCRIPTION);
|
||||||
$privateNote = trim(POST_PRIVATENOTE);
|
$privateNote = trim(POST_PRIVATENOTE);
|
||||||
$status = intval(POST_STATUS);
|
$status = intval(POST_STATUS);
|
||||||
$categories = explode(',', $_POST['tags']);
|
$categories = array_map('trim', explode(',', trim($_POST['tags'])));
|
||||||
|
$removecategories = array_map('trim', explode(',', trim($_POST['removetags'])));
|
||||||
$saved = true;
|
$saved = true;
|
||||||
foreach($address as $index => $value) {
|
foreach($address as $index => $value) {
|
||||||
if ($bookmarkservice->bookmarkExists($value, $currentUserID)) {
|
if ($bookmarkservice->bookmarkExists($value, $currentUserID)) {
|
||||||
@ -171,6 +176,8 @@ if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
|
|||||||
$bId = intval($bookmark['bId']);
|
$bId = intval($bookmark['bId']);
|
||||||
$row = $bookmarkservice->getBookmark($bId, true);
|
$row = $bookmarkservice->getBookmark($bId, true);
|
||||||
$categories = array_unique(array_merge($row['tags'], $categories));
|
$categories = array_unique(array_merge($row['tags'], $categories));
|
||||||
|
// remove tags
|
||||||
|
$categories = array_diff($categories, $removecategories);
|
||||||
if (!$bookmarkservice->updateBookmark($bId, $value, $title[$index], $description, $privateNote, $status, $categories)) {
|
if (!$bookmarkservice->updateBookmark($bId, $value, $title[$index], $description, $privateNote, $status, $categories)) {
|
||||||
$tplvars['error'] = T_('Error while saving this bookmark : ' + $value);
|
$tplvars['error'] = T_('Error while saving this bookmark : ' + $value);
|
||||||
$templatename = 'editbookmark.tpl';
|
$templatename = 'editbookmark.tpl';
|
||||||
@ -199,7 +206,7 @@ if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GET_ACTION == "add") {
|
if (GET_ACTION == "add" || GET_BATCH) {
|
||||||
// If the bookmark exists already, edit the original
|
// If the bookmark exists already, edit the original
|
||||||
if (count($ADDRESS) === 1) {
|
if (count($ADDRESS) === 1) {
|
||||||
if ($bookmarkservice->bookmarkExists(stripslashes($ADDRESS[0]), $currentUserID)) {
|
if ($bookmarkservice->bookmarkExists(stripslashes($ADDRESS[0]), $currentUserID)) {
|
||||||
@ -212,20 +219,46 @@ if (GET_ACTION == "add") {
|
|||||||
$templatename = 'editbookmark.tpl';
|
$templatename = 'editbookmark.tpl';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($templatename == 'editbookmark.tpl') {
|
if ($templatename == 'editbookmark.tpl') { // Prepare to display the edit bookmark page.
|
||||||
if ($userservice->isLoggedOn()) {
|
if ($userservice->isLoggedOn()) {
|
||||||
$tplVars['formaction'] = createURL('bookmarks', $currentUsername);
|
$tplVars['formaction'] = createURL('bookmarks', $currentUsername);
|
||||||
if (POST_SUBMITTED != '') {
|
if (POST_SUBMITTED != '') {
|
||||||
$tplVars['row'] = array(
|
$tplVars['row'] = array(
|
||||||
'bTitle' => array_map('stripslashes', $TITLE),
|
'bTitle' => array_map('stripslashes', $TITLE),
|
||||||
'bAddress' => array_map('stripslashes', $ADDRESS),
|
'bAddress' => array_map('stripslashes', $ADDRESS),
|
||||||
'bDescription' => stripslashes(POST_DESCRIPTION),
|
'bDescription' => stripslashes(POST_DESCRIPTION),
|
||||||
'bPrivateNote' => stripslashes(POST_PRIVATENOTE),
|
'bPrivateNote' => stripslashes(POST_PRIVATENOTE),
|
||||||
'tags' => ($_POST['tags'] ? $_POST['tags'] : array()),
|
'tags' => ($_POST['tags'] ? $_POST['tags'] : array()),
|
||||||
'bStatus' => $GLOBALS['defaults']['privacy'],
|
'bStatus' => $GLOBALS['defaults']['privacy'],
|
||||||
);
|
);
|
||||||
$tplVars['tags'] = $_POST['tags'];
|
$tplVars['tags'] = $_POST['tags'];
|
||||||
} else {
|
}
|
||||||
|
elseif (GET_BATCH) {
|
||||||
|
$completebookmarks = $bookmarkservice->getBookmarks(0, null, $userid, $cat, null, getSortOrder());
|
||||||
|
$addresses2 = array();
|
||||||
|
$titles2 = array();
|
||||||
|
$tags2 = array();
|
||||||
|
foreach ($completebookmarks['bookmarks'] as $key => &$row) {
|
||||||
|
$addresses2[$row['bId']] = $row['bAddress'];
|
||||||
|
$titles2[$row['bId']] = $row['bTitle'];
|
||||||
|
$row = $bookmarkservice->getBookmark($row['bId'], true);
|
||||||
|
$tags2[] = $row['tags'];
|
||||||
|
}
|
||||||
|
$alltags2 = array_unique(call_user_func_array('array_merge', $tags2));
|
||||||
|
$commontags2 = call_user_func_array('array_intersect', $tags2);
|
||||||
|
$tplVars['row'] = array(
|
||||||
|
'bTitle' => $titles2,
|
||||||
|
'bAddress' => $addresses2,
|
||||||
|
'bDescription' => '',
|
||||||
|
'bPrivateNote' => '',
|
||||||
|
'tags' => array(),
|
||||||
|
'bStatus' => $GLOBALS['defaults']['privacy']
|
||||||
|
);
|
||||||
|
$tplVars['batch'] = '1';
|
||||||
|
$tplVars['alltags'] = implode(', ', $alltags2);
|
||||||
|
$tplVars['commontags'] = implode(', ', $commontags2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
if(GET_COPYOF != '') { //copy from bookmarks page
|
if(GET_COPYOF != '') { //copy from bookmarks page
|
||||||
$tplVars['row'] = $bookmarkservice->getBookmark(intval(GET_COPYOF), true);
|
$tplVars['row'] = $bookmarkservice->getBookmark(intval(GET_COPYOF), true);
|
||||||
if(!$currentUser->isAdmin()) {
|
if(!$currentUser->isAdmin()) {
|
||||||
@ -234,9 +267,7 @@ if ($templatename == 'editbookmark.tpl') {
|
|||||||
}else { //copy from pop-up bookmarklet
|
}else { //copy from pop-up bookmarklet
|
||||||
$tplVars['row'] = array(
|
$tplVars['row'] = array(
|
||||||
'bTitle' => array_map('stripslashes', $TITLE),
|
'bTitle' => array_map('stripslashes', $TITLE),
|
||||||
//'bTitle' => stripslashes(GET_TITLE),
|
|
||||||
'bAddress' => array_map('stripslashes', $ADDRESS),
|
'bAddress' => array_map('stripslashes', $ADDRESS),
|
||||||
//'bAddress' => stripslashes(GET_ADDRESS),
|
|
||||||
'bDescription' => stripslashes(GET_DESCRIPTION),
|
'bDescription' => stripslashes(GET_DESCRIPTION),
|
||||||
'bPrivateNote' => stripslashes(GET_PRIVATENOTE),
|
'bPrivateNote' => stripslashes(GET_PRIVATENOTE),
|
||||||
'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()),
|
'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()),
|
||||||
@ -332,24 +363,24 @@ if ($templatename == 'editbookmark.tpl') {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($userservice->isLoggedOn()) {
|
if ($userservice->isLoggedOn()) {
|
||||||
$currentUsername = $currentUser->getUsername();
|
$currentUsername = $currentUser->getUsername();
|
||||||
if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
|
if ($userservice->isPrivateKeyValid($currentUser->getPrivateKey())) {
|
||||||
array_push(
|
array_push(
|
||||||
$tplVars['rsschannels'],
|
$tplVars['rsschannels'],
|
||||||
array(
|
array(
|
||||||
sprintf(
|
sprintf(
|
||||||
T_('%s: %s (+private %s)'),
|
T_('%s: %s (+private %s)'),
|
||||||
$sitename, $rssTitle, $currentUsername
|
$sitename, $rssTitle, $currentUsername
|
||||||
),
|
),
|
||||||
createURL('rss', filter($currentUsername, 'url'))
|
createURL('rss', filter($currentUsername, 'url'))
|
||||||
. $rssCat
|
. $rssCat
|
||||||
. '?sort=' . getSortOrder()
|
. '?sort=' . getSortOrder()
|
||||||
. '&privateKey=' . $currentUser->getPrivateKey()
|
. '&privateKey=' . $currentUser->getPrivateKey()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$tplVars['page'] = $page;
|
$tplVars['page'] = $page;
|
||||||
$tplVars['start'] = $start;
|
$tplVars['start'] = $start;
|
||||||
|
@ -26,7 +26,7 @@ isset($_POST['terms']) ? define('POST_TERMS', $_POST['terms']): define('POST_TER
|
|||||||
isset($_POST['range']) ? define('POST_RANGE', $_POST['range']): define('POST_RANGE', '');
|
isset($_POST['range']) ? define('POST_RANGE', $_POST['range']): define('POST_RANGE', '');
|
||||||
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
|
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
|
||||||
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
|
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
|
||||||
|
isset($_GET['batch']) ? define('GET_BATCH', $_GET['batch']): define('GET_BATCH', 0);
|
||||||
|
|
||||||
// POST
|
// POST
|
||||||
if (POST_TERMS != '') {
|
if (POST_TERMS != '') {
|
||||||
@ -115,6 +115,41 @@ if (is_null($terms)) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($userservice->isLoggedOn() && GET_BATCH) {
|
||||||
|
$currentUsername = $currentUser->getUsername();
|
||||||
|
$completebookmarks = $bookmarkservice->getBookmarks(0, null, $s_user, null, $terms, getSortOrder(),
|
||||||
|
$s_watchlist, $s_start, $s_end);
|
||||||
|
$templatename = 'editbookmark.tpl';
|
||||||
|
$addresses2 = array();
|
||||||
|
$titles2 = array();
|
||||||
|
$tags2 = array();
|
||||||
|
foreach ($completebookmarks['bookmarks'] as $key => &$row) {
|
||||||
|
$addresses2[$row['bId']] = $row['bAddress'];
|
||||||
|
$titles2[$row['bId']] = $row['bTitle'];
|
||||||
|
$row = $bookmarkservice->getBookmark($row['bId'], true);
|
||||||
|
$tags2[] = $row['tags'];
|
||||||
|
}
|
||||||
|
$alltags2 = array_unique(call_user_func_array('array_merge', $tags2));
|
||||||
|
$commontags2 = call_user_func_array('array_intersect', $tags2);
|
||||||
|
$tplVars['row'] = array(
|
||||||
|
'bTitle' => $titles2,
|
||||||
|
'bAddress' => $addresses2,
|
||||||
|
'bDescription' => '',
|
||||||
|
'bPrivateNote' => '',
|
||||||
|
'tags' => array(),
|
||||||
|
'bStatus' => $GLOBALS['defaults']['privacy']
|
||||||
|
);
|
||||||
|
$tplVars['pagetitle'] = T_('Add a Bookmark');
|
||||||
|
$tplVars['subtitle'] = T_('Add a Bookmark');
|
||||||
|
$tplVars['btnsubmit'] = T_('Add Bookmark');
|
||||||
|
$tplVars['popup'] = null;
|
||||||
|
$tplVars['batch'] = '1';
|
||||||
|
$tplVars['alltags'] = implode(', ', $alltags2);
|
||||||
|
$tplVars['commontags'] = implode(', ', $commontags2);
|
||||||
|
$tplVars['formaction'] = createURL('bookmarks', $currentUsername);
|
||||||
|
$templateservice->loadTemplate($templatename, $tplVars);
|
||||||
|
}
|
||||||
|
else {
|
||||||
$bookmarks = $bookmarkservice->getBookmarks(
|
$bookmarks = $bookmarkservice->getBookmarks(
|
||||||
$start, $perpage, $s_user, NULL, $terms, getSortOrder(),
|
$start, $perpage, $s_user, NULL, $terms, getSortOrder(),
|
||||||
$s_watchlist, $s_start, $s_end
|
$s_watchlist, $s_start, $s_end
|
||||||
@ -152,4 +187,5 @@ $tplVars['cat_url'] = createURL('tags', '%2$s');
|
|||||||
$tplVars['nav_url'] = createURL('search', $range .'/'. $terms .'/%3$s');
|
$tplVars['nav_url'] = createURL('search', $range .'/'. $terms .'/%3$s');
|
||||||
|
|
||||||
$templateservice->loadTemplate('bookmarks.tpl', $tplVars);
|
$templateservice->loadTemplate('bookmarks.tpl', $tplVars);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
74
www/tags.php
74
www/tags.php
@ -20,7 +20,6 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
require_once 'www-header.php';
|
require_once 'www-header.php';
|
||||||
|
|
||||||
/* Service creation: only useful services are created */
|
/* Service creation: only useful services are created */
|
||||||
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
|
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
|
||||||
$cacheservice =SemanticScuttle_Service_Factory::get('Cache');
|
$cacheservice =SemanticScuttle_Service_Factory::get('Cache');
|
||||||
@ -28,6 +27,7 @@ $cacheservice =SemanticScuttle_Service_Factory::get('Cache');
|
|||||||
/* Managing all possible inputs */
|
/* Managing all possible inputs */
|
||||||
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
|
isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
|
||||||
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
|
isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
|
||||||
|
isset($_GET['batch']) ? define('GET_BATCH', $_GET['batch']): define('GET_BATCH', 0);
|
||||||
|
|
||||||
/* Managing current logged user */
|
/* Managing current logged user */
|
||||||
$currentUser = $userservice->getCurrentObjectUser();
|
$currentUser = $userservice->getCurrentObjectUser();
|
||||||
@ -63,6 +63,43 @@ if ($usecache) {
|
|||||||
$cacheservice->Start($hash, 1800);
|
$cacheservice->Start($hash, 1800);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need all bookmarks (without paging) for batch tagging.
|
||||||
|
if ($userservice->isLoggedOn() && GET_BATCH) {
|
||||||
|
$currentUsername = $currentUser->getUsername();
|
||||||
|
$completebookmarks = $bookmarkservice->getBookmarks(0, null, null, $cat, null, getSortOrder());
|
||||||
|
$templatename = 'editbookmark.tpl';
|
||||||
|
$addresses2 = array();
|
||||||
|
$titles2 = array();
|
||||||
|
$tags2 = array();
|
||||||
|
foreach ($completebookmarks['bookmarks'] as $key => &$row) {
|
||||||
|
$addresses2[$row['bId']] = $row['bAddress'];
|
||||||
|
$titles2[$row['bId']] = $row['bTitle'];
|
||||||
|
$row = $bookmarkservice->getBookmark($row['bId'], true);
|
||||||
|
$tags2[] = $row['tags'];
|
||||||
|
}
|
||||||
|
$alltags2 = array_unique(call_user_func_array('array_merge', $tags2));
|
||||||
|
$commontags2 = call_user_func_array('array_intersect', $tags2);
|
||||||
|
$tplVars['row'] = array(
|
||||||
|
'bTitle' => $titles2,
|
||||||
|
'bAddress' => $addresses2,
|
||||||
|
'bDescription' => '',
|
||||||
|
'bPrivateNote' => '',
|
||||||
|
'tags' => array(),
|
||||||
|
'bStatus' => $GLOBALS['defaults']['privacy']
|
||||||
|
);
|
||||||
|
$tplVars['pagetitle'] = T_('Add a Bookmark');
|
||||||
|
$tplVars['subtitle'] = T_('Add a Bookmark');
|
||||||
|
$tplVars['btnsubmit'] = T_('Add Bookmark');
|
||||||
|
$tplVars['popup'] = null;
|
||||||
|
$tplVars['batch'] = '1';
|
||||||
|
$tplVars['alltags'] = implode(', ', $alltags2);
|
||||||
|
$tplVars['commontags'] = implode(', ', $commontags2);
|
||||||
|
$tplVars['formaction'] = createURL('bookmarks', $currentUsername);
|
||||||
|
$tplVars['loadjs'] = true;
|
||||||
|
$templateservice->loadTemplate($templatename, $tplVars);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
// Header variables
|
// Header variables
|
||||||
$tplVars['pagetitle'] = T_('Tags') .': '. $cat;
|
$tplVars['pagetitle'] = T_('Tags') .': '. $cat;
|
||||||
$tplVars['loadjs'] = true;
|
$tplVars['loadjs'] = true;
|
||||||
@ -106,7 +143,38 @@ $tplVars['page'] = $page;
|
|||||||
$tplVars['start'] = $start;
|
$tplVars['start'] = $start;
|
||||||
$tplVars['popCount'] = 25;
|
$tplVars['popCount'] = 25;
|
||||||
$tplVars['currenttag'] = $cat;
|
$tplVars['currenttag'] = $cat;
|
||||||
$tplVars['sidebar_blocks'] = array('linked', 'related', 'menu2');//array('linked', 'related', 'popular');
|
|
||||||
|
if ($userservice->isLoggedOn() && ! empty($GLOBALS['shoulderSurfingProtectedTag']) && ! isset($_COOKIE["noshoulderSurfingProtection"])) {
|
||||||
|
$tag2tagservice = SemanticScuttle_Service_Factory::get('Tag2Tag');
|
||||||
|
$b2tservice = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
|
||||||
|
$currentUserID = $currentUser->getId();
|
||||||
|
$alltags = $b2tservice->getTags($currentUserID);
|
||||||
|
$shoulderSurfingProtectedTags = $tag2tagservice->getAllLinkedTags($GLOBALS['shoulderSurfingProtectedTag'], '>', $currentUserID, array());
|
||||||
|
$shoulderSurfingProtectedTags[] = $GLOBALS['shoulderSurfingProtectedTag'];
|
||||||
|
$flag = 0;
|
||||||
|
if (! in_array($cat, $shoulderSurfingProtectedTags, true)) {
|
||||||
|
foreach ($alltags as $tag) {
|
||||||
|
if ($tag['tag'] === $cat) {
|
||||||
|
$flag = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($flag) {
|
||||||
|
$tplVars['sidebar_blocks'][] = 'tagactions';
|
||||||
|
$tplVars['sidebar_blocks'][] = 'linked';
|
||||||
|
$tplVars['sidebar_blocks'][] = 'related';
|
||||||
|
$tplVars['sidebar_blocks'][] = 'menu2';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$tplVars['sidebar_blocks'][] = 'tagactions';
|
||||||
|
$tplVars['sidebar_blocks'][] = 'linked';
|
||||||
|
$tplVars['sidebar_blocks'][] = 'related';
|
||||||
|
$tplVars['sidebar_blocks'][] = 'menu2';
|
||||||
|
}
|
||||||
|
|
||||||
$tplVars['subtitlehtml'] = $pagetitle;
|
$tplVars['subtitlehtml'] = $pagetitle;
|
||||||
$tplVars['bookmarkCount'] = $start + 1;
|
$tplVars['bookmarkCount'] = $start + 1;
|
||||||
$bookmarks = $bookmarkservice->getBookmarks($start, $perpage, NULL, $cat, NULL, getSortOrder());
|
$bookmarks = $bookmarkservice->getBookmarks($start, $perpage, NULL, $cat, NULL, getSortOrder());
|
||||||
@ -116,7 +184,7 @@ $tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s');
|
|||||||
$tplVars['nav_url'] = createURL('tags', '%2$s%3$s');
|
$tplVars['nav_url'] = createURL('tags', '%2$s%3$s');
|
||||||
|
|
||||||
$templateservice->loadTemplate('bookmarks.tpl', $tplVars);
|
$templateservice->loadTemplate('bookmarks.tpl', $tplVars);
|
||||||
|
}
|
||||||
if ($usecache) {
|
if ($usecache) {
|
||||||
// Cache output if existing copy has expired
|
// Cache output if existing copy has expired
|
||||||
$cacheservice->End($hash);
|
$cacheservice->End($hash);
|
||||||
|
Loading…
Reference in New Issue
Block a user