summaryrefslogtreecommitdiffstats
path: root/lib/api/kolab_api_service_type.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-09-24 14:32:43 +0200
committerAleksander Machniak <alec@alec.pl>2012-09-24 14:32:43 +0200
commit778844077ffadd242a431411554d0e3ac137a717 (patch)
tree741a94ea471578f9803cd404b03e152da9340730 /lib/api/kolab_api_service_type.php
parentbd71b0f69fbe15c789a3c48610f5c0d4e75878ad (diff)
downloadwebadmin-778844077ffadd242a431411554d0e3ac137a717.tar.gz
Implemented type.delete
Diffstat (limited to 'lib/api/kolab_api_service_type.php')
-rw-r--r--lib/api/kolab_api_service_type.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/api/kolab_api_service_type.php b/lib/api/kolab_api_service_type.php
index 54d1464..4b71080 100644
--- a/lib/api/kolab_api_service_type.php
+++ b/lib/api/kolab_api_service_type.php
@@ -91,20 +91,20 @@ class kolab_api_service_type extends kolab_api_service
*/
public function type_delete($getdata, $postdata)
{
- //console("type_delete()", $getdata, $postdata);
- if (!isset($postdata['type'])) {
+ if (empty($postdata['type']) || empty($postdata['id'])) {
return false;
}
- // TODO: Input validation
-// $auth = Auth::get_instance();
-// $result = $auth->type_delete($postdata['type']);
-
- if ($result) {
- return $result;
+ if (!in_array($postdata['type'], $this->supported_types_db)) {
+ return false;
}
- return false;
+ $object_name = $postdata['type'];
+ $object_id = $postdata['id'];
+
+ $this->db->query("DELETE FROM {$object_name}_types WHERE id = ?", array($object_id));
+
+ return (bool) $this->db->affected_rows();
}
/**