コード例 #1
0
 /**
  * Preapares data for saving of subscriber
  * Add the line for rapidmail status
  *
  * @param  Mage_Newsletter_Model_Subscriber $subscriber
  * @return array
  */
 protected function _prepareSave(Mage_Newsletter_Model_Subscriber $subscriber)
 {
     $data = array();
     $data['customer_id'] = $subscriber->getCustomerId();
     $data['store_id'] = $subscriber->getStoreId() ? $subscriber->getStoreId() : 0;
     $data['subscriber_status'] = $subscriber->getStatus();
     $data['subscriber_email'] = $subscriber->getEmail();
     $data['subscriber_confirm_code'] = $subscriber->getCode();
     $data['rapidmail_status'] = $subscriber->getRapidmailStatus();
     if ($subscriber->getIsStatusChanged()) {
         $data['change_status_at'] = Mage::getSingleton('core/date')->gmtDate();
     }
     $validators = array('subscriber_email' => 'EmailAddress');
     $filters = array();
     $input = new Zend_Filter_Input($filters, $validators, $data);
     $session = Mage::getSingleton($this->_messagesScope);
     if ($input->hasInvalid() || $input->hasMissing()) {
         foreach ($input->getMessages() as $message) {
             if (is_array($message)) {
                 foreach ($message as $error) {
                     $session->addError($error);
                 }
             } else {
                 $session->addError($message);
             }
         }
         Mage::throwException(Mage::helper('newsletter')->__('Form was filled incorrectly'));
     }
     return $data;
 }
コード例 #2
0
 public function contactUsAction()
 {
     $filters = array('name' => 'StringTrim', 'tel' => 'StringTrim', 'email' => 'StringTrim', 'enquiry' => 'StringTrim');
     $validators = array('name' => 'NotEmpty', 'tel' => 'NotEmpty', 'email' => 'NotEmpty', 'enquiry' => 'NotEmpty');
     $input = new Zend_Filter_Input($filters, $validators, $_POST);
     $returnArray = array();
     if ($input->isValid()) {
         $emailer = new Application_Core_Mail();
         $params = Zend_Registry::get('params');
         $emailer->setTo($params->email->contactUs, 'HomeLet');
         $emailer->setFrom($input->email, $input->name);
         $emailer->setSubject('HomeLet - Contact Us Form');
         $bodyHtml = 'Name : ' . $input->name . '<br />';
         $bodyHtml .= 'Email : ' . $input->email . '<br />';
         $bodyHtml .= 'Tel : ' . $input->tel . '<br />';
         $bodyHtml .= 'Enquiry : <pre>' . $input->enquiry . '</pre><br />';
         $emailer->setBodyHtml($bodyHtml);
         if ($emailer->send()) {
             // Email sent successfully
             $returnArray['success'] = true;
             $returnArray['errorMessage'] = '';
         } else {
             $returnArray['success'] = false;
             $returnArray['errorMessage'] = 'Problem sending email.';
         }
     } else {
         $returnArray['success'] = false;
         $returnArray['errorMessage'] = $input->getMessages();
     }
     echo Zend_Json::encode($returnArray);
 }
コード例 #3
0
 public function searchAction()
 {
     $filters = array('q' => array('StringTrim', 'StripTags'));
     $validators = array('q' => array('presence' => 'required'));
     $input = new Zend_Filter_Input($filters, $validators, $_GET);
     if (is_string($this->_request->getParam('q'))) {
         $queryString = $input->getEscaped('q');
         $this->view->queryString = $queryString;
         if ($input->isValid()) {
             $config = Zend_Registry::get('config');
             $index = App_Search_Lucene::open($config->luceneIndex);
             $query = new Zend_Search_Lucene_Search_Query_Boolean();
             $pathTerm = new Zend_Search_Lucene_Index_Term($queryString);
             $pathQuery = new Zend_Search_Lucene_Search_Query_Term($pathTerm);
             $query->addSubquery($pathQuery, true);
             $pathTerm = new Zend_Search_Lucene_Index_Term('20091023', 'CreationDate');
             $pathQuery = new Zend_Search_Lucene_Search_Query_Term($pathTerm);
             $query->addSubquery($pathQuery, true);
             try {
                 $hits = $index->find($query);
             } catch (Zend_Search_Lucene_Exception $ex) {
                 $hits = array();
             }
             $this->view->hits = $hits;
         } else {
             $this->view->messages = $input->getMessages();
         }
     }
 }
