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);
     }
 }
 /**
  * 
  * 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);
 }
 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();
         }
     }
 }
 /**
  * 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());
         */
     }
 }
 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);
         }
     }
 }
 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);
 }
Exemple #7
0
 /**
  * This function validates the form.  if simple calls 
  * Zend_Filter_Input::isValid(), but capture the result. if the result is 
  * success, it creates the Inspekt cage around the input before returning 
  * true.
  */
 public function isValid()
 {
     if (!parent::isValid()) {
         return false;
     } else {
         $this->_clean = Inspekt_Cage::Factory($this->_validFields);
         return true;
     }
 }
 /**
  * executes the validation and creates an error array or
  * returns the Zend_Filter_Input object
  *
  * @return Zend_Filter_Input|array
  * @param Zend_Filter_Input $input
  */
 protected function validate($input)
 {
     if (!$input->isValid()) {
         $errors = array();
         foreach ($input->getMessages() as $field => $fieldArray) {
             foreach ($fieldArray as $message) {
                 $errors[$field] = $message;
             }
         }
         return $errors;
     } else {
         return $input;
     }
 }
 /**
  * Validate Newsletter template
  *
  * @throws Mage_Core_Exception
  * @return bool
  */
 public function validate()
 {
     $validators = array('template_code' => array(Zend_Filter_Input::ALLOW_EMPTY => false), 'template_type' => 'Int', 'template_sender_email' => 'EmailAddress', 'template_sender_name' => array(Zend_Filter_Input::ALLOW_EMPTY => false));
     $data = array();
     foreach (array_keys($validators) as $validateField) {
         $data[$validateField] = $this->getDataUsingMethod($validateField);
     }
     $validateInput = new Zend_Filter_Input(array(), $validators, $data);
     if (!$validateInput->isValid()) {
         $errorMessages = array();
         foreach ($validateInput->getMessages() as $messages) {
             if (is_array($messages)) {
                 foreach ($messages as $message) {
                     $errorMessages[] = $message;
                 }
             } else {
                 $errorMessages[] = $messages;
             }
         }
         Mage::throwException(join("\n", $errorMessages));
     }
 }
Exemple #10
0
 /**
  *
  * @param \Core_Dto_Mapping $dtoPass
  * @throws \Core_Exception_ServiceLayer_Verification
  */
 public function validatePass(\Core_Dto_Mapping $dtoPass)
 {
     $data = $dtoPass->toArray();
     $filters = array();
     $validators = array('txSenha' => array(array('NotEmpty'), array('StringLength', array('min' => 6)), 'messages' => array(0 => 'O campo Senha Antiga é de preenchimento obrigatório', 1 => 'MN043')), 'txSenhaNova' => array(array('NotEmpty'), array('StringLength', array('min' => 6)), 'messages' => array(0 => 'O campo Nova Senha é de preenchimento obrigatório', 1 => 'MN043')), 'txSenhaNovaConfirm' => array(array('NotEmpty'), array('StringLength', array('min' => 6)), array('Identical', $data['txSenhaNova']), 'messages' => array(0 => 'O campo Confirmação Nova Senha é de preenchimento obrigatório', 1 => 'MN043', 2 => 'A confirmação da nova senha não confere.')));
     $input = new \Zend_Filter_Input($filters, $validators, $data);
     if (!$input->isValid()) {
         foreach ($input->getMessages() as $msgError) {
             switch (key($msgError)) {
                 case 'isEmpty':
                     $this->getMessaging()->addErrorMessage($msgError['isEmpty']);
                     break;
                 case 'stringLengthTooShort':
                     $this->getMessaging()->addErrorMessage($msgError['stringLengthTooShort']);
                     break;
                 case 'notSame':
                     $this->getMessaging()->addErrorMessage($msgError['notSame']);
                     break;
             }
         }
         $this->getMessaging()->dispatchPackets();
         throw new \Core_Exception_ServiceLayer_Verification();
     }
 }
 /**
  *
  * @param string $UserID
  * @param string $StreamID
  * @return boolean
  */
 public function VerifyStream($UserID, $StreamID)
 {
     //check if UserID and StreamID are vaild
     //
     //return false;
     //if true return guid else return INVALID_CREDENTIALS
     $data = array('UserName' => $UserID, 'streamid' => $StreamID);
     $filters = array('UserName' => array('HtmlEntities', 'StringTrim', 'StripTags'), 'streamid' => array('HtmlEntities', 'StringTrim', 'StripTags'));
     $validators = array('UserName' => array('NotEmpty'), 'streamid' => array('NotEmpty'));
     $input = new Zend_Filter_Input($filters, $validators);
     $input->setData($data);
     if ($input->isValid()) {
         $q = Doctrine_Query::create()->from('Webteam_Model_Video r')->where('r.StreamID = ?', $input->streamid)->addWhere('r.UserName = ?', $input->UserName);
         $result = $q->fetchArray();
         if (count($result) >= 1) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
         //returns false if input is not valid
     }
 }
