Example #1
0
 /**
  * Deletes a comment
  *
  * @param integer $record_id  Record ID
  * @param integer $comment_id Comment ID
  * 
  * @return boolean
  */
 function deleteComment($record_id, $comment_id)
 {
     $oComment = new PMF_Comment();
     return $oComment->deleteComment($record_id, $comment_id);
 }
Example #2
0
 * @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-08-27
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$captcha = new PMF_Captcha($sids);
$oGlossary = new PMF_Glossary();
$oLnk = new PMF_Linkverifier();
$tagging = new PMF_Tags();
$relevant = new PMF_Relation();
$faqrating = new PMF_Rating();
$comment = new PMF_Comment();
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
$currentCategory = $cat;
$record_id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$solution_id = PMF_Filter::filterInput(INPUT_GET, 'solution_id', FILTER_VALIDATE_INT);
$highlight = PMF_Filter::filterInput(INPUT_GET, 'highlight', FILTER_SANITIZE_STRIPPED);
$faqsession->userTracking('article_view', $record_id);
// Get all data from the FAQ record
if (0 == $solution_id) {
    $faq->getRecord($record_id);
} else {
    $faq->getRecordBySolutionId($solution_id);
}
Example #3
0
 * @copyright 2003-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     2003-02-23
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
printf("<h2>%s</h2>\n", $PMF_LANG['ad_entry_aor']);
if ($permission['editbt'] || $permission['delbt']) {
    $categoryRelations = new PMF_Category_Relations();
    $categoryData = new PMF_Category_Tree_DataProvider_SingleQuery($LANGCODE);
    $categoryLayout = new PMF_Category_Layout(new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryData)));
    $linkverifier = new PMF_Linkverifier($user->getLogin());
    $comment = new PMF_Comment();
    $faq = new PMF_Faq();
    if ($linkverifier->isReady()) {
        link_verifier_javascript();
    }
    $cond = $numCommentsByFaq = $numActiveByCat = array();
    $internalSearch = $linkState = $searchterm = '';
    $searchcat = $currentcategory = 0;
    $orderby = 1;
    $sortby = null;
    $linkState = PMF_Filter::filterInput(INPUT_POST, 'linkstate', FILTER_SANITIZE_STRING);
    $searchcat = PMF_Filter::filterInput(INPUT_POST, 'searchcat', FILTER_VALIDATE_INT);
    $searchterm = PMF_Filter::filterInput(INPUT_POST, 'searchterm', FILTER_SANITIZE_STRIPPED);
    if (!is_null($linkState)) {
        $cond[SQLPREFIX . 'faqdata.links_state'] = 'linkbad';
        $linkState = ' checked="checked" ';
Example #4
0
 * @category  phpMyFAQ
 * @package   Administration
 * @author    Thorsten Rinne <*****@*****.**>
 * @copyright 2007-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     2007-03-04
 */
if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
printf("<h2>%s</h2>\n", $PMF_LANG['ad_comment_administration']);
print '<div id="returnMessage"></div>';
if ($permission['delcomment']) {
    $comment = new PMF_Comment();
    $faq = new PMF_Faq();
    $faqcomments = $comment->getAllComments('faq');
    printf("<h3>%s</h3>\n", $PMF_LANG['ad_comment_faqs']);
    if (count($faqcomments)) {
        ?>
    <form id="commentSelection" name="commentSelection" method="post">
    <input type="hidden" name="ajax" value="comment" />
    <input type="hidden" name="ajaxaction" value="delete" />
    <table class="listrecords">
<?php 
        foreach ($faqcomments as $faqcomment) {
            ?>
    <tr id="comments_<?php 
            print $faqcomment['comment_id'];
            ?>
Example #5
0
    $twig->loadTemplate('news/add.twig')->display(array('PMF_LANG' => $PMF_LANG, 'languageSelector' => PMF_Language::selectLanguages($LANGCODE, false, array(), 'langTo'), 'userDisplayName' => $user->getUserData('display_name'), 'userEmail' => $user->getUserData('email')));
} elseif ('news' == $action && $user->perm->checkRight($user->getUserId(), "editnews")) {
    $date = new PMF_Date($faqConfig);
    $newsHeader = $news->getNewsHeader();
    foreach ($newsHeader as $key => $newsItem) {
        $newsHeader[$key]['date'] = $date->format($newsItem['date']);
    }
    $twig->loadTemplate('news/list.twig')->display(array('PMF_LANG' => $PMF_LANG, 'newsHeader' => $newsHeader));
    unset($date, $newsHeader, $key, $newsItem);
} elseif ('editnews' == $action && $user->perm->checkRight($user->getUserId(), 'editnews')) {
    $id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
    $newsData = $news->getNewsEntry($id, true);
    $dateStart = $newsData['dateStart'] != '00000000000000' ? PMF_Date::createIsoDate($newsData['dateStart'], 'Y-m-d') : '';
    $dateEnd = $newsData['dateEnd'] != '99991231235959' ? PMF_Date::createIsoDate($newsData['dateEnd'], 'Y-m-d') : '';
    $newsId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
    $oComment = new PMF_Comment($faqConfig);
    $comments = $oComment->getCommentsData($newsId, PMF_Comment::COMMENT_TYPE_NEWS);
    foreach ($comments as $item) {
        $item['date'] = PMF_Date::createIsoDate($item['date'], 'Y-m-d H:i', false);
    }
    $twig->loadTemplate('news/edit.twig')->display(array('PMF_LANG' => $PMF_LANG, 'comments' => $comments, 'commentType' => PMF_Comment::COMMENT_TYPE_NEWS, 'dateEnd' => $dateEnd, 'dateStart' => $dateStart, 'languageSelector' => PMF_Language::selectLanguages($newsData['lang'], false, array(), 'langTo'), 'newsData' => $newsData));
} elseif ('savenews' == $action && $user->perm->checkRight($user->getUserId(), "addnews")) {
    $dateStart = PMF_Filter::filterInput(INPUT_POST, 'dateStart', FILTER_SANITIZE_STRING);
    $dateEnd = PMF_Filter::filterInput(INPUT_POST, 'dateEnd', FILTER_SANITIZE_STRING);
    $header = PMF_Filter::filterInput(INPUT_POST, 'newsheader', FILTER_SANITIZE_STRIPPED);
    $content = PMF_Filter::filterInput(INPUT_POST, 'news', FILTER_SANITIZE_SPECIAL_CHARS);
    $author = PMF_Filter::filterInput(INPUT_POST, 'authorName', FILTER_SANITIZE_STRIPPED);
    $email = PMF_Filter::filterInput(INPUT_POST, 'authorEmail', FILTER_VALIDATE_EMAIL);
    $active = PMF_Filter::filterInput(INPUT_POST, 'active', FILTER_SANITIZE_STRING);
    $comment = PMF_Filter::filterInput(INPUT_POST, 'comment', FILTER_SANITIZE_STRING);
    $link = PMF_Filter::filterInput(INPUT_POST, 'link', FILTER_VALIDATE_URL);
Example #6
0
 *
 * @category  phpMyFAQ
 * @package   Frontend
 * @author    Thorsten Rinne <*****@*****.**>
 * @author    Matteo Scaramuccia <*****@*****.**>
 * @copyright 2006-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     2006-07-23
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$captcha = new PMF_Captcha($db, $Language);
$comment = new PMF_Comment();
$captcha->setSessionId($sids);
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
$oNews = new PMF_News();
$news_id = PMF_Filter::filterInput(INPUT_GET, 'newsid', FILTER_VALIDATE_INT);
if (is_null($news_id)) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$faqsession->userTracking('news_view', $id);
// Define the header of the page
$writeNewsHeader = $faqconfig->get('main.titleFAQ') . $PMF_LANG['msgNews'];
$writeNewsRSS = '&nbsp;<a href="feed/news/rss.php" target="_blank"><img id="newsRSS" src="images/feed.png" width="16" height="16" alt="RSS" /></a>';
Example #7
0
 * 
 * @category  phpMyFAQ
 * @package   Administration
 * @author    Thorsten Rinne <*****@*****.**>
 * @copyright 2009-2011 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1
 * @link      http://www.phpmyfaq.de
 * @since     2009-03-20
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$ajax_action = PMF_Filter::filterInput(INPUT_POST, 'ajaxaction', FILTER_SANITIZE_STRING);
if ('delete' == $ajax_action && $permission['delcomment']) {
    $comment = new PMF_Comment();
    $checkFaqs = array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY);
    $checkNews = array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY);
    $ret = false;
    $faqComments = PMF_Filter::filterInputArray(INPUT_POST, array('faq_comments' => $checkFaqs));
    $newsComments = PMF_Filter::filterInputArray(INPUT_POST, array('news_comments' => $checkNews));
    if (!is_null($faqComments['faq_comments'])) {
        foreach ($faqComments['faq_comments'] as $commentId => $recordId) {
            $ret = $comment->deleteComment($recordId, $commentId);
        }
    }
    if (!is_null($newsComments['news_comments'])) {
        foreach ($newsComments['news_comments'] as $commentId => $recordId) {
            $ret = $comment->deleteComment($recordId, $commentId);
        }
    }
Example #8
0
 *
 * @category  phpMyFAQ
 * @package   Frontend
 * @author    Thorsten Rinne <*****@*****.**>
 * @author    Matteo Scaramuccia <*****@*****.**>
 * @copyright 2006-2012 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1
 * @link      http://www.phpmyfaq.de
 * @since     2006-07-23
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$captcha = new PMF_Captcha($db, $Language);
$comment = new PMF_Comment();
$captcha->setSessionId($sids);
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
$oNews = new PMF_News($db, $Language);
$newsId = PMF_Filter::filterInput(INPUT_GET, 'newsid', FILTER_VALIDATE_INT);
if (is_null($newsId)) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$faqsession->userTracking('news_view', $id);
// Define the header of the page
$newsMainHeader = $faqconfig->get('main.titleFAQ') . $PMF_LANG['msgNews'];
$newsFeed = '&nbsp;<a href="feed/news/rss.php" target="_blank"><img id="newsRSS" src="images/feed.png" width="16" height="16" alt="RSS" /></a>';
Example #9
0
    $message = array('error' => $PMF_LANG['msgCaptcha']);
}
if (isset($message['error'])) {
    $response->setData($message)->send();
    exit;
}
// Save user generated content
switch ($action) {
    // Comments
    case 'savecomment':
        if (!$faqConfig->get('records.allowCommentsForGuests') && $user->perm->checkRight($user->getUserId(), 'addcomment')) {
            $message = array('error' => $PMF_LANG['err_NotAuth']);
            break;
        }
        $faq = new PMF_Faq($faqConfig);
        $oComment = new PMF_Comment($faqConfig);
        $type = PMF_Filter::filterInput(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
        $faqid = PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT, 0);
        $newsid = PMF_Filter::filterInput(INPUT_POST, 'newsid', FILTER_VALIDATE_INT);
        $username = PMF_Filter::filterInput(INPUT_POST, 'user', FILTER_SANITIZE_STRING);
        $mail = PMF_Filter::filterInput(INPUT_POST, 'mail', FILTER_VALIDATE_EMAIL);
        $comment = PMF_Filter::filterInput(INPUT_POST, 'comment_text', FILTER_SANITIZE_SPECIAL_CHARS);
        switch ($type) {
            case 'news':
                $id = $newsid;
                break;
            case 'faq':
                $id = $faqid;
                break;
        }
        // If e-mail address is set to optional
Example #10
0
 * 
 * @category  phpMyFAQ
 * @package   Administration
 * @author    Thorsten Rinne <*****@*****.**>
 * @copyright 2009-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     2009-03-20
 */
if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$ajax_action = PMF_Filter::filterInput(INPUT_POST, 'ajaxaction', FILTER_SANITIZE_STRING);
if ('delete' == $ajax_action && $permission['delcomment']) {
    $comment = new PMF_Comment();
    $checks = array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY);
    $ret = false;
    $faq_comments = PMF_Filter::filterInputArray(INPUT_POST, array('faq_comments' => $checks));
    $news_comments = PMF_Filter::filterInputArray(INPUT_POST, array('news_comments' => $checks));
    if (!is_null($faq_comments['faq_comments'])) {
        foreach ($faq_comments['faq_comments'] as $record_id => $comment_id) {
            $ret = $comment->deleteComment($record_id, $comment_id);
        }
    }
    if (!is_null($news_comments['news_comments'])) {
        foreach ($news_comments['news_comments'] as $record_id => $comment_id) {
            $ret = $comment->deleteComment($record_id, $comment_id);
        }
    }
    print $ret;
Example #11
0
 * @copyright 2002-2012 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-08-27
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$captcha = new PMF_Captcha($db, $Language);
$oGlossary = new PMF_Glossary();
$oLnk = new PMF_Linkverifier();
$faqTagging = new PMF_Tags($db, $Language);
$faqRelation = new PMF_Relation($db, $Language);
$faqRating = new PMF_Rating();
$faqComment = new PMF_Comment();
if (is_null($user)) {
    $user = new PMF_User_CurrentUser();
}
$faqSearchResult = new PMF_Search_Resultset($user, $faq);
$captcha->setSessionId($sids);
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
$currentCategory = $cat;
$recordId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$solutionId = PMF_Filter::filterInput(INPUT_GET, 'solution_id', FILTER_VALIDATE_INT);
$highlight = PMF_Filter::filterInput(INPUT_GET, 'highlight', FILTER_SANITIZE_STRIPPED);
// Set the FAQ language
$faq->setLanguage($lang);
Example #12
0
 */
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;
}
$captcha = new PMF_Captcha($faqConfig);
$oGlossary = new PMF_Glossary($faqConfig);
$oLnk = new PMF_Linkverifier($faqConfig);
$faqTagging = new PMF_Tags($faqConfig);
$faqRelation = new PMF_Relation($faqConfig);
$faqRating = new PMF_Rating($faqConfig);
$faqComment = new PMF_Comment($faqConfig);
if (is_null($user)) {
    $user = new PMF_User_CurrentUser($faqConfig);
}
$faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig);
$captcha->setSessionId($sids);
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
$currentCategory = $cat;
$recordId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$solutionId = PMF_Filter::filterInput(INPUT_GET, 'solution_id', FILTER_VALIDATE_INT);
// Get all data from the FAQ record
if (0 == $solutionId) {
    $faq->getRecord($recordId);