コード例 #4
0
 /**
  * Save changes to an existing panel. This can be expanded to allow adding of new Panels in the future.
  *
  * @return void
  */
 protected function _savePanel()
 {
     // First of all we need to validate and sanitise the input from the form
     $urlFilter = new Zend_Filter();
     $urlFilter->addFilter(new Zend_Filter_StringTrim());
     $urlFilter->addFilter(new Zend_Filter_StringTrim('/'));
     $requiredText = new Zend_Validate();
     $requiredText->addValidator(new Zend_Validate_NotEmpty());
     $filters = array('id' => 'Digits');
     $validators = array('id' => array('allowEmpty' => true), 'content' => array('allowEmpty' => true));
     $input = new Zend_Filter_Input($filters, $validators, $_POST);
     if ($input->isValid()) {
         // Data is all valid, formatted and sanitized so we can save it in the database
         $panel = new Datasource_Cms_Panels();
         if (!$input->id) {
             // This is a new panel so we need to create a new ID
             // NOT IMPLEMENTED - YET
         } else {
             $panel->saveChanges($input->id, $input->getUnescaped('content'));
             $panelID = $input->id;
         }
         // Changes saved - so send them back with a nice success message
         $this->_helper->getHelper('FlashMessenger')->addMessage(array('saved' => true));
         $this->_helper->getHelper('Redirector')->goToUrl('/cms-admin/panels/edit?id=' . $panelID);
     } else {
         // Invalid data in form
         /*
         print_r($_POST);
         print_r($input->getErrors());
         print_r($input->getInvalid());
         */
     }
 }
コード例 #5
0
 /**
  * 
  * Remove an existing contact
  */
 public function removeContactAction()
 {
     $return = array();
     $pageSession = new Zend_Session_Namespace('letting_agents_application');
     $contactManager = new LettingAgents_Manager_Contacts();
     $postData = $this->getRequest()->getParams();
     $filters = array('uid' => 'StringTrim', 'uid' => 'StripTags');
     $validators = array('uid' => 'Alnum');
     $input = new Zend_Filter_Input($filters, $validators, $postData);
     if ($input->isValid()) {
         // Valid input
         $contactManager->deleteByUid($input->uid);
     } else {
         // false
         $return['errorHtml'] = 'Invalid Contact';
     }
     $agent = new LettingAgents_Manager_AgentApplication();
     $agentData = new LettingAgents_Object_AgentApplication();
     $agentData = $agent->fetchByUid($pageSession->agentUniqueId);
     $organisation_type = $agentData->get_organisation_type();
     switch ($organisation_type) {
         case LettingAgents_Object_CompanyTypes::LimitedCompany:
             $partialFile = "limited-company-list.phtml";
             break;
         case LettingAgents_Object_CompanyTypes::LimitedLiabilityPartnership:
         case LettingAgents_Object_CompanyTypes::Partnership:
             $partialFile = "partnership-list.phtml";
             break;
     }
     $return['contactHtml'] = $this->view->partialLoop("partials/{$partialFile}", $contactManager->fetchByAgencyUid($pageSession->agentUniqueId));
     echo Zend_Json::encode($return);
 }
コード例 #6
0
 public function editAction()
 {
     $form = new C3op_Form_ReceivableEdit();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $postData = $this->getRequest()->getPost();
         if ($form->isValid($postData)) {
             $form->process($postData);
             $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.');
             $this->_redirect('/projects/project/success-create');
         } else {
             throw new C3op_Projects_ProjectException("A project must have a valid title.");
         }
     } else {
         $data = $this->_request->getParams();
         $filters = array('id' => new Zend_Filter_Alnum());
         $validators = array('id' => new C3op_Util_ValidId());
         $input = new Zend_Filter_Input($filters, $validators, $data);
         if ($input->isValid()) {
             $id = $input->id;
             if (!isset($this->receivableMapper)) {
                 $this->receivableMapper = new C3op_Projects_ReceivableMapper($this->db);
             }
             $thisReceivable = $this->receivableMapper->findById($id);
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'title', $thisReceivable->GetTitle());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'id', $id);
             $this->SetDateValueToFormField($form, 'predictedDate', $thisReceivable->GetPredictedDate());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'predictedValue', $thisReceivable->GetPredictedValue());
             $this->SetDateValueToFormField($form, 'realDate', $thisReceivable->GetRealDate());
             C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'realValue', $thisReceivable->GetRealValue());
             $projectId = $this->populateProjectFields($thisReceivable->GetProject(), $form);
         }
     }
 }
コード例 #7
0
 public function showAction()
 {
     $params = $this->getRequest()->getUserParams();
     $filters = array('wherecolumn' => 'alnum', 'order' => 'alnum', 'count' => 'digits', 'offset' => 'digits');
     $valids = array('wherecolumn' => array('presence' => 'optional'), 'wherevalue' => array('presence' => 'optional'), 'order' => array('presence' => 'optional'), 'count' => array('int', 'default' => 20), 'offset' => 'int');
     $input = new Zend_Filter_Input($filters, $valids, $params);
     if (!$input->isValid()) {
         $this->_redirect();
     }
     $whereColumn = $input->wherecolumn;
     $whereValue = $input->wherevalue;
     $order = $input->order;
     $count = $input->count;
     $offset = $input->offset;
     $db = $this->_model->getAdapter();
     $tableInfo = $this->_model->info();
     $this->view->tableInfo = $tableInfo;
     $where = null;
     if ($whereColumn) {
         $expr = $db->quoteIdentifier($whereColumn) . ' IN (?)';
         $where = $db->quoteInto($expr, $whereValue);
     }
     $this->view->rowset = $this->_model->fetchAll($where, $order, $count, $offset);
     $select = $db->select()->from($tableInfo['name'], 'COUNT(*)');
     $this->view->rowCount = $db->fetchOne($select);
     $this->view->distinctValues = array();
     foreach ($tableInfo['cols'] as $columnName) {
         $select = $db->select()->from($tableInfo['name'], $columnName)->distinct();
         $this->view->distinctValues[$columnName] = $db->fetchCol($select);
     }
 }
コード例 #8
0
 public function loaddataorderspaymentAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper("layout")->disableLayout();
     $aInputFilters = array("*" => array(new Zend_Filter_StringTrim()));
     $aInputValidators = array("num_row_per_page" => array(new Zend_Validate_Digits()), "curr_page" => array(new Zend_Validate_Digits()), "sort_column" => array(new AppCms2_Validate_SpecialAlpha()), "sort_method" => array(new Zend_Validate_Alpha()));
     $oInput = new Zend_Filter_Input($aInputFilters, $aInputValidators, $_POST);
     $nNumRowPerPage = $oInput->getUnescaped("num_row_per_page");
     $nCurrPage = $oInput->getUnescaped("curr_page");
     $sSortColumn = $oInput->getUnescaped("sort_column");
     $sSortMethod = $oInput->getUnescaped("sort_method");
     $aFilter = array();
     foreach ($aFilter as $sKey => $sValue) {
         if (!isset($sValue)) {
             unset($aFilter[$sKey]);
         }
     }
     $oModelVOrderPaymentHistory = new User_Model_VOrderPaymentHistory();
     $oRowset = $oModelVOrderPaymentHistory->getUserPayments($aFilter, $nNumRowPerPage, ($nCurrPage - 1) * $nNumRowPerPage, $sSortColumn . " " . $sSortMethod);
     $nNumRows = $oModelVOrderPaymentHistory->getUserPayments($aFilter)->count();
     $aJson = array("rowset" => $oRowset->toArray(), "num_rows" => $nNumRows);
     header("Content-type: application/json");
     echo Zend_Json::encode($aJson);
     exit;
 }
コード例 #9
0
ファイル: Bootstrap.php プロジェクト: rogeriopradoj/temostudo
 private function _sanitizeData()
 {
     Fgsl_Session_Namespace::init('session');
     $filterInput = new Zend_Filter_Input(null, null, $_POST);
     $filterInput->setDefaultEscapeFilter('StripTags');
     Fgsl_Session_Namespace::set('post', $filterInput);
 }
コード例 #10
0
 function usunAction()
 {
     $post = new Zend_Filter_Input($_POST);
     $respondent = new Respondenci();
     $db = $respondent->getAdapter();
     $params = $this->_action->getParams();
     if (isset($params['id'])) {
         $id = (int) $params['id'];
         $num = (int) $params['page'];
         $where = $db->quoteInto('id_respondent = ?', $id);
         $respondent->delete($where);
         $this->_forward('respondenci', 'edytuj', array('page' => $num));
     } else {
         $what = trim($post->noTags('Umail'));
         $where = $db->quoteInto('e_mail = ?', $what);
         try {
             if (empty($what)) {
                 throw new Respondenci_Exception('Podaj adres e-mail.');
             }
             $respondent->delete($where);
             $this->_redirect('/respondenci/');
         } catch (Respondenci_Exception $e) {
             $this->_forward('respondenci', 'index', array('insertionError' => $e->getMessage()));
         }
     }
 }
コード例 #11
0
ファイル: Save.php プロジェクト: nblair/magescotch
 /**
  * @return void
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function executeInternal()
 {
     if ($this->getRequest()->getPostValue()) {
         try {
             /** @var \Magento\CatalogRule\Model\Rule $model */
             $model = $this->_objectManager->create('Magento\\CatalogRule\\Model\\Rule');
             $this->_eventManager->dispatch('adminhtml_controller_catalogrule_prepare_save', ['request' => $this->getRequest()]);
             $data = $this->getRequest()->getPostValue();
             $inputFilter = new \Zend_Filter_Input(['from_date' => $this->_dateFilter, 'to_date' => $this->_dateFilter], [], $data);
             $data = $inputFilter->getUnescaped();
             $id = $this->getRequest()->getParam('rule_id');
             if ($id) {
                 $model->load($id);
                 if ($id != $model->getId()) {
                     throw new LocalizedException(__('Wrong rule specified.'));
                 }
             }
             $validateResult = $model->validateData(new \Magento\Framework\DataObject($data));
             if ($validateResult !== true) {
                 foreach ($validateResult as $errorMessage) {
                     $this->messageManager->addError($errorMessage);
                 }
                 $this->_getSession()->setPageData($data);
                 $this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
                 return;
             }
             $data['conditions'] = $data['rule']['conditions'];
             unset($data['rule']);
             $model->loadPost($data);
             $this->_objectManager->get('Magento\\Backend\\Model\\Session')->setPageData($model->getData());
             $model->save();
             $this->messageManager->addSuccess(__('You saved the rule.'));
             $this->_objectManager->get('Magento\\Backend\\Model\\Session')->setPageData(false);
             if ($this->getRequest()->getParam('auto_apply')) {
                 $this->getRequest()->setParam('rule_id', $model->getId());
                 $this->_forward('applyRules');
             } else {
                 if ($model->isRuleBehaviorChanged()) {
                     $this->_objectManager->create('Magento\\CatalogRule\\Model\\Flag')->loadSelf()->setState(1)->save();
                 }
                 if ($this->getRequest()->getParam('back')) {
                     $this->_redirect('catalog_rule/*/edit', ['id' => $model->getId()]);
                     return;
                 }
                 $this->_redirect('catalog_rule/*/');
             }
             return;
         } catch (LocalizedException $e) {
             $this->messageManager->addError($e->getMessage());
         } catch (\Exception $e) {
             $this->messageManager->addError(__('Something went wrong while saving the rule data. Please review the error log.'));
             $this->_objectManager->get('Psr\\Log\\LoggerInterface')->critical($e);
             $this->_objectManager->get('Magento\\Backend\\Model\\Session')->setPageData($data);
             $this->_redirect('catalog_rule/*/edit', ['id' => $this->getRequest()->getParam('rule_id')]);
             return;
         }
     }
     $this->_redirect('catalog_rule/*/');
 }
