diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-02-21 16:00:35 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-02-21 16:00:35 +0000 |
commit | 73cf2a6898b1ea29bf6013a6ecc000e6b14e9688 (patch) | |
tree | 9e819cee55ad4a221d88e09e133866f4f79166db /services | |
parent | 50863e8fee72c0236b8d262e6f95f4ace85961c0 (diff) | |
download | semanticscuttle-73cf2a6898b1ea29bf6013a6ecc000e6b14e9688.tar.gz semanticscuttle-73cf2a6898b1ea29bf6013a6ecc000e6b14e9688.tar.bz2 |
Code refactoring: rename getNbUpdate(s); clean delete() parameters
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@51 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'services')
-rw-r--r-- | services/tagservice.php | 13 | ||||
-rw-r--r-- | services/tagstatservice.php | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/services/tagservice.php b/services/tagservice.php index 256afc5..1aba11e 100644 --- a/services/tagservice.php +++ b/services/tagservice.php @@ -146,11 +146,14 @@ class TagService { return true; } - function deleteTag($tag) { - $userservice =& ServiceFactory::getServiceInstance('UserService'); - $logged_on_user = $userservice->getCurrentUserId(); + function deleteTag($uId, $tag) { + $bs =& ServiceFactory::getServiceInstance('BookmarkService'); - $query = 'DELETE FROM '. $this->getTableName() .' USING '. $GLOBALS['tableprefix'] .'tags, '. $GLOBALS['tableprefix'] .'bookmarks WHERE '. $GLOBALS['tableprefix'] .'tags.bId = '. $GLOBALS['tableprefix'] .'bookmarks.bId AND '. $GLOBALS['tableprefix'] .'bookmarks.uId = '. $logged_on_user .' AND '. $GLOBALS['tableprefix'] .'tags.tag = "'. $this->db->sql_escape($tag) .'"'; + $query = 'DELETE FROM '. $this->getTableName(); + $query.= ' USING '. $this->getTableName() .', '. $bs->getTableName(); + $query.= ' WHERE '. $this->getTableName() .'.bId = '. $bs->getTableName() .'.bId'; + $query.= ' AND '. $bs->getTableName() .'.uId = '. $uId; + $query.= ' AND '. $this->getTableName() .'.tag = "'. $this->db->sql_escape($tag) .'"'; if (!($dbresult =& $this->db->sql_query($query))) { message_die(GENERAL_ERROR, 'Could not delete tags', '', __LINE__, __FILE__, $query, $this->db); @@ -349,7 +352,7 @@ class TagService { $bookmarks =& $bookmarksInfo['bookmarks']; // Delete old tag - $this->deleteTag($old); + $this->deleteTag($userid, $old); // Attach new tags foreach(array_keys($bookmarks) as $key) { diff --git a/services/tagstatservice.php b/services/tagstatservice.php index fa416f4..ec5f814 100644 --- a/services/tagstatservice.php +++ b/services/tagstatservice.php @@ -55,7 +55,7 @@ class TagStatService { }; } - function getNbUpdate($tag1, $relationType, $uId) { + function getNbUpdates($tag1, $relationType, $uId) { $query = "SELECT nbupdate FROM `". $this->getTableName() ."`"; $query.= " WHERE tag1 = '" .$tag1 ."'"; $query.= " AND relationType = '". $relationType ."'"; |