/** * getList * Get all the records for the select objects * @param $domain_name, $tld, $fields="*", $retarray=false * @return Doctrine Record */ public static function getList($id = null) { $items = array(); if ($id) { $order_items = Doctrine::getTable('OrdersItemsDomains')->findby('orderitem_id', $id)->toArray(); } else { $order_items = Doctrine::getTable('OrdersItemsDomains')->findAll()->toArray(); } foreach ($order_items as $item) { $domain = Domains::find($item['domain_id']); $items[$item['domain_id']] = $domain[0]['domain'] . "." . $domain[0]['DomainsTlds']['WhoisServers']['tld']; } return $items; }
/** * updateDomain * Update the domain information * @param unknown_type $customerID */ public function updateDomain($domainID) { // Connection to the SOAP system $soap = $this->Connect(); if (empty($this->session)) { throw new Exception('SOAP connection system error'); } // Get the domain information $domain = Domains::find($domainID); if (!empty($domain[0])) { $domain_name = $domain[0]['domain'] . "." . $domain[0]['DomainsTlds']['WhoisServers']['tld']; try { $retval = $soap->domainInfo($this->session['id'], $domain_name); $info['domain'] = $retval->domain; $info['creation'] = $retval->creation; $info['modification'] = $retval->modification; $info['expiration'] = $retval->expiration; $info['nichandle'] = $retval->nicowner; $info['authinfocode'] = $retval->authinfo; return Domains::updateDomain($domainID, $info); } catch (Exception $e) { throw new Exception($e->getMessage()); } } throw new Exception('Domain ID not found.'); }
/** * * @param integer $domainId * @param string $type */ private function createNic($domainId, $type = 'owner') { $soap = $this->Connect(); if (!empty($this->session)) { $tld = Domains::getDomainTld($domainId); // get the domain profile $profile = DomainsProfiles::getProfileByDomainId($domainId, $type); if ($profile) { // Set generic variables for parameters $profile['countrycode'] = strtolower(Countries::getCodebyId($profile['country_id'])); $profile['birthdate'] = Shineisp_Commons_Utilities::formatDateOut($profile['birthdate']); $profile['password'] = Shineisp_Commons_Utilities::GenerateRandomString(); $profile['fullname'] = $profile['firstname'] . " " . $profile['lastname']; $profile['legalform'] = strtolower($profile['Legalforms']['name']); $profile['corporationtype'] = strtolower($profile['CompanyTypes']['name']); $profile['legalnumber'] = null; $profile['language'] = "en"; $profile['isowner'] = $type == "owner" ? true : false; if ($tld == "it") { // Create a nicHandle for the Italian domain tld $params[] = $this->session['id']; // Session $params[] = $profile['lastname']; // Lastname $params[] = $profile['firstname']; // Firstname $params[] = $profile['gender']; // Gender $params[] = $profile['password']; // Password $params[] = $profile['email']; // Email $params[] = $profile['phone']; // Phone $params[] = $profile['fax']; // Fax $params[] = $profile['address']; // Address $params[] = $profile['city']; // City $params[] = $profile['area']; // Area $params[] = $profile['zip']; // Zip $params[] = $profile['countrycode']; // Country Code $params[] = $profile['language']; // Language $params[] = $profile['isowner']; // isOwner $params[] = $profile['legalform']; // Legalform $params[] = $profile['company']; // Organisation $params[] = $profile['fullname']; // Legal name $params[] = $profile['legalnumber']; // Legal Number $params[] = $profile['vat']; // VAT or IVA $params[] = $profile['birthdate']; // Birthday $params[] = $profile['birthplace']; // Birthcity $params[] = $profile['taxpayernumber']; // Contact fiscal code or company vat $params[] = $profile['vat']; // Company National Identification Number $params[] = $profile['corporationtype']; $nicHandle = call_user_func_array(array($soap, 'nicCreateIT'), $params); Shineisp_Commons_Utilities::log('Calling profile nicCreateIT with these params: ' . json_encode($params), "registrar.ovh.log"); } else { $params[] = $this->session['id']; // Session $params[] = $profile['lastname']; // Lastname $params[] = $profile['firstname']; // Firstname $params[] = $profile['password']; // Password $params[] = $profile['email']; // Email $params[] = $profile['phone']; // Phone $params[] = $profile['fax']; // Fax $params[] = $profile['address']; // Address $params[] = $profile['city']; // City $params[] = $profile['area']; // Area $params[] = $profile['zip']; // Zip $params[] = $profile['countrycode']; // Country Code $params[] = $profile['language']; // Language $params[] = $profile['isowner']; // isOwner $params[] = $profile['legalform']; // Legalform $params[] = $profile['company']; // Organisation $params[] = $profile['fullname']; // Legal name $params[] = $profile['legalnumber']; // Legal Number $params[] = $profile['vat']; // VAT or IVA $nicHandle = call_user_func_array(array($soap, 'nicCreate'), $params); Shineisp_Commons_Utilities::log('Calling profile nicCreate with these params: ' . json_encode($params), "registrar.ovh.log"); } if (!empty($nicHandle)) { CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle, $type, $profile['profile_id']); // Save the nic-Handle in the database } } else { // If the client has not create any profile, the main client information will be set in all domain tld field [admin, tech, owner, billing] // Get the domain information $domain = Domains::find($domainId); // Create the OVH nic-Handle $nicHandle = $this->createNicHandlebyCustomer($domain[0]['customer_id'], $domainId); // Save the nic-Handle in the database CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle); } return $nicHandle; } return false; }
private function doDomainTask($task) { if (!isset($task['Domains']) || !isset($task['Domains']['Customers']) || !isset($task['Domains']['Customers']['customer_id'])) { PanelsActions::UpdateTaskLog($task['action_id'], $this->translations->translate('customer_id not found')); } $customer_id = intval($task['Domains']['Customers']['customer_id']); $ISP = Isp::getByCustomerId($customer_id); if (!$ISP || !isset($ISP['isp_id']) || !is_numeric($ISP['isp_id'])) { PanelsActions::UpdateTaskLog($task['action_id'], $this->translations->translate('isp_id not found')); return false; } try { // Getting domains details $domain = Domains::find($task['domain_id'], null, true); if (!empty($domain[0])) { $domain_name = $domain[0]['domain'] . "." . $domain[0]['tld']; // Get the associated registrar for the domain selected $registrar = Registrars::getRegistrarId($task['registrars_id']); if (!empty($registrar['class'])) { // Create the class registrar object $class = $registrar['class']; $regclass = new $class(); $action = $task['action']; // Check if the task is REGISTER or TRANSFER the domain name if ($action == "registerDomain") { $regclass->registerDomain($task['domain_id']); // Set the DNS ZONES DomainsTasks::AddTask($domain_name, "setDomainHosts"); // Update the domain information DomainsTasks::AddTask($domain_name, "updateDomain"); } elseif ($action == "transferDomain") { $regclass->transferDomain($task['domain_id']); } elseif ($action == "renewDomain") { $regclass->renewDomain($task['domain_id']); // Update the domain information DomainsTasks::AddTask($domain_name, "updateDomain"); } elseif ($action == "lockDomain") { $regclass->lockDomain($task['domain_id']); } elseif ($action == "unlockDomain") { $regclass->unlockDomain($task['domain_id']); // Update the domain information DomainsTasks::AddTask($domain_name, "updateDomain"); } elseif ($action == "setNameServers") { $regclass->setNameServers($task['domain_id']); } elseif ($action == "setDomainHosts") { $regclass->setDomainHosts($task['domain_id']); } else { $regclass->{$action}($task['domain_id']); } // Update the log description of the task DomainsTasks::UpdateTaskLog($task['task_id'], $this->translations->translate("Your request has been executed.")); // Update the status of the task DomainsTasks::UpdateTaskStatus($task['task_id'], Statuses::id('complete', 'domains_tasks')); // Set the task as "Complete" // Increment the task counter number DomainsTasks::UpdateTaskCounter($task['task_id']); // Set the status as Active Domains::setStatus($task['domain_id'], Statuses::id('active', 'domains_tasks')); } } } catch (Exception $e) { DomainsTasks::UpdateTaskLog($task['task_id'], $this->translations->translate($e->getMessage())); Shineisp_Commons_Utilities::SendEmail($ISP['email'], $ISP['email'], null, "Task error message: " . $task['Domains']['domain'] . "." . $task['Domains']['tld'], $e->getMessage()); Shineisp_Commons_Utilities::logs("Task error message: " . $task['Domains']['domain'] . "." . $task['Domains']['tld'] . ":" . $e->getMessage(), "tasks.log"); } return true; }
/** * Create a google calendar event */ public function neweventAction() { $id = $this->getRequest()->getParam('id'); if (!empty($id) && is_numeric($id)) { if (Shineisp_Plugins_Calendar_Main::isReady()) { $domain = Domains::find($id, "expiring_date as end, CONCAT(domain, '.', ws.tld) as domain, CONCAT('http://www.', domain, '.', ws.tld) as url"); if (!empty($domain[0])) { $summary = $domain[0]['domain']; $description = $this->translator->_("The domain %s expires today!", $domain[0]['url']); $location = ""; if (true === Shineisp_Plugins_Calendar_Main::newEvent($summary, $location, $description, $domain[0]['end'], $domain[0]['end'])) { $this->_helper->redirector('edit', 'domains', 'admin', array('id' => $id, 'mex' => 'The task requested has been executed successfully.', 'status' => 'success')); } } } $this->_helper->redirector('edit', 'domains', 'admin', array('id' => $id, 'mex' => $this->translator->translate('Unable to process the request at this time.'), 'status' => 'danger')); } $this->_helper->redirector('edit', 'domains', 'admin', array('id' => $id, 'mex' => $this->translator->translate('Domain id has not been found.'), 'status' => 'danger')); }