/**
  * Constructor
  *
  * @param PMF_Configuration
  *
  * @return PMF_Notification
  */
 public function __construct(PMF_Configuration $config)
 {
     global $PMF_LANG;
     $this->config = $config;
     $this->pmfStr = $PMF_LANG;
     $this->mail = new PMF_Mail($this->config);
     $this->mail->setReplyTo($this->config->get('main.administrationMail'), $this->config->get('main.titleFAQ'));
 }
示例#2
0
        }
        break;
        // Send mails to friends
    // Send mails to friends
    case 'sendtofriends':
        $name = PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
        $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
        $link = PMF_Filter::filterInput(INPUT_POST, 'link', FILTER_VALIDATE_URL);
        $attached = PMF_Filter::filterInput(INPUT_POST, 'message', FILTER_SANITIZE_STRIPPED);
        $mailto = PMF_Filter::filterInputArray(INPUT_POST, array('mailto' => array('filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_REQUIRE_ARRAY | FILTER_NULL_ON_FAILURE)));
        if (!is_null($name) && !empty($name) && !is_null($email) && !empty($email) && is_array($mailto) && !empty($mailto['mailto'][0]) && checkBannedWord(PMF_String::htmlspecialchars($attached))) {
            foreach ($mailto['mailto'] as $recipient) {
                $recipient = trim(strip_tags($recipient));
                if (!empty($recipient)) {
                    $mail = new PMF_Mail();
                    $mail->setReplyTo($email, $name);
                    $mail->addTo($recipient);
                    $mail->subject = $PMF_LANG["msgS2FMailSubject"] . $name;
                    $mail->message = sprintf("%s\r\n\r\n%s\r\n%s\r\n\r\n%s", $faqconfig->get('main.send2friendText'), $PMF_LANG['msgS2FText2'], $link, $attached);
                    // Send the email
                    $result = $mail->send();
                    unset($mail);
                    usleep(250);
                }
            }
            $message = array('success' => $PMF_LANG['msgS2FThx']);
        } else {
            $message = array('error' => $PMF_LANG['err_sendMail']);
        }
        break;
}