コード例 #1
0
ファイル: DomainsController.php プロジェクト: kokkez/shineisp
 /**
  * Save the domain profile data
  * @return unknown_type
  */
 public function saveprofileAction()
 {
     $request = $this->getRequest();
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('profile');
     }
     $form = new Default_Form_DomainsProfilesForm(array('action' => '/domains/profilesave/', 'method' => 'post'));
     $this->view->title = $this->translator->translate("Domain Profile");
     $this->view->description = $this->translator->translate("Here you can create or edit the domain profile.");
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->form = $form;
     if (!$form->isValid($request->getPost())) {
         return $this->_helper->viewRenderer('profile');
     }
     // Get the values posted
     $params = $form->getValues();
     // add the customer id reference
     $params['customer_id'] = $this->customer['customer_id'];
     $profileId = !empty($params['profile_id']) ? $params['profile_id'] : null;
     if (0 == DomainsNichandle::isUsed($profileId)) {
         $profileId = DomainsProfiles::saveAll($params, $profileId);
     } else {
         $this->_helper->redirector('profile', 'domains', 'default', array('id' => $profileId, 'mex' => 'You cannot edit the profile because it is connected to a domain.', 'status' => 'danger'));
     }
     $this->_helper->redirector('profile', 'domains', 'default', array('id' => $profileId, 'mex' => 'The task requested has been executed successfully.', 'status' => 'success'));
     $this->_helper->viewRenderer('profile');
 }
コード例 #2
0
ファイル: DomainsNichandle.php プロジェクト: kokkez/shineisp
 /**
  * Add a new nichandle reference
  */
 public static function setNicHandle($domain_id, $profile_id, $type = "owner")
 {
     try {
         if (!empty($profile_id) && is_numeric($profile_id)) {
             $nicHandle = new DomainsNichandle();
             $nicHandle->domain_id = $domain_id;
             $nicHandle->profile_id = $profile_id;
             $nicHandle->type = $type;
             if ($nicHandle->trySave()) {
                 return true;
             }
         }
         return false;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
コード例 #3
0
ファイル: DomainsController.php プロジェクト: kokkez/shineisp
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $request = $this->getRequest();
     // 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 task");
         $this->view->description = $this->translator->translate("Here you have to fix the domain parameters set.");
         return $this->render('applicantform');
         // re-render the login form
     }
     // Get the values posted
     $params = $form->getValues();
     // Get the id
     $id = $this->getRequest()->getParam('domain_id');
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/domains/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/domains/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     try {
         $id = Domains::saveAll($id, $params);
         Domains::saveDnsZones($id, $params);
         Domains::setAutorenew($id, $params['autorenew'] == 0 ? false : true);
         DomainsNichandle::setNicHandles($id, $params['owner'], $params['admin'], $params['tech'], $params['billing']);
         // If the domain status has been set as active
         // the registrar task record will be set as completed
         if ($params['status_id'] == Statuses::id("active", 'domains')) {
             DomainsTasks::setStatusTask($id, Statuses::id("complete", 'domains_tasks'));
             // Complete
         }
         // Save the message note
         if (!empty($params['message'])) {
             $message = new Messages();
             $message->dateposted = date('Y-m-d H:i:s');
             $message->message = $params['message'];
             $message->isp_id = 1;
             $message->domain_id = $id;
             $message->save();
         }
         $this->_helper->redirector('edit', 'domains', 'admin', array('id' => $id, 'mex' => 'The task requested has been executed successfully.', 'status' => 'success'));
     } catch (Exception $e) {
         $this->_helper->redirector('list', 'domains', 'admin', array('mex' => $e->getMessage(), 'status' => 'danger'));
     }
 }