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>
16 <?php if (!isset($hash)): ?>
17 <a href="?sort=url_asc"><?php echo T_("URL"); ?></a>
20 <ol<?php echo ($start > 0 ? ' start="'. ++$start .'"' : ''); ?> id="bookmarks">
23 foreach(array_keys($bookmarks) as $key) {
24 $row =& $bookmarks[$key];
25 switch ($row['bStatus']) {
39 foreach(array_keys($tags) as $key) {
41 $cats .= '<a href="'. sprintf($cat_url, filter($user, 'url'), filter($tag, 'url')) .'" rel="tag">'. filter($tag) .'</a>, ';
43 $cats = substr($cats, 0, -2);
45 $cats = ' to '. $cats;
48 // Edit and delete links
50 if ($bookmarkservice->editAllowed($row['bId'])) {
51 $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>';
56 if (!isset($user) || isset($watched)) {
57 $copy = ' '. T_('by') .' <a href="'. createURL('bookmarks', $row['username']) .'">'. $row['username'] .'</a>';
62 $others = $bookmarkservice->countOthers($row['bAddress']);
63 $ostart = '<a href="'. createURL('history', $row['bHash']) .'">';
69 $copy .= sprintf(T_(' and %s1 other%s'), $ostart, $oend);
72 $copy .= sprintf(T_(' and %2$s%1$s others%3$s'), $others, $ostart, $oend);
77 if ($userservice->isLoggedOn() && ($logged_on_userid != $row['uId'])) {
78 // Get the username of the current user
79 $currentUser = $userservice->getCurrentUser();
80 $currentUsername = $currentUser[$userservice->getFieldName('username')];
81 $copy .= ' - <a href="'. createURL('bookmarks', $currentUsername .'?action=add&address='. urlencode($row['bAddress']) .'&title='. urlencode($row['bTitle'])) .'">'. T_('Copy') .'</a>';
86 if ($GLOBALS['nofollow']) {
87 $rel = ' rel="nofollow"';
90 $address = filter($row['bAddress']);
93 if ($GLOBALS['useredir']) {
94 $address = $GLOBALS['url_redir'] . $address;
98 echo '<li class="xfolkentry'. $access .'">'."\n";
99 echo '<div class="link"><a href="'. $address .'"'. $rel .' class="taggedlink">'. filter($row['bTitle']) ."</a></div>\n";
100 if ($row['bDescription'] != '') {
101 echo '<div class="description">'. filter($row['bDescription']) ."</div>\n";
103 if ($row['bDatetime'] == $row['bModified']) {
104 echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."</div>\n";
106 echo '<div class="meta">updated: '. date($GLOBALS['shortdate'], strtotime($row['bModified'])) . ", original: ". 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']);