Example #1
0
function deleteCategory($category_id)
{
    $result = mysql_query('S' . $category_id);
    while ($row = mysql_fetch_array($result)) {
        deleteCategory($row["ID"]);
    }
}
/**
* 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;
}
Example #3
0
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>
<?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);
Example #5
0
            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é
Example #6
0
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);
Example #7
0
                            <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 -->
// --------------------------------------------- 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}'");
        }
Example #9
0
    } 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;
        }
Example #10
0
        <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 
Example #11
0
}
/** 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">
Example #12
0
    <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>
            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);
}
Example #14
0
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'])) {
Example #15
0
    $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>
     }
     $sContents .= makeGroup($sContent, "files");
     break;
     /**
      * Delete categories and then files
      */
 /**
  * Delete categories and then files
  */
 case 'deleteCategories':
     if ($sCategory == "") {
         $bResult = false;
     } else {
         $aCategories = explode(",", $sCategory);
         for ($i = 0; $i < count($aCategories); $i++) {
             $bResult = deleteCategory($aCategories[$i]);
         }
     }
     //break shouldn't be here
     /**
      * Delete files (reported files)
      */
 //break shouldn't be here
 /**
  * Delete files (reported files)
  */
 case 'deleteFiles':
     if ($sFile == "" && $sCategory == "") {
         $sContents = parseXml($aXmlTemplates['result'], "msgErrorDelete", FAILED_VAL);
     } elseif ($sFile != "") {
         $aFiles = explode(",", $sFile);
Example #17
0
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title></title>
        <link href="../../css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <?php 
require_once '../../includes/session-start.req-inc.php';
require_once '../../includes/access-required.html.php';
include_once '../../functions/dbconnect.php';
include_once '../../functions/category_functions.php';
include_once '../../functions/util.php';
$categories = getAllCategories();
if (isPostRequest()) {
    $deleteCategoryID = filter_input(INPUT_POST, 'category_id');
    if (deleteCategory($deleteCategoryID)) {
        $results = 'Category deleted';
        $categories = getAllCategories();
    } else {
        $results = 'Category was not deleted. All products must be deleted first.';
    }
}
?>

        
        <h1>Delete Category</h1>
        
        <?php 
include '../../includes/results.html.php';
?>
               
Example #18
0
    if ($_POST['btn-add-recipe'] == "Delete") {
        $validate = validateCategory($category_id);
        if ($validate['total_recipes'] > 0) {
            ?>
   <script>
   alert("You can't delete this category because this category contains a recipes, please delete all recipes first to perform delete");
   </script>
   <?php 
        } else {
            deleteCategory($category_id);
        }
    } else {
        if ($_POST['btn-add-recipe'] == "GO") {
            if (!empty($array_category_id) and $_POST['listing-option'] == "delete") {
                foreach ($array_category_id as $array_category_id) {
                    deleteCategory($array_category_id);
                }
            }
        }
    }
}
$action = $_REQUEST['action'];
if (empty($action)) {
    $action = "";
} else {
    $action = $_REQUEST['action'];
    if ($action == "added") {
        $msg = "Success added new category";
    } else {
        if ($action == "deleted") {
            $msg = "Success deleted category";
Example #19
0
     finishCategory($_POST['name'], $_POST['parent'], $_POST['image']);
     break;
 case "addBlogEntry":
     addBlogEntry($_POST['blog_category']);
     break;
 case "finishBlogEntry":
     finishBlogEntry($_POST['entry_category'], $_POST['entry_title'], $_POST['entry_text'], $_POST['entry_ext_text']);
     break;
 case "editCategory":
     editCategory($_GET['id']);
     break;
 case "finishEditCategory":
     finishEditCategory($_POST['id'], $_POST['name'], $_POST['parent'], $_POST['image']);
     break;
 case "deleteCategory":
     deleteCategory($_GET['id']);
     break;
 case "edit":
     editBlogEntry($_GET['id']);
     break;
 case "finishEdit":
     finishEditBlogEntry($_POST['id'], $_POST['editBlogCategory'], $_POST['editBlogTitle'], $_POST['editBlogText'], $_POST['editBlogExtText']);
     break;
 case "delete":
     deleteBlogEntry($_GET['id']);
     break;
 case "upload":
     upload($_GET['id'], isset($_GET['error']) ? $_GET['error'] : "");
     break;
 case "finishUpload":
     finishUpload($_POST['blog_id'], $_POST['description'], $_FILES['image_file']['tmp_name'], $_FILES['image_file']['type'], $_FILES['image_file']['size'], $_FILES['image_file']['name']);
 * @package plugins
 * @subpackage zenpage
 */
define("OFFSET_PATH", 4);
require_once dirname(dirname(dirname(__FILE__))) . '/admin-globals.php';
require_once "zenpage-admin-functions.php";
admin_securityChecks(ZENPAGE_NEWS_RIGHTS, currentRelativeURL(__FILE__));
$reports = array();
if (isset($_POST['processcheckeditems'])) {
    XSRFdefender('checkeditems');
    processZenpageBulkActions('Category', $reports);
    updateItemSortorder('categories', $reports);
}
if (isset($_GET['delete'])) {
    XSRFdefender('delete_category');
    $reports[] = deleteCategory($_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'])) {
Example #21
0
     $results = maintCategory();
     $message .= $results[1];
     // If there is redirect information
     // redirect to that page
     if ($results[0] == 'categorymaint') {
         // pass on new messages
         if ($results[1]) {
             $_SESSION['message'] = $results[1];
         }
         header("Location: index.php?content=categorymaint&cat_id={$results['2']}");
         exit;
     }
     break;
 case 'category.delete':
     // process the maint
     $results = deleteCategory();
     $message .= $results[1];
     // If there is redirect information
     // redirect to that page
     if ($results[0] == 'categorydelete') {
         // pass on new messages
         if ($results[1]) {
             $_SESSION['message'] = $results[1];
         }
         header("Location: index.php?content=categorydelete&cat_id={$results['2']}");
         exit;
     }
     break;
 case 'lot.maint':
     // process the maint
     $results = maintLot();
<?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.");
}
if (!$modx->hasPermission('save_plugin') && !$modx->hasPermission('save_snippet') && !$modx->hasPermission('save_template') && !$modx->hasPermission('save_module')) {
    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
}
$id = isset($_GET['catId']) ? intval($_GET['catId']) : 0;
if ($id == 0) {
    $modx->webAlertAndQuit($_lang["error_no_id"]);
}
// Set the item name for logger
$name = $modx->db->getValue($modx->db->select('category', $modx->getFullTableName('categories'), "id='{$id}'"));
$_SESSION['itemname'] = $name;
include_once MODX_MANAGER_PATH . 'includes/categories.inc.php';
deleteCategory($id);
// finished emptying cache - redirect
$header = "Location: index.php?a=76";
header($header);
<?php

include_once __DIR__ . '/templates/_libAdmin.php';
include_once __DIR__ . '/templates/_header.php';
include_once __DIR__ . '/templates/_top_menu.php';
echo "<div class='wr_cont'>";
if (isset($_GET['item_act'])) {
    if (isset($_GET['item_id'])) {
        $t_id = $_GET['item_id'];
    }
    switch ($_GET['item_act']) {
        case 'edit':
            editCategory($connection);
            echo "Категория с id='" . $t_id . "' успешно изменена<br/><br/>";
            break;
        case 'del':
            deleteCategory($t_id, $connection);
            echo "Категория с id='" . $t_id . "' успешно удалена<br/><br/>";
            break;
        case 'add':
            addCategory($connection);
            echo "Категория успешно добавлена<br/><br/>";
            break;
    }
}
//вывод таблицы категорий на странице редактирования категорий
showTableCategories($connection);
echo "</div>";
include_once __DIR__ . '/templates/_footer.php';