From d6889066c0d285bf59e89b484800443304585b68 Mon Sep 17 00:00:00 2001 From: mensonge Date: Fri, 5 Dec 2008 07:25:04 +0000 Subject: [PATCH] Major Refactoring: finish transforming into object . Put and into header.inc.php. git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@199 b3834d28-1941-0410-a4f8-b48e95affb8f --- about.php | 5 +-- admin.php | 5 --- ajax/getlinkedtags.php | 1 - ajax/gettags.php | 11 +---- ajaxIsAvailable.php | 2 +- alltags.php | 3 -- api/export_gcs.php | 5 +-- api/export_html.php | 8 ++-- api/httpauth.inc.php | 44 +++++++++---------- api/posts_add.php | 2 +- api/posts_all.php | 8 ++-- api/posts_dates.php | 8 ++-- api/posts_delete.php | 3 +- api/posts_get.php | 7 ++- api/posts_recent.php | 7 ++- api/posts_update.php | 5 +-- api/tags_get.php | 3 +- api/tags_rename.php | 2 +- bookmarkcommondescriptionedit.php | 9 +--- bookmarks.php | 15 ++----- edit.php | 9 +--- gsearch/index.php | 2 - header.inc.php | 10 ++++- history.php | 15 +------ import.php | 7 +-- importNetscape.php | 4 -- importStructure.php | 4 -- index.php | 3 -- login.php | 6 +-- password.php | 6 +-- populartags.php | 10 +---- profile.php | 15 ++----- register.php | 5 +-- rss.php | 8 +--- search.php | 3 -- tag2tagadd.php | 12 ++--- tag2tagdelete.php | 2 - tag2tagedit.php | 9 +--- tagcommondescriptionedit.php | 2 - tagdelete.php | 3 +- tagedit.php | 2 - tagrename.php | 2 - tags.php | 4 -- templates/about.tpl.php | 8 ---- templates/admin.tpl.php | 7 +-- .../bookmarkcommondescriptionedit.tpl.php | 3 -- templates/bookmarks.tpl.php | 11 ++--- templates/dynamictags.inc.php | 2 +- templates/profile.tpl.php | 1 - templates/sidebar.block.linked.php | 2 +- templates/sidebar.block.menu.php | 3 +- templates/sidebar.block.menu2.php | 2 +- templates/sidebar.block.popular.php | 3 +- templates/sidebar.block.profile.php | 23 ---------- templates/sidebar.block.recent.php | 2 +- templates/sidebar.block.related.php | 3 +- templates/sidebar.block.search.php | 2 +- templates/sidebar.block.tagactions.php | 7 ++- templates/sidebar.block.users.php | 3 +- templates/sidebar.block.watchlist.php | 3 +- templates/sidebar.block.watchstatus.php | 11 ++--- templates/tagcommondescriptionedit.tpl.php | 2 +- templates/tagedit.tpl.php | 1 - templates/toolbar.inc.php | 8 +--- upgrade.php | 1 - users.php | 3 -- watch.php | 3 +- watchlist.php | 3 -- 68 files changed, 119 insertions(+), 294 deletions(-) delete mode 100644 templates/sidebar.block.profile.php diff --git a/about.php b/about.php index b8d2fd9..ceecf4b 100644 --- a/about.php +++ b/about.php @@ -20,10 +20,7 @@ require_once('header.inc.php'); -/* Service creation: only useful services are created */ -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); - -$tplVars = array(); $tplVars['subtitle'] = T_('About'); + $templateservice->loadTemplate('about.tpl', $tplVars); ?> \ No newline at end of file diff --git a/admin.php b/admin.php index fa2c3db..e34b7dc 100644 --- a/admin.php +++ b/admin.php @@ -20,14 +20,9 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ -$userservice = & ServiceFactory :: getServiceInstance('UserService'); $bookmark2tagservice = & ServiceFactory :: getServiceInstance('Bookmark2Tagservice'); $bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService'); $tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService'); -$templateservice = & ServiceFactory :: getServiceInstance('TemplateService'); - -/* Managing current logged user */ -$currentUser = $userservice->getCurrentObjectUser(); // Header variables $tplVars['subtitle'] = T_('Manage users'); diff --git a/ajax/getlinkedtags.php b/ajax/getlinkedtags.php index feb70ae..24d00fc 100644 --- a/ajax/getlinkedtags.php +++ b/ajax/getlinkedtags.php @@ -26,7 +26,6 @@ require_once('../header.inc.php'); /* Service creation: only useful services are created */ $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); $bookmarkservice =& ServiceFactory::getServiceInstance('TagService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); $tagstatservice =& ServiceFactory::getServiceInstance('TagStatService'); /* Managing all possible inputs */ diff --git a/ajax/gettags.php b/ajax/gettags.php index 167c63d..7b8b33a 100644 --- a/ajax/gettags.php +++ b/ajax/gettags.php @@ -23,23 +23,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA require_once('../header.inc.php'); +/* Service creation: only useful services are created */ $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); $bookmarkservice =& ServiceFactory::getServiceInstance('TagService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); - -if ($userservice->isLoggedOn()) { - $loggedon = true; - $currentUser = $userservice->getCurrentUser(); - $currentUserID = $userservice->getCurrentUserId(); - $currentUsername = $currentUser[$userservice->getFieldName('username')]; -} ?> {identifier:"tag", items: [ getPopularTags($currentUserID, 1000, $currentUserID); + $listTags = $b2tservice->getPopularTags($userservice->getCurrentUserId(), 1000, $userservice->getCurrentUserId()); foreach($listTags as $t) { echo "{tag: \"".$t['tag']."\"},"; } diff --git a/ajaxIsAvailable.php b/ajaxIsAvailable.php index e9d82e7..ffd4379 100644 --- a/ajaxIsAvailable.php +++ b/ajaxIsAvailable.php @@ -26,7 +26,7 @@ header("Cache-Control: no-cache, must-revalidate"); require_once('header.inc.php'); /* Service creation: only useful services are created */ -$userservice = & ServiceFactory :: getServiceInstance('UserService'); +//No specific services /* Managing all possible inputs */ isset($_GET['username']) ? define('GET_USERNAME', $_GET['username']): define('GET_USERNAME', ''); diff --git a/alltags.php b/alltags.php index 61ad345..c37922d 100644 --- a/alltags.php +++ b/alltags.php @@ -22,9 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA require_once('header.inc.php'); /* Service creation: only useful services are created */ -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); $cacheservice =& ServiceFactory::getServiceInstance('CacheService'); @@ -48,7 +46,6 @@ if ($usecache) { } // Header variables -$tplvars = array(); $pagetitle = T_('All Tags'); if (isset($user) && $user != '') { diff --git a/api/export_gcs.php b/api/export_gcs.php index 1040dd4..6f1f4c2 100644 --- a/api/export_gcs.php +++ b/api/export_gcs.php @@ -12,8 +12,9 @@ if($GLOBALS['enableGoogleCustomSearch'] == false) { die; } +/* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); + /* // Restrict to admins? @@ -36,8 +37,6 @@ $tag = NULL; // Get the posts relevant to the passed-in variables. $bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag, NULL, getSortOrder()); -$currentuser = $userservice->getCurrentUser(); -$currentusername = $currentuser[$userservice->getFieldName('username')]; // Set up the plain file and output all the posts. header('Content-Type: text/plain'); diff --git a/api/export_html.php b/api/export_html.php index b422b4b..79ade0a 100644 --- a/api/export_html.php +++ b/api/export_html.php @@ -7,9 +7,9 @@ // Force HTTP authentication first! require_once('httpauth.inc.php'); require_once('../header.inc.php'); - + +/* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); // Check to see if a tag was specified. if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) @@ -20,8 +20,6 @@ else // Get the posts relevant to the passed-in variables. $bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder()); -$currentuser = $userservice->getCurrentUser(); -$currentusername = $currentuser[$userservice->getFieldName('username')]; // Set up the XML file and output all the posts. header('Content-Type: text/html'); @@ -29,7 +27,7 @@ echo ''."\r\n"; echo ''; echo ''."\r\n"; echo 'Bookmarks'."\r\n"; -echo '

