#1  
Old 3rd May 2012, 21:27
The Other Air Force The Other Air Force is offline
Junior Member
 
Join Date: Sep 2011
Location: Canada
Posts: 18
Thanks: 5
Thanked 4 Times in 3 Posts
Default Adding API Functions

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

Code:
        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 remoting.inc.php 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?
Reply With Quote
Sponsored Links
  #2  
Old 4th May 2012, 09:14
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,461
Thanks: 813
Thanked 5,240 Times in 4,108 Posts
Default

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'))
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
The Following User Says Thank You to till For This Useful Post:
The Other Air Force (10th August 2012)
  #3  
Old 10th August 2012, 00:39
The Other Air Force The Other Air Force is offline
Junior Member
 
Join Date: Sep 2011
Location: Canada
Posts: 18
Thanks: 5
Thanked 4 Times in 3 Posts
Default

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'.
Reply With Quote
  #4  
Old 10th August 2012, 08:40
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,461
Thanks: 813
Thanked 5,240 Times in 4,108 Posts
 
Default

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'));
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ISPConfig3 + API + BoxBilling class450dude Installation/Configuration 3 22nd August 2011 22:32
adding new ip`s Amorphous General 1 22nd June 2009 11:20
how openVPN uses NDIS API on linux tarun@howtoforge Suggest HOWTO 0 3rd June 2008 09:22
Strato Server - Restoring with SystemImager popper2001 HOWTO-Related Questions 5 28th July 2007 10:18
Creating image with Systemimager cuongtim HOWTO-Related Questions 3 18th November 2006 13:55


All times are GMT +2. The time now is 21:20.


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