Exemple #12
0
 private function checkIdFromGet()
 {
     $data = $this->_request->getParams();
     $filters = array('id' => new Zend_Filter_Alnum());
     $validators = array('id' => array('Digits', new Zend_Validate_GreaterThan(0)));
     $input = new Zend_Filter_Input($filters, $validators, $data);
     if ($input->isValid()) {
         $id = $input->id;
         return $id;
     }
     throw new C3op_Projects_ActionException("Invalid Action Id from Get");
 }
 public function loaduserdataAction()
 {
     $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()), "filter_company_name" => array("allowEmpty" => true), "filter_user_name" => array("allowEmpty" => true), "filter_email_address" => array("allowEmpty" => true), "filter_user_category_name" => array("allowEmpty" => true));
     $oInput = new Zend_Filter_Input($aInputFilters, $aInputValidators, $_POST);
     if ($oInput->isValid()) {
         $oModelVUser = new Admin_Model_VUser();
         $nNumRowPerPage = $oInput->getEscaped("num_row_per_page");
         $nCurrPage = $oInput->getEscaped("curr_page");
         $sSortColumn = $oInput->getEscaped("sort_column");
         $sSortMethod = $oInput->getEscaped("sort_method");
         $aFilter = array("company_name" => $oInput->getEscaped("filter_company_name"), "user_name" => $oInput->getEscaped("filter_user_name"), "email_address" => $oInput->getEscaped("filter_email_address"), "user_category_name" => $oInput->getEscaped("filter_user_category_name"));
         $oRowset = $oModelVUser->getAllUser($aFilter, $nNumRowPerPage, ($nCurrPage - 1) * $nNumRowPerPage, $sSortColumn . " " . $sSortMethod);
         $nNumRows = $oModelVUser->getAllUser($aFilter)->count();
         $aJson = array("rowset" => $oRowset->toArray(), "num_rows" => $nNumRows);
         header("Content-type: application/json");
         echo Zend_Json::encode($aJson);
     }
 }
Exemple #14
0
 /**
  * This test doesn't include any assertions as it's purpose is to 
  * ensure that passing an empty array value into a $validators rule 
  * doesn't cause a notice to be emitted
  *  
  * @group ZF-11819
  */
 public function testValidatorRuleCanHaveEmptyArrayAsMetacommandValue()
 {
     $validators = array('perms' => array('Int', 'default' => array()));
     $validate = new Zend_Filter_Input(NULL, $validators);
     $validate->isValid();
 }
