Example #1
0
    $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
//
require_once $includePhp;
//
// Prepate the response
//
$response = Response::create();
//
// Send headers and print template
//
$responseWrapper = new ResponseWrapper($response);
$responseWrapper->addContentTypeHeader('text/html');
$responseWrapper->addCommonHeaders();
$response->setContent($tpl->render());
$response->send();
$faqConfig->getDb()->close();
Example #2
0
use Symfony\Component\HttpFoundation\JsonResponse;
use PMF\Helper\ResponseWrapper;
if (!defined('IS_VALID_PHPMYFAQ')) {
    $protocol = 'http';
    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
        $protocol = 'https';
    }
    header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$ajaxAction = PMF_Filter::filterInput(INPUT_GET, 'ajaxaction', FILTER_SANITIZE_STRING);
$userId = PMF_Filter::filterInput(INPUT_GET, 'user_id', FILTER_VALIDATE_INT);
$usersearch = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
// Send headers
$response = new JsonResponse();
$responseWrapper = new ResponseWrapper($response);
$responseWrapper->addCommonHeaders();
if ($user->perm->checkRight($user->getUserId(), 'adduser') || $user->perm->checkRight($user->getUserId(), 'edituser') || $user->perm->checkRight($user->getUserId(), 'deluser')) {
    $user = new PMF_User($faqConfig);
    switch ($ajaxAction) {
        case 'get_user_list':
            $users = [];
            foreach ($user->searchUsers($usersearch) as $singleUser) {
                $users[] = array('user_id' => $singleUser['user_id'], 'name' => $singleUser['login']);
            }
            $response->setData($users);
            break;
        case 'get_user_data':
            $user->getUserById($userId);
            $userdata = [];
            $userdata = $user->userdata->get('*');