'cat_name, disp_position', 'INTO' => 'categories', 'VALUES' => '\''.$pun_db->escape($new_cat_name).'\', '.$new_cat_pos ); ($hook = get_hook('acg_qr_add_category')) ? eval($hook) : null; $pun_db->query_build($query) or error(__FILE__, __LINE__); redirect(pun_link($pun_url['admin_categories']), $lang_admin['Category added'].' '.$lang_admin['Redirect']); } // Delete a category else if (isset($_POST['del_cat']) || isset($_POST['del_cat_comply'])) { $cat_to_delete = intval($_POST['cat_to_delete']); if ($cat_to_delete < 1) message($lang_common['Bad request']); // User pressed the cancel button if (isset($_POST['del_cat_cancel'])) redirect(pun_link($pun_url['admin_categories']), $lang_admin['Cancel redirect']); ($hook = get_hook('acg_del_cat_form_submitted')) ? eval($hook) : null; if (isset($_POST['del_cat_comply'])) // Delete a category with all forums and posts { @set_time_limit(0); $query = array( 'SELECT' => 'f.id', 'FROM' => 'forums AS f', 'WHERE' => 'cat_id='.$cat_to_delete ); ($hook = get_hook('acg_qr_get_forums_to_delete')) ? eval($hook) : null; $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); $num_forums = $pun_db->num_rows($result); for ($i = 0; $i < $num_forums; ++$i) { $cur_forum = $pun_db->result($result, $i); // Prune all posts and topics prune($cur_forum, 1, -1); // Delete the forum $query = array( 'DELETE' => 'forums', 'WHERE' => 'id='.$cur_forum ); ($hook = get_hook('acg_qr_delete_forum')) ? eval($hook) : null; $pun_db->query_build($query) or error(__FILE__, __LINE__); } delete_orphans(); // Delete the category $query = array( 'DELETE' => 'categories', 'WHERE' => 'id='.$cat_to_delete ); ($hook = get_hook('acg_qr_delete_category')) ? eval($hook) : null; $pun_db->query_build($query) or error(__FILE__, __LINE__); // Regenerate the quickjump cache require_once PUN_ROOT.'include/cache.php'; generate_quickjump_cache(); redirect(pun_link($pun_url['admin_categories']), $lang_admin['Category deleted'].' '.$lang_admin['Redirect']); } else // If the user hasn't comfirmed the delete { $query = array( 'SELECT' => 'c.cat_name', 'FROM' => 'categories AS c', 'WHERE' => 'c.id='.$cat_to_delete ); ($hook = get_hook('acg_qr_get_category_name')) ? eval($hook) : null; $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); $cat_name = $pun_db->result($result); // Setup breadcrumbs $pun_page['crumbs'] = array( array($pun_config['o_board_title'], pun_link($pun_url['index'])), array($lang_admin['Forum administration'], pun_link($pun_url['admin_index'])), array($lang_admin['Categories'], pun_link($pun_url['admin_categories'])), $lang_admin['Delete category'] ); ($hook = get_hook('acg_del_cat_pre_header_load')) ? eval($hook) : null; define('PUN_PAGE_SECTION', 'start'); define('PUN_PAGE', 'admin-categories'); require PUN_ROOT.'header.php'; ?>
'.$lang_admin['Add category info link text'].'') ?>