diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 341c30b..0000000 --- a/LICENSE +++ /dev/null @@ -1,166 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - diff --git a/config.json b/config.json deleted file mode 100644 index 50cb4f6..0000000 --- a/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "apiUsername": "", - "apiPassword": "", - "domain": "http://127.0.0.1", - "ip": "127.0.0.1" -} \ No newline at end of file diff --git a/ddwhois.php b/ddwhois.php deleted file mode 100644 index cd6c317..0000000 --- a/ddwhois.php +++ /dev/null @@ -1,555 +0,0 @@ - 'DonDominio Whois Addon', - 'description' => 'Adds the capability to perform Whois queries using the DonDominio/MrDomain API through WHMCS', - 'version' => ddwhois_getVersion(), - 'author' => 'DonDominio', - 'language' => 'English', - 'fields' => array() - ); - - return $config; -} - -function ddwhois_getVersion() -{ - $versionFile = __DIR__ . '/version.json'; - - if( !file_exists( $versionFile )){ - return 'unknown'; - } - - $json = @file_get_contents( $versionFile ); - - if( empty( $json )){ - return 'unknown'; - } - - $versionInfo = json_decode( $json, true ); - - if( !is_array( $versionInfo ) || !array_key_exists( 'version', $versionInfo )){ - return 'unknown'; - } - - return $versionInfo['version']; -} - -/** - * Main output for the module. - * @param Array $vars Arguments passed by WHMCS - */ -function ddwhois_output( $vars ) -{ - $module_link = $vars['modulelink']; - $version = $vars['version']; - $lang = $vars['_lang']; - - switch( $_REQUEST['action'] ){ - case 'import': - ddwhois_import( $vars ); - break; - case 'import_process': - ddwhois_import_process( $vars ); - - break; - case 'export': - ddwhois_export( $vars ); - break; - case 'switch': - if( !empty( $_GET['tld'] )){ - ddwhois_setup( $vars, $_GET['tld'] ); - } - break; - case 'save_settings': - ddwhois_save_settings( - array( - 'apiuser' => $_POST['username'], - 'apipasswd' => $_POST['password'], - 'domain' => $_POST['domain'], - 'ip' => $_POST['ip'] - ) - ); - case 'settings': - ddwhois_settings( $vars ); - - break; - case 'new_tld': - ddwhois_new_tld( $vars ); - break; - default: - if( array_key_exists( 'message', $_GET )){ - if( $_GET['message'] == 'new-tld-error-permissions' ){ - echo "
" . $lang['new-tld-error-permissions'] . "
"; - } - - if( $_GET['message'] == 'new-tld-ok' ){ - echo "
" . $lang['new-tld-ok'] . "
"; - } - - if( $_GET['message'] == 'new-tld-error' ){ - echo "
" . $lang['new-tld-error'] . "
"; - } - - if( $_GET['message'] == 'import-ok' ){ - echo "
" . $lang['import-ok'] . "
"; - } - - if( $_GET['message'] == 'import-error' ){ - echo "
" . $lang['import-error'] . "
"; - } - - if( $_GET['message'] == 'settings-error' ){ - echo "
" . $lang['settings-error'] . "
"; - } - - if( $_GET['message'] == 'settings-ok' ){ - echo "
" . $lang['settings-ok'] . "
"; - } - } - - echo " - - - " . $lang['config_settings'] . " - " . $lang['servers_export'] . " - " . $lang['servers_import'] . " - -
-   - - " . $lang['info_path_moreinfo'] . " - -
- -

-

- -
-
-
- - - - - - - - - - - -
- " . $lang['new_tld_tld'] . " - - -
- -
- -
-
-
-
- "; - - if( !is_writable( WHOIS_SERVERS_FILE )){ - echo "
" . $lang['error_servers_no_writable'] . "
"; - - echo " -

- " . $lang['info_path_whois'] . ": " . realpath( WHOIS_SERVERS_FILE ) . " -

- -

- -

- "; - - return false; - } - - $whois_database = @file( WHOIS_SERVERS_FILE ); - - echo " -

- -

-
- - - - - - - - - - - - - "; - - foreach( $whois_database as $entry_id=>$entry ){ - $components = explode( '|', $entry ); - - $tld = $components[0]; - $server = $components[1]; - $match = trim( $components[2] ); - - - echo " - - - - - - - - "; - } - - echo " - -
- TLD - - Server - -   -
- $tld - - $server - - "; - - if( is_writable( WHOIS_SERVERS_FILE )){ - echo " - - " . $lang['config_switch'] . " - - "; - }else{ - echo " -   - "; - } - - echo " -
-
-
- "; - - break; - } -} - -function ddwhois_get( $key ) -{ - $config_file = @file_get_contents( SETTINGS_FILE ); - - $config = json_decode( $config_file, true ); - - return $config[$key]; -} - -function ddwhois_set( $key, $value ) -{ - $config_file = @file_get_contents( SETTINGS_FILE ); - - $config = json_decode( $config_file, true ); - - $config[ $key ] = $value; - - $config_json = json_encode( $config ); - - return @file_put_contents( SETTINGS_FILE, $config_json ); -} - -function ddwhois_export( array $vars ) -{ - $lang = $vars['_lang']; - - header('Content-Description: File Transfer'); - header('Content-Type: application/octet-stream'); - header('Content-Disposition: attachment; filename="'.basename( WHOIS_SERVERS_FILE ).'"'); - header('Expires: 0'); - header('Cache-Control: must-revalidate'); - header('Pragma: public'); - header('Content-Length: ' . filesize( WHOIS_SERVERS_FILE )); - readfile( WHOIS_SERVERS_FILE ); -} - -function ddwhois_import( array $vars ) -{ - $lang = $vars['_lang']; - - echo " -
- - - - - - -
- "; -} - -function ddwhois_import_process( array $vars ) -{ - $lang = $vars['_lang']; - - //Backing up, just in case... - ddwhois_backup(); - - $file_contents = @file( $_FILES['whoisservers']['tmp_name'] ); - - $error = false; - - //Checking if the file has the correct format - foreach( $file_contents as $line ){ - $components = explode( '|', $line ); - - if( count( $components ) != 3 ){ - $error = true; - break; - } - - if( substr( $components[0], 0, 1 ) != '.' ){ - $error = true; - break; - } - } - - if( !$error ){ - move_uploaded_file( $_FILES['whoisservers']['tmp_name'], WHOIS_SERVERS_FILE ); - - header( 'Location: addonmodules.php?module=ddwhois&message=import-ok' ); - exit(); - } - - header( 'Location: addonmodules.php?module=ddwhois&message=import-error' ); - exit(); -} - -/** - * Setup a TLD to use DD API for Whois - * @param string $tld The TLD to configure - * @return bool - */ -function ddwhois_setup( array $vars, $new_tld ) -{ - $lang = $vars['_lang']; - - $new_tld = trim( $new_tld ); - - if( empty( $new_tld )){ - header( 'Location: addonmodules.php?module=ddwhois&message=new-tld-error' ); - exit(); - } - - //Backup - ddwhois_backup(); - - //Load file - $whois_database = @file( WHOIS_SERVERS_FILE ); - - //Flag for found TLDs - $found = false; - - //Get URL - $url = $_SERVER['REQUEST_URI']; - $admin_section = strpos( $url, '/admin' ); - $route = substr( $url, 0, $admin_section ); - - //Looking for the TLD in the file - foreach( $whois_database as $whois_id=>$whois_entry ){ - $components = explode( '|', $whois_entry ); - - $tld = $components[0]; - $server = $components[1]; - $match = $components[2]; - - $domain = ddwhois_get( 'domain' ); - - if( substr( $domain, 0, 4 ) != 'http' ){ - $domain = 'http://' . $domain; - } - - //TLD found; modify its settings - if( $tld == $new_tld ){ - $whois_database[$whois_id] = $tld . '|' . $domain . $route . '/modules/addons/ddwhois/whoisproxy.php?domain=|HTTPREQUEST-DDAVAILABLE' . "\r\n"; - - $found = true; - } - } - - //TLD not found in current file; add it to the bottom - if( !$found ){ - $whois_database[] = $new_tld . '|' . $domain . $route . '/modules/addons/ddwhois/whoisproxy.php?domain=|HTTPREQUEST-DDAVAILABLE' . "\r\n"; - } - - //Save the resulting file - $result = @file_put_contents( WHOIS_SERVERS_FILE, implode( "", $whois_database )); - - //Default confirmation - $message = 'new-tld-ok'; - - //Lookup for errors while saving the file - if( !$result ){ - $message = 'new-tld-error-permissions'; - } - - //Redirect - header( 'Location: addonmodules.php?module=ddwhois&message=' . $message ); -} - -/** - * Make a backup of the original whois servers file - * Creates a backup on the local directory of the original whois servers file for restoring it - * later, if needed. - * @return bool - */ -function ddwhois_backup() -{ - //Do not overwrite the backup if it already exists - if( !file_exists( WHOIS_SERVERS_BACKUP )){ - copy( WHOIS_SERVERS_FILE, WHOIS_SERVERS_BACKUP ); - - return true; - } - - return false; -} - -/** - * Save the settings & redirect - * This function is called whenever the settings screen submits the form via POST. Settings are - * pulled from the POST array and passed in the $settings array. After saving the settings, sets - * a redirect header and exits script execution. - * @param array $settings Settings to save - */ -function ddwhois_save_settings( array $settings ) -{ - - $username = ddwhois_set( 'apiUsername', trim($settings['apiuser']) ); - $password = ddwhois_set( 'apiPassword', trim($settings['apipasswd']) ); - $domain = ddwhois_set( 'domain', trim( $settings['domain'] )); - $ip = ddwhois_set( 'ip', trim( $settings['ip'] )); - - //¿Error saving? Redirect w/ error - if( !$username || !$password ){ - header( 'Location: addonmodules.php?module=ddwhois&message=settings-error' ); - exit(); - } - - //Redirect - header( 'Location: addonmodules.php?module=ddwhois&message=settings-ok' ); - - exit(); -} - -/** - * Settings screen. - * @param array $vars Parameters from WHMCS - */ -function ddwhois_settings( array $vars ) -{ - $lang = $vars['_lang']; - - echo " -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- " . $lang['config_username'] . " - - -
- " . $lang['config_password'] . " - - -
- " . $lang['config_domain'] . " - -
" . $lang['config_domain_info'] . " -
- " . $lang['config_ip'] . " - -
" . $lang['config_ip_info'] . " -
- - -
-
- "; -} - -?> diff --git a/lang/english.php b/lang/english.php deleted file mode 100644 index d938c86..0000000 --- a/lang/english.php +++ /dev/null @@ -1,53 +0,0 @@ - 'Change settings', - 'config_username' => 'API Username', - 'config_password' => 'API Password', - 'config_domain' => 'Access domain', - 'config_domain_info' => 'This is the domain name where your WHMCS frontend is hosted, con http:// o https://.', - 'config_ip' => 'Allowed IPs', - 'config_ip_info' => 'Only requests coming from these IPs will be allowed to access the Whois proxy. Separate IPs with ;.', - 'config_save' => 'Save settings', - 'config_cancel' => 'Cancel', - 'config_save_success' => 'Settings successfully saved', - 'config_save_error' => 'Settings couldn\'t be saved. Maybe you have a permissions problem?', - 'config_switch' => 'Switch to MrDomain/DonDominio', - - /* - * NEW TLD - */ - 'new_tld' => 'Add a new TLD', - 'new_tld_tld' => 'TLD', - 'new_tld_add' => 'Add TLD', - - /* - * INFO - */ - 'info_path_whois' => 'Yor Whois servers file is located here', - 'info_path_moreinfo' => 'Documentation', - - /* - * IMPORT/EXPORT - */ - 'servers_export' => 'Export server list', - 'servers_import' => 'Import server list', - 'import_btn' => 'Import file', - - /* - * MESSAGES - */ - 'error_servers_no_writable' => 'Whois servers file is not writable by the server. Make it writable or edit it directly.', - 'new-tld-error-permissions' => 'Couldn\'t access file, check permissions or edit the file directly', - 'new-tld-ok' => 'TLD updated successfully', - 'new-tld-error' => 'Empty TLD provided', - 'import-ok' => 'Whois Servers file imported correctly', - 'import-error' => 'The provided Whois Servers file is invalid or you don\'t have enough permissions to updated the file', - 'settings-ok' => 'Settings modified successfully', - 'settings-error' => 'Could not save settings' -); - -?> \ No newline at end of file diff --git a/lang/spanish.php b/lang/spanish.php deleted file mode 100644 index 1189587..0000000 --- a/lang/spanish.php +++ /dev/null @@ -1,53 +0,0 @@ - 'Cambiar configuración', - 'config_username' => 'Usuario de API', - 'config_password' => 'Contraseña de API', - 'config_domain' => 'Dominio de acceso', - 'config_domain_info' => 'Este es el dominio donde se aloja tu frontend de WHMCS, con http:// o https://.', - 'config_ip' => 'IPs permitidas', - 'config_ip_info' => 'Sólo las peticiones provenientes de estas IPs tendrán acceso al proxy de Whois. Separa varias IPs con ;.', - 'config_save' => 'Guardar cambios', - 'config_cancel' => 'Cancelar los cambios', - 'config_save_success' => 'La configuración se ha guardado correctamente', - 'config_save_error' => 'La configuración no se ha podido guardar correctamente. ¿Quizás es un problema de permisos?', - 'config_switch' => 'Cambiar a DonDominio', - - /* - * NEW TLD - */ - 'new_tld' => 'Añadir un nuevo TLD', - 'new_tld_tld' => 'TLD', - 'new_tld_add' => 'Añadir TLD', - - /* - * INFO - */ - 'info_path_whois' => 'Tu fichero de servidores Whois se encuentra aquí', - 'info_path_moreinfo' => 'Documentación', - - /* - * IMPORT/EXPORT - */ - 'servers_export' => 'Exportar lista de servidores', - 'servers_import' => 'Importar lista de servidores', - 'import_btn' => 'Importar archivo', - - /* - * MESSAGES - */ - 'error_servers_no_writable' => 'El fichero de servidores Whois no se puede escribir. Cambia los permisos o edítalo directamente.', - 'new-tld-error-permissions' => 'No se ha podido acceder al archivo. Cambia los permisos o edítalo directamente.', - 'new-tld-ok' => 'TLD actualizado correctamente', - 'new-tld-error' => 'Se ha proporcionado un TLD vacío', - 'import-ok' => 'Fichero de servidores Whois importado correctamente', - 'import-error' => 'El ficheor proporcionado no es válido o no tienes suficientes permisos', - 'settings-ok' => 'Configuración guardada correctamente', - 'settings-error' => 'No se ha podido guardar la configuración' -); - -?> \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI.php b/lib/sdk/DonDominioAPI.php deleted file mode 100644 index f11d4d8..0000000 --- a/lib/sdk/DonDominioAPI.php +++ /dev/null @@ -1,181 +0,0 @@ - 'https://simple-api.dondominio.net', - 'port' => 443, - 'apiuser' => '', - 'apipasswd' => '', - 'autoValidate' => true, - 'versionCheck' => true, - 'debug' => false, - 'timeout' => 15, - 'debugOutput' => null, - 'verifySSL' => false, - 'response' => array( - 'throwExceptions' => true - ), - 'userAgent' => array() - ); - - /** - * Initializing the client. - * @param array $options Array containing options for the client - * @throws DonDominioAPI_Error if no user or password is present - */ - public function __construct(array $options = null) - { - //Merging default & defined options - if(is_array($options)){ - $this->options = array_merge($this->options, $options); - } - - //Checking that we have an username & a password - if(empty($this->options['apiuser']) || empty($this->options['apipasswd'])){ - throw new \DonDominioAPI_Error('You must provide an user and a password for the API'); - } - - //Initialize the cURL client - $this->client = new DonDominioAPIClientPostCurl(array( - 'endpoint' => $this->options['endpoint'], - 'port' => $this->options['port'], - 'timeout' => $this->options['timeout'], - 'debug' => $this->options['debug'], - 'debugOutput' => $this->options['debugOutput'], - 'verifySSL' => $this->options['verifySSL'], - 'format' => 'json', - 'pretty' => false, - 'userAgent' => $this->options['userAgent'] - )); - - //Modules - $this->account = new DonDominioAPI_Account($this); - $this->contact = new DonDominioAPI_Contact($this); - $this->domain = new DonDominioAPI_Domain($this); - $this->tool = new DonDominioAPI_Tool($this); - $this->service = new DonDominioAPI_Service( $this ); - } - - /** - * Set an option. - * - * @param string $key Name of the option - * @param mixed $value New value for the option - */ - public function setOption($key, $value) - { - $this->options[$key] = $value; - } - - /** - * Get an option. - * - * @param string $key Name of the option - * @return mixed or null if not found - */ - public function getOption($key) - { - if(!array_key_exists($key, $this->options)){ - return null; - } - - return $this->options[$key]; - } - - /** - * Automatically call a method inside a module wrapper from within the client. - * @param string $method Method called - * @param array $args Arguments passed to the method - * @return DonDominioResponse - */ - public function __call($method, array $args = array()) - { - if(!strpos($method, '_')){ - trigger_error('Invalid call: ' . $method, E_USER_ERROR); - } - - list($class, $method) = explode('_', $method); - - if(!property_exists($this, $class)){ - trigger_error('Undefined module: ' . $class, E_USER_ERROR); - } - - return $this->$class->proxy($method, $args); - } - - /** - * Execute an API call through the client. - * @param string $url API endpoint - * @param array $args Arguments passed to the call - * @return array - */ - public function call($url, array $args = array()) - { - $params = array_merge( - array( - 'apiuser' => $this->options['apiuser'], - 'apipasswd' => $this->options['apipasswd'] - ), - (is_array($args)) ? $args : array() - ); - - return $this->client->execute($url, $params); - } -} - -?> \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/DonDominioAPIClientInterface.php b/lib/sdk/DonDominioAPI/DonDominioAPIClientInterface.php deleted file mode 100755 index 48b1189..0000000 --- a/lib/sdk/DonDominioAPI/DonDominioAPIClientInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - 'PHP', - 'ClientVersion' => '1.3', - 'OperatingSystem' => '', - 'OperatingSystemVersion' => '' - ); - - /** - * Array of options for the client. - * @var array - */ - protected $options = array( - 'endpoint' => 'https://simple-api.dondominio.net', - 'port' => 443, - 'timeout' => 15, - 'debug' => false, - 'debugOutput' => null, - 'verifySSL' => false, - 'format' => 'json', - 'pretty' => false - ); - - /** - * Merge options passed and initialize the client. - */ - public function __construct( array $options = array()) - { - //Merging default & defined options - if( is_array( $options )){ - $this->options = array_merge( $this->options, $options ); - } - - $operatingSystem = php_uname( 's' ); - $operatingSystemVersion = php_uname( 'v' ); - - if( empty( $operatingSystem )){ - $operatingSystem = PHP_OS; - } - - $this->userAgent['OperatingSystem'] = $operatingSystem; - $this->userAgent['OperatingSystemVersion'] = $operatingSystemVersion; - - $this->userAgent = array_merge( $this->userAgent, $options['userAgent'] ); - - $this->init(); - } - - /** - * Call an API endpoint. - * @param string $url URL to be requested - * @param array $args Parameters to be submitted along the request - * @throws DonDominioAPI_HttpError on connection error - * @throws DonDominioAPI_Error on - * @return array|string - */ - public function execute( $url, array $args = array()) - { - $ch = $this->ch; - - $params = array_merge( - array( - 'output-format' => $this->options['format'], - 'output-pretty' => $this->options['pretty'] - ), - ( is_array( $args )) ? $args : array() - ); - - curl_setopt( $ch, CURLOPT_URL, trim( $this->options['endpoint'] ) . '/' . trim( $url )); - curl_setopt( $ch, CURLOPT_POSTFIELDS, $params ); - - $start = microtime( true ); - - $this->log( 'Calling: ' . $this->options['endpoint'] . '/' . $url ); - $this->log( 'Parameters: ' . json_encode( $params )); - - if( $this->options['debug'] ){ - //Saving cURL output to memory for later - $curl_buffer = fopen( 'php://memory', 'w+' ); - curl_setopt( $ch, CURLOPT_STDERR, $curl_buffer ); - } - - $response = curl_exec( $ch ); - - $info = curl_getinfo( $ch ); - - $time = microtime( true ) - $start; - - if( $this->options['debug'] ){ - //Reading cURL buffer contents - rewind( $curl_buffer ); - $this->log( stream_get_contents( $curl_buffer )); - fclose( $curl_buffer ); - } - - $this->log( 'Completed in ' . number_format( $time * 1000, 2 ) . 'ms' ); - $this->log( 'Response: ' . $response ); - - //Checking for errors in cURL - if( curl_error( $ch )){ - return null; - } - - return $response; - } - - /** - * Add an user agent to the array. - * - * @param string $value Name of the User Agent - * @param string $version Version - * @return boolean - */ - public function addUserAgent( $value, $version ) - { - $this->userAgent[ $value ] = $version; - - return true; - } - - /** - * Build the user agent string from the array. - * - * @return string - */ - protected function buildUserAgent() - { - $userAgentString = ''; - - foreach( $this->userAgent as $key=>$value ){ - $userAgentString .= $key . '/' . $value . ';'; - } - - return $userAgentString; - } - - /** - * Initialize the cURL client. - */ - protected function init() - { - $this->ch = curl_init(); - - curl_setopt( $this->ch, CURLOPT_USERAGENT, $this->buildUserAgent()); - curl_setopt( $this->ch, CURLOPT_POST, true ); - curl_setopt( $this->ch, CURLOPT_HEADER, false ); - curl_setopt( $this->ch, CURLOPT_RETURNTRANSFER, true ); - - if( $this->options['verifySSL'] == true ){ - curl_setopt( $this->ch, CURLOPT_SSL_VERIFYPEER, 1 ); - curl_setopt( $this->ch, CURLOPT_SSL_VERIFYHOST, 2 ); - } - - curl_setopt( $this->ch, CURLOPT_CONNECTTIMEOUT, 30 ); - curl_setopt( $this->ch, CURLOPT_PORT, $this->options['port'] ); - curl_setopt( $this->ch, CURLOPT_TIMEOUT, $this->options['timeout'] ); - curl_setopt( $this->ch, CURLOPT_VERBOSE, $this->options['debug'] ); - } - - /** - * Log a message to the selected logging system, if logging is enabled. - * The logging system can be controlled using the "debugOutput" option. - * - * Use $output = 'error_log' to output to the default PHP error_log. - * Use $output = 'php://stdout' to output to the default stdout. - * Use $output with a filename to write the log to that file. - * - * @param string $message Message to be logged - */ - protected function log( $message ) - { - if( $this->options['debug'] == true ){ - $output = ( empty($this->options['debugOutput'] )) ? 'php://stdout' : $this->options['debugOutput']; - - if( $output == 'error_log' ){ - //Log to default logging system - error_log( $message ); - }else{ - //Otherwise, log to file - file_put_contents( $output, '[' . date('m/d/Y H:i:s') . '] ' . $message."\r\n", FILE_APPEND ); - } - } - } - - /** - * Freeing resources. - */ - public function __destruct() - { - if( $this->ch ){ - curl_close( $this->ch ); - } - } -} \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/DonDominioAPIResponse.php b/lib/sdk/DonDominioAPI/DonDominioAPIResponse.php deleted file mode 100755 index 9a4b206..0000000 --- a/lib/sdk/DonDominioAPI/DonDominioAPIResponse.php +++ /dev/null @@ -1,267 +0,0 @@ - false - ); - - /** - * Exception mapping. - * @var array - */ - protected static $errorMap = array( - '-1' => 'DonDominioAPI_ValidationError', - - '1' => 'DonDominioAPI_UndefinedError', - - '100' => 'DonDominioAPI_SyntaxError', - '101' => 'DonDominioAPI_SyntaxError_ParameterFault', - '102' => 'DonDominioAPI_ObjectOrAction_NotValid', - '103' => 'DonDominioAPI_ObjectOrAction_NotAllowed', - '104' => 'DonDominioAPI_ObjectOrAction_NotImplemented', - '105' => 'DonDominioAPI_SyntaxError_InvalidParameter', - - '200' => 'DonDominioAPI_Login_Required', - '201' => 'DonDominioAPI_Login_Invalid', - '210' => 'DonDominioAPI_Session_Invalid', - - '300' => 'DonDominioAPI_Action_NotAllowed', - - '1000' => 'DonDominioAPI_Account_Blocked', - '1001' => 'DonDominioAPI_Account_Deleted', - '1002' => 'DonDominioAPI_Account_Inactive', - '1003' => 'DonDominioAPI_Account_NotExists', - '1004' => 'DonDominioAPI_Account_InvalidPass', - '1005' => 'DonDominioAPI_Account_InvalidPass', - '1006' => 'DonDominioAPI_Account_Blocked', - '1007' => 'DonDominioAPI_Account_Filtered', - '1009' => 'DonDominioAPI_Account_InvalidPass', - '1010' => 'DonDominioAPI_Account_Blocked', - '1011' => 'DonDominioAPI_Account_Blocked', - '1012' => 'DonDominioAPI_Account_Blocked', - '1013' => 'DonDominioAPI_Account_Blocked', - '1014' => 'DonDominioAPI_Account_Filtered', - '1015' => 'DonDominioAPI_Account_Banned', - - '1100' => 'DonDominioAPI_InsufficientBalance', - - '2001' => 'DonDominioAPI_InvalidDomainName', - '2002' => 'DonDominioAPI_TLD_NotSupported', - '2003' => 'DonDominioAPI_TLD_UnderMaintenance', - '2004' => 'DonDominioAPI_Domain_CheckError', - '2005' => 'DonDominioAPI_Domain_TransferNotAllowed', - '2006' => 'DonDominioAPI_Domain_WhoisNotAllowed', - '2007' => 'DonDominioAPI_Domain_WhoisError', - '2008' => 'DonDominioAPI_Domain_NotFound', - '2009' => 'DonDominioAPI_Domain_CreateError', - '2010' => 'DonDominioAPI_Domain_CreateError_Taken', - '2011' => 'DonDominioAPI_Domain_CreateError_PremiumDomain', - '2012' => 'DonDominioAPI_Domain_TransferError', - - '2100' => 'DonDominioAPI_Domain_RenewError', - '2101' => 'DonDominioAPI_Domain_RenewNotAllowed', - '2102' => 'DonDominioAPI_Domain_RenewBlocked', - - '2200' => 'DonDominioAPI_Domain_UpdateError', - '2201' => 'DonDominioAPI_Domain_UpdateNotAllowed', - '2202' => 'DonDominioAPI_Domain_UpdateBlocked', - - '3001' => 'DonDominioAPI_Contact_NotExists', - '3002' => 'DonDominioAPI_Contact_DataError' - ); - - /** - * Take a response string in JSON format and an array of options to initialize the class. - * @param string $response Response in JSON format - * @param array $options Options passed to the class - */ - public function __construct($response = null, array $options = null) - { - $this->rawResponse = $response; - - $this->response = @json_decode($this->rawResponse, true); - - $this->options = array_merge( - $this->options, - (is_array($options)) ? $options : array() - ); - - $this->readResponse(); - } - - /** - * Check for errors in the response, and throw appropriate exceptions. - * @throws DonDominioAPI_Error on invalid responses and errors - */ - protected function readResponse() - { - if($this->options['throwExceptions']){ - if(!is_array($this->response) || !array_key_exists('success', $this->response)){ - throw new DonDominioAPI_Error('Invalid response'); - } - - if($this->response['success'] != true){ - throw $this->castError($this->response); - } - } - } - - /** - * Get the "success" parameter from the response. - * @return boolean - */ - public function success() - { - return $this->response['success']; - } - - /** - * Get the "errorCode" parameter from the response. - * @return string - */ - public function getErrorCode() - { - return $this->response['errorCode']; - } - - /** - * Get the "errorCodeMsg" parameter from the response. - * @return string - */ - public function getErrorCodeMsg() - { - return $this->response['errorCodeMsg']; - } - - /** - * Get the "action" parameter from the response. - * @return string - */ - public function getAction() - { - return $this->response['action']; - } - - /** - * Get the "version" parameter from the response. - * @return string - */ - public function getVersion() - { - return $this->response['version']; - } - - /** - * Get all of the values in the "responseData" field in array format. - * @return array - */ - public function getResponseData() - { - return $this->response['responseData']; - } - - /** - * Get a parameter from the "responseData" array. - * @param string $key Key of the parameter - * @return mixed or false if $key not found - */ - public function get($key) - { - if(array_key_exists($key, $this->response['responseData'])){ - return $this->response['responseData'][$key]; - }else{ - return false; - } - } - - /** - * Get the response in raw JSON string format. - * @return string - */ - public function getRawResponse() - { - return $this->rawResponse; - } - - /** - * Get the response in array format. - * @return array - */ - public function getArray() - { - return $this->response; - } - - /** - * Output the response in the specified format. - * @param string $method Output filter - * @param array $args Optional arguments for the call - */ - public function output($format, array $args = array()) - { - $filter = 'OutputFilter' . $format; - - $path = __DIR__ . '/outputFilters/' . $filter . '.php'; - - if(!file_exists($path)){ - trigger_error('Output filter not found: ' . $path, E_USER_ERROR); - } - - require_once($path); - - if(!class_exists($filter)){ - trigger_error('Not a valid Output Filter: ' . $filter, E_USER_ERROR); - } - - $outputFilter = new $filter($args); - - if(!method_exists($outputFilter, 'render')){ - trigger_error('Method render not found in output filter ' . $filter, E_USER_ERROR); - } - - return $outputFilter->render($this->response['responseData']); - } - - /** - * Throw the appropriate exception for the error received. - * @param array $result Response from the API; an error response is expected - * @throws DonDominioAPI_Error or the appropriate exception - */ - public function castError(array $result) - { - if(!$result['errorCode']){ - throw new \DonDominioAPI_Error('Got an unexpected error: ' . @json_encode($result)); - } - - $class = (isset(self::$errorMap[$result['errorCode']])) ? self::$errorMap[$result['errorCode']] : 'DonDominioAPI_Error'; - return new $class($result['messages'], $result['errorCode']); - } -} - -?> \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/Exceptions.php b/lib/sdk/DonDominioAPI/Exceptions.php deleted file mode 100755 index 8525c05..0000000 --- a/lib/sdk/DonDominioAPI/Exceptions.php +++ /dev/null @@ -1,81 +0,0 @@ - \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilter.php b/lib/sdk/DonDominioAPI/OutputFilters/OutputFilter.php deleted file mode 100755 index 6524ff5..0000000 --- a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilter.php +++ /dev/null @@ -1,58 +0,0 @@ -options = array_merge( - $this->options, - $options - ); - } - - /** - * Return the value of an option. - * @param string $key Option name - * @return mixed or null if $key not found - */ - public function getOption($key) - { - if(!array_key_exists($key, $this->options)){ - return null; - } - - return $this->options[$key]; - } - - /** - * Set an option. - * @param string $key Option name - * @param string $value Option value - */ - public function setOption($key, $value) - { - $this->options[$key] = $value; - } -} - -?> \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterArray.php b/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterArray.php deleted file mode 100755 index b3688ae..0000000 --- a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterArray.php +++ /dev/null @@ -1,39 +0,0 @@ - \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterInterface.php b/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterInterface.php deleted file mode 100755 index 7bf6e51..0000000 --- a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterInterface.php +++ /dev/null @@ -1,22 +0,0 @@ - \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterJSON.php b/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterJSON.php deleted file mode 100755 index dc24016..0000000 --- a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterJSON.php +++ /dev/null @@ -1,47 +0,0 @@ - false - ); - - /** - * Render a provided resultset in JSON. - * @param array $result Array containing the response returned by the API - * @return string JSON string - */ - public function render($result) - { - if(!is_array($result)) return false; - - $json_options = null; - - if($this->options['pretty'] == true){ - $json_options = JSON_PRETTY_PRINT; - } - - return json_encode($result, $json_options); - } -} - -?> \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterTXT.php b/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterTXT.php deleted file mode 100755 index 5b869be..0000000 --- a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterTXT.php +++ /dev/null @@ -1,42 +0,0 @@ - ' ' - ); - - /** - * Every output filter must implement the "render" method to work. - */ - public function render($result){ - if(!is_array($result)) return false; - - return $this->toTXT($result); - } - - /** - * This is a custom method created for this example. - */ - protected function toTXT($item, $indentation = 0){ - $txt = ''; - - if(is_array($item)){ - foreach($item as $key=>$value){ - if(is_array($value)){ - $txt .= str_repeat($this->getOption('indentation'), $indentation) . "[$key]\r\n" . $this->toTXT($value, $indentation + 1); - }else{ - $txt .= str_repeat($this->getOption('indentation'), $indentation) . str_pad($key, 12) . ': ' . $value . "\r\n"; - } - } - } - - return $txt; - } -} - - -?> diff --git a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterXML.php b/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterXML.php deleted file mode 100755 index 8ef9dad..0000000 --- a/lib/sdk/DonDominioAPI/OutputFilters/OutputFilterXML.php +++ /dev/null @@ -1,70 +0,0 @@ - false - ); - - /** - * Render a provided resultset in XML. - * @param array $result Array containing the response returned by the API - * @return string Valid XML string - */ - public function render($result) - { - if(!is_array($result)) return false; - - $xml = new SimpleXMLElement(''); - - $this->toXML($xml, $result); - - if($this->getOption('pretty') == false){ - return $xml->asXML(); - } - - $dom = dom_import_simplexml($xml)->ownerDocument; - $dom->preserveWhiteSpace = true; - $dom->formatOutput = true; - - return $dom->saveXML(); - } - - /** - * Recursively convert an Array to a valid XML object. - * @param SimpleXMLElement $object XML object that will receive the data - * @param array $data Array containing data to be converted - */ - protected function toXML(SimpleXMLElement $object, array $data) - { - foreach ($data as $key => $value){ - if(is_array($value)){ - $new_object = $object->addChild($key); - $this->toXML($new_object, $value); - }else{ - $object->addChild($key, $value); - } - } - } -} - -?> \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/Wrappers/Account.php b/lib/sdk/DonDominioAPI/Wrappers/Account.php deleted file mode 100644 index 3b79fa8..0000000 --- a/lib/sdk/DonDominioAPI/Wrappers/Account.php +++ /dev/null @@ -1,59 +0,0 @@ -execute('account/info/'); - } - - /** - * Gets the zones (TLDs) available with prices and extra information. - * Accepts an associative array with the following parameters: - * - * ! = required - * - pageLength integer Max results (defaults to 1000) - * - page integer Number of the page to get (defaults to 1) - * - tld string Filter zones by TLD - * - tldtop string Filter zones by top TLD - * - * @link https://docs.dondominio.com/api/#section-4-2 - * - * @return DonDominioResponse - */ - protected function zones(array $args = array()) - { - $map = array( - array('name'=>'pageLength', 'type'=>'integer', 'required'=>false), - array('name'=>'page', 'type'=>'integer', 'required'=>false), - array('name'=>'tld', 'type'=>'string', 'required'=>false), - array('name'=>'tldtop', 'type'=>'string', 'required'=>false) - ); - - return $this->execute('account/zones', $args, $map); - } -} - -?> \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/Wrappers/Contact.php b/lib/sdk/DonDominioAPI/Wrappers/Contact.php deleted file mode 100644 index 63fe8e9..0000000 --- a/lib/sdk/DonDominioAPI/Wrappers/Contact.php +++ /dev/null @@ -1,96 +0,0 @@ -'pageLength', 'type'=>'integer', 'required'=>false), - array('name'=>'page', 'type'=>'integer', 'required'=>false), - array('name'=>'name', 'type'=>'string', 'required'=>false), - array('name'=>'email', 'type'=>'email', 'required'=>false), - array('name'=>'country', 'type'=>'countryCode', 'required'=>false), - array('name'=>'identNumber', 'type'=>'string', 'required'=>false) - ); - - return $this->execute('contact/list/', $args, $map); - } - - /** - * Get all available information for a contact. - * - * @link https://docs.dondominio.com/api/#section-6-2 - * - * @param string $contactID Contact's ID code - * @param string $infoType Type of information to get. - * - * @return DonDominioAPIResponse - */ - protected function getInfo($contactID, $infoType='data') - { - $_params = array('contactID'=>$contactID, 'infoType'=>$infoType); - - $map = array( - array('name'=>'contactID', 'type'=>'contactID', 'required'=>true), - array('name'=>'infoType', 'type'=>'list', 'required'=>false, 'list'=>array('data')) - ); - - return $this->execute('contact/getinfo/', $_params, $map); - } -} - -?> \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/Wrappers/Domain.php b/lib/sdk/DonDominioAPI/Wrappers/Domain.php deleted file mode 100644 index 10585d2..0000000 --- a/lib/sdk/DonDominioAPI/Wrappers/Domain.php +++ /dev/null @@ -1,879 +0,0 @@ - $domain ); - - $map = array( - array( 'name'=>'domain', 'type'=>'domain', 'required'=>true ) - ); - - return $this->execute( 'domain/check/', $_params, $map ); - } - - /** - * Check if a domain can be transfered. - * - * @link https://docs.dondominio.com/api/#section-5-2 - * - * @param string $domain Domain name to check - * - * @return DonDominioAPIResponse - */ - protected function checkForTransfer($domain) - { - $_params = array('domain' => $domain); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true) - ); - - return $this->execute('domain/checkfortransfer/', $_params, $map); - } - - /** - * Create a new Domain. - * Accepts an associative array with the following parameters: - * - * ! = required - * - period integer Number of years to register the domain. - * - premium boolean Must be true to register premium domains. - * - nameservers string Comma-separated list of DNS servers (min 2, max 7). - * Use "parking" for redirection & parking service. - * ! owner array Associative array of owner contact information. - * - admin array Associative array of administrator contact infromation. - * - tech array Associative array of technical contact information. - * - billing array Associative array of billing contact information. - * - * @link https://docs.dondominio.com/api/#section-5-3 - * - * @param string $domain Domain name to register - * @param array $args Associative array of parameters - * - * @return DonDominioAPIResponse - */ - protected function create($domain, array $args = array()) - { - $_params = array_merge( - array('domain' => $domain), - $this->flattenContacts($args) - ); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true), - array('name'=>'period', 'type'=>'integer', 'required'=>false), - array('name'=>'premium', 'type'=>'boolean', 'required'=>false), - array('name'=>'nameservers', 'type'=>'string', 'required'=>false), - - array('name'=>'ownerContactID', 'type'=>'contactID','required'=>false), - array('name'=>'ownerContactType', 'type'=>'list', 'required'=>false, 'list'=>array('individual', 'organization')), - array('name'=>'ownerContactFirstName', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactLastName', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactIdentNumber', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactEmail', 'type'=>'email', 'required'=>false), - array('name'=>'ownerContactPhone', 'type'=>'phone', 'required'=>false), - array('name'=>'ownerContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'ownerContactAddress', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactPostalCode', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactCity', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactState', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactCountry', 'type'=>'string', 'required'=>false), - - array('name'=>'adminContactID', 'type'=>'contactID','required'=>false), - array('name'=>'adminContactType', 'type'=>'list', 'required'=>false, 'list'=>array('individual', 'organization')), - array('name'=>'adminContactFirstName', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactLastName', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactIdentNumber', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactEmail', 'type'=>'email', 'required'=>false), - array('name'=>'adminContactPhone', 'type'=>'phone', 'required'=>false), - array('name'=>'adminContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'adminContactAddress', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactPostalCode', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactCity', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactState', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactCountry', 'type'=>'string', 'required'=>false), - - array('name'=>'techContactID', 'type'=>'contactID','required'=>false), - array('name'=>'techContactType', 'type'=>'list', 'required'=>false, 'list'=>array('individual', 'organization')), - array('name'=>'techContactFirstName', 'type'=>'string', 'required'=>false), - array('name'=>'techContactLastName', 'type'=>'string', 'required'=>false), - array('name'=>'techContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'techContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'techContactIdentNumber', 'type'=>'string', 'required'=>false), - array('name'=>'techContactEmail', 'type'=>'email', 'required'=>false), - array('name'=>'techContactPhone', 'type'=>'phone', 'required'=>false), - array('name'=>'techContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'techContactAddress', 'type'=>'string', 'required'=>false), - array('name'=>'techContactPostalCode', 'type'=>'string', 'required'=>false), - array('name'=>'techContactCity', 'type'=>'string', 'required'=>false), - array('name'=>'techContactState', 'type'=>'string', 'required'=>false), - array('name'=>'techContactCountry', 'type'=>'string', 'required'=>false), - - array('name'=>'billingContactID', 'type'=>'contactID','required'=>false), - array('name'=>'billingContactType', 'type'=>'list', 'required'=>false, 'list'=>array('individual', 'organization')), - array('name'=>'billingContactFirstName', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactLastName', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactIdentNumber', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactEmail', 'type'=>'email', 'required'=>false), - array('name'=>'billingContactPhone', 'type'=>'phone', 'required'=>false), - array('name'=>'billingContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'billingContactAddress', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactPostalCode', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactCity', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactState', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactCountry', 'type'=>'string', 'required'=>false) - ); - - return $this->execute('domain/create/', $_params, $map); - } - - /** - * Transfer a domain. - * Accepts an associative array with the following parameters: - * - * ! = required - * - nameservers string Comma-separated list of DNS servers (min 2, max 7). - * Use "parking" for redirection & parking service. - * Use "keepns" to leave the DNS servers unmodified. - * - authcode string Authcode for the Domain, if necessary. - * ! owner array Associative array of owner contact information. - * - admin array Associative array of administrator contact infromation. - * - tech array Associative array of technical contact information. - * - billing array Associative array of billing contact information. - * - * @link https://docs.dondominio.com/api/#section-5-4 - * - * @param string $domain Domain name to transfer - * @param array $args Associative array of parameters - * - * @return DonDominioAPIResponse - */ - protected function transfer($domain, array $args = array()) - { - $_params = array_merge( - array('domain'=>$domain), - $this->flattenContacts($args) - ); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true), - array('name'=>'nameservers', 'type'=>'string', 'required'=>false), - array('name'=>'authcode', 'type'=>'string', 'required'=>false), - - array('name'=>'ownerContactID', 'type'=>'contactID','required'=>true, 'bypass'=>'ownerContactType'), - array('name'=>'ownerContactType', 'type'=>'list', 'required'=>true, 'bypass'=>'ownerContactID', 'list'=>array('individual', 'organization')), - array('name'=>'ownerContactFirstName', 'type'=>'string', 'required'=>true, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactLastName', 'type'=>'string', 'required'=>true, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactIdentNumber', 'type'=>'string', 'required'=>true, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactEmail', 'type'=>'email', 'required'=>true, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactPhone', 'type'=>'phone', 'required'=>true, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'ownerContactAddress', 'type'=>'string', 'required'=>true, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactPostalCode', 'type'=>'string', 'required'=>true, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactCity', 'type'=>'string', 'required'=>true, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactState', 'type'=>'string', 'required'=>true, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactCountry', 'type'=>'string', 'required'=>true, 'bypass'=>'ownerContactID'), - - array('name'=>'adminContactID', 'type'=>'contactID','required'=>false), - array('name'=>'adminContactType', 'type'=>'list', 'required'=>false, 'list'=>array('individual', 'organization')), - array('name'=>'adminContactFirstName', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactLastName', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactIdentNumber', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactEmail', 'type'=>'email', 'required'=>false), - array('name'=>'adminContactPhone', 'type'=>'phone', 'required'=>false), - array('name'=>'adminContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'adminContactAddress', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactPostalCode', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactCity', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactState', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactCountry', 'type'=>'string', 'required'=>false), - - array('name'=>'techContactID', 'type'=>'contactID','required'=>false), - array('name'=>'techContactType', 'type'=>'list', 'required'=>false, 'list'=>array('individual', 'organization')), - array('name'=>'techContactFirstName', 'type'=>'string', 'required'=>false), - array('name'=>'techContactLastName', 'type'=>'string', 'required'=>false), - array('name'=>'techContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'techContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'techContactIdentNumber', 'type'=>'string', 'required'=>false), - array('name'=>'techContactEmail', 'type'=>'email', 'required'=>false), - array('name'=>'techContactPhone', 'type'=>'phone', 'required'=>false), - array('name'=>'techContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'techContactAddress', 'type'=>'string', 'required'=>false), - array('name'=>'techContactPostalCode', 'type'=>'string', 'required'=>false), - array('name'=>'techContactCity', 'type'=>'string', 'required'=>false), - array('name'=>'techContactState', 'type'=>'string', 'required'=>false), - array('name'=>'techContactCountry', 'type'=>'string', 'required'=>false), - - array('name'=>'billingContactID', 'type'=>'contactID','required'=>false), - array('name'=>'billingContactType', 'type'=>'list', 'required'=>false, 'list'=>array('individual', 'organization')), - array('name'=>'billingContactFirstName', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactLastName', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactIdentNumber', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactEmail', 'type'=>'email', 'required'=>false), - array('name'=>'billingContactPhone', 'type'=>'phone', 'required'=>false), - array('name'=>'billingContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'billingContactAddress', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactPostalCode', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactCity', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactState', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactCountry', 'type'=>'string', 'required'=>false) - ); - - return $this->execute('domain/transfer/', $_params, $map); - } - - /** - * Update domain parameters, such as contacts, nameservers, and more. - * Accepts an associative array with the following parameters: - * - * ! = required - * [updateType = contact] - * - owner array Associative array of owner contact information. - * - admin array Associative array of administrator contact infromation. - * - tech array Associative array of technical contact information. - * - billing array Associative array of billing contact information. - * - * [updateType = nameservers] - * ! nameservers string Comma-separated list of DNS servers (min 2, max 7). - * Use "default" to assign DonDominio/MrDomain hosting values. - * - * [updateType = transferBlock] - * ! transferBlock boolean Enables or disables the transfer block for the domain. - * - * [updateType = block] - * ! block boolean Enables or disables the domain block. - * - * [updateType = whoisPrivacy] - * ! whoisPrivacy boolean Enables or disables the whoisPrivacy service for the domain. - * - * @link https://docs.dondominio.com/api/#section-5-5 - * - * @param string $domain Domain name to update - * @param string $updateType Type of information to modify (contact, nameservers, transferBlock, block, whoisPrivacy) - * @param array $args Associative array of parameters - * - * @return DonDominioAPIResponse - */ - protected function update( $domain, array $args = array()) - { - $_params = array_merge( - $this->getDomainOrDomainID( $domain ), - $this->flattenContacts( $args ) - ); - - $map = array( - array( 'name' => 'domain', 'type' => 'domain', 'required' => true, 'bypass' => 'domainID' ), - array( 'name' => 'domainID', 'type' => 'string', 'required' => true, 'bypass' => 'domain' ), - array( 'name' => 'updateType', 'type' => 'list', 'required' => true, 'list' => array( 'contact', 'nameservers', 'transferBlock', 'block', 'whoisPrivacy', 'renewalMode' )), - - array( 'name' => 'ownerContactID', 'type' => 'contactID', 'required' => false, 'bypass' => 'ownerContactType' ), - array( 'name' => 'ownerContactType', 'type' => 'list', 'required' => false, 'bypass' => 'ownerContactID', 'list' => array( 'individual', 'organization' )), - array( 'name' => 'ownerContactFirstName', 'type' => 'string', 'required' => false, 'bypass' => 'ownerContactID' ), - array( 'name' => 'ownerContactLastName', 'type' => 'string', 'required' => false, 'bypass' => 'ownerContactID' ), - array( 'name' => 'ownerContactOrgName', 'type' => 'string', 'required' => false ), - array( 'name' => 'ownerContactOrgType', 'type' => 'string', 'required' => false ), - array( 'name' => 'ownerContactIdentNumber', 'type' => 'string', 'required' => false, 'bypass' => 'ownerContactID' ), - array( 'name' => 'ownerContactEmail', 'type' => 'email', 'required' => false, 'bypass' => 'ownerContactID' ), - array( 'name' => 'ownerContactPhone', 'type' => 'phone', 'required' => false , 'bypass' => 'ownerContactID' ), - array( 'name' => 'ownerContactFax', 'type' => 'phone', 'required' => false), - array( 'name' => 'ownerContactAddress', 'type' => 'string', 'required' => false, 'bypass' => 'ownerContactID' ), - array( 'name' => 'ownerContactPostalCode', 'type' => 'string', 'required' => false, 'bypass' => 'ownerContactID' ), - array( 'name' => 'ownerContactCity', 'type' => 'string', 'required' => false, 'bypass' => 'ownerContactID' ), - array( 'name' => 'ownerContactState', 'type' => 'string', 'required' => false, 'bypass' => 'ownerContactID' ), - array( 'name' => 'ownerContactCountry', 'type' => 'string', 'required' => false, 'bypass' => 'ownerContactID' ), - - array( 'name' => 'adminContactID', 'type' => 'contactID', 'required' => false ), - array( 'name' => 'adminContactType', 'type' => 'list', 'required' => false, 'list' => array( 'individual', 'organization' )), - array( 'name' => 'adminContactFirstName', 'type' => 'string', 'required' => false ), - array( 'name' => 'adminContactLastName', 'type' => 'string', 'required' => false ), - array( 'name' => 'adminContactOrgName', 'type' => 'string', 'required' => false ), - array( 'name' => 'adminContactOrgType', 'type' => 'string', 'required' => false ), - array( 'name' => 'adminContactIdentNumber', 'type' => 'string', 'required' => false ), - array( 'name' => 'adminContactEmail', 'type' => 'email', 'required' => false ), - array( 'name' => 'adminContactPhone', 'type' => 'phone', 'required' => false ), - array( 'name' => 'adminContactFax', 'type' => 'phone', 'required' => false ), - array( 'name' => 'adminContactAddress', 'type' => 'string', 'required' => false ), - array( 'name' => 'adminContactPostalCode', 'type' => 'string', 'required' => false ), - array( 'name' => 'adminContactCity', 'type' => 'string', 'required' => false ), - array( 'name' => 'adminContactState', 'type' => 'string', 'required' => false ), - array( 'name' => 'adminContactCountry', 'type' => 'string', 'required' => false ), - - array( 'name' => 'techContactID', 'type' => 'contactID', 'required' => false ), - array( 'name' => 'techContactType', 'type' => 'list', 'required' => false, 'list' => array( 'individual', 'organization' )), - array( 'name' => 'techContactFirstName', 'type' => 'string', 'required' => false ), - array( 'name' => 'techContactLastName', 'type' => 'string', 'required' => false ), - array( 'name' => 'techContactOrgName', 'type' => 'string', 'required' => false ), - array( 'name' => 'techContactOrgType', 'type' => 'string', 'required' => false ), - array( 'name' => 'techContactIdentNumber', 'type' => 'string', 'required' => false ), - array( 'name' => 'techContactEmail', 'type' => 'email', 'required' => false ), - array( 'name' => 'techContactPhone', 'type' => 'phone', 'required' => false ), - array( 'name' => 'techContactFax', 'type' => 'phone', 'required' => false ), - array( 'name' => 'techContactAddress', 'type' => 'string', 'required' => false ), - array( 'name' => 'techContactPostalCode', 'type' => 'string', 'required' => false ), - array( 'name' => 'techContactCity', 'type' => 'string', 'required' => false ), - array( 'name' => 'techContactState', 'type' => 'string', 'required' => false ), - array( 'name' => 'techContactCountry', 'type' => 'string', 'required' => false ), - - array( 'name' => 'billingContactID', 'type' => 'contactID', 'required' => false ), - array( 'name' => 'billingContactType', 'type' => 'list', 'required' => false, 'list' => array( 'individual', 'organization' )), - array( 'name' => 'billingContactFirstName', 'type' => 'string', 'required' => false ), - array( 'name' => 'billingContactLastName', 'type' => 'string', 'required' => false ), - array( 'name' => 'billingContactOrgName', 'type' => 'string', 'required' => false ), - array( 'name' => 'billingContactOrgType', 'type' => 'string', 'required' => false ), - array( 'name' => 'billingContactIdentNumber', 'type' => 'string', 'required' => false ), - array( 'name' => 'billingContactEmail', 'type' => 'email', 'required' => false ), - array( 'name' => 'billingContactPhone', 'type' => 'phone', 'required' => false ), - array( 'name' => 'billingContactFax', 'type' => 'phone', 'required' => false ), - array( 'name' => 'billingContactAddress', 'type' => 'string', 'required' => false ), - array( 'name' => 'billingContactPostalCode', 'type' => 'string', 'required' => false ), - array( 'name' => 'billingContactCity', 'type' => 'string', 'required' => false ), - array( 'name' => 'billingContactState', 'type' => 'string', 'required' => false ), - array( 'name' => 'billingContactCountry', 'type' => 'string', 'required' => false ), - - array( 'name' => 'nameservers', 'type' => 'string', 'required' => false ), - array( 'name' => 'transferBlock', 'type' => 'boolean', 'required' => false ), - array( 'name' => 'block', 'type' => 'boolean', 'required' => false ), - array( 'name' => 'whoisPrivacy', 'type' => 'boolean', 'required' => false ), - array( 'name' => 'renewalMode', 'type' => 'list', 'required' => false, 'list' => array( 'autorenew', 'manual', 'letexpire' )) - ); - - return $this->execute( 'domain/update/', $_params, $map ); - } - - /** - * Modify nameservers for a domain. - * This method expects an array of nameservers that should look like this: - * - * $nameservers = array('ns1.dns.com', 'ns2.dns.com) - * - * @link https://docs.dondominio.com/api/#section-5-6 - * - * @param string $domain Domain name or Domain ID to be modified - * @param array $nameservers Array containing the nameservers - * - * @return DonDominioAPIResponse - */ - protected function updateNameServers( $domain, array $nameservers = array()) - { - $_params = array_merge( - $this->getDomainOrDomainID( $domain ), - array( 'nameservers' => implode( ',', $nameservers )) - ); - - $map = array( - array( 'name' => 'domain', 'type' => 'domain', 'required' => true, 'bypass' => 'domainID' ), - array( 'name' => 'domainID', 'type' => 'string', 'required' => true, 'bypass' => 'domain' ), - array( 'name' => 'nameservers', 'type' => 'string', 'required' => true ) - ); - - return $this->execute('domain/updatenameservers/', $_params, $map); - } - - /** - * Modify contact information for a domain. - * Accepts an associative array with the following parameters: - * - * ! = required - * - owner array Associative array of owner contact information. - * - admin array Associative array of administrator contact infromation. - * - tech array Associative array of technical contact information. - * - billing array Associative array of billing contact information. - * - * @link https://docs.dondominio.com/api/#section-5-7 - * - * @param string $domain Domain name or Domain ID to be modified - * @param array $args Associative array of parameters - * - * @return DonDominioAPIResponse - */ - protected function updateContacts($domain, array $args = array()) - { - $_params = array_merge( - $this->getDomainOrDomainID($domain), - $this->flattenContacts($args) - ); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true, 'bypass'=>'domainID'), - array('name'=>'domainID', 'type'=>'string', 'required'=>true, 'bypass'=>'domain'), - - array('name'=>'ownerContactID', 'type'=>'contactID','required'=>false, 'bypass'=>'ownerContactType'), - array('name'=>'ownerContactType', 'type'=>'list', 'required'=>false, 'bypass'=>'ownerContactID', 'list'=>array('individual', 'organization')), - array('name'=>'ownerContactFirstName', 'type'=>'string', 'required'=>false, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactLastName', 'type'=>'string', 'required'=>false, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'ownerContactIdentNumber', 'type'=>'string', 'required'=>false, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactEmail', 'type'=>'email', 'required'=>false, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactPhone', 'type'=>'phone', 'required'=>false, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'ownerContactAddress', 'type'=>'string', 'required'=>false, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactPostalCode', 'type'=>'string', 'required'=>false, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactCity', 'type'=>'string', 'required'=>false, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactState', 'type'=>'string', 'required'=>false, 'bypass'=>'ownerContactID'), - array('name'=>'ownerContactCountry', 'type'=>'string', 'required'=>false, 'bypass'=>'ownerContactID'), - - array('name'=>'adminContactID', 'type'=>'contactID','required'=>false), - array('name'=>'adminContactType', 'type'=>'list', 'required'=>false, 'list'=>array('individual', 'organization')), - array('name'=>'adminContactFirstName', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactLastName', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactIdentNumber', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactEmail', 'type'=>'email', 'required'=>false), - array('name'=>'adminContactPhone', 'type'=>'phone', 'required'=>false), - array('name'=>'adminContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'adminContactAddress', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactPostalCode', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactCity', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactState', 'type'=>'string', 'required'=>false), - array('name'=>'adminContactCountry', 'type'=>'string', 'required'=>false), - - array('name'=>'techContactID', 'type'=>'contactID','required'=>false), - array('name'=>'techContactType', 'type'=>'list', 'required'=>false, 'list'=>array('individual', 'organization')), - array('name'=>'techContactFirstName', 'type'=>'string', 'required'=>false), - array('name'=>'techContactLastName', 'type'=>'string', 'required'=>false), - array('name'=>'techContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'techContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'techContactIdentNumber', 'type'=>'string', 'required'=>false), - array('name'=>'techContactEmail', 'type'=>'email', 'required'=>false), - array('name'=>'techContactPhone', 'type'=>'phone', 'required'=>false), - array('name'=>'techContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'techContactAddress', 'type'=>'string', 'required'=>false), - array('name'=>'techContactPostalCode', 'type'=>'string', 'required'=>false), - array('name'=>'techContactCity', 'type'=>'string', 'required'=>false), - array('name'=>'techContactState', 'type'=>'string', 'required'=>false), - array('name'=>'techContactCountry', 'type'=>'string', 'required'=>false), - - array('name'=>'billingContactID', 'type'=>'contactID','required'=>false), - array('name'=>'billingContactType', 'type'=>'list', 'required'=>false, 'list'=>array('individual', 'organization')), - array('name'=>'billingContactFirstName', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactLastName', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactOrgName', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactOrgType', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactIdentNumber', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactEmail', 'type'=>'email', 'required'=>false), - array('name'=>'billingContactPhone', 'type'=>'phone', 'required'=>false), - array('name'=>'billingContactFax', 'type'=>'phone', 'required'=>false), - array('name'=>'billingContactAddress', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactPostalCode', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactCity', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactState', 'type'=>'string', 'required'=>false), - array('name'=>'billingContactCountry', 'type'=>'string', 'required'=>false) - ); - - return $this->execute('domain/updatecontacts/', $_params, $map); - } - - /** - * Creates a DNS record associated to a domain (gluerecord). - * Accepts an associative array with the following parameters: - * - * ! = required - * ! ipv4 IPv4 IPv4 address for the DNS server - * - ipv6 IPv6 IPv6 address for the DNS server - * - * @link https://docs.dondominio.com/api/#section-5-8 - * - * @param string $domain Domain name or Domain ID to be modified - * @param string $name Name of the gluerecord to be created - * @param array $args Associative array of parameters - * - * @return DonDominioAPIResponse - */ - protected function glueRecordCreate($domain, array $args = array()) - { - $_params = array_merge( - $this->getDomainOrDomainID($domain), - $args - ); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true, 'bypass'=>'domainID'), - array('name'=>'domainID', 'type'=>'string', 'required'=>true, 'bypass'=>'domain'), - array('name'=>'name', 'type'=>'name', 'required'=>true), - array('name'=>'ipv4', 'type'=>'ipv4', 'required'=>true), - array('name'=>'ipv6', 'type'=>'ipv6', 'required'=>false) - ); - - return $this->execute('domain/gluerecordcreate/', $_params, $map); - } - - /** - * Modifies an existing gluerecord for a domain. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! ipv4 IPv4 IPv4 address for the DNS server - * - ipv6 IPv6 IPv6 address for the DNS server - * - * @link https://docs.dondominio.com/api/#section-5-9 - * - * @param string $domain Domain name or Domain ID to be modified - * @param string $name Name of the gluerecord to be updated - * @param array $args Associative array of parameters - * - * @return DonDominioAPIResponse - */ - protected function glueRecordUpdate($domain, array $args = array()) - { - $_params = array_merge( - $this->getDomainOrDomainID($domain), - $args - ); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true, 'bypass'=>'domainID'), - array('name'=>'domainID', 'type'=>'string', 'required'=>true, 'bypass'=>'domain'), - array('name'=>'name', 'type'=>'name', 'required'=>true), - array('name'=>'ipv4', 'type'=>'ipv4', 'required'=>true), - array('name'=>'ipv6', 'type'=>'ipv6', 'required'=>false) - ); - - return $this->execute('domain/gluerecordupdate/', $_params, $map); - } - - /** - * Deletes an existing gluerecord for a domain. - * - * @link https://docs.dondominio.com/api/#section-5-10 - * - * @param string $domain Domain name or Domain ID to be modified - * @param string $name Name of the gluerecord to be deleted - * - * @return DonDominioAPIResponse - */ - protected function glueRecordDelete($domain, array $args = array()) - { - $_params = array_merge( - $this->getDomainOrDomainID($domain), - $args - ); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true, 'bypass'=>'domainID'), - array('name'=>'domainID', 'type'=>'string', 'required'=>true, 'bypass'=>'domain'), - array('name'=>'name', 'type'=>'name', 'required'=>true) - ); - - return $this->execute('domain/gluerecorddelete/', $_params, $map); - } - - /** - * List the domains in the account, filtered by various parameters. - * Accepts an associative array with the following parameters: - * - * ! = required - * - pageLength integer Max results (defaults to 1000) - * - page integer Number of the page to get (defaults to 1) - * - domain string Exact domain name to find - * - word string Filter the list by this string - * - tld string Filter list by this TLD - * - renewable boolean Set to true to get only renewable domains - * - * @link https://docs.dondominio.com/api/#section-5-11 - * - * @param array $args Associative array of parameters - * - * @return DonDominioAPIResponse - */ - protected function getList(array $args = array()) - { - $_params = $args; - - $map = array( - array('name'=>'pageLength', 'type'=>'integer', 'required'=>false), - array('name'=>'page', 'type'=>'integer', 'required'=>false), - array('name'=>'domain', 'type'=>'domain', 'required'=>false), - array('name'=>'word', 'type'=>'string', 'required'=>false), - array('name'=>'tld', 'type'=>'string', 'required'=>false), - array('name'=>'renewable', 'type'=>'boolean', 'required'=>false) - ); - - return $this->execute('domain/list/', $_params, $map); - } - - /** - * Get information from a domain in the account. - * Accepts an associative array with the following parameters: - * - * ! = required - * - infoType string Type of information to get. Accepted values: - * status, contact, nameservers, authcode, service, gluerecords. - * - * @link https://docs.dondominio.com/api/#section-5-12 - * - * @param string $domain Domain name or Domain ID to get the information from - * @param array $args Associative array of parameters - * - * @return DonDominioAPIResponse - */ - protected function getInfo($domain, array $args = array()) - { - $_params = array_merge( - $this->getDomainOrDomainID($domain), - $args - ); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true, 'bypass'=>'domainID'), - array('name'=>'domainID', 'type'=>'string', 'required'=>true, 'bypass'=>'domain'), - array('name'=>'infoType', 'type'=>'list', 'required'=>true, 'list'=>array('status', 'contact', 'nameservers', 'authcode', 'service', 'gluerecords')) - ); - - return $this->execute('domain/getinfo/', $_params, $map); - } - - /** - * Get the authcode for a domain in the account. - * - * @link https://docs.dondominio.com/api/#section-5-13 - * - * @param string $domain Domain name or Domain ID to get the authcode for - * - * @return DonDominioAPIResponse - */ - protected function getAuthCode($domain) - { - $_params = $this->getDomainOrDomainID($domain); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true, 'bypass'=>'domainID'), - array('name'=>'domainID', 'type'=>'string', 'required'=>true, 'bypass'=>'domain'), - ); - - return $this->execute('domain/getauthcode/', $_params, $map); - } - - /** - * Get the nameservers for a domain in the account. - * - * @link https://docs.dondominio.com/api/#section-5-14 - * - * @param string $domain Domain name or Domain ID to get the nameservers for - * - * @return DonDominioAPIResponse - */ - protected function getNameServers($domain) - { - $_params = $this->getDomainOrDomainID($domain); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true, 'bypass'=>'domainID'), - array('name'=>'domainID', 'type'=>'string', 'required'=>true, 'bypass'=>'domain'), - ); - - return $this->execute('domain/getnameservers/', $_params, $map); - } - - /** - * Get the gluerecords for a domain in the account. - * - * @link https://docs.dondominio.com/api/#section-5-15 - * - * @param string $domain Domain name or Domain ID to get the gluerecords for - * - * @return DonDominioAPIResponse - */ - protected function getGlueRecords($domain) - { - $_params = $this->getDomainOrDomainID($domain); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true, 'bypass'=>'domainID'), - array('name'=>'domainID', 'type'=>'string', 'required'=>true, 'bypass'=>'domain'), - ); - - return $this->execute('domain/getgluerecords/', $_params, $map); - } - - /** - * Attempts to renew a domain in the account. - * Accepts an associative array with the following parameters: - * - * ! = required - * - period integer Number of years to renew the domain for - * - * @link https://docs.dondominio.com/api/#section-5-16 - * - * @param string $domain Domain name or Domain ID to renew - * @param string $curExpDate Current expiration date for this domain - * @param array $args Associative array of parameters - * - * @return DonDominioAPIResponse - */ - protected function renew($domain, array $args = array()) - { - $_params = array_merge( - $this->getDomainOrDomainID($domain), - $args - ); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true, 'bypass'=>'domainID'), - array('name'=>'domainID', 'type'=>'string', 'required'=>true, 'bypass'=>'domain'), - array('name'=>'curExpDate', 'type'=>'date', 'required'=>true), - array('name'=>'period', 'type'=>'integer', 'required'=>false) - ); - - return $this->execute('domain/renew/', $_params, $map); - } - - /** - * Performs a whois lookup for a domain name. - * Returns whois data for a domain in a single string field. By default, - * only domains on the user account can be queried. - * - * @link https://docs.dondominio.com/api/#section-5-17 - * - * @param string $domain Domain name to be queried - * - * @return DonDominioAPIResponse - */ - protected function whois($domain) - { - $_params = array('domain'=>$domain); - - $map = array( - array('name'=>'domain', 'type'=>'domain', 'required'=>true) - ); - - return $this->execute('domain/whois/', $_params, $map); - } - - /** - * Check whether the domain is a domain name or a domain ID. - * - * Some calls can be provided with a domain name or a domain ID. To simplify - * methods, we only ask for one parameter and we try to identify if it's a - * Domain Name or a Domain ID. - * - * If we can find a dot (.) inside $domain, then it's a Domain Name. If not, - * we assume it's a Domain ID. - * - * This method returns an array ready to be passed to any API call or to be - * merged with more parameters. - * - * @param string $domain Domain name or Domain ID - * - * @return array - */ - protected function getDomainOrDomainID($domain) - { - if(strpos($domain, '.')){ - return array('domain' => $domain); - }else{ - return array('domainID' => $domain); - } - } - - /** - * Convert a multi-dimensional array of parameters (w/ contacts) to its - * flattened equivalent. - * - * We take an array that looks like this: - * Array => [ - * 'domain' => 'example.com', - * 'owner' => [ - * 'firstName' => 'John', - * 'lastName' => 'Doe' - * ] - * ] - * - * And flatten it so it looks like this: - * Array => [ - * 'domain' => 'example.com', - * 'ownerContactFirstName' => 'John', - * 'ownerContactLastName' => 'Doe' - * ] - * - * @param array $args Associative array of arguments - * @return array Flattened array - */ - protected function flattenContacts(array $args = array()) - { - $_params = array(); - - foreach($args as $section=>$argument){ - //We only parse arrays inside the array that match one of the four contact types - if(is_array($argument) && in_array($section, array('owner', 'admin', 'billing', 'tech'))){ - foreach($argument as $key=>$value){ - //Automagically add the 'Contact' word to the key - $_params[$section . 'Contact' . ucfirst($key)] = $value; - } - }else{ - $_params[$section] = $argument; - } - } - - //The flattened array - return $_params; - } -} - -?> \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/Wrappers/DonDominioAPIModule.php b/lib/sdk/DonDominioAPI/Wrappers/DonDominioAPIModule.php deleted file mode 100644 index 342fafa..0000000 --- a/lib/sdk/DonDominioAPI/Wrappers/DonDominioAPIModule.php +++ /dev/null @@ -1,377 +0,0 @@ -master = $master; - } - - /** - * Proxy a request to a method in this class and return its result. - * @param string $method Requested method - * @param array $args Arguments passed to the method - * @return DonDominioResponse - */ - public function proxy($method, array $args = array()) - { - $class_name = __CLASS__; - - if( strpos( '_', __CLASS__ )){ - $class_array = explode( '_', __CLASS__ ); - $class_name = $class_array[1]; - } - - if( !method_exists( $this, $method )){ - trigger_error( 'Method ' . $method . ' not found in ' . $class_name, E_USER_ERROR ); - } - - return call_user_func_array( array( $this, $method ), $args ); - } - - /** - * Output the response in the appropriate format. - * @param string $response Response in JSON format - * @return string|array|DonDominioResponse - */ - protected function output($response) - { - return new DonDominioAPIResponse( - $response, - $this->master->getOption('response') - ); - } - - /** - * Simulates an error from the API for internal purposes. - * This makes an error produced by the client compatible with the - * DonDominioResponse object. - * @param string $message Error message - * @param integer $errorCode Optional error code - * @return string - */ - protected function error($errorCodeMsg, $errorCode = -1, array $messages = array()) - { - return json_encode( - array( - 'success'=>false, - 'errorCode'=>$errorCode, - 'errorCodeMsg'=>$errorCodeMsg, - 'action'=>'', - 'version'=>'', - 'messages'=>$messages - ) - ); - } - - /** - * Validate the parameters passed to a call and return the result from the API call. - * @param string $url URL to be called - * @param array $params Parameters to be passed to the call - * @param array $map Map of validations to perform against the parameters - * @return DonDominioResponse - */ - protected function execute($url, array $params = array(), array $map = array()) - { - $errors = array(); - - if(count($map) > 0 && $this->master->getOption('autoValidate') == true){ - $errors = $this->validate($params, $map); - } - - if(is_array($errors) && count($errors) > 0){ - return $this->output( - $this->error( - 'Validation error', - -1, - $errors - ) - ); - }else{ - $output = $this->output($this->master->call($url, $params)); - - //Check the version from the API call to see if it matches the version - //of this client. - if($this->master->getOption('versionCheck')){ - $version = explode('.', $output->getVersion()); - - if($this->master->api_version_minor < $version[1] && $this->master->api_version_major == $version[0]){ - trigger_error('This client is not up to date. It\'s recommended to update it to match the API version being used.', E_USER_WARNING); - } - - if($this->master->api_version_major < $version[0]){ - trigger_error('This client is deprecated. You must update to the latest version.', E_USER_WARNING); - } - } - - return $output; - } - } - - /** - * Validate parameters passed to a call and return an array of the errors found. - * @param array $params Parameters passed to the call - * @param array $map Map of validations to perform against the parameters - * @return array - */ - protected function validate(array $params = array(), array $map = array()) - { - $errors = array(); - - foreach($map as $key=>$parameter){ - if($parameter['required'] == true && (!array_key_exists($parameter['name'], $params) || empty($params[$parameter['name']]))){ - if(array_key_exists('bypass', $parameter)){ - $bypass = $parameter['bypass']; - - if(!array_key_exists($bypass, $params) || empty($params[$bypass])){ - $errors[] = 'Parameter "' . $parameter['name'] . '" missing'; - } - }else{ - $errors[] = 'Parameter "' . $parameter['name'] . '" missing'; - } - } - - if(array_key_exists($parameter['name'], $params)){ - $value = $params[$parameter['name']]; - - if(!is_null($value)){ - switch($parameter['type']){ - /* - * LIST - * When validating against a list, the provided value must match one of - * the possible values listed in the validator. - */ - case 'list': - if(!in_array($value, $parameter['list'])){ - $errors[] = '"' . $value . '" is not a valid value for parameter "' . $parameter['name'] . '". Accepted values: "' . implode('", "', $parameter['list']) . '"'; - } - - break; - - /* - * BOOLEAN - */ - case 'boolean': - if(!is_bool($value)){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a boolean'; - } - - break; - - /* - * STRING - */ - case 'string': - if(!is_string($value)){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a string'; - } - - break; - - /* - * INTEGER - */ - case 'integer': - if(!is_integer($value)){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be an integer'; - } - - if( isset( $parameter['min'] ) && $value < intval( $parameter['min'] )){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be ' . $parameter['min'] . ' or more'; - } - - if( isset( $parameter['max'] ) && $value > intval( $parameter['max'] )){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be ' . $parameter['max'] . ' or less'; - } - - break; - - /* - * FLOAT - */ - case 'float': - if(!is_float($value)){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a float'; - } - - if( isset( $parameter['min'] ) && $value < floatval( $parameter['min'] )){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be ' . $parameter['min'] . ' or more'; - } - - if( isset( $parameter['max'] ) && $value > floatval( $parameter['max'] )){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be ' . $parameter['min'] . ' or less'; - } - - break; - - /* - * EMAIL - */ - case 'email': - if(!filter_var($value, FILTER_VALIDATE_EMAIL)){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a valid email address'; - } - - break; - - /* - * PHONE - * Phones have the following format: +DD.DDDDDDDD... - * The part after the dot has an undefined longitude. - */ - case 'phone': - if(!preg_match('/^\+(\d+)\.(\d+)$/i', $value)){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a valid phone number, in +DD.DDDDDDDD... format'; - } - - break; - - /* - * URL - */ - case 'url': - if(!filter_var($value, FILTER_VALIDATE_URL)){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a valid URL'; - } - - break; - - /* - * DOMAIN - * Domains must be valid CNAMEs. - */ - case 'domain': - if(!$this->cname(strtolower($value))){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a valid domain name'; - } - - break; - - /* - * COUNTRY CODE - * Country codes must be ISO-3166-1 alfa-2 codes (for example, ES for Spain) - */ - case 'countryCode': - if(!preg_match("/^([A-Z][A-Z])$/i", $value)){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a valid Country Code'; - } - - break; - - /* - * CONTACT ID - * Contact IDs must be in DonDominio's format: AA-00000. - */ - case 'contactID': - if(!preg_match("/^([A-Z]+)(-)([0-9]+)$/i", $value)){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a valid Contact ID'; - } - - break; - - /* - * DATE - * Dates must be specified in YYYYMMDD or YYYY-MM-DD format. - */ - case 'date': - if(!preg_match("/^[0-9]{4}(-?)(0[1-9]|1[0-2])(-?)(0[1-9]|[1-2][0-9]|3[0-1])$/i", $value)){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a valid date, in YYYYMMDD or YYYY-MM-DD format'; - } - - break; - - /* - * IP v4 - */ - case 'ipv4': - if(!filter_var( - $value, - FILTER_VALIDATE_IP, - array('flags' => - FILTER_FLAG_IPV4, - FILTER_FLAG_NO_PRIV_RANGE, - FILTER_FLAG_NO_RES_RANGE - )) - ){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a valid IPv4 address'; - } - - break; - - /* - * IP v6 - */ - case 'ipv6': - if(!filter_var( - $value, - FILTER_VALIDATE_IP, - array('flags' => - FILTER_FLAG_IPV6, - FILTER_FLAG_NO_PRIV_RANGE, - FILTER_FLAG_NO_RES_RANGE - )) - ){ - $errors[] = 'Parameter "' . $parameter['name'] . '" must be a valid IPv6 address'; - } - - break; - - } - } - } - } - - return $errors; - } - - /** - * Check if a provided string is a valid CNAME. - * @param string $cname String to check - * @return boolean - */ - protected function cname($cname) - { - if (!preg_match('/^([a-z0-9\-\.]+)\.[a-z]{2,30}$/i', $cname)){ - return false; - } - - $double_punctuation = ( - strpos($cname, '..') !== false - || strpos($cname, '-.') !== false - || strpos($cname, '.-') !== false - ); - - if($double_punctuation){ - return false; - } - - if(strpos($cname, '.') !== false && strpos($cname, '.') == 0){ - return false; - } - - if(strpos($cname, '-') !== false && strpos($cname, '-') == 0){ - return false; - } - - return true; - } -} - -?> diff --git a/lib/sdk/DonDominioAPI/Wrappers/Service.php b/lib/sdk/DonDominioAPI/Wrappers/Service.php deleted file mode 100644 index b97a39f..0000000 --- a/lib/sdk/DonDominioAPI/Wrappers/Service.php +++ /dev/null @@ -1,1396 +0,0 @@ - 'pageLength', 'type' => 'integer', 'required' => false ), - array( 'name' => 'page', 'type' => 'integer', 'required' => false ), - array( 'name' => 'name', 'type' => 'string', 'required' => false ), - array( 'name' => 'word', 'type' => 'string', 'required' => false ), - array( 'name' => 'tld', 'type' => 'string', 'required' => false ), - array( 'name' => 'renewable', 'type' => 'boolean', 'required' => false ), - array( 'name' => 'status', 'type' => 'list', 'required' => false, 'list' => array( 'init', 'active', 'inactive', 'renewed', 'renewable' )) - ); - - return $this->execute( 'service/list/', $_params, $map ); - } - - /** - * Retrieves information about a service/hosting. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! infoType string One of: status, resources, serverinfo - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-2 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function getInfo( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'infoType', 'type' => 'list', 'required' => true, 'list' => array( 'status', 'resources', 'serverinfo' )) - ); - - return $this->execute( 'service/getinfo/', $_params, $map ); - } - - /** - * Creates or associates a new hosting service. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! productKey string One of: redir, mini, mail, basic, professional, advanced - * - period integer Duration, in years, of the service - * - * @link https://dev.mrdomain.com/api/docs/api/#section-7-3 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function create( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'productKey', 'type' => 'list', 'required' => true, 'list' => array( 'redir', 'mini', 'mail', 'basic', 'professional', 'advanced' )), - array( 'name' => 'period', 'type' => 'integer', 'required' => false ) - ); - - return $this->execute( 'service/create/', $_params, $map ); - } - - /** - * Renews an existing hosting service. - * Accepts an associative array with the following parameters: - * - * ! = required - * - period integer Period, in years, to renew the service for (defaults to 1 year) - * - * @link https://dev.mrdomain.com/api/docs/api/#section-7-4 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function renew( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'period', 'type' => 'integer', 'required' => false ) - ); - - return $this->execute( 'service/renew/', $_params, $map ); - } - - /** - * Upgrades the service to a higher plan. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! productKey string One of: redir, mini, mail, basic, professional, advanced - * - * @link https://dev.mrdomain.com/api/docs/api/#section-7-5 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of arguments (see table) - * - * @return DonDominioAPIResponse - */ - protected function upgrade( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'productKey', 'type' => 'list', 'required' => true, 'list' => array( 'redir', 'mini', 'mail', 'basic', 'professional', 'advanced' )) - ); - - return $this->execute( 'service/upgrade/', $_params, $map ); - } - - /** - * Modifies global parameters of an existing service. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! updateType string One of: renewalMode - * - renewalMode string One of: autorenew, manual - * - * @link https://dev.mrdomain.com/api/docs/api/#section-7-6 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function update( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'updateType', 'type' => 'list', 'required' => true, 'list' => array( 'renewalMode' )), - array( 'name' => 'renewalMode', 'type' => 'list', 'required' => false, 'list' => array( 'autorenew', 'manual' )) - ); - - return $this->execute( 'service/update/', $_params, $map ); - } - - /** - * Retrieves information about a parking service. - * - * @link https://dev.mrdomain.com/api/docs/api/#section-7-7 - * - * @param string $serviceName Name of the service - * - * @return DonDominioAPIResponse - */ - protected function parkingGetInfo( $serviceName ) - { - $_params = array( 'serviceName' => $serviceName ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'text', 'required' => true ) - ); - - return $this->execute( 'service/parkinggetinfo/', $_params, $map ); - } - - /** - * Modifies parameters from the Parking Service. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! enabled boolean Enable/Disable parking service - * - * @link https://dev.mrdomain.com/api/docs/api/#section-7-8 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function parkingUpdate( $serviceName, array $args = array()) - { - $_params = array_merge( - array( 'serviceName' => $serviceName ), - $args - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'enabled', 'type' => 'boolean', 'required' => true ) - ); - - return $this->execute( 'service/parkingupdate/', $_params, $map ); - } - - /** - * Retrieves the URL needed to log in the Webconstructor service. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! subdomain string The subdomain associated with the Webconstructor - * - loginlang string Default language for the Webconstructor interface - * - * @link https://dev.mrdomain.com/api/docs/api/#section-7-7 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function webConstructorLogin( $serviceName, array $args = array()) - { - $_params = array_merge( - array( 'serviceName' => $serviceName ), - $args - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'subdomain', 'type' => 'text', 'required' => true ), - array( 'name' => 'loginlang', 'type' => 'text', 'required' => false ) - ); - - return $this->execute( 'service/webconstructorlogin/', $_params, $map ); - } - - /** - * Lists/Searchs FTP accounts under the specified service. - * Accepts an associative array with the following parameters: - * - * ! = required - * - pageLength integer Number of results to display in a single query - * - page integer Results page - * - filter string Filter results by this text - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-10 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function ftpList( $serviceName, array $args = array()) - { - $_params = array_merge( - array( 'serviceName' => $serviceName ), - $args - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'pageLength', 'type' => 'integer', 'required' => false ), - array( 'name' => 'page', 'type' => 'integer', 'required' => false ), - array( 'name' => 'filter', 'type' => 'string', 'required' => false ) - ); - - return $this->execute( 'service/ftplist/', $_params, $map ); - } - - /** - * Retrieves information about an FTP account. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-11 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function ftpGetInfo( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/ftpgetinfo/', $_params, $map ); - } - - /** - * Creates a new FTP account. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! name string Name of the account (username) - * ! ftpPath string Path (directory) for this account - * ! password string Password for the username - * ! quota integer Quota, in bytes, for the account. Min: 1MB - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-12 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function ftpCreate( $serviceName, array $args = array()) - { - $_params = array_merge( - array( 'serviceName' => $serviceName ), - $args - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'name', 'type' => 'string', 'required' => true ), - array( 'name' => 'ftpPath', 'type' => 'string', 'required' => true ), - array( 'name' => 'password', 'type' => 'string', 'required' => true ), - array( 'name' => 'quota', 'type' => 'integer', 'required' => true, 'min' => 1048576 ) - ); - - return $this->execute( 'service/ftpcreate/', $_params, $map ); - } - - /** - * Updates settings and parameters of an existing FTP account. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! ftpPath string Path (directory) for this account - * ! password string Password for the username - * ! quota integer Quota, in bytes, for the account. Min: 1MB - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-13 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function ftpUpdate( $serviceName, $entityID, array $args = array()) - { - $_params = array_merge( - array( - array( 'serviceName' => $serviceName ), - array( 'entityID' => $entityID ) - ), - $args - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ), - array( 'name' => 'ftpPath', 'type' => 'string', 'required' => true ), - array( 'name' => 'password', 'type' => 'string', 'required' => true ), - array( 'name' => 'quota', 'type' => 'integer', 'required' => true, 'min' => 1048576 ) - ); - - return $this->execute( 'service/ftpupdate/', $_params, $map ); - } - - /** - * Deletes an existing FTP account. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-14 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function ftpDelete( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/ftpdelete/', $_params, $map ); - } - - /** - * Searchs/lists databases in an specific service. - * Accepts an associative array with the following parameters: - * - * ! = required - * - pageLength integer Number of results to display in a single query - * - page integer Results page - * - filter string Filter results by this text - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-15 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function ddbbList( $serviceName, array $args = array()) - { - $_params = array_merge( - array( 'serviceName' => $serviceName ), - $args - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'pageLength', 'type' => 'integer', 'required' => false ), - array( 'name' => 'page', 'type' => 'integer', 'required' => false, 'min' => 1 ), - array( 'name' => 'filter', 'type' => 'string', 'required' => false ) - ); - - return $this->execute( 'service/ddbblist/', $_params, $map ); - } - - /** - * Retrieves information from an existing Database. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-16 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function ddbbGetInfo( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/ddbbgetinfo/', $_params, $map ); - } - - /** - * Creates a new Database. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! password string Password for the Database account - * - externalAccess boolean Enable/Disable external access to the database (disabled by default) - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-17 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function ddbbCreate( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'password', 'type' => 'string', 'required' => true ), - array( 'name' => 'externalAccess', 'type' => 'boolean', 'required' => false ) - ); - - return $this->execute( 'service/ddbbcreate/', $_params, $map ); - } - - /** - * Modifies settings and parameters for an existing Database. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! password string Set password for the database account - * - externalAccess boolean Enable/disable external access for the database (disabled by default) - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-18 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function ddbbUpdate( $serviceName, $entityID, array $args = array()) - { - $_params = array_merge( - array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ), - $args - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ), - array( 'name' => 'password', 'type' => 'string', 'required' => true ), - array( 'name' => 'externalAccess', 'type' => 'boolean', 'required' => false ) - ); - - return $this->execute( 'service/ddbbupdate/', $_params, $map ); - } - - /** - * Deletes a Database. - * This, of course, drops all database information. Use with caution. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-19 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function ddbbDelete( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/ddbbdelete/', $_params, $map ); - } - - /** - * Searchs/Lists subdomains in an specific service. - * Accepts an associative array with the following parameters: - * - * ! = required - * - pageLength integer Number of results to display in a single query - * - page integer Results page - * - filter string Filter results by this text - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-20 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function subdomainList( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'pageLength', 'type' => 'integer', 'required' => false ), - array( 'name' => 'page', 'type' => 'integer', 'required' => false, 'min' => 1 ), - array( 'name' => 'filter', 'type' => 'string', 'required' => false ) - ); - - return $this->execute( 'service/subdomainlist/', $_params, $map ); - } - - /** - * Retrieves information from an existing subdomain. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-21 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function subdomainGetInfo( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/subdomaingetinfo/', $_params, $map ); - } - - /** - * Creates a new Subdomain. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! name string Name for the subdomain (the subdomain itself) - * ! ftpPath string The FTP path where the files for the subdomain will be hosted - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-22 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function subdomainCreate( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'name', 'type' => 'string', 'required' => true ), - array( 'name' => 'ftpPath', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/subdomaincreate/', $_params, $map ); - } - - /** - * Modifies settings and parameters for an existing Subdomain. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! ftpPath string The FTP path where the files for the subdomain will be hosted - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-23 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function subdomainUpdate( $serviceName, $entityID, array $args = array()) - { - $_params = array_merge( - array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ), - $args - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityId', 'type' => 'string', 'required' => true ), - array( 'name' => 'ftpPath', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/subdomainupdate/', $_params, $map ); - } - - /** - * Deletes a Subdomain. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-24 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function subdomainDelete( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/subdomaindelete/', $_params, $map ); - } - - /** - * Searchs/Lists redirections in an specific service. - * Accepts an associative array with the following parameters: - * - * ! = required - * - pageLength integer Number of results to display in a single query - * - page integer Results page - * - filter string Filter results by this text - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-25 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function redirectList( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'pageLength', 'type' => 'integer', 'required' => false ), - array( 'name' => 'page', 'type' => 'integer', 'required' => false, 'min' => 1 ), - array( 'name' => 'filter', 'type' => 'string', 'required' => false ) - ); - - return $this->execute( 'service/redirectlist/', $_params, $map ); - } - - /** - * Retrieves information from an existing redirection. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-26 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function redirectGetInfo( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/redirectgetinfo/', $_params, $map ); - } - - /** - * Creates a new Redirection. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! origin string Origin of the Redirection (from) - * ! destination string Destination of the Redirection (to) - * ! type string One of: 301, 302, frame - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-27 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function redirectCreate( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'origin', 'type' => 'string', 'required' => true ), - array( 'name' => 'destination', 'type' => 'string', 'required' => true ), - array( 'name' => 'type', 'type' => 'list', 'required' => true, 'list' => array( '301', '302', 'frame' )) - ); - - return $this->execute( 'service/redirectcreate/', $_params, $map ); - } - - /** - * Modifies settings and parameters for an existing Redirection. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! destination string Destination of the Redirection (to) - * ! type string One of: 301, 302, frame - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-28 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function redirectUpdate( $serviceName, $entityID, array $args = array()) - { - $_params = array_merge( - array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ), - $args - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ), - array( 'name' => 'destination', 'type' => 'string', 'required' => true ), - array( 'name' => 'type', 'type' => 'list', 'required' => true, 'list' => array( '301', '302', 'frame' )) - ); - - return $this->execute( 'service/redirectupdate/', $_params, $map ); - } - - /** - * Deletes a Redirection. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-29 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function redirectDelete( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/redirectdelete/', $_params, $map ); - } - - /** - * Searchs/Lists email accounts in an specific service. - * Accepts an associative array with the following parameters: - * - * ! = required - * - pageLength integer Number of results to display in a single query - * - page integer Results page - * - filter string Filter results by this text - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-30 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function mailList( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'pageLength', 'type' => 'integer', 'required' => false ), - array( 'name' => 'page', 'type' => 'integer', 'required' => false, 'min' => 1 ), - array( 'name' => 'filter', 'type' => 'string', 'required' => false ) - ); - - return $this->execute( 'service/maillist/', $_params, $map ); - } - - /** - * Retrieves information from an existing email account. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-31 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function mailGetInfo( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/mailgetinfo/', $_params, $map ); - } - - /** - * Creates a new Email Account. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! name string Name of the account (username) - * ! password string Password for the account - * - spamfilter boolean Enable or disable the SPAM filter (enabled by default) - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-32 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function mailCreate( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'name', 'type' => 'string', 'required' => true ), - array( 'name' => 'password', 'type' => 'string', 'required' => true ), - array( 'name' => 'spamfilter', 'type' => 'boolean', 'required' => false ) - ); - - return $this->execute( 'service/mailcreate/', $_params, $map ); - } - - /** - * Modifies settings and parameters for an existing Email Account. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! password string Password for the account - * - spamfilter boolean Enable or disable the SPAM filter (enabled by default) - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-33 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function mailUpdate( $serviceName, $entityID, array $args = array()) - { - $_params = array_merge( - array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ), - $args - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ), - array( 'name' => 'password', 'type' => 'string', 'required' => true ), - array( 'name' => 'spamfilter', 'type' => 'boolean', 'required' => false ) - ); - - return $this->execute( 'service/mailupdate/', $_params, $map ); - } - - /** - * Deletes an Email account. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-34 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function mailDelete( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/maildelete/', $_params, $map ); - } - - /** - * Searchs/Lists email alias in an specific service. - * Accepts an associative array with the following parameters: - * - * ! = required - * - pageLength integer Number of results to display in a single query - * - page integer Results page - * - filter string Filter results by this text - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-35 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function mailAliasList( $servicename, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'pageLength', 'type' => 'integer', 'required' => false ), - array( 'name' => 'page', 'type' => 'integer', 'required' => false, 'min' => 1 ), - array( 'name' => 'filter', 'type' => 'string', 'required' => false ) - ); - - return $this->execute( 'service/mailaliaslist/', $_params, $map ); - } - - /** - * Retrieves information from an existing email alias. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-36 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function mailAliasGetInfo( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/mailaliasgetinfo/', $_params, $map ); - } - - /** - * Creates a new Email Alias. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! name string Name of the alias (the part before the '@') - * ! target string Target Email account(s) (for more than one, use ',') - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-37 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function mailAliasCreate( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'name', 'type' => 'string', 'required' => true ), - array( 'name' => 'target', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/mailaliascreate/', $_params, $map ); - } - - /** - * Modifies settings and parameters for an existing Email Alias. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! target string Target Email account(s) (for more than one, use ',') - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-38 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function mailAliasUpdate( $serviceName, $entityID, array $args = array()) - { - $_params = array_merge( - array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ), - $args - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ), - array( 'name' => 'target', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/mailaliasupdate/', $_params, $map ); - } - - /** - * Deletes an Email Alias. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-39 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function mailAliasDelete( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/mailaliasdelete/', $_params, $map ); - } - - /** - * Searchs/Lists DNS zones in an specific service. - * Accepts an associative array with the following parameters: - * - * ! = required - * - pageLength integer Number of results to display in a single query - * - page integer Results page - * - filter string Filter results by this text - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-40 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function dnsList( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'pageLength', 'type' => 'integer', 'required' => false ), - array( 'name' => 'page', 'type' => 'integer', 'required' => false, 'min' => 1 ), - array( 'name' => 'filter', 'type' => 'string', 'required' => false ) - ); - - return $this->execute( 'service/dnslist/', $_params, $map ); - } - - /** - * Retrieves information from an existing DNS zone. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-41 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function dnsGetInfo( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/dnsgetinfo/', $_params, $map ); - } - - /** - * Creates a new DNS zone. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! name string Name of the DNS zone - * ! type string One of: A, AAAA, CNAME, MX, SRV, TXT, NS - * ! value string The value of the DNS zone, depending on its type - * - ttl string Time to live (use '-' for default) - * - priority string Priority of this zone (use '-' for default) - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-42 - * - * @param string $serviceName Name of the service - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function dnsCreate( $serviceName, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'name', 'type' => 'string', 'required' => true ), - array( 'name' => 'type', 'type' => 'list', 'required' => true , 'list' => array( 'A', 'AAAA', 'CNAME', 'MX', 'SRV', 'TXT', 'NS' )), - array( 'name' => 'value', 'type' => 'string', 'required' => true ), - array( 'name' => 'ttl', 'type' => 'string', 'required' => false ), - array( 'name' => 'priority', 'type' => 'string', 'required' => false ) - ); - - return $this->execute( 'service/dnscreate/', $_params, $map ); - } - - /** - * Modifies settings and parameters for an existing DNS zone. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! value string The value of the DNS zone, depending on its type - * - ttl string Time to live (use '-' for default) - * - priority string Priority of this zone (use '-' for default) - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-43 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function dnsUpdate( $serviceName, $entityID, array $args = array()) - { - $_params = array_merge( array( 'serviceName' => $serviceName ), $args ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ), - array( 'name' => 'value', 'type' => 'string', 'required' => true ), - array( 'name' => 'ttl', 'type' => 'string', 'required' => false ), - array( 'name' => 'priority', 'type' => 'string', 'required' => false ) - ); - - return $this->execute( 'service/dnsupdate/', $_params, $map ); - } - - /** - * Deletes a DNS zone. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-44 - * - * @param string $serviceName Name of the service - * @param string $entityID Entity identifier - * - * @return DonDominioAPIResponse - */ - protected function dnsDelete( $serviceName, $entityID ) - { - $_params = array( - 'serviceName' => $serviceName, - 'entityID' => $entityID - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'entityID', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/dnsdelete/', $_params, $map ); - } - - /** - * Restores the entire service to the default DNS zones. - * This, of course, destrois all previous DNS zones. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-45 - * - * @param string $serviceName Name of the service - * - * @return DonDominioAPIResponse - */ - protected function dnsRestore( $serviceName ) - { - $_params = array( 'serviceName' => $serviceName ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/dnsrestore/', $_params, $map ); - } - - /** - * Sets all the DNS zones for the service directly. - * This destrois all previous DNS zones that may exist. Accepts an associative, multidimensional - * array of parameters. - * - * Each array in $dnsZoneData must include the following parameters: - * ! name string Name of the DNS zone - * ! type string One of: One of: A, AAAA, CNAME, MX, SRV, TXT, NS - * ! ttl string Time to live (use '-' to set default) - * ! priority string Priority of the zone (use '-' to set default) - * ! value string Value for this zone, depending on its type - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-46 - * - * @param string $serviceName Name of the service - * @param array $dnsZoneData Multidimensional associative array containing DNS data - * - * @return DonDominioAPIResponse - */ - protected function dnsSetZone( $serviceName, array $dnsZoneData = array()) - { - $_params = array_merge( - array( - 'serviceName' => $serviceName, - 'dnsZoneData' => base64_encode( json_encode( $dnsZoneData )) - ) - ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ), - array( 'name' => 'dnsZoneData', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/dnssetzone/', $_params, $map ); - } - - /** - * Deletes all DNS zones inside a service. - * This, of course, will destroy all DNS zones. Use with caution. - * - * @link https://dev.dondominio.com/api/docs/api/#section-7-47 - * - * @param string $serviceName Name of the service - * - * @return DonDominioAPIResponse - */ - protected function dnsDeleteAll( $serviceName ) - { - $_params = array( 'serviceName' => $serviceName ); - - $map = array( - array( 'name' => 'serviceName', 'type' => 'string', 'required' => true ) - ); - - return $this->execute( 'service/dnsdeleteall/', $_params, $map ); - } -} - -?> \ No newline at end of file diff --git a/lib/sdk/DonDominioAPI/Wrappers/Tool.php b/lib/sdk/DonDominioAPI/Wrappers/Tool.php deleted file mode 100644 index eca4a90..0000000 --- a/lib/sdk/DonDominioAPI/Wrappers/Tool.php +++ /dev/null @@ -1,191 +0,0 @@ -execute('tool/hello/', $_params); - } - - /** - * Converts a string or domain name to unicode or punycode (IDNA). - * - * @link https://docs.dondominio.com/api/#section-3-2 - * @link http://en.wikipedia.org/wiki/Internationalized_domain_name#Example_of_IDNA_encoding - * - * @param string $query String to be converted - * - * @return DonDominioAPIResponse - */ - protected function idnConverter($query) - { - if(empty($query)){ - $query = ''; - } - - $_params = array('query'=>$query); - - $map = array( - array('name'=>'query', 'type'=>'string', 'required'=>true) - ); - - return $this->execute('tool/idnconverter/', $_params, $map); - } - - /** - * Generates suggestions for domains based on a word. - * Accepts an associative array with the following parameters: - * - * ! = required - * ! query string The word to search for - * - language string One of: es, en, zh, fr, de, kr, pt, tr (defaults to es) - * - tlds string One of: com, net, tv, cc, es, org, info, biz, eu (defaults to "com,net,tv,es"); separate with commas - * - * @link https://dev.dondominio.com/api/docs/api/#section-3-3 - * - * @param array $args Associative array of parameters (see table) - * - * @return DonDominioAPIResponse - */ - protected function domainSuggests( array $args = array()) - { - $_params = $args; - - $map = array( - array( 'name' => 'query', 'type' => 'string', 'required' => true ), - array( 'name' => 'language', 'type' => 'string', 'required' => false ), - array( 'name' => 'tlds', 'type' => 'string', 'required' => false ) - ); - - return $this->execute( 'tool/domainsuggests/', $_params, $map ); - } - - /** - * Get various types of code tables used by the API. - * - * @link https://docs.dondominio.com/api/#section-3-4 - * - * @param string $tableType Table to get - * - * @return DonDominioAPIResponse - */ - protected function getTable($tableType) - { - if(empty($tableType)){ - $tableType = ''; - } - - $_params = array('tableType'=>$tableType); - - $map = array( - array('name'=>'tableType', 'type'=>'list', 'required'=>true, 'list'=>array('countries', 'es_juridic')) - ); - - return $this->execute('tool/gettable/', $_params, $map); - } - - /** - * Decode the parameters contained in a CSR. - * - * @link https://docs.dondominio.com/api/#section-3-5 - * @link http://en.wikipedia.org/wiki/Certificate_signing_request - * - * @param string $csrData CSR data (including ---BEGIN--- and ---END---) - * - * @return DonDominioAPIResponse - */ - protected function csrDecode($csrData) - { - if(empty($csrData)){ - $csrData = ''; - } - - $_params = array('csrData'=>$csrData); - - $map = array( - array('name'=>'csrData', 'type'=>'string', 'required'=>true) - ); - - return $this->execute('tool/csrdecode/', $_params, $map); - } - - /** - * Test the DNS servers for a domain using the Domain Information Groper. - * Accepts an associative array with the following parameters: - * - * @link https://docs.dondominio.com/api/#section-3-6 - * @link https://en.wikipedia.org/wiki/Dig_(command) - * - * ! = required - * ! query string Domain/query to test - * ! type list One of: A, AAAA, ANY, CNAME, MX, NS, SOA, or TXT - * ! nameserver IPv4 DNS server to use to test the domain - * - * @param array $args Associative array of parameters - * - * @return DonDominioAPIResponse - */ - protected function dig(array $args = array()) - { - $map = array( - array('name' => 'query', 'type' => 'string', 'required' => true), - array('name' => 'type', 'type' => 'list', 'required' => true, 'list' => array('A', 'AAAA', 'ANY', 'CNAME', 'MX', 'NS', 'SOA', 'TXT')), - array('name' => 'nameserver', 'type' => 'ipv4', 'required' => true) - ); - - return $this->execute('tool/dig/', $args, $map); - } - - /** - * Checks the domain zone. - * Accepts an associative array with the following parameters: - * - * @link https://docs.dondominio.com/api/#section-3-7 - * - * ! = required - * ! nameservers string Comma-separated list of DNS servers (min 2, max 7). - * - * @param string $domain Domain to be checked - * @param array $args Associative array of parameters - * - * @return DonDominioAPIResponse - */ - protected function zonecheck($domain, array $args = array()) - { - $_params = array_merge( - array('domain' => $domain), - $args - ); - - $map = array( - array('name' => 'domain', 'type' => 'domain', 'required' => true), - array('name' => 'nameservers', 'type' => 'string', 'required' => true) - ); - - return $this->execute('tool/zonecheck/', $_params, $map); - } -} - -?> \ No newline at end of file diff --git a/version.json b/version.json index 2e7c523..b9778a6 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "version": "0.5", - "releaseDate": "2016-01-08" + "version": "0.6", + "releaseDate": "2016-02-22" -} \ No newline at end of file +} diff --git a/whoisproxy.php b/whoisproxy.php deleted file mode 100644 index 307ade2..0000000 --- a/whoisproxy.php +++ /dev/null @@ -1,54 +0,0 @@ - 'https://simple-api.dondominio.net', - 'apiuser' => $config['apiUsername'], - 'apipasswd' => $config['apiPassword'], - 'autoValidate' => true, - 'versionCheck' => true, - 'response' => array( - 'throwExceptions' => true - ), - 'userAgent' => array( - 'WhoisProxyAddonForWHMCS' => '1.0' - ) -); - -//Checking allowed IPs -$ip = $config['ip']; - -$ip_array = explode( ';', $ip ); - -$current_ip = $_SERVER['REMOTE_ADDR']; - -if( !in_array( $current_ip, $ip_array )){ - die( "Error: $current_ip not allowed to access this script." ); -} - -try{ - $dondominio = new DonDominioAPI( $options ); -}catch( \DonDominioAPI_Error $e ){ - die( $e->getMessage()); -} - -try{ - $whois = $dondominio->domain_check( $_REQUEST['domain'] ); -}catch( \DonDominioAPI_Error $e ){ - die( $e->getMessage()); -} - -$domain = $whois->get( "domains" )[0]; - -if( $domain['available'] ){ - die( "DDAVAILABLE" ); -}else{ - die( "Not Available" ); -} - -?> \ No newline at end of file