From 5595bf0ccbd10869f20ccd0ee4f7ad1935956408 Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 23 Mar 2010 20:06:36 +0000 Subject: Added remove_subtype() and update_subtype(). git-svn-id: http://code.elgg.org/elgg/trunk@5488 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'engine/lib') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index fd46b062d..e3fa0cb52 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1461,6 +1461,44 @@ function add_subtype($type, $subtype, $class = "") { return $id; } +/** + * Removes a registered subtype + * + * @param string $type + * @param string $subtype + */ +function remove_subtype($type, $subtype) { + global $CONFIG; + + $type = sanitise_string($type); + $subtype = sanitise_string($subtype); + + return delete_data("DELETE FROM {$CONFIG->dbprefix}entity_subtypes WHERE type = '$type' AND subtype = '$subtype'"); +} + +/** + * Update the registered information + * + * @param string $type + * @param string $subtype + * @param string $class + */ +function update_subtype($type, $subtype, $class = '') { + global $CONFIG; + + if (!$id = get_subtype_id($type, $subtype)) { + return FALSE; + } + $type = sanitise_string($type); + $subtype = sanitise_string($subtype); + + return update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes + SET type = '$type', subtype = '$subtype', class = '$class' + WHERE id = $id + "); +} + + /** * Update an existing entity. * -- cgit v1.2.3