2007-12-12 16:29:16 +00:00
|
|
|
<?php
|
|
|
|
/***************************************************************************
|
2008-11-25 15:57:29 +00:00
|
|
|
Copyright (C) 2004 - 2006 Scuttle project
|
|
|
|
http://sourceforge.net/projects/scuttle/
|
|
|
|
http://scuttle.org/
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2008-11-25 15:57:29 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2008-11-25 15:57:29 +00:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2008-11-25 15:57:29 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
***************************************************************************/
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2009-10-03 21:52:30 +00:00
|
|
|
require_once '../src/SemanticScuttle/header.php';
|
2008-11-25 15:57:29 +00:00
|
|
|
|
|
|
|
/* Service creation: only useful services are created */
|
2009-10-23 17:13:16 +00:00
|
|
|
$bookmarkservice =SemanticScuttle_Service_Factory::get('Bookmark');
|
|
|
|
$cacheservice =SemanticScuttle_Service_Factory::get('Cache');
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2008-11-25 15:57:29 +00:00
|
|
|
|
2007-12-12 16:29:16 +00:00
|
|
|
header('Content-Type: application/xml');
|
2008-11-25 15:57:29 +00:00
|
|
|
if(isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) >1) {
|
|
|
|
list($url, $user, $cat) = explode('/', $_SERVER['PATH_INFO']);
|
|
|
|
} else {
|
|
|
|
$url = '';
|
|
|
|
$user = '';
|
|
|
|
$cat = NULL;
|
|
|
|
}
|
2007-12-12 16:29:16 +00:00
|
|
|
|
|
|
|
if ($usecache) {
|
2008-11-25 15:57:29 +00:00
|
|
|
// Generate hash for caching on
|
|
|
|
$hashtext = $_SERVER['REQUEST_URI'];
|
|
|
|
if ($userservice->isLoggedOn()) {
|
|
|
|
$hashtext .= $userservice->getCurrentUserID();
|
2008-12-05 07:25:04 +00:00
|
|
|
if ($currentUser->getUsername() == $user) {
|
2008-11-25 15:57:29 +00:00
|
|
|
$hashtext .= $user;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$hash = md5($hashtext);
|
|
|
|
|
|
|
|
// Cache for an hour
|
|
|
|
$cacheservice->Start($hash, 3600);
|
2007-12-12 16:29:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$watchlist = null;
|
2008-11-25 15:57:29 +00:00
|
|
|
$pagetitle = '';
|
2007-12-12 16:29:16 +00:00
|
|
|
if ($user && $user != 'all') {
|
2008-11-25 15:57:29 +00:00
|
|
|
if ($user == 'watchlist') {
|
|
|
|
$user = $cat;
|
|
|
|
$cat = null;
|
|
|
|
$watchlist = true;
|
|
|
|
}
|
|
|
|
if (is_int($user)) {
|
|
|
|
$userid = intval($user);
|
|
|
|
} else {
|
|
|
|
if ($userinfo = $userservice->getUserByUsername($user)) {
|
|
|
|
$userid =& $userinfo[$userservice->getFieldName('primary')];
|
|
|
|
} else {
|
|
|
|
$tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
|
|
|
|
$templateservice->loadTemplate('error.404.tpl', $tplVars);
|
|
|
|
//throw a 404 error
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$pagetitle .= ": ". $user;
|
2007-12-12 16:29:16 +00:00
|
|
|
} else {
|
2008-11-25 15:57:29 +00:00
|
|
|
$userid = NULL;
|
2007-12-12 16:29:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($cat) {
|
2008-11-25 15:57:29 +00:00
|
|
|
$pagetitle .= ": ". str_replace('+', ' + ', $cat);
|
2007-12-12 16:29:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$tplVars['feedtitle'] = filter($GLOBALS['sitename'] . (isset($pagetitle) ? $pagetitle : ''));
|
2008-11-21 10:44:28 +00:00
|
|
|
$tplVars['feedlink'] = ROOT;
|
2007-12-12 16:29:16 +00:00
|
|
|
$tplVars['feeddescription'] = sprintf(T_('Recent bookmarks posted to %s'), $GLOBALS['sitename']);
|
|
|
|
|
|
|
|
$bookmarks =& $bookmarkservice->getBookmarks(0, 15, $userid, $cat, NULL, getSortOrder(), $watchlist);
|
2008-11-25 15:57:29 +00:00
|
|
|
|
2007-12-12 16:29:16 +00:00
|
|
|
$bookmarks_tmp =& filter($bookmarks['bookmarks']);
|
|
|
|
|
|
|
|
$bookmarks_tpl = array();
|
|
|
|
foreach(array_keys($bookmarks_tmp) as $key) {
|
2008-11-25 15:57:29 +00:00
|
|
|
$row =& $bookmarks_tmp[$key];
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2008-11-25 15:57:29 +00:00
|
|
|
$_link = $row['bAddress'];
|
|
|
|
// Redirection option
|
|
|
|
if ($GLOBALS['useredir']) {
|
|
|
|
$_link = $GLOBALS['url_redir'] . $_link;
|
|
|
|
}
|
|
|
|
$_pubdate = gmdate("r", strtotime($row['bDatetime']));
|
|
|
|
// array_walk($row['tags'], 'filter');
|
2007-12-12 16:29:16 +00:00
|
|
|
|
2008-11-25 15:57:29 +00:00
|
|
|
$bookmarks_tpl[] = array(
|
2007-12-12 16:29:16 +00:00
|
|
|
'title' => $row['bTitle'],
|
|
|
|
'link' => $_link,
|
|
|
|
'description' => $row['bDescription'],
|
|
|
|
'creator' => $row['username'],
|
|
|
|
'pubdate' => $_pubdate,
|
|
|
|
'tags' => $row['tags']
|
2008-11-25 15:57:29 +00:00
|
|
|
);
|
2007-12-12 16:29:16 +00:00
|
|
|
}
|
|
|
|
unset($bookmarks_tmp);
|
|
|
|
unset($bookmarks);
|
|
|
|
$tplVars['bookmarks'] =& $bookmarks_tpl;
|
|
|
|
|
|
|
|
$templateservice->loadTemplate('rss.tpl', $tplVars);
|
|
|
|
|
|
|
|
if ($usecache) {
|
2008-11-25 15:57:29 +00:00
|
|
|
// Cache output if existing copy has expired
|
|
|
|
$cacheservice->End($hash);
|
2007-12-12 16:29:16 +00:00
|
|
|
}
|
|
|
|
?>
|