]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Refactoring: rename sc_tags into sc_bookmarks2tags (and services, codes...)
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Mon, 21 Apr 2008 08:44:44 +0000 (08:44 +0000)
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Mon, 21 Apr 2008 08:44:44 +0000 (08:44 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@116 b3834d28-1941-0410-a4f8-b48e95affb8f

27 files changed:
.htaccess
alltags.php
api/tags_get.php
api/tags_rename.php
bookmarkcommondescriptionedit.php
header.inc.php
populartags.php
services/bookmark2tagservice.php [moved from services/tagservice.php with 96% similarity]
services/bookmarkservice.php
tables.sql
tagcommondescriptionedit.php
tagdelete.php
tagrename.php
templates/dynamictags.inc.php
templates/sidebar.block.common.php
templates/sidebar.block.popular.php
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
tests/LAUNCH_TESTS
tests/bookmarksTest.php
tests/commonDescriptionTest.php
tests/searchTest.php
tests/tag2TagTest.php
upgrade.txt

index 323c2fa4c22f7fe6ea62a7f454dd6409f9b31299..8262b680167d37bb6e3857ca73d08074707c0f5e 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -1,16 +1,28 @@
 # this file is used if you configure your scuttle for nice urls
 # (see $cleanurls in config.inc.php)
 
-Options +FollowSymlinks
-# AcceptPathInfo On
-RewriteEngine On
-RewriteBase /
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule ^([^/]+)/?(.*)       $1.php/$2       [L]
+#Options +FollowSymlinks
+#RewriteEngine On
+#RewriteBase /
+#RewriteCond %{REQUEST_FILENAME} !-f
+#RewriteCond %{REQUEST_FILENAME} !-d
+#RewriteRule ^([^/]+)/?(.*)       $1.php/$2       [L]
 
 # If you have Scuttle in subdirectories e.g. http://www.example.com/myscuttle/links/
 # then you need to comment the precedent line and remove comment of the following one
 # (replace "myscuttle/links/" with your subdirectories name)
 
 #RewriteRule ^([^/]+)/?(.*)      myscuttle/links/$1.php/$2       [L]
+
+####
+
+# Rewrite clean URLs onto real files
+<IfModule mod_rewrite.c>
+Options +FollowSymlinks
+RewriteEngine On
+RewriteBase /
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{REQUEST_FILENAME}.php -f
+RewriteRule ^([^/]+)/?(.*) $1.php?query=$2 [L,QSA]
+</IfModule>
index 3805a3d16e6a86cefa895eae8737a30714d7def4..f2520a04f9d4bf047487da13c27328a0a7f26d30 100644 (file)
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 require_once('header.inc.php');
 $templateservice =& ServiceFactory::getServiceInstance('TemplateService');
-$tagservice =& ServiceFactory::getServiceInstance('TagService');
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
 $userservice =& ServiceFactory::getServiceInstance('UserService');
 $cacheservice =& ServiceFactory::getServiceInstance('CacheService');
 
@@ -65,8 +65,8 @@ if (isset($user) && $user != '') {
     $userid = NULL;
 }
 
-$tags =& $tagservice->getTags($userid);
-$tplVars['tags'] =& $tagservice->tagCloud($tags, 5, 90, 225, getSortOrder()); 
+$tags =& $b2tservice->getTags($userid);
+$tplVars['tags'] =& $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder()); 
 $tplVars['user'] = $user;
 
 if (isset($userid)) {
index 2584566127d8bce1eac4c470b5763d3103ae4a58..172dd0a6c83e7d1b38a351c46fdab368dd38b8fb 100644 (file)
@@ -8,11 +8,11 @@
 require_once('httpauth.inc.php');
 require_once('../header.inc.php');
 
-$tagservice =& ServiceFactory::getServiceInstance('TagService');
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
 $userservice =& ServiceFactory::getServiceInstance('UserService');
 
 // Get the tags relevant to the passed-in variables.
-$tags =& $tagservice->getTags($userservice->getCurrentUserId());
+$tags =& $b2tservice->getTags($userservice->getCurrentUserId());
 
 // Set up the XML file and output all the tags.
 header('Content-Type: text/xml');
@@ -22,4 +22,4 @@ foreach($tags as $row) {
     echo "\t<tag count=\"". $row['bCount'] .'" tag="'. filter(convertTag($row['tag'], 'out'), 'xml') ."\" />\r\n";
 }
 echo "</tags>";
-?>
\ No newline at end of file
+?>
index 20831e7166b130624e7fc664b44caa78612f68cd..fc4f2ad490ceed61e55ff8b7c052ff2ad9f8d60c 100644 (file)
@@ -8,7 +8,7 @@
 require_once('httpauth.inc.php');
 require_once('../header.inc.php');
 
-$tagservice =& ServiceFactory::getServiceInstance('TagService');
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
 $userservice =& ServiceFactory::getServiceInstance('UserService');
 
 // Get the tag info.
@@ -26,7 +26,7 @@ if (is_null($old) || is_null($new)) {
     $renamed = false;
 } else {
     // Rename the tag.
-    $result = $tagservice->renameTag($userservice->getCurrentUserId(), $old, $new, true);
+    $result = $b2tservice->renameTag($userservice->getCurrentUserId(), $old, $new, true);
     $renamed = $result;
 }
 
index 2abdf4f4d34a8e41ed1e3c132ece130426b14b08..c70dac0f1e3c44334f29d1a994da24602c67de36 100644 (file)
@@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 require_once('header.inc.php');
 $bookmarkservice  = & ServiceFactory :: getServiceInstance('BookmarkService');
-$tagservice       = & ServiceFactory :: getServiceInstance('TagService');
 $templateservice  = & ServiceFactory :: getServiceInstance('TemplateService');
 $userservice      = & ServiceFactory :: getServiceInstance('UserService');
 $cdservice        = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
index 55defdb93b254768ff8ee1dc2b1799c440e6f020..361d2337604feefbc974cf3fd601ff70fcd0460a 100644 (file)
@@ -26,10 +26,4 @@ if (!isset($root)) {
     }
     $root = 'http://'. $_SERVER['HTTP_HOST'] . $root;
 }
