Пример #1
0
 $username = PMF_Filter::filterInput(INPUT_POST, 'user', FILTER_SANITIZE_STRING);
 $mail = PMF_Filter::filterInput(INPUT_POST, 'mail', FILTER_VALIDATE_EMAIL);
 $comment = PMF_Filter::filterInput(INPUT_POST, 'comment_text', FILTER_SANITIZE_SPECIAL_CHARS);
 switch ($type) {
     case 'news':
         $id = $newsid;
         break;
     case 'faq':
         $id = $faqid;
         break;
 }
 // If e-mail address is set to optional
 if (!$faqConfig->get('main.optionalMailAddress') && is_null($mail)) {
     $mail = $faqConfig->get('main.administrationMail');
 }
 if (!is_null($username) && !empty($username) && !empty($mail) && !is_null($mail) && !is_null($comment) && !empty($comment) && $stopwords->checkBannedWord($comment) && !$faq->commentDisabled($id, $languageCode, $type)) {
     try {
         $faqsession->userTracking('save_comment', $id);
     } catch (PMF_Exception $e) {
         // @todo handle the exception
     }
     $commentData = array('record_id' => $id, 'type' => $type, 'username' => $username, 'usermail' => $mail, 'comment' => nl2br($comment), 'date' => $_SERVER['REQUEST_TIME'], 'helped' => '');
     if ($oComment->addComment($commentData)) {
         $emailTo = $faqConfig->get('main.administrationMail');
         $urlToContent = '';
         if ('faq' == $type) {
             $faq->getRecord($id);
             if ($faq->faqRecord['email'] != '') {
                 $emailTo = $faq->faqRecord['email'];
             }
             $faqUrl = sprintf('%s?action=artikel&cat=%d&id=%d&artlang=%s', $faqConfig->get('main.referenceURL'), 0, $faq->faqRecord['id'], $faq->faqRecord['lang']);