aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-12 10:58:35 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-12 10:58:35 +0000
commit083219d563d9c3a35429b27a1b76a312e7fa72dd (patch)
tree932917abbdfd8428460e42f0b70438a5e935b159 /engine/lib
parent922dd7518361a491e227be5db23e0e1a154566ff (diff)
downloadelgg-083219d563d9c3a35429b27a1b76a312e7fa72dd.tar.gz
elgg-083219d563d9c3a35429b27a1b76a312e7fa72dd.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Added get_entity_subtypes function git-svn-id: https://code.elgg.org/elgg/trunk@183 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/entities.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
new file mode 100644
index 000000000..2b97ffa10
--- /dev/null
+++ b/engine/lib/entities.php
@@ -0,0 +1,34 @@
+<?php
+ /**
+ * Elgg entities.
+ * Functions to manage all elgg entities (sites, collections, objects and users).
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey <marcus@dushka.co.uk>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ /**
+ * Get the subtype of a given entity, based on its id and type pair.
+ *
+ * @param int $entity_id The entity ID
+ * @param string $entity_type The entity type string.
+ * @return mixed Either an int id into the *_entity_subtypes
+ */
+ function get_entity_subtype($entity_id, $entity_type)
+ {
+ global $CONFIG;
+
+ $entity_id = (int)$entity_id;
+ $entity_type = sanitise_string($entity_type);
+
+ $row = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes where entity_id=$entity_id and entity_type='$entity_type' limit 1");
+ if ($row)
+ return $row->id;
+
+ return false;
+ }
+?> \ No newline at end of file