예제 #1
0
 /**
  * Save all the domain selection
  * @return unknown_type
  */
 public function saveAction()
 {
     $session = new Zend_Session_Namespace('Default');
     $params = $this->getRequest()->getParams();
     if (empty($session->customer)) {
         $profile = $session->customer;
         $customerid = $profile['customer_id'];
     } else {
         $customerid = NULL;
     }
     if (empty($params['tlds'])) {
         // Redirect the user to the domain check page
         $this->_helper->redirector('index', 'domainschk', 'default', array('mex' => 'You have to check one of the domain tlds.', 'status' => 'danger'));
     }
     $domain = $params['domain'];
     $tlds = $params['tlds'];
     $authinfo = !empty($params['authinfo']) ? $params['authinfo'] : null;
     // Clear the temporary list before adding the new one
     DomainsBulk::clear(Zend_Session::getId());
     // Adding the domain in the temporary domains bulk table
     if (!empty($tlds) && !empty($domain)) {
         for ($i = 0; $i < count($tlds); $i++) {
             $isavailable = Domains::check_availability($domain, $tlds[$i]);
             $authinfocode = !empty($authinfo[$i]) ? $authinfo[$i] : null;
             DomainsBulk::add_domain($domain, $tlds[$i], $isavailable, $customerid, $authinfocode);
         }
     }
     // Redirect the user to the order creation page.
     $this->_helper->redirector('createorder', 'domainschk', 'default');
 }
예제 #2
0
 /**
  *  Check the domain availability
  *  @return template
  */
 public function bulkdomainsAction()
 {
     $request = $this->getRequest();
     $session = new Zend_Session_Namespace('Default');
     $i = 0;
     try {
         $form = new Default_Form_BulkdomainsForm(array('action' => '/common/bulkdomains', 'method' => 'post'));
         if ($request->getPost()) {
             if ($form->isValid($request->getPost())) {
                 $params = $form->getValues();
                 if (!empty($params['domains'])) {
                     $checker = new Shineisp_Commons_DomainChecker();
                     $tlds = $request->getParam('tlds');
                     // Clear the temporary domains of the customer
                     if ($session->customer) {
                         $customerId = $session->customer['customer_id'];
                         DomainsBulk::findbyCustomerID($customerId)->delete();
                     } else {
                         $customerId = null;
                     }
                     $domains = explode("\n", $params['domains']);
                     foreach ($domains as $domain) {
                         foreach ($tlds as $tld) {
                             $tldinfo = DomainsTlds::getAllInfo($tld);
                             $domain = Shineisp_Commons_UrlRewrites::format($domain);
                             $domainame = $domain . "." . $tldinfo['DomainsTldsData'][0]['name'];
                             $isAvailable = $checker->checkDomainAvailability($domainame);
                             DomainsBulk::add_domain($domainame, $tld, $isAvailable, $customerId);
                         }
                     }
                     $this->_helper->redirector('bulkdomainsorder', 'common', 'default');
                 }
             }
         }
     } catch (Exception $e) {
         $this->_helper->redirector('index', 'index', 'default', array('mex' => $e->getMessage(), 'status' => 'danger'));
     }
     $this->view->form = $form;
     $this->getHelper('layout')->setLayout('1column');
 }