]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Major Refactoring: finish transforming into object . Put and into header.inc.php.
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Fri, 5 Dec 2008 07:25:04 +0000 (07:25 +0000)
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Fri, 5 Dec 2008 07:25:04 +0000 (07:25 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@199 b3834d28-1941-0410-a4f8-b48e95affb8f

68 files changed:
about.php
admin.php
ajax/getlinkedtags.php
ajax/gettags.php
ajaxIsAvailable.php
alltags.php
api/export_gcs.php
api/export_html.php
api/httpauth.inc.php
api/posts_add.php
api/posts_all.php
api/posts_dates.php
api/posts_delete.php
api/posts_get.php
api/posts_recent.php
api/posts_update.php
api/tags_get.php
api/tags_rename.php
bookmarkcommondescriptionedit.php
bookmarks.php
edit.php
gsearch/index.php
header.inc.php
history.php
import.php
importNetscape.php
importStructure.php
index.php
login.php
password.php
populartags.php
profile.php
register.php
rss.php
search.php
tag2tagadd.php
tag2tagdelete.php
tag2tagedit.php
tagcommondescriptionedit.php
tagdelete.php
tagedit.php
tagrename.php
tags.php
templates/about.tpl.php
templates/admin.tpl.php
templates/bookmarkcommondescriptionedit.tpl.php
templates/bookmarks.tpl.php
templates/dynamictags.inc.php
templates/profile.tpl.php
templates/sidebar.block.linked.php
templates/sidebar.block.menu.php
templates/sidebar.block.menu2.php
templates/sidebar.block.popular.php
templates/sidebar.block.profile.php [deleted file]
templates/sidebar.block.recent.php
templates/sidebar.block.related.php
templates/sidebar.block.search.php
templates/sidebar.block.tagactions.php
templates/sidebar.block.users.php
templates/sidebar.block.watchlist.php
templates/sidebar.block.watchstatus.php
templates/tagcommondescriptionedit.tpl.php
templates/tagedit.tpl.php
templates/toolbar.inc.php
upgrade.php
users.php
watch.php
watchlist.php

index b8d2fd9dd3a62919808a920e73ed345652943438..ceecf4bb7d0f28515202eb20e0fa17cf450e8440 100644 (file)
--- a/about.php
+++ b/about.php
 
 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
index fa2c3dbcf9d50fdf4c4a1c23f4b2e9b7cae8f2bf..e34b7dce4b4f6afe4582b7c063d28aa7c3aa8779 100644 (file)
--- a/admin.php
+++ b/admin.php
 require_once('header.inc.php');\r
 
 /* Service creation: only useful services are created */\r
-$userservice = & ServiceFactory :: getServiceInstance('UserService');\r
 $bookmark2tagservice = & ServiceFactory :: getServiceInstance('Bookmark2Tagservice');\r
 $bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
 $tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');\r
-$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
-
-/* Managing current logged user */
-$currentUser = $userservice->getCurrentObjectUser();\r
 \r
 // Header variables\r
 $tplVars['subtitle'] = T_('Manage users');\r
index feb70aed927f5dfbe5c46bdfa9635d0db04074d3..24d00fcea0c97ad5cae4bfc7799051041d6080b5 100644 (file)
@@ -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 */
index 167c63d1fc2f70f7e2449dd4c84e0b1371ff5281..7b8b33a46d051678c43b636255f8e6559e2ea019 100644 (file)
@@ -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']."\"},";
        }
index e9d82e76f12c45f82e6eed5b8fa87aa8d5b3aa33..ffd4379f89c756a184e6f00d78e08923b68a0f0d 100644 (file)
@@ -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', '');
index 61ad3452a936336a0472f806a19dc3c4b3466421..c37922d1c50367fccc5fcf2309724d5a81d7e743 100644 (file)
@@ -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 != '') {
index 1040dd468eb3c8ba865a2bf855df688654da061d..6f1f4c274f06c283b96aa43bc67bb1efe42ed165 100644 (file)
@@ -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');
index b422b4beb2307a8221e49419855a6d38658d43a4..79ade0a2ff956b0191c80151b51c0779a1cf6346 100644 (file)
@@ -7,9 +7,9 @@
 // Force HTTP authentication first!
 require_once('httpauth.inc.php');\r
 require_once('../header.inc.php');\r
-\r
+
+/* Service creation: only useful services are created */\r
 $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');\r
-$userservice =& ServiceFactory::getServiceInstance('UserService');\r
 \r
 // Check to see if a tag was specified.\r
 if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))\r
@@ -20,8 +20,6 @@ else
 // Get the posts relevant to the passed-in variables.\r
 $bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder());\r
 \r
-$currentuser = $userservice->getCurrentUser();\r
-$currentusername = $currentuser[$userservice->getFieldName('username')];\r
 \r
 // Set up the XML file and output all the posts.\r
 header('Content-Type: text/html');\r
@@ -29,7 +27,7 @@ echo '<!DOCTYPE NETSCAPE-Bookmark-file-1>'."\r\n";
 echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">';\r
 echo '<!-- This is an automatically generated file. -->'."\r\n";\r
 echo '<TITLE>Bookmarks</TITLE>'."\r\n";\r
-echo '<H1 LAST_MODIFIED="'. date('U') .'">Bookmarks for '. htmlspecialchars($currentusername) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."</H1>\r\n";\r
+echo '<H1 LAST_MODIFIED="'. date('U') .'">Bookmarks for '. htmlspecialchars($currentUser->getUsername()) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."</H1>\r\n";\r
 echo '<DL><p>'."\r\n";\r
 \r
 \r
index d0198fddda2425618a0b04bfff0bc6062bb80347..5dd7444dc0bd064646efceefa8ca7b87fd423afc 100644 (file)
@@ -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();
+               }
        }
-    }
 }
 ?>
index 77c3288179bd02a029ee89276ea385c26d0f2c89..e27fc995592af0adc69a677a963678bf0ed0fba7 100644 (file)
@@ -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']) != ''))
index 03026c4234d271ed7e48b997388ba38958260d14..4ecbd7e7c5c856ad9fde22a8639ecd584c67d26e 100644 (file)
@@ -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']) == ''))
index 70987564e9044ea1a6e23ce63b32192da27995a0..d4962ff339c8629b0d21cf1e70590a314548bdb8 100644 (file)
@@ -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) {
index 737a4fb5d90f3bf4244c0b5bc24a6d367f87d8bb..d24ba59b7e3f9c356c2d9f4779ca74d5011cd9c5 100644 (file)
@@ -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.
index 8be067bc97e02b9a872e781839db116a61f334b4..34d192eb134ca67da772188d7c3327aaa1e38ef1 100644 (file)
@@ -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']) == ''))
index 22fc2bdef04fb60fd6b3a54b48c819cb1f9c8b26..daa9d390c5c35991d5dd8265249e8d30663df49f 100644 (file)
@@ -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']) == ''))
index de379d2161f679ad3d59001c705974f772144c24..6ea50e2895cdd10030076169a38cf6982a974bd4 100644 (file)
@@ -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');
index 172dd0a6c83e7d1b38a351c46fdab368dd38b8fb..cee36ee56066e61c511021d64d951c38ec67a487 100644 (file)
@@ -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());
index fc4f2ad490ceed61e55ff8b7c052ff2ad9f8d60c..dd16339366058010c0288e3e6d2881002c757068 100644 (file)
@@ -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']) != ''))
index ec7aee21ce83d608976de7939771f4bf85f1a543..ac1890e0e6df80fb7ab22b917d2779ce1cd6d5f2 100644 (file)
@@ -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);
index f222202aab59432eb4e960589b2349306e537c22..3a948efd5d0493c11b55c80f3e932a663ecc44c2 100644 (file)
@@ -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;
index 3984c7d6d328133ec322fc886fc6136ad524f2a3..7a5b0ab86368907e0fd81bccd5249b16cf0394ac 100644 (file)
--- 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 {
index f2ac0d8617531667b8fa83f73d28af4c28fb3f1f..07aceb8465e2d93defadaad5c6463799042f7a58 100644 (file)
@@ -5,8 +5,6 @@ if($GLOBALS['enableGoogleCustomSearch']==false) {
     die;
 }
 
-$userservice = & ServiceFactory :: getServiceInstance('UserService');
-$currentUser = $userservice->getCurrentObjectUser();
 ?>
 
 <html>
index ccf198b83c22b4566f1bb0b58765349bb42d41ad..87952f6225d4e46f15f160087cbec1e1b1934036 100644 (file)
@@ -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;
 ?>
index e66973ce62bfc3bc7043b5bd0ba26a3212fed516..1891695c8b43cc681fc382855a2db3f5d8f036af 100644 (file)
@@ -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'] = '';
     }