Bookmarks for '. htmlspecialchars($currentusername) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."

\r\n"; +echo '

Bookmarks for '. htmlspecialchars($currentUser->getUsername()) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."

\r\n"; echo '

'."\r\n"; diff --git a/api/httpauth.inc.php b/api/httpauth.inc.php index d0198fd..5dd7444 100644 --- a/api/httpauth.inc.php +++ b/api/httpauth.inc.php @@ -1,37 +1,33 @@ isLoggedOn()) { - /* Maybe we have caught authentication data in $_SERVER['REMOTE_USER'] - ( Inspired by http://www.yetanothercommunitysystem.com/article-321-regle-comment-utiliser-l-authentification-http-en-php-chez-ovh ) */ - if((!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) - && preg_match('/Basic\s+(.*)$/i', $_SERVER['REMOTE_USER'], $matches)) { - list($name, $password) = explode(':', base64_decode($matches[1])); - $_SERVER['PHP_AUTH_USER'] = strip_tags($name); - $_SERVER['PHP_AUTH_PW'] = strip_tags($password); - } - - if (!isset($_SERVER['PHP_AUTH_USER'])) { - authenticate(); - } else { - require_once('../header.inc.php'); - $userservice =& ServiceFactory::getServiceInstance('UserService'); - - $login = $userservice->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); - if (!$login) { - authenticate(); + /* Maybe we have caught authentication data in $_SERVER['REMOTE_USER'] + ( Inspired by http://www.yetanothercommunitysystem.com/article-321-regle-comment-utiliser-l-authentification-http-en-php-chez-ovh ) */ + if((!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) + && preg_match('/Basic\s+(.*)$/i', $_SERVER['REMOTE_USER'], $matches)) { + list($name, $password) = explode(':', base64_decode($matches[1])); + $_SERVER['PHP_AUTH_USER'] = strip_tags($name); + $_SERVER['PHP_AUTH_PW'] = strip_tags($password); + } + + if (!isset($_SERVER['PHP_AUTH_USER'])) { + authenticate(); + } else { + $login = $userservice->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); + if (!$login) { + authenticate(); + } } - } } ?> diff --git a/api/posts_add.php b/api/posts_add.php index 77c3288..e27fc99 100644 --- a/api/posts_add.php +++ b/api/posts_add.php @@ -13,8 +13,8 @@ require_once('httpauth.inc.php'); require_once('../header.inc.php'); +/* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); // Get all the bookmark's passed-in information if (isset($_REQUEST['url']) && (trim($_REQUEST['url']) != '')) diff --git a/api/posts_all.php b/api/posts_all.php index 03026c4..4ecbd7e 100644 --- a/api/posts_all.php +++ b/api/posts_all.php @@ -8,8 +8,9 @@ require_once('httpauth.inc.php'); require_once('../header.inc.php'); +/* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); + // Check to see if a tag was specified. if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) @@ -20,13 +21,10 @@ else // Get the posts relevant to the passed-in variables. $bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag); -$currentuser = $userservice->getCurrentUser(); -$currentusername = $currentuser[$userservice->getFieldName('username')]; - // Set up the XML file and output all the posts. header('Content-Type: text/xml'); echo '\r\n"; -echo '\r\n"; +echo '\r\n"; foreach($bookmarks['bookmarks'] as $row) { if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) diff --git a/api/posts_dates.php b/api/posts_dates.php index 7098756..d4962ff 100644 --- a/api/posts_dates.php +++ b/api/posts_dates.php @@ -6,8 +6,9 @@ require_once('httpauth.inc.php'); require_once('../header.inc.php'); +/* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); + // Check to see if a tag was specified. if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) @@ -18,13 +19,10 @@ else // Get the posts relevant to the passed-in variables. $bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag); -$currentuser = $userservice->getCurrentUser(); -$currentusername = $currentuser[$userservice->getFieldName('username')]; - // Set up the XML file and output all the tags. header('Content-Type: text/xml'); echo '\r\n"; -echo '\r\n"; +echo '\r\n"; $lastdate = NULL; foreach($bookmarks['bookmarks'] as $row) { diff --git a/api/posts_delete.php b/api/posts_delete.php index 737a4fb..d24ba59 100644 --- a/api/posts_delete.php +++ b/api/posts_delete.php @@ -10,8 +10,9 @@ require_once('httpauth.inc.php'); require_once('../header.inc.php'); +/* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); + // Note that del.icio.us only errors out if no URL was passed in; there's no error on attempting // to delete a bookmark you don't have. diff --git a/api/posts_get.php b/api/posts_get.php index 8be067b..34d192e 100644 --- a/api/posts_get.php +++ b/api/posts_get.php @@ -13,8 +13,9 @@ require_once('httpauth.inc.php'); require_once('../header.inc.php'); +/* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); + // Check to see if a tag was specified. if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) @@ -32,13 +33,11 @@ $dtend = date('Y-m-d H:i:s', strtotime($dtstart .'+1 day')); // Get the posts relevant to the passed-in variables. $bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, NULL, NULL, $dtstart, $dtend); -$currentuser = $userservice->getCurrentUser(); -$currentusername = $currentuser[$userservice->getFieldName('username')]; // Set up the XML file and output all the tags. header('Content-Type: text/xml'); echo '\r\n"; -echo '\r\n"; +echo '\r\n"; foreach($bookmarks['bookmarks'] as $row) { if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) diff --git a/api/posts_recent.php b/api/posts_recent.php index 22fc2bd..daa9d39 100644 --- a/api/posts_recent.php +++ b/api/posts_recent.php @@ -10,8 +10,9 @@ $countMax = 100; require_once('httpauth.inc.php'); require_once('../header.inc.php'); +/* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); + // Check to see if a tag was specified. if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) @@ -33,13 +34,11 @@ if (isset($_REQUEST['count']) && (intval($_REQUEST['count']) != 0)) { // Get the posts relevant to the passed-in variables. $bookmarks =& $bookmarkservice->getBookmarks(0, $count, $userservice->getCurrentUserId(), $tag); -$currentuser = $userservice->getCurrentUser(); -$currentusername = $currentuser[$userservice->getFieldName('username')]; // Set up the XML file and output all the tags. header('Content-Type: text/xml'); echo '\r\n"; -echo '\r\n"; +echo '\r\n"; foreach($bookmarks['bookmarks'] as $row) { if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) diff --git a/api/posts_update.php b/api/posts_update.php index de379d2..6ea50e2 100644 --- a/api/posts_update.php +++ b/api/posts_update.php @@ -8,14 +8,13 @@ require_once('httpauth.inc.php'); require_once('../header.inc.php'); +/* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); + // Get the posts relevant to the passed-in variables. $bookmarks =& $bookmarkservice->getBookmarks(0, 1, $userservice->getCurrentUserId()); -$currentuser = $userservice->getCurrentUser(); -$currentusername = $currentuser[$userservice->getFieldName('username')]; // Set up the XML file and output all the tags. header('Content-Type: text/xml'); diff --git a/api/tags_get.php b/api/tags_get.php index 172dd0a..cee36ee 100644 --- a/api/tags_get.php +++ b/api/tags_get.php @@ -8,8 +8,9 @@ require_once('httpauth.inc.php'); require_once('../header.inc.php'); +/* Service creation: only useful services are created */ $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); + // Get the tags relevant to the passed-in variables. $tags =& $b2tservice->getTags($userservice->getCurrentUserId()); diff --git a/api/tags_rename.php b/api/tags_rename.php index fc4f2ad..dd16339 100644 --- a/api/tags_rename.php +++ b/api/tags_rename.php @@ -8,8 +8,8 @@ require_once('httpauth.inc.php'); require_once('../header.inc.php'); +/* Service creation: only useful services are created */ $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); // Get the tag info. if (isset($_REQUEST['old']) && (trim($_REQUEST['old']) != '')) diff --git a/bookmarkcommondescriptionedit.php b/bookmarkcommondescriptionedit.php index ec7aee2..ac1890e 100644 --- a/bookmarkcommondescriptionedit.php +++ b/bookmarkcommondescriptionedit.php @@ -23,8 +23,6 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ $bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService'); -$templateservice = & ServiceFactory :: getServiceInstance('TemplateService'); -$userservice = & ServiceFactory :: getServiceInstance('UserService'); $cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService'); /* Managing all possible inputs */ @@ -47,11 +45,9 @@ if(!isset($_POST['referrer'])) { list ($url, $hash) = explode('/', $_SERVER['PATH_INFO']); $template = 'bookmarkcommondescriptionedit.tpl'; -//$logged_on_user = $userservice->getCurrentUser(); -$currentObjectUser = $userservice->getCurrentObjectUser(); //permissions -if(is_null($currentObjectUser)) { +if(is_null($currentUser)) { $tplVars['error'] = T_('Permission denied.'); $templateservice->loadTemplate('error.500.tpl', $tplVars); exit(); @@ -59,7 +55,7 @@ if(is_null($currentObjectUser)) { if (POST_CONFIRM) { if (strlen($hash)>0 && - $cdservice->addBookmarkDescription(POST_HASH, stripslashes(POST_TITLE), stripslashes(POST_DESCRIPTION), $currentObjectUser->getId(), time()) + $cdservice->addBookmarkDescription(POST_HASH, stripslashes(POST_TITLE), stripslashes(POST_DESCRIPTION), $currentUser->getId(), time()) ) { $tplVars['msg'] = T_('Bookmark common description updated'); header('Location: '. POST_REFERRER); @@ -68,7 +64,6 @@ if (POST_CONFIRM) { $template = 'error.500.tpl'; } } elseif (POST_CANCEL) { - $logged_on_user = $userservice->getCurrentUser(); header('Location: '. POST_REFERRER); } else { $bkm = $bookmarkservice->getBookmarkByHash($hash); diff --git a/bookmarks.php b/bookmarks.php index f222202..3a948ef 100644 --- a/bookmarks.php +++ b/bookmarks.php @@ -23,12 +23,8 @@ 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'); -$tplVars = array(); - /* Managing all possible inputs */ isset($_GET['action']) ? define('GET_ACTION', $_GET['action']): define('GET_ACTION', ''); isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', ''); @@ -59,12 +55,9 @@ if ((GET_ACTION == "add") && !$userservice->isLoggedOn()) { } if ($userservice->isLoggedOn()) { - //$currentUser = $userservice->getCurrentUser(); - //$currentUserID = $userservice->getCurrentUserId(); - //$currentUsername = $currentUser[$userservice->getFieldName('username')]; - $currentObjectUser = $userservice->getCurrentObjectUser(); - $currentUserID = $currentObjectUser->getId(); - $currentUsername = $currentObjectUser->getUsername(); + $currentUser = $userservice->getCurrentObjectUser(); + $currentUserID = $currentUser->getId(); + $currentUsername = $currentUser->getUsername(); } @@ -197,7 +190,7 @@ if ($templatename == 'editbookmark.tpl') { } } else if ($user && GET_POPUP == '') { - $tplVars['sidebar_blocks'] = array('profile', 'watchstatus'); + $tplVars['sidebar_blocks'] = array('watchstatus'); if (!$cat) { $cat = NULL; diff --git a/edit.php b/edit.php index 3984c7d..7a5b0ab 100644 --- a/edit.php +++ b/edit.php @@ -23,8 +23,6 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ $bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService'); -$templateservice = & ServiceFactory :: getServiceInstance('TemplateService'); -$userservice = & ServiceFactory :: getServiceInstance('UserService'); /* Managing all possible inputs */ isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', ''); @@ -40,9 +38,6 @@ isset($_GET['popup']) ? define('GET_POPUP', $_GET['popup']): define('GET_POPUP', isset($_POST['popup']) ? define('POST_POPUP', $_POST['popup']): define('POST_POPUP', ''); isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', ''); -/* Managing current logged user */ -$currentObjectUser = $userservice->getCurrentObjectUser(); - // Header variables $tplVars['subtitle'] = T_('Edit Bookmark'); @@ -81,7 +76,7 @@ if (!($row = $bookmarkservice->getBookmark(intval($bookmark), true))) { header('Location: '. POST_REFERRER); } else { $tplVars['msg'] = T_('Bookmark saved'); - header('Location: '. createURL('bookmarks', $currentObjectUser->getUsername())); + header('Location: '. createURL('bookmarks', $currentUser->getUsername())); } } } @@ -92,7 +87,7 @@ if (!($row = $bookmarkservice->getBookmark(intval($bookmark), true))) { if (POST_REFERRER != '') { header('Location: '. POST_REFERRER); } else { - header('Location: '. createURL('bookmarks', $currentObjectUser->getUsername())); + header('Location: '. createURL('bookmarks', $currentUser->getUsername())); } exit(); } else { diff --git a/gsearch/index.php b/gsearch/index.php index f2ac0d8..07aceb8 100644 --- a/gsearch/index.php +++ b/gsearch/index.php @@ -5,8 +5,6 @@ if($GLOBALS['enableGoogleCustomSearch']==false) { die; } -$userservice = & ServiceFactory :: getServiceInstance('UserService'); -$currentUser = $userservice->getCurrentObjectUser(); ?> diff --git a/header.inc.php b/header.inc.php index ccf198b..87952f6 100644 --- a/header.inc.php +++ b/header.inc.php @@ -37,7 +37,15 @@ T_bindtextdomain($domain, dirname(__FILE__) .'/locales'); T_bind_textdomain_codeset($domain, 'UTF-8'); T_textdomain($domain); - +// 4 // Session session_start(); +// 5 // Create mandatory services and objects +$userservice =& ServiceFactory::getServiceInstance('UserService'); +$currentUser = $userservice->getCurrentObjectUser(); + +$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); +$tplVars = array(); +$tplVars['currentUser'] = $currentUser; +$tplVars['userservice'] = $userservice; ?> diff --git a/history.php b/history.php index e66973c..1891695 100644 --- a/history.php +++ b/history.php @@ -23,32 +23,21 @@ 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; -$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 .= $currentObjectUser->getUsername(); + $hashtext .= $currentUser->getUsername(); } $cachehash = md5($hashtext); @@ -85,7 +74,7 @@ if ($bookmark =& $bookmarkservice->getBookmarkByHash($hash)) { $tplVars['nav_url'] = createURL('history', $hash .'/%3$s'); $tplVars['rsschannels'] = array(); if($userservice->isLoggedOn()) { - $tplVars['user'] = $currentObjectUser->getUsername(); + $tplVars['user'] = $currentUser->getUsername(); } else { $tplVars['user'] = ''; } diff --git a/import.php b/import.php index 8d051c8..adf89ad 100644 --- a/import.php +++ b/import.php @@ -22,9 +22,7 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ -$userservice =& ServiceFactory::getServiceInstance('UserService'); -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); - +// No specific services /* Managing all possible inputs */ // First input is $_FILES @@ -32,8 +30,6 @@ $templateservice =& ServiceFactory::getServiceInstance('TemplateService'); isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', ''); -$tplVars = array(); - if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) { $userinfo = $userservice->getCurrentObjectUser(); @@ -72,7 +68,6 @@ function startElement($parser, $name, $attrs) { global $depth, $status, $tplVars, $userservice; $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - $userservice =& ServiceFactory::getServiceInstance('UserService'); if ($name == 'POST') { while(list($attrTitle, $attrVal) = each($attrs)) { diff --git a/importNetscape.php b/importNetscape.php index 8a12ff8..b720001 100644 --- a/importNetscape.php +++ b/importNetscape.php @@ -23,8 +23,6 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); /* Managing all possible inputs */ @@ -32,8 +30,6 @@ $templateservice =& ServiceFactory::getServiceInstance('TemplateService'); // Other inputs isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', ''); - -$tplVars = array(); $countImportedBookmarks = 0; $tplVars['msg'] = ''; diff --git a/importStructure.php b/importStructure.php index eb3df86..ea4a1a5 100644 --- a/importStructure.php +++ b/importStructure.php @@ -22,8 +22,6 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ -$userservice =& ServiceFactory::getServiceInstance('UserService'); -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); /* Managing current logged user */ @@ -33,8 +31,6 @@ $currentUser = $userservice->getCurrentObjectUser(); /* Managing all possible inputs */ // First input is $_FILES - -$tplVars = array(); $tplVars['msg'] = ''; if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) { diff --git a/index.php b/index.php index 030f06e..fa890fa 100644 --- a/index.php +++ b/index.php @@ -24,8 +24,6 @@ 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 */ @@ -35,7 +33,6 @@ isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '') // Logout action -$tplvars = array(); if (GET_ACTION == "logout") { $userservice->logout(); $tplvars['msg'] = T_('You have now logged out'); diff --git a/login.php b/login.php index b1b9fcb..0fa820c 100644 --- a/login.php +++ b/login.php @@ -23,8 +23,7 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ -$userservice =& ServiceFactory::getServiceInstance('UserService'); -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); +// No specific services /* Managing all possible inputs */ @@ -34,9 +33,6 @@ isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define( isset($_POST['password']) ? define('POST_PASSWORD', $_POST['password']): define('POST_PASSWORD', ''); isset($_POST['query']) ? define('POST_QUERY', $_POST['query']): define('POST_QUERY', ''); - -$tplVars = array(); - $keeppass = (POST_KEEPPASS=='yes')?true:false; $login = false; diff --git a/password.php b/password.php index e3a8721..430a355 100644 --- a/password.php +++ b/password.php @@ -21,17 +21,13 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ -$userservice =& ServiceFactory::getServiceInstance('UserService'); -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); +// No specific services /* Managing all possible inputs */ isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', ''); isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define('POST_USERNAME', ''); isset($_POST['email']) ? define('POST_EMAIL', $_POST['email']): define('POST_EMAIL', ''); - -$tplVars = array(); - // IF SUBMITTED if (POST_SUBMITTED != '') { diff --git a/populartags.php b/populartags.php index 80ed0ed..3bdf139 100644 --- a/populartags.php +++ b/populartags.php @@ -22,14 +22,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA require_once('header.inc.php'); /* Service creation: only useful services are created */ -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); $cacheservice =& ServiceFactory::getServiceInstance('CacheService'); -/* Managing current logged user */ -$currentObjectUser = $userservice->getCurrentObjectUser(); - list($url, $user) = explode('/', $_SERVER['PATH_INFO']); @@ -37,8 +32,8 @@ if ($usecache) { // Generate hash for caching on $hashtext = $_SERVER['REQUEST_URI']; if ($userservice->isLoggedOn()) { - $hashtext .= $currentObjectUser->getId(); - if ($currentObjectUser->getUsername() == $user) { + $hashtext .= $currentUser->getId(); + if ($currentUser->getUsername() == $user) { $hashtext .= $user; } } @@ -49,7 +44,6 @@ if ($usecache) { } // Header variables -$tplvars = array(); $pagetitle = T_('Popular Tags'); if (isset($user) && $user != '') { diff --git a/profile.php b/profile.php index df5ae7e..56d6515 100644 --- a/profile.php +++ b/profile.php @@ -22,8 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA require_once('header.inc.php'); /* Service creation: only useful services are created */ -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); +// No specific services /* Managing all possible inputs */ isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', ''); @@ -39,12 +38,6 @@ isset($_SESSION['token']) ? define('SESSION_TOKEN', $_SESSION['token']): define( isset($_SESSION['token_stamp']) ? define('SESSION_TOKENSTAMP', $_SESSION['token_stamp']): define('SESSION_TOKENSTAMP', ''); -/* Managing current logged user */ -$currentObjectUser = $userservice->getCurrentObjectUser(); - - -$tplVars = array(); - @list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; if ($user) { @@ -67,7 +60,7 @@ if ($user) { exit(); } -if ($userservice->isLoggedOn() && $user == $currentObjectUser->getUsername()) { +if ($userservice->isLoggedOn() && $user == $currentUser->getUsername()) { $title = T_('My Profile'); } else { $title = T_('Profile') .': '. $user; @@ -78,7 +71,7 @@ $tplVars['subtitle'] = $title; $tplVars['user'] = $user; $tplVars['userid'] = $userid; -if (POST_SUBMITTED!='' && $currentObjectUser->getId() == $userid) { +if (POST_SUBMITTED!='' && $currentUser->getId() == $userid) { $error = false; $detPass = trim(POST_PASS); $detPassConf = trim(POST_PASSCONF); @@ -117,7 +110,7 @@ if (POST_SUBMITTED!='' && $currentObjectUser->getId() == $userid) { $userinfo = $userservice->getObjectUserByUsername($user); } -if (!$userservice->isLoggedOn() || $currentObjectUser->getId() != $userid) { +if (!$userservice->isLoggedOn() || $currentUser->getId() != $userid) { $templatename = 'profile.tpl.php'; } else { //Token Init diff --git a/register.php b/register.php index aeaa18f..9bee1db 100644 --- a/register.php +++ b/register.php @@ -22,8 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA require_once('header.inc.php'); /* Service creation: only useful services are created */ -$userservice =& ServiceFactory::getServiceInstance('UserService'); -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); +// No specific services /* Managing all possible inputs */ isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', ''); @@ -33,8 +32,6 @@ isset($_POST['email']) ? define('POST_MAIL', $_POST['email']): define('POST_MAIL isset($_POST['antispamAnswer']) ? define('POST_ANTISPAMANSWER', $_POST['antispamAnswer']): define('POST_ANTISPAMANSWER', ''); -$tplVars = array(); - if (POST_SUBMITTED != '') { $posteduser = trim(utf8_strtolower(POST_USERNAME)); diff --git a/rss.php b/rss.php index 08b4567..3a2b54a 100644 --- a/rss.php +++ b/rss.php @@ -24,12 +24,8 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); $cacheservice =& ServiceFactory::getServiceInstance('CacheService'); -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); - -$tplVars = array(); header('Content-Type: application/xml'); if(isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) >1) { list($url, $user, $cat) = explode('/', $_SERVER['PATH_INFO']); @@ -44,9 +40,7 @@ if ($usecache) { $hashtext = $_SERVER['REQUEST_URI']; if ($userservice->isLoggedOn()) { $hashtext .= $userservice->getCurrentUserID(); - $currentUser = $userservice->getCurrentUser(); - $currentUsername = $currentUser[$userservice->getFieldName('username')]; - if ($currentUsername == $user) { + if ($currentUser->getUsername() == $user) { $hashtext .= $user; } } diff --git a/search.php b/search.php index 273fc05..56a910f 100644 --- a/search.php +++ b/search.php @@ -37,8 +37,6 @@ if (POST_TERMS != '') { } else { /* Service creation: only useful services are created */ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - $templateservice =& ServiceFactory::getServiceInstance('TemplateService'); - $userservice =& ServiceFactory::getServiceInstance('UserService'); $searchhistoryservice =& ServiceFactory::getServiceInstance('SearchHistoryService'); /* Managing current logged user */ @@ -53,7 +51,6 @@ if (POST_TERMS != '') { $page= NULL; } - $tplvars = array(); $tplVars['loadjs'] = true; // Pagination diff --git a/tag2tagadd.php b/tag2tagadd.php index 07ce3a9..15ee6af 100644 --- a/tag2tagadd.php +++ b/tag2tagadd.php @@ -23,8 +23,6 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ $tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService'); -$templateservice = & ServiceFactory :: getServiceInstance('TemplateService'); -$userservice = & ServiceFactory :: getServiceInstance('UserService'); /* Managing all possible inputs */ isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); @@ -33,8 +31,6 @@ isset($_POST['tag1']) ? define('POST_TAG1', $_POST['tag1']): define('POST_TAG1', isset($_POST['linkType']) ? define('POST_LINKTYPE', $_POST['linkType']): define('POST_LINKTYPE', ''); isset($_POST['tag2']) ? define('POST_TAG2', $_POST['tag2']): define('POST_TAG2', ''); -/* Managing current logged user */ -$currentObjectUser = $userservice->getCurrentObjectUser(); //permissions if(!$userservice->isLoggedOn()) { @@ -50,19 +46,19 @@ if (POST_CONFIRM != '') { $tag1 = POST_TAG1; $linkType = POST_LINKTYPE; $tag2 = POST_TAG2; - if ($tag2tagservice->addLinkedTags($tag1, $tag2, $linkType, $currentObjectUser->getId())) { + if ($tag2tagservice->addLinkedTags($tag1, $tag2, $linkType, $currentUser->getId())) { $tplVars['msg'] = T_('Tag link created'); - header('Location: '. createURL('bookmarks', $currentObjectUser->getUsername())); + header('Location: '. createURL('bookmarks', $currentUser->getUsername())); } else { $tplVars['error'] = T_('Failed to create the link'); $templateservice->loadTemplate('error.500.tpl', $tplVars); exit(); } } elseif (POST_CANCEL) { - header('Location: '. createURL('bookmarks', $currentObjectUser->getUsername() .'/'. $tags)); + header('Location: '. createURL('bookmarks', $currentUser->getUsername() .'/'. $tags)); } -$tplVars['links'] = $tag2tagservice->getLinks($currentObjectUser->getId()); +$tplVars['links'] = $tag2tagservice->getLinks($currentUser->getId()); $tplVars['tag1'] = $tag1; $tplVars['tag2'] = ''; diff --git a/tag2tagdelete.php b/tag2tagdelete.php index b62b623..78016e7 100644 --- a/tag2tagdelete.php +++ b/tag2tagdelete.php @@ -23,8 +23,6 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ $tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService'); -$templateservice = & ServiceFactory :: getServiceInstance('TemplateService'); -$userservice = & ServiceFactory :: getServiceInstance('UserService'); /* Managing all possible inputs */ isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); diff --git a/tag2tagedit.php b/tag2tagedit.php index e75553f..c707253 100644 --- a/tag2tagedit.php +++ b/tag2tagedit.php @@ -23,18 +23,13 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ $tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService'); -$templateservice = & ServiceFactory :: getServiceInstance('TemplateService'); -$userservice = & ServiceFactory :: getServiceInstance('UserService'); + /* Managing all possible inputs */ isset($_SERVER['HTTP_REFERER']) ? define('HTTP_REFERER', $_SERVER['HTTP_REFERER']): define('HTTP_REFERER', ''); -/* Managing current logged user */ -$logged_on_user = $userservice->getCurrentUser(); - - //permissions -if($logged_on_user == null) { +if(!$userservice->loggedOn()) { $tplVars['error'] = T_('Permission denied.'); $templateservice->loadTemplate('error.500.tpl', $tplVars); exit(); diff --git a/tagcommondescriptionedit.php b/tagcommondescriptionedit.php index 113c5bf..3d13d66 100644 --- a/tagcommondescriptionedit.php +++ b/tagcommondescriptionedit.php @@ -23,8 +23,6 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); -$templateservice = & ServiceFactory :: getServiceInstance('TemplateService'); -$userservice = & ServiceFactory :: getServiceInstance('UserService'); $cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService'); /* Managing all possible inputs */ diff --git a/tagdelete.php b/tagdelete.php index 8c4b1af..61d2546 100644 --- a/tagdelete.php +++ b/tagdelete.php @@ -23,8 +23,7 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); -$templateservice = & ServiceFactory :: getServiceInstance('TemplateService'); -$userservice = & ServiceFactory :: getServiceInstance('UserService'); + /* Managing all possible inputs */ isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); diff --git a/tagedit.php b/tagedit.php index cd248a5..57a9466 100644 --- a/tagedit.php +++ b/tagedit.php @@ -23,8 +23,6 @@ require_once('header.inc.php'); /* Service creation: only useful services are created */ $tagservice = & ServiceFactory :: getServiceInstance('TagService'); -$templateservice = & ServiceFactory :: getServiceInstance('TemplateService'); -$userservice = & ServiceFactory :: getServiceInstance('UserService'); /* Managing all possible inputs */ isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); diff --git a/tagrename.php b/tagrename.php index 3dde296..bead5e7 100644 --- a/tagrename.php +++ b/tagrename.php @@ -25,8 +25,6 @@ require_once('header.inc.php'); $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); $tagservice = & ServiceFactory :: getServiceInstance('TagService'); $tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2tagService'); -$templateservice = & ServiceFactory :: getServiceInstance('TemplateService'); -$userservice = & ServiceFactory :: getServiceInstance('UserService'); /* Managing all possible inputs */ isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); diff --git a/tags.php b/tags.php index 308069d..bee3092 100644 --- a/tags.php +++ b/tags.php @@ -23,8 +23,6 @@ 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 */ @@ -37,8 +35,6 @@ $currentUser = $userservice->getCurrentObjectUser(); /* Managing path info */ list($url, $cat) = explode('/', $_SERVER['PATH_INFO']); -$tplVars = array(); - if (!$cat) { header('Location: '. createURL('populartags')); diff --git a/templates/about.tpl.php b/templates/about.tpl.php index a4bc718..77c34bc 100644 --- a/templates/about.tpl.php +++ b/templates/about.tpl.php @@ -1,12 +1,4 @@ getCurrentUser(); -//$currentUserId = $userservice->getCurrentUserId(); - -$currentObjectUser = $userservice->getCurrentObjectUser(); - $this->includeTemplate($GLOBALS['top_include']); ?> diff --git a/templates/admin.tpl.php b/templates/admin.tpl.php index 35b97c7..ac288bd 100644 --- a/templates/admin.tpl.php +++ b/templates/admin.tpl.php @@ -1,9 +1,4 @@ getCurrentObjectUser(); $this->includeTemplate($GLOBALS['top_include']); @@ -18,7 +13,7 @@ foreach($users as $user) { echo ''.$user->getUsername().''; echo ''; - if($user->getUsername() != $currentObjectUser->getUsername()) { + if($user->getUsername() != $currentUser->getUsername()) { echo '

