├── ChangeLog ├── TODO ├── HOWTO ├── whmcs └── modules │ └── registrars │ └── registrobr │ ├── logo.gif │ ├── install.sh │ ├── Net │ ├── EPP │ │ ├── Frame │ │ │ ├── Hello.php │ │ │ ├── Command │ │ │ │ ├── Logout.php │ │ │ │ ├── Info │ │ │ │ │ ├── Host.php │ │ │ │ │ ├── Domain.php │ │ │ │ │ └── Contact.php │ │ │ │ ├── Check │ │ │ │ │ ├── Host.php │ │ │ │ │ └── Domain.php │ │ │ │ ├── Create │ │ │ │ │ ├── Host.php │ │ │ │ │ ├── Contact.php │ │ │ │ │ └── Domain.php │ │ │ │ ├── Delete │ │ │ │ │ ├── Host.php │ │ │ │ │ ├── Contact.php │ │ │ │ │ └── Domain.php │ │ │ │ ├── Update │ │ │ │ │ ├── Host.php │ │ │ │ │ ├── Contact.php │ │ │ │ │ └── Domain.php │ │ │ │ ├── Renew │ │ │ │ │ └── Domain.php │ │ │ │ ├── Transfer │ │ │ │ │ ├── Contact.php │ │ │ │ │ └── Domain.php │ │ │ │ ├── Poll │ │ │ │ │ ├── Req.php │ │ │ │ │ └── Ack.php │ │ │ │ ├── Create.php │ │ │ │ ├── Delete.php │ │ │ │ ├── Update.php │ │ │ │ ├── Poll.php │ │ │ │ ├── Check.php │ │ │ │ ├── Renew.php │ │ │ │ ├── Info.php │ │ │ │ ├── Transfer.php │ │ │ │ └── Login.php │ │ │ ├── Response.php │ │ │ ├── Greeting.php │ │ │ └── Command.php │ │ ├── Frame.php │ │ ├── ObjectSpec.php │ │ ├── Protocol.php │ │ └── Client.php │ └── EPP.php │ ├── RegistroEPP │ ├── RegistroEPPFactory.class.php │ ├── RegistroEPPPoll.class.php │ ├── RegistroEPPBrorg.class.php │ ├── RegistroEPPDomain.class.php │ └── RegistroEPP.class.php │ ├── whoisjson.php │ ├── TLDs.php │ ├── additionalfields.php │ ├── BeautyXML.class.php │ ├── client-pwd.pem │ ├── isCpfValid.php │ ├── isCnpjValid.php │ ├── hooks.php │ └── ParserResponse │ └── ParserResponse.class.php ├── AUTHORS ├── README ├── COMOINSTALAR └── LICENSE /ChangeLog: -------------------------------------------------------------------------------- 1 | Please see https://github.com/registrobr/whmcs-registrobr-epp/commits/ 2 | 3 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Please see 2 | https://github.com/registrobr/whmcs-registrobr-epp/issues?state=open 3 | -------------------------------------------------------------------------------- /HOWTO: -------------------------------------------------------------------------------- 1 | Para Portugues, por favor leia COMOINSTALAR . 2 | For English instructions please pass COMOINSTALAR through an automatic translator 3 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/registrobr/whmcs-registrobr-epp/HEAD/whmcs/modules/registrars/registrobr/logo.gif -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | NIC.br(R) Registro.br(TM) Team 2 | Other authors as listed at https://github.com/registrobr/whmcs-registrobr-epp/graphs/contributors 3 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # install.sh 4 | # 5 | # 6 | # (C) NIC.br 2025 7 | # 8 | 9 | php whoisjson.php >> ../../../resources/domains/whois.json 10 | 11 | cat additionalfields.php >> ../../../resources/domains/additionalfields.php 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Hello.php: -------------------------------------------------------------------------------- 1 | setOp('req'); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command/Create.php: -------------------------------------------------------------------------------- 1 | type = $type; 11 | parent::__construct('create', $type); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command/Delete.php: -------------------------------------------------------------------------------- 1 | type = $type; 11 | parent::__construct('delete', $type); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command/Update.php: -------------------------------------------------------------------------------- 1 | type = $type; 11 | parent::__construct('update', $type); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/RegistroEPP/RegistroEPPFactory.class.php: -------------------------------------------------------------------------------- 1 | 19 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command/Poll.php: -------------------------------------------------------------------------------- 1 | command->setAttribute('op', $op); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command/Poll/Ack.php: -------------------------------------------------------------------------------- 1 | setOp('ack'); 12 | } 13 | 14 | public function setMsgID($id) 15 | { 16 | $this->command->setAttribute('msgID', $id); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | WHMCS Module for .br EPP registrations with Registro.br (TM) 2 | 3 | This module comes with no warranties or guarantees whatsoever from the authors; use it at your own risk. 4 | 5 | NIC.br, Registro.br and the Registro.br logo are trademarks, either registered or ongoing registration. 6 | Such names and logos can be depicted in fair use scenarios but not in violation of NIC.br(R) rights. 7 | Such names and logos cannot be used to purport an endorsement from NIC.br(R). 8 | 9 | Please see https://github.com/registrobr/whmcs-registrobr-epp for further information. 10 | 11 | 12 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Response.php: -------------------------------------------------------------------------------- 1 | getElementsByTagName('result')->item(0)->getAttribute('code'); 16 | } 17 | 18 | public function message() 19 | { 20 | return $this->getElementsByTagName('msg')->item(0)->firstChild->textContent; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command/Transfer/Domain.php: -------------------------------------------------------------------------------- 1 | createObjectPropertyElement('period'); 16 | $el->setAttribute('unit', $units); 17 | $el->appendChild($this->createTextNode($period)); 18 | $this->payload->appendChild($el); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command/Check.php: -------------------------------------------------------------------------------- 1 | payload->appendChild($this->createElementNS( 17 | Net_EPP_ObjectSpec::xmlns($type), 18 | $type.':'.Net_EPP_ObjectSpec::id($type), 19 | $object 20 | )); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command/Renew.php: -------------------------------------------------------------------------------- 1 | payload->appendChild($this->createElementNS( 17 | Net_EPP_ObjectSpec::xmlns($type), 18 | $type.':'.Net_EPP_ObjectSpec::id($type), 19 | $object 20 | )); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/whoisjson.php: -------------------------------------------------------------------------------- 1 | svID = $this->createElement('svID'); 13 | $this->body->appendChild($this->svID); 14 | 15 | $this->svDate = $this->createElement('svDate'); 16 | $this->body->appendChild($this->svDate); 17 | 18 | $this->svcMenu = $this->createElement('svcMenu'); 19 | $this->body->appendChild($this->svcMenu); 20 | 21 | $this->dcp = $this->createElement('dcp'); 22 | $this->body->appendChild($this->dcp); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP.php: -------------------------------------------------------------------------------- 1 | '; 11 | 12 | public function __construct($type) 13 | { 14 | parent::__construct('1.0', 'UTF-8'); 15 | 16 | $this->loadXML(self::TEMPLATE); 17 | 18 | $type = strtolower($type); 19 | if (!in_array($type, array('hello', 'greeting', 'command', 'response'))) { 20 | trigger_error("Invalid argument value '$type' for \$type", E_USER_ERROR); 21 | } 22 | 23 | $this->epp = $this->firstChild; 24 | $this->body = $this->createElement($type); 25 | $this->epp->appendChild($this->body); 26 | } 27 | 28 | public function friendly() 29 | { 30 | return str_replace('><', ">\n<", $this->saveXML()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command/Info.php: -------------------------------------------------------------------------------- 1 | payload->childNodes as $child) { 17 | $this->payload->removeChild($child); 18 | } 19 | $this->payload->appendChild($this->createElementNS( 20 | Net_EPP_ObjectSpec::xmlns($type), 21 | $type.':'.Net_EPP_ObjectSpec::id($type), 22 | $object 23 | )); 24 | } 25 | 26 | public function setAuthInfo($authInfo) 27 | { 28 | $el = $this->createObjectPropertyElement('authInfo'); 29 | $el->appendChild($this->createObjectPropertyElement('pw')); 30 | $el->firstChild->appendChild($this->createTextNode($authInfo)); 31 | $this->payload->appendChild($el); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command/Transfer.php: -------------------------------------------------------------------------------- 1 | payload->childNodes as $child) { 17 | $this->payload->removeChild($child); 18 | } 19 | $this->payload->appendChild($this->createElementNS( 20 | Net_EPP_ObjectSpec::xmlns($type), 21 | $type.':'.Net_EPP_ObjectSpec::id($type), 22 | $object 23 | )); 24 | } 25 | 26 | public function setOp($op) 27 | { 28 | $this->command->setAttribute('op', $op); 29 | } 30 | 31 | public function setAuthInfo($authInfo) 32 | { 33 | $el = $this->createObjectPropertyElement('authInfo'); 34 | $el->appendChild($this->createObjectPropertyElement('pw')); 35 | $el->firstChild->appendChild($this->createTextNode($authInfo)); 36 | $this->payload->appendChild($el); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command/Login.php: -------------------------------------------------------------------------------- 1 | clID = $this->createElement('clID'); 13 | $this->command->appendChild($this->clID); 14 | 15 | $this->pw = $this->createElement('pw'); 16 | $this->command->appendChild($this->pw); 17 | 18 | $this->options = $this->createElement('options'); 19 | $this->command->appendChild($this->options); 20 | 21 | $this->eppVersion = $this->createElement('version'); 22 | $this->options->appendChild($this->eppVersion); 23 | 24 | $this->eppLang = $this->createElement('lang'); 25 | $this->options->appendChild($this->eppLang); 26 | 27 | $this->svcs = $this->createElement('svcs'); 28 | $this->command->appendChild($this->svcs); 29 | } 30 | 31 | public function addExtension($exts) 32 | { 33 | $extensions = $this->createElement('svcExtension'); 34 | foreach ($exts as $ext) { 35 | $ext_el = $this->createObjectPropertyElement('extURI'); 36 | $ext_el->appendChild($this->createTextNode(Net_EPP_ObjectSpec::xmlns($ext))); 37 | $extensions->appendChild($ext_el); 38 | } 39 | $this->svcs->appendChild($extensions); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/TLDs.php: -------------------------------------------------------------------------------- 1 | "CPF ou CNPJ", 15 | "Type" => "text", 16 | "Size" => "18", 17 | "Description" => "
Formato do CPF (11 dígitos) : NNN.NNN.NNN-NN
Formato do CNPJ (14 dígitos) : NN.NNN.NNN/NNNN-NN", 18 | "Default" => "", 19 | "Required" => true); 20 | } 21 | 22 | foreach ($registrobr_CPFTLDs as &$registrobr_TLD) { 23 | $additionaldomainfields[$registrobr_TLD][] = array( 24 | "Name" => "CPF", 25 | "Type" => "text", 26 | "Size" => "14", 27 | "Description" => "
Formato do CPF (11 dígitos) : NNN.NNN.NNN-NN", 28 | "Default" => "", 29 | "Required" => true ); 30 | } 31 | 32 | foreach ($registrobr_CNPJTLDs as &$registrobr_TLD) { 33 | $additionaldomainfields[$registrobr_TLD][] = array( 34 | "Name" => "CNPJ", 35 | "Type" => "text", 36 | "Size" => "18", 37 | "Description" => "
Formato do CNPJ (14 dígitos) : NN.NNN.NNN/NNNN-NN", 38 | "Default" => "", 39 | "Required" => true); 40 | } 41 | 42 | foreach ($registrobr_AllTLDs as &$registrobr_TLD) { 43 | $additionaldomainfields[$registrobr_TLD][] = array( 44 | "Name" => "Register Number", 45 | "Remove" => true, 46 | ); 47 | } 48 | 49 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Frame/Command.php: -------------------------------------------------------------------------------- 1 | type = $type; 11 | $command = strtolower($command); 12 | if (!in_array($command, array('check', 'info', 'create', 'update', 'delete', 'renew', 'transfer', 'poll', 'login', 'logout'))) { 13 | trigger_error("Invalid argument value '$command' for \$command", E_USER_ERROR); 14 | } 15 | parent::__construct('command'); 16 | 17 | $this->command = $this->createElement($command); 18 | $this->body->appendChild($this->command); 19 | 20 | if (!empty($this->type)) { 21 | $this->payload = $this->createElementNS( 22 | Net_EPP_ObjectSpec::xmlns($this->type), 23 | $this->type.':'.$command 24 | ); 25 | 26 | $this->command->appendChild($this->payload); 27 | } 28 | } 29 | 30 | public function addclTRID($id) 31 | { 32 | $this->clTRID = $this->createElement('clTRID'); 33 | $this->clTRID->appendChild($this->createTextNode($id)); 34 | $this->body->appendChild($this->clTRID); 35 | } 36 | 37 | public function addObjectProperty($name, $value = null) 38 | { 39 | $element = $this->createObjectPropertyElement($name); 40 | $this->payload->appendChild($element); 41 | 42 | if ($value instanceof DomNode) { 43 | $element->appendChild($value); 44 | } elseif (isset($value)) { 45 | $element->appendChild($this->createTextNode($value)); 46 | } 47 | return $element; 48 | } 49 | 50 | public function createObjectPropertyElement($name, $type = null) 51 | { 52 | $ns_type = isset($type) ? $type : $this->type; 53 | $ns = !empty($ns_type) ? $ns_type.':'.$name : $name; 54 | return $this->createElementNS( 55 | Net_EPP_ObjectSpec::xmlns($ns_type), 56 | $ns 57 | ); 58 | } 59 | 60 | public function createExtension() 61 | { 62 | $this->extension = $this->createElement('extension'); 63 | $this->body->appendChild($this->extension); 64 | } 65 | 66 | /** 67 | * Creates an extension element with the option of specifying a custom namespace 68 | * @param $ext 69 | * @param $command 70 | * @param null $version * 71 | */ 72 | public function createExtensionElement($ext, $command, $version = null) 73 | { 74 | $this->extension->payload = $this->createElementNS( 75 | Net_EPP_ObjectSpec::xmlns($version !== null ? $version : $ext), 76 | $ext.':'.$command 77 | ); 78 | $this->extension->appendChild($this->extension->payload); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/BeautyXML.class.php: -------------------------------------------------------------------------------- 1 | how_to_ident; 34 | return $spaces .= $str; 35 | } 36 | 37 | 38 | // main funcion 39 | function format($str) { 40 | 41 | $str = preg_replace("/<\?[^>]+>/", "", $str); 42 | 43 | $tmp = explode("\n", $str); // extracting string into array 44 | 45 | // cleaning string from spaces and other stuff like \n \r \t 46 | for ($a = 0, $c = count($tmp); $a < $c; $a++) 47 | $tmp[$a] = trim($tmp[$a]); 48 | 49 | // joining to string ;-) 50 | $newstr = join("", $tmp); 51 | 52 | $newstr = preg_replace("/>([\s]+)<\//", "><", ">\n<", $newstr); 56 | 57 | // exploding - each line is one XML tag 58 | $tmp = explode("\n", $newstr); 59 | 60 | // preparing array for list of tags 61 | $stab = array(''); 62 | 63 | // lets go :-) 64 | for ($a = 0, $c = count($tmp); $a <= $c; $a++) { 65 | 66 | $add = true; 67 | 68 | preg_match("/<([^\/\s>]+)/", $tmp[$a], $match); 69 | 70 | $lan = trim(strtr($match[0], "<>", " ")); 71 | 72 | $level = count($stab); 73 | 74 | if (in_array($lan, $stab) && substr_count($tmp[$a], "$/", $tmp[$a], $match)) 84 | $add = false; 85 | 86 | $tmp[$a] = $this->ident($tmp[$a], $level); 87 | 88 | if ($this->wrap) $tmp[$a] = wordwrap($tmp[$a], $this->wrap_cont, "\n" . $this->how_to_ident . $this->how_to_ident . $this->how_to_ident); 89 | 90 | if ($add && !@in_array($lan, $stab) && $lan != '') array_push($stab, $lan); 91 | 92 | } 93 | 94 | return join("\n", $tmp); 95 | } 96 | 97 | } -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/client-pwd.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEtDCCApygAwIBAgICAZIwDQYJKoZIhvcNAQELBQAwezELMAkGA1UEBhMCQlIx 3 | EjAQBgNVBAgMCVNhbyBQYXVsbzESMBAGA1UEBwwJU2FvIFBhdWxvMRQwEgYDVQQK 4 | DAtSZWdpc3Ryby5icjEMMAoGA1UECwwDRVBQMSAwHgYDVQQDDBdSZWdpc3Ryby5i 5 | ciBFUFAgQ0EgLSBSMzAeFw0yMDEyMDMyMjA5MzJaFw0yMzEyMDMyMjA5MzJaMHcx 6 | CzAJBgNVBAYTAkJSMRIwEAYDVQQIDAlTYW8gUGF1bG8xEjAQBgNVBAcMCVNhbyBQ 7 | YXVsbzEPMA0GA1UECgwGTklDLmJyMRQwEgYDVQQLDAtSZWdpc3Ryby5icjEZMBcG 8 | A1UEAwwQdGVzdCBjZXJ0aWZpY2F0ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC 9 | AQoCggEBANlYAXz5W7EHxqWoj1FgukPrbTovK5CprnTLiaZY3/uhXekwjNV0r2S6 10 | pqVXyeHpqDZ9AIoF+aRA/y+Ev/jXL9VaBMGqSZcVC6rp4kxnmIal4fynILPHqA7i 11 | 7alrmlSSnIYzjpvzv7qYggt4MXD9WmUhcwYGV3QP/OQGBQAeTAza9Jnewgq0OuJB 12 | JKUVX6BBvxWTSlDqR/C0kCbzyD84CIcmesrnsjn3PYXt34kUxAWxhoBDXsP/p7ry 13 | kOnkOSojGFd6FIgyfKBiKqB0f/Q6rdjl0whcK3FGmtdZsyUtWekcB8ZbtB6VhDPB 14 | Q0S9I3Bo8KpTFtc4F2ewr2EX54ba1zkCAwEAAaNGMEQwHwYDVR0jBBgwFoAUnMtm 15 | F/OBkmPgM1ljBaV7il4p+8AwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDAYDVR0TAQH/ 16 | BAIwADANBgkqhkiG9w0BAQsFAAOCAgEAeTunohp47as4szg9qaDee/pBhse4aPYH 17 | uZLp+B7gWZxM3ziGZAXQXNtgSjz6QXfRWWt3NrgTG92Kt/JKeW6Zo/mQe0Gq1CVS 18 | OQ8WKCOvQUHMBpHj7jzqslkIv3DO9CcyMHP2/80lnPORGxroRfWGIOt+B7Nn4tKi 19 | FDVB4PlgMJdHyG9Ah3Z+UClHPE9u7CxkCgiwGhcNsLtq0CdvrVVBCUhiLAfl/Gp/ 20 | o9xg0h+X4f9InorSz8sR+iiiyALA5vQxQ+fl6EOa4bolG/E05AFEF2OpluBFOEiH 21 | UP0ekhIwLcHf3vxSTKvyrDNUygxSopsWO09McemhyNi/vUTTOw3DVktyQ369uWzj 22 | xNXdrUqe+vL74iYE3G2lCSb01W69xw9Xmaf0pKZbAQt15J/6DOCwE+OjB8KCAhUv 23 | LB6zuLxpmnBRwB42NB3ogedlv9dbXr01bJuDLoXWQZu8vZ5Yv7HT1jJapcr3sYF2 24 | 8XPmghAkpMQ6SnfRQLQ3IptXw5W/MGRFTCYcfdg0nGExgbdDMsL7c+I2K2kSQgVk 25 | ZXYSvvzJEbs1/fMVvrs008Ce2LS5LTNueUY92CALwmspKq+7r02wDnyJeR++H5IQ 26 | B7zrSVtphjV1RBaMy63m8uyVncqaqFvheTyASaBwgZOczboRViN0EkQPQxtNtd5q 27 | jjqXhmDK/SY= 28 | -----END CERTIFICATE----- 29 | -----BEGIN RSA PRIVATE KEY----- 30 | Proc-Type: 4,ENCRYPTED 31 | DEK-Info: AES-256-CBC,9D1329C1DBA1816C7A6789AB8ED04649 32 | 33 | AfCNGljYI53/yhvNvqPkKaFzQIn1NUq3IDj6k7A5hIe7yRcJDHBJzChv/KnR5WNQ 34 | vvngrhF0vE/dbHIVpUOmwK1HqoKR1z3fQXytuaSTdFBKbKXU440dCiu4+WHXggTh 35 | AsKTI1IJ+sstmG/yja1dMJmdO0vwWvNx47Q1dasCt5s08G25HFKKQYFOJLdbF4/3 36 | LAYjL7gMO/K4IzMev8kTEohz0oBg5/+FCK+8nqpEHZl87nlVsLq/DukSfCdnW2Cz 37 | gMM4tnB5j4zkp5IP5rL4riFtlgqdhKO9dSsAFxGpGPKId8gPpCOv50zGNW6vQrMw 38 | 6VWG3qlfEAajOkDgxUD/kcAE0G0NUj45tHmEdQYBFxbUUhsFOowku2lB4BlSRq2q 39 | 2jtbnmASfHduVFfH2mHmKXcqPNrCNXLjkhC98qfwiGh1Al5SpGHwPWleL9aoSFj9 40 | y/U4ZQlvWMiGI6PJpXzDNKNUMHOcL1u5wMWqmfvx9yQNwkHSH4pAOw95Y/JAA0Ms 41 | zWfDXfeCJL98O29M/N5epvymKCu//bvjjQIdSw8Gaqf/wGbmYKwJxh0zvJltvvjr 42 | F3P0oAUWL2oFlvpzbgo/Hwr/CwQOP2cxT9NH2vVxnzfe9/bd21WZ+eTpwiyLEgA0 43 | HlhnCIwdHOeKz7DKua1ixtc0qn7g1icAe/kejO9QBkUGQs+qBRipKjb7mXSk/3BE 44 | h4hYE/SZZXqFouPSfZxTyAeGKf5aXI+VxhU40gWfIKjAtbjDnQoYGSCte5erWpFW 45 | T1licfEaoc4tDPKJxsj2rdBIqnuK6NI4TUIZug30AURzWQNmWY0CSjzfv+xYLCeU 46 | lz0myYTEWIzzCOamsntkGqnoB6kVaPD0xYUEFkX3PM2A3FYROFBf9GlAMvyENA4D 47 | B80rkU3ATiRE3Bwzj/uMqEnqeA4SPLR5QRnpgy7+WRVnFKUQJrAiKRsVvxqFkjQ1 48 | UMCrrFfazH+n2QveRqxrCiuFrrvvNLUkLXmVDyLYi3X+MdCOy/5iwvbtKSn9f4uv 49 | BaKUiiJv4mR5YjBiqlmni8dJQ6eG3YZJShLxv39YTAc+VgZl6UxGF/fplO/5G4CN 50 | loMpCnCTNNjQ1fdT3yoHf/OQUcj3Wi58IUvSwYIjH3p3qzrY7kGo049mIktu/88a 51 | W9Ss2g6kOyU4WH7ciwIyJWWKBIIIues0e35UIUnEoZp0OkyOPOxL1rxRNhUW/Ch7 52 | 4ygpNULfUcJ6k/lf8O8ZTf4oSccgpsVi1cT/0WCYoSD5svfLVklqemfjbyl08VkL 53 | BbQ1cRN1VZwG0lXu9FPLpVmfgVahaXsd1tro5r1e/+X590DQ55B7G8lUMgpEGPJQ 54 | VnbJKvDCI+4/b/8Dl5zRfdNZzCfzQ7Y+HEWd/Mp83cWhK80JHTFzbUd/F8ncMq1P 55 | AvO2rS/Rk1jBpi8V8U4Xk43g97/3XMqtZjYelC95M5t1Djm36kS1mmqay6Qysvjc 56 | HKyyiiJr91GqIxNs8itXE99XYgp5Xxqh0rZD/955ncwEd96tEWTWD8DRraj5dj7d 57 | WIWXeTlCB8w5gQToG3gqYh/efHa1LAiepZTHBEia5QL7xjS5lay4x+FS4Yig2DBy 58 | -----END RSA PRIVATE KEY----- 59 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/ObjectSpec.php: -------------------------------------------------------------------------------- 1 | array( 10 | 'xmlns' => 'urn:ietf:params:xml:ns:domain-1.0', 11 | 'id' => 'name', 12 | 'schema' => 'urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd', 13 | ), 14 | 'host' => array( 15 | 'xmlns' => 'urn:ietf:params:xml:ns:host-1.0', 16 | 'id' => 'name', 17 | 'schema' => 'urn:ietf:params:xml:ns:host-1.0 host-1.0.xsd', 18 | ), 19 | 'contact' => array( 20 | 'xmlns' => 'urn:ietf:params:xml:ns:contact-1.0', 21 | 'id' => 'id', 22 | 'schema' => 'urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd', 23 | ), 24 | 'rgp' => array( 25 | 'xmlns' => 'urn:ietf:params:xml:ns:rgp-1.0', 26 | 'id' => 'id', 27 | 'schema' => 'urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd', 28 | ), 29 | 'launch' => array( 30 | 'xmlns' => 'urn:ietf:params:xml:ns:launch-1.0', 31 | 'id' => 'id', 32 | 'schema' => 'urn:ar:params:xml:ns:launch-1.0 launch-1.0.xsd', 33 | ), 34 | 'idn' => array( 35 | 'xmlns' => 'urn:ietf:params:xml:ns:idn-1.0', 36 | 'id' => 'id', 37 | 'schema' => 'urn:ar:params:xml:ns:idn-1.0 idn-1.0.xsd', 38 | ), 39 | 'tmch' => array( 40 | 'xmlns' => 'urn:ar:params:xml:ns:tmch-1.0', 41 | 'id' => 'id', 42 | 'schema' => 'urn:ar:params:xml:ns:tmch-1.0 tmch-1.0.xsd', 43 | ), 44 | 'application' => array( 45 | 'xmlns' => 'urn:ar:params:xml:ns:application-1.0', 46 | 'id' => 'id', 47 | 'schema' => 'urn:ar:params:xml:ns:application-1.0 application-1.0.xsd', 48 | ), 49 | 'price' => array( 50 | 'xmlns' => 'urn:ar:params:xml:ns:price-1.0', 51 | 'id' => 'id', 52 | 'schema' => 'urn:ar:params:xml:ns:price-1.0 price-1.0.xsd', 53 | ), 54 | 'asia' => array( 55 | 'xmlns' => 'urn:ar:params:xml:ns:asia-1.0', 56 | 'id' => 'id', 57 | 'schema' => 'urn:ar:params:xml:ns:asia-1.0 asia-1.0.xsd', 58 | ), 59 | 'signedMark' => array( 60 | 'xmlns' => 'urn:ietf:params:xml:ns:signedMark-1.0', 61 | 'id' => 'domain', 62 | 'schema' => 'urn:ietf:params:xml:ns:signedMark-1.0 signedMark-1.0.xsd', 63 | ), 64 | 'fee' => array( 65 | 'xmlns' => 'urn:ietf:params:xml:ns:fee-0.5', 66 | 'id' => 'domain', 67 | 'schema' => 'urn:ietf:params:xml:ns:fee-0.5 fee-0.5.xsd', 68 | ), 69 | 'fee_23' => array( 70 | 'xmlns' => 'urn:ietf:params:xml:ns:fee-0.23', 71 | 'id' => 'domain', 72 | 'schema' => 'urn:ietf:params:xml:ns:fee-0.23 fee-0.23.xsd', 73 | ), 74 | 'allocationToken' => array( 75 | 'xmlns' => 'urn:ietf:params:xml:ns:allocationToken-1.0', 76 | 'id' => 'domain', 77 | 'schema' => 'urn:ietf:params:xml:ns:allocationToken-1.0 allocationToken-1.0.xsd', 78 | ), 79 | 'auxcontact' => array( 80 | 'xmlns' => 'urn:ietf:params:xml:ns:auxcontact-0.1', 81 | 'id' => 'domain', 82 | 'schema' => 'urn:ietf:params:xml:ns:auxcontact-0.1 auxcontact-1.0.xsd', 83 | ), 84 | 'secDNS' => array( 85 | 'xmlns' => 'urn:ietf:params:xml:ns:secDNS-1.1', 86 | 'id' => 'domain', 87 | 'schema' => 'urn:ietf:params:xml:ns:secDNS-1.1 secDNS-1.1.xsd', 88 | ), 89 | ); 90 | 91 | public static function id($object) 92 | { 93 | return self::$_spec[$object]['id']; 94 | } 95 | 96 | public static function xmlns($object) 97 | { 98 | return self::$_spec[$object]['xmlns']; 99 | } 100 | 101 | public static function schema($object) 102 | { 103 | return self::$_spec[$object]['schema']; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/isCpfValid.php: -------------------------------------------------------------------------------- 1 | 8 | * @version 1.0 Debugada em 26/09/2011 no PHP 5.3.8 9 | * @param string $cpf Guarda o cpf como ele foi digitado pelo cliente 10 | * @param array $num Guarda apenas os números do cpf 11 | * @param boolean $isCpfValid Guarda o retorno da função 12 | * @param int $multiplica Auxilia no Calculo dos Dígitos verificadores 13 | * @param int $soma Auxilia no Calculo dos Dígitos verificadores 14 | * @param int $resto Auxilia no Calculo dos Dígitos verificadores 15 | * @param int $dg Dígito verificador 16 | * @return boolean "true" se o cpf é válido ou "false" caso o contrário 17 | * 18 | */ 19 | 20 | function isCpfValid($cpf) 21 | { 22 | //Etapa 1: Cria um array com apenas os digitos numéricos, isso permite receber o cpf em diferentes formatos como "000.000.000-00", "00000000000", "000 000 000 00" etc... 23 | $j=0; 24 | for($i=0; $i<(strlen($cpf)); $i++) 25 | { 26 | if(is_numeric($cpf[$i])) 27 | { 28 | $num[$j]=$cpf[$i]; 29 | $j++; 30 | } 31 | } 32 | //Etapa 2: Conta os dígitos, um cpf válido possui 11 dígitos numéricos. 33 | if(count($num)!=11) 34 | { 35 | $isCpfValid=false; 36 | } 37 | //Etapa 3: Combinações como 00000000000 e 22222222222 embora não sejam cpfs reais resultariam em cpfs válidos após o calculo dos dígitos verificares e por isso precisam ser filtradas nesta parte. 38 | else 39 | { 40 | for($i=0; $i<10; $i++) 41 | { 42 | if ($num[0]==$i && $num[1]==$i && $num[2]==$i && $num[3]==$i && $num[4]==$i && $num[5]==$i && $num[6]==$i && $num[7]==$i && $num[8]==$i) 43 | { 44 | $isCpfValid=false; 45 | break; 46 | } 47 | } 48 | } 49 | //Etapa 4: Calcula e compara o primeiro dígito verificador. 50 | if(!isset($isCpfValid)) 51 | { 52 | $j=10; 53 | for($i=0; $i<9; $i++) 54 | { 55 | $multiplica[$i]=$num[$i]*$j; 56 | $j--; 57 | } 58 | $soma = array_sum($multiplica); 59 | $resto = $soma%11; 60 | if($resto<2) 61 | { 62 | $dg=0; 63 | } 64 | else 65 | { 66 | $dg=11-$resto; 67 | } 68 | if($dg!=$num[9]) 69 | { 70 | $isCpfValid=false; 71 | } 72 | } 73 | //Etapa 5: Calcula e compara o segundo dígito verificador. 74 | if(!isset($isCpfValid)) 75 | { 76 | $j=11; 77 | for($i=0; $i<10; $i++) 78 | { 79 | $multiplica[$i]=$num[$i]*$j; 80 | $j--; 81 | } 82 | $soma = array_sum($multiplica); 83 | $resto = $soma%11; 84 | if($resto<2) 85 | { 86 | $dg=0; 87 | } 88 | else 89 | { 90 | $dg=11-$resto; 91 | } 92 | if($dg!=$num[10]) 93 | { 94 | $isCpfValid=false; 95 | } 96 | else 97 | { 98 | $isCpfValid=true; 99 | } 100 | } 101 | //Trecho usado para depurar erros. 102 | /* 103 | if($isCpfValid==true) 104 | { 105 | echo "Cpf é Válido"; 106 | } 107 | if($isCpfValid==false) 108 | { 109 | echo "Cpf Inválido"; 110 | } 111 | */ 112 | //Etapa 6: Retorna o Resultado em um valor booleano. 113 | return $isCpfValid; 114 | } 115 | ?> -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/RegistroEPP/RegistroEPPPoll.class.php: -------------------------------------------------------------------------------- 1 | get('netClient'); 29 | if(empty($client)){ 30 | throw new Exception('net Client is not set, check login before'); 31 | } 32 | 33 | $requestXML = $this->_getXMLMessages(); 34 | $responseXML = $client->request($requestXML); 35 | 36 | 37 | 38 | $objParser = New ParserResponse(); 39 | $objParser->parsePoll($responseXML); 40 | 41 | $this->set('msgQ',$objParser->get('msgQ')); 42 | $this->set('qDate',$objParser->get('qDate')); 43 | $this->set('code',$objParser->get('code')); 44 | $this->set('txt',$objParser->get('txt')); 45 | 46 | $this->set('reason',$objParser->get('reason')); 47 | $this->set('coderes',$objParser->get('coderes')); 48 | $this->set('objectId',$objParser->get('objectId')); 49 | 50 | $coderes = $objParser->get('coderes',$coderes); 51 | 52 | if ($coderes == 'xxxx') { 53 | $msg = $this->errorEPP('domainnotfound',$objParser,$requestXML,$responseXML); 54 | throw new Exception($msg); 55 | } 56 | 57 | #build content 58 | 59 | $content = $this->_registrobr_lang("Date").substr($qDate,0,10)." "; 60 | $content .= $this->_registrobr_lang("Time").substr($qDate,11,10)." UTC\n"; 61 | $code = $this->get('code'); 62 | $txt = $this->get('txt'); 63 | $content .= $this->_registrobr_lang("Code").$code."\n"; 64 | $content .= $this->_registrobr_lang("Text").$txt; 65 | $reason = $this->get('reason'); 66 | 67 | 68 | if (!empty($reason)) { 69 | $content .= $this->_registrobr_lang("Reason").$reason."\n"; 70 | } 71 | 72 | 73 | $content .= $this->_registrobr_lang("FullXMLBelow")."\n"; 74 | 75 | $bc = new BeautyXML(); 76 | 77 | $content .= htmlentities($bc->format($responseXML)); 78 | 79 | 80 | $this->set('content',$content); 81 | $this->set('ticket',$objParser->get('ticket')); 82 | $this->set('objectId',$objParser->get('objectId')); 83 | 84 | 85 | 86 | } 87 | 88 | public function sendAck(){ 89 | 90 | require_once('ParserResponse/ParserResponse.class.php'); 91 | 92 | 93 | $client = $this->get('netClient'); 94 | 95 | if(empty($client)){ 96 | throw new Exception('net Client is not set, check login before'); 97 | } 98 | 99 | $requestXML = $this->_getXMLAck(); 100 | $responseXML = $client->request($requestXML); 101 | 102 | $objParser = New ParserResponse(); 103 | $objParser->parseAck($responseXML); 104 | 105 | $coderes = $objParser->get('coderes'); 106 | 107 | if ($coderes != '1000') { 108 | $msg = $this->errorEPP('pollackerrorcode',$objParser,$coderes,$responseXML); 109 | throw new Exception($msg); 110 | } 111 | } 112 | private function _getXMLAck(){ 113 | 114 | $msgid = $this->get('msgQ'); 115 | 116 | if(empty($msgid)){ 117 | throw new Exception('no msgQ sent'); 118 | } 119 | # Ack poll message 120 | $request=' 121 | 122 | 123 | '.mt_rand().mt_rand().' 124 | 125 | 126 | '; 127 | 128 | return $request; 129 | 130 | } 131 | private function _getXMLMessages(){ 132 | 133 | $request = ' 134 | 135 | 136 | 137 | '.mt_rand().mt_rand().' 138 | 139 | 140 | '; 141 | 142 | return $request; 143 | 144 | } 145 | 146 | 147 | 148 | } 149 | 150 | ?> 151 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/isCnpjValid.php: -------------------------------------------------------------------------------- 1 | 8 | * @version 1.0 Debugada em 27/09/2011 no PHP 5.3.8 9 | * @param string $cnpj Guarda o Cnpj como ele foi digitado pelo cliente 10 | * @param array $num Guarda apenas os números do Cnpj 11 | * @param boolean $isCnpjValid Guarda o retorno da função 12 | * @param int $multiplica Auxilia no Calculo dos Dígitos verificadores 13 | * @param int $soma Auxilia no Calculo dos Dígitos verificadores 14 | * @param int $resto Auxilia no Calculo dos Dígitos verificadores 15 | * @param int $dg Dígito verificador 16 | * @return boolean "true" se o Cnpj é válido ou "false" caso o contrário 17 | * 18 | */ 19 | 20 | function isCnpjValid($cnpj) 21 | { 22 | //Etapa 1: Cria um array com apenas os digitos numéricos, isso permite receber o cnpj em diferentes formatos como "00.000.000/0000-00", "00000000000000", "00 000 000 0000 00" etc... 23 | $j=0; 24 | for($i=0; $i<(strlen($cnpj)); $i++) 25 | { 26 | if(is_numeric($cnpj[$i])) 27 | { 28 | $num[$j]=$cnpj[$i]; 29 | $j++; 30 | } 31 | } 32 | //Etapa 2: Conta os dígitos, um Cnpj válido possui 14 dígitos numéricos. 33 | if(count($num)!=14) 34 | { 35 | $isCnpjValid=false; 36 | } 37 | //Etapa 3: O número 00000000000 embora não seja um cnpj real resultaria um cnpj válido após o calculo dos dígitos verificares e por isso precisa ser filtradas nesta etapa. 38 | if ($num[0]==0 && $num[1]==0 && $num[2]==0 && $num[3]==0 && $num[4]==0 && $num[5]==0 && $num[6]==0 && $num[7]==0 && $num[8]==0 && $num[9]==0 && $num[10]==0 && $num[11]==0) 39 | { 40 | $isCnpjValid=false; 41 | } 42 | //Etapa 4: Calcula e compara o primeiro dígito verificador. 43 | else 44 | { 45 | $j=5; 46 | for($i=0; $i<4; $i++) 47 | { 48 | $multiplica[$i]=$num[$i]*$j; 49 | $j--; 50 | } 51 | $soma = array_sum($multiplica); 52 | $j=9; 53 | for($i=4; $i<12; $i++) 54 | { 55 | $multiplica[$i]=$num[$i]*$j; 56 | $j--; 57 | } 58 | $soma = array_sum($multiplica); 59 | $resto = $soma%11; 60 | if($resto<2) 61 | { 62 | $dg=0; 63 | } 64 | else 65 | { 66 | $dg=11-$resto; 67 | } 68 | if($dg!=$num[12]) 69 | { 70 | $isCnpjValid=false; 71 | } 72 | } 73 | //Etapa 5: Calcula e compara o segundo dígito verificador. 74 | if(!isset($isCnpjValid)) 75 | { 76 | $j=6; 77 | for($i=0; $i<5; $i++) 78 | { 79 | $multiplica[$i]=$num[$i]*$j; 80 | $j--; 81 | } 82 | $soma = array_sum($multiplica); 83 | $j=9; 84 | for($i=5; $i<13; $i++) 85 | { 86 | $multiplica[$i]=$num[$i]*$j; 87 | $j--; 88 | } 89 | $soma = array_sum($multiplica); 90 | $resto = $soma%11; 91 | if($resto<2) 92 | { 93 | $dg=0; 94 | } 95 | else 96 | { 97 | $dg=11-$resto; 98 | } 99 | if($dg!=$num[13]) 100 | { 101 | $isCnpjValid=false; 102 | } 103 | else 104 | { 105 | $isCnpjValid=true; 106 | } 107 | } 108 | //Trecho usado para depurar erros. 109 | /* 110 | if($isCnpjValid==true) 111 | { 112 | echo "

