Refactoring: rename sc_tags into sc_bookmarks2tags (and services, codes...)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@116 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
81478ceba0
commit
4de56ed662
27 changed files with 111 additions and 85 deletions
26
.htaccess
26
.htaccess
|
@ -1,16 +1,28 @@
|
||||||
# this file is used if you configure your scuttle for nice urls
|
# this file is used if you configure your scuttle for nice urls
|
||||||
# (see $cleanurls in config.inc.php)
|
# (see $cleanurls in config.inc.php)
|
||||||
|
|
||||||
Options +FollowSymlinks
|
#Options +FollowSymlinks
|
||||||
# AcceptPathInfo On
|
#RewriteEngine On
|
||||||
RewriteEngine On
|
#RewriteBase /
|
||||||
RewriteBase /
|
#RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
#RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
#RewriteRule ^([^/]+)/?(.*) $1.php/$2 [L]
|
||||||
RewriteRule ^([^/]+)/?(.*) $1.php/$2 [L]
|
|
||||||
|
|
||||||
# If you have Scuttle in subdirectories e.g. http://www.example.com/myscuttle/links/
|
# 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
|
# then you need to comment the precedent line and remove comment of the following one
|
||||||
# (replace "myscuttle/links/" with your subdirectories name)
|
# (replace "myscuttle/links/" with your subdirectories name)
|
||||||
|
|
||||||
#RewriteRule ^([^/]+)/?(.*) myscuttle/links/$1.php/$2 [L]
|
#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>
|
||||||
|
|
|
@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
require_once('header.inc.php');
|
require_once('header.inc.php');
|
||||||
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
|
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
|
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
|
||||||
|
|
||||||
|
@ -65,8 +65,8 @@ if (isset($user) && $user != '') {
|
||||||
$userid = NULL;
|
$userid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tags =& $tagservice->getTags($userid);
|
$tags =& $b2tservice->getTags($userid);
|
||||||
$tplVars['tags'] =& $tagservice->tagCloud($tags, 5, 90, 225, getSortOrder());
|
$tplVars['tags'] =& $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder());
|
||||||
$tplVars['user'] = $user;
|
$tplVars['user'] = $user;
|
||||||
|
|
||||||
if (isset($userid)) {
|
if (isset($userid)) {
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
require_once('httpauth.inc.php');
|
require_once('httpauth.inc.php');
|
||||||
require_once('../header.inc.php');
|
require_once('../header.inc.php');
|
||||||
|
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
|
|
||||||
// Get the tags relevant to the passed-in variables.
|
// 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.
|
// Set up the XML file and output all the tags.
|
||||||
header('Content-Type: text/xml');
|
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 "\t<tag count=\"". $row['bCount'] .'" tag="'. filter(convertTag($row['tag'], 'out'), 'xml') ."\" />\r\n";
|
||||||
}
|
}
|
||||||
echo "</tags>";
|
echo "</tags>";
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
require_once('httpauth.inc.php');
|
require_once('httpauth.inc.php');
|
||||||
require_once('../header.inc.php');
|
require_once('../header.inc.php');
|
||||||
|
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
|
|
||||||
// Get the tag info.
|
// Get the tag info.
|
||||||
|
@ -26,7 +26,7 @@ if (is_null($old) || is_null($new)) {
|
||||||
$renamed = false;
|
$renamed = false;
|
||||||
} else {
|
} else {
|
||||||
// Rename the tag.
|
// Rename the tag.
|
||||||
$result = $tagservice->renameTag($userservice->getCurrentUserId(), $old, $new, true);
|
$result = $b2tservice->renameTag($userservice->getCurrentUserId(), $old, $new, true);
|
||||||
$renamed = $result;
|
$renamed = $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
require_once('header.inc.php');
|
require_once('header.inc.php');
|
||||||
$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
|
$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
|
||||||
$tagservice = & ServiceFactory :: getServiceInstance('TagService');
|
|
||||||
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
|
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
|
||||||
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
||||||
$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
|
$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
|
||||||
|
|
|
@ -26,10 +26,4 @@ if (!isset($root)) {
|
||||||
}
|
}
|
||||||
$root = 'http://'. $_SERVER['HTTP_HOST'] . $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);
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
require_once('header.inc.php');
|
require_once('header.inc.php');
|
||||||
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
|
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
|
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ if (isset($user) && $user != '') {
|
||||||
$userid = NULL;
|
$userid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tags = $tagservice->getPopularTags($userid, 150, $logged_on_userid);
|
$tags = $b2tservice->getPopularTags($userid, 150, $logged_on_userid);
|
||||||
$tplVars['tags'] =& $tagservice->tagCloud($tags, 5, 90, 225, getSortOrder('alphabet_asc'));
|
$tplVars['tags'] =& $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder('alphabet_asc'));
|
||||||
$tplVars['user'] = $user;
|
$tplVars['user'] = $user;
|
||||||
|
|
||||||
if (isset($userid)) {
|
if (isset($userid)) {
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
class TagService {
|
class Bookmark2TagService {
|
||||||
var $db;
|
var $db;
|
||||||
var $tablename;
|
var $tablename;
|
||||||
|
|
||||||
function &getInstance(&$db) {
|
function &getInstance(&$db) {
|
||||||
static $instance;
|
static $instance;
|
||||||
if (!isset($instance))
|
if (!isset($instance))
|
||||||
$instance =& new TagService($db);
|
$instance =& new Bookmark2TagService($db);
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
function TagService(&$db) {
|
function Bookmark2TagService(&$db) {
|
||||||
$this->db =& $db;
|
$this->db =& $db;
|
||||||
$this->tablename = $GLOBALS['tableprefix'] .'tags';
|
$this->tablename = $GLOBALS['tableprefix'] .'bookmarks2tags';
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNotSystemTag($var) {
|
function isNotSystemTag($var) {
|
||||||
|
@ -204,7 +204,7 @@ class TagService {
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
$logged_on_user = $userservice->getCurrentUserId();
|
$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();
|
$conditions = array();
|
||||||
if (!is_null($userid)) {
|
if (!is_null($userid)) {
|
||||||
|
@ -288,7 +288,7 @@ class TagService {
|
||||||
$privacy = ' AND B.bStatus = 0 ';
|
$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))) {
|
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);
|
message_die(GENERAL_ERROR, 'Could not get related tags for this hash', '', __LINE__, __FILE__, $query, $this->db);
|
|
@ -47,8 +47,8 @@ class BookmarkService {
|
||||||
|
|
||||||
if ($row = & $this->db->sql_fetchrow($dbresult)) {
|
if ($row = & $this->db->sql_fetchrow($dbresult)) {
|
||||||
if ($include_tags) {
|
if ($include_tags) {
|
||||||
$tagservice = & ServiceFactory :: getServiceInstance('TagService');
|
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
|
||||||
$row['tags'] = $tagservice->getTagsForBookmark($bid);
|
$row['tags'] = $b2tservice->getTagsForBookmark($bid);
|
||||||
}
|
}
|
||||||
return $row;
|
return $row;
|
||||||
} else {
|
} else {
|
||||||
|
@ -157,8 +157,8 @@ class BookmarkService {
|
||||||
$extension = end($uriparts);
|
$extension = end($uriparts);
|
||||||
unset($uriparts);
|
unset($uriparts);
|
||||||
|
|
||||||
$tagservice = & ServiceFactory :: getServiceInstance('TagService');
|
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
|
||||||
if (!$tagservice->attachTags($bId, $categories, $fromApi, $extension, false, $fromImport)) {
|
if (!$b2tservice->attachTags($bId, $categories, $fromApi, $extension, false, $fromImport)) {
|
||||||
$this->db->sql_transaction('rollback');
|
$this->db->sql_transaction('rollback');
|
||||||
message_die(GENERAL_ERROR, 'Could not insert bookmark', '', __LINE__, __FILE__, $sql, $this->db);
|
message_die(GENERAL_ERROR, 'Could not insert bookmark', '', __LINE__, __FILE__, $sql, $this->db);
|
||||||
return false;
|
return false;
|
||||||
|
@ -204,8 +204,8 @@ class BookmarkService {
|
||||||
$extension = end($uriparts);
|
$extension = end($uriparts);
|
||||||
unset($uriparts);
|
unset($uriparts);
|
||||||
|
|
||||||
$tagservice = & ServiceFactory :: getServiceInstance('TagService');
|
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
|
||||||
if (!$tagservice->attachTags($bId, $categories, $fromApi, $extension)) {
|
if (!$b2tservice->attachTags($bId, $categories, $fromApi, $extension)) {
|
||||||
$this->db->sql_transaction('rollback');
|
$this->db->sql_transaction('rollback');
|
||||||
message_die(GENERAL_ERROR, 'Could not update bookmark', '', __LINE__, __FILE__, $sql, $this->db);
|
message_die(GENERAL_ERROR, 'Could not update bookmark', '', __LINE__, __FILE__, $sql, $this->db);
|
||||||
return false;
|
return false;
|
||||||
|
@ -226,7 +226,7 @@ class BookmarkService {
|
||||||
// bookmarks; otherwise, just get the public bookmarks.
|
// bookmarks; otherwise, just get the public bookmarks.
|
||||||
// - if the $user is set and IS the logged-in user, then get all bookmarks.
|
// - if the $user is set and IS the logged-in user, then get all bookmarks.
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
|
$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
|
||||||
$sId = $userservice->getCurrentUserId();
|
$sId = $userservice->getCurrentUserId();
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ class BookmarkService {
|
||||||
// Handle the parts of the query that depend on any tags that are present.
|
// Handle the parts of the query that depend on any tags that are present.
|
||||||
$query_4 = '';
|
$query_4 = '';
|
||||||
for ($i = 0; $i < $tagcount; $i ++) {
|
for ($i = 0; $i < $tagcount; $i ++) {
|
||||||
$query_2 .= ', '. $tagservice->getTableName() .' AS T'. $i;
|
$query_2 .= ', '. $b2tservice->getTableName() .' AS T'. $i;
|
||||||
$query_4 .= ' AND (';
|
$query_4 .= ' AND (';
|
||||||
|
|
||||||
$allLinkedTags = $tag2tagservice->getAllLinkedTags($this->db->sql_escape($tags[$i]), '>', $user);
|
$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
|
// Search terms in tags as well when none given
|
||||||
if (!count($tags)) {
|
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;
|
$dotags = true;
|
||||||
} else {
|
} else {
|
||||||
$dotags = false;
|
$dotags = false;
|
||||||
|
@ -386,7 +386,7 @@ class BookmarkService {
|
||||||
|
|
||||||
$bookmarks = array();
|
$bookmarks = array();
|
||||||
while ($row = & $this->db->sql_fetchrow($dbresult)) {
|
while ($row = & $this->db->sql_fetchrow($dbresult)) {
|
||||||
$row['tags'] = $tagservice->getTagsForBookmark(intval($row['bId']));
|
$row['tags'] = $b2tservice->getTagsForBookmark(intval($row['bId']));
|
||||||
$bookmarks[] = $row;
|
$bookmarks[] = $row;
|
||||||
}
|
}
|
||||||
return array ('bookmarks' => $bookmarks, 'total' => $total);
|
return array ('bookmarks' => $bookmarks, 'total' => $total);
|
||||||
|
|
20
tables.sql
20
tables.sql
|
@ -1,5 +1,6 @@
|
||||||
-- Semantice Scuttle - Tables creation SQL script
|
-- Semantice Scuttle - Tables creation SQL script
|
||||||
-- ! Dont forget to change table names according to $tableprefix defined in config.inc.php !
|
-- ! Dont forget to change table names according to $tableprefix defined in config.inc.php !
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `sc_bookmarks`
|
-- Table structure for table `sc_bookmarks`
|
||||||
--
|
--
|
||||||
|
@ -28,12 +29,27 @@ CREATE TABLE `sc_bookmarks` (
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE `sc_tags` (
|
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,
|
`id` int(11) NOT NULL auto_increment,
|
||||||
`bId` int(11) NOT NULL default '0',
|
`bId` int(11) NOT NULL default '0',
|
||||||
`tag` varchar(32) NOT NULL default '',
|
`tag` varchar(32) NOT NULL default '',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `sc_tags_tag_bId` (`tag`,`bId`),
|
UNIQUE KEY `sc_bookmarks2tags_tag_bId` (`tag`,`bId`),
|
||||||
KEY `sc_tags_bId` (`bId`)
|
KEY `sc_bookmarks2tags_bId` (`bId`)
|
||||||
);
|
);
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
require_once('header.inc.php');
|
require_once('header.inc.php');
|
||||||
$tagservice = & ServiceFactory :: getServiceInstance('TagService');
|
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
|
||||||
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
|
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
|
||||||
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
||||||
$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
|
$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
|
||||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
require_once('header.inc.php');
|
require_once('header.inc.php');
|
||||||
$tagservice = & ServiceFactory :: getServiceInstance('TagService');
|
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
|
||||||
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
|
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
|
||||||
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ $logged_on_user = $userservice->getCurrentUser();
|
||||||
list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
|
list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
|
||||||
|
|
||||||
if ($_POST['confirm']) {
|
if ($_POST['confirm']) {
|
||||||
if ($tagservice->deleteTag($logged_on_user['uId'], $tag)) {
|
if ($b2tservice->deleteTag($logged_on_user['uId'], $tag)) {
|
||||||
$tplVars['msg'] = T_('Tag deleted');
|
$tplVars['msg'] = T_('Tag deleted');
|
||||||
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')]));
|
header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')]));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
require_once('header.inc.php');
|
require_once('header.inc.php');
|
||||||
$tagservice = & ServiceFactory :: getServiceInstance('TagService');
|
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
|
||||||
$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2tagService');
|
$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2tagService');
|
||||||
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
|
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
|
||||||
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
||||||
|
@ -43,7 +43,7 @@ if ($_POST['confirm']) {
|
||||||
if (
|
if (
|
||||||
!is_null($old) &&
|
!is_null($old) &&
|
||||||
!is_null($new) &&
|
!is_null($new) &&
|
||||||
$tagservice->renameTag($userservice->getCurrentUserId(), $old, $new) &&
|
$b2tservice->renameTag($userservice->getCurrentUserId(), $old, $new) &&
|
||||||
$tag2tagservice->renameTag($userservice->getCurrentUserId(), $old, $new)
|
$tag2tagservice->renameTag($userservice->getCurrentUserId(), $old, $new)
|
||||||
) {
|
) {
|
||||||
$tplVars['msg'] = T_('Tag renamed');
|
$tplVars['msg'] = T_('Tag renamed');
|
||||||
|
|
|
@ -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
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
$tagservice = & ServiceFactory :: getServiceInstance('TagService');
|
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
|
||||||
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
||||||
|
|
||||||
$logged_on_userid = $userservice->getCurrentUserId();
|
$logged_on_userid = $userservice->getCurrentUserId();
|
||||||
|
|
||||||
$userPopularTags =& $tagservice->getPopularTags($logged_on_userid, 25, $logged_on_userid);
|
$userPopularTags =& $b2tservice->getPopularTags($logged_on_userid, 25, $logged_on_userid);
|
||||||
$userPopularTagsCloud =& $tagservice->tagCloud($userPopularTags, 5, 90, 175);
|
$userPopularTagsCloud =& $b2tservice->tagCloud($userPopularTags, 5, 90, 175);
|
||||||
$userPopularTagsCount = count($userPopularTags);
|
$userPopularTagsCount = count($userPopularTags);
|
||||||
|
|
||||||
if ($userPopularTagsCount > 0) {
|
if ($userPopularTagsCount > 0) {
|
||||||
|
@ -117,4 +117,4 @@ document.write('<\/div>');
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$commonTags =& $tagservice->getRelatedTagsByHash($hash);
|
$commonTags =& $b2tservice->getRelatedTagsByHash($hash);
|
||||||
$commonTags =& $tagservice->tagCloud($commonTags, 5, 90, 225, 'alphabet_asc');
|
$commonTags =& $b2tservice->tagCloud($commonTags, 5, 90, 225, 'alphabet_asc');
|
||||||
|
|
||||||
if ($commonTags && count($commonTags) > 0) {
|
if ($commonTags && count($commonTags) > 0) {
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
|
|
||||||
$logged_on_userid = $userservice->getCurrentUserId();
|
$logged_on_userid = $userservice->getCurrentUserId();
|
||||||
if ($logged_on_userid === false) {
|
if ($logged_on_userid === false) {
|
||||||
$logged_on_userid = NULL;
|
$logged_on_userid = NULL;
|
||||||
}
|
}
|
||||||
$popularTags =& $tagservice->getPopularTags($userid, $popCount, $logged_on_userid);
|
$popularTags =& $b2tservice->getPopularTags($userid, $popCount, $logged_on_userid);
|
||||||
$popularTags =& $tagservice->tagCloud($popularTags, 5, 90, 225, 'alphabet_asc');
|
$popularTags =& $b2tservice->tagCloud($popularTags, 5, 90, 225, 'alphabet_asc');
|
||||||
|
|
||||||
if ($popularTags && count($popularTags) > 0) {
|
if ($popularTags && count($popularTags) > 0) {
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
|
|
||||||
$logged_on_userid = $userservice->getCurrentUserId();
|
$logged_on_userid = $userservice->getCurrentUserId();
|
||||||
if ($logged_on_userid === false) {
|
if ($logged_on_userid === false) {
|
||||||
$logged_on_userid = NULL;
|
$logged_on_userid = NULL;
|
||||||
}
|
}
|
||||||
$recentTags = $tagservice->getPopularTags($userid, $popCount, $logged_on_userid, $GLOBALS['defaultRecentDays']);
|
$recentTags = $b2tservice->getPopularTags($userid, $popCount, $logged_on_userid, $GLOBALS['defaultRecentDays']);
|
||||||
$recentTags =& $tagservice->tagCloud($recentTags, 5, 90, 225, 'alphabet_asc');
|
$recentTags =& $b2tservice->tagCloud($recentTags, 5, 90, 225, 'alphabet_asc');
|
||||||
|
|
||||||
if ($recentTags && count($recentTags) > 0) {
|
if ($recentTags && count($recentTags) > 0) {
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
|
|
||||||
$logged_on_userid = $userservice->getCurrentUserId();
|
$logged_on_userid = $userservice->getCurrentUserId();
|
||||||
|
@ -10,7 +10,7 @@ if(strlen($user)==0) {
|
||||||
$cat_url = createURL('tags', '%2$s');
|
$cat_url = createURL('tags', '%2$s');
|
||||||
}
|
}
|
||||||
if ($currenttag) {
|
if ($currenttag) {
|
||||||
$relatedTags = $tagservice->getRelatedTags($currenttag, $userid, $logged_on_userid);
|
$relatedTags = $b2tservice->getRelatedTags($currenttag, $userid, $logged_on_userid);
|
||||||
if (sizeof($relatedTags) > 0) {
|
if (sizeof($relatedTags) > 0) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
$searchhistoryservice =& ServiceFactory::getServiceInstance('SearchHistoryService');
|
$searchhistoryservice =& ServiceFactory::getServiceInstance('SearchHistoryService');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
|
||||||
|
|
||||||
if ($userservice->isLoggedOn()) {
|
if ($userservice->isLoggedOn()) {
|
||||||
$currentUser = $userservice->getCurrentUser();
|
$currentUser = $userservice->getCurrentUser();
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
|
||||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||||
|
|
||||||
$logged_on_userid = $userservice->getCurrentUserId();
|
$logged_on_userid = $userservice->getCurrentUserId();
|
||||||
|
|
|
@ -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):
|
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
|
||||||
|
|
|
@ -22,8 +22,8 @@ class BookmarksTest extends PHPUnit_Framework_TestCase
|
||||||
$this->us =& ServiceFactory::getServiceInstance('UserService');
|
$this->us =& ServiceFactory::getServiceInstance('UserService');
|
||||||
$this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
|
$this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
|
||||||
$this->bs->deleteAll();
|
$this->bs->deleteAll();
|
||||||
$this->ts =& ServiceFactory::getServiceInstance('TagService');
|
$this->b2ts=& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$this->ts->deleteAll();
|
$this->b2ts->deleteAll();
|
||||||
$this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
|
$this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
|
||||||
$this->tts->deleteAll();
|
$this->tts->deleteAll();
|
||||||
$this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
|
$this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
|
||||||
|
|
|
@ -11,7 +11,7 @@ class CommonDescriptionTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected $us;
|
protected $us;
|
||||||
protected $bs;
|
protected $bs;
|
||||||
protected $ts;
|
protected $b2ts;
|
||||||
protected $tts;
|
protected $tts;
|
||||||
protected $tsts;
|
protected $tsts;
|
||||||
protected $cds;
|
protected $cds;
|
||||||
|
@ -24,8 +24,8 @@ class CommonDescriptionTest extends PHPUnit_Framework_TestCase
|
||||||
$this->us =& ServiceFactory::getServiceInstance('UserService');
|
$this->us =& ServiceFactory::getServiceInstance('UserService');
|
||||||
$this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
|
$this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
|
||||||
$this->bs->deleteAll();
|
$this->bs->deleteAll();
|
||||||
$this->ts =& ServiceFactory::getServiceInstance('TagService');
|
$this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$this->ts->deleteAll();
|
$this->b2ts->deleteAll();
|
||||||
$this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
|
$this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
|
||||||
$this->tts->deleteAll();
|
$this->tts->deleteAll();
|
||||||
$this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
|
$this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
|
||||||
|
|
|
@ -11,7 +11,7 @@ class SearchTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected $us;
|
protected $us;
|
||||||
protected $bs;
|
protected $bs;
|
||||||
protected $ts;
|
protected $b2ts;
|
||||||
protected $tts;
|
protected $tts;
|
||||||
protected $shs;
|
protected $shs;
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ class SearchTest extends PHPUnit_Framework_TestCase
|
||||||
$this->us =& ServiceFactory::getServiceInstance('UserService');
|
$this->us =& ServiceFactory::getServiceInstance('UserService');
|
||||||
$this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
|
$this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
|
||||||
$this->bs->deleteAll();
|
$this->bs->deleteAll();
|
||||||
$this->ts =& ServiceFactory::getServiceInstance('TagService');
|
$this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$this->ts->deleteAll();
|
$this->b2ts->deleteAll();
|
||||||
$this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
|
$this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
|
||||||
$this->tts->deleteAll();
|
$this->tts->deleteAll();
|
||||||
$this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
|
$this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected $us;
|
protected $us;
|
||||||
protected $bs;
|
protected $bs;
|
||||||
protected $ts;
|
protected $b2ts;
|
||||||
protected $tts;
|
protected $tts;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
|
@ -22,8 +22,8 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
|
||||||
$this->us =& ServiceFactory::getServiceInstance('UserService');
|
$this->us =& ServiceFactory::getServiceInstance('UserService');
|
||||||
$this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
|
$this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
|
||||||
$this->bs->deleteAll();
|
$this->bs->deleteAll();
|
||||||
$this->ts =& ServiceFactory::getServiceInstance('TagService');
|
$this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService');
|
||||||
$this->ts->deleteAll();
|
$this->b2ts->deleteAll();
|
||||||
$this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
|
$this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
|
||||||
$this->tts->deleteAll();
|
$this->tts->deleteAll();
|
||||||
$this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
|
$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);
|
$bs->addBookmark("http://google.com", "title", "description", "status", $tags, null, false, false, 1);
|
||||||
$bookmark = $bs->getBookmarkByAddress("http://google.com");
|
$bookmark = $bs->getBookmarkByAddress("http://google.com");
|
||||||
|
|
||||||
$ts = $this->ts;
|
$b2ts = $this->b2ts;
|
||||||
$savedTags = $ts->getTagsForBookmark(intval($bookmark['bId']));
|
$savedTags = $b2ts->getTagsForBookmark(intval($bookmark['bId']));
|
||||||
$this->assertEquals(6, sizeof($savedTags));
|
$this->assertEquals(6, sizeof($savedTags));
|
||||||
$this->assertContains('b', $savedTags);
|
$this->assertContains('b', $savedTags);
|
||||||
$this->assertContains('c', $savedTags);
|
$this->assertContains('c', $savedTags);
|
||||||
|
@ -425,7 +425,7 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
|
||||||
public function testRenameFunction()
|
public function testRenameFunction()
|
||||||
{
|
{
|
||||||
$tts = $this->tts;
|
$tts = $this->tts;
|
||||||
$ts = $this->ts;
|
$b2ts = $this->b2ts;
|
||||||
$bs = $this->bs;
|
$bs = $this->bs;
|
||||||
$tsts = $this->tsts;
|
$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);
|
$bookmarks =& $bs->getBookmarks(0, 1, NULL, NULL, NULL, getSortOrder(), NULL, 0, $dtend);
|
||||||
$this->assertEquals(1, $bookmarks['total']);
|
$this->assertEquals(1, $bookmarks['total']);
|
||||||
|
|
||||||
$ts->renameTag(1, 'tag1', 'newtag1');
|
$b2ts->renameTag(1, 'tag1', 'newtag1');
|
||||||
$tags1 = $ts->getTagsForBookmark(1);
|
$tags1 = $b2ts->getTagsForBookmark(1);
|
||||||
$this->assertSame(array('newtag1', 'tag11', 'tag111'), $tags1);
|
$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
|
$this->assertSame(array('tag2', 'tag22', 'tag222'), $tags1); //should not be changed
|
||||||
|
|
||||||
|
|
||||||
|
|
10
upgrade.txt
10
upgrade.txt
|
@ -3,7 +3,15 @@
|
||||||
=== From version 0.88 to 0.89 ===
|
=== From version 0.88 to 0.89 ===
|
||||||
- Backup you database
|
- Backup you database
|
||||||
- Make a copy from your SemanticScuttle Web directory
|
- 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` (
|
CREATE TABLE `sc_searchhistory` (
|
||||||
`shId` int(11) NOT NULL auto_increment,
|
`shId` int(11) NOT NULL auto_increment,
|
||||||
|
|
Loading…
Reference in a new issue