예제 #1
0
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $request = $this->getRequest();
     try {
         // Check if we have a POST request
         if (!$request->isPost()) {
             return $this->_helper->redirector('index');
         }
         // Get our form and validate it
         $form = $this->getForm('/admin/domains/process');
         if (!$form->isValid($request->getPost())) {
             // Invalid entries
             $this->view->form = $form;
             $this->view->title = $this->translator->translate("Domain Process");
             $this->view->description = $this->translator->translate("Check all the information posted before saving them.");
             return $this->_helper->viewRenderer('customform');
             // re-render the login form
         }
         // Get the values posted
         $params = $form->getValues();
         // Get the id
         $id = $params['domain_id'];
         if (!empty($params['dnsform']['target']) && !empty($params['dnsform']['zones'])) {
             Dns_Zones::addDnsZone($id, $params['dnsform']['subdomain'], $params['dnsform']['target'], $params['dnsform']['zones']);
         }
         // Save the message note
         if (!empty($params['note'])) {
             Messages::addMessage($params['note'], $this->customer['customer_id'], $id);
             $isp = Shineisp_Registry::get('ISP');
             $placeholder['fullname'] = $this->customer['firstname'] . " " . $this->customer['lastname'];
             $placeholder['domain'] = domains::getDomainName($id);
             $placeholder['message'] = $params['note'];
             $placeholder['messagetype'] = $this->translator->translate('Domain');
             Messages::sendMessage("message_new", $this->customer['email'], $placeholder);
             Messages::sendMessage("message_admin", $isp->email, $placeholder);
         }
         Domains::setAuthInfo($id, $params['authinfocode']);
         Domains::setAutorenew($id, $params['autorenew']);
         $this->_helper->redirector('edit', 'domains', 'default', array('id' => $id, 'mex' => 'The task requested has been executed successfully.', 'status' => 'success'));
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }