Exemple #1
0
 * @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);
        }
    }
    print $ret;
} else {
    print 0;
}
Exemple #2
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);
 }
Exemple #3
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;
}