index 8d051c85319fc04c4fa9798282e74651e589a189..adf89ad65456f69aec2a9cd043bc03e12f7b25bb 100644 (file)
@@ -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)) {
index 8a12ff8529d3e82525b066efe455c6704799df53..b72000196ca2211f09d99bb429a786dc59a64108 100644 (file)
@@ -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'] = '';
 
index eb3df86dcfb905ec1ded664e67e819dee560d609..ea4a1a517cf64dc78cb0cb8450f81961941cf686 100644 (file)
@@ -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) {
index 030f06e8e96e0cc85bf18e914699051781a815d5..fa890fa06dfe701aa2625ada3e4c0056166880f6 100644 (file)
--- 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');
index b1b9fcb5504b6afeccb83e746dddd9fb0694bf20..0fa820c0c92432ca93efcaeaa3cec02329c0b929 100644 (file)
--- 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;
index e3a87210084c8ff40da16a9518dd30102d424d23..430a355540d07eba93ba3175e23a2a92543c9b13 100644 (file)
 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 != '') {
 
index 80ed0ed3034e7a8a495878366b248144d13f21fd..3bdf139edab18e8511e07d431b0a4019910578d8 100644 (file)
@@ -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 != '') {
index df5ae7e13cdd8d09a5b27dd96c938304b7f2b9b5..56d651500a3d0bed88703edb0f3de0c80fc66607 100644 (file)
@@ -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
index aeaa18f7c3e9c0eff4a8b3086c92e432380dc629..9bee1dbcb479d2dcab994a05349328a2e574eb88 100644 (file)
@@ -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 08b45679a4146b6ef628ce39cb90356fe9d977df..3a2b54aaffcad7a3faa0002d35f042c94578a4ed 100644 (file)
--- 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;
                }
        }
index 273fc05ae7213122ece7dad45fa47b29e5c286af..56a910f7c46797214518e297c1d96f09704c663c 100644 (file)
@@ -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
index 07ce3a90b45448c6caf1aa556e33fd2080cc6376..15ee6af89cc47765ce1b3fd9e69bdce5a500ce30 100644 (file)
@@ -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']               = '';
index b62b6236be95bdf39ea1f7179a8ee72f521321d8..78016e7435366dcc1bfee27c072d3dd425ccb0bf 100644 (file)
@@ -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', '');
index e75553f09c29ff69a8609025cea28e4f9632a47c..c707253c83e7c788e86093a13bb4ec25cfee42f1 100644 (file)
@@ -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();
index 113c5bff4f388791da31a9aea513b74aa72efa29..3d13d66e30f7c2289ef2d45d54fc7a9fa2649a01 100644 (file)
@@ -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 */
index 8c4b1af53b3e2a3a0b329e0a15b093a7182b85ed..61d2546c04398b3dc8ea92d1e71bdf40f9009025 100644 (file)
@@ -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', '');
index cd248a50998dfd9c7d2ff4dfd2bfb75d8ce7d251..57a94660440a2ddcccab94335366c09e7c2dae70 100644 (file)
@@ -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', '');
index 3dde296c2adc0fcd8522047b059d8e763cc558c1..bead5e742668f688a700b3cff8eb8f989cf521d8 100644 (file)
@@ -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', '');
index 308069dce977c192cb1321ea4c82b08007686197..bee3092b11da68243896438fdd0018881ea66103 100644 (file)
--- 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'));
index a4bc7182c79ecaa1f6a33e77eed65d729ba1c013..77c34bc81b09bed956bbf6513f2151d9c6299505 100644 (file)
@@ -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']);
 ?>
 
index 35b97c7a8136dae108b2a33b5dcf1bd81967b221..ac288bdab27ecc2fd99d842b9eec1cec426a9f73 100644 (file)
@@ -1,9 +1,4 @@
 <?php\r
-
-/* Service creation: only useful services are created */\r
-$userservice =& ServiceFactory::getServiceInstance('UserService');
-
-$currentObjectUser = $userservice->getCurrentObjectUser();\r
 \r
 $this->includeTemplate($GLOBALS['top_include']);
 
