function sendAskedQuestion($username, $usermail, $usercat, $content) { global $IDN, $category, $PMF_LANG, $faq, $faqconfig; $retval = false; $cat = new PMF_Category(); $categories = $cat->getAllCategories(); if ($faqconfig->get('records.enableVisibilityQuestions')) { $visibility = 'N'; } else { $visibility = 'Y'; } $questionData = array('ask_username' => $username, 'ask_usermail' => $IDN->encode($usermail), 'ask_category' => $usercat, 'ask_content' => $content, 'ask_date' => date('YmdHis'), 'is_visible' => $visibility); list($user, $host) = explode("@", $questionData['ask_usermail']); if (PMF_Filter::filterVar($questionData['ask_usermail'], FILTER_VALIDATE_EMAIL) != false) { $faq->addQuestion($questionData); $questionMail = "User: "******", mailto:" . $questionData['ask_usermail'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categories[$questionData['ask_category']]["name"] . "\n\n" . wordwrap($content, 72); $userId = $category->getCategoryUser($questionData['ask_category']); $oUser = new PMF_User(); $oUser->getUserById($userId); $userEmail = $oUser->getUserData('email'); $mainAdminEmail = $faqconfig->get('main.administrationMail'); $mail = new PMF_Mail(); $mail->unsetFrom(); $mail->setFrom($questionData['ask_usermail'], $questionData['ask_username']); $mail->addTo($mainAdminEmail); // Let the category owner get a copy of the message if ($userEmail && $mainAdminEmail != $userEmail) { $mail->addCc($userEmail); } $mail->subject = '%sitename%'; $mail->message = $questionMail; $retval = $mail->send(); } return $retval; }
function sendAskedQuestion($username, $usermail, $usercat, $content) { global $PMF_LANG, $faq; $retval = false; $faqconfig = PMF_Configuration::getInstance(); $categoryNode = new PMF_Category_Node(); if ($faqconfig->get('records.enableVisibilityQuestions')) { $visibility = 'N'; } else { $visibility = 'Y'; } $questionData = array('id' => null, 'username' => $username, 'email' => $usermail, 'category_id' => $usercat, 'question' => $content, 'date' => date('YmdHis'), 'is_visible' => $visibility); list($user, $host) = explode("@", $questionData['email']); if (PMF_Filter::filterVar($questionData['email'], FILTER_VALIDATE_EMAIL) != false) { $faqQuestions = new PMF_Faq_Questions(); $faqQuestions->create($questionData); $categoryData = $categoryNode->fetch($questionData['category_id']); $questionMail = "User: "******", mailto:" . $questionData['email'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categoryData->name . "\n\n" . wordwrap($content, 72); $userId = $categoryData->user_id; $oUser = new PMF_User(); $oUser->getUserById($userId); $userEmail = $oUser->getUserData('email'); $mainAdminEmail = $faqconfig->get('main.administrationMail'); $mail = new PMF_Mail(); $mail->unsetFrom(); $mail->setFrom($questionData['email'], $questionData['username']); $mail->addTo($mainAdminEmail); // Let the category owner get a copy of the message if ($userEmail && $mainAdminEmail != $userEmail) { $mail->addCc($userEmail); } $mail->subject = '%sitename%'; $mail->message = $questionMail; $retval = $mail->send(); } return $retval; }
$news = $oNews->getNewsEntry($id); if ($news['authorEmail'] != '') { $emailTo = $news['authorEmail']; } $oLink = new PMF_Link(PMF_Link::getSystemUri() . '?action=news&newsid=' . $news['id'] . '&newslang=' . $news['lang']); $oLink->itemTitle = $news['header']; $urlToContent = $oLink->toString(); } $commentMail = 'User: '******'username'] . ', mailto:' . $commentData['usermail'] . "\n" . 'New comment posted on: ' . $urlToContent . "\n\n" . wordwrap($comment, 72); $mail = new PMF_Mail(); $mail->unsetFrom(); $mail->setFrom($commentData['usermail']); $mail->addTo($emailTo); // Let the category owner get a copy of the message if ($emailTo != $faqconfig->get('main.administrationMail')) { $mail->addCc($faqconfig->get('main.administrationMail')); } $mail->subject = '%sitename%'; $mail->message = strip_tags($commentMail); $result = $mail->send(); unset($mail); $message = $PMF_LANG['msgCommentThanks']; } else { $faqsession->userTracking('error_save_comment', $id); $message = $PMF_LANG['err_SaveComment']; } } else { if (!IPCheck($_SERVER['REMOTE_ADDR'])) { $message = $PMF_LANG['err_bannedIP']; } else { $faqsession->userTracking('error_save_comment', $id);
} } else { $questionData = array('username' => $name, 'email' => $email, 'category_id' => $ucategory, 'question' => $question, 'is_visible' => $visibility); $faq->addQuestion($questionData); $questionMail = "User: "******", mailto:" . $questionData['email'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categories[$questionData['category_id']]["name"] . "\n\n" . wordwrap($question, 72) . "\n\n" . $faqconfig->get('main.referenceURL') . '/admin/'; $userId = $cat->getCategoryUser($questionData['category_id']); $oUser = new PMF_User(); $oUser->getUserById($userId); $userEmail = $oUser->getUserData('email'); $mainAdminEmail = PMF_Configuration::getInstance()->get('main.administrationMail'); $mail = new PMF_Mail(); $mail->setReplyTo($questionData['email'], $questionData['username']); $mail->addTo($mainAdminEmail); // Let the category owner get a copy of the message if ($userEmail && $mainAdminEmail != $userEmail) { $mail->addCc($userEmail); } $mail->subject = '%sitename%'; $mail->message = $questionMail; $mail->send(); unset($mail); $message = array('success' => $PMF_LANG['msgAskThx4Mail']); } } else { $message = array('error' => $PMF_LANG['err_SaveQuestion']); } break; case 'saveregistration': $realname = PMF_Filter::filterInput(INPUT_POST, 'realname', FILTER_SANITIZE_STRING); $loginname = PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING); $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
// Let the PMF Administrator and the Category Owner to be informed by email of this new entry foreach ($categories as $category) { $userId = $category->user_id; // Avoid to send multiple emails to the same owner if (!isset($sent[$userId])) { // TODO: Move this code to Category.php $oUser = new PMF_User(); $oUser->getUserById($userId); $catOwnerEmail = $oUser->getUserData('email'); $mail = new PMF_Mail(); $mail->unsetFrom(); $mail->setFrom($usermail); $mail->addTo($faqconfig->get('main.administrationMail')); // Let the category owner get a copy of the message if ($faqconfig->get('main.administrationMail') != $catOwnerEmail) { $mail->addCc($catOwnerEmail); } $mail->subject = '%sitename%'; // TODO: let the email contains the faq article both as plain text and as HTML $mail->message = html_entity_decode($PMF_LANG['msgMailCheck']) . "\n\n" . $faqconfig->get('main.titleFAQ') . ": " . PMF_Link::getSystemUri('/index.php') . '/admin'; $result = $mail->send(); unset($mail); $sent[$userId] = $catOwnerEmail; } } $tpl->processTemplate('writeContent', array('msgNewContentHeader' => $PMF_LANG["msgNewContentHeader"], 'Message' => $isNew ? $PMF_LANG['msgNewContentThanks'] : $PMF_LANG['msgNewTranslationThanks'])); } else { if (false === IPCheck($_SERVER['REMOTE_ADDR'])) { $tpl->processTemplate('writeContent', array('msgNewContentHeader' => $PMF_LANG['msgNewContentHeader'], 'Message' => $PMF_LANG['err_bannedIP'])); } else { if (is_null($faqid)) {