2 /***************************************************************************
3 Copyright (c) 2004 - 2010 Marcus Campbell
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ***************************************************************************/
21 require_once 'header.inc.php';
22 $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
23 $templateservice =& ServiceFactory::getServiceInstance('TemplateService');
24 $userservice =& ServiceFactory::getServiceInstance('UserService');
25 $cacheservice =& ServiceFactory::getServiceInstance('CacheService');
28 if (isset($_GET['action']) && 'logout' == $_GET['action']) {
29 $userservice->logout($path);
30 $tplvars['msg'] = T_('You have now logged out');
34 $tplVars['loadjs'] = true;
35 $tplVars['rsschannels'] = array(
36 array(sprintf(T_('%s: Recent bookmarks'), $sitename), createURL('rss'))
40 // Generate hash for caching on
41 $hashtext = $_SERVER['REQUEST_URI'];
42 if ($userservice->isLoggedOn()) {
43 $hashtext .= $userservice->getCurrentUserID();
45 $hash = md5($hashtext);
47 // Cache for 15 minutes
48 $cacheservice->Start($hash, 900);
52 $perpage = getPerPageCount();
55 $tplVars['start'] = 0;
56 $tplVars['popCount'] = 30;
57 $tplVars['sidebar_blocks'] = array('recent');
58 $tplVars['range'] = 'all';
59 $tplVars['pagetitle'] = T_('Store, share and tag your favourite links');
60 $tplVars['subtitle'] = T_('Recent Bookmarks');
61 $tplVars['bookmarkCount'] = 1;
62 $bookmarks =& $bookmarkservice->getBookmarks(0, $perpage, NULL, NULL, NULL, getSortOrder(), NULL);
63 $tplVars['total'] = $bookmarks['total'];
64 $tplVars['bookmarks'] =& $bookmarks['bookmarks'];
65 $tplVars['cat_url'] = createURL('tags', '%2$s');
66 $tplVars['nav_url'] = createURL('index', '%3$s');
68 $templateservice->loadTemplate('bookmarks.tpl', $tplVars);
71 // Cache output if existing copy has expired
72 $cacheservice->End($hash);