2 $sf = new ServiceFactory();
3 $userservice =& $sf->getServiceInstance('UserService');
4 $bookmarkservice =& $sf->getServiceInstance('BookmarkService');
6 $logged_on_userid = $userservice->getCurrentUserId();
7 $this->includeTemplate($GLOBALS['top_include']);
10 if (!isset($currenttag)) {
16 if (!isset($userid)) {
20 include 'search.inc.php';
21 if (count($bookmarks) > 0) {
25 <?php echo T_("Sort by:"); ?>
26 <a href="?sort=date_desc"><?php echo T_("Date"); ?></a><span> / </span>
27 <a href="?sort=title_asc"><?php echo T_("Title"); ?></a><span> / </span>
28 <?php if (!isset($hash)): ?>
29 <a href="?sort=url_asc"><?php echo T_("URL"); ?></a>
32 <ol<?php echo ($start > 0 ? ' start="'. ++$start .'"' : ''); ?> id="bookmarks">
35 foreach(array_keys($bookmarks) as $key) {
36 $row =& $bookmarks[$key];
37 switch ($row['bStatus']) {
51 foreach(array_keys($tags) as $key) {
53 $cats .= '<a href="'. sprintf($cat_url, filter($user, 'url'), filter($tag, 'url')) .'" rel="tag">'. filter($tag) .'</a>, ';
55 $cats = substr($cats, 0, -2);
57 $cats = ' to '. $cats;
60 // Edit and delete links
62 if ($bookmarkservice->editAllowed($row['bId'])) {
63 $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>';
68 if (!isset($user) || isset($watched)) {
69 $copy = ' '. T_('by') .' <a href="'. createURL('bookmarks', $row['username']) .'">'. $row['username'] .'</a>';
74 $others = $bookmarkservice->countOthers($row['bAddress']);
75 $ostart = '<a href="'. createURL('history', $row['bHash']) .'">';
81 $copy .= sprintf(T_(' and %s1 other%s'), $ostart, $oend);
84 $copy .= sprintf(T_(' and %2$s%1$s others%3$s'), $others, $ostart, $oend);
89 if ($userservice->isLoggedOn() && ($logged_on_userid != $row['uId'])) {
90 // Get the username of the current user
91 $currentUser = $userservice->getCurrentUser();
92 $currentUsername = $currentUser[$userservice->getFieldName('username')];
93 $copy .= ' - <a href="'. createURL('bookmarks', $currentUsername .'?action=add&address='. urlencode($row['bAddress']) .'&title='. urlencode($row['bTitle'])) .'">'. T_('Copy') .'</a>';
98 if ($GLOBALS['nofollow']) {
99 $rel = ' rel="nofollow"';
102 $address = filter($row['bAddress']);
104 // Internet Archive WayBack Links
106 if ($GLOBALS["archive_links"]) {
107 $archive_link = ' - <a href="' . $GLOBALS['archive_base_url'] . "/" . date("YmdHis", strtotime($row['bDatetime'])) . "/" . $address . '">' . T_('Archived Link') . '</a>';
110 // Redirection option
111 if ($GLOBALS['useredir']) {
112 $address = $GLOBALS['url_redir'] . $address;
116 echo '<li class="xfolkentry'. $access .'">'."\n";
117 echo '<div class="link"><a href="'. $address .'"'. $rel .' class="taggedlink">'. filter($row['bTitle']) ."</a></div>\n";
118 if ($row['bDescription'] != '') {
119 echo '<div class="description">'. filter($row['bDescription']) ."</div>\n";
121 if ($row['bDatetime'] == $row['bModified']) {
122 echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit . $archive_link ."</div>\n";
124 echo '<div class="meta"><span id="date-updated">updated: '. date($GLOBALS['shortdate'], strtotime($row['bModified'])) . '</span>, <span id="date-original">original: '. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . "</span>" . $cats . $copy . $edit . $archive_link ."</div>\n";
137 if (isset($_GET['sort'])) {
138 $sortOrder = 'sort='. $_GET['sort'];
141 $sortAmp = (($sortOrder) ? '&'. $sortOrder : '');
142 $sortQue = (($sortOrder) ? '?'. $sortOrder : '');
145 $perpage = getPerPageCount();
146 if (!$page || $page < 2) {
149 $bfirst = '<span class="disable">'. T_('First') .'</span>';
150 $bprev = '<span class="disable">'. T_('Previous') .'</span>';
153 $prev = 'page='. $prev;
154 $start = ($page - 1) * $perpage;
155 $bfirst= '<a href="'. sprintf($nav_url, $user, $currenttag, '') . $sortQue .'">'. T_('First') .'</a>';
156 $bprev = '<a href="'. sprintf($nav_url, $user, $currenttag, '?') . $prev . $sortAmp .'">'. T_('Previous') .'</a>';
161 $totalpages = ceil($total / $perpage);
162 if (count($bookmarks) < $perpage || $perpage * $page == $total) {
163 $bnext = '<span class="disable">'. T_('Next') .'</span>';
164 $blast = '<span class="disable">'. T_('Last') .'</span>';
166 $bnext = '<a href="'. sprintf($nav_url, $user, $currenttag, '?page=') . $next . $sortAmp .'">'. T_('Next') .'</a>';
167 $blast = '<a href="'. sprintf($nav_url, $user, $currenttag, '?page=') . $totalpages . $sortAmp .'">'. T_('Last') .'</a>';
169 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>';
173 <p class="error"><?php echo T_('No bookmarks available'); ?>.</p>
177 $this->includeTemplate('sidebar.tpl');
178 $this->includeTemplate($GLOBALS['bottom_include']);