Results 1 to 15 of 15

Thread: DA PHP Class with DA API Functions

  1. #1
    Join Date
    Aug 2008
    Posts
    25

    DA PHP Class with DA API Functions

    Hi,

    First, don't look at my english, i'm from the Netherlands and my english is not that good.

    This week, i started writing an Class that translate all the API functies off directadmin to PHP.

    You can see the first start (some functions are not ready yet!) here: SEE IT!

    Is this an good start?

    I will update the .phps file as much as possible

    If this class is ready, it will be public accessable.

    All comments, positive or negative, I will understand and adapt within the script.

    I use HTTP Socket written by Phi1 'l0rdphi1' Stier.

    Greetz,
    DJVG
    Last edited by DJVG; 01-17-2012 at 03:49 PM.

  2. #2
    Join Date
    Aug 2007
    Location
    Moldova
    Posts
    164
    Yes it is.
    It's a great start.

    It's hardware that makes a machine fast. It's software that makes a fast machine slow.

  3. #3
    Join Date
    Jul 2009
    Posts
    8
    Nice idea

  4. #4
    Join Date
    Nov 2004
    Posts
    338
    Hi there
    This is a nice idea, i like it

    Im going to go on from your class.

    Nice job,
    Sky

  5. #5
    Join Date
    Aug 2008
    Posts
    25
    Little Bump!

    Today class updated!

    For url, see my first post!

    DJVG

  6. #6
    Join Date
    Jun 2009
    Posts
    75
    Nice class.
    Softaculous - Auto Installer
    Rate for the apps you love the best
    Installing 325+ apps. Install in just ONE STEP!
    Now available for Direct Admin.

  7. #7
    Join Date
    Feb 2007
    Posts
    439
    Very interesting... can't wait for it to be finished.

  8. #8
    Join Date
    May 2010
    Posts
    7

    Question

    Any updates on this class?

  9. #9
    Join Date
    Nov 2004
    Posts
    338
    I think the author updated this php class without adding comment on this thread.

    I seam to remenber this class whas not a big.

    Its a nice job now.

  10. #10
    Join Date
    May 2010
    Posts
    7
    well not everything is available yet, for example the email forwarders...

  11. #11
    Join Date
    Nov 2004
    Posts
    338
    Quote Originally Posted by sergeant View Post
    well not everything is available yet, for example the email forwarders...
    Here are the 4 actions possible dealing with email froward :
    PHP Code:
        // list of email forwarders
        
    function CMD_API_EMAIL_FORWARDERS($domain) {
            if(
    $this->_empty($domain)) {
                return 
    'fieldempty';
            }elseif(!
    $this->DOMAIN_EXISTS($domain)) {
                return 
    'domainnotexists';
            }else{
                
    $query = array(
                            
    'domain'    =>    $domain
                            
    );
                
    $this->socket->query('/CMD_API_EMAIL_FORWARDERS'$query);

                
    $result $this->socket->fetch_parsed_body();
                return 
    $result;
            }
        }
        
    // add email forwarder
        
    function CMD_API_EMAIL_CREATE_FORWARDERS($domain$user$email) {
            if(
    $this->_empty($domain) || $this->_empty($user) || $this->_empty($email)) {
                return 
    'fieldempty';
            }elseif(!
    $this->DOMAIN_EXISTS($domain)) {
                return 
    'domainnotexists';
            }else{
                
    $query = array(
                            
    'action'    =>    'create',
                            
    'domain'    =>    $domain,
                            
    'email'    =>    $email,
                            
    'user'        =>    $user
                            
    );
                
    $this->socket->query('/CMD_API_EMAIL_FORWARDERS'$query);
                
    $result $this->socket->fetch_parsed_body();

                if(
    $result['error'] == 0) {
                    return 
    'succes';
                }else{
                    return 
    'failed';
                }
            }
        }
        
    // modify email forwarder
        
    function CMD_API_EMAIL_MODIFY_FORWARDERS($domain$user$email) {
            if(
    $this->_empty($domain) || $this->_empty($user) || $this->_empty($email)) {
                return 
    'fieldempty';
            }elseif(!
    $this->DOMAIN_EXISTS($domain)) {
                return 
    'domainnotexists';
            }else{
                
    $query = array(
                            
    'action'    =>    'modify',
                            
    'domain'    =>    $domain,
                            
    'email'    =>    $email,
                            
    'user'        =>    $user
                            
    );
                
    $this->socket->query('/CMD_API_EMAIL_FORWARDERS'$query);
                
    $result $this->socket->fetch_parsed_body();

                if(
    $result['error'] == 0) {
                    return 
    'succes';
                }else{
                    return 
    'failed';
                }
            }
        }
        
    // delete email forwarder
        
    function CMD_API_EMAIL_DELETE_FORWARDERS($domain$user) {
            if(
    $this->_empty($domain) || $this->_empty($user)) {
                return 
    'fieldempty';
            }elseif(!
    $this->DOMAIN_EXISTS($domain)) {
                return 
    'domainnotexists';
            }else{
                
    $query = array(
                            
    'action'    =>    'delete',
                            
    'domain'    =>    $domain,
                            
    'select0'        =>    $user
                            
    );
                
    $this->socket->query('/CMD_API_EMAIL_FORWARDERS'$query);
                
    $result $this->socket->fetch_parsed_body();

                if(
    $result['error'] == 0) {
                    return 
    'succes';
                }else{
                    return 
    'failed';
                }
            }
        } 
    Just add that in the class.

    Paste that before this string : // Subfunctions needed by functions:

    Its not artwork, but it works.

    Sky

  12. #12
    Join Date
    Aug 2008
    Posts
    25
    Hi All,

    I have finished writing the class.

    It has all the futures of: http://www.directadmin.com/api.html

    And you can see it here: http://195.22.102.63/~vgis/da/da.class.phps

    For any question's please contact me.

    One thing using this class, check every user-input before executing a class command!

    DJVG

  13. #13
    Join Date
    Nov 2004
    Posts
    338
    Hello

    Nice work there.

    Just to say that there are a fiew more function's out there (like forward email for ex.) that have not been integrated into that api.html page.

    It would also be pretty nice to have comments on every function so that any good Editor can parse that and give us the params infos needed + hints.

    Thx for sharing.
    Sky

  14. #14
    Join Date
    Oct 2011
    Posts
    1

    Unhappy link is dead

    Quote Originally Posted by DJVG View Post
    Hi All,

    I have finished writing the class.

    It has all the futures of: http://www.directadmin.com/api.html

    And you can see it here: http://195.22.102.63/~vgis/da/da.class.phps

    For any question's please contact me.

    One thing using this class, check every user-input before executing a class command!

    DJVG
    Hi, thank you for your effort, but http://195.22.102.63/~vgis/da/da.class.phps link is dead. Can not download your class.

  15. #15
    Join Date
    Aug 2008
    Posts
    25
    Hi All,

    A long time ago the link died, so I have uploaded it to my own blog, you can view it here: http://djvg.net/directadmin/

    Kind regards,
    Daan van Gorkum

Similar Threads

  1. Ftp functions via API?
    By ozgurerdogan in forum Scripting / API
    Replies: 1
    Last Post: 08-25-2010, 10:55 AM
  2. Custom Class to direct use of API functions
    By jodasi in forum Scripting / API
    Replies: 0
    Last Post: 01-31-2006, 07:21 AM
  3. mySQL functions within DA
    By damn in forum MySQL / PHP
    Replies: 9
    Last Post: 09-07-2005, 03:22 AM
  4. disabling PHP functions
    By Lem0nHead in forum DirectAdmin General Discussion
    Replies: 5
    Last Post: 07-09-2005, 08:40 AM
  5. New API functions
    By DirectAdmin Support in forum Scripting / API
    Replies: 1
    Last Post: 07-21-2003, 12:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •