public function showAction() { parent::showAction(); $request = $this->getRequest(); $id = $this->_helper->IdConvert->hexToStr($request->getParam('id')); $certLogic = new Logic_Ws_Cert(); $certRowset = $certLogic->getCertificatesForService($id); $certPaginator = new Base_Paginator(new Base_Paginator_Adapter_Array($certRowset->toArray(), array('RowClass' => 'Row_WsServiceSmsCert'))); $this->view->certs = $certPaginator; $this->view->certsHeaders = array('ws_service_id', 'file_path', 'valid_from', 'valid_until'); }
/** * Walidacja poprawności parametrów * @param array $data */ public function isValid($data) { $isValid = parent::isValid($data); switch ($data['operator_id']) { case Logic_Sms::LWS_Plus: foreach (array('crt', 'pem') as $type) { $this->getElement($type)->addFilter(new Zend_Filter_File_Rename(array('target' => $data['service_login'] . ".{$type}"))); $certFileName[$type] = $this->_receiveFiles($type); } if (!$this->_edit && !empty($certFileName)) { if (null === $certFileName['crt'] || null === $certFileName['pem']) { try { Logic_Sms_Operator_Plus::checkValidCertificates($data['service_login']); } catch (Exception $exc) { $this->getElement('pem')->setRequired(true); $this->getElement('crt')->setRequired(true)->addError($exc->getMessage()); $isValid = false; } } else { try { Logic_Ws_Cert::isCertificateValid($certFileName['crt']); } catch (Exception $exc) { $this->getElement('crt')->addError($exc->getMessage()); $isValid = false; } } } } return $isValid; }
public function showAction() { $request = $this->getRequest(); $id = $this->_helper->IdConvert->hexToStr($request->getParam('id')); $logic = new Logic_Ws_Cert(); try { $data = $logic->showCertificate($id); $logic->isCertificateExists($id); } catch (Logic_Exception $e) { $this->_helper->messenger('error', $e->getMessage()); return $this->_helper->redirector('index'); } $this->view->data = $data; }
/** * Walidacja poprawności parametrów * @param array $data */ public function isValid($data) { $isValid = parent::isValid($data); $wsServiceSmsModel = new WsServiceSms(); $wsServiceSmsRow = $wsServiceSmsModel->findOne($data['service_id']); foreach (array('crt', 'pem') as $type) { $this->getElement($type)->addFilter(new Zend_Filter_File_Rename(array('target' => $wsServiceSmsRow->service_login . ".{$type}"))); $certFileName[$type] = $this->_receiveFiles($type); } try { Logic_Ws_Cert::isCertificateValid($certFileName['crt']); } catch (Exception $exc) { $this->getElement('crt')->addError($exc->getMessage()); $isValid = false; } return $isValid; }
public function softDelete() { $logicCert = new Logic_Ws_Cert(); $logicCert->deleteCertificateFiles($this->ws_service_id); parent::softDelete(); }
/** * @return void */ public function editAction() { $request = $this->getRequest(); $id = $this->_helper->IdConvert->hexToStr($request->getParam('id')); $form = new $this->_addForm(null, 0, array(), true); $logic = new Logic_Ws_Service(new $this->_model()); $appEnvs = Logic_Ws_Service::getServiceAppEnvs(); if ($request->isPost()) { if ($form->isCancelled($this->getRequest()->getPost())) { return $this->_helper->redirector('index', null, null); } if ($form->isValid($request->getPost())) { try { $value = $form->getValues(); $logic->createOrUpdateService($value, $id); $logic->addLimits(array('min' => $value['min'], 'max' => $value['max']), $id); $files = $form->getReceivedFiles(); if (false === empty($files)) { $certLogic = new Logic_Ws_Cert(); $certLogic->saveCertificateFiles($id, $files); } $this->_helper->messenger->success(); return $this->_helper->redirector('index'); } catch (Logic_Ws_Exception $e) { $this->_helper->messenger->error(); } } } try { $serviceRow = $logic->getService($id); } catch (Zend_Db_Exception $e) { $this->_helper->messenger->error($e->getMessage()); return $this->_helper->redirector('index'); } $defaults = $serviceRow->toArray(); $getLimits = $logic->getLimitsForService($id, array()); if ($getLimits->count() > 0) { $getLimits = Zend_Json_Decoder::decode($getLimits->getRow(0)->validator_params); foreach ($getLimits as $key => $getLimit) { $defaults[$key] = $getLimit; } } $defaults['mask'] = $serviceRow->getMasks(); $form->setDefaults($defaults); $this->view->form = $form; }
/** * Metoda sprawdza, czy istnieją aktualne pliki certyfikatów. * @param string $login Login usługi Multiinfo */ public static function checkValidCertificates($login) { $config = Zend_Registry::get('config'); if (false === is_file($config['services']['Plus']['pathToPem'] . $login . '.pem')) { throw new Logic_Sms_Operator_Exception("Selected PEM certificate file does not exitst or is not accessible!"); } //check dates of certificate Logic_Ws_Cert::isCertificateValid($config['services']['Plus']['pathToCrt'] . $login . '.crt'); }