summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-12-05 07:25:04 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-12-05 07:25:04 +0000
commitd6889066c0d285bf59e89b484800443304585b68 (patch)
tree8cc9aa5011a6e6a66061995a6f8186653be9695e
parentf7ccbde31062488cbf04b3e4c06a9aa590ebfedd (diff)
downloadsemanticscuttle-d6889066c0d285bf59e89b484800443304585b68.tar.gz
semanticscuttle-d6889066c0d285bf59e89b484800443304585b68.tar.bz2
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
-rw-r--r--about.php5
-rw-r--r--admin.php5
-rw-r--r--ajax/getlinkedtags.php1
-rw-r--r--ajax/gettags.php11
-rw-r--r--ajaxIsAvailable.php2
-rw-r--r--alltags.php3
-rw-r--r--api/export_gcs.php5
-rw-r--r--api/export_html.php8
-rw-r--r--api/httpauth.inc.php42
-rw-r--r--api/posts_add.php2
-rw-r--r--api/posts_all.php8
-rw-r--r--api/posts_dates.php8
-rw-r--r--api/posts_delete.php3
-rw-r--r--api/posts_get.php7
-rw-r--r--api/posts_recent.php7
-rw-r--r--api/posts_update.php5
-rw-r--r--api/tags_get.php3
-rw-r--r--api/tags_rename.php2
-rw-r--r--bookmarkcommondescriptionedit.php9
-rw-r--r--bookmarks.php15
-rw-r--r--edit.php9
-rw-r--r--gsearch/index.php2
-rw-r--r--header.inc.php10
-rw-r--r--history.php15
-rw-r--r--import.php7
-rw-r--r--importNetscape.php4
-rw-r--r--importStructure.php4
-rw-r--r--index.php3
-rw-r--r--login.php6
-rw-r--r--password.php6
-rw-r--r--populartags.php10
-rw-r--r--profile.php15
-rw-r--r--register.php5
-rw-r--r--rss.php8
-rw-r--r--search.php3
-rw-r--r--tag2tagadd.php12
-rw-r--r--tag2tagdelete.php2
-rw-r--r--tag2tagedit.php9
-rw-r--r--tagcommondescriptionedit.php2
-rw-r--r--tagdelete.php3
-rw-r--r--tagedit.php2
-rw-r--r--tagrename.php2
-rw-r--r--tags.php4
-rw-r--r--templates/about.tpl.php8
-rw-r--r--templates/admin.tpl.php7
-rw-r--r--templates/bookmarkcommondescriptionedit.tpl.php3
-rw-r--r--templates/bookmarks.tpl.php11
-rw-r--r--templates/dynamictags.inc.php2
-rw-r--r--templates/profile.tpl.php1
-rw-r--r--templates/sidebar.block.linked.php2
-rw-r--r--templates/sidebar.block.menu.php3
-rw-r--r--templates/sidebar.block.menu2.php2
-rw-r--r--templates/sidebar.block.popular.php3
-rw-r--r--templates/sidebar.block.profile.php23
-rw-r--r--templates/sidebar.block.recent.php2
-rw-r--r--templates/sidebar.block.related.php3
-rw-r--r--templates/sidebar.block.search.php2
-rw-r--r--templates/sidebar.block.tagactions.php7
-rw-r--r--templates/sidebar.block.users.php3
-rw-r--r--templates/sidebar.block.watchlist.php3
-rw-r--r--templates/sidebar.block.watchstatus.php9
-rw-r--r--templates/tagcommondescriptionedit.tpl.php2
-rw-r--r--templates/tagedit.tpl.php1
-rw-r--r--templates/toolbar.inc.php8
-rw-r--r--upgrade.php1
-rw-r--r--users.php3
-rw-r--r--watch.php3
-rw-r--r--watchlist.php3
68 files changed, 117 insertions, 292 deletions
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: [
<?php
- $listTags = $b2tservice->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 '<!DOCTYPE NETSCAPE-Bookmark-file-1>'."\r\n";
echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">';
echo '<!-- This is an automatically generated file. -->'."\r\n";
echo '<TITLE>Bookmarks</TITLE>'."\r\n";
-echo '<H1 LAST_MODIFIED="'. date('U') .'">Bookmarks for '. htmlspecialchars($currentusername) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."</H1>\r\n";
+echo '<H1 LAST_MODIFIED="'. date('U') .'">Bookmarks for '. htmlspecialchars($currentUser->getUsername()) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."</H1>\r\n";
echo '<DL><p>'."\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 @@
<?php
require_once('../header.inc.php');
-$userservice =& ServiceFactory::getServiceInstance('UserService');
// Provides HTTP Basic authentication of a user, and sets two variables, sId and username,
// with the user's info.
function authenticate() {
- header('WWW-Authenticate: Basic realm="SemanticScuttle API"');
- header('HTTP/1.0 401 Unauthorized');
-
- die(T_("Use of the API calls requires authentication."));
+ header('WWW-Authenticate: Basic realm="SemanticScuttle API"');
+ header('HTTP/1.0 401 Unauthorized');
+
+ die(T_("Use of the API calls requires authentication."));
}
if(!$userservice->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');
+ /* 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);
+ }
- $login = $userservice->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
- if (!$login) {
- authenticate();
+ 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 '<?xml version="1.0" standalone="yes" ?'.">\r\n";
-echo '<posts update="'. gmdate('Y-m-d\TH:i:s\Z') .'" user="'. htmlspecialchars($currentusername) .'"'. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') .">\r\n";
+echo '<posts update="'. gmdate('Y-m-d\TH:i:s\Z') .'" user="'. htmlspecialchars($currentUser->getUsername()) .'"'. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') .">\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 '<?xml version="1.0" standalone="yes" ?'.">\r\n";
-echo '<dates tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentusername, 'xml') ."\">\r\n";
+echo '<dates tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\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 '<?xml version="1.0" standalone="yes" ?'.">\r\n";
-echo '<posts'. (is_null($dtstart) ? '' : ' dt="'. $dtstart .'"') .' tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentusername, 'xml') ."\">\r\n";
+echo '<posts'. (is_null($dtstart) ? '' : ' dt="'. $dtstart .'"') .' tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\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 '<?xml version="1.0" standalone="yes" ?'.">\r\n";
-echo '<posts tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentusername, 'xml') ."\">\r\n";
+echo '<posts tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\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();
?>
<html>
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 @@
<?php
-
-/* Service creation: only useful services are created */
-$userservice =& ServiceFactory::getServiceInstance('UserService');
-//$currentUser = $userservice->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 @@
<?php
-
-/* Service creation: only useful services are created */
-$userservice =& ServiceFactory::getServiceInstance('UserService');
-
-$currentObjectUser = $userservice->getCurrentObjectUser();
$this->includeTemplate($GLOBALS['top_include']);
@@ -18,7 +13,7 @@ foreach($users as $user) {
echo '<a href="'.createURL('profile', $user->getUsername()).'">'.$user->getUsername().'</a>';
echo '</div>';
- if($user->getUsername() != $currentObjectUser->getUsername()) {
+ if($user->getUsername() != $currentUser->getUsername()) {
echo '<div class="meta">';
echo '<a href="'.createURL('admin','delete/'.$user->getUsername()).'" onclick="return confirm(\''.T_('Are you sure?').'\');">'.T_('Delete').'</a>';
echo '</div>';
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 @@
<?php
-/* Service creation: only useful services are created */
-$userservice = & ServiceFactory :: getServiceInstance('UserService');
$this->includeTemplate($GLOBALS['top_include']);
@@ -47,7 +45,6 @@ window.onload = function() {
<td></td>
</tr>
</table>
-</p>
<?php if (isset($referrer)): ?>
<div><input type="hidden" name="referrer" value="<?php echo $referrer; ?>" /></div>
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 @@
<?php
/* Service creation: only useful services are created */
-$userservice =& ServiceFactory::getServiceInstance('UserService');
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$tagservice =& ServiceFactory::getServiceInstance('TagService');
$cdservice =& ServiceFactory::getServiceInstance('CommonDescriptionService');
-// Momentary useful to go to object code
-$currentObjectUser = $userservice->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 '<a href="'. createURL('bookmarks', $currentObjectUser->getUsername().'/'.$currenttag) .'">';
+ echo '<a href="'. createURL('bookmarks', $currentUser->getUsername().'/'.$currenttag) .'">';
echo T_('Only your bookmarks for this tag').'</a>';
//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 .= ' - <a href="'. createURL('bookmarks', $currentObjectUser->getUsername() .'?action=add&amp;address='. urlencode($row['bAddress']) .'&amp;title='. urlencode($row['bTitle'])). '&amp;description='.urlencode($row['bDescription']). '&amp;tags='.$tagsForCopy .'">'. T_('Copy') .'</a>';
+ && ($currentUser->getId() != $row['uId'])
+ && !$bookmarkservice->bookmarkExists($row['bAddress'], $currentUser->getId())) {
+ $copy .= ' - <a href="'. createURL('bookmarks', $currentUser->getUsername() .'?action=add&amp;address='. urlencode($row['bAddress']) .'&amp;title='. urlencode($row['bTitle'])). '&amp;description='.urlencode($row['bDescription']). '&amp;tags='.$tagsForCopy .'">'. T_('Copy') .'</a>';
}
// 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 @@
<?php
-$userservice =& ServiceFactory::getServiceInstance('UserService');
$this->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 @@
<?php
+/* Service creation: only useful services are created */
$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
-$userservice =& ServiceFactory::getServiceInstance('UserService');
require_once('sidebar.linkedtags.inc.php');
diff --git a/templates/sidebar.block.menu.php b/templates/sidebar.block.menu.php
index 9012872..ed1069a 100644
--- a/templates/sidebar.block.menu.php
+++ b/templates/sidebar.block.menu.php
@@ -1,6 +1,7 @@
<?php
+/* Service creation: only useful services are created */
$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
-$userservice =& ServiceFactory::getServiceInstance('UserService');
+
require_once('sidebar.linkedtags.inc.php');
diff --git a/templates/sidebar.block.menu2.php b/templates/sidebar.block.menu2.php
index 439ed33..8759f1b 100644
--- a/templates/sidebar.block.menu2.php
+++ b/templates/sidebar.block.menu2.php
@@ -1,6 +1,6 @@
<?php
+/* Service creation: only useful services are created */
$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
-$userservice =& ServiceFactory::getServiceInstance('UserService');
require_once('sidebar.linkedtags.inc.php');
diff --git a/templates/sidebar.block.popular.php b/templates/sidebar.block.popular.php
index b9c029f..4279620 100644
--- a/templates/sidebar.block.popular.php
+++ b/templates/sidebar.block.popular.php
@@ -1,6 +1,7 @@
<?php
+/* Service creation: only useful services are created */
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
-$userservice =& ServiceFactory::getServiceInstance('UserService');
+
if(!isset($user)) {
$user = '';
diff --git a/templates/sidebar.block.profile.php b/templates/sidebar.block.profile.php
deleted file mode 100644
index 4fd61ff..0000000
--- a/templates/sidebar.block.profile.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-// Menu moved to toolbar.inc.php
-
-/*
-$userservice =& ServiceFactory::getServiceInstance('UserService');
-if (utf8_strlen($userinfo['name']) > 0) {
- $name = $userinfo['name'];
-} else {
- $name = $userinfo['username'];
-}
-
-
-<h2><?php echo $name; ?></h2>
-<div id="profile">
- <ul>
- <li><a href="<?php echo $userservice->getProfileUrl($userid, $user); ?>"><?php echo T_('Profile'); ?></a> &rarr;</li>
- <li><a href="<?php echo createURL('alltags', $user); ?>"><?php echo T_('Tags'); ?></a> &rarr;</li>
- <li><a href="<?php echo createURL('watchlist', $user); ?>"><?php echo T_('Watchlist'); ?></a> &rarr;</li>
- </ul>
-</div>
-
-*/
-?>
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 @@
<?php
+/* Service creation: only useful services are created */
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
-$userservice =& ServiceFactory::getServiceInstance('UserService');
/* Manage input */
$userid = isset($userid)?$userid:NULL;
diff --git a/templates/sidebar.block.related.php b/templates/sidebar.block.related.php
index 81336f9..31c817a 100644
--- a/templates/sidebar.block.related.php
+++ b/templates/sidebar.block.related.php
@@ -1,6 +1,7 @@
<?php
+/* Service creation: only useful services are created */
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
-$userservice =& ServiceFactory::getServiceInstance('UserService');
+
if(!isset($user)) $user="";
diff --git a/templates/sidebar.block.search.php b/templates/sidebar.block.search.php
index 921b0b9..7979ebf 100644
--- a/templates/sidebar.block.search.php
+++ b/templates/sidebar.block.search.php
@@ -1,5 +1,5 @@
<?php
-$userservice =& ServiceFactory::getServiceInstance('UserService');
+/* Service creation: only useful services are created */
$searchhistoryservice =& ServiceFactory::getServiceInstance('SearchHistoryService');
$logged_on_userid = $userservice->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 @@
<?php
-$userservice =& ServiceFactory::getServiceInstance('UserService');
+/* Service creation: only useful services are created */
+//No specific services
if ($userservice->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 @@
<?php
-$userservice =& ServiceFactory::getServiceInstance('UserService');
+/* Service creation: only useful services are created */
+//No specific services
$logged_on_userid = $userservice->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 @@
<?php
-$userservice =& ServiceFactory::getServiceInstance('UserService');
+/* Service creation: only useful services are created */
+//No specific services
$watching = $userservice->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 @@
<?php
-$userservice =& ServiceFactory::getServiceInstance('UserService');
+/* Service creation: only useful services are created */
+//No specific services
+
+
if ($userservice->isLoggedOn()) {
- $currentUser = $userservice->getCurrentUser();
- $currentUsername = $currentUser[$userservice->getFieldName('username')];
- if ($currentUsername != $user) {
+ 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 @@
<?php
$this->includeTemplate($GLOBALS['top_include']);
-$userservice = & ServiceFactory :: getServiceInstance('UserService');
+
?>
<script type="text/javascript">
window.onload = function() {
diff --git a/templates/tagedit.tpl.php b/templates/tagedit.tpl.php
index fbfe48c..5edfbc7 100644
--- a/templates/tagedit.tpl.php
+++ b/templates/tagedit.tpl.php
@@ -1,6 +1,5 @@
<?php
$this->includeTemplate($GLOBALS['top_include']);
-$userservice = & ServiceFactory :: getServiceInstance('UserService');
?>
<script type="text/javascript">
window.onload = function() {
diff --git a/templates/toolbar.inc.php b/templates/toolbar.inc.php
index 0b052e0..a04b6a0 100644
--- a/templates/toolbar.inc.php
+++ b/templates/toolbar.inc.php
@@ -1,10 +1,7 @@
<?php
-$userservice =& ServiceFactory::getServiceInstance('UserService');
if ($userservice->isLoggedOn()) {
- $cUser = $userservice->getCurrentUser();
$cUserId = $userservice->getCurrentUserId();
- $cUsername = $cUser[$userservice->getFieldName('username')];
- $isAdmin = $userservice->isAdmin($cUser[$userservice->getFieldname('primary')]);
+ $cUsername = $currentUser->getUsername();
?>
<ul id="navigation">
@@ -15,7 +12,7 @@ if ($userservice->isLoggedOn()) {
<li><a href="<?php echo createURL('bookmarks', $cUsername . '?action=add'); ?>"><?php echo T_('Add a Bookmark'); ?></a></li>
<li class="access"><?php echo $cUsername?><a href="<?php echo ROOT ?>?action=logout">(<?php echo T_('Log Out'); ?>)</a></li>
<li><a href="<?php echo createURL('about'); ?>"><?php echo T_('About'); ?></a></li>
- <?php if($isAdmin): ?>
+ <?php if($currentUser->isAdmin()): ?>
<li><a href="<?php echo createURL('admin', ''); ?>"><?php echo '['.T_('Admin').']'; ?></a></li>
<?php endif; ?>
@@ -24,7 +21,6 @@ if ($userservice->isLoggedOn()) {
<?php
} else {
?>
-
<ul id="navigation">
<li><a href="<?php echo createURL('populartags'); ?>"><?php echo T_('Popular Tags'); ?></a></li>
<li><a href="<?php echo createURL('about'); ?>"><?php echo T_('About'); ?></a></li>
diff --git a/upgrade.php b/upgrade.php
index 7eee254..a2fb606 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -36,7 +36,6 @@ exit();
/////////////////
require_once('header.inc.php');
$tagstatservice = & ServiceFactory :: getServiceInstance('TagStatService');
-$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
?>
<h1>Upgrade</h1>
diff --git a/users.php b/users.php
index c3ba8ac..959dfdb 100644
--- a/users.php
+++ b/users.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 current logged user */
@@ -33,7 +31,6 @@ $currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */
list($url, $cat) = explode('/', $_SERVER['PATH_INFO']);
-$tplVars = array();
$pagetitle = T_('Users');
diff --git a/watch.php b/watch.php
index 11a0073..9fc480b 100644
--- a/watch.php
+++ b/watch.php
@@ -22,7 +22,7 @@
require_once('header.inc.php');
/* Service creation: only useful services are created */
-$userservice =& ServiceFactory::getServiceInstance('UserService');
+//No specific services
/* Managing current logged user */
$currentUser = $userservice->getCurrentObjectUser();
@@ -32,7 +32,6 @@ $currentUser = $userservice->getCurrentObjectUser();
if ($userservice->isLoggedOn() && $user) {
- $tplVars = array();
$pagetitle = '';
if (is_int($user)) {
diff --git a/watchlist.php b/watchlist.php
index 323cb81..d824937 100644
--- a/watchlist.php
+++ b/watchlist.php
@@ -22,8 +22,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 */
@@ -36,7 +34,6 @@ $currentUser = $userservice->getCurrentObjectUser();
/* Managing path info */
@list($url, $user, $page) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
-$tplVars = array();
if ($usecache) {
// Generate hash for caching on