コード例 #12
0
ファイル: Block.php プロジェクト: Lazaro-Gallo/psmn
 protected function _filterInputBlock($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'value' => array(array('Alnum', array('allowwhitespace' => true))), 'long_description' => array(), 'conclusion_text' => array(array('Alnum', array('allowwhitespace' => true)))), array('questionnaire_id' => array('NotEmpty'), 'designation' => array('allowEmpty' => true), 'value' => array('NotEmpty', 'messages' => array('O nome do bloco não pode ser vazio.')), 'long_description' => array('allowEmpty' => true), 'conclusion_text' => array('allowEmpty' => true)), $params, array('presence' => 'required'));
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #13
0
ファイル: Glossary.php プロジェクト: Lazaro-Gallo/psmn
 protected function _filterInputQuestion($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'term' => array(array('Alnum', array('allowwhitespace' => true))), 'description' => array(array('HtmlEntities'))), array('term' => array('NotEmpty'), 'description' => array('NotEmpty')), $params, array('presence' => 'required'));
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #14
0
 protected function _filterInputECAC($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), array('enterprise_id' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa'), 'presence' => 'required'), 'competition_id' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa'), 'presence' => 'required'), 'category_award_id' => array('NotEmpty', 'messages' => array('Escolha a categoria do premio'), 'presence' => 'required'), 'token' => array('allowEmpty' => true)), $params);
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #15
0
 protected function _filterInputEnterpriseProgramaRank($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), array('enterprise_id_key' => array('allowEmpty' => true), 'user_id' => array('allowEmpty' => true), 'programa_id' => array('allowEmpty' => true), 'classificar' => array('allowEmpty' => true), 'desclassificar' => array('allowEmpty' => true), 'justificativa' => array('allowEmpty' => true), 'classificado_verificacao' => array('allowEmpty' => true), 'desclassificado_verificacao' => array('allowEmpty' => true), 'motivo_desclassificado_verificacao' => array('allowEmpty' => true), 'classificado_ouro' => array('allowEmpty' => true), 'classificado_prata' => array('allowEmpty' => true), 'classificado_bronze' => array('allowEmpty' => true), 'desclassificado_final' => array('allowEmpty' => true), 'motivo_desclassificado_final' => array('allowEmpty' => true), 'classificar_nacional' => array('allowEmpty' => true), 'desclassificar_nacional' => array('allowEmpty' => true), 'motivo_desclassificado_nacional' => array('allowEmpty' => true), 'classificar_fase2_nacional' => array('allowEmpty' => true), 'desclassificar_fase2_nacional' => array('allowEmpty' => true), 'motivo_desclassificado_fase2_nacional' => array('allowEmpty' => true), 'classificado_ouro_nacional' => array('allowEmpty' => true), 'classificado_prata_nacional' => array('allowEmpty' => true), 'classificado_bronze_nacional' => array('allowEmpty' => true), 'classificar_fase3_nacional' => array('allowEmpty' => true), 'desclassificar_fase3_nacional' => array('allowEmpty' => true), 'motivo_desclassificado_fase3_nacional' => array('allowEmpty' => true)), $params);
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #16
0
 protected function _filterInputLogCadastroEmpresa($params)
 {
     $input = new Zend_Filter_Input(array(), array('user_id_log' => array('NotEmpty', 'presence' => 'required'), 'enterprise_id' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa.'), 'presence' => 'required'), 'programa_id' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa.'), 'presence' => 'required'), 'acao' => array('NotEmpty', 'messages' => array('Erro ao cadastrar empresa.'), 'presence' => 'required')), $params, array());
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #17
0
ファイル: Authenticate.php プロジェクト: Lazaro-Gallo/psmn
 protected function _filterInputIdentify($parameters)
 {
     $input = new Zend_Filter_Input(array('*' => 'StripTags', 'username' => 'StringTrim'), array('username' => array(), 'password' => array(), 'uri' => array('allowEmpty' => true)), $parameters, array('presence' => 'required'));
     if ($input->hasInvalid() or $input->hasMissing()) {
         throw new Vtx_UserException($this->messageErrorEmpty);
     }
     return $input;
 }