Exemple #15
0
 /**
  * @group ZF-7394
  */
 public function testSettingMultipleNotEmptyMessages()
 {
     require_once 'Zend/Validate/NotEmpty.php';
     require_once 'Zend/Validate/Regex.php';
     require_once 'Zend/Validate/StringLength.php';
     $filters = array();
     $validators = array('name' => array('NotEmpty', 'messages' => 'Please enter your name'), 'subject' => array('NotEmpty', 'messages' => 'Please enter a subject'), 'email' => array('EmailAddress', 'messages' => 'Please enter a valid Email address'), 'content' => array('NotEmpty', 'messages' => 'Please enter message contents'));
     $data = array('name' => '', 'subject' => '', 'content' => '');
     $filter = new Zend_Filter_Input($filters, $validators, $data);
     $this->assertFalse($filter->isValid());
     $message = $filter->getMessages();
     $this->assertContains('Please enter your name', $message['name']['isEmpty']);
     $this->assertContains('Please enter a subject', $message['subject']['isEmpty']);
     $this->assertContains('Please enter message contents', $message['content']['isEmpty']);
 }
 /**
  * Save a new testimonial, or changes to an existing testimonial. If it's a new entry the function will return the ID for the record
  *
  * @return int
  */
 protected function _saveQuote()
 {
     $requiredText = new Zend_Validate();
     $requiredText->addValidator(new Zend_Validate_NotEmpty());
     $tagFilter = new Zend_Filter();
     $tagFilter->addFilter(new Zend_Filter_StringTrim());
     $tagFilter->addFilter(new Zend_Filter_StringTrim(','));
     $filters = array('id' => 'Digits', 'title' => 'StringTrim', 'subtitle' => 'StringTrim', 'tags' => $tagFilter);
     $validators = array('id' => array('allowEmpty' => true), 'title' => $requiredText, 'subtitle' => array('allowEmpty' => true), 'tags' => $requiredText);
     $input = new Zend_Filter_Input($filters, $validators, $_POST);
     if ($input->isValid()) {
         $quote = new Datasource_Cms_HeaderQuotes();
         // Data is all valid, formatted and sanitized so we can save it in the database
         if (!$input->id) {
             // This is a new quote so we need to create a new ID
             $quoteID = $quote->addNew($input->getUnescaped('title'), $input->subtitle, $input->tags);
         } else {
             // This is an existing article so we can just update the data
             $quote->saveChanges($input->id, $input->getUnescaped('title'), $input->subtitle, $input->tags);
             $quoteID = $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/header-quotes/edit?id=' . $quoteID);
     } else {
         // Invalid data in form
         /*
         print_r($_POST);
         print_r($input->getErrors());
         print_r($input->getInvalid());
         */
     }
 }
 public function applyAction()
 {
     $this->view->pageTitle = 'Careers';
     if ($this->getRequest()->isPost()) {
         // Handle the cv file and form data
         $filters = array('name' => 'StringTrim', 'tel' => 'StringTrim', 'email' => 'StringTrim', 'enquiry' => 'StringTrim');
         $validators = array('name' => array('NotEmpty', 'messages' => 'Please enter your name'), 'tel' => array('NotEmpty', 'messages' => 'Please enter your telephone number'), 'email' => array('NotEmpty', 'messages' => 'Please enter your email address'), 'enquiry' => array('NotEmpty', 'messages' => 'Please tell us why this position interests you'));
         $input = new Zend_Filter_Input($filters, $validators, $_POST);
         if ($input->isValid()) {
             $upload = new Zend_File_Transfer();
             // Make sure the file is actually a document
             $upload->clearValidators();
             $upload->setOptions(array('ignoreNoFile' => true));
             //$upload->addValidator('MimeType', false, array('application/msword', 'application/pdf', 'application/rtf', 'text/plain'));
             if ($upload->isValid()) {
                 $params = Zend_Registry::get('params');
                 $uploadPath = $params->cms->fileUploadPath;
                 $upload->setDestination($uploadPath);
                 $upload->receive();
                 $fileInfo = $upload->getFileInfo();
                 $emailer = new Application_Core_Mail();
                 $emailer->setTo($params->email->careers, 'HomeLet');
                 $emailer->setFrom($input->email, $input->name);
                 $emailer->setSubject('HomeLet - Job Application (' . $input->position . ')');
                 $bodyHtml = 'Position : ' . $input->position . '<br />';
                 $bodyHtml .= 'Name : ' . $input->name . '<br />';
                 $bodyHtml .= 'Email : ' . $input->email . '<br />';
                 $bodyHtml .= 'Tel : ' . $input->tel . '<br />';
                 $bodyHtml .= 'Enquiry : <pre>' . $input->enquiry . '</pre><br />';
                 if ($fileInfo['cv_file']['type'] !== null) {
                     $emailer->addAttachment($fileInfo['cv_file']['destination'] . '/' . $fileInfo['cv_file']['name'], $fileInfo['cv_file']['name']);
                 }
                 $emailer->setBodyHtml($bodyHtml);
                 if ($emailer->send()) {
                     $this->_helper->redirector('thanks', 'careers');
                 } else {
                 }
             } else {
                 // Invalid file type
                 $this->view->errors = array('cv_file' => 'Invalid file type');
                 $this->view->name = $input->name;
                 $this->view->tel = $input->tel;
                 $this->view->email = $input->email;
                 $this->view->enquiry = $input->enquiry;
             }
         } else {
             // Invalid form data
             $this->view->errors = $input->getMessages();
             $this->view->name = $input->name;
             $this->view->tel = $input->tel;
             $this->view->email = $input->email;
             $this->view->enquiry = $input->enquiry;
         }
     }
     $careerUrl = $this->getRequest()->getParam('careerID');
     $careerID = substr($careerUrl, 0, strpos($careerUrl, '-'));
     $careers = new Datasource_Cms_Careers();
     $career = $careers->getById($careerID);
     $this->view->title = $career['title'];
     $this->view->id = $career['id'];
 }
 protected function _saveVacancy()
 {
     // First of all we need to validate and sanitise the input from the form
     $requiredText = new Zend_Validate();
     $requiredText->addValidator(new Zend_Validate_NotEmpty());
     $filters = array('id' => 'Digits', 'jobTitle' => 'StringTrim', 'reportingTo' => 'StringTrim', 'location' => 'StringTrim', 'startDate' => 'StringTrim', 'endDate' => 'StringTrim', 'jobDescription' => 'StringTrim');
     $validators = array('id' => array('allowEmpty' => true), 'jobTitle' => $requiredText, 'reportingTo' => array('allowEmpty' => true), 'location' => array('allowEmpty' => true), 'startDate' => $requiredText, 'endDate' => $requiredText, 'jobDescription' => 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
         $careers = new Datasource_Cms_Careers();
         if (!$input->id) {
             // This is a new vacancy so we need to create a new ID
             $vacancyID = $careers->addNew($input->jobTitle, $input->reportingto, $input->location, $input->getUnescaped('startDate'), $input->getUnescaped('endDate'), $input->getUnescaped('jobDescription'));
         } else {
             $careers->saveChanges($input->id, $input->jobTitle, $input->reportingTo, $input->location, $input->getUnescaped('startDate'), $input->getUnescaped('endDate'), $input->getUnescaped('jobDescription'));
             $vacancyID = $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/vacancies');
     } else {
         // Invalid data in form
         /*
         print_r($_POST);
         print_r($input->getErrors());
         print_r($input->getInvalid());
         */
     }
 }
Exemple #19
0
 /**
  * Prepares template for saving, validates input data
  *
  * @param   Mage_Newsletter_Model_Template $template
  * @return  array
  */
 protected function _prepareSave(Mage_Newsletter_Model_Template $template)
 {
     $data = array();
     $data['template_code'] = $template->getTemplateCode();
     $data['template_text'] = $template->getTemplateText();
     $data['template_text_preprocessed'] = $template->getTemplateTextPreprocessed();
     $data['template_type'] = (int) $template->getTemplateType();
     $data['template_subject'] = $template->getTemplateSubject();
     $data['template_sender_name'] = $template->getTemplateSenderName();
     $data['template_sender_email'] = $template->getTemplateSenderEmail();
     $data['template_actual'] = !is_null($template->getTemplateActual()) && $template->getTemplateActual() == 0 ? 0 : 1;
     if (!$template->getAddedAt()) {
         $template->setAddedAt(Mage::getSingleton('core/date')->gmtDate());
         $template->setModifiedAt(Mage::getSingleton('core/date')->gmtDate());
     }
     $data['modified_at'] = $template->getModifiedAt();
     $data['added_at'] = $template->getAddedAt();
     if ($this->checkCodeUsage($template)) {
         Mage::throwException(Mage::helper('newsletter')->__('Duplicate of template code'));
     }
     $validators = array('template_code' => array(Zend_Filter_Input::ALLOW_EMPTY => false), 'template_type' => 'Alnum', 'template_sender_email' => 'EmailAddress', 'template_sender_name' => array(Zend_Filter_Input::ALLOW_EMPTY => false));
     $validateInput = new Zend_Filter_Input(array(), $validators, $data);
     if (!$validateInput->isValid()) {
         $errorString = '';
         foreach ($validateInput->getMessages() as $message) {
             if (is_array($message)) {
                 foreach ($message as $str) {
                     $errorString .= $str . "\n";
                 }
             } else {
                 $errorString .= $message . "\n";
             }
         }
         Mage::throwException($errorString);
     }
     return $data;
 }
 /**
  * Save changes to an existing news article, or save a new article in the database. If a new article the function will return the ID.
  *
  * @return int
  */
 private function _saveNewsArticle()
 {
     // First of all we need to validate and sanitise the input from the form
     $requiredText = new Zend_Validate();
     $requiredText->addValidator(new Zend_Validate_NotEmpty());
     // $requiredText->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)));
     $filters = array('id' => 'Digits', 'newsTitle' => 'StringTrim', 'newsDate' => 'StringTrim', 'categoryList' => 'StringTrim');
     $validators = array('id' => array('allowEmpty' => true), 'newsTitle' => $requiredText, 'newsContent' => array('allowEmpty' => true), 'newsDate' => 'NotEmpty', 'categoryList' => 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
         $newsArticle = new Datasource_Cms_News();
         if (!$input->id) {
             // This is a new article so we need to create a new ID
             $newsID = $newsArticle->addNew($input->newsTitle, $input->newsDate, $input->getUnescaped('newsContent'));
         } else {
             // This is an existing article so we can just update the data
             $newsArticle->saveChanges($input->id, $input->newsTitle, $input->newsDate, $input->getUnescaped('newsContent'));
             $newsID = $input->id;
         }
         // Now we need to link the page to the categories selected
         $categoryList = $input->categoryList;
         $newsArticle->saveCategories($newsID, $categoryList);
         // 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/news/edit?id=' . $newsID);
     } else {
         // Invalid data in form
         print_r($_POST);
         print_r($input->getErrors());
         print_r($input->getInvalid());
     }
 }
 /**
  * Action for the Confirmation of a Successful Credit card Payment
  *
  * @return void
  * @todo The company name need to be fetched from branding
  *
  */
 public function ddconfirmationAction()
 {
     $policyNumber = $this->getRequest()->getParam("pn") ? $this->getRequest()->getParam("pn") : $this->_policyNumber;
     $quoteNumber = str_replace('P', 'Q', $policyNumber);
     // Check to see if this quote has already been converted to a policy - if it has we don't want to do any of the below
     $policyManager = new Manager_Insurance_LegacyPolicy();
     $policy = $policyManager->getByPolicyNumber($policyNumber);
     if (is_null($policy)) {
         $refNo = $this->_customerReferenceNumber;
         $params = Zend_Registry::get('params');
         // Set up the validators and filters
         $filters = array();
         $validators = array();
         $request = $this->getRequest();
         $input = new Zend_Filter_Input($filters, $validators, $request->getParams());
         if ($input->isValid()) {
             // Update Pay Status
             $quote = new Manager_Insurance_TenantsContentsPlus_Quote(null, null, $this->_policyNumber);
             $quoteObject = new Model_Insurance_LegacyQuote();
             $quoteObject = $quote->getQuoteObject();
             $quoteObject->startTime = date("h:j:s");
             $quoteObject->payStatus = "UpToDate";
             $quote->update($quoteObject);
             /*$quoteObject->startTime = date("h:j:s");
             		$quoteObject->payStatus = "UpToDate";
             		$quote->update($quoteObject);*/
             $schedule = new Manager_Insurance_Schedule();
             $schedule->save($refNo, $quote);
             $quoteToPolicyManager = new Manager_Insurance_TenantsContentsPlus_QuoteToPolicy();
             $quoteToPolicyManager->changeQuoteToPolicy($quoteNumber);
             //Update the WebLeads
             $webLeadManager = new Manager_Core_WebLead();
             $webLeadSummary = $webLeadManager->getSummary($this->_webLeadSummaryId);
             $webLeadSummary->quoteNumber = $policyNumber;
             $webLeadSummary->status = Model_Core_WebLeadStatus::COMPLETE;
             $webLeadSummary->completedTime = $this->_offsetDate();
             $webLeadManager->updateSummary($webLeadSummary);
             $agentSchemeNumber = Manager_Core_Agent::filterAsn($quote->getAgentSchemeNumber());
             // Transaction is complete unset the Session to prevent navigation to other steps again
             Zend_Session::namespaceUnset('tenants_insurance_quote');
             // Document management stuff, only runs on first conversion of quote -> policy
             $documentManager = new Manager_Insurance_Document();
             $documentManager->createAndPostDocument($policyNumber, Model_Insurance_TenantsContentsPlus_DocumentTypes::NEW_POLICY_DOCS);
             $documentArray = $documentManager->getDocuments($policyNumber, Model_Insurance_TenantsContentsPlus_DocumentTypes::NEW_POLICY_DOCS);
             $firstDocument = $documentArray[0];
             // Put document number in the view, on any later page loads to the same URL this part will not be available for better security
             if (!is_null($firstDocument)) {
                 $this->view->documentNumber = $firstDocument->request_hash;
             }
         }
     } else {
         $agentSchemeNumber = Manager_Core_Agent::filterAsn($policy->agentSchemeNumber);
     }
     $disbursement = new Manager_Core_Disbursement();
     $disbursement->createTermImage($policyNumber);
     $params = Zend_Registry::get('params');
     // Put domain name of the legacy server in the view
     $this->view->domain = $params->homelet->legacyDomain;
     $whiteLabelManager = new Manager_Core_WhiteLabel();
     $whiteLabelData = new Model_Core_WhiteLabel();
     $whiteLabelData = $whiteLabelManager->fetchByAgentSchemeNumber($agentSchemeNumber);
     $this->view->companyName = $whiteLabelData->companyName;
     $this->view->companyName = "HomeLet";
     // Put Policy number in the view
     $this->view->policyNumber = $policyNumber;
     $this->view->openingTimes = $params->cms->openingtimes->insurance->tenants;
     // Extra values passed into view for Google Analytics commerce tracking:
     if (is_null($policy)) {
         $policy = $policyManager->getByPolicyNumber($policyNumber);
     }
     $this->view->policy = $policy;
     // Policy object
     // todo: Fix disgusting way of passing additional data through two chained views.
     $extraVars = new stdClass();
     $monthMultiplier = strtolower($policy->paySchedule) == 'monthly' ? 12 : 1;
     $extraVars->quoteAnnual = $policy->quote * $monthMultiplier;
     $extraVars->iptAnnual = $policy->ipt * $monthMultiplier;
     $this->view->extraVars = $extraVars;
 }
 public function displayAction()
 {
     // set filters and validators for GET input
     $filters = array('id' => array('HtmlEntities', 'StripTags', 'StringTrim'));
     $validators = array('id' => array('NotEmpty', 'Int'));
     // test if input is valid
     // retrieve requested record
     // attach to view
     $input = new Zend_Filter_Input($filters, $validators);
     $input->setData($this->getRequest()->getParams());
     if ($input->isValid()) {
         $q = Doctrine_Query::create()->from('Webteam_Model_Video i')->where('i.VideoID = ?', $input->id);
         $result = $q->fetchArray();
         if (count($result) == 1) {
             $this->view->item = $result[0];
             // initialize logging engine
             $logger = new Zend_Log();
             // add Doctrine writer
             //values on the right represent database attritubtes
             $columnMap = array('message' => 'LogMessage', 'user' => 'UserName', 'videoid' => 'VideoID');
             $dbWriter = new Webteam_Log_Writer_Doctrine('Webteam_Model_Log', $columnMap);
             $logger->addWriter($dbWriter);
             // add additional data to log message
             $auth = Zend_Auth::getInstance();
             $identity = $auth->getIdentity();
             $user = $identity['UserName'];
             $logger->setEventItem('user', $user);
             $logger->setEventItem('videoid', $result[0]['VideoID']);
             // write log message
             $logger->log('user trace', Zend_Log::INFO);
         } else {
             throw new Zend_Controller_Action_Exception('Page not found', 404);
         }
     } else {
         throw new Zend_Controller_Action_Exception('Invalid input');
     }
 }
Exemple #23
0
 /**
  * Data Grid constructor
  * @access public
  * @param Core_DataGrid_DataSource_Interface dataSource
  * @param int limit
  * @param array params
  */
 public function __construct(Core_DataGrid_DataSource_Interface $dataSource = null, $limit = null, array $_params = array())
 {
     $this->setLimit($limit);
     $this->_emptyText = 'dataGridNoRecordsFound';
     $filters = array('direction' => 'alpha', 'page' => 'digits');
     $valids = array('orderBy' => array('allowEmpty' => true), 'direction' => array('Alpha', 'allowEmpty' => true), 'page' => array('int', 'default' => 0));
     Zend_Loader::loadClass('Zend_Filter_Input');
     if (empty($_params)) {
         $_params = Zend_Controller_Front::getInstance()->getRequest()->getParams();
     }
     $input = new Zend_Filter_Input($filters, $valids, $_params);
     if (!$input->isValid()) {
         $errors = '';
         foreach ($input->getMessages() as $messageId => $messages) {
             $message = current($messages);
             $errors .= "'{$messageId}': {$message}\n";
         }
         /**
          * @see Core_DataGrid_Exception
          */
         require_once 'Core/DataGrid/Exception.php';
         throw new Core_DataGrid_Exception('Invalid Parmas for DataGrid: ' . $errors);
     }
     $this->setPage((int) $input->page);
     $this->setOrder(!empty($input->orderBy) ? $input->orderBy : null);
     $this->setDirection(!empty($input->direction) ? $input->direction : null);
     if (null !== $dataSource) {
         $this->setDataSource($dataSource);
     }
     $this->init();
 }
 public function landlordLowdownSignupAction()
 {
     // Throw a 404 error
     throw new Zend_Controller_Action_Exception("This page doesn't exist", 404);
     die;
     // NOT CURRENTLY IN USE
     // @codeCoverageIgnoreStart
     $formInput = array();
     $formInput['email'] = htmlentities($this->getRequest()->getParam('email'));
     // Check e-mail present and valid
     $filters = array('email' => 'StringTrim');
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in email address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid email address'));
     $validators = array('email' => $emailValidator);
     $validate = new Zend_Filter_Input($filters, $validators, $formInput);
     if ($validate->isValid()) {
         // E-mail address valid, instantiate subscription manager using the e-mail address
         $email = $formInput['email'];
         $subscriptionManager = new Manager_Core_Subscription($email);
         // Create subscription
         try {
             $subscriptionManager->subscribe('landlord-lowdown');
             $this->view->content = "Subscribed to Landlord Lowdown with address <em>{$email}</em>.  Please check your e-mail (including any bulk mail filters) to confirm activation of your subscription.";
         } catch (Exception $e) {
             $this->view->content = 'Sorry, we were unable to set up your subscription for the following reason(s):<br /><br />' . $e->getMessage();
         }
     } else {
         // E-mail address didn't validate, show flattened errors
         $allErrors = $validate->getMessages();
         $errors = '';
         foreach ($allErrors as $key => $val) {
             foreach ($val as $subkey => $subval) {
                 $errors .= "{$subval}<br />";
             }
         }
         $this->view->content = 'Sorry, we were unable to set up your subscription for the following reason(s):<br /><br />' . $errors;
     }
     // Disable the layout
     $this->_helper->layout->disableLayout();
     // @codeCoverageIgnoreEnd
 }
 public function testValidatorIsValid()
 {
     $data = array('field1' => 'abc123', 'field2' => 'abcdef');
     $validators = array('field1' => 'alpha', 'field2' => 'alpha');
     $input = new Zend_Filter_Input(null, $validators, $data);
     $this->assertFalse($input->hasMissing(), 'Expected hasMissing() to return false');
     $this->assertTrue($input->hasInvalid(), 'Expected hasInvalid() to return true');
     $this->assertFalse($input->hasUnknown(), 'Expected hasUnknown() to return false');
     $this->assertTrue($input->hasValid(), 'Expected hasValid() to return true');
     $this->assertFalse($input->isValid());
     $this->assertFalse($input->isValid('field1'));
     $this->assertTrue($input->isValid('field2'));
     $input->setData(array('field2' => 'abcdef'));
     $this->assertFalse($input->hasMissing(), 'Expected hasMissing() to return false');
     $this->assertFalse($input->hasInvalid(), 'Expected hasInvalid() to return false');
     $this->assertFalse($input->hasUnknown(), 'Expected hasUnknown() to return false');
     $this->assertTrue($input->hasValid(), 'Expected hasValid() to return true');
     $this->assertTrue($input->isValid());
     $this->assertFalse($input->isValid('field1'));
     $this->assertTrue($input->isValid('field2'));
 }
 /**
  * Save changes to an existing page, or create a new page. If creating a new page the function will return the ID
  *
  * @return int
  */
 protected function _savePage($siteID)
 {
     // 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', 'pageTitle' => 'StringTrim', 'pageURL' => $urlFilter, 'metaKeywords' => 'StringTrim', 'metaDescription' => 'StringTrim', 'template' => 'Digits');
     $validators = array('id' => array('allowEmpty' => true), 'pageTitle' => $requiredText, 'pageURL' => 'NotEmpty', 'metaKeywords' => array('allowEmpty' => true), 'metaDescription' => array('allowEmpty' => true), 'pageContent' => array('allowEmpty' => true), 'template' => 'NotEmpty');
     $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
         $page = new Datasource_Cms_Pages();
         $auth = Zend_Auth::getInstance();
         $auth->setStorage(new Zend_Auth_Storage_Session('hl_admin'));
         $username = $auth->getStorage()->read()->username;
         if (!$input->id) {
             // This is a new page so we need to create a new ID
             $pageID = $page->addNew($siteID, $input->pageTitle, $input->pageURL, $input->getUnescaped('pageContent'), $input->metaKeywords, $input->metaDescription, $input->template);
             // Record activity
             Application_Core_ActivityLogger::log('CMS Page Added', 'complete', 'CMS-Admin', $username, "Page URL: /" . $input->pageURL);
         } else {
             // This is an existing page
             // If the URL is not editable, use the original saved version
             $pageEdit = $page->getByID($input->id);
             if ($pageEdit['urlEditable'] == 0) {
                 $input->pageURL = $pageEdit['url'];
             }
             $page->saveChanges($input->id, $input->pageTitle, $input->pageURL, $input->getUnescaped('pageContent'), $input->metaKeywords, $input->metaDescription, $input->template);
             $pageID = $input->id;
             Application_Core_ActivityLogger::log('CMS Page Edited ', 'complete', 'CMS-Admin', $username, "Page URL: /" . $input->pageURL);
         }
         // Now we need to save any meta data associated with this page
         $metaFields = $page->getMetaFields($pageID);
         // We now have an array that tells us what meta fields are expected and what type they are - so first
         //  we need to make a filter and validator array for them.
         // This could be expanded in the future to allow us to require certain meta data to be entered
         //  if a 'required' flag is set in the meta database.
         $metaFilters = array();
         $metaValidators = array();
         foreach ($metaFields as $metaField) {
             if ($metaField['metaType'] == 'string' || $metaField['metaType'] == 'html' || $metaField['metaType'] == 'icon') {
                 array_push($metaFilters, array($metaField['metaName'] => 'StringTrim'));
                 array_push($metaValidators, array($metaField['metaName'] => array('allowEmpty' => true)));
             }
         }
         $metaInput = new Zend_Filter_Input($metaFilters, $metaValidators, $_POST);
         $metaDataArray = array();
         foreach ($metaFields as $metaField) {
             if ($metaField['metaType'] == 'html') {
                 $metaDataArray[$metaField['metaName']] = $metaInput->getUnescaped($metaField['metaName']);
             } else {
                 $metaDataArray[$metaField['metaName']] = $metaInput->getEscaped($metaField['metaName']);
             }
         }
         $page->saveMeta($pageID, $metaDataArray);
         // 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/pages/edit?id=' . $pageID);
     } else {
         // Invalid data in form
         /*
         print_r($_POST);
         print_r($input->getErrors());
         print_r($input->getInvalid());
         */
     }
 }
Exemple #27
0
 /**
  * Validate Newsletter template
  *
  * @return void
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function validate()
 {
     $validators = ['template_code' => [\Zend_Filter_Input::ALLOW_EMPTY => false], 'template_type' => 'Int', 'template_sender_email' => 'EmailAddress', 'template_sender_name' => [\Zend_Filter_Input::ALLOW_EMPTY => false]];
     $data = [];
     foreach (array_keys($validators) as $validateField) {
         $data[$validateField] = $this->getDataUsingMethod($validateField);
     }
     $validateInput = new \Zend_Filter_Input([], $validators, $data);
     if (!$validateInput->isValid()) {
         $errorMessages = [];
         foreach ($validateInput->getMessages() as $messages) {
             if (is_array($messages)) {
                 foreach ($messages as $message) {
                     $errorMessages[] = $message;
                 }
             } else {
                 $errorMessages[] = $messages;
             }
         }
         throw new \Magento\Framework\Exception\LocalizedException(__(join("\n", $errorMessages)));
     }
 }
Exemple #28
0
 /**
  * Validate and filter data (not used)
  */
 public static function cleanData($data)
 {
     if (!is_array($data)) {
         $data = array($data);
     }
     $filters = array('*' => array('StringTrim', 'HtmlEntities', 'StripTags', 'Alnum'));
     $validators = array('*' => array('NotEmpty', 'presence' => 'required'));
     $input = new Zend_Filter_Input($filters, $validators, $data);
     if ($input->isValid()) {
         // return filtered and escaped data
         $ret = $input->getEscaped();
         return $ret[0];
     }
     return false;
 }
 public function displayAction()
 {
     // set filters and validators for GET input
     $filters = array('id' => array('HtmlEntities', 'StripTags', 'StringTrim'));
     $validators = array('id' => array('NotEmpty', 'Int'));
     $input = new Zend_Filter_Input($filters, $validators);
     $input->setData($this->getRequest()->getParams());
     // test if input is valid
     // retrieve requested record
     // attach to view
     if ($input->isValid()) {
         $q = Doctrine_Query::create()->from('Webteam_Model_Video i')->where('i.VideoID = ?', $input->id);
         $result = $q->fetchArray();
         if (count($result) == 1) {
             $this->view->item = $result[0];
         } else {
             throw new Zend_Controller_Action_Exception('Page not found', 404);
         }
     } else {
         throw new Zend_Controller_Action_Exception('Invalid input');
     }
 }
 /**
  * Action for the Confirmation of a successful direct debit Payment
  *
  * @return void
  */
 public function ddconfirmationAction()
 {
     $pageSession = new Zend_Session_Namespace('landlords_insurance_quote');
     $policyNumber = $this->getRequest()->getParam('pn');
     $quoteNumber = str_replace('Q', 'P', $policyNumber);
     // Check to see if this quote has already been converted to a policy - if it has we don't want to do any of the below
     $policyManager = new Manager_Insurance_LegacyPolicy();
     $policy = $policyManager->getByPolicyNumber($policyNumber);
     // My HomeLet registration/login form and processing
     $this->view->form = $this->registrationFormProcess($policyNumber);
     // Set the completed status of the quote to true
     $this->view->completed = true;
     if (is_null($policy)) {
         $refNo = $this->_customerReferenceNumber;
         // Set up the validators and filters
         $filters = array();
         $validators = array();
         $request = $this->getRequest();
         $input = new Zend_Filter_Input($filters, $validators, $request->getParams());
         if ($input->isValid()) {
             // Update Pay Status
             $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($this->_quoteID);
             $quoteNumber = $quoteManager->getPolicyNumber();
             $schedule = new Manager_Insurance_Schedule();
             $schedule->save($refNo, $quoteManager);
             $quoteToPolicyManager = new Manager_Insurance_LandlordsPlus_QuoteToPolicy();
             $quoteToPolicyManager->changeQuoteToPolicy($quoteNumber);
             //Update the WebLeads
             $session = new Zend_Session_Namespace('landlords_insurance_quote');
             $webLeadManager = new Manager_Core_WebLead();
             $webLeadSummary = $webLeadManager->getSummary($session->webLeadSummaryId);
             $webLeadSummary->quoteNumber = $policyNumber;
             $webLeadSummary->status = Model_Core_WebLeadStatus::COMPLETE;
             $webLeadSummary->completedTime = $this->_offsetDate();
             $webLeadManager->updateSummary($webLeadSummary);
             $agentSchemeNumber = Manager_Core_Agent::filterAsn($quoteManager->getAgentSchemeNumber());
             // Document management stuff, only runs on first conversion of quote -> policy
             $documentManager = new Manager_Insurance_Document();
             $documentManager->createAndPostDocument($policyNumber, Model_Insurance_LandlordsPlus_DocumentTypes::NEW_POLICY_DOCS);
             $documentArray = $documentManager->getDocuments($policyNumber, Model_Insurance_LandlordsPlus_DocumentTypes::NEW_POLICY_DOCS);
             $firstDocument = $documentArray[0];
             // Put the document number into session so that it can be displayed from this action and later in
             // the registration confirmation action
             if (!is_null($firstDocument)) {
                 $pageSession->documentNumber = $firstDocument->request_hash;
             }
         }
         // If a document number exists from before, pass it into the view
         if (isset($pageSession->documentNumber)) {
             $this->view->documentNumber = $pageSession->documentNumber;
         }
         // Extra values passed into view for Google Analytics commerce tracking:
         if (is_null($policy)) {
             $policy = $policyManager->getByPolicyNumber($policyNumber);
         }
         $this->view->policy = $policy;
         // Policy object
         // todo: Fix disgusting way of passing additional data through two chained views.
         $extraVars = new stdClass();
         $monthMultiplier = strtolower($policy->paySchedule) == 'monthly' ? 12 : 1;
         $extraVars->quoteAnnual = $policy->quote * $monthMultiplier;
         $extraVars->iptAnnual = $policy->ipt * $monthMultiplier;
         $this->view->extraVars = $extraVars;
     } else {
         $agentSchemeNumber = Manager_Core_Agent::filterAsn($policy->agentSchemeNumber);
     }
     // Put Policy number in the view
     $this->view->policyNumber = $policyNumber;
     // Fetch the HOMELETUK.COM legacy domain
     // Please don't change this again it is SUPPOSED to be the old crappy php4 box
     // Put domain name of the legacy server in the view
     $this->view->domain = $this->_params->homelet->legacyDomain;
     $whiteLabelManager = new Manager_Core_WhiteLabel();
     $whiteLabelData = new Model_Core_WhiteLabel();
     $whiteLabelData = $whiteLabelManager->fetchByAgentSchemeNumber($agentSchemeNumber);
     $this->view->companyName = $whiteLabelData->companyName;
     $this->view->companyName = "HomeLet";
 }