-
-// Error codes
-define('GENERAL_MESSAGE', 200);
-define('GENERAL_ERROR', 202);
-define('CRITICAL_MESSAGE', 203);
-define('CRITICAL_ERROR', 204);
 ?>
index 6bed82d503422ddcdc97cb7bfcb46ef78a0f82af..a51ff68a1da76a8e2d6d1865990d64defb948c28 100644 (file)
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 require_once('header.inc.php');
 $templateservice =& ServiceFactory::getServiceInstance('TemplateService');
-$tagservice =& ServiceFactory::getServiceInstance('TagService');
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
 $userservice =& ServiceFactory::getServiceInstance('UserService');
 $cacheservice =& ServiceFactory::getServiceInstance('CacheService');
 
@@ -66,8 +66,8 @@ if (isset($user) && $user != '') {
     $userid = NULL;
 }
 
-$tags = $tagservice->getPopularTags($userid, 150, $logged_on_userid);
-$tplVars['tags'] =& $tagservice->tagCloud($tags, 5, 90, 225, getSortOrder('alphabet_asc')); 
+$tags = $b2tservice->getPopularTags($userid, 150, $logged_on_userid);
+$tplVars['tags'] =& $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder('alphabet_asc')); 
 $tplVars['user'] = $user;
 
 if (isset($userid)) {
similarity index 96%
rename from services/tagservice.php
rename to services/bookmark2tagservice.php
index 1aba11e56c88cf7bee30445810d85c5ece2beece..148ad3a615172349828bcd1791c3ac453c853839 100644 (file)
@@ -1,18 +1,18 @@
 <?php
-class TagService {
+class Bookmark2TagService {
     var $db;
     var $tablename;
 
     function &getInstance(&$db) {
         static $instance;
         if (!isset($instance))
-            $instance =& new TagService($db);
+            $instance =& new Bookmark2TagService($db);
         return $instance;
     }
 
-    function TagService(&$db) {
+    function Bookmark2TagService(&$db) {
         $this->db =& $db;
-        $this->tablename = $GLOBALS['tableprefix'] .'tags';
+        $this->tablename = $GLOBALS['tableprefix'] .'bookmarks2tags';
     }
 
     function isNotSystemTag($var) {
@@ -204,7 +204,7 @@ class TagService {
         $userservice =& ServiceFactory::getServiceInstance('UserService');
         $logged_on_user = $userservice->getCurrentUserId();
 
-        $query = 'SELECT T.tag, COUNT(B.bId) AS bCount FROM '. $GLOBALS['tableprefix'] .'bookmarks AS B INNER JOIN '. $userservice->getTableName() .' AS U ON B.uId = U.'. $userservice->getFieldName('primary') .' INNER JOIN '. $GLOBALS['tableprefix'] .'tags AS T ON B.bId = T.bId';
+        $query = 'SELECT T.tag, COUNT(B.bId) AS bCount FROM '. $GLOBALS['tableprefix'] .'bookmarks AS B INNER JOIN '. $userservice->getTableName() .' AS U ON B.uId = U.'. $userservice->getFieldName('primary') .' INNER JOIN '. $GLOBALS['tableprefix'] .'bookmarks2tags AS T ON B.bId = T.bId';
 
         $conditions = array();
         if (!is_null($userid)) {
@@ -288,7 +288,7 @@ class TagService {
             $privacy = ' AND B.bStatus = 0 ';
         }
 
-        $query = 'SELECT T.tag, COUNT(T.tag) AS bCount FROM sc_bookmarks AS B LEFT JOIN sc_tags AS T ON B.bId = T.bId WHERE B.bHash = "'. $hash .'" '. $privacy .'AND LEFT(T.tag, 7) <> "system:" GROUP BY T.tag ORDER BY bCount DESC';
+        $query = 'SELECT T.tag, COUNT(T.tag) AS bCount FROM '.$GLOBALS['tableprefix'].'bookmarks AS B LEFT JOIN '.$GLOBALS['tableprefix'].'bookmarks2tags AS T ON B.bId = T.bId WHERE B.bHash = "'. $hash .'" '. $privacy .'AND LEFT(T.tag, 7) <> "system:" GROUP BY T.tag ORDER BY bCount DESC';
 
         if (!($dbresult =& $this->db->sql_query_limit($query, $limit))) {
             message_die(GENERAL_ERROR, 'Could not get related tags for this hash', '', __LINE__, __FILE__, $query, $this->db);
index 54c2773ef31e3376bbeb3081f3aa9c4fa3ed5d9f..5339004665cad122d51c4005db9fbd7715077f8c 100644 (file)
@@ -47,8 +47,8 @@ class BookmarkService {
 
         if ($row = & $this->db->sql_fetchrow($dbresult)) {
             if ($include_tags) {
-                $tagservice = & ServiceFactory :: getServiceInstance('TagService');
-                $row['tags'] = $tagservice->getTagsForBookmark($bid);
+                $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
+                $row['tags'] = $b2tservice->getTagsForBookmark($bid);
             }
             return $row;
         } else {
@@ -157,8 +157,8 @@ class BookmarkService {
         $extension = end($uriparts);
         unset($uriparts);
 
-        $tagservice = & ServiceFactory :: getServiceInstance('TagService');
-        if (!$tagservice->attachTags($bId, $categories, $fromApi, $extension, false, $fromImport)) {
+        $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
+        if (!$b2tservice->attachTags($bId, $categories, $fromApi, $extension, false, $fromImport)) {
             $this->db->sql_transaction('rollback');
             message_die(GENERAL_ERROR, 'Could not insert bookmark', '', __LINE__, __FILE__, $sql, $this->db);
             return false;
@@ -204,8 +204,8 @@ class BookmarkService {
         $extension = end($uriparts);
         unset($uriparts);
 
-        $tagservice = & ServiceFactory :: getServiceInstance('TagService');
-        if (!$tagservice->attachTags($bId, $categories, $fromApi, $extension)) {
+        $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
+        if (!$b2tservice->attachTags($bId, $categories, $fromApi, $extension)) {
             $this->db->sql_transaction('rollback');
             message_die(GENERAL_ERROR, 'Could not update bookmark', '', __LINE__, __FILE__, $sql, $this->db);
             return false;
@@ -226,7 +226,7 @@ class BookmarkService {
         //    bookmarks; otherwise, just get the public bookmarks.
         //  - if the $user is set and IS the logged-in user, then get all bookmarks.
         $userservice =& ServiceFactory::getServiceInstance('UserService');
-        $tagservice =& ServiceFactory::getServiceInstance('TagService');
+        $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
        $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
         $sId = $userservice->getCurrentUserId();
 
@@ -307,7 +307,7 @@ class BookmarkService {
         // Handle the parts of the query that depend on any tags that are present.
         $query_4 = '';
         for ($i = 0; $i < $tagcount; $i ++) {
-            $query_2 .= ', '. $tagservice->getTableName() .' AS T'. $i;
+            $query_2 .= ', '. $b2tservice->getTableName() .' AS T'. $i;
             $query_4 .= ' AND (';
 
            $allLinkedTags = $tag2tagservice->getAllLinkedTags($this->db->sql_escape($tags[$i]), '>', $user);
@@ -331,7 +331,7 @@ class BookmarkService {
 
             // Search terms in tags as well when none given
             if (!count($tags)) {
-                $query_2 .= ' LEFT JOIN '. $tagservice->getTableName() .' AS T ON B.bId = T.bId';
+                $query_2 .= ' LEFT JOIN '. $b2tservice->getTableName() .' AS T ON B.bId = T.bId';
                 $dotags = true;
             } else {
                 $dotags = false;
@@ -386,7 +386,7 @@ class BookmarkService {
 
         $bookmarks = array();
         while ($row = & $this->db->sql_fetchrow($dbresult)) {
-            $row['tags'] = $tagservice->getTagsForBookmark(intval($row['bId']));
+            $row['tags'] = $b2tservice->getTagsForBookmark(intval($row['bId']));
             $bookmarks[] = $row;
         }
         return array ('bookmarks' => $bookmarks, 'total' => $total);
index 92c42c722143f9317dd525797691e8e16349b4d6..8280ac3a0a2b33644b2bfa792c95ed2aa3898067 100644 (file)
@@ -1,5 +1,6 @@
 -- Semantice Scuttle - Tables creation SQL script
 -- ! Dont forget to change table names according to $tableprefix defined in config.inc.php !
+
 -- 
 -- Table structure for table `sc_bookmarks`
 -- 
@@ -28,12 +29,27 @@ CREATE TABLE `sc_bookmarks` (
 -- 
 
 CREATE TABLE `sc_tags` (
+  `tId` int(11) NOT NULL auto_increment,
+  `tag` varchar(32) NOT NULL default '',
+  `uId` int(11) NOT NULL default '0',
+  `tDescription` varchar(255) default NULL,
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `sc_tags_tag_uId` (`tag`, `uId`)
+);
+
+-- --------------------------------------------------------
+
+-- 
+-- Table structure for table `sc_bookmarks2tags`
+-- 
+
+CREATE TABLE `sc_bookmarks2tags` (
   `id` int(11) NOT NULL auto_increment,
   `bId` int(11) NOT NULL default '0',
   `tag` varchar(32) NOT NULL default '',
   PRIMARY KEY  (`id`),
-  UNIQUE KEY `sc_tags_tag_bId` (`tag`,`bId`),
-  KEY `sc_tags_bId` (`bId`)
+  UNIQUE KEY `sc_bookmarks2tags_tag_bId` (`tag`,`bId`),
+  KEY `sc_bookmarks2tags_bId` (`bId`)
 );
 
 -- --------------------------------------------------------
index bb167d8d664de2211359f271312ab26c9a5e35ac..4c77b146b203ddf6bedf8c2e0d0af7ed487a6dbc 100644 (file)
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ***************************************************************************/
 
 require_once('header.inc.php');
-$tagservice       = & ServiceFactory :: getServiceInstance('TagService');
+$b2tservice       = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
 $templateservice  = & ServiceFactory :: getServiceInstance('TemplateService');
 $userservice      = & ServiceFactory :: getServiceInstance('UserService');
 $cdservice        = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
index c5325c523907cf3d0f50609ec7a58cee607c70fc..efdca1631a9e591bfba4732ed8daa28a83ed787e 100644 (file)
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ***************************************************************************/
 
 require_once('header.inc.php');
-$tagservice = & ServiceFactory :: getServiceInstance('TagService');
+$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
 $templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
 $userservice = & ServiceFactory :: getServiceInstance('UserService');
 
@@ -29,7 +29,7 @@ $logged_on_user = $userservice->getCurrentUser();
 list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
 
 if ($_POST['confirm']) {
-    if ($tagservice->deleteTag($logged_on_user['uId'], $tag)) {
+    if ($b2tservice->deleteTag($logged_on_user['uId'], $tag)) {
         $tplVars['msg'] = T_('Tag deleted');        
         header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')]));
     } else {
index 18e9675618c8dd1b06c66476b617423bf8bf3ed5..23cb00b306abae724ba9cc05c59a0747224bf022 100644 (file)
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ***************************************************************************/
 
 require_once('header.inc.php');
-$tagservice       = & ServiceFactory :: getServiceInstance('TagService');
+$b2tservice       = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
 $tag2tagservice   = & ServiceFactory :: getServiceInstance('Tag2tagService');
 $templateservice  = & ServiceFactory :: getServiceInstance('TemplateService');
 $userservice      = & ServiceFactory :: getServiceInstance('UserService');
@@ -43,7 +43,7 @@ if ($_POST['confirm']) {
    if (
       !is_null($old) &&
       !is_null($new) &&
-      $tagservice->renameTag($userservice->getCurrentUserId(), $old, $new) &&
+      $b2tservice->renameTag($userservice->getCurrentUserId(), $old, $new) &&
       $tag2tagservice->renameTag($userservice->getCurrentUserId(), $old, $new)
    ) {
       $tplVars['msg'] = T_('Tag renamed');
index 5a85143d0165029a46b673d3e85a539b56575844..4bc0421843a388b7fc4f299c4ba2d2e37e985d97 100644 (file)
@@ -19,13 +19,13 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ***************************************************************************/
 
-$tagservice = & ServiceFactory :: getServiceInstance('TagService');
+$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
 $userservice = & ServiceFactory :: getServiceInstance('UserService');
 
 $logged_on_userid = $userservice->getCurrentUserId();
 
-$userPopularTags        =& $tagservice->getPopularTags($logged_on_userid, 25, $logged_on_userid);
-$userPopularTagsCloud   =& $tagservice->tagCloud($userPopularTags, 5, 90, 175); 
+$userPopularTags        =& $b2tservice->getPopularTags($logged_on_userid, 25, $logged_on_userid);
+$userPopularTagsCloud   =& $b2tservice->tagCloud($userPopularTags, 5, 90, 175); 
 $userPopularTagsCount   = count($userPopularTags);
 
 if ($userPopularTagsCount > 0) {
@@ -117,4 +117,4 @@ document.write('<\/div>');
 
 <?php
 }
-?>
\ No newline at end of file
+?>
index e92efa7693a063873d22a839ce08fc072fbb1816..dd3ce18ebef01c75401d0ae0429c3a7312013e47 100644 (file)
@@ -1,7 +1,7 @@
 <?php
-$tagservice =& ServiceFactory::getServiceInstance('TagService');
-$commonTags =& $tagservice->getRelatedTagsByHash($hash);
-$commonTags =& $tagservice->tagCloud($commonTags, 5, 90, 225, 'alphabet_asc'); 
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+$commonTags =& $b2tservice->getRelatedTagsByHash($hash);
+$commonTags =& $b2tservice->tagCloud($commonTags, 5, 90, 225, 'alphabet_asc'); 
 
 if ($commonTags && count($commonTags) > 0) {
 ?>
index 446e9b22b46b0e2e5d5f73fa152e0f3e7e6b1c40..cc5c73a138f8de174cf19260f4505c7c9bec919c 100644 (file)
@@ -1,13 +1,13 @@
 <?php
-$tagservice =& ServiceFactory::getServiceInstance('TagService');
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
 $userservice =& ServiceFactory::getServiceInstance('UserService');
 
 $logged_on_userid = $userservice->getCurrentUserId();
 if ($logged_on_userid === false) {
     $logged_on_userid = NULL;
 }
-$popularTags =& $tagservice->getPopularTags($userid, $popCount, $logged_on_userid);
-$popularTags =& $tagservice->tagCloud($popularTags, 5, 90, 225, 'alphabet_asc'); 
+$popularTags =& $b2tservice->getPopularTags($userid, $popCount, $logged_on_userid);
+$popularTags =& $b2tservice->tagCloud($popularTags, 5, 90, 225, 'alphabet_asc'); 
 
 if ($popularTags && count($popularTags) > 0) {
 ?>
index 58a9f844d98e19494536ab47f98dfa6bcf8bcebc..6d2547837eecb7dfc64359882f667cc022194336 100644 (file)
@@ -1,13 +1,13 @@
 <?php
-$tagservice =& ServiceFactory::getServiceInstance('TagService');
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
 $userservice =& ServiceFactory::getServiceInstance('UserService');
 
 $logged_on_userid = $userservice->getCurrentUserId();
 if ($logged_on_userid === false) {
     $logged_on_userid = NULL;
 }
-$recentTags = $tagservice->getPopularTags($userid, $popCount, $logged_on_userid, $GLOBALS['defaultRecentDays']);
-$recentTags =& $tagservice->tagCloud($recentTags, 5, 90, 225, 'alphabet_asc'); 
+$recentTags = $b2tservice->getPopularTags($userid, $popCount, $logged_on_userid, $GLOBALS['defaultRecentDays']);
+$recentTags =& $b2tservice->tagCloud($recentTags, 5, 90, 225, 'alphabet_asc'); 
 
 if ($recentTags && count($recentTags) > 0) {
 ?>
index fd305a65700c34d5e910818c30f218a8db8dc2ec..380c789e3ffcd3b30ad755ac49e89a7341da98c1 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-$tagservice =& ServiceFactory::getServiceInstance('TagService');
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
 $userservice =& ServiceFactory::getServiceInstance('UserService');
 
 $logged_on_userid = $userservice->getCurrentUserId();
@@ -10,7 +10,7 @@ if(strlen($user)==0) {
     $cat_url = createURL('tags', '%2$s');
 }
 if ($currenttag) {
-    $relatedTags = $tagservice->getRelatedTags($currenttag, $userid, $logged_on_userid);
+    $relatedTags = $b2tservice->getRelatedTags($currenttag, $userid, $logged_on_userid);
     if (sizeof($relatedTags) > 0) {
 ?>
 
index e9638d25fcb797b9c43d25ed5b2d480d48945e4c..8b00bb41be9acda71835b1ab4b96de782f3ee01e 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-$tagservice =& ServiceFactory::getServiceInstance('TagService');
 $userservice =& ServiceFactory::getServiceInstance('UserService');
 $searchhistoryservice =& ServiceFactory::getServiceInstance('SearchHistoryService');
 
index 907a61d9bfa183208bffa5f5a110fb89de7f6754..43d49228a3850738197b89cb2602a40fc15efd3a 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 $userservice =& ServiceFactory::getServiceInstance('UserService');
-$tagservice =& ServiceFactory::getServiceInstance('TagService');
 
 if ($userservice->isLoggedOn()) {
     $currentUser = $userservice->getCurrentUser();
index b2d5b4e782c70be0dbd8f50e1c6c37fd09aab3bf..813c163fcfc04e8bdf9d54d3ab1ca69befad3501 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-$tagservice =& ServiceFactory::getServiceInstance('TagService');
 $userservice =& ServiceFactory::getServiceInstance('UserService');
 
 $logged_on_userid = $userservice->getCurrentUserId();
index 52d4ba50f75cac4d950557c88903cca57373ff26..531d239b56b621ff7baed0432999fc9426473edf 100644 (file)
@@ -4,4 +4,4 @@ Then
 
 To launch the tests, put in a console situated in the root of the SEMANTICSCUTTLE project (where is the SEMANTICSCUTTLE config file):
 
-phpunit BookmarksTest ./tests/bookmarksTest.php ; phpunit CommonDescriptionTest tests/commonDescriptionTest.php ; phpunit Tag2TagTest tests/tag2TagTest.php ; phpunit SearchTest tests/searchTest.php
+phpunit BookmarksTest ./tests/bookmarksTest.php ; phpunit CommonDescriptionTest tests/commonDescriptionTest.php ; phpunit Tag2TagTest tests/tag2TagTest.php ; phpunit SearchTest tests/searchTest.php ; phpunit TagsTest tests/tagsTest.php
index ac6a79f22875ce246b79a29feb33625c156153e1..9c8e533c7a8b754f167380fce642915c200413ca 100644 (file)
@@ -22,8 +22,8 @@ class BookmarksTest extends PHPUnit_Framework_TestCase
        $this->us =& ServiceFactory::getServiceInstance('UserService');
        $this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
        $this->bs->deleteAll();
-       $this->ts =& ServiceFactory::getServiceInstance('TagService');
-       $this->ts->deleteAll();
+       $this->b2ts=& ServiceFactory::getServiceInstance('Bookmark2TagService');
+       $this->b2ts->deleteAll();
        $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
        $this->tts->deleteAll(); 
        $this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
index 4de4d84da2f0daab1aa707d7f789cc7a7791fa50..c8666c2d37b4eaddc099a0ae9cb66674b24c06be 100644 (file)
@@ -11,7 +11,7 @@ class CommonDescriptionTest extends PHPUnit_Framework_TestCase
 {
     protected $us;
     protected $bs;
-    protected $ts;
+    protected $b2ts;
     protected $tts;
     protected $tsts;
     protected $cds;
@@ -24,8 +24,8 @@ class CommonDescriptionTest extends PHPUnit_Framework_TestCase
        $this->us =& ServiceFactory::getServiceInstance('UserService');
        $this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
        $this->bs->deleteAll();
-       $this->ts =& ServiceFactory::getServiceInstance('TagService');
-       $this->ts->deleteAll();
+       $this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+       $this->b2ts->deleteAll();
        $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
        $this->tts->deleteAll(); 
        $this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
index ecdc6ad76856e52dd103c490b7790aae9b2291ed..2e517178e67cd9ed83909adbe0ae4f14e6148f0c 100644 (file)
@@ -11,7 +11,7 @@ class SearchTest extends PHPUnit_Framework_TestCase
 {
     protected $us;
     protected $bs;
-    protected $ts;
+    protected $b2ts;
     protected $tts;
     protected $shs;
  
@@ -23,8 +23,8 @@ class SearchTest extends PHPUnit_Framework_TestCase
        $this->us =& ServiceFactory::getServiceInstance('UserService');
        $this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
        $this->bs->deleteAll();
-       $this->ts =& ServiceFactory::getServiceInstance('TagService');
-       $this->ts->deleteAll();
+       $this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+       $this->b2ts->deleteAll();
        $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
        $this->tts->deleteAll(); 
        $this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
index 70925bd07734d320f26f0c4efba4cc97e89535b8..3f686a49a203c3edab044b3217916e5b57baa4d6 100644 (file)
@@ -11,7 +11,7 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
 {
     protected $us;
     protected $bs;
-    protected $ts;
+    protected $b2ts;
     protected $tts;
  
     protected function setUp()
@@ -22,8 +22,8 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
        $this->us =& ServiceFactory::getServiceInstance('UserService');
        $this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
        $this->bs->deleteAll();
-       $this->ts =& ServiceFactory::getServiceInstance('TagService');
-       $this->ts->deleteAll();
+       $this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+       $this->b2ts->deleteAll();
        $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
        $this->tts->deleteAll(); 
        $this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
@@ -237,8 +237,8 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
        $bs->addBookmark("http://google.com", "title", "description", "status", $tags, null, false, false, 1);
        $bookmark = $bs->getBookmarkByAddress("http://google.com");
 
-       $ts = $this->ts;
-       $savedTags = $ts->getTagsForBookmark(intval($bookmark['bId']));
+       $b2ts = $this->b2ts;
+       $savedTags = $b2ts->getTagsForBookmark(intval($bookmark['bId']));
        $this->assertEquals(6, sizeof($savedTags));
        $this->assertContains('b', $savedTags);
        $this->assertContains('c', $savedTags);
@@ -425,7 +425,7 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
     public function testRenameFunction()
     {
        $tts = $this->tts;
-       $ts = $this->ts;
+       $b2ts = $this->b2ts;
        $bs = $this->bs;
        $tsts = $this->tsts;
 
@@ -436,10 +436,10 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
        $bookmarks =& $bs->getBookmarks(0, 1, NULL, NULL, NULL, getSortOrder(), NULL, 0, $dtend);
        $this->assertEquals(1, $bookmarks['total']);
 
-       $ts->renameTag(1, 'tag1', 'newtag1');
-       $tags1 = $ts->getTagsForBookmark(1);
+       $b2ts->renameTag(1, 'tag1', 'newtag1');
+       $tags1 = $b2ts->getTagsForBookmark(1);
        $this->assertSame(array('newtag1', 'tag11', 'tag111'), $tags1);
-       $tags1 = $ts->getTagsForBookmark(2);
+       $tags1 = $b2ts->getTagsForBookmark(2);
        $this->assertSame(array('tag2', 'tag22', 'tag222'), $tags1); //should not be changed
        
 
index 9891ac90bca238910909ccb12e6ca069cb4e3cc6..11464eb4dfedf47a989921b0d404866bec90f32c 100644 (file)
@@ -3,7 +3,15 @@
 === From version 0.88 to 0.89 ===
 - Backup you database
 - Make a copy from your SemanticScuttle Web directory
-- Upgrade your database : add the following table (adapt its name prefix to your convenience) executin the following SQL commands:
+- Upgrade your database :
+
+
+* change the table called 'sc_tags' into 'sc_bookmarks2tags' by executing the following SQL commands (after changing 'yourdatabasename' and adapting its name prefix 'sc_' to your convenience):
+
+       RENAME TABLE `yourdatabasename`.`sc_tags`  TO `yourdatabasename`.`sc_bookmarks2tags` ;
+
+
+* add the following table (adapt its name prefix to your convenience) executing the following SQL commands:
 
        CREATE TABLE `sc_searchhistory` (
          `shId` int(11) NOT NULL auto_increment,