From 15b91c7e661d928d8b125ec9cfbda1702319c8b4 Mon Sep 17 00:00:00 2001 From: mensonge Date: Tue, 25 Nov 2008 15:57:29 +0000 Subject: Major refactoring: transform user into object, define parameters used into each file, ... git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@173 b3834d28-1941-0410-a4f8-b48e95affb8f --- history.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'history.php') diff --git a/history.php b/history.php index f7ae927..e66973c 100644 --- a/history.php +++ b/history.php @@ -21,27 +21,34 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA require_once('header.inc.php'); +/* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); $templateservice =& ServiceFactory::getServiceInstance('TemplateService'); $userservice =& ServiceFactory::getServiceInstance('UserService'); $cacheservice =& ServiceFactory::getServiceInstance('CacheService'); +/* Managing all possible inputs */ +isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0); +isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', ''); + $tplVars = array(); @list($url, $hash) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; -$loggedon = false; +$currentObjectUser = $userservice->getCurrentObjectUser(); + +/*$loggedon = false; if ($userservice->isLoggedOn()) { $loggedon = true; $currentUser = $userservice->getCurrentUser(); $currentUsername = $currentUser[$userservice->getFieldName('username')]; -} +}*/ if ($usecache) { // Generate hash for caching on $hashtext = $_SERVER['REQUEST_URI']; if ($userservice->isLoggedOn()) { - $hashtext .= $currentUsername; + $hashtext .= $currentObjectUser->getUsername(); } $cachehash = md5($hashtext); @@ -51,8 +58,8 @@ if ($usecache) { // Pagination $perpage = getPerPageCount(); -if (isset($_GET['page']) && intval($_GET['page']) > 1) { - $page = $_GET['page']; +if (intval(GET_PAGE) > 1) { + $page = GET_PAGE; $start = ($page - 1) * $perpage; } else { $page = 0; @@ -76,6 +83,12 @@ if ($bookmark =& $bookmarkservice->getBookmarkByHash($hash)) { //$tplVars['cat_url'] = createURL('tags', '%2$s'); $tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s'); $tplVars['nav_url'] = createURL('history', $hash .'/%3$s'); + $tplVars['rsschannels'] = array(); + if($userservice->isLoggedOn()) { + $tplVars['user'] = $currentObjectUser->getUsername(); + } else { + $tplVars['user'] = ''; + } $templateservice->loadTemplate('bookmarks.tpl', $tplVars); } else { // Throw a 404 error -- cgit v1.2.3