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'); } // Check display name and e-mail address for not logged in users if (false === $isLoggedIn) { $user = new PMF_User($faqConfig); if (true === $user->checkDisplayName($username) && true === $user->checkMailAddress($mail)) { echo json_encode(array('error' => $PMF_LANG['err_SaveComment'])); break; } } if (!is_null($username) && !empty($username) && !empty($mail) && !is_null($mail) && !is_null($comment) && !empty($comment) && $stopwords->checkBannedWord($comment) && !$faq->commentDisabled($id, $languageCode, $type)) { $faqsession->userTracking("save_comment", $id); $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']; }