function main()
{
    $action = ReadGETString('action', '');
    switch ($action) {
        case 'add_category':
            AddCategory();
            break;
        case 'delete_category':
            DeleteCategory();
            break;
        case 'list_categories':
            ListCategories();
            break;
        case 'rename_category':
            RenameCategory();
            break;
        default:
            $json_out['status'] = 'fail';
            $json_out['error_code'] = 'Unrecognized action';
            echo json_encode($json_out);
            break;
    }
}
示例#2
0
function DeleteCategory($category_id, $category = null)
{
    global $DB, $ROOT_CATEGORY;
    if ($category == null) {
        $category = $DB->Row('SELECT * FROM lx_categories WHERE category_id=?', array($category_id));
    }
    // Remove cache files
    ClearCategoryCache($category['category_id'], $category['path']);
    ClearCategoryCache($category['parent_id']);
    // Delete all sub-categories
    $result = $DB->Query('SELECT * FROM lx_categories WHERE parent_id=?', array($category_id));
    while ($subcategory = $DB->NextRow($result)) {
        DeleteCategory($subcategory['category_id'], $subcategory);
    }
    $DB->Free($result);
    // Delete all links in this category
    $result = $DB->Query('SELECT * FROM lx_links JOIN lx_link_cats USING (link_id) WHERE category_id=?', array($category_id));
    while ($link = $DB->NextRow($result)) {
        DeleteLink($link['link_id'], FALSE, $link);
    }
    $DB->Free($result);
    // Delete this category
    $DB->Update('DELETE FROM lx_categories WHERE category_id=?', array($category_id));
    // Update subcategory count for parent category
    if ($category['parent_id'] != $ROOT_CATEGORY['parent_id']) {
        UpdateSubcategoryCount($category['parent_id']);
    }
}
示例#3
0
文件: event.php 项目: Maksumys/lab8
     $sth->bind_Param("si", $_POST["textcoments"], $_POST["insertcoment"]);
     $sth->execute();
     $_SESSION["list"] = $tmpl['mainAdmin'];
 } else {
     if (isset($_POST["deletecoment"])) {
         $sth = $mysqli->prepare("DELETE FROM Comments WHERE id = ?");
         $sth->bind_Param("i", $_POST["deletecoment"]);
         $sth->execute();
         $_SESSION["list"] = $tmpl['mainAdmin'];
     } else {
         if ($_POST["selectoption"] == "Категории") {
             //
             list_of_categ($mysqli, $tmpl['list_categ_admin'], $tmpl['search']);
         } else {
             if ($_POST['DeleteCategory']) {
                 DeleteCategory($mysqli, $_POST['select_name_category2']);
                 $_SESSION["list"] = $tmpl['mainAdmin'];
             } else {
                 if ($_POST['AddCategory']) {
                     AddCategory($mysqli, $_POST['new_categ'], $_POST['select_name_category1']);
                     $_SESSION["list"] = $tmpl['mainAdmin'];
                 } else {
                     if ($_POST["selectoption"] == "Пользователи") {
                         list_users($mysqli, $tmpl['usersAdmin']);
                     } else {
                         if ($_POST['selectedUser']) {
                             SelectUser($mysqli, $_POST['selectuser'], $tmpl['user_admin']);
                         } else {
                             if ($_POST['DeleteUser']) {
                                 DeleteUser($mysqli);
                                 $_SESSION["list"] = $tmpl['mainAdmin'];
<TITLE><?php 
msg('CTGR_DEL_PAGE_TITLE');
?>
</TITLE>
<?php 
include 'part_htmlheader.php';
?>
</HEAD>

<BODY>
  <TABLE cellspacing="0" cellpadding="0" align=center border=0 width="670">
    <TR>
      <TD>
        <div class="fixed_height_popup_form" style="background-color: #ffffff;">
        <?php 
DeleteCategory();
?>
        </div>
      </TD>
    </TR>
    <TFOOT>
    <TR>
        <TH><BR><?php 
//
// Insert Page Footer
//
include 'part_footer_popup.php';
?>
</TH>
    </TR>
    </TFOOT>
示例#5
0
文件: ajax.php 项目: hackingman/LinkX
/**
* Delete a category
*/
function lxDeleteCategory()
{
    global $DB, $C, $json;
    VerifyPrivileges(P_CATEGORY_REMOVE, TRUE);
    if (!is_array($_REQUEST['category_id'])) {
        $_REQUEST['category_id'] = array($_REQUEST['category_id']);
    }
    foreach ($_REQUEST['category_id'] as $category_id) {
        DeleteCategory($category_id);
    }
    echo $json->encode(array('status' => JSON_SUCCESS, 'message' => 'The selected categories have been deleted'));
}
示例#6
0
function lxDeleteCategory()
{
    global $DB, $C;
    VerifyPrivileges(P_CATEGORY_REMOVE);
    DeleteCategory($_REQUEST['id']);
    $GLOBALS['message'] = 'The selected category has been deleted';
    lxShBrowse();
}
示例#7
0
<?php

/**
 * Created by PhpStorm.
 * User: Hoan
 * Date: 10/28/2015
 * Time: 7:18 PM
 */
//Khởi động session
session_start();
//Kiểm tra nếu chưa đăng nhập thì quay về trang đăng nhập
if (!isset($_SESSION['user'])) {
    header('location:../user/login.php');
}
require '../../configs/config.php';
require '../../libraries/connect.php';
require '../../models/category.php';
//Lấy category_id từ URL
$category_id = $_GET['category_id'];
//Xóa
DeleteCategory($category_id);
//Quay về trang danh sách danh mục sản phẩm
header('location:list.php');