<div class="col-xs-6"> <table class="table table-bordered table-hover"> <thead> <tr> <th> Id </th> <th>Category Title</th> </tr> <tbody> <?php findAllCategories(); ?> <?php deleteCategories(); ?> </tbody> </thead> </table> </div> </div> </div> <!-- /.row --> </div> <!-- /.container-fluid -->
function EditCategory2() { global $db_prefix, $sourcedir; checkSession(); require_once $sourcedir . '/Subs-Boards.php'; $_POST['cat'] = (int) $_POST['cat']; // Add a new category or modify an existing one.. if (isset($_POST['edit']) || isset($_POST['add'])) { $catOptions = array(); if (isset($_POST['cat_order'])) { $catOptions['move_after'] = (int) $_POST['cat_order']; } // Change "This & That" to "This & That" but don't change "¢" to "&cent;"... $catOptions['cat_name'] = preg_replace('~[&]([^;]{8}|[^;]{0,8}$)~', '&$1', $_POST['cat_name']); $catOptions['is_collapsible'] = isset($_POST['collapse']); if (isset($_POST['add'])) { createCategory($catOptions); } else { modifyCategory($_POST['cat'], $catOptions); } } elseif (isset($_POST['delete']) && !isset($_POST['confirmation']) && !isset($_POST['empty'])) { EditCategory(); return; } elseif (isset($_POST['delete'])) { // First off - check if we are moving all the current boards first - before we start deleting! if (isset($_POST['delete_action']) && $_POST['delete_action'] == 1) { if (empty($_POST['cat_to'])) { fatal_lang_error('mboards_delete_error'); } deleteCategories(array($_POST['cat']), (int) $_POST['cat_to']); } else { deleteCategories(array($_POST['cat'])); } } redirectexit('action=manageboards'); }
$pathParts = trim(isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/', '/'); $pathParts = explode('/', $pathParts); switch ($pathParts[0]) { //2 case 'category': switch ($_SERVER['REQUEST_METHOD']) { case 'GET': if (empty($pathParts[1])) { echo getCategories(); } else { echo getCategory($pathParts[1]); } break; case 'POST': postCategory(); break; case 'DELETE': if (empty($pathParts[1])) { echo "you can delete everthing!!"; } else { deleteCategories($pathParts[1]); } break; case 'UPDATE': if (isset($pathParts[1])) { updateCategory($pathParts[1], $_POST); } } break; } //2
cancelCategory($option); break; case "categories": showCategories($option); break; case "new_category": editCategory(0, $option); break; case "edit_category": editCategory($cid, $option); break; case "save_category": saveCategory($option); break; case "delete_category": deleteCategories($option); break; case "publish_category": publishCategories(1, $option); break; case "unpublish_category": publishCategories(0, $option); break; // SLIDES // SLIDES case "cancel": cancelSlide($option); break; case "slides": showSlides($option); break;
/** * Function for handling a submitted form saving the category. * * What it does: * - complete the modifications to a specific category. * - It also handles deletion of a category. * - It requires manage_boards permission. * - Called by ?action=admin;area=manageboards;sa=cat2 * - Redirects to ?action=admin;area=manageboards. */ public function action_cat2() { checkSession(); validateToken('admin-bc-' . $_REQUEST['cat']); require_once SUBSDIR . '/Categories.subs.php'; $_POST['cat'] = (int) $_POST['cat']; // Add a new category or modify an existing one.. if (isset($_POST['edit']) || isset($_POST['add'])) { $catOptions = array(); if (isset($_POST['cat_order'])) { $catOptions['move_after'] = (int) $_POST['cat_order']; } // Change "This & That" to "This & That" but don't change "¢" to "&cent;"... $catOptions['cat_name'] = preg_replace('~[&]([^;]{8}|[^;]{0,8}$)~', '&$1', $_POST['cat_name']); $catOptions['is_collapsible'] = isset($_POST['collapse']); if (isset($_POST['add'])) { createCategory($catOptions); } else { modifyCategory($_POST['cat'], $catOptions); } } elseif (isset($_POST['delete']) && !isset($_POST['confirmation']) && !isset($_POST['empty'])) { $this->action_cat(); return; } elseif (isset($_POST['delete'])) { // First off - check if we are moving all the current boards first - before we start deleting! if (isset($_POST['delete_action']) && $_POST['delete_action'] == 1) { if (empty($_POST['cat_to'])) { fatal_lang_error('mboards_delete_error'); } deleteCategories(array($_POST['cat']), (int) $_POST['cat_to']); } else { deleteCategories(array($_POST['cat'])); } } redirectexit('action=admin;area=manageboards'); }