diff options
author | 2008-09-11 16:51:00 +0000 | |
---|---|---|
committer | 2008-09-11 16:51:00 +0000 | |
commit | 1d059dc06d24e02c858c43d70eaa70453d51cdff (patch) | |
tree | d29378c81ec8a9498a33ed7276722031c1f12981 /services/tag2tagservice.php | |
parent | bfdc6bd7380fda2d5d8ca78a462047069c4020bc (diff) | |
download | scuttle-1d059dc06d24e02c858c43d70eaa70453d51cdff.tar.gz scuttle-1d059dc06d24e02c858c43d70eaa70453d51cdff.zip |
New Feature: add users admin page with delete function
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@146 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'services/tag2tagservice.php')
-rw-r--r-- | services/tag2tagservice.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/services/tag2tagservice.php b/services/tag2tagservice.php index bf4f866..f24ef79 100644 --- a/services/tag2tagservice.php +++ b/services/tag2tagservice.php @@ -234,15 +234,17 @@ class Tag2TagService { } function removeLinkedTags($tag1, $tag2, $relationType, $uId) { - if($tag1 == $tag2 || strlen($tag1) == 0 || strlen($tag2) == 0 - || ($relationType != ">" && $relationType != "=")) { + if(($tag1 != '' && $tag1 == $tag2) || + ($relationType != ">" && $relationType != "=" && $relationType != "") || + ($tag1 == '' && $tag2 == '' && $relationType == '' && $uId == '')) { return false; } $query = 'DELETE FROM '. $this->getTableName(); - $query.= ' WHERE tag1 = "'. $tag1 .'"'; - $query.= ' AND tag2 = "'. $tag2 .'"'; - $query.= ' AND relationType = "'. $relationType .'"'; - $query.= ' AND uId = "'. $uId .'"'; + $query.= ' WHERE 1=1'; + $query.= strlen($tag1)>0 ? ' AND tag1 = "'. $tag1 .'"' : ''; + $query.= strlen($tag2)>0 ? ' AND tag2 = "'. $tag2 .'"' : ''; + $query.= strlen($relationType)>0 ? ' AND relationType = "'. $relationType .'"' : ''; + $query.= strlen($uId)>0 ? ' AND uId = "'. $uId .'"' : ''; if (!($dbresult =& $this->db->sql_query($query))) { message_die(GENERAL_ERROR, 'Could not remove tag relation', '', __LINE__, __FILE__, $query, $this->db); |