'; echo ''.T_('Delete').''; echo '
'; diff --git a/templates/bookmarkcommondescriptionedit.tpl.php b/templates/bookmarkcommondescriptionedit.tpl.php index ac3f540..af5909a 100644 --- a/templates/bookmarkcommondescriptionedit.tpl.php +++ b/templates/bookmarkcommondescriptionedit.tpl.php @@ -1,6 +1,4 @@ includeTemplate($GLOBALS['top_include']); @@ -47,7 +45,6 @@ window.onload = function() { -

diff --git a/templates/bookmarks.tpl.php b/templates/bookmarks.tpl.php index 341358d..efec240 100644 --- a/templates/bookmarks.tpl.php +++ b/templates/bookmarks.tpl.php @@ -1,13 +1,10 @@ getCurrentObjectUser(); $pageName = isset($pageName)?$pageName:""; $user = isset($user)?$user:""; @@ -94,7 +91,7 @@ if(isset($currenttag) && $currenttag!= '') { //echo T_(' for these tags'); } else if($userservice->isLoggedOn()){ echo ' - '; - echo ''; + echo ''; echo T_('Only your bookmarks for this tag').''; //echo T_(' for these tags'); } @@ -165,9 +162,9 @@ if(isset($currenttag) && $currenttag!= '') { // Copy link if ($userservice->isLoggedOn() - && ($currentObjectUser->getId() != $row['uId']) - && !$bookmarkservice->bookmarkExists($row['bAddress'], $currentObjectUser->getId())) { - $copy .= ' - '. T_('Copy') .''; + && ($currentUser->getId() != $row['uId']) + && !$bookmarkservice->bookmarkExists($row['bAddress'], $currentUser->getId())) { + $copy .= ' - '. T_('Copy') .''; } // Nofollow option diff --git a/templates/dynamictags.inc.php b/templates/dynamictags.inc.php index b317e9f..07e3ee9 100644 --- a/templates/dynamictags.inc.php +++ b/templates/dynamictags.inc.php @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ +/* Service creation: only useful services are created */ $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); -$userservice = & ServiceFactory :: getServiceInstance('UserService'); $logged_on_userid = $userservice->getCurrentUserId(); diff --git a/templates/profile.tpl.php b/templates/profile.tpl.php index a544fb4..a7a92ba 100644 --- a/templates/profile.tpl.php +++ b/templates/profile.tpl.php @@ -1,5 +1,4 @@ includeTemplate($GLOBALS['top_include']); ?> diff --git a/templates/sidebar.block.linked.php b/templates/sidebar.block.linked.php index efe75a8..13a8319 100644 --- a/templates/sidebar.block.linked.php +++ b/templates/sidebar.block.linked.php @@ -1,6 +1,6 @@ 0) { - $name = $userinfo['name']; -} else { - $name = $userinfo['username']; -} - - -

-
-
    -
  • -
  • -
  • -
-
- -*/ -?> diff --git a/templates/sidebar.block.recent.php b/templates/sidebar.block.recent.php index 9e4df08..71f9aa9 100644 --- a/templates/sidebar.block.recent.php +++ b/templates/sidebar.block.recent.php @@ -1,6 +1,6 @@ getCurrentUserId(); diff --git a/templates/sidebar.block.tagactions.php b/templates/sidebar.block.tagactions.php index fd13d98..37bf5c6 100644 --- a/templates/sidebar.block.tagactions.php +++ b/templates/sidebar.block.tagactions.php @@ -1,11 +1,10 @@ isLoggedOn()) { - $currentUser = $userservice->getCurrentUser(); - $currentUsername = $currentUser[$userservice->getFieldName('username')]; - if ($currentUsername == $user) { + if ($currentUser->getUsername() == $user) { $tags = explode('+', $currenttag); $renametext = T_ngettext('Rename Tag', 'Rename Tags', count($tags)); $renamelink = createURL('tagrename', $currenttag); diff --git a/templates/sidebar.block.users.php b/templates/sidebar.block.users.php index 7c61acc..b6eef24 100644 --- a/templates/sidebar.block.users.php +++ b/templates/sidebar.block.users.php @@ -1,5 +1,6 @@ getCurrentUserId(); if ($logged_on_userid === false) { diff --git a/templates/sidebar.block.watchlist.php b/templates/sidebar.block.watchlist.php index e35fa76..a42acba 100644 --- a/templates/sidebar.block.watchlist.php +++ b/templates/sidebar.block.watchlist.php @@ -1,5 +1,6 @@ getWatchNames($userid); if ($watching) { diff --git a/templates/sidebar.block.watchstatus.php b/templates/sidebar.block.watchstatus.php index d912846..99574aa 100644 --- a/templates/sidebar.block.watchstatus.php +++ b/templates/sidebar.block.watchstatus.php @@ -1,10 +1,11 @@ isLoggedOn()) { - $currentUser = $userservice->getCurrentUser(); - $currentUsername = $currentUser[$userservice->getFieldName('username')]; +/* Service creation: only useful services are created */ +//No specific services - if ($currentUsername != $user) { + +if ($userservice->isLoggedOn()) { + + if ($currentUser->getUsername() != $user) { $result = $userservice->getWatchStatus($userid, $userservice->getCurrentUserId()); if ($result) { $linkText = T_('Remove from Watchlist'); diff --git a/templates/tagcommondescriptionedit.tpl.php b/templates/tagcommondescriptionedit.tpl.php index 158142e..d3a006a 100644 --- a/templates/tagcommondescriptionedit.tpl.php +++ b/templates/tagcommondescriptionedit.tpl.php @@ -1,6 +1,6 @@ includeTemplate($GLOBALS['top_include']); -$userservice = & ServiceFactory :: getServiceInstance('UserService'); + ?>