aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-14 16:26:26 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-14 16:26:26 +0000
commit1bb2b3f8572c087b20ef5649fa1463a35374521f (patch)
tree3511b287d06a278c37fe9551f1fed82ea07893fb /engine/lib/entities.php
parentd2a63172f0d09475319ea2935575044beea4da4d (diff)
downloadelgg-1bb2b3f8572c087b20ef5649fa1463a35374521f.tar.gz
elgg-1bb2b3f8572c087b20ef5649fa1463a35374521f.tar.bz2
Adding a couple of extra functions, deleting the old users module
git-svn-id: https://code.elgg.org/elgg/trunk@224 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 5fd16461d..cab9afae6 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -555,6 +555,28 @@
$guid_two = (int)$guid_two;
return insert_data("INSERT into {$CONFIG->dbprefix}entity_relationships (guid_one, relationship, guid_two) values ($guid_one, 'relationship', $guid_two)");
+ }
+
+ /**
+ * Determine whether or not a relationship between two entities exists
+ *
+ * @param int $guid_one The GUID of the entity "owning" the relationship
+ * @param string $relationship The type of relationship
+ * @param int $guid_two The GUID of the entity the relationship is with
+ * @return true|false
+ */
+ function check_entity_relationship($guid_one, $relationship, $guid_two)
+ {
+ global $CONFIG;
+
+ $guid_one = (int)$guid_one;
+ $relationship = sanitise_string($relationship);
+ $guid_two = (int)$guid_two;
+
+ if ($row = get_data_row("select guid_one from {$CONFIG->dbprefix}entity_relationships where guid_one=$guid_one and relationship='$relationship' and guid_two=$guid_two limit 1")) {
+ return true;
+ }
+ return false;
}
/**
@@ -572,7 +594,7 @@
$relationship = sanitise_string($relationship);
$guid_two = (int)$guid_two;
- return insert_data("DELETE from {$CONFIG->dbprefix}entity_relationships where guid_one=$guid_one and relationship='$relationship' and guid_two=$guid_two");
+ return delete_data("DELETE from {$CONFIG->dbprefix}entity_relationships where guid_one=$guid_one and relationship='$relationship' and guid_two=$guid_two");
}