本文整理汇总了PHP中deleteCategory函数的典型用法代码示例。如果您正苦于以下问题:PHP deleteCategory函数的具体用法?PHP deleteCategory怎么用?PHP deleteCategory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deleteCategory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteCategory
function deleteCategory($category_id)
{
$result = mysql_query('S' . $category_id);
while ($row = mysql_fetch_array($result)) {
deleteCategory($row["ID"]);
}
}
示例2: deleteCategory
/**
* Delete category
* @param $sCategory - category identificator
* @return $bResult: true - success / false - failure
*/
function deleteCategory($sCategory)
{
$bResult = false;
if (!isEmptyCategory($sCategory)) {
$res = getResult("SELECT `ID` FROM `" . MODULE_DB_PREFIX . "Categories` WHERE `Parent`='" . $sCategory . "'");
for ($i = 0; $i < mysql_num_rows($res); $i++) {
$aCat = mysql_fetch_assoc($res);
$bResult = deleteCategory($aCat['ID']);
}
$res = getResult("SELECT `ID` FROM `" . MODULE_DB_PREFIX . "Files` WHERE `CategoryId`='" . $sCategory . "'");
for ($i = 0; $i < mysql_num_rows($res); $i++) {
$aFile = mysql_fetch_assoc($res);
$bResult = deleteFile($aFile['ID']);
}
} else {
$bResult = true;
}
getResult("DELETE FROM `" . MODULE_DB_PREFIX . "Categories` WHERE `ID`='" . $sCategory . "'");
return $bResult;
}
示例3: trim
if (isset($_POST['button_search'])) {
$search_criteria = trim(strip_tags($_POST['search']));
$arrayCategories = getSearchCategories($search_criteria);
}
if (!empty($_SERVER['QUERY_STRING'])) {
$params = getParams();
if ($params == null) {
header("Location: 403.php");
return;
}
if (count($params) == 0) {
header("Location: 403.php");
return;
}
if (!empty($params['action_delete'])) {
deleteCategory($params['category_id'], 1);
}
}
?>
<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="http://getbootstrap.com/assets/ico/favicon.ico">
<title>Deal Finder</title>
示例4: die
<?php
if (IN_MANAGER_MODE != "true") {
die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the MODx Content Manager instead of accessing this file directly.");
}
$hasPermission = 0;
if ($modx->hasPermission('save_plugin') || $modx->hasPermission('save_snippet') || $modx->hasPermission('save_template') || $modx->hasPermission('save_module')) {
$hasPermission = 1;
}
if ($hasPermission) {
$catId = intval($_GET['catId']);
include_once "categories.inc.php";
deleteCategory($catId);
}
$header = "Location: index.php?a=76";
header($header);
示例5: error_log
break;
case 'delete_project':
if (isset($_POST["id_project"])) {
error_log('delete_project task » ' . $_POST["id_project"]);
if (deleteProject($_POST["id_project"])) {
error_log("project deleted");
deselectProject();
header("HTTP/1.1 302 Redirect");
header("location:home.php");
}
}
break;
case 'delete_category':
if (isset($_POST["id_category"])) {
error_log('delete_category task » ' . $_POST["id_category"]);
if (deleteCategory($_POST["id_category"])) {
error_log("category deleted");
//deselectProject();
header("HTTP/1.1 302 Redirect");
header("location:home.php");
}
}
break;
default:
error_log('undefined action : ' . $_POST["action"]);
break;
}
}
// recup les projets de l'utilisateur connecté
$projects = getUserProjects($_SESSION['id_user']);
// si un projet est sélectionné
示例6: deleteItem
function deleteItem($id)
{
mysql_query("DELETE FROM KK_products\n\t\t\t\t\tWHERE id_KK_products = '{$id}'");
$_SESSION['alert']['text'] = "Produkt został usunięty";
header("location: add_item.html");
}
function usun($id)
{
mysql_query("DELETE FROM KK_carts WHERE id_KK_cart='{$id}' ");
header("location: cart.html");
}
if (isset($_GET['delete'])) {
usun($_GET['delete']);
}
if (isset($_GET['delete_category'])) {
deleteCategory($_GET['delete_category']);
}
if (isset($_GET['delete_item'])) {
deleteItem($_GET['delete_item']);
}
if (!empty($_SESSION["role"])) {
$role = $_SESSION["role"];
} else {
$role = "guest";
}
$zalogowany = $_SESSION["zalogowany"];
$smarty->assign("zalogowany", $zalogowany);
$smarty->assign("role", $role);
$name = $_SESSION["name"];
$smarty->assign("name", $name);
$smarty->assign("strona", $strona);
示例7: findAllCategories
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Id</th>
<th>Category Title</th>
</tr>
</thead>
<tbody>
<?php
findAllCategories();
?>
</tbody>
<?php
deleteCategory();
?>
</table>
</div>
</div>
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
示例8: title
// --------------------------------------------- category pfad
include $REX[INCLUDE_PATH] . "/functions/function_rex_category.inc.php";
title($I18N->msg("title_structure"), $KATout);
// --------------------------------------------- name check $kat_name, $category_name
// --------------------------------------------- category functions
if ($function == "edit_category" && $STRUCTURE_PERM && $edit_id != "") {
$message = $I18N->msg("category_updated");
$KAT->query("update rex_category set name='{$kat_name}' where id='{$edit_id}'");
generateCategory($edit_id);
}
if ($function == "delete_category" && $STRUCTURE_PERM && $edit_id != "") {
$KAT->setQuery("select * from rex_category where re_category_id='{$edit_id}'");
if ($KAT->getRows() == 0) {
$KAT->setQuery("select * from rex_article where category_id='{$edit_id}' and startpage=0");
if ($KAT->getRows() == 0) {
$message = deleteCategory($edit_id);
} else {
$message = $I18N->msg("category_could_not_be_deleted") . " " . $I18N->msg("category_still_contains_articles");
$function = "edit";
}
} else {
$message = $I18N->msg("category_could_not_be_deleted") . " " . $I18N->msg("category_still_contains_subcategories");
$function = "edit";
}
}
if ($function == "status" && $STRUCTURE_PERM && $edit_id != "") {
$KAT->setQuery("select * from rex_category where id='{$edit_id}'");
if ($KAT->getRows() == 1) {
if ($KAT->getValue("status") == 1) {
$KAT->query("update rex_category set status='0' where id='{$edit_id}'");
}
示例9: setCategoryVisibility
} else {
$selected = $_GET['id'];
}
}
if (!empty($_POST['visibility'])) {
$setVisibility = $_POST['visibility'];
$visibility = setCategoryVisibility($blogid, $selected, $setVisibility);
} else {
$visibility = getCategoryVisibility($blogid, $selected);
}
if (!empty($_POST['deleteCategory'])) {
$parent = getParentCategoryId($blogid, $_POST['deleteCategory']);
$selected = is_null($parent) ? 0 : $parent;
$_POST['modifyCategoryName'] = '';
$_POST['modifyCategoryBodyId'] = '';
deleteCategory($blogid, $_POST['deleteCategory']);
}
if (!empty($_POST['direction'])) {
moveCategory($blogid, $selected, $_POST['direction']);
}
if ($selected == 0) {
$depth = 0;
} else {
if (!empty($_GET['name1']) && !empty($_GET['name2'])) {
$depth = 2;
} else {
if (!empty($_GET['name1']) && empty($_GET['name2'])) {
$depth = 1;
} else {
$depth = 0;
}
示例10: getAllCategories
<title></title>
</head>
<body>
<?php
require_once '../../includes/session-start.php';
require_once '../../includes/access-required.html.php';
include_once '../../functions/dbConnect.php';
include_once '../../functions/category-functions.php';
include_once '../../functions/products-functions.php';
include_once '../../functions/until.php';
$categories = getAllCategories();
$results3 = '';
if (isPostRequest()) {
$category_id = filter_input(INPUT_POST, 'category_id');
deleteCategory($category_id);
if (deleteCategory($category_id) == true) {
$results3 = 'Category deleted';
} else {
$results3 = 'Category was not deleted';
}
}
?>
<center>
<h1>Delete Category</h1><br/>
<form method="post" action="#">
<div class="form-group">
<select name="category_id">
<?php
示例11: updateCategory
}
/** UPDATE CATEGORY **/
if (isset($_POST['submit_edit_category'])) {
$category_id = $_POST['category_id'];
$new_category_title = $_POST['category_title'];
if (empty(trim($new_category_title))) {
$update_error_message = "Category title can not be empty";
} else {
updateCategory($category_id, $new_category_title);
$update_success_message = "Category updated successfully";
}
}
/** DELETE CATEGORY **/
if (isset($_GET['delete'])) {
$category_id = $_GET['delete'];
deleteCategory($category_id);
}
?>
<div id="wrapper">
<?php
require "includes/admin_navigation.php";
?>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
示例12: filter_input
<head>
<meta charset="utf-8">
<title>Categories CRUD</title>
<?php
require_once '../../includes/session-start.req-inc.php';
include_once '../../includes/ico.html.php';
include_once '../../functions/dbconnect.php';
include_once '../../functions/category-functions.php';
?>
</head>
<body>
<?php
require_once '../../includes/session-start.req-inc.php';
require_once '../../includes/access-required.html.php';
$id = filter_input(INPUT_GET, 'id');
$isDeleted = deleteCategory($id);
?>
<h1> Record <?php
echo $id;
?>
<?php
if (!$isDeleted) {
?>
Not<?php
}
?>
Deleted
</h1>
示例13: remove_directory
if ($item != "." && $item != "..") {
if (is_dir("{$dir}/{$item}")) {
remove_directory("{$dir}/{$item}");
} else {
unlink("{$dir}/{$item}");
}
}
}
closedir($handle);
rmdir($dir);
}
}
if (isset($chart["chartId"])) {
$dir = "../resources/chart/" . $chart["chartId"];
} else {
if (isset($chart["projectId"])) {
$dir = "../resources/chart/" . $chart["projectId"];
}
}
if (file_exists($dir)) {
remove_directory($dir);
} else {
// todo
// directory has not been existed
}
// edit project if parameters include projectChart.
if (isset($chart["projectChart"])) {
echo editProject($chart);
} else {
echo deleteCategory($chart);
}
示例14: XSRFdefender
if (isset($_POST['action'])) {
XSRFdefender('checkeditems');
if ($_POST['checkallaction'] == 'noaction') {
if (updateItemSortorder('categories', $reports)) {
$reports[] = "<p class='messagebox fade-message'>" . gettext("Sort order saved.") . "</p>";
} else {
$reports[] = "<p class='notebox fade-message'>" . gettext("Nothing changed.") . "</p>";
}
} else {
$action = processZenpageBulkActions('Category');
bulkActionRedirect($action);
}
}
if (isset($_GET['delete'])) {
XSRFdefender('delete_category');
$reports[] = deleteCategory(sanitize($_GET['delete']));
}
if (isset($_GET['hitcounter'])) {
XSRFdefender('hitcounter');
$x = $_zp_zenpage->getCategory(sanitize_numeric($_GET['id']));
$obj = new ZenpageCategory($x['titlelink']);
$obj->set('hitcounter', 0);
$obj->save();
}
if (isset($_GET['publish'])) {
XSRFdefender('update');
$obj = new ZenpageCategory(sanitize($_GET['titlelink']));
$obj->setShow(sanitize_numeric($_GET['publish']));
$obj->save();
}
if (isset($_GET['save'])) {
示例15: array
$page = $_GET['page'];
} else {
$page = 1;
}
$numrows = 20;
$data = array('start' => ($page - 1) * $numrows, 'limit' => $numrows);
$categories = getCategory($data);
$pagination = new Pagination();
$pagination->total = $total_category;
$pagination->page = $page;
$pagination->limit = $numrows;
$pagination->url = "category/page{page}.html";
$pagination = $pagination->render();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['selected'])) {
foreach ($_POST['selected'] as $category_id) {
$delete_query = deleteCategory($category_id);
if ($delete_query) {
$_SESSION['success'] = $lang['success_delete'];
header('Location:category.html');
} else {
$error_warning = $lang['error_query'];
}
}
}
?>
<div id="content">
<div class="breadcrumb">
<a href="home.html"><?php
echo $lang['text_home'];
?>
</a>