Cnpj é Válido

"; 113 | } 114 | if($isCnpjValid==false) 115 | { 116 | echo "

Cnpj Inválido

"; 117 | } 118 | */ 119 | //Etapa 6: Retorna o Resultado em um valor booleano. 120 | return $isCnpjValid; 121 | } 122 | ?> -------------------------------------------------------------------------------- /COMOINSTALAR: -------------------------------------------------------------------------------- 1 | 2 | Para informações não contidas neste texto por favor verifique https://github.com/registrobr/whmcs-registrobr-epp/. 3 | 4 | Suporte comunitário em língua portuguesa pode ser obtido em um destes fóruns: 5 | - https://eng.registro.br/mailman/listinfo/eppnicbr 6 | - http://portaldohost.com.br/forum/ 7 | 8 | REQUISITOS 9 | 10 | - WHMCS versão 8.6 ou superior (testado apenas com WHMCS 8.13.1) 11 | - Todos as dependências do WHMCS (incluindo ionCube loader) 12 | - Ambiente POSIX (Linux, FreeBSD e demais atendem este requisito) 13 | - PHP versão 8.1 ou superior (testado apenas com PHP 8.3) 14 | - Suporte a SSL/TLS 15 | - Ambiente exclusivo (VPS ou dedicado) para armazenamento seguro da chave privada SSL 16 | - Usuário privilegiado root ou equivalente sudo(er) 17 | - Permissão de firewall para portas TCP 443 e TCP 700 nos servidores beta.registro.br, 18 | registro.br e epp.registro.br 19 | - Data correta no servidor (NTP recomendado mas não obrigatório; veja https://ntp.br para mais informações) 20 | 21 | 22 | INSTALAÇÃO 23 | 24 | Copiar o conteúdo dos diretórios em whmcs a pasta do WHMCS (ex: sudo cp -R whmcs /var/www) 25 | Rodar o script sudo ./install.sh para preparação dos arquivos whois.json (checagem de disponibilidade de domínios e additionalfields.php (solicitação de CPF/CNPJ no registro). 26 | 27 | Notar que se já houver entradas de .br no arquivo whois.json elas serão duplicadas e é recomendado manter apenas um conjunto deles, o mesmo se aplicando ao additionalfields.php. 28 | 29 | 30 | Caso já hajam arquivos em $WHMCS/modules/registrars/registrobr, basta sobrescrever. 31 | 32 | - Formatador de CNPJ e CPF (opcional) 33 | 34 | Para formatar automaticamente nos formatos NNN.NNN.NNN-NN e NN.NNN.NNN/NNNN-NN enquanto o cliente digita. 35 | Na tela de checkout de registro de domínio, o CPF e CNPJ irão ser formatados automaticamente enquanto o usuário digita. 36 | 37 | No arquivo `additionalfields.php`, mantenha o `
`, dentro de `Description`. Não se preocupe, o não irá aparecer na tela. 38 | 39 | 40 | 41 | CONFIGURAÇÃO 42 | 43 | 1) No painel de controle do WHMCS, vá até linha do topo, clique em "Setup" 44 | 45 | 2) Clique então em "Products/Services" => "Domain Registrars" 46 | 47 | 3) Ative o módulo do Registro.br e depois em Configure. 48 | 49 | 4) Preencha os seus dados de autenticação do ambiente beta.registro.br. Notar que Username se trata do número do provedor 50 | EPP (ex: 001) e não do ID do provedor (ex: FAN). Por enquanto deixe a opção TestMode ativada. O certificado para utilização da 51 | beta.registro.br já vem como parte da distribuição do módulo. 52 | 53 | 5) O preenchimento de TechC é opcional; sem ele os domínios são criados com contato 54 | técnico igual ao titular. O contato técnico só poderá alterar o domínio se for feita remoção do provedor de serviço, mas sempre aparecerá no WHOIS/RDAP. 55 | 56 | 6) Para o correto processamento das mensagens de retorno("Poll") é necessário 57 | configurar Cron (Menu System, Opção Automation) e também departamentos de suporte no WHMCS e atribuir usuários a eles. 58 | Na opção "Sender Username", utilize um Username que esteja em sua lista de 59 | administradores ('../whmcs/admin/configadmins.php'), tal como root, ou cadastre um. 60 | 61 | 7) Sugerimos muito fortemente que seja habilitado o módulo de log 62 | em Utilities -> Log -> Module Log mesmo para uso em produção, para facilitar 63 | o diagnóstico de 64 | problemas reportados por clientes. Assim, não será necessário solicitar ao cliente 65 | que refaça uma transação para que seja diagnosticado um problema. 66 | 67 | 8) Apesar do módulo criar os TLDs de todas as categorias do .br que não tenham requisitos adicionais, no ambiente beta.registro.br devem ser usados apenas 68 | os TLDs .com.br (CPF ou CNPJ) e .eng.br (apenas CPF) 69 | 70 | 9) Em "Domain Pricing" -> "Lookup Provider" escolha "Registro.br". Isso tem o efeito colateral de desabilitar o WHMCS Name Spinner, apesar de não quebrar lookups de outros TLDs pois é usado WHOIS para os demais TLDs que não .br. 71 | 72 | HOMOLOGAÇÃO 73 | 74 | Este módulo não tem como objetivo aprovação no procedimento de homologação disponível em https://ftp.registro.br/pub/libepp-nicbr/pt-epp-accreditation-proc.txt 75 | Nem o WHMCS implementa funções equivalentes às transações lá solicitadas, nem este módulo o faz. 76 | Sugerimos que a mesma máquina com WHMCS tenha disponível o shepp, parte da libepp-nicbr, tanto 77 | para homologação quanto para uso eventual em produção. 78 | 79 | Além do shepp ou outra implementação de cliente EPP, é necessária também para homologação alguma capacidade 80 | de gestão de serviço DNS autoritativo, seja próprio do provedor de serviços, seja via serviço online. 81 | Alguns módulos que podem oferecer isso: 82 | https://www.modulesgarden.com/products/whmcs/dns-manager 83 | https://www.cloudns.net/whmcs-module/ 84 | 85 | 86 | ATIVAÇÃO EM PRODUÇÃO 87 | 88 | - Gere uma requisição de certificado como descrito em https://registro.br/tecnologia/provedores-de-hospedagem/epp/solicitacao-certificado/ 89 | - Envie o CSR para epp@registro.br, sem enviar a chave privada 90 | - Copie o certificado recebido e a chave privada em unico arquivo .pem 91 | - Copie o arquivo .pem gerado para uma área fora do diretório de documentos do servidor Web 92 | - Na administração do WHMCS -> Setup -> General Settings -> Domain Registrars -> 93 | Registro.br, colocar a opção TESTMODE como produção , preencher usuário e senha para as informações 94 | de produção, informar o diretório onde o certificado foi copiado e a pass-phrase do certificado 95 | - Escolher entre deixar "Registro.br" como "Lookup Provider" ou adicionar o arquivo whois.json que está no diretório modules/registrars/registrobr em resources/domains, ou mesclar o whois.json 96 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Protocol.php: -------------------------------------------------------------------------------- 1 | 24 | * @revision $Id: Protocol.php,v 1.4 2011/06/28 09:48:02 gavin Exp $ 25 | */ 26 | 27 | /** 28 | * Low-level functions useful for both EPP clients and servers 29 | * @package Net_EPP 30 | */ 31 | class Net_EPP_Protocol 32 | { 33 | public static function _fread_nb($socket, $length) 34 | { 35 | $result = ''; 36 | 37 | // Loop reading and checking info to see if we hit timeout 38 | $info = stream_get_meta_data($socket); 39 | $time_start = microtime(true); 40 | $timeout_time = $time_start + $GLOBALS['timeout']; 41 | 42 | while (!$info['timed_out'] && !feof($socket)) { 43 | //make sure we don't wait too long 44 | if (isset($time_end) && ($time_end - $time_start) > 10000000) { 45 | $time_diff = microtime(true) - $time_start; 46 | throw new exception("Timeout reading from EPP server after $time_diff seconds"); 47 | } 48 | // Try read remaining data from socket 49 | $buffer = fread($socket, $length - strlen($result)); 50 | // If the buffer actually contains something then add it to the result 51 | if ($buffer !== false) { 52 | $result .= $buffer; 53 | // If we hit the length we looking for, break 54 | if (strlen($result) == $length) { 55 | break; 56 | } 57 | } else { 58 | // Sleep 0.25s 59 | usleep(250000); 60 | } 61 | // Update metadata 62 | $info = stream_get_meta_data($socket); 63 | $time_end = microtime(true); 64 | } 65 | 66 | // Check for timeout 67 | if ($info['timed_out']) { 68 | throw new Exception('Timeout while reading data from socket'); 69 | } 70 | if ($GLOBALS['debug']) { 71 | $time_diff = (microtime(true) - $time_start) * 1000; 72 | syslog(LOG_INFO, "returning after {$time_diff} ms"); 73 | } 74 | 75 | return $result; 76 | } 77 | 78 | public static function _fwrite_nb($socket, $buffer, $length) 79 | { 80 | // Loop writing and checking info to see if we hit timeout 81 | $info = stream_get_meta_data($socket); 82 | $time_start = microtime(true); 83 | 84 | $pos = 0; 85 | while (!$info['timed_out'] && !feof($socket)) { 86 | // Some servers don't like alot of data, so keep it small per chunk 87 | $wlen = $length - $pos; 88 | if ($wlen > 1024) { 89 | $wlen = 1024; 90 | } 91 | // Try write remaining data from socket 92 | $written = @fwrite($socket, substr($buffer, $pos), $wlen); 93 | // If we read something, bump up the position 94 | if ($written && $written !== false) { 95 | $pos += $written; 96 | // If we hit the length we looking for, break 97 | if ($pos == $length) { 98 | break; 99 | } 100 | } else { 101 | // Sleep 0.25s 102 | usleep(250000); 103 | } 104 | // Update metadata 105 | $info = stream_get_meta_data($socket); 106 | $time_end = microtime(true); 107 | $timeDiff = round(($time_end - $time_start) * 1000); 108 | if ($GLOBALS['debug']) { 109 | syslog(LOG_DEBUG, "time to write to socket {$timeDiff}ms"); 110 | } 111 | if (($time_end - $time_start) > 10000000) { 112 | throw new exception('Timeout while writing to EPP Server'); 113 | } 114 | } 115 | // Check for timeout 116 | if ($info['timed_out']) { 117 | throw new Exception('Timeout while writing data to socket'); 118 | } 119 | 120 | 121 | return $pos; 122 | } 123 | 124 | /** 125 | * get an EPP frame from the remote peer 126 | * @param resource $socket a socket connected to the remote peer 127 | * @throws Exception on frame errors. 128 | * @return string the frame 129 | */ 130 | public static function getFrame($socket) 131 | { 132 | if ($GLOBALS['debug']) { 133 | syslog(LOG_INFO, "start reading first 4 bytes"); 134 | } 135 | // Read header 136 | $hdr = Net_EPP_Protocol::_fread_nb($socket, 4); 137 | 138 | // Unpack first 4 bytes which is our length 139 | $unpacked = unpack('N', $hdr); 140 | $length = $unpacked[1]; 141 | if ($length < 5) { 142 | throw new Exception(sprintf('Got a bad frame header length of %d bytes from peer', $length)); 143 | } else { 144 | $length -= 4; // discard the length of the header itself 145 | // Read frame 146 | return Net_EPP_Protocol::_fread_nb($socket, $length); 147 | } 148 | } 149 | 150 | /** 151 | * send an EPP frame to the remote peer 152 | * @param resource $socket a socket connected to the remote peer 153 | * @param string $xml the XML to send 154 | * @throws Exception when it doesn't complete the write to the socket 155 | * @return the amount of bytes written to the frame 156 | */ 157 | public static function sendFrame($socket, $xml) 158 | { 159 | $length = strlen($xml) + 4; 160 | if ($GLOBALS['debug']) { 161 | syslog(LOG_INFO, "length of the header is {$length} about to write {$xml}"); 162 | } 163 | // Grab XML length & add on 4 bytes for the counter 164 | $res = Net_EPP_Protocol::_fwrite_nb($socket, pack('N', $length) . $xml, $length); 165 | // Check our write matches 166 | if ($length != $res) { 167 | throw new Exception("Short write when sending XML"); 168 | } 169 | 170 | return $res; 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/Net/EPP/Client.php: -------------------------------------------------------------------------------- 1 | 24 | * @revision $Id: Client.php,v 1.13 2010/10/21 11:55:07 gavin Exp $ 25 | */ 26 | require_once('Protocol.php'); 27 | 28 | $GLOBALS['Net_EPP_Client_Version'] = '0.0.6'; 29 | 30 | /** 31 | * A simple client class for the Extensible Provisioning Protocol (EPP) 32 | * @package Net_EPP 33 | */ 34 | class Net_EPP_Client 35 | { 36 | 37 | /** 38 | * @var resource the socket resource, once connected 39 | */ 40 | public $socket; 41 | /** 42 | * @var bool do output more debug messages 43 | */ 44 | public $debug; 45 | 46 | /** 47 | * @var integer timeout to wait on commands 48 | */ 49 | public $timeout; 50 | 51 | /** 52 | * constructor set initialize various objects 53 | * @param boolean set debugging on 54 | */ 55 | public function __construct($debug = false) 56 | { 57 | $this->debug = $debug; 58 | $GLOBALS['debug'] = $debug; 59 | $this->socket = null; 60 | } 61 | 62 | /** 63 | * Establishes a connect to the server 64 | * This method establishes the connection to the server. If the connection was 65 | * established, then this method will call getFrame() and return the EPP 66 | * frame which is sent by the server upon connection. If connection fails, then 67 | * an exception with a message explaining the error will be thrown and handled 68 | * in the calling code. 69 | * @param string $host the hostname 70 | * @param integer $port the TCP port 71 | * @param integer $timeout the timeout in seconds 72 | * @param boolean $ssl whether to connect using SSL 73 | * @param resource $context a stream resource to use when setting up the socket connection 74 | *@param string $protocol whether to use TLS or SSL 75 | * @throws Exception on connection errors 76 | * @return a string containing the server 77 | */ 78 | public function connect($host, $port = 700, $timeout = 1, $ssl = true, $context = null, $protocol = 'tls') 79 | { 80 | if ($this->debug) { 81 | syslog(LOG_INFO, "in connect"); 82 | } 83 | 84 | $target = sprintf('%s://%s:%d', ($ssl === true ? $protocol : 'tcp'), $host, $port); 85 | if ($this->debug) { 86 | syslog(LOG_INFO, "connecting to {$target}"); 87 | } 88 | 89 | if (is_resource($context)) { 90 | if ($this->debug) { 91 | syslog(LOG_INFO, "using your provided context resource"); 92 | } 93 | $result = stream_socket_client($target, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $context); 94 | } else { 95 | $result = stream_socket_client($target, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT); 96 | } 97 | if (is_resource($result)) { 98 | if ($errno == 0) { 99 | if ($this->debug) { 100 | $socketmeta = stream_get_meta_data($result); 101 | if (isset($socketmeta['crypto'])) { 102 | syslog(LOG_NOTICE, "socket opened with protocol ".$socketmeta['crypto']['protocol'].", cipher ".$socketmeta['crypto']['cipher_name'].", ".$socketmeta['crypto']['cipher_bits']." bits ".$socketmeta['crypto']['cipher_version']); 103 | } else { 104 | syslog(LOG_INFO, "socket opened without crypt"); 105 | } 106 | } 107 | // Set our socket 108 | $this->socket = $result; 109 | } else { 110 | throw new Exception("non errono 0 retrieved from socket connection: {$errno}"); 111 | } 112 | } else { 113 | if ($result === false && $errno == 0) { 114 | throw new Exception("Connection could not be opened due to socket problem. Reasons can be unmatched peer name, tls not supported..."); 115 | } else { 116 | throw new Exception("Connection could not be opened: $errno $errstr"); 117 | } 118 | } 119 | 120 | // Set stream timeout 121 | if (!stream_set_timeout($this->socket, $timeout)) { 122 | throw new Exception("Failed to set timeout on socket: $errstr (code $errno)"); 123 | } 124 | $this->timeout = $timeout; 125 | $GLOBALS['timeout'] = $timeout; 126 | 127 | // Set blocking 128 | if (!stream_set_blocking($this->socket, 0)) { 129 | throw new Exception("Failed to set blocking on socket: $errstr (code $errno)"); 130 | } 131 | if ($this->debug) { 132 | syslog(LOG_INFO, "trying to get frame from server"); 133 | } 134 | return $this->getFrame(); 135 | } 136 | 137 | /** 138 | * Get an EPP frame from the server. 139 | * This retrieves a frame from the server. Since the connection is blocking, this 140 | * method will wait until one becomes available. If the connection has been broken, 141 | * this method will return a string containing the XML from the server 142 | * @throws Exception on frame errors 143 | * @return a string containing the frame 144 | */ 145 | public function getFrame() 146 | { 147 | return Net_EPP_Protocol::getFrame($this->socket); 148 | } 149 | 150 | /** 151 | * Send an XML frame to the server. 152 | * This method sends an EPP frame to the server. 153 | * @param string the XML data to send 154 | * @throws Exception when it doesn't complete the write to the socket 155 | * @return boolean the result of the fwrite() operation 156 | */ 157 | public function sendFrame($xml) 158 | { 159 | return Net_EPP_Protocol::sendFrame($this->socket, $xml); 160 | } 161 | 162 | /** 163 | * a wrapper around sendFrame() and getFrame() 164 | * @param string $xml the frame to send to the server 165 | * @throws Exception when it doesn't complete the write to the socket 166 | * @return string the frame returned by the server, or an error object 167 | */ 168 | public function request($xml) 169 | { 170 | $res = $this->sendFrame($xml); 171 | return $this->getFrame(); 172 | } 173 | 174 | /** 175 | * Close the connection. 176 | * This method closes the connection to the server. Note that the 177 | * EPP specification indicates that clients should send a 178 | * command before ending the session. 179 | * @return boolean the result of the fclose() operation 180 | */ 181 | public function disconnect() 182 | { 183 | return @fclose($this->socket); 184 | } 185 | 186 | /** 187 | * ping the connection to check that it's up 188 | * @return boolean 189 | */ 190 | public function ping() 191 | { 192 | return (!is_resource($this->socket) || feof($this->socket) ? false : true); 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/hooks.php: -------------------------------------------------------------------------------- 1 | login($moduleparams); 39 | 40 | } 41 | catch (Exception $e){ 42 | logModuleCall('registrobr', 'Poll processing login failure', $moduleparams, $e->getMessage()); 43 | } 44 | $i = 0; 45 | 46 | do { 47 | 48 | try { 49 | $objRegistroEPPPoll->getMessages($moduleparams); 50 | 51 | } 52 | catch (Exception $e){ 53 | logModuleCall('registrobr', 'Poll processing login failure', $moduleparams, $e->getMessage()); 54 | } 55 | $coderes = $objRegistroEPPPoll->get('coderes'); 56 | 57 | 58 | $last = 0; 59 | 60 | # This is the last one 61 | if ($coderes == 1300) { 62 | $last = 1; 63 | } 64 | else { 65 | 66 | 67 | $msgid = $objRegistroEPPPoll->get('msgQ'); 68 | $reason = $objRegistroEPPPoll->get('reason'); 69 | $code = $objRegistroEPPPoll->get('code'); 70 | $content = $objRegistroEPPPoll->get('content'); 71 | $objectId = $objRegistroEPPPoll->get('objectId'); 72 | 73 | logModuleCall('registrobr', 'Poll debug', $moduleparams, "msgQ ".$msgid." reason ".$reason." code ".$code." content ".$content." objectId ".$objectId); 74 | 75 | $ok = _registrobr_whmcsTickets($code,$msgid,$reason,$content,$objRegistroEPPPoll); 76 | 77 | if($ok){ 78 | $objRegistroEPPPoll->sendAck(); 79 | } 80 | } 81 | 82 | $i++; 83 | 84 | } while($last != 1 and $i < 100); //prevent inbox flooding 85 | 86 | } 87 | 88 | ); 89 | 90 | 91 | 92 | add_hook('ClientAreaFooterOutput', 1, function ($domain) { 93 | if (strpos($domain['currentpagelinkback'], 'cart.php?a=confdomains') !== false) { 94 | // Formats the additionalfields (CPF ou CNPJ) in the client area page "/cart.php?a=confdomains". 95 | echo << 97 | window.addEventListener("DOMContentLoaded", (event) => { 98 | const docInput = document.getElementById('cpf-cnpj-rgbr-formatter').parentElement.firstChild 99 | 100 | if (docInput) { 101 | docInput.maxLength = 18 102 | docInput.minLength = 14 103 | 104 | docInput.addEventListener('input', e => { 105 | // Source: https://gist.github.com/marceloneppel/dd9c17a01c1a8031c760b034dad0efd9 106 | const rawValue = e.target.value.replace(/\D/g, '') 107 | 108 | if (rawValue.length >= 11) { 109 | if (rawValue.length === 11) { 110 | e.target.value = rawValue.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/g, "\$1.\$2.\$3-\$4") 111 | 112 | return 113 | } 114 | 115 | e.target.value = rawValue.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/g, "\$1.\$2.\$3/\$4-\$5") 116 | 117 | return 118 | } else { 119 | e.target.value = rawValue 120 | } 121 | }) 122 | } 123 | }); 124 | 125 | HTML; 126 | } 127 | }); 128 | 129 | /** 130 | * Code based on WHMCS Sample Registrar Module Admin Dashboard Widget. 131 | * 132 | */ 133 | class registrobrModuleWidget extends \WHMCS\Module\AbstractWidget 134 | { 135 | protected $title = 'Registro.br'; 136 | protected $description = ''; 137 | protected $weight = 150; 138 | protected $columns = 1; 139 | protected $cache = false; 140 | protected $cacheExpiry = 120; 141 | protected $requiredPermission = ''; 142 | 143 | public function getData() 144 | { 145 | $include_path = ROOTDIR . '/modules/registrars/registrobr'; 146 | set_include_path($include_path . PATH_SEPARATOR . get_include_path()); 147 | 148 | require_once('TLDs.php'); 149 | 150 | require_once ROOTDIR . '/includes/registrarfunctions.php'; 151 | $moduleparams = getRegistrarConfigOptions('registrobr'); 152 | 153 | if ($moduleparams["ReprovisionTLDs"] == "No") { 154 | return (array ('success' => true)); } ; 155 | 156 | $firstyearprice = $moduleparams['firstyearprice']; 157 | 158 | 159 | $renewalprice = $moduleparams['renewalprice']; 160 | 161 | $registerpricearray = array (1 => $firstyearprice, 2 => $firstyearprice + $renewalprice, 3 => $firstyearprice + 2 * $renewalprice, 4 => $firstyearprice + 3 * $renewalprice, 5 => $firstyearprice + 4 * $renewalprice, 6 => $firstyearprice + 5 * $renewalprice, 7 => $firstyearprice + 6 * $renewalprice, 8 => $firstyearprice + 7 * $renewalprice, 9 => $firstyearprice + 8 * $renewalprice, 10 => $firstyearprice + 9 * $renewalprice); 162 | 163 | $renewpricearray = array (1 => $renewalprice, 2 => 2 * $renewalprice, 3 => 3 * $renewalprice, 4 => 4 * $renewalprice, 5 => 5 * $renewalprice, 6 => 6 * $renewalprice, 7 => 7 * $renewalprice, 8 => 8 * $renewalprice, 9 => 9 * $renewalprice); 164 | 165 | 166 | $success=true ; 167 | 168 | 169 | 170 | foreach ($registrobr_AllTLDs as &$registrobr_TLD) { 171 | $command = 'CreateOrUpdateTLD'; 172 | $postData = array( 173 | 'extension' => $registrobr_TLD, 174 | 'id_protection' => false, 175 | 'dns_management' => false, 176 | 'email_forwarding' => false, 177 | 'epp_required' => false, 178 | 'auto_registrar' => 'registrobr', 179 | 'currency_code' => 'BRL', 180 | 'grace_period_days' => '104', 181 | 'grace_period_fee' => '-1', 182 | 'redemption_period_fee' => '0.00', 183 | 'register' => $registerpricearray, 184 | 'renew' => $renewpricearray, 185 | 'transfer' => array(1 => '-1.00'), 186 | ); 187 | 188 | $results = localAPI($command, $postData); 189 | if ($results['result'] != 'success') { 190 | $success=false ; 191 | logModuleCall('registrobr', 'Create or Update TLD failure', $command . $postData, $results); 192 | } 193 | } 194 | 195 | $moduleparams['ReprovisionTLDs'] = "No"; 196 | 197 | $command = 'UpdateModuleConfiguration'; 198 | $postData = array( 199 | 'moduleType' => 'registrar', 200 | 'moduleName' => 'registrobr', 201 | 'parameters' => $moduleparams); 202 | $results = localAPI($command, $postData); 203 | if ($results['result'] != 'success') { 204 | $success=false ; 205 | } 206 | return array('success' => $success); 207 | } 208 | 209 | public function generateOutput($data) 210 | { 211 | $message = ($data['success'] == true) ? 'ok' : 'failed' ; 212 | 213 | return << 215 | Registro.br TLDs $message 216 | 217 | EOF; 218 | } 219 | } 220 | 221 | 222 | 223 | function _registrobr_whmcsTickets($code,$msgid,$reason,$content,$objRegistroEPPPoll){ 224 | 225 | $moduleparams = getregistrarconfigoptions('registrobr'); 226 | 227 | $automation = false; 228 | 229 | 230 | 231 | switch($code) { 232 | case '1': 233 | $automation = true ; // DOMAIN_CREATE_PAN handled by code 234 | #no break, domain_create_pan also has domain in objectId 235 | case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '10': case '11': case '12': case '13': case '14': case '15': case '16': case '17': case '18': case '20': case '107': case '108': case '304': case '305': 236 | $domain = $objRegistroEPPPoll->get('objectId'); 237 | break; 238 | case '100': case '101': case '102': case '103': case '106': 239 | $taxpayerID = $objRegistroEPPPoll->get('objectId'); 240 | break; 241 | } 242 | $taxpayerID=preg_replace("/[^0-9]/","",$taxpayerID); 243 | 244 | if (in_array($code,array('300','302','303','305'))==TRUE) { 245 | $issue["priority"] = "High"; 246 | $issue["deptid"] = $moduleparams["FinanceDept"]; 247 | } 248 | elseif (in_array($code,array('301','304'))==TRUE) { 249 | $issue["priority"] = "Low"; 250 | $issue["deptid"] = $moduleparams["FinanceDept"]; 251 | } 252 | elseif (!$automation) { 253 | $issue["priority"] = "Low" ; 254 | $issue["deptid"] = $moduleparams["TechDept"]; 255 | } 256 | 257 | if (!empty($domain)) { 258 | $issue["domain"] =$domain; 259 | 260 | 261 | // Refactor opportunity: changing this code to use Domain Model instead of tbldomains 262 | if (!empty($domainid)) { 263 | $issue["domainid"] = $domainid; 264 | $data = Capsule::table('tbldomains') 265 | ->where(id,"=",$domainid) 266 | ->get(); 267 | 268 | $issue["clientid"]=$data['userid']; 269 | } 270 | } 271 | 272 | if ($automation) { 273 | switch($code) { 274 | case '1': // DOMAIN_CREATE_PAN 275 | try { 276 | Capsule::table('mod_registrobr') 277 | ->where('domainid', $domainid) 278 | ->update( 279 | [ 280 | 'registered' => true, 281 | ] 282 | ); 283 | } catch (Exception $e) { 284 | logModuleCall('registrobr', 'Failed to update mod_registrobr in poll processing', "Capsule table where domainid ". $domainid . " update registered true " ,$e->getMessage()); 285 | } 286 | break; 287 | } 288 | 289 | 290 | 291 | } else { 292 | 293 | if (!isset($issue["clientid"])) { 294 | $issue["email"]='noreply@registro.br'; 295 | $issue["name"]='Registro.br EPP'; 296 | } 297 | 298 | $issue["subject"] = "Mensagem de Poll relativa a dominios .br"; 299 | $issue["message"] = $content; 300 | $issue["admin"] = true; 301 | 302 | $results = localAPI("OpenTicket",$issue); 303 | 304 | if ($results['result']!="success") { 305 | logModuleCall("registrobr","failed to open ticket",$issue,$results); 306 | return false; 307 | } else { 308 | return true; 309 | } 310 | } 311 | 312 | } 313 | 314 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/ParserResponse/ParserResponse.class.php: -------------------------------------------------------------------------------- 1 | loadXML($response); 38 | 39 | $createdate = substr($doc->getElementsByTagName('crDate')->item(0)->nodeValue,0,10); 40 | $exDate = substr($doc->getElementsByTagName('exDate')->item(0)->nodeValue,0,10); 41 | 42 | $holdreasons = array(); 43 | $i = 0; 44 | 45 | $hreasons = $doc->getElementsByTagName('onHoldReason'); 46 | foreach ($hreasons as $hr) { 47 | $holdreasons[$i] = $hr->nodeValue; 48 | $i++; 49 | } 50 | 51 | 52 | $this->set('coderes',$doc->getElementsByTagName('result')->item(0)->getAttribute('code')); 53 | $this->set('msg',$doc->getElementsByTagName('msg')->item(0)->nodeValue); 54 | $this->set('reason',$doc->getElementsByTagName('reason')->item(0)->nodeValue); 55 | $this->set('id',$doc->getElementsByTagName('id')->item(0)->nodeValue); 56 | $this->set('contact',$doc->getElementsByTagName('contact')->item(0)->nodeValue); 57 | $this->set('clID',$doc->getElementsByTagName('clID')->item(0)->nodeValue); 58 | $this->set('name',$doc->getElementsByTagName('name')->item(0)->nodeValue); 59 | $this->set('exDate',$exDate); 60 | $this->set('crDate',$createdate); 61 | $this->set('onHoldReason',$holdreasons); 62 | 63 | $this->set('name',$doc->getElementsByTagName('name')->item(0)->nodeValue); 64 | $this->set('ticket',$doc->getElementsByTagName('ticketNumber')->item(0)->nodeValue); 65 | 66 | 67 | $this->set('doc',$doc); 68 | } 69 | public function parsePoll($response){ 70 | $doc= new DOMDocument(); 71 | $doc->loadXML($response); 72 | 73 | /* 74 | * 75 | 76 | 77 | 78 | 79 | Command completed successfully; ack to dequeue 80 | 81 | 82 | 2011-07-05T14:42:14.0Z 83 | 84 | 301 85 | Deposit notification. 86 | 1000.00 87 | 1000.00 88 | 89 | 90 | 91 | 20997642941829377339 92 | 20130325152922-3671AABF-237-0002 93 | 94 | 95 | 96 | */ 97 | $coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code'); 98 | $this->set('coderes',$coderes); 99 | 100 | if($coderes != 1300){ 101 | 102 | $msgQ = $doc->getElementsByTagName('msgQ')->item(0)->getAttribute('id'); 103 | $qDate = $doc->getElementsByTagName('qDate')->item(0)->nodeValue; 104 | $txt = $doc->getElementsByTagName('txt')->item(0)->nodeValue; 105 | $reason = $doc->getElementsByTagName('reason')->item(0)->nodeValue; 106 | $coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code'); 107 | $ticket = $doc->getElementsByTagName('ticketNumber')->item(0)->nodeValue; 108 | $objectId = $doc->getElementsByTagName('objectId')->item(0)->nodeValue; 109 | 110 | 111 | $this->set('coderes',$coderes); 112 | $this->set('msgQ',$msgQ); 113 | $this->set('qDate',$qDate); 114 | $this->set('code',$code); 115 | $this->set('txt',$txt); 116 | $this->set('reason',$reason); 117 | $this->set('ticket',$ticket); 118 | $this->set('objectId',$objectId); 119 | $this->set('msg',$txt); 120 | $this->set('language',$language); 121 | } 122 | } 123 | public function parseAck($response){ 124 | /* 125 | 126 | 127 | 128 | Command completed successfully 129 | 130 | 131 | 132 | 14295320031113985087 133 | 20130327184845-2D7B794A-237-0003 134 | 135 | 136 | */ 137 | $doc= new DOMDocument(); 138 | $doc->loadXML($response); 139 | 140 | $msgQ = $doc->getElementsByTagName('msgQ')->item(0)->getAttribute('id'); 141 | $coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code'); 142 | 143 | $this->set('coderes',$coderes); 144 | $this->set('msgQ',$msgQ); 145 | } 146 | public function parseBRorgInfo($response){ 147 | $doc= new DOMDocument(); 148 | $doc->loadXML($response); 149 | 150 | 151 | 152 | /* must be inherits from parser() */ 153 | $this->set('coderes',$doc->getElementsByTagName('result')->item(0)->getAttribute('code')); 154 | $this->set('msg',$doc->getElementsByTagName('msg')->item(0)->nodeValue); 155 | $this->set('reason',$doc->getElementsByTagName('reason')->item(0)->nodeValue); 156 | $this->set('id',$doc->getElementsByTagName('id')->item(0)->nodeValue); 157 | $this->set('contact',$doc->getElementsByTagName('contact')->item(0)->nodeValue); 158 | $this->set('clID',$doc->getElementsByTagName('clID')->item(0)->nodeValue); 159 | $this->set('name',$doc->getElementsByTagName('name')->item(0)->nodeValue); 160 | $this->set('doc',$doc); 161 | /* must be inherits from parser() */ 162 | 163 | $this->set('name',$doc->getElementsByTagName('name')->item(0)->nodeValue); 164 | $this->set('street1',$doc->getElementsByTagName('street')->item(0)->nodeValue); 165 | $this->set('street2',$doc->getElementsByTagName('street')->item(1)->nodeValue); 166 | $this->set('street3',$doc->getElementsByTagName('street')->item(2)->nodeValue); 167 | $this->set('city',$doc->getElementsByTagName('city')->item(0)->nodeValue); 168 | $this->set('sp',$doc->getElementsByTagName('sp')->item(0)->nodeValue); 169 | $this->set('pc',$doc->getElementsByTagName('pc')->item(0)->nodeValue); 170 | $this->set('cc',$doc->getElementsByTagName('cc')->item(0)->nodeValue); 171 | $this->set('voice',$doc->getElementsByTagName('voice')->item(0)->nodeValue); 172 | $this->set('email',$doc->getElementsByTagName('email')->item(0)->nodeValue); 173 | 174 | } 175 | 176 | public function getContacts(){ 177 | 178 | $doc = $this->get('doc'); 179 | $domaininfo=array(); 180 | 181 | 182 | if(!empty($doc)){ 183 | $domaininfo=array(); 184 | for ($i=0; $i<=2; $i++) { 185 | $domaininfo[$doc->getElementsByTagName('contact')->item($i)->getAttribute('type')]=$doc->getElementsByTagName('contact')->item($i)->nodeValue; 186 | } 187 | return $domaininfo; 188 | } 189 | else { 190 | throw new Exception('Variable doc is not set, run parse method before'); 191 | } 192 | } 193 | public function getOrganization(){ 194 | $doc = $this->get('doc'); 195 | 196 | if(!empty($doc)){ 197 | # Get TaxPayer ID for obtaining Reg Info 198 | $RegistrantTaxID=$doc->getElementsByTagName('organization')->item(0)->nodeValue; 199 | return $RegistrantTaxID; 200 | } 201 | else { 202 | throw new Exception('Variable doc is not set, run parse method before'); 203 | } 204 | } 205 | public function getNameServers(){ 206 | //after RegistroEPPDomainInfo(); 207 | 208 | $doc = $this->get('doc'); 209 | if(!empty($doc)){ 210 | $ns = $doc->getElementsByTagName('hostName'); 211 | 212 | # Extract nameservers 213 | $i =0; 214 | $values = array(); 215 | foreach ($ns as $nn) { 216 | $i++; 217 | if ($nn->nodeName=='domain:hostName') $values["ns{$i}"] = $nn->nodeValue; 218 | } 219 | return $values; 220 | } 221 | else { 222 | throw new Exception('Response XML doesnt exists'); 223 | 224 | } 225 | 226 | 227 | } 228 | 229 | 230 | public function get($key){ 231 | if (property_exists($this, $key)) { 232 | return $this->$key; 233 | } 234 | else { 235 | return false; 236 | } 237 | } 238 | public function set($key,$value){ 239 | if (property_exists($this, $key)) { 240 | $this->$key = $value; 241 | return $this; 242 | } 243 | else { 244 | return false; 245 | } 246 | } 247 | 248 | } 249 | 250 | ?> 251 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/RegistroEPP/RegistroEPPBrorg.class.php: -------------------------------------------------------------------------------- 1 | get('netClient'); 28 | if(empty($client)){ 29 | throw new Exception('net Client is not setted, check login before'); 30 | } 31 | $requestXML = $this->_getXMLinfo(); 32 | $responseXML = $client->request($requestXML); 33 | $objParser = New ParserResponse(); 34 | $objParser->parseBRorgInfo($responseXML); // must be change to OO aproach 35 | 36 | 37 | $coderes = $objParser->get('coderes'); 38 | 39 | $this->set('coderes',$coderes); 40 | 41 | if($coderes == '2303' and $ignore){ 42 | return; 43 | } 44 | elseif($coderes != '1000') { 45 | $msg = $this->errorEPP('getcontactorginfoerrorcode',$objParser,$requestXML,$responseXML); 46 | throw new Exception($msg); 47 | } 48 | 49 | $this->set('clID',$objParser->get('clID')); 50 | $this->set('coderes',$objParser->get('coderes')); 51 | $this->set('contact',$objParser->get('contact')); 52 | $this->set('name',$objParser->get('name')); 53 | 54 | $this->set('street1',$objParser->get('street1')); 55 | $this->set('street2',$objParser->get('street2')); 56 | $this->set('street3',$objParser->get('street3')); 57 | $this->set('street4',$objParser->get('street4')); 58 | 59 | $this->set('city',$objParser->get('city')); 60 | $this->set('sp',$objParser->get('sp')); 61 | $this->set('pc',$objParser->get('pc')); 62 | $this->set('cc',$objParser->get('cc')); 63 | $this->set('voice',$objParser->get('voice')); 64 | $this->set('email',$objParser->get('email')); 65 | 66 | } 67 | public function createData(){ 68 | require_once('ParserResponse/ParserResponse.class.php'); 69 | 70 | $client = $this->get('netClient'); 71 | if(empty($client)){ 72 | throw new Exception('net Client is not setted, check login before'); 73 | } 74 | $requestXML = $this->_createXML(); 75 | 76 | $responseXML = $client->request($requestXML); 77 | $objParser = New ParserResponse(); 78 | $objParser->parse($responseXML); 79 | 80 | $coderes = $objParser->get('coderes'); 81 | $id = $objParser->get('id'); 82 | 83 | $this->set('id',$id); 84 | $this->set('coderes',$coderes); 85 | 86 | //$msg = $this->errorEPP('savecontacttypeerrorcode',$objParser,$requestXML,$responseXML); 87 | 88 | if($coderes != '1000') { 89 | $msg = $this->errorEPP('savecontacttypeerrorcode',$objParser,$requestXML,$responseXML); 90 | throw new Exception($msg); 91 | } 92 | } 93 | 94 | public function createOrgData(){ 95 | require_once('ParserResponse/ParserResponse.class.php'); 96 | 97 | $client = $this->get('netClient'); 98 | if(empty($client)){ 99 | throw new Exception('net Client is not setted, check login before'); 100 | } 101 | $requestXML = $this->_createXMLOrg(); 102 | 103 | 104 | $responseXML = $client->request($requestXML); 105 | $objParser = New ParserResponse(); 106 | $objParser->parse($responseXML); 107 | 108 | $coderes = $objParser->get('coderes'); 109 | $id = $objParser->get('id'); 110 | 111 | $this->set('id',$id); 112 | $this->set('coderes',$coderes); 113 | 114 | if($coderes != '1001') { 115 | $msg = $this->errorEPP('registercreateorgcontacterrorcode',$objParser,$requestXML,$responseXML); 116 | throw new Exception($msg); 117 | } 118 | } 119 | 120 | public function updateInfo($OldContacts,$NewContacts){ 121 | require_once('ParserResponse/ParserResponse.class.php'); 122 | 123 | $client = $this->get('netClient'); 124 | if(empty($client)){ 125 | throw new Exception('net Client is not setted, check login before'); 126 | } 127 | 128 | if(empty($OldContacts) || empty($NewContacts)){ 129 | throw new Exception('OldContacts and NewContacts params are required'); 130 | } 131 | 132 | $requestXML = $this->_updateXMLinfo($OldContacts,$NewContacts); 133 | $responseXML = $client->request($requestXML); 134 | $objParser = New ParserResponse(); 135 | $objParser->parse($responseXML); 136 | 137 | $coderes = $objParser->get('coderes'); 138 | $id = $objParser->get('id'); 139 | 140 | $this->set('id',$id); 141 | $this->set('coderes',$coderes); 142 | 143 | if($coderes != '1000') { 144 | $msg = $this->errorEPP('savecontactorgupdateeerrorcode',$objParser,$requestXML,$responseXML); 145 | throw new Exception($msg); 146 | } 147 | } 148 | 149 | 150 | 151 | private function _updateXMLinfo($OldContacts,$NewContacts){ 152 | 153 | $contactID = $this->get('contactID'); 154 | $contactIDDigits = $this->get('contactIDDigits'); 155 | 156 | 157 | if(!$contactID){ 158 | throw new Exception('contactID is not set'); 159 | } 160 | 161 | $name = $this->get('name'); 162 | $street1 = $this->get('street1'); 163 | $street2 = $this->get('street2'); 164 | $street3 = $this->get('street3'); 165 | $city = $this->get('city'); 166 | $sp = $this->get('sp'); 167 | $pc = $this->get('pc'); 168 | $cc = $this->get('cc'); 169 | $voice = $this->get('voice'); 170 | $email = $this->get('email'); 171 | $responsible = $this->get('responsible'); 172 | 173 | $request=' 174 | 175 | 176 | 177 | '.$contactIDDigits.' 178 | 179 | 180 | '.$name.' 181 | '; 182 | if(!empty($street1)) $request.= "$street1"; 183 | if(!empty($street2)) $request.= "$street2"; 184 | if(!empty($street3)) $request.= "$street3"; 185 | $request.=' 186 | '.$city.' 187 | '.$sp.' 188 | '.$pc.' 189 | '.$cc.' 190 | 191 | 192 | '.$voice.' 193 | '.$email.' 194 | 195 | 196 | 197 | 198 | 199 | '.$contactID.' 200 | 201 | '.$NewContacts["Registrant"].' 202 | 203 | 204 | '.$OldContacts["Registrant"].' 205 | 206 | 207 | '.$responsible.' 208 | 209 | 210 | 211 | '.mt_rand().mt_rand().' 212 | 213 | '; 214 | 215 | 216 | return $request; 217 | 218 | } 219 | #terminar esse metodo 220 | private function _createXMLOrg(){ 221 | 222 | $contactID = $this->get('contactID'); 223 | $contactIDDigits = $this->get('contactIDDigits'); 224 | 225 | 226 | if(!$contactID){ 227 | throw new Exception('contactID is not set'); 228 | } 229 | 230 | $name = $this->get('name'); 231 | $street1 = $this->get('street1'); 232 | $street2 = $this->get('street2'); 233 | $street3 = $this->get('street3'); 234 | $city = $this->get('city'); 235 | $sp = $this->get('sp'); 236 | $pc = $this->get('pc'); 237 | $cc = $this->get('cc'); 238 | $idt = $this->get('idt'); 239 | $voice = $this->get('voice'); 240 | $email = $this->get('email'); 241 | $responsible = $this->get('responsible'); 242 | 243 | $request=' 244 | 245 | 246 | 247 | 248 | '.$contactIDDigits.' 249 | 250 | '.$name.' 251 | '; 252 | if(!empty($street1)) $request.= "$street1"; 253 | if(!empty($street2)) $request.= "$street2"; 254 | if(!empty($street3)) $request.= "$street3"; 255 | $request.=' 256 | '.$city.' 257 | '.$sp.' 258 | '.$pc.' 259 | '.$cc.' 260 | 261 | 262 | '.$voice.' 263 | '.$email.' 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | '.$contactID.' 272 | '.$idt.' 273 | 274 | 275 | '.mt_rand().mt_rand().' 276 | 277 | '; 278 | 279 | return $request; 280 | } 281 | 282 | private function _getXMLinfo(){ 283 | 284 | 285 | $contactID = $this->get('contactID'); 286 | $contactIDDigits = $this->get('contactIDDigits'); 287 | 288 | 289 | if(!$contactIDDigits){ 290 | //throw new Exception('contactID is not set'); 291 | } 292 | 293 | $request = ' 294 | 295 | 296 | 297 | 298 | '.$contactIDDigits.' 299 | 300 | '; 301 | if($contactID){ 302 | $request.= ' 303 | 304 | 305 | '.$contactID.' 306 | 307 | '; 308 | } 309 | $request.=''.mt_rand().mt_rand().' 310 | 311 | 312 | '; 313 | 314 | return $request; 315 | } 316 | 317 | private function _createXML(){ 318 | 319 | $name = $this->get('name'); 320 | $street1 = $this->get('street1'); 321 | $street2 = $this->get('street2'); 322 | $street3 = $this->get('street3'); 323 | $city = $this->get('city'); 324 | $sp = $this->get('sp'); 325 | $pc = $this->get('pc'); 326 | $cc = $this->get('cc'); 327 | $voice = $this->get('voice'); 328 | $email = $this->get('email'); 329 | 330 | 331 | if(!$name){ 332 | throw new Exception('name must be set'); 333 | } 334 | //must check 335 | 336 | $request=' 337 | 338 | 339 | 340 | 341 | dummy 342 | 343 | '.$name.' 344 | '; 345 | if(!empty($street1)) $request.= "$street1"; 346 | if(!empty($street2)) $request.= "$street2"; 347 | if(!empty($street3)) $request.= "$street3"; 348 | $request.= ' 349 | '.$city.' 350 | '.$sp.' 351 | '.$pc.' 352 | '.$cc.' 353 | 354 | 355 | '.$voice.' 356 | '.$email.' 357 | 358 | 359 | 360 | 361 | 362 | '.mt_rand().mt_rand().' 363 | 364 | '; 365 | 366 | return $request; 367 | } 368 | 369 | 370 | 371 | public function verifyProvider($prov,$prov_module){ 372 | $prov_module = trim($prov_module); 373 | $prov = trim($prov); 374 | 375 | if($prov != $prov_module){ 376 | $msg = $this->error('getcontactnotallowed',$prov,$prov_module); 377 | throw new Exception($msg); 378 | } 379 | } 380 | } 381 | 382 | ?> 383 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/RegistroEPP/RegistroEPPDomain.class.php: -------------------------------------------------------------------------------- 1 | get('netClient'); 26 | if(empty($client)){ 27 | throw new Exception('net Client is not setted, check login before'); 28 | } 29 | 30 | $requestXML = $this->_getXMLinfo(); 31 | $responseXML = $client->request($requestXML); 32 | 33 | $objParser = New ParserResponse(); 34 | $objParser->parse($responseXML); 35 | 36 | $coderes = $objParser->get('coderes',$coderes); 37 | $this->set('coderes',$coderes); 38 | 39 | 40 | if ($coderes == '2303') { 41 | $msg = $this->errorEPP('domainnotfound',$objParser,$requestXML,$responseXML); 42 | throw new Exception($msg); 43 | } 44 | elseif ($coderes != '1000') { 45 | $msg = $this->errorEPP('getnserrorcode',$objParser,$requestXML,$responseXML); 46 | throw new Exception($msg); 47 | } 48 | 49 | $this->set('nameservers',$objParser->getNameServers()); 50 | $this->set('clID',$objParser->get('clID')); 51 | $this->set('contacts',$objParser->getContacts()); 52 | $this->set('organization',$objParser->getOrganization()); 53 | $this->set('exDate',$objParser->get('exDate')); 54 | $this->set('crDate',$objParser->get('crDate')); 55 | $this->set('onHoldReason',$objParser->get('onHoldReason')); 56 | $this->set('ticket',$objParser->get('ticket')); 57 | 58 | } 59 | 60 | public function createDomain($Nameservers = null){ 61 | require_once('ParserResponse/ParserResponse.class.php'); 62 | 63 | $client = $this->get('netClient'); 64 | if(empty($client)){ 65 | throw new Exception('net Client is not setted, check login before'); 66 | } 67 | 68 | $requestXML = $this->_createXMLDomain($Nameservers); 69 | $responseXML = $client->request($requestXML); 70 | 71 | $objParser = New ParserResponse(); 72 | $objParser->parse($responseXML); 73 | 74 | $this->set('ticket',$objParser->get('ticket')); 75 | $this->set('name',$objParser->get('name')); 76 | $this->set('coderes',$objParser->get('coderes')); 77 | 78 | $coderes = $objParser->get('coderes',$coderes); 79 | 80 | #$msg = $this->errorEPP('registererrorcode',$objParser,$requestXML,$responseXML); 81 | 82 | 83 | if ($coderes != '1001') { 84 | $msg = $this->errorEPP('registererrorcode',$objParser,$requestXML,$responseXML); 85 | throw new Exception($msg); 86 | } 87 | 88 | 89 | } 90 | public function updateNameServers($OldNameservers,$NewNameservers){ 91 | require_once('ParserResponse/ParserResponse.class.php'); 92 | 93 | $client = $this->get('netClient'); 94 | if(empty($client)){ 95 | throw new Exception('net Client is not setted, check login before'); 96 | } 97 | 98 | $requestXML = $this->_getXMLupdateNameserver($OldNameservers,$NewNameservers); 99 | $responseXML = $client->request($requestXML); 100 | 101 | $objParser = New ParserResponse(); 102 | $objParser->parse($responseXML); 103 | 104 | $coderes = $objParser->get('coderes',$coderes); 105 | 106 | if ($coderes != '1000') { 107 | $msg = $this->errorEPP('setnsupdateerrorcode',$objParser,$requestXML,$responseXML); 108 | throw new Exception($msg); 109 | } 110 | 111 | 112 | $this->set('coderes',$coderes); 113 | 114 | 115 | } 116 | 117 | public function updateInfo($OldContacts,$NewContacts){ 118 | 119 | require_once('ParserResponse/ParserResponse.class.php'); 120 | 121 | $client = $this->get('netClient'); 122 | if(empty($client)){ 123 | throw new Exception('net Client is not setted, check login before'); 124 | } 125 | 126 | $requestXML = $this->_updateXMLinfo($OldContacts,$NewContacts); 127 | $responseXML = $client->request($requestXML); 128 | 129 | $objParser = New ParserResponse(); 130 | $objParser->parse($responseXML); 131 | 132 | $coderes = $objParser->get('coderes',$coderes); 133 | 134 | if ($coderes != '1000') { 135 | $msg = $this->errorEPP('savecontactdomainupdateerrorcode',$objParser,$requestXML,$responseXML); 136 | throw new Exception($msg); 137 | } 138 | 139 | } 140 | 141 | public function deleteDomain(){ 142 | 143 | require_once('ParserResponse/ParserResponse.class.php'); 144 | 145 | $client = $this->get('netClient'); 146 | if(empty($client)){ 147 | throw new Exception('net Client is not setted, check login before'); 148 | } 149 | 150 | $requestXML = $this->_deleteXMLDomain(); 151 | $responseXML = $client->request($requestXML); 152 | 153 | $objParser = New ParserResponse(); 154 | $objParser->parse($responseXML); 155 | 156 | $coderes = $objParser->get('coderes',$coderes); 157 | $this->set('coderes',$coderes); 158 | 159 | if ($coderes != '1000' and $coderes != '2303') { 160 | $msg = $this->errorEPP('deleteerrorcode',$objParser,$requestXML,$responseXML); 161 | throw new Exception($msg); 162 | } 163 | } 164 | 165 | public function renewDomain(){ 166 | 167 | require_once('ParserResponse/ParserResponse.class.php'); 168 | 169 | $client = $this->get('netClient'); 170 | if(empty($client)){ 171 | throw new Exception('net Client is not setted, check login before'); 172 | } 173 | 174 | $requestXML = $this->_renewXMLDomain(); 175 | $responseXML = $client->request($requestXML); 176 | 177 | $objParser = New ParserResponse(); 178 | $objParser->parse($responseXML); 179 | 180 | $coderes = $objParser->get('coderes',$coderes); 181 | $this->set('coderes',$coderes); 182 | $this->set('exDate',$objParser->get('exDate')); 183 | $this->set('crDate',$objParser->get('crDate')); 184 | $this->set('onHoldReason',$objParser->get('onHoldReason')); 185 | $this->set('ticket',$objParser->get('ticket')); 186 | 187 | 188 | if ($coderes != '1000') { 189 | $msg = $this->errorEPP('renewerrorcode',$objParser,$requestXML,$responseXML); 190 | throw new Exception($msg); 191 | } 192 | } 193 | 194 | private function _renewXMLDomain(){ 195 | 196 | $domain = $this->get('domain'); 197 | $exDate = $this->get('exDate'); 198 | $regperiod = $this->get('regperiod'); 199 | 200 | 201 | $request=' 202 | 203 | 204 | 205 | 206 | '.$domain.' 207 | '.$exDate.' 208 | '.$regperiod.' 209 | 210 | 211 | '.mt_rand().mt_rand().' 212 | 213 | 214 | '; 215 | 216 | return $request; 217 | } 218 | private function _deleteXMLDomain(){ 219 | 220 | $domain = $this->get('domain'); 221 | 222 | if(!$domain){ 223 | throw new Exception("Domain not set "); 224 | } 225 | 226 | $request = ' 227 | 228 | 229 | 230 | 231 | '.$domain.' 232 | 233 | 234 | '.mt_rand().mt_rand().' 235 | 236 | 237 | '; 238 | 239 | return $request; 240 | } 241 | 242 | private function _updateXMLinfo($OldContacts,$NewContacts){ 243 | 244 | $domain = $this->get('domain'); 245 | 246 | 247 | if(!$domain){ 248 | throw new Exception("Domain not set "); 249 | } 250 | 251 | $request=' 252 | 253 | 254 | 255 | 256 | '.$domain.' 257 | '; 258 | foreach ($NewContacts as $type => $id) { 259 | if ($type!="Registrant") { 260 | $request.=''.$id.'' ; 261 | } 262 | } 263 | $request.=' 264 | '; 265 | foreach ($OldContacts as $type => $id){ 266 | if ($type!="Registrant") { 267 | $request.=''.$id.'' ; 268 | } 269 | } 270 | $request.=' 271 | 272 | 273 | 274 | '.mt_rand().mt_rand().' 275 | 276 | '; 277 | 278 | 279 | return $request; 280 | 281 | } 282 | 283 | private function _getXMLinfo(){ 284 | 285 | $ticket = $this->get('ticket'); 286 | $domain = $this->get('domain'); 287 | 288 | 289 | if(!$domain){ 290 | throw new Exception("Domain not set => $domain"); 291 | } 292 | 293 | $request = ' 294 | 295 | 296 | 297 | 298 | '.$domain.' 299 | 300 | '; 301 | if ($this->get('ticket')) { 302 | $request.=' 303 | 304 | 307 | '.$ticket.' 308 | 309 | '; 310 | $this->set('ticket',''); 311 | } 312 | $request.=' 313 | '.mt_rand().mt_rand().' 314 | 315 | 316 | '; 317 | 318 | return $request; 319 | } 320 | 321 | private function _createXMLDomain($Nameservers = null){ 322 | 323 | $domain = $this->get('domain'); 324 | $regperiod = $this->get('regperiod'); 325 | $contactIDDigits = $this->get('contactIDDigits'); 326 | $contactID = $this->get('contactID'); 327 | $tech = $this->get('tech'); 328 | 329 | $addhosts = ''; 330 | 331 | foreach ($Nameservers as $key => $ns){ 332 | # Generate XML for nameservers 333 | if (!empty($ns)) { 334 | $add_hosts.= ' 335 | 336 | '.$ns.' 337 | 338 | '; 339 | } 340 | } 341 | 342 | 343 | 344 | $request = ' 345 | 346 | 347 | 348 | 349 | '.$domain.' 350 | '.$regperiod.' 351 | '.$add_hosts.''; 352 | 353 | # Valid .br contacts have 3 or more letters and/or numbers 354 | if (strlen($tech)>2) 355 | $request.=' '.$tech.''; 356 | 357 | $request.=' 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | '.$contactID.' 366 | 367 | 368 | '.mt_rand().mt_rand().' 369 | 370 | 371 | '; 372 | 373 | return $request; 374 | } 375 | 376 | private function _getXMLupdateNameserver($OldNameservers,$NewNameservers){ 377 | 378 | 379 | $ticket = $this->get('ticket'); 380 | $domain = $this->get('domain'); 381 | 382 | $addhosts = ''; 383 | $remhosts = ''; 384 | 385 | foreach ($NewNameservers as $key => $ns){ 386 | # Generate XML for nameservers 387 | if (!empty($ns)) { 388 | $add_hosts.= ' 389 | 390 | '.$ns.' 391 | 392 | '; 393 | } 394 | } 395 | 396 | 397 | foreach ($OldNameservers as $key => $ns) { 398 | if (!empty($ns)){ 399 | $rem_hosts .= ' 400 | 401 | '.$ns.' 402 | 403 | '; 404 | } 405 | } 406 | 407 | 408 | # Build request 409 | $request=' 410 | 411 | 412 | 413 | 414 | '.$domain.''; 415 | if(!empty($add_hosts)) 416 | $request .=' 417 | 418 | '.$add_hosts.' 419 | '; 420 | 421 | $request .=' 422 | 423 | '.$rem_hosts.' 424 | 425 | 426 | '; 427 | if ($ticket!='') { 428 | $request.=' 429 | 430 | 433 | '.$ticket.' 434 | 435 | '; 436 | } 437 | $request.=' 438 | '.mt_rand().mt_rand().' 439 | 440 | 441 | '; 442 | 443 | return $request; 444 | } 445 | 446 | public function verifyProvider($prov,$prov_module){ 447 | if($prov != $prov_module){ 448 | $msg = $this->error('getcontactnotallowed',$prov,$prov_module); 449 | throw new Exception($msg); 450 | } 451 | } 452 | 453 | 454 | } 455 | 456 | ?> 457 | -------------------------------------------------------------------------------- /whmcs/modules/registrars/registrobr/RegistroEPP/RegistroEPP.class.php: -------------------------------------------------------------------------------- 1 | $key; 47 | } 48 | else { 49 | return false; 50 | } 51 | } 52 | public function set($key,$value){ 53 | 54 | if($key == 'domain'){ 55 | $value = idn_to_ascii($value); 56 | } 57 | 58 | if (property_exists($this, $key)) { 59 | $this->$key = $value; 60 | return $this; 61 | } 62 | else { 63 | return false; 64 | } 65 | } 66 | 67 | 68 | public function language($string){ 69 | 70 | $this->set('language',$string); 71 | 72 | } 73 | public function errorEPP($StringError,$ObjParser,$XmlRequest,$XmlResponse){ 74 | 75 | //$msg = _registrobr_set_encode($msg); 76 | $coderes = $ObjParser->get('coderes'); 77 | $msg = $ObjParser->get('msg'); 78 | $reason = $ObjParser->get('reason'); 79 | $language = $this->get('language'); 80 | 81 | $errormsg = $this->_registrobr_lang($StringError)." ".$coderes.": ".$this->_registrobr_lang('msg').$msg."'"; 82 | 83 | if (!empty($reason)) { 84 | #$reason = _registrobr_set_encode($reason); 85 | $errormsg.= $this->_registrobr_lang("reason").$reason."'"; 86 | } 87 | 88 | logModuleCall("registrobr",$errormsg,$XmlRequest,$XmlResponse,'',array('BetaPassword','ProdPassword','ProdPassphrase')); 89 | return $errormsg; 90 | } 91 | 92 | public function error($StringError,$param1,$errormsg){ 93 | 94 | $translate = $this->_registrobr_lang($StringError); 95 | logModuleCall("registrobr",$translate,$param1,$errormsg,'', array('BetaPassword','ProdPassword','ProdPassphrase')); 96 | return $errormsg; 97 | } 98 | public function login($moduleparams){ 99 | 100 | require_once('RegistroEPP/RegistroEPPFactory.class.php'); 101 | require_once('ParserResponse/ParserResponse.class.php'); 102 | require_once('Net/EPP/Client.php'); 103 | require_once('Net/EPP/Protocol.php'); 104 | 105 | 106 | # Grab module parameters 107 | 108 | 109 | $language = $this->set('language',$moduleparams['Language']); 110 | 111 | if ($moduleparams["TestMode"] == "Beta") { 112 | $Server = "beta.registro.br" ; 113 | $Certificate = ROOTDIR . '/modules/registrars/registrobr/client-pwd.pem'; 114 | $Passphrase = "shepp"; 115 | $Username = $moduleparams["BetaUsername"]; 116 | $Password = $moduleparams["BetaPassword"]; 117 | 118 | } 119 | else { 120 | $Server = "epp.registro.br" ; 121 | $Certificate = $moduleparams["ProdCertificate"]; 122 | $Passphrase = $moduleparams["ProdPassphrase"]; 123 | $Username = $moduleparams["ProdUsername"]; 124 | $Password = $moduleparams["ProdPassword"]; 125 | } 126 | 127 | if (empty($Certificate)) { 128 | $errormsg = $this->_registrobr_lang("specifypath"); 129 | $msg = $this->error('configerr',$moduleparams,$errormsg); 130 | throw new Exception($msg); 131 | } 132 | 133 | if (!file_exists($Certificate)) { 134 | $errormsg = $this->_registrobr_lang("invalidpath"); 135 | $msg = $this->error('configerr',$moduleparams,$errormsg); 136 | throw new Exception($msg); 137 | } 138 | 139 | if (empty($Passphrase)) { 140 | $errormsg = $this->_registrobr_lang("specifypassphrase") ; 141 | $msg = $this->error('configerr',$moduleparams,$errormsg); 142 | throw new Exception($msg); 143 | 144 | } 145 | 146 | 147 | $username = $this->set('username',$Username); 148 | $password = $this->set('password',$Password); 149 | 150 | $Options = array ( 151 | 'ssl' => array ( 152 | 'allow_self_signed' => TRUE, 153 | 'passphrase' => $Passphrase, 154 | 'local_cert' => $Certificate, 155 | # if NIC.br EPP root.pem is added to ca-certificates, change verify_peer below to TRUE 156 | 'verify_peer' => FALSE, 157 | 'verify_peer_name' => TRUE, 158 | 159 | 160 | )); 161 | 162 | 163 | 164 | # Create SSL context 165 | $context = stream_context_create($Options) ; 166 | 167 | # Create EPP client 168 | $client = new Net_EPP_Client(); 169 | 170 | # Connect 171 | $Port = 700; 172 | $use_ssl = true; 173 | try { 174 | $client->connect($Server, $Port, 3 , $use_ssl, $context); 175 | } catch (Exception $e) { 176 | $param1 = "tls://".$Server.":".$Port; 177 | $errormsg = $e->getMessage(); 178 | $msg = $this->error('eppconnect',$param1,$errormsg); 179 | throw new Exception($msg); 180 | } 181 | $requestXML = $this->loginXML(); 182 | $responseXML = $client->request($requestXML); 183 | $objParser = New ParserResponse(); 184 | $objParser->parse($responseXML); 185 | 186 | # Check results 187 | $coderes = $objParser->get('coderes'); 188 | $this->set('netClient',$client); //set NET client to others requests 189 | 190 | 191 | if($coderes != '1000') { 192 | $msg = $this->errorEPP('epplogin',$objParser,$requestXML,$responseXML); 193 | throw new Exception($msg); 194 | } 195 | } 196 | 197 | private function loginXML(){ 198 | 199 | 200 | $username = $this->get('username'); 201 | $password = $this->get('password'); 202 | $language = $this->get('language'); 203 | 204 | if($language == "Portuguese"){ 205 | $lang = "pt"; 206 | } 207 | else { 208 | $lang = "en"; 209 | } 210 | 211 | if(empty($username) || empty($password)){ 212 | throw new Exception('Username or password not set'); 213 | } 214 | 215 | $request=' 216 | 217 | 218 | 219 | '.$username.' 220 | '.$password.' 221 | 222 | 1.0 223 | '.$lang.' 224 | 225 | 226 | urn:ietf:params:xml:ns:domain-1.0 227 | urn:ietf:params:xml:ns:contact-1.0 228 | 229 | urn:ietf:params:xml:ns:brdomain-1.0 230 | urn:ietf:params:xml:ns:brorg-1.0 231 | urn:ietf:params:xml:ns:secDNS-1.0 232 | urn:ietf:params:xml:ns:secDNS-1.1 233 | 234 | 235 | 236 | '.mt_rand().mt_rand().' 237 | 238 | 239 | '; 240 | 241 | return $request; 242 | } 243 | public function getMsgLang($string){ 244 | 245 | return $this->_registrobr_lang($string); 246 | 247 | } 248 | protected function _registrobr_lang($msgid) { 249 | 250 | 251 | 252 | # Grab module parameters 253 | $moduleparams = getregistrarconfigoptions('registrobr'); 254 | $msgs = array ( 255 | "epplogin" => array ("Erro no login EPP código ","EPP login error code "), 256 | "msg" => array (" mensagem '"," message '"), 257 | "reason" => array (" motivo '"," reason '"), 258 | "eppconnect" => array ("Erro de conexão EPP","EPP connect error"), 259 | "configerr" => array ("Erro nas opções de configuração","Config options error"), 260 | "specifypath" => array ("Favor informar o caminho para o arquivo de certificado","Please specifity path to certificate file"), 261 | "invalidpath" => array ("Caminho para o arquivo de certificado inválido", "Invalid certificate file path"), 262 | "specifypassphrase" => array ("Favor especificar a frase secreta do certificado", "Please specifity certificate passphrase"), 263 | "deleteerrorcode" => array ("Erro na remoção de domíenio código ","Domain delete: error code "), 264 | "deleteconnerror" => array ("Falha na conexão EPP ao tentar remover domínio erro ","Domain delete: EPP connection error "), 265 | "getnsconnerror" => array ("Falha na conexão EPP ao tentar obter servidores DNS erro ", "get nameservers: EPP connection error "), 266 | "setnsconnerror" => array ("Falha na conexão EPP ao tentar alterar servidores DNS erro ", "set nameservers: EPP connection error "), 267 | "setnsgeterrorcode" => array ("Falha ao tentar obter servidores DNS atuais para alterar servidores DNS código ", "set nameservers: error getting nameservers code "), 268 | "setnsupdateerrorcode" => array ("Falha ao alterar servidores DNS código ","set nameservers: update servers error code "), 269 | "cpfcnpjrequired" => array ("Registro de domínios .br requer CPF ou CNPJ","register domain: .br registrations require valid CPF or CNPJ"), 270 | "companynamerequired" => array ("Registros com CNPJ requerem nome da empresa preenchido",".br registrations with CNPJ require Company Name to be filled in"), 271 | "registerconnerror" => array ("Falha na conexão EPP ao tentar registrar domínio erro ", "register domain: EPP connection error "), 272 | "notallowed" => array ("Entidade só pode registrar domínios por provedor atualmente designado.", "entity can only register domains through designated registrar."), 273 | "registergetorgerrorcode" => array ("Falha ao obter status de entidade para registrar domínio erro ","register domain: get org status error code "), 274 | "registercreateorgcontacterrorcode" => array ("Falha ao criar contato para entidade erro ","register domain: create org contact error code "), 275 | "registercreateorgerrorcode" => array ("Falha ao criar entidade para registrar domínio erro ","register domain: create org error code "), 276 | "registererrorcode" => array ("Falha ao registrar domínio erro ","register domain error code "), 277 | "renewconnerror" => array ("Falha na conexão EPP ao renovar domínio erro ", "renew domain: EPP connection error "), 278 | "renewinfoerrorcode" => array ("Falha ao obter informações de domínio ao renovar domínio erro ", "renew: domain info error code "), 279 | "renewerrorcode" => array ("Falha ao renovar domínio erro ","domain renew: error code "), 280 | "getcontactconnerror" => array ("Falha na conexão EPP ao obter dados de contato erro ","get contact details: EPP connection error "), 281 | "getcontacterrorcode" => array ("Falha ao obter dados de contato erro ", "get contact details: domain info error code "), 282 | "getcontactnotallowed" => array ("Somente provedor designado pode obter dados deste domínio.","get contact details: domain is not designated to this registrar."), 283 | "getcontactorginfoerrorcode" => array ("Falha ao obter informações de entidade detentora de domínio erro ","get contact details: organization info error code "), 284 | "getcontacttypeerrorcode" => array ("Falha ao obter dados de contato do tipo ","get contact details: "), 285 | "getcontacterrorcode" => array ("código de erro ","contact info error code "), 286 | "savecontactconnerror" => array ("Falha na conexão EPP ao gravar contatos erro ", "save contact details: EPP connection error "), 287 | "savecontactdomaininfoerrorcode" => array ("Falha ao obter dados de domínio para gravar contatos erro ","set contact details: domain info error code"), 288 | "savecontactnotalloweed" => array ("Somente provedor designado pode alterar dados deste domínio.", "Set contact details: domain is not designated to this registrar."), 289 | "savecontacttypeerrorcode" => array ("Falha ao criar novo contato do tipo ","save contact details: "), 290 | "savecontacterrorcode" => array ("código de erro ","contact create error code "), 291 | "savecontactdomainupdateerrorcode" => array ("Falha ao atualizar domínio ao modificar contatos erro ","set contact: domain update error code "), 292 | "savecontactorginfoeerrorcode" => array ("Falha de obtenção de informações de entidade ao modificar contatos erro ","set contact: org info error code "), 293 | "savecontactorgupdateerrorcode" => array ("Falha ao atualizar entidade ao modificar contatos erro ","set contact: org update error code "), 294 | "testerror" => array("Testando ...","Testing..."), 295 | "domainnotfound" => array ("Domínio ainda não registrado.","Domain not yet registered"), 296 | "getnserrorcode" => array ("Falha ao obter dados de domínio erro ","get nameserver error code "), 297 | "syncconnerror" => array ("Falha na conexão EPP ao sincronizar domínio erro ","domain sync: EPP connection error "), 298 | "syncerrorcode" => array ("Falha ao tentar obter informação de domínio código ", "domain sync: error getting domain info code "), 299 | "syncdomainnotfound" => array ("não mais registrado."," no longer registered"), 300 | "syncdomainunknownstatus" => array(" apresentou status desconhecido: ","domain sync: unknown status code "), 301 | "Domain" => array ("Domínio ","Domain "), 302 | "domain" => array ("domínio ","domain "), 303 | "syncreport" => array("Relatorio de Sincronismo de Dominios Registro.br\n","Registro.br Domain Sync Report\n"), 304 | "syncreportdashes" => array ("------------------------------------------------\n","------------------------------\n"), 305 | "ERROR" => array ("ERRO: ","ERROR: "), 306 | "domainstatusok" => array ("Ativo","Active"), 307 | "domainstatusserverhold" => array ("CONGELADO","PENDING"), 308 | "domainstatusexpired" => array ("Vencido","Expired"), 309 | "domainpending" => array("Modificação de dados de contato de domínios que ainda não completaram o ciclo de registro não é permitida em domínios .br", "'Modify Contact Details' of domains that not finalized the complete registrars' process are not allowed"), 310 | "is" => array (" está "," is "), 311 | "registration" => array ("(Criação: ","(Registered: "), 312 | "epppollerror" => array ("Erro de ao fazer EPP Poll","EPP Polling error"), 313 | "Pollmsg" => array ("Mensagem de Poll relativa a dominios .br","Poll message about .br domains"), 314 | "pollackerrorcode" => array ("Falha ao dar recebimento de mensagem EPP Poll codigo ", "EPP Poll: error acknowledging a message error code "), 315 | "Date" => array ("Data ","Date "), 316 | "time" => array ("hora ","time "), 317 | "Code" => array ("Codigo ", "code "), 318 | "Text" => array ("Texto ","Text "), 319 | "FullXMLBelow" => array ("Mensagem XML completo abaixo:\n","Full XML message below:\n"), 320 | 321 | "companynamefield" => array ("Razao Social","Company Name"), 322 | "fullnamefield" => array ("Nome e Sobrenome","Full Name"), 323 | "streetnamefield" => array ("Logradouro","Street Name"), 324 | "streetnumberfield" => array ("Numero", "Street Number"), 325 | "addresscomplementsfield" => array ("Complemento", "Address Complements"), 326 | "citynamefield" => array ("Cidade","City"), 327 | "stateprovincefield" => array ("Estado","State or Province"), 328 | "zipcodefield" => array ("CEP","Zip code"), 329 | "countrycodefield" => array ("Pais","Country"), 330 | "phonenumberfield" => array ("Fone","Phone"), 331 | "email" => array ("Email","Email") 332 | 333 | 334 | ); 335 | 336 | $language = $this->get('language'); 337 | 338 | $langmsg = ($language=="Portuguese" ? $msgs["$msgid"][0] : $msgs["$msgid"][1] ); 339 | 340 | #$langmsg = _registrobr_set_encode($langmsg); 341 | return $langmsg; 342 | } 343 | 344 | public function normaliza($string) { 345 | 346 | $string = str_replace(' ',' ',$string); 347 | $string = trim($string); 348 | $string = html_entity_decode($string,ENT_QUOTES,'UTF-8'); 349 | 350 | //Instead of The Normalizer class ... requires (PHP 5 >= 5.3.0, PECL intl >= 1.0.0) 351 | $normalized_chars = array( 'Š'=>'S', 'š'=>'s', 'Ð'=>'Dj','Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss','à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ý'=>'y', 'ý'=>'y', 'þ'=>'b', 'ÿ'=>'y', 'ƒ'=>'f', ' ' => ''); 352 | 353 | $string = strtr($string,$normalized_chars); 354 | $string = strtolower($string); 355 | return $string; 356 | } 357 | 358 | public function StateProvince($sp) { 359 | 360 | if (strlen($sp)==2) return $sp; 361 | $estado = $this->normaliza($sp); 362 | $map = array( 363 | "acre" => "AC", 364 | "alagoas" => "AL", 365 | "amazonas" => "AM", 366 | "amapa" => "AP", 367 | "bahia" => "BA", 368 | "baia" => "BA", 369 | "ceara" => "CE", 370 | "distritofederal" => "DF", 371 | "espiritosanto" => "ES", 372 | "espiritusanto" => "ES", 373 | "goias" => "GO", 374 | "goia" => "GO", 375 | "maranhao" => "MA", 376 | "matogrosso" => "MT", 377 | "matogroso" => "MT", 378 | "matogrossodosul" => "MS", 379 | "matogrossosul" => "MS", 380 | "matogrossodesul" => "MS", 381 | "minasgerais" => "MG", 382 | "minasgeral" => "MG", 383 | "para" => "PA", 384 | "paraiba" => "PB", 385 | "parana" => "PR", 386 | "pernambuco" => "PE", 387 | "pernanbuco" => "PE", 388 | "piaui" => "PI", 389 | "riodejaneiro" => "RJ", 390 | "rio" => "RJ", 391 | "riograndedonorte" => "RN", 392 | "riograndenorte" => "RN", 393 | "rondonia" => "RO", 394 | "riograndedosul" => "RS", 395 | "riograndedesul" => "RS", 396 | "riograndesul" => "RS", 397 | "roraima" => "RR", 398 | "santacatarina" => "SC", 399 | "sergipe" => "SE", 400 | "saopaulo" => "SP", 401 | "tocantins" => "TO" 402 | ); 403 | if(!empty($map[$estado])){ 404 | return $map[$estado]; 405 | } 406 | else { 407 | return $sp; 408 | } 409 | } 410 | 411 | 412 | private function _registrobr_identify_env_encode() { 413 | #Encoding default UTF-8 414 | 415 | 416 | if(!empty($CONFIG['Charset'])){ 417 | 418 | return $CONFIG['Charset']; 419 | } 420 | else { 421 | $results = localAPI('GetConfigurationValue', array( 422 | 'setting' => 'Charset',)); 423 | if ($results['result']=='success'){ 424 | return $results['value']; 425 | } 426 | return 'utf-8'; 427 | 428 | } 429 | } 430 | 431 | } 432 | 433 | ?> 434 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------