Exemple #1
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
$articles = new articles();
if (!empty($_POST['newsave'])) {
    if ($articles->setWorkContainer($_POST['c']) && $articles->createCategory($_POST['ctitle'], @$_POST['cdesc'], @$_FILES['cicon'], @$_POST['caccess'])) {
        rcms_showAdminMessage(__('Category created'));
    } else {
        rcms_showAdminMessage($articles->last_error);
    }
} elseif (!empty($_POST['delete']) && is_array($_POST['delete']) && !empty($_POST['c']) && $articles->setWorkContainer($_POST['c'])) {
    $result = '';
    foreach ($_POST['delete'] as $id => $cond) {
        if (!empty($cond)) {
            if ($articles->deleteCategory($id)) {
                $result .= __('Category removed') . ' (' . $_POST['c'] . ':' . $id . ')<br/>';
            } else {
                $result .= $articles->last_error . ' (' . $_POST['c'] . ':' . $id . ')<br/>';
            }
        }
    }
    rcms_showAdminMessage($result);
    unset($_POST['edit']);
} elseif (!empty($_POST['b']) && !empty($_POST['c']) && !empty($_POST['save'])) {
    if ($articles->setWorkContainer($_POST['c']) && $articles->editCategory($_POST['b'], $_POST['ctitle'], @$_POST['cdesc'], @$_FILES['cicon'], @$_POST['caccess'], @$_POST['ckillicon'])) {
        rcms_showAdminMessage(__('Category updated'));
    } else {