@@ -18,7 +13,7 @@ foreach($users as $user) {
        echo '<a href="'.createURL('profile', $user->getUsername()).'">'.$user->getUsername().'</a>';\r
        echo '</div>';\r
 
-       if($user->getUsername() != $currentObjectUser->getUsername()) {\r
+       if($user->getUsername() != $currentUser->getUsername()) {\r
            echo '<div class="meta">';\r
            echo '<a href="'.createURL('admin','delete/'.$user->getUsername()).'" onclick="return confirm(\''.T_('Are you sure?').'\');">'.T_('Delete').'</a>';\r
            echo '</div>';
index ac3f5407f8a62e3b0d70a0c41afeb6954d313887..af5909a0675bc2de2e460aa985e108ad3053e297 100644 (file)
@@ -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>
index 341358d58c421599a21dee50899b5e92df66508e..efec24043c182cf867b3b1c504df600df1327895 100644 (file)
@@ -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
index b317e9f4a37f5613354e4cc37c75767d46e69c49..07e3ee97b2314ae8b0110e12c4b92f06ed608a67 100644 (file)
@@ -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();
 
index a544fb4d90e9c1f8b524d49987a81e3cbce5439b..a7a92ba570f6dd745f37171d1bdf4e8a26e36e6c 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-$userservice =& ServiceFactory::getServiceInstance('UserService');
 $this->includeTemplate($GLOBALS['top_include']);
 ?>
 
index efe75a8e55ae14419ab86d62a92223f870fa8ef1..13a8319235770003868b7d74ffac4beaec4c01ef 100644 (file)
@@ -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');
 
index 9012872ebd59d2adc32088ce8801096080708fb7..ed1069a83fab109d641ddb13e55bdb9615bc84ed 100644 (file)
@@ -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');
 
index 439ed3345ceffd7cd89ea42fb24e8f652d962426..8759f1b1a042364844f5af3f78b56aa10eaffbec 100644 (file)
@@ -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');
 
index b9c029f863f7365ec0c487ed382070a5c76b883e..42796204a26a9cbfa635585a3546401d45aacbaa 100644 (file)
@@ -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 (file)
index 4fd61ff..0000000
+++ /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>
-
-*/
-?>
index 9e4df083953a913cf7f1e56bb1bb393171edd158..71f9aa9cc185e0c32e4ba20f8bf4fd59ddae1d5e 100644 (file)
@@ -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;
index 81336f9d4f99c145d012844c99bf0d6346e3efe8..31c817ac98a0078aa96e17aa8242a1652a3214a2 100644 (file)
@@ -1,6 +1,7 @@
 <?php
+/* Service creation: only useful services are created */
 $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
-$userservice =& ServiceFactory::getServiceInstance('UserService');
+
 
 if(!isset($user)) $user="";
 
index 921b0b91280ee42f079faeca3a2fdcad78091dbe..7979ebfd92560c5a9b4a7aab179d5d4d82517cc6 100644 (file)
@@ -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();
index fd13d9830d8660168464218d1a678db4c0bea307..37bf5c6cd8c29cf1b26370fe3622306b56167336 100644 (file)
@@ -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);
index 7c61acc32ce7e8d24c677c5d48c5722e3c360c23..b6eef24d334018db2aa86b3f3181f2782316c7bf 100644 (file)
@@ -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) {
index e35fa763ea2606b0e1fe424c269963fffb5a7e9f..a42acbac66e19fc23065faed806f55cebcd7cb36 100644 (file)
@@ -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) {
index d9128467bf5cfddd9f193172da93d617c9607d98..99574aad73c7a5f39785f0ab6cf66c8c5e9091f1 100644 (file)
@@ -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');
index 158142ee4df852e4d0adb424121497f010754433..d3a006a693cb5d0f3d7bda6942742b149ed3e58c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 $this->includeTemplate($GLOBALS['top_include']);
-$userservice      = & ServiceFactory :: getServiceInstance('UserService');
+
 ?>
 <script type="text/javascript">
 window.onload = function() {
index fbfe48ce7e275f365e8952c903622038c180acb2..5edfbc7527074e83b5ebe0e9f5bd330b1f6d9520 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 $this->includeTemplate($GLOBALS['top_include']);
-$userservice      = & ServiceFactory :: getServiceInstance('UserService');
 ?>
 <script type="text/javascript">
 window.onload = function() {
index 0b052e09832e0da9ff476be4c7b01d170e43399a..a04b6a000b34110d54f19e880919e15f80b71363 100644 (file)
@@ -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): ?>\r
+       <?php if($currentUser->isAdmin()): ?>\r
         <li><a href="<?php echo createURL('admin', ''); ?>"><?php echo '['.T_('Admin').']'; ?></a></li>\r
        <?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>
index 7eee2546a2cb42418f507db91bd235a12135679c..a2fb606d6f18e04a4597098daded1700d981846b 100644 (file)
@@ -36,7 +36,6 @@ exit();
 /////////////////
 require_once('header.inc.php');
 $tagstatservice   = & ServiceFactory :: getServiceInstance('TagStatService');
-$templateservice  = & ServiceFactory :: getServiceInstance('TemplateService');
 ?>
 
 <h1>Upgrade</h1>
index c3ba8acefc4bc1582d8c31cdeb3838aa6e0283cf..959dfdb52a402536c0971d8f51424efa4865fd01 100644 (file)
--- 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');
 
index 11a0073d8b15c71f5dc10e06917a0a617a4222bd..9fc480b34ac6a39c1fcc17e80f6fba880bd0a41b 100644 (file)
--- 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)) {
index 323cb81203ef4f8cc499a8011cb65646f32ed296..d8249370e32d7630ed62fb44ba6be2f65c1837b0 100644 (file)
@@ -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