source: trunk/bookmarks/tags.php @ 103

Revision 103, 2.8 KB checked in by admin, 4 years ago (diff)

Merged 1.003 into Trunk

Line 
1<?php
2/*
3       
4        This file is part of omCollab.
5       
6        Copyright (c) 2008 omCollab (Openmethodology Project)
7        http://www.openmethodology.org
8        http://mike2.openmethodology.org/wiki/OmCollab
9       
10        And parts copyright of Scuttle project
11        (http://sourceforge.net/projects/scuttle/, http://scuttle.org/)
12       
13        omCollab is free software: you can redistribute it and/or modify
14        it under the terms of the GNU General Public License as published by
15        the Free Software Foundation, either version 3 of the License, or
16        (at your option) any later version.
17       
18        omCollab is distributed in the hope that it will be useful,
19        but WITHOUT ANY WARRANTY; without even the implied warranty of
20        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21        GNU General Public License for more details.
22
23*/
24
25require_once('header.inc.php');
26
27$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
28$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
29$userservice =& ServiceFactory::getServiceInstance('UserService');
30$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
31
32$tplVars = array();
33
34list($url, $cat) = explode('/', $_SERVER['PATH_INFO']);
35if (!$cat) {
36    header('Location: '. createURL('populartags'));
37    exit;
38} else {
39    $cattitle = str_replace('+', ' + ', $cat);
40}
41$pagetitle = T_('Tags') .': '. $cattitle;
42
43if ($usecache) {
44    // Generate hash for caching on
45    if ($userservice->isLoggedOn()) {
46        $hash = md5($_SERVER['REQUEST_URI'] . $userservice->getCurrentUserID());
47    } else {
48        $hash = md5($_SERVER['REQUEST_URI']);
49    }
50
51    // Cache for 30 minutes
52    $cacheservice->Start($hash, 1800);
53}
54
55// Header variables
56$tplVars['pagetitle'] = $pagetitle;
57$tplVars['loadjs'] = true;
58$tplVars['bLoadJqueryPhp'] = true;
59$tplVars['rsschannels'] = array(
60    array(filter($sitename .': '. $pagetitle), createURL('rss', 'all/'. filter($cat, 'url')))
61);
62
63// Pagination
64$perpage = getPerPageCount();
65if (isset($_GET['page']) && intval($_GET['page']) > 1) {
66    $page = $_GET['page'];
67    $start = ($page - 1) * $perpage;
68} else {
69    $page = 0;
70    $start = 0;
71}
72
73$tplVars['page'] = $page;
74$tplVars['start'] = $start;
75$tplVars['popCount'] = 25;
76$tplVars['currenttag'] = $cat;
77$tplVars['sidebar_blocks'] = array('profile', 'related', 'popular' );
78$tplVars['subtitle'] = filter($pagetitle);
79$tplVars['bookmarkCount'] = $start + 1;
80$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, NULL, $cat, NULL, getSortOrder());
81$tplVars['total'] = $bookmarks['total'];
82$tplVars['bookmarks'] =& $bookmarks['bookmarks'];
83$tplVars['cat_url'] = createURL('tags', '%2$s');
84$tplVars['nav_url'] = createURL('tags', '%2$s%3$s');
85
86$templateservice->loadTemplate('bookmarks.tpl', $tplVars);
87
88if ($usecache) {
89    // Cache output if existing copy has expired
90    $cacheservice->End($hash);
91}
92?>
Note: See TracBrowser for help on using the repository browser.