/** * Enables an authenticated user to create a domain on their hosting account. * @return type */ public function CreateDomain() { $request_data = $this->RawXMWSToArray($this->wsdata); $dataobject = new runtime_dataobject(); $dataobject->addItemValue('response', ''); if (module_controller::ExecuteAddDomain(ws_generic::GetTagValue('uid', $request_data['content']), ws_generic::GetTagValue('domain', $request_data['content']), ws_generic::GetTagValue('destination', $request_data['content']), ws_generic::GetTagValue('autohome', $request_data['content']))) { $dataobject->addItemValue('content', ws_xmws::NewXMLTag('domain', ws_generic::GetTagValue('domain', $request_data['content'])) . ws_xmws::NewXMLTag('created', 'true')); } else { $dataobject->addItemValue('content', ws_xmws::NewXMLTag('domain', ws_generic::GetTagValue('domain', $request_data['content'])) . ws_xmws::NewXMLTag('created', 'false')); } return $dataobject->getDataObject(); }
public function CreateClient() { $request_data = $this->RawXMWSToArray($this->wsdata); $response_xml = "false"; $userExits = module_controller::CheckUserExists(ws_generic::GetTagValue('username', $request_data['content'])); if (!$userExits) { if (module_controller::ExecuteCreateClient(ws_generic::GetTagValue('resellerid', $request_data['content']), ws_generic::GetTagValue('username', $request_data['content']), ws_generic::GetTagValue('packageid', $request_data['content']), ws_generic::GetTagValue('groupid', $request_data['content']), ws_generic::GetTagValue('fullname', $request_data['content']), ws_generic::GetTagValue('email', $request_data['content']), ws_generic::GetTagValue('address', $request_data['content']), ws_generic::GetTagValue('postcode', $request_data['content']), ws_generic::GetTagValue('phone', $request_data['content']), ws_generic::GetTagValue('password', $request_data['content']), ws_generic::GetTagValue('sendemail', $request_data['content']), ws_generic::GetTagValue('emailsubject', $request_data['content']), ws_generic::GetTagValue('emailbody', $request_data['content']))) { $response_xml = "true"; } } $dataobject = new runtime_dataobject(); $dataobject->addItemValue('response', ''); $dataobject->addItemValue('content', $response_xml); return $dataobject->getDataObject(); }
/** * Enables an authenticated user to create a sub-domain. * @return type */ public function CreateSubDomain() { global $zdbh; $request_data = $this->RawXMWSToArray($this->wsdata); $response_xml = "\n"; $subname = ws_generic::GetTagValue('subname', $request_data['content']); $subdirectory = ws_generic::GetTagValue('subdirectory', $request_data['content']); $uid = ws_generic::GetTagValue('uid', $request_data['content']); $autohome = ws_generic::GetTagValue('autohome', $request_data['content']); $retval = module_controller::ExecuteAddSubDomain($uid, $subname, $subdirectory, $autohome); $response_xml = $response_xml . ws_xmws::NewXMLContentSection('subdomain', array('subname' => $subname, 'subdirectory' => $subdirectory, 'uid' => $uid, 'autohome' => $autohome)); $dataobject = new runtime_dataobject(); $dataobject->addItemValue('response', ''); $dataobject->addItemValue('content', $response_xml); return $dataobject->getDataObject(); }
public function CreateDNSRecord() { $request_data = $this->RawXMWSToArray($this->wsdata); $response_xml = "\n"; $uid = ws_generic::GetTagValue('uid', $request_data['content']); $domainName = ws_generic::GetTagValue('domainName', $request_data['content']); $domainID = ws_generic::GetTagValue('domainID', $request_data['content']); $hostName = ws_generic::GetTagValue('hostName', $request_data['content']); $type = ws_generic::GetTagValue('type', $request_data['content']); $target = ws_generic::GetTagValue('target', $request_data['content']); $ttl = ws_generic::GetTagValue('ttl', $request_data['content']); module_controller::createDNSRecord(array("uid" => $uid, "domainName" => $domainName, "domainID" => $domainID, "type" => $type, "hostName" => $hostName, "ttl" => $ttl, "target" => $target)); $response_xml = $response_xml . ws_xmws::NewXMLContentSection('dns_record', array('domainName' => $domainName, 'hostName' => $hostName, 'type' => $type, 'target' => $target, 'created' => 'true')); $dataobject = new runtime_dataobject(); $dataobject->addItemValue('response', ''); $dataobject->addItemValue('content', $response_xml); return $dataobject->getDataObject(); }
/** * Delete one or multiple DNS records * Mandatory parameters: uid and domainName * Optional parameters: hostName, record type, target * The meaning of parameters is same as in CreateDNSRecord() */ public function DeleteDNSRecords() { global $zdbh; $request_data = $this->RawXMWSToArray($this->wsdata); $response_xml = "\n"; $tags = array('hostName' => 'dn_host_vc', 'type' => 'dn_type_vc', 'target' => 'dn_target_vc'); // these are mandatory parameters $uid = ws_generic::GetTagValue('uid', $request_data['content']); $domainName = ws_generic::GetTagValue('domainName', $request_data['content']); $domainID = self::GetDomainID($uid, $domainName); $sqlstr = "SELECT * FROM x_dns WHERE dn_acc_fk=:userid AND vh_deleted_ts IS NULL AND dn_vhost_fk=:domainID "; // iterate through optional parameters foreach ($tags as $tag => $sql_param) { if (!is_null(ws_generic::GetTagValue($tag, $request_data['content']))) { $sqlstr .= " AND " . $sql_param . '=:' . $tag; } } $sql = $zdbh->prepare($sqlstr); $sql->bindParam(':userid', $uid); $sql->bindParam(':domainID', $domainID); $params = array(); foreach ($tags as $tag => $sql_param) { if (!is_null($params[$tag] = ws_generic::GetTagValue($tag, $request_data['content']))) { $sql->bindParam(":" . $tag, $params[$tag]); } } $sql->execute(); while ($rowdns = $sql->fetch()) { $response_xml = $response_xml . ws_xmws::NewXMLContentSection('dns_record', array('hostName' => $rowdns['dn_host_vc'], 'type' => $rowdns['dn_type_vc'], 'target' => $rowdns['dn_target_vc'], 'ttl' => $rowdns['dn_ttl_in'], 'deleted' => 'true')); $sql2 = $zdbh->prepare("UPDATE x_dns SET dn_deleted_ts=:time WHERE dn_id_pk =:id AND dn_deleted_ts IS NULL"); $sql2->bindParam(':id', $rowdns['dn_id_pk']); $time = time(); $sql2->bindParam(':time', $time); $sql2->execute(); } module_controller::TriggerDNSUpdate($domainID); $dataobject = new runtime_dataobject(); $dataobject->addItemValue('response', ''); $dataobject->addItemValue('content', $response_xml); return $dataobject->getDataObject(); }
public function UpdateClientPackage() { $request_data = $this->RawXMWSToArray($this->wsdata); $response_xml = ""; $userExits = module_controller::CheckUserExits(ws_generic::GetTagValue('username', $request_data['content'])); if ($userExits === true) { $update = module_controller::ExecuteChangeClientPackage(ws_generic::GetTagValue('uid', $request_data['content']), ws_generic::GetTagValue('packageid', $request_data['content']), ws_generic::GetTagValue('groupid', $request_data['content'])); if ($update !== true) { $response = '1106'; } } else { $response_xml = $userExits; $response = '9998'; } $dataobject = new runtime_dataobject(); $dataobject->addItemValue('response', $response); $dataobject->addItemValue('content', $response_xml); return $dataobject->getDataObject(); }