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) {
12 <script type="text/javascript">
13 window.onload = playerLoad;
17 <?php echo T_("Sort by:"); ?>
18 <a href="?sort=date_desc"><?php echo T_("Date"); ?></a><span> / </span>
19 <a href="?sort=title_asc"><?php echo T_("Title"); ?></a><span> / </span>
23 <a href="?sort=url_asc"><?php echo T_("URL"); ?></a>
29 <ol<?php echo ($start > 0 ? ' start="'. ++$start .'"' : ''); ?> id="bookmarks">
32 foreach(array_keys($bookmarks) as $key) {
33 $row =& $bookmarks[$key];
34 switch ($row['bStatus']) {
48 foreach(array_keys($tags) as $key) {
50 $cats .= '<a href="'. sprintf($cat_url, filter($user, 'url'), filter($tag, 'url')) .'" rel="tag">'. filter($tag) .'</a>, ';
52 $cats = substr($cats, 0, -2);
54 $cats = ' to '. $cats;
57 // Edit and delete links
59 if ($bookmarkservice->editAllowed($row['bId'])) {
60 $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>';
65 if (!isset($user) || isset($watched)) {
66 $copy = ' '. T_('by') .' <a href="'. createURL('bookmarks', $row['username']) .'">'. $row['username'] .'</a>';
71 $others = $bookmarkservice->countOthers($row['bAddress']);
72 $ostart = '<a href="'. createURL('history', $row['bHash']) .'">';
78 $copy .= sprintf(T_(' and %s1 other%s'), $ostart, $oend);
81 $copy .= sprintf(T_(' and %2$s%1$s others%3$s'), $others, $ostart, $oend);
86 if ($userservice->isLoggedOn() && ($logged_on_userid != $row['uId'])) {
87 // Get the username of the current user
88 $currentUser = $userservice->getCurrentUser();
89 $currentUsername = $currentUser[$userservice->getFieldName('username')];
90 $copy .= ' - <a href="'. createURL('bookmarks', $currentUsername .'?action=add&address='. urlencode($row['bAddress']) .'&title='. urlencode($row['bTitle'])) .'">'. T_('Copy') .'</a>';
95 if ($GLOBALS['nofollow']) {
96 $rel = ' rel="nofollow"';
99 $address = filter($row['bAddress']);
101 // Redirection option
102 if ($GLOBALS['useredir']) {
103 $address = $GLOBALS['url_redir'] . $address;
107 echo '<li class="xfolkentry'. $access .'">'."\n";
108 echo '<div class="link"><a href="'. $address .'"'. $rel .' class="taggedlink">'. filter($row['bTitle']) ."</a></div>\n";
109 if ($row['bDescription'] != '') {
110 echo '<div class="description">'. filter($row['bDescription']) ."</div>\n";
112 echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."</div>\n";
124 if (isset($_GET['sort'])) {
125 $sortOrder = 'sort='. $_GET['sort'];
128 $sortAmp = (($sortOrder) ? '&'. $sortOrder : '');
129 $sortQue = (($sortOrder) ? '?'. $sortOrder : '');
132 $perpage = getPerPageCount();
133 if (!$page || $page < 2) {
136 $bfirst = '<span class="disable">'. T_('First') .'</span>';
137 $bprev = '<span class="disable">'. T_('Previous') .'</span>';
140 $prev = 'page='. $prev;
141 $start = ($page - 1) * $perpage;
142 $bfirst= '<a href="'. sprintf($nav_url, $user, $currenttag, '') . $sortQue .'">'. T_('First') .'</a>';
143 $bprev = '<a href="'. sprintf($nav_url, $user, $currenttag, '?') . $prev . $sortAmp .'">'. T_('Previous') .'</a>';
148 $totalpages = ceil($total / $perpage);
149 if (count($bookmarks) < $perpage || $perpage * $page == $total) {
150 $bnext = '<span class="disable">'. T_('Next') .'</span>';
151 $blast = '<span class="disable">'. T_('Last') .'</span>';
153 $bnext = '<a href="'. sprintf($nav_url, $user, $currenttag, '?page=') . $next . $sortAmp .'">'. T_('Next') .'</a>';
154 $blast = '<a href="'. sprintf($nav_url, $user, $currenttag, '?page=') . $totalpages . $sortAmp .'">'. T_('Last') .'</a>';
156 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>';
160 <p class="error"><?php echo T_('No bookmarks available'); ?>.</p>
164 $this->includeTemplate('sidebar.tpl');
165 $this->includeTemplate($GLOBALS['bottom_include']);