Beispiel #1
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
define('USING_LANGUAGE', false);
require_once '../../../config.php';
require_once $config['root_path'] . '/core/functions.php';
include_once $config['system_core'] . "/initEngine.php";
admin_login();
if (isset($_POST['delete']) && isset($_POST['id']) && isset($_SESSION['user']['access']['categories'])) {
    require_once ROOT_PATH . "/apps/categories/models/categories.class.php";
    $cms = new categories();
    $cms->delete(intval($_POST['id']));
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
}
echo json_encode(array_merge($_POST, array('status' => 'unknown error')));
die;
Beispiel #2
0
<?php

if (!isset($_SESSION['admin'])) {
    header('location: Login');
    die;
}
require 'classes/class_categories.php';
$categories = new categories();
// If there are a request to save the categories
if (isset($_POST['save_categories_submit'])) {
    // Saving the categories
    if (isset($_POST['categories'])) {
        $categories->save($_POST['categories']);
    }
    // Adding new category, if admin fill one
    $checked = isset($_POST['checked']) ? 1 : 0;
    if (isset($_POST['name']) && isset($_POST['order']) && !empty($_POST['name']) && !empty($_POST['order'])) {
        $categories->add($_POST['name'], $_POST['order'], $checked);
    }
}
// If there are a request to delete category
if (isset($_GET['d'])) {
    $categories->delete($_GET['d']);
}
// Gets all the categories in array
$categories->get();
require 'design/design_categories.php';