├── .gitignore ├── LICENSE ├── README.md ├── config.ini.sample ├── hooks.php ├── lang └── english.php ├── lib └── Plesk │ ├── Api.php │ ├── Config.php │ ├── Loader.php │ ├── Manager │ ├── Base.php │ ├── V1000.php │ ├── V1630.php │ ├── V1632.php │ ├── V1635.php │ ├── V1640.php │ ├── V1660.php │ └── V1670.php │ ├── Object │ ├── Addon.php │ ├── Customer.php │ ├── Ip.php │ ├── ResellerPlan.php │ └── Webspace.php │ ├── Registry.php │ ├── Translate.php │ └── Utils.php ├── plesk.php └── templates └── api ├── 1.0.0.0 ├── customer_add.tpl ├── customer_del.tpl ├── customer_get_by_login.tpl ├── customer_ippool_add_ip.tpl ├── customer_set_password.tpl ├── domain_usage_get_by_name.tpl ├── domains_get.tpl ├── ip_get.tpl ├── reseller_set_password.tpl ├── server_getProtos.tpl ├── webspace_add.tpl ├── webspace_del.tpl ├── webspace_get_by_name.tpl ├── webspace_set_ip.tpl ├── webspace_set_password.tpl ├── webspace_set_status.tpl ├── webspaces_get.tpl └── webspaces_get_by_owner_id.tpl ├── 1.6.3.0 ├── certificate_generate.tpl ├── certificate_install.tpl ├── customer_add.tpl ├── customer_del.tpl ├── customer_get_by_external_id.tpl ├── customer_get_by_login.tpl ├── customer_set_password.tpl ├── dns_record_delete.tpl ├── dns_record_retrieve.tpl ├── mx_record_create.tpl ├── resellerPlan_get.tpl ├── reseller_add.tpl ├── reseller_del.tpl ├── reseller_get_by_external_id.tpl ├── reseller_get_by_login.tpl ├── reseller_get_usage_by_login.tpl ├── reseller_plan_get_by_name.tpl ├── reseller_set_password.tpl ├── reseller_set_status.tpl ├── service_plan_addon_get_by_guid.tpl ├── service_plan_addon_get_by_name.tpl ├── service_plan_get.tpl ├── service_plan_get_by_guid.tpl ├── service_plan_get_by_name.tpl ├── switch_reseller_plan.tpl ├── switch_subscription.tpl ├── webspace_add.tpl ├── webspace_add_subscription.tpl ├── webspace_del.tpl ├── webspace_get_by_name.tpl ├── webspace_remove_subscription.tpl ├── webspace_set_ip.tpl ├── webspace_subscriptions_get_by_name.tpl ├── webspace_usage_get_by_name.tpl ├── webspaces_get.tpl └── webspaces_get_by_owner_id.tpl ├── 1.6.3.2 ├── ip_get.tpl ├── service_plan_addon_get_by_guid.tpl ├── service_plan_addon_get_by_name.tpl ├── service_plan_get_by_guid.tpl ├── webspace_add.tpl ├── webspace_add_subscription.tpl ├── webspace_get_by_name.tpl ├── webspace_remove_subscription.tpl ├── webspace_set_ip.tpl ├── webspace_subscriptions_get_by_name.tpl ├── webspace_usage_get_by_name.tpl └── webspaces_get.tpl ├── 1.6.3.5 ├── customer_get_by_external_id.tpl ├── customer_get_by_login.tpl ├── reseller_get_by_external_id.tpl ├── reseller_get_by_login.tpl └── session_create.tpl ├── 1.6.4.0 └── webspace_usage_get_by_name.tpl ├── 1.6.6.0 ├── customer_add.tpl └── reseller_add.tpl └── 1.6.7.0 ├── certificate_generate.tpl ├── certificate_install.tpl ├── customer_get_by_external_id.tpl ├── customer_get_by_login.tpl ├── reseller_get_by_external_id.tpl └── reseller_get_by_login.tpl /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plesk/whmcs-plugin/709772000e593ff92c782eb2837c0c6038417610/.gitignore -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 1999-2016. Parallels IP Holdings GmbH. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WHMCS Plesk Provisioning Module # 2 | 3 | This repository is no longer maintained. All questions regarding the WHMCS Plesk Provisioning Module should be addressed to WHMCS Technical Support. 4 | https://www.whmcs.com/submit-a-ticket/ 5 | -------------------------------------------------------------------------------- /config.ini.sample: -------------------------------------------------------------------------------- 1 | ; WHMCS Plesk Provisioning Module Config File 2 | 3 | ; Limit of accounts per Plesk client 4 | ; account_limit = 1 5 | ; skip_addon_prefix = false 6 | -------------------------------------------------------------------------------- /hooks.php: -------------------------------------------------------------------------------- 1 | account_limit; 16 | if (0 >= $accountLimit) { 17 | return array(); 18 | } 19 | 20 | $accountCount = ('new' == $vars['custtype']) ? 0 : Plesk_Utils::getAccountsCount($vars['userid']); 21 | $pleskAccountsInCart = 0; 22 | foreach($_SESSION['cart']['products'] as $product) { 23 | $currentProduct = Capsule::table('tblproducts')->where('id', $product['pid'])->first(); 24 | if ('plesk' == $currentProduct->servertype) { 25 | $pleskAccountsInCart++; 26 | } 27 | } 28 | if (!$pleskAccountsInCart) { 29 | return array(); 30 | } 31 | $summaryAccounts = $accountCount + $pleskAccountsInCart; 32 | 33 | $errors = array(); 34 | if (0 < $accountLimit && $summaryAccounts > $accountLimit) { 35 | $errors[] = $translator->translate( 36 | 'ERROR_RESTRICTIONS_ACCOUNT_COUNT', 37 | array( 38 | 'ACCOUNT_LIMIT' => $accountLimit 39 | ) 40 | ); 41 | } 42 | 43 | return $errors; 44 | }); 45 | -------------------------------------------------------------------------------- /lang/english.php: -------------------------------------------------------------------------------- 1 | "Open Control Panel", 6 | "CONFIG_SERVICE_PLAN_NAME" => "Service Plan Name", 7 | "CONFIG_RESELLER_PLAN_NAME" => "Reseller Plan Name", 8 | "CONFIG_WHICH_IP_ADDRESSES" => "Which IP addresses to use?", 9 | "CONFIG_POWER_USER_MODE" => "Use Power User view", 10 | "CONFIG_POWER_USER_MODE_DESCRIPTION" => "(Parallels Plesk 12+ only)", 11 | "FIELD_CHANGE_PASSWORD_MAIN_PACKAGE_DESCR" => "Please pay attention that username/password shown above are used for system/FTP user only and can be used to log in to the Panel.", 12 | "FIELD_CHANGE_PASSWORD_ADDITIONAL_PACKAGE_DESCR" => "Please pay attention that username/password shown above are used for system/FTP user only and can't be used to log in to the Panel. You should use username/password pair from package '@PACKAGE@' instead of them.", 13 | "ERROR_COMMON_MESSAGE" => "Error code: @CODE@. Error message: @MESSAGE@", 14 | "ERROR_ACCOUNT_VALIDATION_EMPTY_FIRST_OR_LASTNAME" => "Unable to create account in Panel. Please specify firstname or lastname or both.", 15 | "ERROR_ACCOUNT_VALIDATION_EMPTY_USERNAME" => "Unable to create account in Panel. The field 'username' is required.", 16 | "ERROR_RESELLER_ACCOUNT_IS_ALREADY_EXISTS" => "Reseller account with email '@EMAIL@' is already exist in panel.", 17 | "ERROR_NO_APPROPRIATE_MANAGER" => "Unable to find appropriate manager for this version of Panel. Plesk should be at least 8.0 version.", 18 | "ERROR_NO_TEMPLATE_TO_API_VERSION" => "Unable to locate template of command '@COMMAND@' for api version '@API_VERSION@'.", 19 | "ERROR_NO_METHOD_TO_API_VERSION" => "There is no method '@METHOD@' for api version '@API_VERSION@'.", 20 | "ERROR_IPV6_DOES_NOT_SUPPORTED" => "IPv6 addresses are not support in protocols below 1.6.3.2", 21 | "ERROR_NO_SHARED_IPV4" => "No shared IPv4", 22 | "ERROR_NO_SHARED_IPV6" => "No shared IPv6", 23 | "ERROR_NO_FREE_DEDICATED_IPTYPE" => "No free dedicated @TYPE@", 24 | "ERROR_CUSTOMER_WITH_EMAIL_NOT_FOUND_IN_PANEL" => "Customer with email '@EMAIL@' is not found in panel. Please contact your service provider.", 25 | "ERROR_CUSTOMER_WITH_EXTERNAL_ID_NOT_FOUND_IN_PANEL" => "Customer with external id '@EXTERNAL_ID@' is not found in panel. Please contact your service provider.", 26 | "ERROR_RESELLER_WITH_EXTERNAL_ID_NOT_FOUND_IN_PANEL" => "Reseller with external id '@EXTERNAL_ID@' is not found in panel. Please contact your service provider.", 27 | "ERROR_AUTHENTICATION_FAILED" => "Authentication failed. Please enter the correct credentials to Panel and try again.", 28 | "ERROR_AGENT_INITIALIZATION_FAILED" => "Panel agent initialization failed. Please check your panel settings and try again. If this problem remains unresolved, contact your service provider.", 29 | "ERROR_ACCOUNT_CREATE_COMMON_MESSAGE" => "Unable to create account on Panel side. Please check your account settings and try again. If this problem remains unresolved, contact your Panel administrator.", 30 | "ERROR_RESTRICTIONS_ACCOUNT_COUNT" => "You have reached the limit of allowed subscriptions per one account (@ACCOUNT_LIMIT@ subscription(s) allowed). To order a new subscription you should use another account.", 31 | ); 32 | -------------------------------------------------------------------------------- /lib/Plesk/Api.php: -------------------------------------------------------------------------------- 1 | _login = $login; 27 | $this->_password = $password; 28 | $this->_hostname = $hostname; 29 | $this->_port = $port; 30 | $this->_isSecure = $isSecure; 31 | 32 | $this->_templatesDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates/api'; 33 | } 34 | 35 | public function __call($name, $args) { 36 | $params = isset($args[0]) ? $args[0] : array(); 37 | return $this->request($name, $params); 38 | } 39 | 40 | protected function request($command, $params) 41 | { 42 | $translator = Plesk_Registry::getInstance()->translator; 43 | $url = ($this->_isSecure ? 'https' : 'http') . '://' . $this->_hostname . ':' . $this->_port . '/enterprise/control/agent.php'; 44 | $headers = array( 45 | 'HTTP_AUTH_LOGIN: ' . $this->_login, 46 | 'HTTP_AUTH_PASSWD: ' . $this->_password, 47 | 'Content-Type: text/xml' 48 | ); 49 | 50 | $template = $this->_templatesDir . DIRECTORY_SEPARATOR . Plesk_Registry::getInstance()->version . DIRECTORY_SEPARATOR . $command . '.tpl'; 51 | 52 | if (!file_exists($template)) { 53 | throw new Exception($translator->translate('ERROR_NO_TEMPLATE_TO_API_VERSION', array('COMMAND' => $command, 'API_VERSION' => Plesk_Registry::getInstance()->version))); 54 | } 55 | 56 | $escapedParams = array(); 57 | foreach ($params as $name => $value) { 58 | $escapedParams[$name] = is_array($value) ? array_map(array($this, '_escapeValue'), $value) : $this->_escapeValue($value); 59 | } 60 | 61 | extract($escapedParams); 62 | ob_start(); 63 | include $template; 64 | $data = '' . ob_get_clean() . ''; 65 | foreach (array_keys($escapedParams) as $name => $value) { 66 | unset($$name); 67 | } 68 | 69 | $curl = curl_init(); 70 | curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); 71 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 72 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); 73 | curl_setopt($curl, CURLOPT_URL, $url); 74 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 75 | curl_setopt($curl, CURLOPT_TIMEOUT, 300); 76 | curl_setopt($curl, CURLOPT_POSTFIELDS, $data); 77 | $response = curl_exec($curl); 78 | $errorCode = curl_errno($curl); 79 | $errorMessage = curl_error($curl); 80 | curl_close($curl); 81 | 82 | logModuleCall('plesk', Plesk_Registry::getInstance()->actionName, $data, $response, $response); 83 | 84 | if ($errorCode) { 85 | throw new Exception('Curl error: [' . $errorCode . '] ' . $errorMessage . '.'); 86 | } 87 | 88 | $result = simplexml_load_string($response); 89 | 90 | if ($result === false) { 91 | /** 92 | * Server returned a non-parsable result. Report here so as not to throw a fatal error later. 93 | */ 94 | throw new Exception('Server response could not be processed.', self::ERROR_PARSING_XML); 95 | } 96 | 97 | if (isset($result->system) && self::STATUS_ERROR == (string)$result->system->status && self::ERROR_PARSING_XML == (int)$result->system->errcode) { 98 | throw new Exception((string)$result->system->errtext, (int)$result->system->errcode); 99 | } 100 | 101 | $statusResult = $result->xpath('//result'); 102 | if (1 == count($statusResult)) { 103 | $statusResult = reset($statusResult); 104 | if (Plesk_Api::STATUS_ERROR == (string)$statusResult->status) { 105 | switch ((int)$statusResult->errcode) { 106 | case Plesk_Api::ERROR_AUTHENTICATION_FAILED: 107 | $errorMessage = $translator->translate('ERROR_AUTHENTICATION_FAILED'); 108 | break; 109 | case Plesk_Api::ERROR_AGENT_INITIALIZATION_FAILED: 110 | $errorMessage = $translator->translate('ERROR_AGENT_INITIALIZATION_FAILED'); 111 | break; 112 | default: 113 | $errorMessage = (string)$statusResult->errtext; 114 | break; 115 | } 116 | 117 | throw new Exception( $errorMessage, (int)$statusResult->errcode); 118 | } 119 | } 120 | 121 | return $result; 122 | } 123 | 124 | private function _escapeValue($value) 125 | { 126 | return htmlspecialchars($value, ENT_COMPAT | ENT_HTML401, 'UTF-8'); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /lib/Plesk/Config.php: -------------------------------------------------------------------------------- 1 | 0, 36 | 'skip_addon_prefix' => false, 37 | ); 38 | } 39 | 40 | /** 41 | * Override settings with panel.ini values 42 | * 43 | * @return array 44 | */ 45 | private static function _getConfigFileSettings() 46 | { 47 | $filename = dirname(dirname(dirname(__FILE__))) . "/config.ini"; 48 | if (!file_exists($filename)) { 49 | return array(); 50 | } 51 | 52 | $result = parse_ini_file($filename, true); 53 | return !$result ? array() : $result; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/Plesk/Loader.php: -------------------------------------------------------------------------------- 1 | actionName = $caller['function']; 16 | Plesk_Registry::getInstance()->translator = new Plesk_Translate(); 17 | Plesk_Registry::getInstance()->api = new Plesk_Api($params['serverusername'], $params['serverpassword'], $params['serverhostname'], $port, $params['serversecure']); 18 | 19 | $manager = new Plesk_Manager_V1000(); 20 | foreach ($manager->getSupportedApiVersions() as $version) { 21 | $managerClassName = 'Plesk_Manager_V' . str_replace('.', '', $version); 22 | if (class_exists($managerClassName)) { 23 | Plesk_Registry::getInstance()->manager = new $managerClassName(); 24 | break; 25 | } 26 | } 27 | 28 | if (!isset(Plesk_Registry::getInstance()->manager)) { 29 | throw new Exception(Plesk_Registry::getInstance()->translator->translate('ERROR_NO_APPROPRIATE_MANAGER')); 30 | } 31 | } 32 | 33 | public static function autoload($className) { 34 | $filePath = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; 35 | if (file_exists($filePath)) { 36 | require_once $filePath; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/Plesk/Manager/Base.php: -------------------------------------------------------------------------------- 1 | translator->translate('ERROR_NO_TEMPLATE_TO_API_VERSION', array('METHOD' => $methodName, 'API_VERSION' => $this->getVersion()))); 14 | } 15 | 16 | // set appropriate api version 17 | $reflection = new ReflectionClass(get_class($this)); 18 | $declaringClassName = $reflection->getMethod($methodName)->getDeclaringClass()->name; 19 | $declaringClass = new $declaringClassName(); 20 | $version = $declaringClass->getVersion(); 21 | 22 | $currentApiVersion = isset(Plesk_Registry::getInstance()->version) ? Plesk_Registry::getInstance()->version : null; 23 | Plesk_Registry::getInstance()->version = $version; 24 | 25 | $result = call_user_func_array(array($this, $methodName), $args); 26 | 27 | Plesk_Registry::getInstance()->version = $currentApiVersion; 28 | 29 | return $result; 30 | } 31 | 32 | public function getVersion() 33 | { 34 | $className = get_class($this); 35 | return implode('.', str_split(substr($className, strrpos($className, 'V') + 1))); 36 | } 37 | 38 | public function createTableForAccountStorage() 39 | { 40 | if (Capsule::schema()->hasTable('mod_pleskaccounts')) { 41 | return; 42 | } 43 | 44 | Capsule::schema()->create( 45 | 'mod_pleskaccounts', 46 | function ($table) { 47 | $table->engine = 'MyISAM'; 48 | 49 | /** @var \Illuminate\Database\Schema\Blueprint $table */ 50 | $table->integer('userid'); 51 | $table->string('usertype', 20); 52 | $table->string('panelexternalid', 50); 53 | 54 | $table->primary(array('panelexternalid', 'usertype')); 55 | $table->index(array('userid', 'usertype')); 56 | } 57 | ); 58 | } 59 | 60 | protected function _checkErrors($result) 61 | { 62 | if (Plesk_Api::STATUS_OK == (string)$result->status) { 63 | return; 64 | } 65 | switch ((int)$result->errcode) { 66 | case Plesk_Api::ERROR_AUTHENTICATION_FAILED: 67 | $errorMessage = Plesk_Registry::getInstance()->translator->translate('ERROR_AUTHENTICATION_FAILED'); 68 | break; 69 | case Plesk_Api::ERROR_AGENT_INITIALIZATION_FAILED: 70 | $errorMessage = Plesk_Registry::getInstance()->translator->translate('ERROR_AGENT_INITIALIZATION_FAILED'); 71 | break; 72 | default: 73 | $errorMessage = (string)$result->errtext; 74 | break; 75 | } 76 | 77 | throw new Exception( $errorMessage, (int)$result->errcode); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/Plesk/Manager/V1000.php: -------------------------------------------------------------------------------- 1 | api->server_getProtos(); 13 | 14 | // return list of supported versions in reverse order 15 | $versions = array(); 16 | foreach ($result->server->get_protos->result->protos->proto as $proto) { 17 | $versions[] = (string)$proto; 18 | } 19 | rsort($versions); 20 | return $versions; 21 | } 22 | 23 | protected function _getSharedIpv4($params) 24 | { 25 | return $this->_getIp($params); 26 | } 27 | 28 | protected function _getSharedIpv6($params) 29 | { 30 | throw new Exception(Plesk_Registry::getInstance()->translator->translate('ERROR_IPV6_DOES_NOT_SUPPORTED')); 31 | } 32 | 33 | protected function _getFreeDedicatedIpv4() 34 | { 35 | return $this->_getFreeDedicatedIp(); 36 | } 37 | 38 | protected function _getFreeDedicatedIpv6() 39 | { 40 | throw new Exception(Plesk_Registry::getInstance()->translator->translate('ERROR_IPV6_DOES_NOT_SUPPORTED')); 41 | } 42 | 43 | protected function _setAccountPassword($params) 44 | { 45 | $requestParams = array( 46 | 'login' => $params['username'], 47 | 'accountPassword' => $params['password'], 48 | ); 49 | switch ($params['type']) { 50 | case Plesk_Object_Customer::TYPE_CLIENT: 51 | Plesk_Registry::getInstance()->api->customer_set_password($requestParams); 52 | break; 53 | case Plesk_Object_Customer::TYPE_RESELLER: 54 | Plesk_Registry::getInstance()->api->reseller_set_password($requestParams); 55 | break; 56 | } 57 | } 58 | 59 | protected function _getIp($params, $version = Plesk_Object_Ip::IPV4) 60 | { 61 | $ipList = $this->_getIpList(Plesk_Object_Ip::SHARED, $version); 62 | $ipAddress = reset($ipList); 63 | if (!$ipAddress) { 64 | if (Plesk_Object_Ip::IPV6 == $version && !$this->_isIpv6($params['serverip'])) { 65 | throw new Exception(Plesk_Registry::getInstance()->translator->translate('ERROR_NO_SHARED_IPV6')); 66 | } 67 | if (Plesk_Object_Ip::IPV4 == $version && $this->_isIpv6($params['serverip'])) { 68 | throw new Exception(Plesk_Registry::getInstance()->translator->translate('ERROR_NO_SHARED_IPV4')); 69 | } 70 | 71 | $ipAddress = $params['serverip']; 72 | } 73 | 74 | return $ipAddress; 75 | } 76 | 77 | protected function _setWebspaceStatus($params) 78 | { 79 | Plesk_Registry::getInstance()->api->webspace_set_status( 80 | array( 81 | 'status' => $params['status'], 82 | 'domain' => $params['domain'], 83 | ) 84 | ); 85 | } 86 | 87 | protected function _deleteWebspace($params) 88 | { 89 | Plesk_Registry::getInstance()->api->webspace_del( array('domain' => $params['domain']) ); 90 | $manager = new Plesk_Manager_V1000(); 91 | $ownerInfo = $manager->getAccountInfo($params); 92 | $webspaces = $this->_getWebspacesByOwnerId($ownerInfo['id']); 93 | if (!isset($webspaces->id)) { 94 | Plesk_Registry::getInstance()->api->customer_del( array('id' => $ownerInfo['id']) ); 95 | } 96 | } 97 | 98 | protected function _setWebspacePassword($params) 99 | { 100 | Plesk_Registry::getInstance()->api->webspace_set_password( 101 | array( 102 | 'domain' => $params['domain'], 103 | 'password' => $params['password'], 104 | ) 105 | ); 106 | } 107 | 108 | protected function _getClientAreaForm($params) 109 | { 110 | $domain = ($params["serverhostname"]) ? $params["serverhostname"] : $params["serverip"]; 111 | $port = ($params["serveraccesshash"]) ? $params["serveraccesshash"] : '8443'; 112 | $secure = ($params["serversecure"]) ? 'https' : 'http'; 113 | 114 | /** @var stdClass $hosting */ 115 | $hosting = Capsule::table('tblhosting') 116 | ->where('server', $params['serverid']) 117 | ->where('userid', $params['clientsdetails']['userid']) 118 | ->where('domainstatus', 'Active') 119 | ->first(); 120 | 121 | $code = ''; 122 | 123 | if ($hosting->username && $hosting->password) { 124 | $manager = new Plesk_Manager_V1000(); 125 | $ownerInfo = $manager->getAccountInfo($params); 126 | if (!isset($ownerInfo['login'])) { 127 | return ''; 128 | } 129 | $code = sprintf( 130 | '
' . 131 | '' . 132 | '' . 133 | '' . 134 | '
', 135 | $secure, 136 | Sanitize::encode($domain), 137 | Sanitize::encode($port), 138 | Sanitize::encode($ownerInfo['login']), 139 | Sanitize::encode(decrypt($hosting->password)), 140 | Plesk_Registry::getInstance()->translator->translate('BUTTON_CONTROL_PANEL') 141 | ); 142 | } 143 | 144 | return $code; 145 | } 146 | 147 | protected function _getFreeDedicatedIp($version = Plesk_Object_Ip::IPV4) 148 | { 149 | static $domains = null; 150 | $ipListUse = array(); 151 | $ipListFree = array(); 152 | $ipList = $this->_getIpList(Plesk_Object_Ip::DEDICATED, $version); 153 | if (is_null($domains)) { 154 | $domains = Plesk_Registry::getInstance()->api->webspaces_get(); 155 | } 156 | foreach($domains->xpath('//domain/get/result') as $item) { 157 | try { 158 | $this->_checkErrors($item); 159 | if (!empty($item->data->hosting->vrt_hst->ip_address)) { 160 | $ipListUse[] = (string)$item->data->hosting->vrt_hst->ip_address; 161 | } 162 | } catch (Exception $e) { 163 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 164 | throw $e; 165 | } 166 | } 167 | } 168 | foreach($ipList as $ip) { 169 | if (!in_array($ip, $ipListUse)) { 170 | $ipListFree[$ip] = $ip; 171 | } 172 | } 173 | 174 | $freeIp = reset($ipListFree); 175 | if (empty($freeIp)) { 176 | throw new Exception(Plesk_Registry::getInstance()->translator->translate('ERROR_NO_FREE_DEDICATED_IPTYPE', array('TYPE' => Plesk_Object_Ip::IPV6 == $version ? 'IPv6' : 'IPv4'))); 177 | } 178 | 179 | return $freeIp; 180 | } 181 | 182 | protected function _getIpList($type = Plesk_Object_Ip::SHARED, $version = null) 183 | { 184 | $ipList = array(); 185 | static $result = null; 186 | if (is_null($result)) { 187 | $result = Plesk_Registry::getInstance()->api->ip_get(); 188 | } 189 | foreach ($result->ip->get->result->addresses->ip as $item) { 190 | if ($type !== (string)$item->type) { 191 | continue; 192 | } 193 | $ip = (string)$item->ip_address; 194 | if (Plesk_Object_Ip::IPV6 == $version && !$this->_isIpv6($ip)) { 195 | continue; 196 | } 197 | if (Plesk_Object_Ip::IPV4 == $version && $this->_isIpv6($ip)) { 198 | continue; 199 | } 200 | $ipList[] = $ip; 201 | } 202 | 203 | return $ipList; 204 | } 205 | 206 | protected function _isIpv6($ip) 207 | { 208 | return (false === strpos($ip, '.')); 209 | } 210 | 211 | protected function _getCustomerExternalId($params) 212 | { 213 | return ''; 214 | } 215 | 216 | protected function _getAccountInfo($params, $panelExternalId = null) 217 | { 218 | $accountInfo = array(); 219 | 220 | /** @var stdClass $hosting */ 221 | $hosting = Capsule::table('tblhosting') 222 | ->where('server', $params['serverid']) 223 | ->where('userid', $params['clientsdetails']['userid']) 224 | ->first(); 225 | 226 | $login = is_null($hosting) ? '' : $hosting->username; 227 | 228 | try { 229 | $result = Plesk_Registry::getInstance()->api->customer_get_by_login(['login' => $login]); 230 | if (isset($result->client->get->result->id)){ 231 | $accountInfo['id'] = (int)$result->client->get->result->id; 232 | } 233 | 234 | if (isset($result->client->get->result->data->gen_info->login)) { 235 | $accountInfo['login'] = (string)$result->client->get->result->data->gen_info->login; 236 | } 237 | } catch (Exception $e) { 238 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 239 | throw $e; 240 | } 241 | } 242 | 243 | if (empty($accountInfo)) { 244 | throw new Exception( 245 | Plesk_Registry::getInstance()->translator->translate( 246 | 'ERROR_CUSTOMER_WITH_EMAIL_NOT_FOUND_IN_PANEL', 247 | array('EMAIL' => $params['clientsdetails']['email']) 248 | ), 249 | Plesk_Api::ERROR_OBJECT_NOT_FOUND 250 | ); 251 | } 252 | 253 | return $accountInfo; 254 | } 255 | 256 | protected function _addAccount($params) 257 | { 258 | $accountId = null; 259 | $result = Plesk_Registry::getInstance()->api->customer_add($this->_getAddAccountParams($params)); 260 | $accountId = (int)$result->client->add->result->id; 261 | return $accountId; 262 | } 263 | 264 | /** 265 | * @param array $params 266 | * @return array 267 | */ 268 | protected function _getAddAccountParams($params) 269 | { 270 | $result = array_merge( 271 | $params['clientsdetails'], 272 | array( 273 | 'username' => $params['username'], 274 | 'accountPassword' => $params['password'], 275 | 'status' => Plesk_Object_Customer::STATUS_ACTIVE 276 | ) 277 | ); 278 | return $result; 279 | } 280 | 281 | protected function _addIpToIpPool($accountId, $params) 282 | { 283 | Plesk_Registry::getInstance()->api->customer_ippool_add_ip( 284 | array( 285 | "clientId" => $accountId, 286 | "ipAddress" => $params['ipv4Address'] 287 | ) 288 | ); 289 | } 290 | 291 | protected function _addWebspace($params) 292 | { 293 | $this->_checkRestrictions($params); 294 | 295 | $requestParams = [ 296 | 'domain' => $params['domain'], 297 | 'ownerId' => $params['ownerId'], 298 | 'username' => $params['username'], 299 | 'password' => $params['password'], 300 | 'status' => Plesk_Object_Webspace::STATUS_ACTIVE, 301 | 'htype' => Plesk_Object_Webspace::TYPE_VRT_HST, 302 | 'planName' => $params['configoption1'], 303 | 'ipv4Address' => $params['ipv4Address'], 304 | 'ipv6Address' => $params['ipv6Address'], 305 | ]; 306 | Plesk_Registry::getInstance()->api->webspace_add($requestParams); 307 | } 308 | 309 | /** 310 | * @param $params 311 | * @return array ( => array ('diskusage' => value, 'disklimit' => value, 'bwusage' => value, 'bwlimit' => value)) 312 | * @throws Exception 313 | */ 314 | protected function _getWebspacesUsage($params) 315 | { 316 | $usage = array(); 317 | $webspaces = Plesk_Registry::getInstance()->api->domain_usage_get_by_name(array('domains' => $params['domains'])); 318 | foreach($webspaces->xpath('//domain/get/result') as $result) { 319 | try { 320 | $this->_checkErrors($result); 321 | $domainName = (string)$result->data->gen_info->name; 322 | $usage[$domainName]['diskusage'] = (float)$result->data->gen_info->real_size; 323 | $usage[$domainName]['bwusage'] = (float)$result->data->stat->traffic; 324 | foreach($result->data->limits->children() as $limit) { 325 | $name = (string)$limit->getName(); 326 | switch ($name) { 327 | case 'disk_space': 328 | $usage[$domainName]['disklimit'] = (float)$limit; 329 | break; 330 | case 'max_traffic': 331 | $usage[$domainName]['bwlimit'] = (float)$limit; 332 | break; 333 | default: 334 | break; 335 | } 336 | } 337 | 338 | //Data saved in megabytes, not in a bytes 339 | foreach($usage[$domainName] as $param => $value) { 340 | $usage[$domainName][$param] = $usage[$domainName][$param] / (1024 * 1024); 341 | } 342 | } catch (Exception $e) { 343 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 344 | throw $e; 345 | } 346 | } 347 | } 348 | return $usage; 349 | } 350 | 351 | protected function _getWebspacesByOwnerId($ownerId) 352 | { 353 | $result = Plesk_Registry::getInstance()->api->webspaces_get_by_owner_id( array('ownerId' => $ownerId) ); 354 | return $result->domain->get->result; 355 | } 356 | 357 | /** 358 | * @param $params 359 | * 360 | * @return array 361 | */ 362 | protected function _getIps($params) 363 | { 364 | $params['addAddonDedicatedIPv4'] = false; 365 | $params['addAddonDedicatedIPv6'] = false; 366 | $ip = array( 367 | 'ipv4Address' => '', 368 | 'ipv6Address' => '' 369 | ); 370 | if (!empty($params['configoptions'])) { 371 | foreach($params['configoptions'] as $addonTitle => $value) { 372 | if ("0" == $value) { 373 | continue; 374 | } 375 | if (Plesk_Object_Ip::ADDON_NAME_IPV6 == $addonTitle) { 376 | $params['addAddonDedicatedIPv6'] = true; 377 | continue; 378 | } 379 | if (Plesk_Object_Ip::ADDON_NAME_IPV4 == $addonTitle) { 380 | $params['addAddonDedicatedIPv4'] = true; 381 | continue; 382 | } 383 | } 384 | } 385 | 386 | switch($params["configoption3"]) { 387 | case 'IPv4 shared; IPv6 none': 388 | $ip['ipv4Address'] = ($params['addAddonDedicatedIPv4']) 389 | ? Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv4() 390 | : Plesk_Registry::getInstance()->manager->getSharedIpv4($params); 391 | break; 392 | case 'IPv4 none; IPv6 shared': 393 | $ip['ipv6Address'] = ($params['addAddonDedicatedIPv6']) 394 | ? Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv6() 395 | : Plesk_Registry::getInstance()->manager->getSharedIpv6($params); 396 | break; 397 | case 'IPv4 shared; IPv6 shared': 398 | $ip['ipv4Address'] = ($params['addAddonDedicatedIPv4']) 399 | ? Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv4() 400 | : Plesk_Registry::getInstance()->manager->getSharedIpv4($params); 401 | $ip['ipv6Address'] = ($params['addAddonDedicatedIPv6']) 402 | ? Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv6() 403 | : Plesk_Registry::getInstance()->manager->getSharedIpv6($params); 404 | break; 405 | case 'IPv4 dedicated; IPv6 none': 406 | $ip['ipv4Address'] = Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv4(); 407 | break; 408 | case 'IPv4 none; IPv6 dedicated': 409 | $ip['ipv6Address'] = Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv6(); 410 | break; 411 | case 'IPv4 shared; IPv6 dedicated': 412 | $ip['ipv4Address'] = ($params['addAddonDedicatedIPv4']) 413 | ? Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv4() 414 | : Plesk_Registry::getInstance()->manager->getSharedIpv4($params); 415 | $ip['ipv6Address'] = Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv6(); 416 | break; 417 | case 'IPv4 dedicated; IPv6 shared': 418 | $ip['ipv4Address'] = Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv4(); 419 | $ip['ipv6Address'] = ($params['addAddonDedicatedIPv6']) 420 | ? Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv6() 421 | : Plesk_Registry::getInstance()->manager->getSharedIpv6($params); 422 | break; 423 | case 'IPv4 dedicated; IPv6 dedicated': 424 | $ip['ipv4Address'] = Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv4(); 425 | $ip['ipv6Address'] = Plesk_Registry::getInstance()->manager->getFreeDedicatedIpv6(); 426 | break; 427 | default: 428 | $ip['ipv4Address'] = $params['serverip']; 429 | break; 430 | } 431 | 432 | return $ip; 433 | } 434 | 435 | protected function _changeSubscriptionIp($params) 436 | { 437 | $webspace = Plesk_Registry::getInstance()->api->webspace_get_by_name(array('domain' => $params['domain'])); 438 | $ipDedicatedList = $this->_getIpList(Plesk_Object_Ip::DEDICATED); 439 | if (empty($ipDedicatedList)) { 440 | return; 441 | } 442 | $oldIp[Plesk_Object_Ip::IPV4] = (string)$webspace->data->hosting->vrt_hst->ip_address; 443 | 444 | $ipv4Address = isset($oldIp[Plesk_Object_Ip::IPV4]) ? $oldIp[Plesk_Object_Ip::IPV4] : ''; 445 | if ($params["configoption3"] == 'IPv4 none; IPv6 shared' || $params["configoption3"] == 'IPv4 none; IPv6 dedicated') { 446 | $ipv4Address = ''; 447 | } 448 | 449 | if (!empty($params['ipv4Address'])) { 450 | if (isset($oldIp[Plesk_Object_Ip::IPV4]) && ($oldIp[Plesk_Object_Ip::IPV4] != $params['ipv4Address']) && 451 | (!in_array($oldIp[Plesk_Object_Ip::IPV4], $ipDedicatedList) || !in_array($params['ipv4Address'], $ipDedicatedList))) { 452 | $ipv4Address = $params['ipv4Address']; 453 | } elseif (!isset($oldIp[Plesk_Object_Ip::IPV4])) { 454 | $ipv4Address = $params['ipv4Address']; 455 | } 456 | } 457 | 458 | if (!empty($ipv4Address)) { 459 | Plesk_Registry::getInstance()->api->webspace_set_ip( 460 | array( 461 | 'domain' => $params['domain'], 462 | 'ipv4Address' => $ipv4Address, 463 | ) 464 | ); 465 | } 466 | } 467 | 468 | /** 469 | * @param array $params 470 | * @throws Exception 471 | */ 472 | protected function _checkRestrictions($params) 473 | { 474 | $accountLimit = (int)Plesk_Config::get()->account_limit; 475 | if (0 >= $accountLimit) { 476 | return; 477 | } 478 | 479 | $accountCount = Plesk_Utils::getAccountsCount($params['userid']); 480 | if ($accountLimit < $accountCount) { 481 | throw new Exception( 482 | Plesk_Registry::getInstance()->translator->translate( 483 | 'ERROR_RESTRICTIONS_ACCOUNT_COUNT', 484 | [ 485 | 'ACCOUNT_LIMIT' => $accountLimit, 486 | ] 487 | ) 488 | ); 489 | } 490 | } 491 | 492 | /** 493 | * @return array 494 | */ 495 | protected function _getServicePlans() 496 | { 497 | return array(); 498 | } 499 | 500 | } 501 | -------------------------------------------------------------------------------- /lib/Plesk/Manager/V1630.php: -------------------------------------------------------------------------------- 1 | api->resellerPlan_get(); 11 | $resellerPlans = array(); 12 | foreach ($result->xpath('//reseller-plan/get/result') as $result) { 13 | $resellerPlans[] = (string)$result->name; 14 | } 15 | return $resellerPlans; 16 | } 17 | 18 | protected function _getAccountInfo($params, $panelExternalId = null) 19 | { 20 | $accountInfo = array(); 21 | if (is_null($panelExternalId)) { 22 | 23 | $this->createTableForAccountStorage(); 24 | 25 | /** @var stdClass $account */ 26 | $account = Capsule::table('mod_pleskaccounts') 27 | ->where('userid', $params['clientsdetails']['userid']) 28 | ->where('usertype', $params['type']) 29 | ->first(); 30 | 31 | $panelExternalId = is_null($account) ? '' : $account->panelexternalid; 32 | } 33 | 34 | if ('' != $panelExternalId) { 35 | 36 | $requestParams = array( 'externalId' => $panelExternalId ); 37 | switch ($params['type']) { 38 | 39 | case Plesk_Object_Customer::TYPE_CLIENT: 40 | try { 41 | $result = Plesk_Registry::getInstance()->api->customer_get_by_external_id($requestParams); 42 | if (isset($result->customer->get->result->id)) { 43 | $accountInfo['id'] = (int)$result->customer->get->result->id; 44 | } 45 | if (isset($result->customer->get->result->data->gen_info->login)) { 46 | $accountInfo['login'] = (string)$result->customer->get->result->data->gen_info->login; 47 | } 48 | } catch (Exception $e) { 49 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 50 | throw $e; 51 | } 52 | throw new Exception( 53 | Plesk_Registry::getInstance()->translator->translate( 54 | 'ERROR_CUSTOMER_WITH_EXTERNAL_ID_NOT_FOUND_IN_PANEL', 55 | array( 56 | 'EXTERNAL_ID' => $panelExternalId, 57 | ) 58 | ) 59 | , Plesk_Api::ERROR_OBJECT_NOT_FOUND 60 | ); 61 | } 62 | break; 63 | 64 | case Plesk_Object_Customer::TYPE_RESELLER: 65 | try { 66 | $result = Plesk_Registry::getInstance()->api->reseller_get_by_external_id($requestParams); 67 | if (isset($result->reseller->get->result->id)) { 68 | $accountInfo['id'] = (int)$result->reseller->get->result->id; 69 | } 70 | if (isset($result->reseller->get->result->data->{'gen-info'}->login)) { 71 | $accountInfo['login'] = (string)$result->reseller->get->result->data->{'gen-info'}->login; 72 | } 73 | } catch (Exception $e) { 74 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 75 | throw $e; 76 | } 77 | throw new Exception( 78 | Plesk_Registry::getInstance()->translator->translate( 79 | 'ERROR_RESELLER_WITH_EXTERNAL_ID_NOT_FOUND_IN_PANEL', 80 | array( 81 | 'EXTERNAL_ID' => $panelExternalId, 82 | ) 83 | ) 84 | , Plesk_Api::ERROR_OBJECT_NOT_FOUND 85 | ); 86 | } 87 | break; 88 | } 89 | 90 | return $accountInfo; 91 | } 92 | 93 | $accountsArray = []; 94 | 95 | $productsOnServer = Capsule::table('tblhosting') 96 | ->where('server', $params['serverid']) 97 | ->where('userid', $params['clientsdetails']['userid']) 98 | ->get(); 99 | 100 | if ($productsOnServer) { 101 | foreach ($productsOnServer as $product) { 102 | $accountsArray[] = $product->username; 103 | } 104 | } 105 | 106 | 107 | $addonsOnServer = $addons = Addon::with( 108 | [ 109 | 'customFieldValues', 110 | 'customFieldValues.customField' => function ($query) { 111 | $query->where('fieldname', '=', 'username'); 112 | }, 113 | ]) 114 | ->where('server', $params['serverid']) 115 | ->where('userid', $params['clientsdetails']['userid']) 116 | ->get(); 117 | 118 | if ($addonsOnServer) { 119 | foreach ($addonsOnServer as $addon) { 120 | $pleskUsername = $addon->customFieldValue['username']; 121 | if ($pleskUsername) { 122 | $accountsArray[] = $pleskUsername; 123 | } 124 | } 125 | } 126 | 127 | 128 | /** @var stdClass $hosting */ 129 | foreach ($accountsArray as $username) { 130 | $requestParams = array('login' => $username); 131 | switch ($params['type']) { 132 | case Plesk_Object_Customer::TYPE_CLIENT: 133 | 134 | try { 135 | $result = Plesk_Registry::getInstance()->api->customer_get_by_login($requestParams); 136 | if (isset($result->customer->get->result->id)) { 137 | $accountInfo['id'] = (int)$result->customer->get->result->id; 138 | } 139 | if (isset($result->customer->get->result->data->gen_info->login)) { 140 | $accountInfo['login'] = (string)$result->customer->get->result->data->gen_info->login; 141 | } 142 | } catch (Exception $e) { 143 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 144 | throw $e; 145 | } 146 | } 147 | break; 148 | 149 | case Plesk_Object_Customer::TYPE_RESELLER: 150 | try { 151 | $result = Plesk_Registry::getInstance()->api->reseller_get_by_login($requestParams); 152 | if (isset($result->reseller->get->result->id)) { 153 | $accountInfo['id'] = (int)$result->reseller->get->result->id; 154 | } 155 | if (isset($result->reseller->get->result->data->{'gen-info'}->login)) { 156 | $accountInfo['login'] = (string)$result->reseller->get->result->data->{'gen-info'}->login; 157 | } 158 | } catch (Exception $e) { 159 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 160 | throw $e; 161 | } 162 | } 163 | break; 164 | } 165 | 166 | if (!empty($accountInfo)) { 167 | break; 168 | } 169 | } 170 | 171 | if (empty($accountInfo)) { 172 | throw new Exception( 173 | Plesk_Registry::getInstance()->translator->translate( 174 | 'ERROR_CUSTOMER_WITH_EMAIL_NOT_FOUND_IN_PANEL', 175 | array('EMAIL' => $params['clientsdetails']['email']) 176 | ), 177 | Plesk_Api::ERROR_OBJECT_NOT_FOUND 178 | ); 179 | } 180 | 181 | return $accountInfo; 182 | } 183 | 184 | /** 185 | * @param array $params 186 | * @return array 187 | */ 188 | protected function _getAddAccountParams($params) 189 | { 190 | $result = parent::_getAddAccountParams($params); 191 | $result['externalId'] = $this->_getCustomerExternalId($params); 192 | return $result; 193 | } 194 | 195 | protected function _addAccount($params) 196 | { 197 | $accountId = null; 198 | $requestParams = $this->_getAddAccountParams($params); 199 | switch ($params['type']) { 200 | case Plesk_Object_Customer::TYPE_CLIENT: 201 | $result = Plesk_Registry::getInstance()->api->customer_add($requestParams); 202 | $accountId = (int)$result->customer->add->result->id; 203 | break; 204 | case Plesk_Object_Customer::TYPE_RESELLER: 205 | $requestParams = array_merge($requestParams, array( 'planName' => $params['configoption2'])); 206 | $result = Plesk_Registry::getInstance()->api->reseller_add($requestParams); 207 | $accountId = (int)$result->reseller->add->result->id; 208 | break; 209 | } 210 | 211 | return $accountId; 212 | } 213 | 214 | protected function _addWebspace($params) 215 | { 216 | $this->_checkRestrictions($params); 217 | 218 | $requestParams = [ 219 | 'domain' => $params['domain'], 220 | 'ownerId' => $params['ownerId'], 221 | 'username' => $params['username'], 222 | 'password' => $params['password'], 223 | 'status' => Plesk_Object_Webspace::STATUS_ACTIVE, 224 | 'htype' => Plesk_Object_Webspace::TYPE_VRT_HST, 225 | 'planName' => $params['configoption1'], 226 | 'ipv4Address' => $params['ipv4Address'], 227 | 'ipv6Address' => $params['ipv6Address'], 228 | ]; 229 | Plesk_Registry::getInstance()->api->webspace_add($requestParams); 230 | } 231 | 232 | protected function _setResellerStatus($params) 233 | { 234 | $accountInfo = $this->_getAccountInfo($params); 235 | if (!isset($accountInfo['id'])) { 236 | return; 237 | } 238 | Plesk_Registry::getInstance()->api->reseller_set_status( 239 | array( 240 | 'status' => $params['status'], 241 | 'id' => $accountInfo['id'], 242 | ) 243 | ); 244 | } 245 | 246 | protected function _deleteReseller($params) 247 | { 248 | $accountInfo = $this->_getAccountInfo($params); 249 | if (!isset($accountInfo['id'])) { 250 | return; 251 | } 252 | Plesk_Registry::getInstance()->api->reseller_del(array('id' => $accountInfo['id'])); 253 | } 254 | 255 | protected function _setAccountPassword($params) 256 | { 257 | $accountInfo = $this->_getAccountInfo($params); 258 | if (!isset($accountInfo['id'])) { 259 | return; 260 | } 261 | 262 | if (isset($accountInfo['login']) && $accountInfo['login'] != $params["username"]) { 263 | return; 264 | } 265 | $requestParams = array( 266 | 'id' => $accountInfo['id'], 267 | 'accountPassword' => $params['password'], 268 | ); 269 | 270 | switch ($params['type']) { 271 | case Plesk_Object_Customer::TYPE_CLIENT: 272 | Plesk_Registry::getInstance()->api->customer_set_password($requestParams); 273 | break; 274 | case Plesk_Object_Customer::TYPE_RESELLER: 275 | Plesk_Registry::getInstance()->api->reseller_set_password($requestParams); 276 | break; 277 | } 278 | } 279 | 280 | protected function _deleteWebspace($params) 281 | { 282 | Plesk_Registry::getInstance()->api->webspace_del( array('domain' => $params['domain']) ); 283 | $accountInfo = $this->_getAccountInfo($params); 284 | if (!isset($accountInfo['id'])) { 285 | return; 286 | } 287 | $webspaces = $this->_getWebspacesByOwnerId($accountInfo['id']); 288 | if (!isset($webspaces->id)) { 289 | Plesk_Registry::getInstance()->api->customer_del( array('id' => $accountInfo['id']) ); 290 | } 291 | } 292 | 293 | protected function _switchSubscription($params) 294 | { 295 | switch ($params['type']) { 296 | case Plesk_Object_Customer::TYPE_CLIENT: 297 | $result = Plesk_Registry::getInstance()->api->service_plan_get_by_name(array('name' => $params['configoption1'])); 298 | $servicePlanResult = reset($result->xpath('//service-plan/get/result')); 299 | Plesk_Registry::getInstance()->api->switch_subscription( 300 | array( 301 | 'domain' => $params['domain'], 302 | 'planGuid' => (string)$servicePlanResult->guid, 303 | ) 304 | ); 305 | break; 306 | case Plesk_Object_Customer::TYPE_RESELLER: 307 | $result = Plesk_Registry::getInstance()->api->reseller_plan_get_by_name(array('name' => $params['configoption2'])); 308 | $resellerPlanResult = reset($result->xpath('//reseller-plan/get/result')); 309 | $accountInfo = $this->_getAccountInfo($params); 310 | if (!isset($accountInfo['id'])) { 311 | return; 312 | } 313 | Plesk_Registry::getInstance()->api->switch_reseller_plan( 314 | array( 315 | 'id' => $accountInfo['id'], 316 | 'planGuid' => (string)$resellerPlanResult->guid, 317 | ) 318 | ); 319 | break; 320 | } 321 | } 322 | 323 | 324 | protected function _processAddons($params) 325 | { 326 | $result = Plesk_Registry::getInstance()->api->webspace_subscriptions_get_by_name(array('domain' => $params['domain'])); 327 | $planGuids = array(); 328 | foreach($result->xpath('//webspace/get/result/data/subscriptions/subscription/plan/plan-guid') as $guid) { 329 | $planGuids[] = (string)$guid; 330 | } 331 | $webspaceId = (int)$result->webspace->get->result->id; 332 | $exludedPlanGuids = array(); 333 | 334 | $servicePlan = Plesk_Registry::getInstance()->api->service_plan_get_by_guid(array('planGuids' => $planGuids)); 335 | foreach($servicePlan->xpath('//service-plan/get/result') as $result) { 336 | try { 337 | $this->_checkErrors($result); 338 | $exludedPlanGuids[] = (string)$result->guid; 339 | } catch (Exception $e) { 340 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 341 | throw $e; 342 | } 343 | } 344 | } 345 | 346 | $addons = array(); 347 | $addonGuids = array_diff($planGuids, $exludedPlanGuids); 348 | if (!empty($addonGuids)) { 349 | $addon = Plesk_Registry::getInstance()->api->service_plan_addon_get_by_guid(array('addonGuids' => $addonGuids)); 350 | foreach($addon->xpath('//service-plan-addon/get/result') as $result) { 351 | try { 352 | $this->_checkErrors($result); 353 | $addons[(string)$result->guid] = (string)$result->name; 354 | } catch (Exception $e) { 355 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 356 | throw $e; 357 | } 358 | } 359 | } 360 | } 361 | 362 | $addonsToRemove = array(); 363 | $addonsFromRequest = array(); 364 | $skipAddonPrefix = (bool)Plesk_Config::get()->skip_addon_prefix; 365 | foreach($params['configoptions'] as $addonTitle => $value) { 366 | // if value = 1 then add-on has question (yes/no) type and should be process a little another way. if 0 - we should not include this add-on to processing. 367 | if ("0" == $value) { 368 | continue; 369 | } 370 | 371 | $addonTitleHasPrefix = 0 === strpos($addonTitle, Plesk_Object_Addon::ADDON_PREFIX); 372 | if ($skipAddonPrefix) { 373 | $pleskAddonTitle = $addonTitleHasPrefix ? $this->sanitizeAddonName($addonTitle) : $addonTitle; 374 | } else { 375 | if (!$addonTitleHasPrefix) { 376 | continue; 377 | } 378 | $pleskAddonTitle = $this->sanitizeAddonName($addonTitle); 379 | } 380 | 381 | $addonsFromRequest[] = ("1" == $value) ? $pleskAddonTitle : $value; 382 | } 383 | foreach($addons as $guid => $addonName) { 384 | if (!in_array($addonName, $addonsFromRequest)) { 385 | $addonsToRemove[$guid] = $addonName; 386 | } 387 | } 388 | 389 | $addonsToAdd = array_diff($addonsFromRequest, array_values($addons)); 390 | foreach($addonsToRemove as $guid => $addon) { 391 | Plesk_Registry::getInstance()->api->webspace_remove_subscription( 392 | array( 393 | 'planGuid' => $guid, 394 | 'id' => $webspaceId, 395 | ) 396 | ); 397 | } 398 | foreach($addonsToAdd as $addonName) { 399 | $addon = Plesk_Registry::getInstance()->api->service_plan_addon_get_by_name(array('name' => $addonName)); 400 | foreach($addon->xpath('//service-plan-addon/get/result/guid') as $guid) { 401 | Plesk_Registry::getInstance()->api->webspace_add_subscription( 402 | array( 403 | 'planGuid' => (string)$guid, 404 | 'id' => $webspaceId, 405 | ) 406 | ); 407 | } 408 | 409 | } 410 | } 411 | 412 | /** 413 | * @param string $addonTitle 414 | * @return string 415 | */ 416 | protected function sanitizeAddonName($addonTitle) 417 | { 418 | return substr_replace($addonTitle, '', 0, strlen(Plesk_Object_Addon::ADDON_PREFIX)); 419 | } 420 | 421 | /** 422 | * @param $params 423 | * @return array ( => array ('diskusage' => value, 'disklimit' => value, 'bwusage' => value, 'bwlimit' => value)) 424 | * @throws Exception 425 | */ 426 | protected function _getWebspacesUsage($params) 427 | { 428 | $usage = array(); 429 | $data = Plesk_Registry::getInstance()->api->webspace_usage_get_by_name(array('domains' => $params['domains'])); 430 | foreach($data->xpath('//webspace/get/result') as $result) { 431 | try { 432 | $this->_checkErrors($result); 433 | $domainName = (string)$result->data->gen_info->name; 434 | $usage[$domainName]['diskusage'] = (float)$result->data->gen_info->real_size; 435 | $usage[$domainName]['bwusage'] = (float)$result->data->stat->traffic; 436 | $usage[$domainName] = array_merge($usage[$domainName], $this->_getLimits($result->data->limits)); 437 | } catch (Exception $e) { 438 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 439 | throw $e; 440 | } 441 | } 442 | } 443 | // Calculate traffic for additional domains 444 | foreach($data->xpath('//site/get/result') as $result) { 445 | try { 446 | $parentDomainName = (string)reset($result->xpath('filter-id')); 447 | $usage[$parentDomainName]['bwusage'] += (float)$result->data->stat->traffic; 448 | } catch (Exception $e) { 449 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 450 | throw $e; 451 | } 452 | } 453 | } 454 | 455 | //Data saved in megabytes, not in a bytes 456 | foreach($usage as $domainName => $domainUsage) { 457 | foreach($domainUsage as $param => $value) { 458 | $usage[$domainName][$param] = $usage[$domainName][$param] / (1024 * 1024); 459 | } 460 | } 461 | return $usage; 462 | } 463 | 464 | /** 465 | * @param $params 466 | * @return array ( => array ('diskusage' => value, 'disklimit' => value, 'bwusage' => value, 'bwlimit' => value)) 467 | * @throws Exception 468 | */ 469 | protected function _getResellersUsage($params) 470 | { 471 | $usage = array(); 472 | $data = Plesk_Registry::getInstance()->api->reseller_get_usage_by_login(array('logins' => $params['usernames'])); 473 | foreach($data->xpath('//reseller/get/result') as $result) { 474 | try { 475 | $this->_checkErrors($result); 476 | $login = (string)$result->data->{'gen-info'}->login; 477 | $usage[$login]['diskusage'] = (float)$result->data->stat->{'disk-space'}; 478 | $usage[$login]['bwusage'] = (float)$result->data->stat->traffic; 479 | $usage[$login] = array_merge($usage[$login], $this->_getLimits($result->data->limits)); 480 | } catch (Exception $e) { 481 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 482 | throw $e; 483 | } 484 | } 485 | } 486 | 487 | //Data saved in megabytes, not in a bytes 488 | foreach($usage as $login => $loginUsage) { 489 | foreach($loginUsage as $param => $value) { 490 | $usage[$login][$param] = $usage[$login][$param] / (1024 * 1024); 491 | } 492 | } 493 | return $usage; 494 | } 495 | 496 | protected function _addIpToIpPool($accountId, $params) {} 497 | 498 | protected function _getWebspacesByOwnerId($ownerId) 499 | { 500 | $result = Plesk_Registry::getInstance()->api->webspaces_get_by_owner_id( array('ownerId' => $ownerId) ); 501 | return $result->webspace->get->result; 502 | } 503 | 504 | protected function _getCustomerExternalId($params) 505 | { 506 | return Plesk_Object_Customer::getCustomerExternalId($params); 507 | } 508 | 509 | protected function _changeSubscriptionIp($params) 510 | { 511 | $webspace = Plesk_Registry::getInstance()->api->webspace_get_by_name(array('domain' => $params['domain'])); 512 | $ipDedicatedList = $this->_getIpList(Plesk_Object_Ip::DEDICATED); 513 | if (empty($ipDedicatedList)) { 514 | return; 515 | } 516 | $oldIp[Plesk_Object_Ip::IPV4] = (string)$webspace->webspace->get->result->data->hosting->vrt_hst->ip_address; 517 | 518 | $ipv4Address = isset($oldIp[Plesk_Object_Ip::IPV4]) ? $oldIp[Plesk_Object_Ip::IPV4] : ''; 519 | if ($params["configoption3"] == 'IPv4 none; IPv6 shared' || $params["configoption3"] == 'IPv4 none; IPv6 dedicated') { 520 | $ipv4Address = ''; 521 | } 522 | 523 | if (!empty($params['ipv4Address'])) { 524 | if (isset($oldIp[Plesk_Object_Ip::IPV4]) && ($oldIp[Plesk_Object_Ip::IPV4] != $params['ipv4Address']) && 525 | (!in_array($oldIp[Plesk_Object_Ip::IPV4], $ipDedicatedList) || !in_array($params['ipv4Address'], $ipDedicatedList))) { 526 | $ipv4Address = $params['ipv4Address']; 527 | } elseif (!isset($oldIp[Plesk_Object_Ip::IPV4])) { 528 | $ipv4Address = $params['ipv4Address']; 529 | } 530 | } 531 | 532 | if (!empty($ipv4Address)) { 533 | Plesk_Registry::getInstance()->api->webspace_set_ip( 534 | array( 535 | 'domain' => $params['domain'], 536 | 'ipv4Address' => $ipv4Address, 537 | ) 538 | ); 539 | } 540 | } 541 | 542 | protected function _getLimits(SimpleXMLElement $limits) 543 | { 544 | $result = array(); 545 | foreach($limits->limit as $limit) { 546 | $name = (string)$limit->name; 547 | switch ($name) { 548 | case 'disk_space': 549 | $result['disklimit'] = (float)$limit->value; 550 | break; 551 | case 'max_traffic': 552 | $result['bwlimit'] = (float)$limit->value; 553 | break; 554 | default: 555 | break; 556 | } 557 | } 558 | return $result; 559 | } 560 | 561 | protected function _getServicePlans() 562 | { 563 | $result = Plesk_Registry::getInstance()->api->service_plan_get(); 564 | $plans = array(); 565 | foreach ($result->xpath('//service-plan/get/result') as $plan) { 566 | $plans[] = (string) $plan->name; 567 | } 568 | return $plans; 569 | } 570 | 571 | protected function _generateCSR($params) 572 | { 573 | $accountInfo = $this->_getAccountInfo($params); 574 | if (!isset($accountInfo['id'])) { 575 | return ''; 576 | } 577 | 578 | if (isset($accountInfo['login']) && $accountInfo['login'] != $params["username"]) { 579 | return ''; 580 | } 581 | return Plesk_Registry::getInstance()->api->certificate_generate($params['certificateInfo']); 582 | } 583 | 584 | protected function _installSsl($params) 585 | { 586 | $accountInfo = $this->_getAccountInfo($params); 587 | if (!isset($accountInfo['id'])) { 588 | return ''; 589 | } 590 | 591 | if (isset($accountInfo['login']) && $accountInfo['login'] != $params["username"]) { 592 | return ''; 593 | } 594 | return Plesk_Registry::getInstance()->api->certificate_install($params); 595 | } 596 | 597 | protected function _getMxRecords($params) 598 | { 599 | $accountInfo = $this->_getAccountInfo($params); 600 | if (!isset($accountInfo['id'])) { 601 | return ''; 602 | } 603 | if (isset($accountInfo['login']) && $accountInfo['login'] != $params["username"]) { 604 | return ''; 605 | } 606 | $webSpace = Plesk_Registry::getInstance() 607 | ->api 608 | ->webspace_get_by_name(['domain' => $params['domain'],]); 609 | 610 | $siteId = (string) $webSpace->webspace->get->result->id; 611 | 612 | $records = Plesk_Registry::getInstance()->api->dns_record_retrieve(['siteId' => (int) $siteId,]); 613 | $mxRecords = []; 614 | foreach ($records->dns->get_rec->result as $dnsRecord) { 615 | if (strtolower($dnsRecord->data->type->__toString()) !== 'mx') { 616 | continue; 617 | } 618 | $mxData = (array) $dnsRecord->data; 619 | $mxRecords[] = [ 620 | 'id' => (int) $dnsRecord->id, 621 | 'mx' => $mxData['value'], 622 | 'priority' => $mxData['opt'], 623 | ]; 624 | } 625 | return ['mxRecords' => $mxRecords,]; 626 | } 627 | 628 | protected function _deleteMxRecords($params) 629 | { 630 | $accountInfo = $this->_getAccountInfo($params); 631 | if (!isset($accountInfo['id'])) { 632 | return; 633 | } 634 | if (isset($accountInfo['login']) && $accountInfo['login'] != $params["username"]) { 635 | return; 636 | } 637 | $dnsToRemove = []; 638 | foreach ($params['mxRecords'] as $record) { 639 | $dnsToRemove[] = $record['id']; 640 | } 641 | Plesk_Registry::getInstance()->api->dns_record_delete(['dnsRecords' => $dnsToRemove,]); 642 | } 643 | 644 | protected function _addMxRecords($params) 645 | { 646 | $accountInfo = $this->_getAccountInfo($params); 647 | if (!isset($accountInfo['id'])) { 648 | return; 649 | } 650 | if (isset($accountInfo['login']) && $accountInfo['login'] != $params["username"]) { 651 | return; 652 | } 653 | $webSpace = Plesk_Registry::getInstance() 654 | ->api 655 | ->webspace_get_by_name(['domain' => $params['domain'],]); 656 | 657 | $siteId = (string) $webSpace->webspace->get->result->id; 658 | 659 | $params['pleskSiteId'] = $siteId; 660 | Plesk_Registry::getInstance()->api->mx_record_create($params); 661 | } 662 | } 663 | -------------------------------------------------------------------------------- /lib/Plesk/Manager/V1632.php: -------------------------------------------------------------------------------- 1 | _getIp($params); 19 | } 20 | 21 | protected function _getSharedIpv6($params) 22 | { 23 | return $this->_getIp($params, Plesk_Object_Ip::IPV6); 24 | } 25 | 26 | protected function _getFreeDedicatedIpv4() 27 | { 28 | return $this->_getFreeDedicatedIp(); 29 | } 30 | 31 | protected function _getFreeDedicatedIpv6() 32 | { 33 | return $this->_getFreeDedicatedIp(Plesk_Object_Ip::IPV6); 34 | } 35 | 36 | protected function _getIpList($type = Plesk_Object_Ip::SHARED, $version = null) 37 | { 38 | $ipList = array(); 39 | static $result = null; 40 | if (is_null($result)) { 41 | $result = Plesk_Registry::getInstance()->api->ip_get(); 42 | } 43 | foreach ($result->ip->get->result->addresses->ip_info as $item) { 44 | if ($type !== (string)$item->type) { 45 | continue; 46 | } 47 | $ip = (string)$item->ip_address; 48 | if (Plesk_Object_Ip::IPV6 == $version && !$this->_isIpv6($ip)) { 49 | continue; 50 | } 51 | if (Plesk_Object_Ip::IPV4 == $version && $this->_isIpv6($ip)) { 52 | continue; 53 | } 54 | $ipList[] = $ip; 55 | } 56 | 57 | return $ipList; 58 | } 59 | 60 | protected function _getFreeDedicatedIp($version = Plesk_Object_Ip::IPV4) 61 | { 62 | static $domains = null; 63 | $ipListUse = array(); 64 | $ipListFree = array(); 65 | $ipList = $this->_getIpList(Plesk_Object_Ip::DEDICATED, $version); 66 | if (is_null($domains)) { 67 | $domains = Plesk_Registry::getInstance()->api->webspaces_get(); 68 | } 69 | foreach($domains->xpath('//webspace/get/result') as $item) { 70 | try { 71 | $this->_checkErrors($item); 72 | foreach($item->data->hosting->vrt_hst->ip_address as $ip) { 73 | $ipListUse[(string)$ip] = (string)$ip; 74 | } 75 | } catch (Exception $e) { 76 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 77 | throw $e; 78 | } 79 | } 80 | } 81 | 82 | foreach($ipList as $ip) { 83 | if (!in_array($ip, $ipListUse)) { 84 | $ipListFree[] = $ip; 85 | } 86 | } 87 | 88 | $freeIp = reset($ipListFree); 89 | if (empty($freeIp)) { 90 | throw new Exception(Plesk_Registry::getInstance()->translator->translate('ERROR_NO_FREE_DEDICATED_IPTYPE', array('TYPE' => Plesk_Object_Ip::IPV6 == $version ? 'IPv6' : 'IPv4'))); 91 | } 92 | 93 | return $freeIp; 94 | } 95 | 96 | /** 97 | * @param $params 98 | * @return array ( => array ('diskusage' => value, 'disklimit' => value, 'bwusage' => value, 'bwlimit' => value)) 99 | */ 100 | protected function _getWebspacesUsage($params) 101 | { 102 | return parent::_getWebspacesUsage($params); 103 | } 104 | 105 | protected function _changeSubscriptionIp($params) 106 | { 107 | $webspace = Plesk_Registry::getInstance()->api->webspace_get_by_name(array('domain' => $params['domain'])); 108 | $ipDedicatedList = $this->_getIpList(Plesk_Object_Ip::DEDICATED); 109 | if (empty($ipDedicatedList)) { 110 | return; 111 | } 112 | foreach($webspace->webspace->get->result->data->hosting->vrt_hst->ip_address as $ip) { 113 | $ip = (string)$ip; 114 | $oldIp[$this->_isIpv6($ip) ? Plesk_Object_Ip::IPV6 : Plesk_Object_Ip::IPV4] = $ip; 115 | } 116 | $ipv4Address = isset($oldIp[Plesk_Object_Ip::IPV4]) ? $oldIp[Plesk_Object_Ip::IPV4] : ''; 117 | $ipv6Address = isset($oldIp[Plesk_Object_Ip::IPV6]) ? $oldIp[Plesk_Object_Ip::IPV6] : ''; 118 | 119 | if ($params["configoption3"] == 'IPv4 none; IPv6 shared' || $params["configoption3"] == 'IPv4 none; IPv6 dedicated') { 120 | $ipv4Address = ''; 121 | } 122 | if ($params["configoption3"] == 'IPv4 shared; IPv6 none' || $params["configoption3"] == 'IPv4 dedicated; IPv6 none') { 123 | $ipv6Address = ''; 124 | } 125 | 126 | if (!empty($params['ipv4Address'])) { 127 | if (isset($oldIp[Plesk_Object_Ip::IPV4]) && ($oldIp[Plesk_Object_Ip::IPV4] != $params['ipv4Address']) && 128 | (!in_array($oldIp[Plesk_Object_Ip::IPV4], $ipDedicatedList) || !in_array($params['ipv4Address'], $ipDedicatedList))) { 129 | $ipv4Address = $params['ipv4Address']; 130 | } elseif (!isset($oldIp[Plesk_Object_Ip::IPV4])) { 131 | $ipv4Address = $params['ipv4Address']; 132 | } 133 | } 134 | 135 | if (!empty($params['ipv6Address'])) { 136 | if (isset($oldIp[Plesk_Object_Ip::IPV6]) && ($oldIp[Plesk_Object_Ip::IPV6] != $params['ipv6Address']) && 137 | (!in_array($oldIp[Plesk_Object_Ip::IPV6], $ipDedicatedList) || !in_array($params['ipv6Address'], $ipDedicatedList))) { 138 | $ipv6Address = $params['ipv6Address']; 139 | } elseif (!isset($oldIp[Plesk_Object_Ip::IPV6])) { 140 | $ipv6Address = $params['ipv6Address']; 141 | } 142 | } 143 | 144 | if (!empty($ipv4Address) || !empty($ipv6Address)) { 145 | Plesk_Registry::getInstance()->api->webspace_set_ip( 146 | array( 147 | 'domain' => $params['domain'], 148 | 'ipv4Address' => $ipv4Address, 149 | 'ipv6Address' => $ipv6Address, 150 | ) 151 | ); 152 | } 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /lib/Plesk/Manager/V1635.php: -------------------------------------------------------------------------------- 1 | _getAccountInfo($params); 12 | if (!isset($ownerInfo['login'])) { 13 | return null; 14 | } 15 | $request = new Request($_SERVER); 16 | $result = Plesk_Registry::getInstance()->api->session_create( 17 | array( 18 | 'login' => $ownerInfo['login'], 19 | 'userIp' => base64_encode($request->getClientIP()), 20 | ) 21 | ); 22 | 23 | return $result->server->create_session->result->id; 24 | } 25 | 26 | protected function _getClientAreaForm($params) 27 | { 28 | $address = ($params['serverhostname']) ? $params['serverhostname'] : $params['serverip']; 29 | $port = ($params["serveraccesshash"]) ? $params["serveraccesshash"] : '8443'; 30 | $secure = ($params["serversecure"]) ? 'https' : 'http'; 31 | if (empty($address)) { 32 | return ''; 33 | } 34 | 35 | $sessionId = $this->_createSession($params); 36 | if (is_null($sessionId)) { 37 | return ''; 38 | } 39 | 40 | $form = sprintf( 41 | '
' . 42 | '' . 43 | '' . 44 | '' . 45 | '
', 46 | $secure, 47 | Sanitize::encode($address), 48 | Sanitize::encode($port), 49 | Sanitize::encode($sessionId), 50 | Sanitize::encode($sessionId), 51 | Plesk_Registry::getInstance()->translator->translate('BUTTON_CONTROL_PANEL') 52 | ); 53 | 54 | return $form; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/Plesk/Manager/V1640.php: -------------------------------------------------------------------------------- 1 | => array ('diskusage' => value, 'disklimit' => value, 'bwusage' => value, 'bwlimit' => value)) 9 | * @throws Exception 10 | */ 11 | protected function _getWebspacesUsage($params) 12 | { 13 | $usage = array(); 14 | $webspaces = Plesk_Registry::getInstance()->api->webspace_usage_get_by_name(array('domains' => $params['domains'])); 15 | foreach($webspaces->xpath('//webspace/get/result') as $result) { 16 | try { 17 | $this->_checkErrors($result); 18 | $domainName = (string)$result->data->gen_info->name; 19 | $usage[$domainName]['diskusage'] = (float)$result->data->gen_info->real_size; 20 | $resourceUsage = (array)$result->data->xpath('resource-usage'); 21 | $resourceUsage = reset($resourceUsage); 22 | foreach($resourceUsage->resource as $resource) { 23 | $name = (string)$resource->name; 24 | if ('max_traffic' == $name) { 25 | $usage[$domainName]['bwusage'] = (float)$resource->value; 26 | break; 27 | } 28 | } 29 | $usage[$domainName] = array_merge($usage[$domainName], $this->_getLimits($result->data->limits)); 30 | 31 | //Data saved in megabytes, not in a bytes 32 | foreach($usage[$domainName] as $param => $value) { 33 | $usage[$domainName][$param] = $usage[$domainName][$param] / (1024 * 1024); 34 | } 35 | } catch (Exception $e) { 36 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 37 | throw $e; 38 | } 39 | } 40 | } 41 | return $usage; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/Plesk/Manager/V1660.php: -------------------------------------------------------------------------------- 1 | id = $id; 12 | $this->name = $name; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/Plesk/Object/Webspace.php: -------------------------------------------------------------------------------- 1 | _instances[$name])) { 21 | return $this->_instances[$name]; 22 | } else { 23 | throw new Exception('There is no object "' . $name . '" in the registry.'); 24 | } 25 | } 26 | 27 | function __set($name, $value) 28 | { 29 | $this->_instances[$name] = $value; 30 | } 31 | 32 | function __isset($name) 33 | { 34 | return isset($this->_instances[$name]) ? true : false; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/Plesk/Translate.php: -------------------------------------------------------------------------------- 1 | _getLanguage() . ".php"; 15 | 16 | if (file_exists($englishFile)) { 17 | require $englishFile; 18 | $this->_keys = $keys; 19 | } 20 | 21 | if (file_exists($currentFile)) { 22 | require $currentFile; 23 | $this->_keys = array_merge($this->_keys, $keys); 24 | } 25 | } 26 | 27 | public function translate($msg, $placeholders = array()) 28 | { 29 | if (isset($this->_keys[$msg])) { 30 | $msg = $this->_keys[$msg]; 31 | foreach ($placeholders as $key => $val) 32 | $msg = str_replace("@{$key}@", $val, $msg); 33 | } 34 | 35 | return $msg; 36 | } 37 | 38 | private function _getLanguage() 39 | { 40 | $language = "english"; 41 | if (isset($GLOBALS[ 'CONFIG' ][ 'Language' ])) { 42 | $language = $GLOBALS[ 'CONFIG' ][ 'Language' ]; 43 | } 44 | if (isset($_SESSION["adminid"])) { 45 | $language = $this->_getUserLanguage('tbladmins', 'adminid'); 46 | } elseif ($_SESSION["uid"]) { 47 | $language = $this->_getUserLanguage('tblclients', 'uid'); 48 | } 49 | 50 | return strtolower($language); 51 | } 52 | 53 | private function _getUserLanguage($table, $field) 54 | { 55 | /** @var stdClass $language */ 56 | $language = Capsule::table($table)->where('id', $_SESSION[$field])->first(); 57 | return is_null($language) ? '' : $language->language; 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/Plesk/Utils.php: -------------------------------------------------------------------------------- 1 | join('tblservers', 'tblservers.id', '=', 'tblhosting.server') 15 | ->where('tblhosting.userid', $userId) 16 | ->where('tblservers.type', 'plesk') 17 | ->whereIn('tblhosting.domainstatus', array('Active', 'Suspended', 'Pending')) 18 | ->count(); 19 | 20 | $hostingAddonAccounts = Capsule::table('tblhostingaddons') 21 | ->join('tblservers', 'tblhostingaddons.server', '=', 'tblservers.id') 22 | ->where('tblhostingaddons.userid', $userId) 23 | ->where('tblservers.type', 'plesk') 24 | ->whereIn('status', ['Active', 'Suspended', 'Pending']) 25 | ->count(); 26 | 27 | return $hostingAccounts + $hostingAddonAccounts; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /plesk.php: -------------------------------------------------------------------------------- 1 | 'Plesk', 15 | 'APIVersion' => '1.1', 16 | ); 17 | } 18 | 19 | /** 20 | * @param array $params 21 | * @return array 22 | */ 23 | function plesk_ConfigOptions(array $params) 24 | { 25 | require_once 'lib/Plesk/Translate.php'; 26 | $translator = new Plesk_Translate(); 27 | 28 | $resellerSimpleMode = ($params['producttype'] == 'reselleraccount'); 29 | 30 | $configarray = array( 31 | "servicePlanName" => array( 32 | "FriendlyName" => $translator->translate("CONFIG_SERVICE_PLAN_NAME"), 33 | "Type" => "text", 34 | "Size" => "25", 35 | 'Loader' => function(array $params) { 36 | $return = array(); 37 | 38 | Plesk_Loader::init($params); 39 | $packages = Plesk_Registry::getInstance()->manager->getServicePlans(); 40 | $return[''] = 'None'; 41 | foreach ($packages as $package) { 42 | $return[$package] = $package; 43 | } 44 | 45 | return $return; 46 | }, 47 | 'SimpleMode' => true, 48 | ), 49 | "resellerPlanName" => array( 50 | "FriendlyName" => $translator->translate("CONFIG_RESELLER_PLAN_NAME"), 51 | "Type" => "text", 52 | "Size" => "25", 53 | 'Loader' => function(array $params) { 54 | $return = array(); 55 | 56 | Plesk_Loader::init($params); 57 | $packages = Plesk_Registry::getInstance()->manager->getResellerPlans(); 58 | $return[''] = 'None'; 59 | foreach ($packages as $package) { 60 | $return[$package] = $package; 61 | } 62 | 63 | return $return; 64 | }, 65 | 'SimpleMode' => $resellerSimpleMode, 66 | ), 67 | "ipAdresses" => array ( 68 | "FriendlyName" => $translator->translate("CONFIG_WHICH_IP_ADDRESSES"), 69 | "Type" => "dropdown", 70 | "Options" => "IPv4 shared; IPv6 none,IPv4 dedicated; IPv6 none,IPv4 none; IPv6 shared,IPv4 none; IPv6 dedicated,IPv4 shared; IPv6 shared,IPv4 shared; IPv6 dedicated,IPv4 dedicated; IPv6 shared,IPv4 dedicated; IPv6 dedicated", 71 | "Default" => "IPv4 shared; IPv6 none", 72 | "Description" => "", 73 | 'SimpleMode' => true, 74 | ), 75 | "powerUser" => array( 76 | "FriendlyName" => $translator->translate("CONFIG_POWER_USER_MODE"), 77 | "Type" => "yesno", 78 | "Description" => $translator->translate("CONFIG_POWER_USER_MODE_DESCRIPTION"), 79 | ), 80 | 81 | ); 82 | 83 | return $configarray; 84 | } 85 | 86 | /** 87 | * @param $params 88 | * @return string 89 | */ 90 | function plesk_AdminLink($params) 91 | { 92 | $address = ($params['serverhostname']) ? $params['serverhostname'] : $params['serverip']; 93 | $port = ($params["serveraccesshash"]) ? $params["serveraccesshash"] : '8443'; 94 | $secure = ($params["serversecure"]) ? 'https' : 'http'; 95 | if (empty($address)) { 96 | return ''; 97 | } 98 | 99 | $form = sprintf( 100 | '
' . 101 | '' . 102 | '' . 103 | '' . 104 | '
', 105 | $secure, 106 | Sanitize::encode($address), 107 | Sanitize::encode($port), 108 | Sanitize::encode($params["serverusername"]), 109 | Sanitize::encode($params["serverpassword"]), 110 | 'Login to panel' 111 | ); 112 | 113 | return $form; 114 | } 115 | 116 | /** 117 | * @param $params 118 | * @return string 119 | */ 120 | function plesk_ClientArea($params) { 121 | try { 122 | Plesk_Loader::init($params); 123 | return Plesk_Registry::getInstance()->manager->getClientAreaForm($params); 124 | 125 | } catch (Exception $e) { 126 | return Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())); 127 | } 128 | } 129 | 130 | /** 131 | * Create panel reseller or customer with webspace. If customer exists function add webspace to him. 132 | * @param $params 133 | * @return string 134 | */ 135 | function plesk_CreateAccount($params) { 136 | 137 | try { 138 | 139 | Plesk_Loader::init($params); 140 | $translator = Plesk_Registry::getInstance()->translator; 141 | 142 | if ("" == $params['clientsdetails']['firstname'] && "" == $params['clientsdetails']['lastname']) { 143 | return $translator->translate('ERROR_ACCOUNT_VALIDATION_EMPTY_FIRST_OR_LASTNAME'); 144 | } elseif ("" == $params["username"]) { 145 | return $translator->translate('ERROR_ACCOUNT_VALIDATION_EMPTY_USERNAME'); 146 | } 147 | 148 | Plesk_Registry::getInstance()->manager->createTableForAccountStorage(); 149 | 150 | /** @var stdClass $account */ 151 | $account = Capsule::table('mod_pleskaccounts') 152 | ->where('userid', $params['clientsdetails']['userid']) 153 | ->where('usertype', $params['type']) 154 | ->first(); 155 | 156 | $panelExternalId = is_null($account) ? '' : $account->panelexternalid; 157 | $params['clientsdetails']['panelExternalId'] = $panelExternalId; 158 | 159 | $accountId = null; 160 | try{ 161 | $accountInfo = Plesk_Registry::getInstance()->manager->getAccountInfo($params, $panelExternalId); 162 | if (isset($accountInfo['id'])) { 163 | $accountId = $accountInfo['id']; 164 | } 165 | } catch (Exception $e) { 166 | if (Plesk_Api::ERROR_OBJECT_NOT_FOUND != $e->getCode()) { 167 | throw $e; 168 | } 169 | } 170 | 171 | if (!is_null($accountId) && Plesk_Object_Customer::TYPE_RESELLER == $params['type']) { 172 | return $translator->translate('ERROR_RESELLER_ACCOUNT_IS_ALREADY_EXISTS', array('EMAIL' => $params['clientsdetails']['email'])); 173 | } 174 | 175 | $params = array_merge($params, Plesk_Registry::getInstance()->manager->getIps($params)); 176 | if (is_null($accountId)) { 177 | try { 178 | $accountId = Plesk_Registry::getInstance()->manager->addAccount($params); 179 | } catch (Exception $e) { 180 | if (Plesk_Api::ERROR_OPERATION_FAILED == $e->getCode()) { 181 | return $translator->translate('ERROR_ACCOUNT_CREATE_COMMON_MESSAGE'); 182 | } 183 | throw $e; 184 | } 185 | } 186 | Plesk_Registry::getInstance()->manager->addIpToIpPool($accountId, $params); 187 | 188 | if ('' == $panelExternalId && '' != ($possibleExternalId = Plesk_Registry::getInstance()->manager->getCustomerExternalId($params))) { 189 | /** @var stdClass $account */ 190 | Capsule::table('mod_pleskaccounts') 191 | ->insert( 192 | array( 193 | 'userid' => $params['clientsdetails']['userid'], 194 | 'usertype' => $params['type'], 195 | 'panelexternalid' => $possibleExternalId 196 | ) 197 | ); 198 | } 199 | 200 | if (!is_null($accountId) && Plesk_Object_Customer::TYPE_RESELLER == $params['type']) { 201 | return 'success'; 202 | } 203 | 204 | $params['ownerId'] = $accountId; 205 | Plesk_Registry::getInstance()->manager->addWebspace($params); 206 | 207 | if (!empty($params['configoptions'])) { 208 | Plesk_Registry::getInstance()->manager->processAddons($params); 209 | } 210 | 211 | return 'success'; 212 | } catch (Exception $e) { 213 | return Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())); 214 | } 215 | } 216 | 217 | /** 218 | * Suspend reseller account or customer's subscription (webspace) 219 | * @param $params 220 | * @return string 221 | */ 222 | function plesk_SuspendAccount($params) { 223 | 224 | try { 225 | Plesk_Loader::init($params); 226 | $params['status'] = ('root' != $params['serverusername'] && 'admin' != $params['serverusername']) ? Plesk_Object_Customer::STATUS_SUSPENDED_BY_RESELLER : Plesk_Object_Customer::STATUS_SUSPENDED_BY_ADMIN ; 227 | 228 | switch ($params['type']) { 229 | case Plesk_Object_Customer::TYPE_CLIENT: 230 | Plesk_Registry::getInstance()->manager->setWebspaceStatus($params); 231 | break; 232 | case Plesk_Object_Customer::TYPE_RESELLER: 233 | Plesk_Registry::getInstance()->manager->setResellerStatus($params); 234 | break; 235 | } 236 | return 'success'; 237 | 238 | } catch (Exception $e) { 239 | return Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())); 240 | } 241 | 242 | } 243 | 244 | /** 245 | * Unsuspend reseller account or customer's subscription (webspace) 246 | * @param $params 247 | * @return string 248 | */ 249 | function plesk_UnsuspendAccount($params) { 250 | 251 | try { 252 | Plesk_Loader::init($params); 253 | switch ($params['type']) { 254 | case Plesk_Object_Customer::TYPE_CLIENT: 255 | $params["status"] = Plesk_Object_Webspace::STATUS_ACTIVE; 256 | Plesk_Registry::getInstance()->manager->setWebspaceStatus($params); 257 | break; 258 | case Plesk_Object_Customer::TYPE_RESELLER: 259 | $params["status"] = Plesk_Object_Customer::STATUS_ACTIVE; 260 | Plesk_Registry::getInstance()->manager->setResellerStatus($params); 261 | break; 262 | } 263 | return 'success'; 264 | 265 | } catch (Exception $e) { 266 | return Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())); 267 | } 268 | 269 | } 270 | 271 | /** 272 | * Delete webspace or reseller from Panel 273 | * @param $params 274 | * @return string 275 | */ 276 | function plesk_TerminateAccount($params) { 277 | 278 | try { 279 | Plesk_Loader::init($params); 280 | switch ($params['type']) { 281 | case Plesk_Object_Customer::TYPE_CLIENT: 282 | Plesk_Registry::getInstance()->manager->deleteWebspace($params); 283 | break; 284 | case Plesk_Object_Customer::TYPE_RESELLER: 285 | Plesk_Registry::getInstance()->manager->deleteReseller($params); 286 | break; 287 | } 288 | return 'success'; 289 | 290 | } catch (Exception $e) { 291 | return Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())); 292 | } 293 | } 294 | 295 | /** 296 | * @param $params 297 | * @return string 298 | */ 299 | function plesk_ChangePassword($params) { 300 | 301 | try { 302 | Plesk_Loader::init($params); 303 | Plesk_Registry::getInstance()->manager->setAccountPassword($params); 304 | if (Plesk_Object_Customer::TYPE_RESELLER == $params['type']) { 305 | return 'success'; 306 | } 307 | 308 | Plesk_Registry::getInstance()->manager->setWebspacePassword($params); 309 | return 'success'; 310 | } catch (Exception $e) { 311 | return Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())); 312 | } 313 | } 314 | 315 | function plesk_AdminServicesTabFields($params) { 316 | 317 | try { 318 | Plesk_Loader::init($params); 319 | $translator = Plesk_Registry::getInstance()->translator; 320 | $accountInfo = Plesk_Registry::getInstance()->manager->getAccountInfo($params); 321 | if (!isset($accountInfo['login'])) { 322 | return array(); 323 | } 324 | 325 | if ($accountInfo['login'] == $params["username"]) { 326 | return array('' => $translator->translate('FIELD_CHANGE_PASSWORD_MAIN_PACKAGE_DESCR')); 327 | } 328 | 329 | return array( 330 | '' => $translator->translate('FIELD_CHANGE_PASSWORD_ADDITIONAL_PACKAGE_DESCR', 331 | array('PACKAGE' => $params['domain'],) 332 | ) 333 | ); 334 | 335 | } catch (Exception $e) { 336 | return Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())); 337 | } 338 | } 339 | 340 | /** 341 | * @param $params 342 | * @return string 343 | */ 344 | function plesk_ChangePackage($params) { 345 | try { 346 | Plesk_Loader::init($params); 347 | $params = array_merge($params, Plesk_Registry::getInstance()->manager->getIps($params)); 348 | 349 | Plesk_Registry::getInstance()->manager->switchSubscription($params); 350 | if (Plesk_Object_Customer::TYPE_RESELLER == $params['type']) { 351 | return 'success'; 352 | } 353 | Plesk_Registry::getInstance()->manager->processAddons($params); 354 | Plesk_Registry::getInstance()->manager->changeSubscriptionIp($params); 355 | 356 | return 'success'; 357 | 358 | } catch (Exception $e) { 359 | return Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())); 360 | } 361 | } 362 | 363 | /** 364 | * @param $params 365 | * @return string 366 | */ 367 | function plesk_UsageUpdate($params) { 368 | 369 | $services = Service::where('server', '=', $params['serverid'])->whereIn('domainstatus', ['Active', 'Suspended',])->get(); 370 | $addons = Addon::whereHas('customFieldValues.customField', function ($query) { 371 | $query->where('fieldname', 'Domain'); 372 | }) 373 | ->with('customFieldValues', 'customFieldValues.customField') 374 | ->where('server', '=', $params['serverid']) 375 | ->whereIn('status', ['Active', 'Suspended',]) 376 | ->get(); 377 | 378 | $domains = []; 379 | $resellerUsernames = []; 380 | $resellerAccountsUsage = []; 381 | $domainToModel = []; 382 | 383 | /** @var Service $service */ 384 | foreach ($services as $service) { 385 | if ($service->product->type == 'reselleraccount') { 386 | $resellerUsernames['service'][] = $service->username; 387 | $resellerToModel[$service->username] = $service; 388 | } elseif ($service->domain) { 389 | $domains[] = $service->domain; 390 | $domainToModel[$service->domain] = $service; 391 | } 392 | } 393 | 394 | /** @var Addon $addon */ 395 | foreach ($addons as $addon) { 396 | if ($addon->productAddon->type == 'reselleraccount') { 397 | $resellerUsernames['addon'][] = $addon->username; 398 | $resellerToModel[$addon->username] = $addon; 399 | continue; 400 | } 401 | foreach ($addon->customFieldValues as $customFieldValue) { 402 | if (!$customFieldValue->customField) { 403 | continue; 404 | } 405 | if ($customFieldValue->value) { 406 | $domains[] = $customFieldValue->value; 407 | $domainToModel[$customFieldValue->value] = $addon; 408 | } 409 | break; 410 | } 411 | } 412 | 413 | /** Reseller Plan Updates **/ 414 | if (!empty($resellerUsernames) && !empty($resellerUsernames['service'])) { 415 | $params['usernames'] = $resellerUsernames['service']; 416 | try { 417 | Plesk_Loader::init($params); 418 | $resellerServiceUsage = Plesk_Registry::getInstance()->manager->getResellersUsage($params); 419 | } catch (Exception $e) { 420 | return Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())); 421 | } 422 | $resellerAccountsUsage = $resellerServiceUsage; 423 | } 424 | 425 | if (!empty($resellerUsernames) && !empty($resellerUsernames['addon'])) { 426 | $params['usernames'] = $resellerUsernames['addon']; 427 | try { 428 | Plesk_Loader::init($params); 429 | $resellerAddonUsage = Plesk_Registry::getInstance()->manager->getResellersUsage($params); 430 | } catch (Exception $e) { 431 | return Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())); 432 | } 433 | $resellerAccountsUsage = array_merge($resellerAccountsUsage, $resellerAddonUsage); 434 | } 435 | 436 | if (!empty ($resellerAccountsUsage)) { 437 | foreach ($resellerAccountsUsage as $username => $usage) { 438 | 439 | /** @var Addon|Service $domainModel */ 440 | $domainModel = $resellerToModel[$username]; 441 | 442 | if ($domainModel) { 443 | 444 | $domainModel->serviceProperties->save( 445 | [ 446 | 'diskusage' => $usage['diskusage'], 447 | 'disklimit' => $usage['disklimit'], 448 | 'bwusage' => $usage['bwusage'], 449 | 'bwlimit' => $usage['bwlimit'], 450 | 'lastupdate' => Carbon::now()->toDateTimeString(), 451 | ] 452 | ); 453 | } 454 | } 455 | } 456 | 457 | if (!empty($domains)) { 458 | $params["domains"] = $domains; 459 | 460 | try { 461 | Plesk_Loader::init($params); 462 | $domainsUsage = Plesk_Registry::getInstance()->manager->getWebspacesUsage($params); 463 | } catch (Exception $e) { 464 | return Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())); 465 | } 466 | 467 | foreach ($domainsUsage as $domainName => $usage) { 468 | 469 | /** @var Addon|Service $domainModel */ 470 | $domainModel = $domainToModel[$domainName]; 471 | 472 | if ($domainModel) { 473 | 474 | $domainModel->serviceProperties->save( 475 | [ 476 | 'diskusage' => $usage['diskusage'], 477 | 'disklimit' => $usage['disklimit'], 478 | 'bwusage' => $usage['bwusage'], 479 | 'bwlimit' => $usage['bwlimit'], 480 | 'lastupdate' => Carbon::now()->toDateTimeString(), 481 | ] 482 | ); 483 | } 484 | } 485 | } 486 | 487 | return 'success'; 488 | } 489 | 490 | function plesk_TestConnection($params) { 491 | try { 492 | Plesk_Loader::init($params); 493 | $translator = Plesk_Registry::getInstance()->translator; 494 | return array( 495 | 'success' => true, 496 | ); 497 | } catch (Exception $e) { 498 | return array( 499 | 'error' => Plesk_Registry::getInstance()->translator->translate('ERROR_COMMON_MESSAGE', array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage())), 500 | ); 501 | } 502 | } 503 | 504 | /** 505 | * @param array $params 506 | * 507 | * @return string|array 508 | */ 509 | function plesk_GenerateCertificateSigningRequest(array $params) 510 | { 511 | try { 512 | Plesk_Loader::init($params); 513 | 514 | $result = Plesk_Registry::getInstance()->manager->generateCSR($params); 515 | return [ 516 | 'csr' => $result->certificate->generate->result->csr->__toString(), 517 | 'key' => $result->certificate->generate->result->pvt->__toString(), 518 | 'saveData' => true, 519 | ]; 520 | } catch (\Exception $e) { 521 | return Plesk_Registry::getInstance() 522 | ->translator 523 | ->translate( 524 | 'ERROR_COMMON_MESSAGE', 525 | array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage()) 526 | ); 527 | } 528 | 529 | } 530 | 531 | /** 532 | * @param array $params 533 | * 534 | * @return string 535 | */ 536 | function plesk_InstallSsl(array $params) 537 | { 538 | try { 539 | Plesk_Loader::init($params); 540 | Plesk_Registry::getInstance()->manager->installSsl($params); 541 | return 'success'; 542 | } catch (\Exception $e) { 543 | return Plesk_Registry::getInstance() 544 | ->translator 545 | ->translate( 546 | 'ERROR_COMMON_MESSAGE', 547 | array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage()) 548 | ); 549 | } 550 | } 551 | 552 | /** 553 | * @throws Exception 554 | * 555 | * @param array $params 556 | * 557 | * @return array 558 | */ 559 | function plesk_GetMxRecords(array $params) 560 | { 561 | try { 562 | Plesk_Loader::init($params); 563 | return Plesk_Registry::getInstance()->manager->getMxRecords($params); 564 | } catch (\Exception $e) { 565 | throw new Exception( 566 | 'MX Retrieval Failed: ' . Plesk_Registry::getInstance() 567 | ->translator 568 | ->translate( 569 | 'ERROR_COMMON_MESSAGE', 570 | array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage()) 571 | ) 572 | ); 573 | } 574 | } 575 | 576 | /** 577 | * @throws Exception 578 | * 579 | * @param array $params 580 | */ 581 | function plesk_DeleteMxRecords(array $params) 582 | { 583 | try { 584 | Plesk_Loader::init($params); 585 | Plesk_Registry::getInstance()->manager->deleteMxRecords($params); 586 | } catch (\Exception $e) { 587 | throw new Exception( 588 | 'Unable to Delete MX Record: ' . Plesk_Registry::getInstance() 589 | ->translator 590 | ->translate( 591 | 'ERROR_COMMON_MESSAGE', 592 | array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage()) 593 | ) 594 | ); 595 | } 596 | } 597 | 598 | /** 599 | * @throws Exception 600 | * 601 | * @param array $params 602 | */ 603 | function plesk_AddMxRecords(array $params) 604 | { 605 | try { 606 | Plesk_Loader::init($params); 607 | Plesk_Registry::getInstance()->manager->addMxRecords($params); 608 | } catch (\Exception $e) { 609 | throw new Exception( 610 | 'MX Creation Failed: ' . Plesk_Registry::getInstance() 611 | ->translator 612 | ->translate( 613 | 'ERROR_COMMON_MESSAGE', 614 | array('CODE' => $e->getCode(), 'MESSAGE' => $e->getMessage()) 615 | ) 616 | ); 617 | } 618 | } 619 | 620 | function plesk_CreateFileWithinDocRoot(array $params) 621 | { 622 | 623 | $ftpConnection = false; 624 | if (function_exists('ftp_ssl_connect')) { 625 | $ftpConnection = @ftp_ssl_connect($params['serverhostname']); 626 | } 627 | if (!$ftpConnection) { 628 | $ftpConnection = @ftp_connect($params['serverhostname']); 629 | } 630 | if (!$ftpConnection) { 631 | throw new Exception('Plesk: Unable to create DV Auth File: FTP Connection Failed'); 632 | } 633 | $ftpLogin = @ftp_login($ftpConnection, $params['username'], $params['password']); 634 | 635 | if (!$ftpLogin) { 636 | throw new Exception('Plesk: Unable to create DV Auth File: FTP Login Failed'); 637 | } 638 | 639 | $tempFile = tempnam(sys_get_temp_dir(), "plesk"); 640 | if (!$tempFile) { 641 | throw new Exception('Plesk: Unable to create DV Auth File: Unable to Create Temp File'); 642 | } 643 | $file = fopen($tempFile, 'w+'); 644 | if (!fwrite($file, $params['fileContent'])) { 645 | throw new Exception('Plesk: Unable to create DV Auth File: Unable to Write to Temp File'); 646 | } 647 | fclose($file); 648 | ftp_chdir($ftpConnection, 'httpdocs'); 649 | 650 | $dir = array_key_exists('dir', $params) ? $params['dir'] : ''; 651 | 652 | if ($dir) { 653 | $dirParts = explode('/', $dir); 654 | foreach ($dirParts as $dirPart) { 655 | if(!@ftp_chdir($ftpConnection, $dirPart)){ 656 | ftp_mkdir($ftpConnection, $dirPart); 657 | ftp_chdir($ftpConnection, $dirPart); 658 | } 659 | } 660 | } 661 | $upload = ftp_put($ftpConnection, $params['filename'], $tempFile, FTP_ASCII); 662 | if (!$upload) { 663 | ftp_pasv($ftpConnection, true); 664 | $upload = ftp_put($ftpConnection, $params['filename'], $tempFile, FTP_ASCII); 665 | } 666 | ftp_close($ftpConnection); 667 | if (!$upload) { 668 | throw new Exception('Plesk: Unable to create DV Auth File: Unable to Upload File: ' . json_encode(error_get_last())); 669 | } 670 | } 671 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/customer_add.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 |
18 |
19 |
20 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/customer_del.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/customer_get_by_login.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/customer_ippool_add_ip.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/customer_set_password.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/domain_usage_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/domains_get.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/ip_get.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/reseller_set_password.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/server_getProtos.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/webspace_add.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | true 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/webspace_del.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/webspace_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/webspace_set_ip.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/webspace_set_password.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/webspace_set_status.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/webspaces_get.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/api/1.0.0.0/webspaces_get_by_owner_id.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/certificate_generate.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2048 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/certificate_install.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/customer_add.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/customer_del.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/customer_get_by_external_id.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/customer_get_by_login.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/customer_set_password.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/dns_record_delete.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/dns_record_retrieve.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/mx_record_create.tpl: -------------------------------------------------------------------------------- 1 | 2 | $priority): ?> 3 | 4 | 5 | MX 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/resellerPlan_get.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/reseller_add.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |
21 |
22 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/reseller_del.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/reseller_get_by_external_id.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/reseller_get_by_login.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/reseller_get_usage_by_login.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/reseller_plan_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/reseller_set_password.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/reseller_set_status.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/service_plan_addon_get_by_guid.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/service_plan_addon_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/service_plan_get.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/service_plan_get_by_guid.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/service_plan_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/switch_reseller_plan.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/switch_subscription.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/webspace_add.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | ftp_login 15 | 16 | 17 | 18 | ftp_password 19 | 20 | 21 | 22 | 23 | 24 | 25 | true 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/webspace_add_subscription.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/webspace_del.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/webspace_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/webspace_remove_subscription.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/webspace_set_ip.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/webspace_subscriptions_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/webspace_usage_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/webspaces_get.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/api/1.6.3.0/webspaces_get_by_owner_id.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/ip_get.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/service_plan_addon_get_by_guid.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/service_plan_addon_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/service_plan_get_by_guid.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/webspace_add.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | ftp_login 14 | 15 | 16 | 17 | ftp_password 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | true 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/webspace_add_subscription.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/webspace_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/webspace_remove_subscription.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/webspace_set_ip.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/webspace_subscriptions_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/webspace_usage_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /templates/api/1.6.3.2/webspaces_get.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/api/1.6.3.5/customer_get_by_external_id.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.5/customer_get_by_login.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.5/reseller_get_by_external_id.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.5/reseller_get_by_login.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.3.5/session_create.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /templates/api/1.6.4.0/webspace_usage_get_by_name.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /templates/api/1.6.6.0/customer_add.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /templates/api/1.6.6.0/reseller_add.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 |
22 |
23 | -------------------------------------------------------------------------------- /templates/api/1.6.7.0/certificate_generate.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2048 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /templates/api/1.6.7.0/certificate_install.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.7.0/customer_get_by_external_id.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.7.0/customer_get_by_login.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.7.0/reseller_get_by_external_id.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/api/1.6.7.0/reseller_get_by_login.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | --------------------------------------------------------------------------------