aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-02-05 13:30:33 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-02-05 13:30:33 +0000
commit73e20c2ff50d197105f3efbc8940c498de4d2f47 (patch)
tree7ca227f920e21d19c02b34110c2240100ce87671 /services
parent67b4663c9a1ec6b173d50516e88bc78067a46369 (diff)
downloadsemanticscuttle-73e20c2ff50d197105f3efbc8940c498de4d2f47.tar.gz
semanticscuttle-73e20c2ff50d197105f3efbc8940c498de4d2f47.tar.bz2
fix interface: make easier the management of tag links
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@33 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'services')
-rw-r--r--services/tag2tagservice.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/services/tag2tagservice.php b/services/tag2tagservice.php
index d37ab8b..1c6392e 100644
--- a/services/tag2tagservice.php
+++ b/services/tag2tagservice.php
@@ -16,7 +16,8 @@ class Tag2TagService {
}
function addLinkedTags($tag1, $tag2, $relationType, $uId) {
- if($tag1 == $tag2) {
+ if($tag1 == $tag2 || strlen($tag1) == 0 || strlen($tag2) == 0
+ || ($relationType != ">" && $relationType != "=")) {
return false;
}
$values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> $relationType, 'uId'=> $uId);
@@ -196,7 +197,21 @@ class Tag2TagService {
return $this->db->sql_numrows($this->db->sql_query($query)) > 0;
}
+ function getLinks($uId) {
+ $query = "SELECT tag1, tag2, relationType, uId FROM `". $this->getTableName() ."`";
+ $query.= " WHERE 1=1";
+ if($uId > 0) {
+ $query.= " AND uId = '".$uId."'";
+ }
+
+ return $this->db->sql_fetchrowset($this->db->sql_query($query));
+ }
+
function removeLinkedTags($tag1, $tag2, $relationType, $uId) {
+ if($tag1 == $tag2 || strlen($tag1) == 0 || strlen($tag2) == 0
+ || ($relationType != ">" && $relationType != "=")) {
+ return false;
+ }
$query = 'DELETE FROM '. $this->getTableName();
$query.= ' WHERE tag1 = "'. $tag1 .'"';
$query.= ' AND tag2 = "'. $tag2 .'"';