2 $userservice =& ServiceFactory::getServiceInstance('UserService');
3 $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
5 $logged_on_userid = $userservice->getCurrentUserId();
6 $this->includeTemplate($GLOBALS['top_include']);
8 include 'search.inc.php';
9 if (count($bookmarks) > 0) {
13 <?php echo T_("Sort by:"); ?>
14 <a href="?sort=date_desc"><?php echo T_("Date"); ?></a><span> / </span>
15 <a href="?sort=title_asc"><?php echo T_("Title"); ?></a><span> / </span>
19 <a href="?sort=url_asc"><?php echo T_("URL"); ?></a>
24 <ol<?php echo ($start > 0 ? ' start="'. ++$start .'"' : ''); ?> id="bookmarks">
27 foreach(array_keys($bookmarks) as $key) {
28 $row =& $bookmarks[$key];
29 switch ($row['bStatus']) {
43 foreach(array_keys($tags) as $key) {
45 $cats .= '<a href="'. sprintf($cat_url, filter($user, 'url'), filter($tag, 'url')) .'" rel="tag">'. filter($tag) .'</a>, ';
47 $cats = substr($cats, 0, -2);
49 $cats = ' to '. $cats;
52 // Edit and delete links
54 if ($bookmarkservice->editAllowed($row['bId'])) {
55 $edit = ' - <a href="'. createURL('edit', $row['bId']) .'">'. T_('Edit') .'</a><script type="text/javascript">document.write(" - <a href=\"#\" onclick=\"deleteBookmark(this, '. $row['bId'] .'); return false;\">'. T_('Delete') .'<\/a>");</script>';
60 if (!isset($user) || isset($watched)) {
61 $copy = ' '. T_('by') .' <a href="'. createURL('bookmarks', $row['username']) .'">'. $row['username'] .'</a>';
66 $others = $bookmarkservice->countOthers($row['bAddress']);
67 $ostart = '<a href="'. createURL('history', $row['bHash']) .'">';
73 $copy .= sprintf(T_(' and %s1 other%s'), $ostart, $oend);
76 $copy .= sprintf(T_(' and %2$s%1$s others%3$s'), $others, $ostart, $oend);
81 if ($userservice->isLoggedOn() && ($logged_on_userid != $row['uId'])) {
82 // Get the username of the current user
83 $currentUser = $userservice->getCurrentUser();
84 $currentUsername = $currentUser[$userservice->getFieldName('username')];
85 $copy .= ' - <a href="'. createURL('bookmarks', $currentUsername .'?action=add&address='. urlencode($row['bAddress']) .'&title='. urlencode($row['bTitle'])) .'">'. T_('Copy') .'</a>';
90 if ($GLOBALS['nofollow']) {
91 $rel = ' rel="nofollow"';
94 $address = filter($row['bAddress']);
97 if ($GLOBALS['useredir']) {
98 $address = $GLOBALS['url_redir'] . $address;
102 echo '<li class="xfolkentry'. $access .'">'."\n";
103 echo '<div class="link"><a href="'. $address .'"'. $rel .' class="taggedlink">'. filter($row['bTitle']) ."</a></div>\n";
104 if ($row['bDescription'] != '') {
105 echo '<div class="description">'. filter($row['bDescription']) ."</div>\n";
107 echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."</div>\n";
119 if (isset($_GET['sort'])) {
120 $sortOrder = 'sort='. $_GET['sort'];
123 $sortAmp = (($sortOrder) ? '&'. $sortOrder : '');
124 $sortQue = (($sortOrder) ? '?'. $sortOrder : '');
127 $perpage = getPerPageCount();
128 if (!$page || $page < 2) {
131 $bfirst = '<span class="disable">'. T_('First') .'</span>';
132 $bprev = '<span class="disable">'. T_('Previous') .'</span>';
135 $prev = 'page='. $prev;
136 $start = ($page - 1) * $perpage;
137 $bfirst= '<a href="'. sprintf($nav_url, $user, $currenttag, '') . $sortQue .'">'. T_('First') .'</a>';
138 $bprev = '<a href="'. sprintf($nav_url, $user, $currenttag, '?') . $prev . $sortAmp .'">'. T_('Previous') .'</a>';
143 $totalpages = ceil($total / $perpage);
144 if (count($bookmarks) < $perpage || $perpage * $page == $total) {
145 $bnext = '<span class="disable">'. T_('Next') .'</span>';
146 $blast = '<span class="disable">'. T_('Last') .'</span>';
148 $bnext = '<a href="'. sprintf($nav_url, $user, $currenttag, '?page=') . $next . $sortAmp .'">'. T_('Next') .'</a>';
149 $blast = '<a href="'. sprintf($nav_url, $user, $currenttag, '?page=') . $totalpages . $sortAmp .'">'. T_('Last') .'</a>';
151 echo '<p class="paging">'. $bfirst .'<span> / </span>'. $bprev .'<span> / </span>'. $bnext .'<span> / </span>'. $blast .'<span> / </span>'. sprintf(T_('Page %d of %d'), $page, $totalpages) .'</p>';
155 <p class="error"><?php echo T_('No bookmarks available'); ?>.</p>
159 $this->includeTemplate('sidebar.tpl');
160 $this->includeTemplate($GLOBALS['bottom_include']);