function cw_faq_get_membership_category() { global $tables; $rubrik_id = cw_query_first_cell("select rubrik_id from {$tables['faq_rubrik']} where title='Customers'"); if (!$rubrik_id) { $rubrik_id = cw_faq_create_rubrik('Customers', 0); } return $rubrik_id; }
<?php cw_load('faq'); if ($action == 'add' && $data['title']) { $rubrik_id = cw_faq_create_rubrik($data['title'], $cat); cw_faq_recalc_counters($cat); cw_header_location('index.php?target=' . $target . '&mode=category&rubrik_id=' . $rubrik_id); } if ($action == 'edit') { db_query("update {$tables['faq_rubrik']} set title='{$data['title']}' where rubrik_id='{$rubrik_id}'"); cw_faq_recalc_counters($rubrik_id); if ($data['parent_id'] >= 0) { db_query("update {$tables['faq_rubrik']} set parent_id='{$data['parent_id']}' where rubrik_id='{$rubrik_id}'"); cw_faq_update_path($rubrik_id); cw_faq_recalc_counters($current_parent); if ($new_parent != $current_parent) { cw_faq_recalc_counters($new_parent); } } cw_header_location('index.php?target=' . $target . '&mode=category&rubrik_id=' . $rubrik_id); } $location[] = array(cw_get_langvar_by_name('lbl_faq_categories'), 'index.php?target=faq_categories'); if (!$rubrik_id) { if ($cat && !cw_faq_is_category($cat)) { cw_header_location('index.php?target=faq_categories'); } $smarty->assign('cat', $cat); $smarty->assign('mode', 'add'); } else { $smarty->assign('all_rubriks', cw_faq_get_all_rubriks($rubrik_id)); $smarty->assign('current_rubrik', cw_faq_get_rubrik($rubrik_id));