Beispiel #1
0
 /**
  * Send a link to reset the  password to user's email
  * @access public
  * @param int id
  * @return void
  */
 public function sendPassword($id)
 {
     $session = Zend_Registry::get('session');
     $seoOption = Zend_Registry::get('seo');
     $value = $this->getUserBy('id', $id);
     if (!empty($value)) {
         $dotEmail = new Dot_Email();
         $dotEmail->addTo($value['email']);
         $subject = str_replace('%SITENAME%', $seoOption->siteName, $this->option->forgotPassword->subject);
         $dotEmail->setSubject($subject);
         $userToken = Dot_Auth::generateUserToken($value['password']);
         $msg = str_replace(array('%FIRSTNAME%', '%SITE_URL%', '%USERID%', '%TOKEN%'), array($value['firstName'], $this->config->website->params->url, $value['id'], $userToken), $this->option->forgotPassword->message);
         $dotEmail->setBodyText($msg);
         $succeed = $dotEmail->send();
         if ($succeed) {
             $session->message['txt'] = $this->option->infoMessage->emailSent . $value['email'];
             $session->message['type'] = 'info';
         } else {
             $session->message['txt'] = $this->option->errorMessage->emailNotSent . $value['email'];
             $session->message['type'] = 'error';
         }
     } else {
         $session->message['txt'] = $value['email'] . $this->option->infoMessage->emailNotFound;
         $session->message['type'] = 'info';
     }
 }
     $pageTitle = $option->pageTitle->action->home;
 case 'home':
     // call showPage method to view the home page
     $pageView->showPage('home');
     if ($_SERVER['REQUEST_METHOD'] === "POST" && array_key_exists('phone', $_POST) && array_key_exists('phone', $_POST) && array_key_exists('email', $_POST) && array_key_exists('message', $_POST)) {
         // validate the response
         $values = array('email' => array('email' => $_POST['email']), 'details' => array('message' => $_POST['message']));
         //if phone is completed, validate phone to be from US
         if ($_POST['phone'] != '') {
             $values['phone'] = array('phone' => $_POST['phone']);
         }
         $dotValidateUser = new Dot_Validate_User(array('who' => 'mobile', 'action' => 'form', 'values' => $values));
         if ($dotValidateUser->isValid()) {
             //if valid, send a mail
             $data = $dotValidateUser->getData();
             $dotEmail = new Dot_Email();
             $dotEmail->addTo($settings->siteEmail);
             $dotEmail->setSubject($registry->seo->siteName . ' - ' . $option->contactForm->subject);
             $msg = str_replace(array('%EMAIL%', '%PHONE%', '%MESSAGE%', '%DATE%', '%IP%', '%USERAGENT%'), array($data['email'], isset($data['phone']) ? $data['phone'] : '', $data['message'], Dot_Kernel::timeFormat('now'), Dot_Kernel::getUserIp(), $_SERVER['HTTP_USER_AGENT']), $option->contactForm->message);
             $dotEmail->setBodyText($msg);
             $dotEmail->send();
             /** If you want to redirect to a link, 
              *  uncomment the 2 lines below to display a message
              */
             $tpl->setVar('ERROR_MESSAGE', $option->contactForm->mailSent);
         } else {
             $session->message['txt'] = $dotValidateUser->getError();
             $session->message['type'] = 'error';
             $pageView->showPage('home', $dotValidateUser->getData());
         }
     }
Beispiel #3
0
 /**
  * Failed admin login - send email notice to valid admin account
  * @access private
  * @param arry $values
  * @return void
  */
 private function sendEmailFailedLogin($values)
 {
     // get all  admin list
     $emailAdminList = explode(',', $this->settings->devEmails);
     $dotEmail = new Dot_Email();
     // Add each admin
     foreach ($emailAdminList as $emailAdmin) {
         $dotEmail->addTo($emailAdmin);
     }
     $dotEmail->setSubject($this->seo->siteName . ' - ' . $this->option->failedLogin->subject);
     $dotGeoip = new Dot_Geoip();
     $country = $dotGeoip->getCountryByIp(Dot_Kernel::getUserIp());
     $msg = str_replace(array('%LINK%', '%USERNAME%', '%PASSWORD%', '%DATE%', '%COUNTRY%', '%IP%', '%USERAGENT%'), array($this->config->website->params->url . '/' . Zend_Registry::get('requestModule'), $values['username'], $values['password'], Dot_Kernel::timeFormat('now', 'long'), $country[1], Dot_Kernel::getUserIp(), $this->_userAgent), $this->option->failedLogin->message);
     $dotEmail->setBodyText($msg);
     $success = $dotEmail->send();
     return $success;
 }