$response = sprintf('<p>%s</p>', $plr->GetMsg('plmsgSearchAmount', $faqSearchResult->getNumberOfResults())); $response .= '<ul>'; foreach ($faqSearchResult->getResultset() as $result) { $url = sprintf('/index.php?action=artikel&cat=%d&id=%d&artlang=%s', $result->category_id, $result->id, $result->lang); $oLink = new PMF_Link(PMF_Configuration::getInstance()->get('main.referenceURL') . $url); $oLink->text = PMF_Utils::chopString($result->question, 15); $oLink->itemTitle = $result->question; $response .= sprintf('<li>%s<br /><div class="searchpreview">%s...</div></li>', $oLink->toHtmlAnchor(), PMF_Utils::chopString(strip_tags($result->answer), 10)); } $response .= '</ul>'; $message = array('result' => $response); } 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);
$content = $content . "<br />" . $PMF_LANG["msgInfo"] . "<a href=\"http://" . PMF_String::substr($contentlink, 7) . "\" target=\"_blank\">" . $contentlink . "</a>"; } $newData = array('lang' => $isTranslation == true ? $newLanguage : $LANGCODE, 'thema' => $thema, 'active' => FAQ_SQL_ACTIVE_NO, 'sticky' => 0, 'content' => $content, 'keywords' => $keywords, 'author' => $username, 'email' => $usermail, 'comment' => FAQ_SQL_YES, 'date' => date('YmdHis'), 'dateStart' => '00000000000000', 'dateEnd' => '99991231235959', 'linkState' => '', 'linkDateCheck' => 0); if ($isNew) { $categories = $categories['rubrik']; } else { $newData['id'] = $faqid; $category = new PMF_Category(); $categories = $category->getCategoryIdsFromArticle($newData['id']); } $recordId = $faq->addRecord($newData, $isNew); $faq->addCategoryRelations($categories, $recordId, $newData['lang']); $sent = array(); // Let the PMF Administrator and the Category Owner to be informed by email of this new entry foreach ($categories as $_category) { $userId = $category->getCategoryUser($_category); // 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%';