public function checkAdditionalEmails($additionalEmails)
 {
     foreach ($additionalEmails as $email) {
         if (!Piwik::isValidEmailString($email)) {
             throw new \Exception(Piwik::translate('UsersManager_ExceptionInvalidEmail') . ' (' . $email . ')');
         }
     }
 }
 function validateOwner()
 {
     return Piwik::isValidEmailString($this->owner->getValue());
 }
Example #3
0
 private static function checkAdditionalEmails($additionalEmails)
 {
     foreach ($additionalEmails as &$email) {
         $email = trim($email);
         if (empty($email)) {
             $email = false;
         } elseif (!Piwik::isValidEmailString($email)) {
             throw new Exception(Piwik::translate('UsersManager_ExceptionInvalidEmail') . ' (' . $email . ')');
         }
     }
     $additionalEmails = array_values(array_filter($additionalEmails));
     return $additionalEmails;
 }
Example #4
0
 protected function isValid($email)
 {
     return Piwik::isValidEmailString($email);
 }
Example #5
0
 private function checkEmail($email)
 {
     if ($this->userEmailExists($email)) {
         throw new Exception(Piwik::translate('UsersManager_ExceptionEmailExists', $email));
     }
     if (!Piwik::isValidEmailString($email)) {
         throw new Exception(Piwik::translate('UsersManager_ExceptionInvalidEmail'));
     }
 }
Example #6
-1
 /**
  * send email to Piwik team and display nice thanks
  * @throws Exception
  */
 function sendFeedback()
 {
     $email = Common::getRequestVar('email', '', 'string');
     $body = Common::getRequestVar('body', '', 'string');
     $category = Common::getRequestVar('category', '', 'string');
     $nonce = Common::getRequestVar('nonce', '', 'string');
     $view = new View('@Feedback/sendFeedback');
     $view->feedbackEmailAddress = Config::getInstance()->General['feedback_email_address'];
     try {
         $minimumBodyLength = 40;
         if (strlen($body) < $minimumBodyLength || strpos($email, 'probe@') !== false || strpos($body, '&lt;probe') !== false) {
             throw new Exception(Piwik::translate('Feedback_ExceptionBodyLength', array($minimumBodyLength)));
         }
         if (!Piwik::isValidEmailString($email)) {
             throw new Exception(Piwik::translate('UsersManager_ExceptionInvalidEmail'));
         }
         if (preg_match('/https?:/i', $body)) {
             throw new Exception(Piwik::translate('Feedback_ExceptionNoUrls'));
         }
         if (!Nonce::verifyNonce('Feedback.sendFeedback', $nonce)) {
             throw new Exception(Piwik::translate('General_ExceptionNonceMismatch'));
         }
         Nonce::discardNonce('Feedback.sendFeedback');
         $mail = new Mail();
         $mail->setFrom(Common::unsanitizeInputValue($email));
         $mail->addTo($view->feedbackEmailAddress, 'Piwik Team');
         $mail->setSubject('[ Feedback form - Piwik ] ' . $category);
         $mail->setBodyText(Common::unsanitizeInputValue($body) . "\n" . 'Piwik ' . Version::VERSION . "\n" . 'IP: ' . IP::getIpFromHeader() . "\n" . 'URL: ' . Url::getReferrer() . "\n");
         @$mail->send();
     } catch (Exception $e) {
         $view->errorString = $e->getMessage();
         $view->message = $body;
     }
     return $view->render();
 }