Ejemplo n.º 1
0
 /**
  * Returns the single instance
  *
  * @access static
  * @return PMF_Helper_Search
  */
 public static function getInstance()
 {
     if (null == self::$instance) {
         $className = __CLASS__;
         self::$instance = new $className();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
    $tpl->parseBlock('rightBox', 'toptenListError', array('errorMsgTopTen' => $toptenParams['error']));
}
$latestEntriesParams = $faq->getLatest();
if (!isset($latestEntriesParams['error'])) {
    $tpl->parseBlock('rightBox', 'latestEntriesList', array('latestEntriesUrl' => $latestEntriesParams['url'], 'latestEntriesTitle' => $latestEntriesParams['title'], 'latestEntriesPreview' => $latestEntriesParams['preview'], 'latestEntriesDate' => $latestEntriesParams['date']));
} else {
    $tpl->parseBlock('rightBox', 'latestEntriesListError', array('errorMsgLatest' => $latestEntriesParams['error']));
}
if ('artikel' == $action || 'show' == $action || is_numeric($solutionId)) {
    // We need some Links from social networks
    $faqServices = new PMF_Services($faqConfig);
    $faqServices->setCategoryId($cat);
    $faqServices->setFaqId($id);
    $faqServices->setLanguage($lang);
    $faqServices->setQuestion($faq->getRecordTitle($id));
    $faqHelper = new PMF_Helper_Faq($faqConfig);
    $faqHelper->setSsl(isset($_SERVER['HTTPS']) && is_null($_SERVER['HTTPS']) ? false : true);
    $tpl->parseBlock('rightBox', 'socialLinks', array('writePDFTag' => $PMF_LANG['msgPDF'], 'writePrintMsgTag' => $PMF_LANG['msgPrintArticle'], 'writeSend2FriendMsgTag' => $PMF_LANG['msgSend2Friend'], 'shareOnFacebook' => $faqHelper->renderFacebookShareLink($faqServices->getShareOnFacebookLink()), 'shareOnTwitter' => $faqHelper->renderTwitterShareLink($faqServices->getShareOnTwitterLink()), 'link_email' => $faqServices->getSuggestLink(), 'link_pdf' => $faqServices->getPdfLink(), 'facebookLikeButton' => $faqHelper->renderFacebookLikeButton($faqServices->getLink())));
}
$tpl->parse('rightBox', array('writeTopTenHeader' => $PMF_LANG['msgTopTen'], 'writeNewestHeader' => $PMF_LANG['msgLatestArticles'], 'writeTagCloudHeader' => $PMF_LANG['msg_tags'], 'writeTags' => $oTag->printHTMLTagsCloud(), 'msgAllCatArticles' => $PMF_LANG['msgAllCatArticles'], 'allCatArticles' => $faq->showAllRecordsWoPaging($cat)));
if (DEBUG) {
    $tpl->parseBlock('index', 'debugMode', array('debugExceptions' => implode('<br>', $pmfExeptions), 'debugQueries' => $faqConfig->getDb()->log()));
}
//
// Get main template, set main variables
//
$tpl->parse('index', array_merge($tplMainPage, $tplNavigation));
$tpl->merge('rightBox', 'index');
//
// Include requested PHP file
//
    $tpl->parseBlock('rightBox', 'toptenListError', array('errorMsgTopTen' => $toptenParams['error']));
}
$latestEntriesParams = $faq->getLatest();
if (!isset($latestEntriesParams['error'])) {
    $tpl->parseBlock('rightBox', 'latestEntriesList', array('latestEntriesUrl' => $latestEntriesParams['url'], 'latestEntriesTitle' => $latestEntriesParams['title'], 'latestEntriesDate' => $latestEntriesParams['date']));
} else {
    $tpl->parseBlock('rightBox', 'latestEntriesListError', array('errorMsgLatest' => $latestEntriesParams['error']));
}
if ('artikel' == $action || 'show' == $action || is_numeric($solutionId)) {
    // We need some Links from social networks
    $faqServices = new PMF_Services($faqConfig);
    $faqServices->setCategoryId($cat);
    $faqServices->setFaqId($id);
    $faqServices->setLanguage($lang);
    $faqServices->setQuestion($faq->getRecordTitle($id));
    $faqHelper = new PMF_Helper_Faq($faqConfig);
    $faqHelper->setSsl(isset($_SERVER['HTTPS']) && is_null($_SERVER['HTTPS']) ? false : true);
    $tpl->parseBlock('rightBox', 'socialLinks', array('baseHref' => $faqSystem->getSystemUri($faqConfig), 'writeDiggMsgTag' => 'Digg it!', 'writeFacebookMsgTag' => 'Share on Facebook', 'writeTwitterMsgTag' => 'Share on Twitter', 'writePDFTag' => $PMF_LANG['msgPDF'], 'writePrintMsgTag' => $PMF_LANG['msgPrintArticle'], 'writeSend2FriendMsgTag' => $PMF_LANG['msgSend2Friend'], 'link_digg' => $faqServices->getDiggLink(), 'link_facebook' => $faqServices->getShareOnFacebookLink(), 'link_twitter' => $faqServices->getShareOnTwitterLink(), 'link_email' => $faqServices->getSuggestLink(), 'link_pdf' => $faqServices->getPdfLink(), 'facebookLikeButton' => $faqHelper->renderFacebookLikeButton($faqServices->getLink())));
}
$tpl->parse('rightBox', array('writeTopTenHeader' => $PMF_LANG['msgTopTen'], 'writeNewestHeader' => $PMF_LANG['msgLatestArticles'], 'writeTagCloudHeader' => $PMF_LANG['msg_tags'], 'writeTags' => $oTag->printHTMLTagsCloud(), 'msgAllCatArticles' => $PMF_LANG['msgAllCatArticles'], 'allCatArticles' => $faq->showAllRecordsWoPaging($cat)));
$tpl->merge('rightBox', 'index');
//
// Include requested PHP file
//
require_once $includePhp;
//
// Send headers and print template
//
$httpHeader = new PMF_Helper_Http();
$httpHeader->setContentType('text/html');
$httpHeader->addHeader();
Ejemplo n.º 4
0
    }
    if ($maxVisits < $_r['visits']) {
        $maxVisits = $_r['visits'];
    }
    if ($faq->faqRecord['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&amp;cat=%s&amp;id=%d&amp;srclang=%s', $sids, $currentCategory, $faq->faqRecord['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));
}
$faqHelper = PMF_Helper_Faq::getInstance();
// Set the template variables
$tpl->processTemplate("writeContent", array('writeRubrik' => $categoryName . '<br />', 'solution_id' => $faq->faqRecord['solution_id'], 'facebookeLikeButton' => $faqHelper->renderFacebookLikeButton($facebookUrl), 'writeThema' => $thema, 'writeArticleCategoryHeader' => $PMF_LANG['msgArticleCategories'], 'writeArticleCategories' => $writeMultiCategories, 'writeContent' => $content, 'writeTagHeader' => $PMF_LANG['msg_tags'] . ': ', 'writeArticleTags' => $tagging->getAllLinkTagsById($faq->faqRecord['id']), 'writeRelatedArticlesHeader' => $PMF_LANG['msg_related_articles'] . ': ', 'writeRelatedArticles' => $relevant->getAllRelatedById($faq->faqRecord['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&amp;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&amp;cat=%d&amp;id=%d&amp;artlang=%s', $sids, $currentCategory, $faq->faqRecord['id'], $lang), 'link_pdf' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'pdf.php?cat=%d&amp;id=%d&amp;artlang=%s', $currentCategory, $faq->faqRecord['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' => $faq->faqRecord['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' => $faq->faqRecord['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($faq->faqRecord['id'], PMF_Comment::COMMENT_TYPE_FAQ)));
$tpl->includeTemplate('writeContent', 'index');