* @author Thorsten Rinne <*****@*****.**> * @copyright 2002-2010 phpMyFAQ Team * @license http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1 * @link http://www.phpmyfaq.de * @since 2002-09-16 */ if (!defined('IS_VALID_PHPMYFAQ')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } $recordId = PMF_Filter::filterInput(INPUT_POST, 'artikel', FILTER_VALIDATE_INT, 0); $vote = PMF_Filter::filterInput(INPUT_POST, 'vote', FILTER_VALIDATE_INT); $userIp = PMF_Filter::filterVar($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP); if (isset($vote) && $faq->votingCheck($recordId, $userIp) && $vote > 0 && $vote < 6) { $faqsession->userTracking('save_voting', $recordId); $voting = new PMF_Rating(); $votingData = array('id' => null, 'record_id' => $recordId, 'vote' => $vote, 'date' => $_SERVER['REQUEST_TIME'], 'user_ip' => $userIp); if (!$voting->fetch($recordId)) { $voting->create($votingData); } else { $voting->update($recordId, $votingData); } $tpl->processTemplate('writeContent', array('msgVoteThanks' => $PMF_LANG['msgVoteThanks'])); } elseif (isset($voting) && !$faq->votingCheck($recordId, $userIp)) { $faqsession->userTracking('error_save_voting', $recordId); $tpl->processTemplate('writeContent', array('msgVoteThanks' => $PMF_LANG['err_VoteTooMuch'])); } else { $faqsession->userTracking('error_save_voting', $recordId); $tpl->processTemplate('writeContent', array('msgVoteThanks' => $PMF_LANG['err_noVote'])); } $tpl->includeTemplate('writeContent', 'index');
$minVisits = $_r['visits']; } if ($maxVisits < $_r['visits']) { $maxVisits = $_r['visits']; } if ($record_id == $_r['id'] && $lang == $_r['lang']) { $currVisits = $_r['visits']; } } if ($maxVisits - $minVisits > 0) { $percentage = 100 * ($currVisits - $minVisits) / ($maxVisits - $minVisits); } $faqPopularity = $currVisits . '/' . (int) $percentage . '%'; $translationForm = ''; if (count($arrLanguage) < count(PMF_Language::getAvailableLanguages())) { $translationUrl = sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=translate&cat=%s&id=%d&srclang=%s', $sids, $currentCategory, $record_id, $lang); $translationForm = ' <form action="' . $translationUrl . '" method="post" style="display: inline;"> <img src="images/translate.gif" alt="' . $PMF_LANG['msgTranslate'] . '" title="' . $PMF_LANG['msgTranslate'] . '" width="16" height="16" border="0" /> ' . $PMF_LANG['msgTranslate'] . ' ' . PMF_Language::selectLanguages($LANGCODE, false, $arrLanguage, 'translation') . ' <input class="submit" type="submit" name="submit" value="' . $PMF_LANG['msgTranslateSubmit'] . '" /> </form>'; } // Get rating $recordRating = $faqrating->fetch($record_id); if (!is_null($recordRating)) { $printVoting = sprintf(' %s (%s)', round($recordRating->sumVotings / $recordRating->numVotings, 2), $plr->GetMsg('plmsgVotes', $recordRating->numVotings)); } else { $printVoting = sprintf('0 (%s)', $plr->GetMsg('plmsgVotes', 0)); } // Set the template variables $tpl->processTemplate("writeContent", array('writeRubrik' => $categoryName . '<br />', 'solution_id' => $faq->faqRecord['solution_id'], 'writeThema' => $thema, 'writeArticleCategoryHeader' => $PMF_LANG['msgArticleCategories'], 'writeArticleCategories' => $writeMultiCategories, 'writeContent' => $content, 'writeTagHeader' => $PMF_LANG['msg_tags'] . ': ', 'writeArticleTags' => $tagging->getAllLinkTagsById($record_id), 'writeRelatedArticlesHeader' => $PMF_LANG['msg_related_articles'] . ': ', 'writeRelatedArticles' => $relevant->getAllRelatedById($record_id, $faq->faqRecord['title'], $faq->faqRecord['keywords']), 'writePopularity' => $faqPopularity, 'writeDateMsg' => $PMF_LANG['msgLastUpdateArticle'] . $faq->faqRecord['date'], 'writeRevision' => $PMF_LANG['ad_entry_revision'] . ': 1.' . $faq->faqRecord['revision_id'], 'writeAuthor' => $PMF_LANG['msgAuthor'] . ': ' . $faq->faqRecord['author'], 'editThisEntry' => $editThisEntry, 'writeDiggMsgTag' => 'Digg it!', 'link_digg' => sprintf('http://digg.com/submit?phase=2&url=%s', urlencode($diggItUrl)), 'writeFacebookMsgTag' => 'Share on Facebook', 'link_facebook' => sprintf('http://www.facebook.com/sharer.php?u=%s', urlencode($facebookUrl)), 'link_email' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=send2friend&cat=%d&id=%d&artlang=%s', $sids, $currentCategory, $record_id, $lang), 'link_pdf' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'pdf.php?cat=%d&id=%d&artlang=%s', $currentCategory, $record_id, $lang), 'writePDFTag' => $PMF_LANG['msgPDF'], 'writePrintMsgTag' => $PMF_LANG['msgPrintArticle'], 'writeSend2FriendMsgTag' => $PMF_LANG['msgSend2Friend'], 'translationForm' => $translationForm, 'saveVotingPATH' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=savevoting', $sids), 'saveVotingID' => $record_id, 'saveVotingIP' => $_SERVER['REMOTE_ADDR'], 'msgAverageVote' => $PMF_LANG['msgAverageVote'], 'printVotings' => $printVoting, 'switchLanguage' => $switchLanguage, 'msgVoteUseability' => $PMF_LANG['msgVoteUseability'], 'msgVoteBad' => $PMF_LANG['msgVoteBad'], 'msgVoteGood' => $PMF_LANG['msgVoteGood'], 'msgVoteSubmit' => $PMF_LANG['msgVoteSubmit'], 'writeCommentMsg' => $commentMessage, 'msgWriteComment' => $PMF_LANG['msgWriteComment'], 'writeSendAdress' => '?' . $sids . 'action=savecomment', 'id' => $record_id, 'lang' => $lang, 'msgCommentHeader' => $PMF_LANG['msgCommentHeader'], 'msgNewContentName' => $PMF_LANG['msgNewContentName'], 'msgNewContentMail' => $PMF_LANG['msgNewContentMail'], 'defaultContentMail' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('email') : '', 'defaultContentName' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('display_name') : '', 'msgYourComment' => $PMF_LANG['msgYourComment'], 'msgNewContentSubmit' => $PMF_LANG['msgNewContentSubmit'], 'captchaFieldset' => PMF_Helper_Captcha::getInstance()->renderFieldset($PMF_LANG['msgCaptcha'], $captcha->printCaptcha('writecomment')), 'writeComments' => $comment->getComments($record_id, PMF_Comment::COMMENT_TYPE_FAQ))); $tpl->includeTemplate('writeContent', 'index');