Update API.
authorJan Schneider <jan@horde.org>
Wed, 8 Dec 2010 18:24:33 +0000 (19:24 +0100)
committerJan Schneider <jan@horde.org>
Wed, 8 Dec 2010 18:24:33 +0000 (19:24 +0100)
vilma/lib/Api.php [new file with mode: 0644]
vilma/lib/api.php [deleted file]

diff --git a/vilma/lib/Api.php b/vilma/lib/Api.php
new file mode 100644 (file)
index 0000000..d6907c1
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Vilma external API interface.
+ *
+ * This file defines Vilma's external API interface. Other applications
+ * can interact with Vilma through this API.
+ *
+ * Copyright 2006-2007 Alkaloid Networks <http://www.alkaloid.net/>
+ *
+ * See the enclosed file LICENSE for license information (BSD). If you did not
+ * did not receive this file, see http://cvs.horde.org/co.php/vilma/LICENSE.
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author  Ben Klang <ben@alkaloid.net>
+ * @package Vilma
+ */
+class Vilma_Api extends Horde_Registry_Api
+{
+    public function listDomains()
+    {
+        $domains = array();
+        foreach ($GLOBALS['vilma']->driver->getDomains() as $domain) {
+            $domains[] = $domain['domain_name'];
+        }
+        return $domains;
+    }
+}
diff --git a/vilma/lib/api.php b/vilma/lib/api.php
deleted file mode 100644 (file)
index d3cc221..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * Vilma external API interface.
- *
- * This file defines Vilma's external API interface. Other applications
- * can interact with Vilma through this API.
- *
- * Copyright 2006-2007 Alkaloid Networks <http://www.alkaloid.net/>
- *
- * See the enclosed file LICENSE for license information (BSD). If you did not
- * did not receive this file, see http://cvs.horde.org/co.php/vilma/LICENSE.
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author  Ben Klang <ben@alkaloid.net>
- * @package Vilma
- */
-@define('VILMA_BASE', dirname(__FILE__) . '/..');
-
-$_services['perms'] = array(
-    'args' => array(),
-    'type' => '{urn:horde}stringArray');
-
-
-$_services['listDomains'] = array(
-    'args' => array(),
-    'type' => '{urn:horde}stringArray');
-
-function _vilma_listDomains()
-{
-    require_once VILMA_BASE . '/lib/base.php';
-    global $vilma_driver;
-
-    return $vilma_driver->getDomains();
-    $domains = array();
-    foreach ($vilma_driver->getDomains() as $domain) {
-        $domains[] = $domain['domain_name'];
-    }
-    return $domains;
-}