function cw_faq_delete_rubrik($rubrik_id)
{
    global $tables;
    cw_faq_generate_path($rubrik_id, $path);
    $cats = cw_faq_get_sub_rubriks($rubrik_id);
    $cats[] = $rubrik_id;
    if ($cats) {
        foreach ($cats as $v) {
            $questions = cw_query("select question_id from {$tables['faq_questions']} where rubrik_id='{$rubrik_id}'");
            if ($questions) {
                foreach ($questions as $qn) {
                    cw_faq_delete_question($qn['question_id']);
                }
            }
            db_query($sql = "delete from {$tables['faq_rubrik']} where rubrik_id='{$rubrik_id}'");
        }
    }
    cw_faq_recalc_counters($path);
}
}
if ($mode == 'hide' && is_array($faq_update)) {
    foreach ($faq_update as $id => $_tmp) {
        db_query("update {$tables['faq_questions']} set active = '0' where question_id='{$id}'");
    }
    cw_header_location('index.php?target=faq&mode=questions');
}
if ($mode == 'show' && is_array($faq_update)) {
    foreach ($faq_update as $id => $_tmp) {
        db_query("update {$tables['faq_questions']} set active = '1' where question_id='{$id}'");
    }
    cw_header_location('index.php?target=faq&mode=questions');
}
if ($mode == 'delete' && is_array($faq_update)) {
    foreach ($faq_update as $id => $_tmp) {
        cw_faq_delete_question($id);
    }
    cw_header_location('index.php?target=faq&mode=questions');
}
if (empty($search_data['faq']['sort_field'])) {
    $search_data['faq']['sort_field'] = 'thema';
    $search_data['faq']['sort_direction'] = 1;
}
$data = $search_data['faq'];
$orderbys = array();
$orderbys[] = $data['sort_field'] . " " . ($data['sort_direction'] ? "DESC" : "ASC");
$conditions = array('1');
if (isset($data['active']) && in_array($data['active'], array('1', '0'))) {
    $conditions[] = "d.active = '{$data['active']}'";
}
if ($data['substring']) {