HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Developers' Forum (
-   -   Adding API Functions (

The Other Air Force 3rd May 2012 22:27

Adding API Functions
I was wondering if it was possible to add a feature where I could place my own unique functions for the ISPConfig API.


        public function dns_zone_get_all($session_id, $primary_id)
                global $app;

                if(!$this->checkPerm($session_id, 'dns_zone_get')) {
                        $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
                        return false;
                $sql = "SELECT origin FROM dns_soa WHERE xfer = 'linode'";
                $all = $app->db->queryAllRecords($sql);
                return $all;

Currently I have the above function added to the file, naturally everytime I update to a new version of ISPConfig my changes are lost. And due to the uniqueness of the SQL query, I doubt anyone else would want this added permanently to the ISPConfig API. Would it be possible to have a separate file for API functions that would be untouched by updates?

till 4th May 2012 10:14

The above function is a duplicate of existing function. To get all zones were xfer = linode, use this function call instead:

$zones = $client->dns_zone_get($session_id, array('xfer' = 'linode'))

The Other Air Force 10th August 2012 01:39

Only getting around to updating that now. Thanks for that, will make updates much easier.

Anyone else looking at that example though, you need to have double quotes around 'xfer' = 'linode'.

till 10th August 2012 09:40

Singö quotes are fine. The difference between single and double quotes in PHP is that double quotes may contain variables that get replaces automatically, the above example does not contain any variables inside the strings, so single quotes are the right choice.

The error in my example is the =, it has to be =>

$zones = $client->dns_zone_get($session_id, array('xfer' => 'linode'));

All times are GMT +2. The time now is 18:40.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.