if (!is_null($faqlanguage)) { $isTranslation = true; $newLanguage = $faqlanguage; } if (PMF_String::substr($contentlink, 7) != "") { $answer = sprintf('%s<br /><div id="newFAQContentLink">%s<a href="http://%s" target="_blank">%s</a></div>', $answer, $PMF_LANG['msgInfo'], PMF_String::substr($contentlink, 7), $contentlink); } $autoActivate = PMF_Configuration::getInstance()->get('records.defaultActivation'); $newData = array('lang' => $isTranslation == true ? $newLanguage : $languageCode, 'thema' => $question, 'active' => $autoActivate ? FAQ_SQL_ACTIVE_YES : FAQ_SQL_ACTIVE_NO, 'sticky' => 0, 'content' => nl2br($answer), 'keywords' => $keywords, 'author' => $name, 'email' => $email, 'comment' => FAQ_SQL_YES, 'date' => date('YmdHis'), 'dateStart' => '00000000000000', 'dateEnd' => '99991231235959', 'linkState' => '', 'linkDateCheck' => 0); if ($isNew) { $categories = $categories['rubrik']; } else { $newData['id'] = $faqid; $categories = $category->getCategoryIdsFromArticle($newData['id']); } $recordId = $faq->addRecord($newData, $isNew); $faq->addCategoryRelations($categories, $recordId, $newData['lang']); // Activate visits $visits = PMF_Visits::getInstance(); $visits->add($recordId, $newData['lang']); if ($autoActivate) { // Add user permissions $faq->addPermission('user', $recordId, -1); $category->addPermission('user', $categories['rubrik'], array(-1)); // Add group permission if ($faqconfig->get('security.permLevel') != 'basic') { $faq->addPermission('group', $recordId, -1); $category->addPermission('group', $categories['rubrik'], array(-1)); } } // Let the PMF Administrator and the Category Owner to be informed by email of this new entry