Example #1
0
    /**
     * Expected is an array of the structure:
     * array( 0 => array((int)id, (string)langugage, (int) checked)),
     * 	      1 => .....
     * )
     */
    $items = isset($_GET['items']) && is_array($_GET['items']) ? $_GET['items'] : array();
    $faq = new PMF_Faq();
    foreach ($items as $item) {
        if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) {
            print $faq->updateRecordSticky((int) $item[0], addslashes($item[1]), (int) $item[2]);
        }
    }
}
if ('delete_record' == $ajax_action && $permission['delbt']) {
    $record_id = PMF_Filter::filterInput(INPUT_POST, 'record_id', FILTER_VALIDATE_INT);
    $record_lang = PMF_Filter::filterInput(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING);
    adminlog('Beitragdel, ' . $record_id);
    $path = PMF_ROOT_DIR . '/attachments/' . $record_id . '/';
    if (@is_dir($path)) {
        $do = dir($path);
        while ($dat = $do->read()) {
            if ($dat != "." && $dat != "..") {
                unlink($path . $dat);
            }
        }
        rmdir($path);
    }
    $faq->deleteRecord($record_id, $record_lang);
    print $PMF_LANG['ad_entry_delsuc'];
}
             $searchHelper->setSearchterm($searchString);
             echo $searchHelper->renderAdminSuggestionResult($faqSearchResult);
         }
     } else {
         echo $PMF_LANG['err_NotAuth'];
     }
     break;
     // delete FAQs
 // delete FAQs
 case 'delete_record':
     if ($permission['delbt']) {
         $recordId = PMF_Filter::filterInput(INPUT_POST, 'record_id', FILTER_VALIDATE_INT);
         $recordLang = PMF_Filter::filterInput(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING);
         $logging = new PMF_Logging($faqConfig);
         $logging->logAdmin($user, 'Deleted FAQ ID ' . $recordId);
         $faq->deleteRecord($recordId, $recordLang);
         echo $PMF_LANG['ad_entry_delsuc'];
     } else {
         echo $PMF_LANG['err_NotAuth'];
     }
     break;
     // delete open questions
 // delete open questions
 case 'delete_question':
     if ($permission['delquestion']) {
         $checks = array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY);
         $questionIds = PMF_Filter::filterInputArray(INPUT_POST, array('questions' => $checks));
         if (!is_null($questionIds['questions'])) {
             foreach ($questionIds['questions'] as $questionId) {
                 $faq->deleteQuestion((int) $questionId);
             }