increased description size to 1000 characters
[scuttle] / index.php
1 <?php
2 /***************************************************************************
3 Copyright (c) 2004 - 2010 Marcus Campbell
4 http://scuttle.org/
5
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.
10
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.
15
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 ***************************************************************************/
20
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');
26
27 $tplvars = array();
28 if (isset($_GET['action']) && 'logout' == $_GET['action']) {
29   $userservice->logout($path);
30   $tplvars['msg'] = T_('You have now logged out');
31 }
32
33 // Header variables
34 $tplVars['loadjs'] = true;
35 $tplVars['rsschannels'] = array(
36     array(sprintf(T_('%s: Recent bookmarks'), $sitename), createURL('rss'))
37 );
38
39 if ($usecache) {
40     // Generate hash for caching on
41     $hashtext = $_SERVER['REQUEST_URI'];
42     if ($userservice->isLoggedOn()) {
43         $hashtext .= $userservice->getCurrentUserID();
44     }
45     $hash = md5($hashtext);
46
47     // Cache for 15 minutes
48     $cacheservice->Start($hash, 900);
49 }
50
51 // Pagination
52 $perpage = getPerPageCount();
53
54 $tplVars['page']     = 0;
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');
67
68 $templateservice->loadTemplate('bookmarks.tpl', $tplVars);
69
70 if ($usecache) {
71     // Cache output if existing copy has expired
72     $cacheservice->End($hash);
73 }

Benjamin Mako Hill || Want to submit a patch?