コード例 #18
0
ファイル: ServiceArea.php プロジェクト: Lazaro-Gallo/psmn
 protected function _filterInputServiceArea($params)
 {
     $input = new Zend_Filter_Input(array(), array('regional_id' => array('NotEmpty', 'presence' => 'required'), 'StateId' => array('allowEmpty' => true), 'CityId' => array('allowEmpty' => true), 'NeighborhoodId' => array('allowEmpty' => true)), $params);
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #19
0
ファイル: UserLocality.php プロジェクト: Lazaro-Gallo/psmn
 protected function _filterInputUserLocality($params)
 {
     $input = new Zend_Filter_Input(array(), array('user_id' => array('NotEmpty', 'presence' => 'required'), 'enterprise_id' => array('allowEmpty' => true), 'regional_id' => array('allowEmpty' => true)), $params);
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #20
0
 protected function _filterInputAnswerFeedbackImprove($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), array('user_id' => array('NotEmpty'), 'answer_id' => array('NotEmpty'), 'feedback_improve' => array('NotEmpty')), $params, array('presence' => 'required'));
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #21
0
ファイル: President.php プロジェクト: Lazaro-Gallo/psmn
 protected function _filterInputPresident($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'name' => array(), 'cpf' => array('Digits')), array('enterprise_id' => array('NotEmpty', 'presence' => 'required'), 'education_id' => array('NotEmpty', 'messages' => array('Escolha o Nivel de Escolaridade.'), 'presence' => 'required'), 'position_id' => array('NotEmpty', 'messages' => array('Escolha o Cargo.'), 'presence' => 'required'), 'find_us_id' => array('NotEmpty', 'messages' => array('Selecione o item como nos conheceu.'), 'presence' => 'required'), 'name' => array('NotEmpty', 'messages' => array('Digite o Nome da candidata.'), 'presence' => 'required'), 'nick_name' => array('allowEmpty' => true), 'cpf' => array('NotEmpty', 'messages' => array('Digite o CPF.'), new Vtx_Validate_Cpf()), 'email' => array('allowEmpty' => true), 'phone' => array('allowEmpty' => true), 'cellphone' => array('allowEmpty' => true), 'born_date' => array('NotEmpty', 'messages' => array('Digite a Data de Nascimento.'), 'presence' => 'required', new Zend_Validate_Date('dd/MM/yyyy')), 'gender' => array('allowEmpty' => true), 'newsletter_email' => array('allowEmpty' => true), 'newsletter_mail' => array('allowEmpty' => true), 'newsletter_sms' => array('allowEmpty' => true), 'agree' => array('NotEmpty', 'messages' => array('É necessário aceitar o regulamento'), 'presence' => 'required'), 'created' => array('allowEmpty' => true)), $params, array());
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #22
0
 protected function _filterInputAnnualResultData($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'value' => array(array('Alnum', array('allowwhitespace' => true))), 'Year' => array(array('Digits', array('allowwhitespace' => true)))), array('annual_result_id' => array('NotEmpty'), 'year' => array('allowEmpty' => true), 'value' => array('allowEmpty' => true)), $params, array('presence' => 'required'));
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #23
0
ファイル: Configuration.php プロジェクト: Lazaro-Gallo/psmn
 protected function _filterInputConfiguration($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim')), array(), $params, array('presence' => 'required'));
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #24
0
ファイル: Group.php プロジェクト: Lazaro-Gallo/psmn
 protected function _filterInputGroup($params)
 {
     $input = new Zend_Filter_Input(array('name' => array(), 'description' => array()), array('name' => array('NotEmpty', 'messages' => array('O Nome não pode ser vazio.')), 'description' => array('NotEmpty', 'messages' => array('A Descrição não pode ser vazia.'))), $params, array('presence' => 'required'));
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #25
0
ファイル: AnnualResult.php プロジェクト: Lazaro-Gallo/psmn
 protected function _filterInputAnnualResult($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StringTrim'), 'value' => array()), array('question_id' => array(), 'mask' => array('NotEmpty', 'messages' => array('Escolha a máscara do Resultado Anual.')), 'value' => array('NotEmpty', 'messages' => array('Escolha o nome do Resultado Anual.'))), $params, array('presence' => 'required'));
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #26
0
 protected function _filterInputAddressPresident($params)
 {
     $input = new Zend_Filter_Input(array('cep' => array(array('Alnum', array('allowwhitespace' => true)), array('StripTags', 'StringTrim')), 'street_name_full' => array(array('Alnum', array('allowwhitespace' => true)), array('StripTags', 'StringTrim'))), array('address_id' => array('allowEmpty' => true), 'president_id' => array('NotEmpty', 'presence' => 'required'), 'cep' => array('NotEmpty', 'messages' => array('Digite apenas números no CEP da candidata.'), 'presence' => 'required'), 'state_id' => array('NotEmpty', 'messages' => array('Escolha o estado da candidata.')), 'city_id' => array('NotEmpty', 'messages' => array('Escolha a cidade da candidata.')), 'neighborhood_id' => array('NotEmpty', 'messages' => array('Escolha o bairro da candidata.')), 'name_full_log' => array('NotEmpty', 'messages' => array('Digite o nome da Rua da candidata.')), 'street_number' => array('NotEmpty', 'messages' => array('Digite o Número da Rua da candidata.')), 'street_completion' => array('allowEmpty' => true)), $params);
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #27
0
ファイル: EmailQueue.php プロジェクト: Lazaro-Gallo/psmn
 protected function _filterInputEmailQueue($params)
 {
     $input = new Zend_Filter_Input(array('*' => array('StripTags', 'StringTrim'), 'answer_value' => array(array('Alnum', array('allowwhitespace' => true)))), array('alternative_id' => array('NotEmpty'), 'answer_value' => array('allowEmpty' => true), 'start_time' => array('allowEmpty' => true), 'end_time' => array('allowEmpty' => true), 'answer_date' => array('allowEmpty' => true), 'user_id' => array('NotEmpty'), 'logged_user_id' => array('NotEmpty')), $params, array('presence' => 'required'));
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #28
0
 protected function _filterInputRoleQuestionnaire($params)
 {
     $input = new Zend_Filter_Input(array(), array('role_id' => array('NotEmpty', 'messages' => array('Escolha o Papel (perfil)')), 'questionnaire_id' => array('NotEmpty', 'messages' => array('Escolha o questionário')), 'start_date' => array('NotEmpty', new Zend_Validate_Date('dd/MM/yyyy')), 'end_date' => array('NotEmpty', new Zend_Validate_Date('dd/MM/yyyy'))), $params, array('presence' => 'required'));
     if ($input->hasInvalid() || $input->hasMissing()) {
         throw new Vtx_UserException(Model_ErrorMessage::getFirstMessage($input->getMessages()));
     }
     return $input;
 }
コード例 #29
0
ファイル: Save.php プロジェクト: magefan/module-blog
 /**
  * Before model save
  * @param  \Magefan\Blog\Model\Post $model
  * @param  \Magento\Framework\App\Request\Http $request
  * @return void
  */
 protected function _beforeSave($model, $request)
 {
     /* Prepare dates */
     $dateFilter = $this->_objectManager->create('Magento\\Framework\\Stdlib\\DateTime\\Filter\\Date');
     $data = $model->getData();
     $filterRules = [];
     foreach (['publish_time', 'custom_theme_from', 'custom_theme_to'] as $dateField) {
         if (!empty($data[$dateField])) {
             $filterRules[$dateField] = $dateFilter;
         }
     }
     $inputFilter = new \Zend_Filter_Input($filterRules, [], $data);
     $data = $inputFilter->getUnescaped();
     $model->setData($data);
     /* Prepare author */
     if (!$model->getAuthorId()) {
         $authSession = $this->_objectManager->get('Magento\\Backend\\Model\\Auth\\Session');
         $model->setAuthorId($authSession->getUser()->getId());
     }
     /* Prepare relative links */
     $data = $request->getPost('data');
     $links = isset($data['links']) ? $data['links'] : null;
     if ($links && is_array($links)) {
         foreach (['post', 'product'] as $linkType) {
             if (!empty($links[$linkType]) && is_array($links[$linkType])) {
                 $linksData = [];
                 foreach ($links[$linkType] as $item) {
                     $linksData[$item['id']] = ['position' => $item['position']];
                 }
                 $links[$linkType] = $linksData;
             }
         }
         $model->setData('links', $links);
     }
     /* Prepare images */
     $data = $model->getData();
     foreach (['featured_img', 'og_img'] as $key) {
         if (isset($data[$key]) && is_array($data[$key])) {
             if (!empty($data[$key]['delete'])) {
                 $model->setData($key, null);
             } else {
                 if (isset($data[$key][0]['name']) && isset($data[$key][0]['tmp_name'])) {
                     $image = $data[$key][0]['name'];
                     $model->setData($key, Post::BASE_MEDIA_PATH . DIRECTORY_SEPARATOR . $image);
                     $imageUploader = $this->_objectManager->get('Magefan\\Blog\\ImageUpload');
                     $imageUploader->moveFileFromTmp($image);
                 } else {
                     if (isset($data[$key][0]['name'])) {
                         $model->setData($key, $data[$key][0]['name']);
                     }
                 }
             }
         } else {
             $model->setData($key, null);
         }
     }
 }
コード例 #30
0
 public function deleteKompAction()
 {
     $post = new Zend_Filter_Input($_POST);
     $kompy = new Komputery();
     $db = $kompy->getAdapter();
     $where = $db->quoteInto('id_komputer = ?', $post->getRaw('komputer_id'));
     $rows_affected = $kompy->delete($where);
     $this->_forward('komp', 'index');
 }