function delete_category($cid) { global $db; $q = $db->prepare("SELECT category_id FROM phph_categories WHERE category_parent = ?"); $r = $db->execute($q, $cid); if (PEAR::isError($r)) { die($r->getMessage()); } while ($row = $r->fetchRow()) { delete_category($row['category_id']); } $q = $db->prepare("DELETE FROM phph_categories WHERE category_id = ?"); $r = $db->execute($q, $cid); if (PEAR::isError($r)) { die($r->getMessage()); } }
function delete_category($filecat) { $rubrics = safe_query("SELECT filecatID FROM " . PREFIX . "files_categorys WHERE subcatID = '" . $filecat . "' ORDER BY name"); if (mysql_num_rows($rubrics)) { while ($ds = mysql_fetch_assoc($rubrics)) { delete_category($ds['filecatID']); } } safe_query("DELETE FROM " . PREFIX . "files_categorys WHERE filecatID='" . $filecat . "'"); $files = safe_query("SELECT * FROM " . PREFIX . "files WHERE filecatID='" . $filecat . "'"); while ($ds = mysql_fetch_array($files)) { if (stristr($ds['file'], "http://") or stristr($ds['file'], "ftp://")) { @unlink('../downloads/' . $ds['file']); } } safe_query("DELETE FROM " . PREFIX . "files WHERE filecatID='" . $filecat . "'"); }
exit; } $id = $_GET['id']; $category = get_category_by_id($id); $tab_category = $dom->get_elements_by_tagname('category'); foreach ($tab_category as $cat) { if ($cat->get_attribute('xml_file') == $category->xml_file) { $node = $cat; } } $parent = $node->parent_node(); $parent->remove_child($node); $dom->dump_file($file); unlink("/etc/ossim/server/" . $category->xml_file); // modify directives.xml now delete_category(str_replace(" ", "-", $category->name)); echo "<html><body onload=\"top.frames['main'].document.location.href='../numbering.php'\"></body></html>"; } elseif ($query == "save_group") { $file = '/etc/ossim/server/groups.xml'; if (!($dom = domxml_open_file($file, DOMXML_LOAD_SUBSTITUTE_ENTITIES))) { echo _("Error while parsing the document") . "\n"; exit; } $group = unserialize($_SESSION['group']); $oldname = $group->name; $oldlist = $group->list; $new_node = $dom->create_element('group'); $new_node->set_attribute("name", $_POST["name"]); $list = split(',', $_POST["list"]); foreach ($list as $dir) { $new_child = $dom->create_element('append-directive');
GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ************************************************************************/ define('OPENLD_ROOT', './'); require OPENLD_ROOT . 'admin_header.php'; $req_page = isset($_REQUEST['page']) ? is_numeric($_REQUEST['page']) ? $_REQUEST['page'] : '1' : '1'; $req_id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '0'; $req_cat = isset($_REQUEST['category']) ? $_REQUEST['category'] : ''; ($hook = get_hook('admin_browse_before_sql_input_check')) ? eval($hook) : null; //SQL Operations if (isset($_REQUEST['delete'])) { delete_category($_REQUEST['delete']); } elseif (isset($_REQUEST['delete_link'])) { delete_link($_REQUEST['delete_link']); } elseif (isset($_REQUEST['move_cat_sql'])) { move_category($req_id, $req_page, $_REQUEST['move_cat_sql'], $_REQUEST['to_new_parent']); } elseif (isset($_REQUEST['move_link_sql'])) { move_link($req_id, $req_page, $_REQUEST['move_link_sql'], $_REQUEST['to_new_parent']); } elseif (isset($_REQUEST['edit_cat_sql'])) { edit_a_category($req_id, $req_page, $_REQUEST['cat_id']); } elseif (isset($_REQUEST['edit_link_sql'])) { edit_a_link($req_id, $req_page, $_REQUEST['edit_link_sql']); } elseif (isset($_REQUEST['add_a_link'])) { add_a_link($req_id); } elseif (isset($_REQUEST['add_a_category'])) { add_a_category($req_id); } elseif (isset($_REQUEST['unaccept'])) {
if ($action == 'deletereceivedfile') { $dropboxfile->deleteReceivedWork($_GET['id']); $message = get_lang('ReceivedFileDeleted'); } if ($action == 'deletesentfile') { $dropboxfile->deleteSentWork($_GET['id']); $message = get_lang('SentFileDeleted'); } Display::display_confirmation_message($message); } // Delete a category if (($action == 'deletereceivedcategory' or $action == 'deletesentcategory') and isset($_GET['id']) and is_numeric($_GET['id'])) { if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } $message = delete_category($action, $_GET['id']); Display::display_confirmation_message($message); } // Do an action on multiple files // only the download has is handled separately in dropbox_init_inc.php because this has to be done before the headers are sent // (which also happens in dropbox_init.inc.php if (!isset($_POST['feedback']) && (strstr($postAction, 'move_received') or $postAction == 'delete_received' or $postAction == 'download_received' or $postAction == 'delete_sent' or $postAction == 'download_sent')) { $display_message = handle_multiple_actions(); Display::display_normal_message($display_message); } // Store Feedback if (isset($_POST['feedback'])) { if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } $check = Security::check_token();
<?php require_once '../../../util/main.php'; require_once '../../../model/database.php'; require_once '../../../model/menu_category_db.php'; $success_notification = ''; $error_notification = ''; if (isset($_POST['id'])) { $ids = $_POST['id']; try { for ($count = 0; $count < count($ids); $count++) { $categoryID = $ids[$count]; delete_category($categoryID); } } catch (Exception $e) { $error_notification = $e->getMessage(); } $success_notification = 'Successfully deleted'; require_once '../../../util/notification.php'; }
$form->assign('is_postAllowed', $forumSettingList['forum_access'] != 0 ? true : false); $dialogBox->form($form->render()); } catch (Exception $ex) { if (claro_debug_mode()) { $dialogBox->error('<pre>' . $ex->__toString() . '</pre>'); } else { $dialogBox->error($ex->getMessage()); } } } else { $dialogBox->warning(get_lang('There are currently no forum categories!') . '<br/>' . get_lang('Please create a category first')); $cmd = 'show'; } } if ('exDelCat' == $cmd) { if (delete_category($catId)) { $dialogBox->success(get_lang('Category deleted')); } else { $dialogBox->error(get_lang('Unable to delete category')); if (claro_failure::get_last_failure() == 'GROUP_FORUMS_CATEGORY_REMOVALE_FORBIDDEN') { $dialogBox->error(get_lang('Group forums category can\'t be deleted')); } elseif (claro_failure::get_last_failure() == 'GROUP_FORUM_REMOVALE_FORBIDDEN') { $dialogBox->error(get_lang('You can not remove a group forum. You have to remove the group first')); } } } if ('exDelForum' == $cmd) { $forumSettingList = get_forum_settings($forumId); if (is_null($forumSettingList['idGroup'])) { if (delete_forum($forumId)) { $dialogBox->success(get_lang('Forum deleted'));
function delete_categories() { $category_id = filter_input(INPUT_POST, 'category_id', FILTER_VALIDATE_INT); delete_category($category_id); header('Location: .?action=list_categories'); }
<input type="reset" value="Clear form" /> <input type="button" value="Cancel" onclick="javascript:window.location='categories.php';" /> </td></tr> </table></form> <?php } /*___________________________________________________________________DELETE__*/ } else { if ($action == 'delete') { if (isset($_GET['id']) && $_GET['id'] != '') { // make sure first that there are no children -- delete them first if (count(get_enth_category_children($_GET['id'])) == 0) { $cat = get_category_name($_GET['id']); $success = delete_category($_GET['id']); if ($success) { echo '<p class="success">Category <i>' . $cat . '</i> deleted.</p>'; } else { echo '<p class="error">Error deleting category. ' . 'Please try again.</p>'; } } else { echo '<p class="error">There are categories that are assigned as ' . 'children to this category. Please delete them before ' . 'attempting to delete this category.</p>'; } } /*_____________________________________________________________________EDIT__*/ } else { if ($action == 'edit') { $show_edit_form = true; $show_default = false; if (isset($_POST['catname']) && $_POST['catname'] != '') {
<?php // include function files for this application //session_start(); do_html_header('Deleting category'); if (check_admin_user()) { if (isset($_POST['catid'])) { if (delete_category($_POST['catid'])) { echo 'Category was deleted.<br />'; } else { echo 'Category could not be deleted.<br />' . 'This is usually because it is not empty.<br />'; } } else { echo 'No category specified. Please try again.<br />'; } do_html_url(baseurl() . 'cart/admin', 'Back to administration menu'); } else { echo 'You are not authorised to view this page.'; }
function change_categories() { global $user, $current_user, $globals; $errors = 0; $ncat = 0; if( !(isset($_POST['new']) || isset($_POST['delete'])) || !isset($_POST['process']) || $_POST['user_id'] != $current_user->user_id ) return; if (isset($_POST['delete'])) { delete_category(array_keys($_POST['delete'])); } elseif (isset($_POST['new_cat'])) { insert_category(trim($_POST['new_cat']), trim($_POST['new_parent']), trim($_POST['new_feed']), trim($_POST['new_tags'])); } else { foreach (array_keys($_POST['new_cat-edit']) as $key) { $category->id[$ncat]=trim($key); $ncat++; } $ncat=0; foreach ($_POST['new_cat-edit'] as $catitem) { $category->name[$ncat]=trim($catitem); $ncat++; } $ncat=0; foreach ($_POST['new_parent-edit'] as $catparent) { $category->parent[$ncat]=intval($catparent); $ncat++; } $ncat=0; foreach ($_POST['new_feed-edit'] as $catfeed) { $category->feed[$ncat]=htmlspecialchars(trim($catfeed)); $ncat++; } $ncat=0; foreach ($_POST['new_tags-edit'] as $cattags) { $category->tags[$ncat]=trim($cattags); $ncat++; } if ( !(empty($_POST['new_cat-edit']) || empty($_POST['new-cat'])) ) { $errors = 1; echo '<p class="form-error">'._('No ha introducido ninguna categoría nueva').'</p>'; } if ( empty($_POST['new_tags-edit']) ) { $errors = 1; echo '<p class="form-error">'._('No ha introducido ninguna etiqueta').'</p>'; } if (!$errors) { save_categories($category); echo '<p class="form-act">'._('Datos actualizados').'</p>'; } } }
<?php include_once '../functions/database.php'; $id = $_POST['id']; $result = delete_category($id); echo $result;
if(isset($_POST['text'])){ edit_delivery_times($_POST['text']); } require "templates/admin/edit-delivery-times.php"; } else if($_GET['action'] == 'edit_delivery_method'){ if(isset($_POST['text'])){ edit_delivery_method($_POST['text']); } require "templates/admin/edit-delivery-method.php"; } else if($_GET['action'] == 'delete_category'){ if(isset($_POST['id'])){ delete_category($_POST['id']); } require "templates/admin/delete-category.php"; } else if($_GET['action'] == 'delete_account'){ if(isset($_POST['id'])){ delete_account($_POST['id']); } require "templates/admin/delete-account.php"; } else if($_GET['action'] == 'ban_account'){ if(isset($_POST['id'])){ ban_account($_POST['id']); }
<?php include_once 'config.php'; include_once 'func.php'; $connection = connect_db(); if (isset($_POST['id'])) { delete_category($connection, $_POST['id']); } $result = get_category($connection); ?> <!DOCTYPE HTML> <html> <head> <title>Remove Category</title> </head> <body> <div> <form action="" method="post"> <div> <div> <select name="id"> <?php while ($row = mysqli_fetch_assoc($result)) { ?> <option value="<?php echo $row['id']; ?> "><?php echo $row['name']; ?>
} } // edit category if (isset($_POST['edit_category']) && $_POST['edit_category'] == 'edit') { $category_id = (int) $_GET['category_id']; $update_status = update_category($category_id); if ($update_status === true) { header('Location: ' . $url); } else { $error = $update_status; } } // delete category if (isset($_POST['confirm_delete_category']) && $_POST['confirm_delete_category'] == 'Yes') { $category_id = (int) $_GET['category_id']; $delete_status = delete_category($category_id); if ($delete_status === true) { $reload = $_SERVER["PHP_SELF"] . '?page_name=categories'; header('Location: ' . $reload); } else { $error = $delete_status; } } // cancel delete tag if (isset($_POST['cancel_delete_category']) && $_POST['cancel_delete_category'] == 'No') { $category_id = (int) $_GET['category_id']; header('Location: ' . $_SERVER["PHP_SELF"] . '?page_name=categories&category_id=' . $category_id); } // category list $categories_list = get_categories_admin(); // get main content
<?php /*************************category Insert***********************/ if (!empty($_POST['submit'])) { $insert_category = add_category($_POST['category_name'], $_POST['category_code_slug']); if ($insert_category == 1) { $message = "Category has been added."; } else { $errormessage = "Something wrong. Please Try Again!!"; } } /*************************end category Insert***********************/ $all_category = all_category(); //show all category /**************************Category delete***********************/ if (!empty($_GET['delete'])) { $delete_category = delete_category($_GET['delete']); if ($delete_category == 1) { header('Location:category.php'); } else { $errormessage = "Something wrong. Please try again!!."; } } /**************************Category delete***********************/ ?> <div id="page-wrapper"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header">Manage Category</h1>
function delete() { global $Register, $FpsDB; $id = !empty($_GET['id']) ? intval($_GET['id']) : 0; if ($id < 1) { redirect('/admin/category.php?mod=' . getCurrMod()); } $model = $Register['ModManager']->getModelInstance(getCurrMod() . 'Categories'); $total = $model->getTotal(); if ($total <= 1) { $_SESSION['errors'] = $Register['DocParser']->wrapErrors(__('You can\'t remove the last category'), true); redirect('/admin/category.php?mod=' . getCurrMod()); } $childrens = $model->getCollection(array('parent_id' => $id)); if (!$childrens) { delete_category($id); } else { foreach ($childrens as $category) { delete_category($category->getId()); delete($category->getId()); } $category->delete(); } redirect('/admin/category.php?mod=' . getCurrMod()); }
/** * Include users */ include $config['template_path'] . "admin/users.php"; } else { if ($action == "categories") { if (isset($_GET['delete'])) { // What method should we use? if ($_GET['method'] == "all") { $method = "all"; } else { if (alpha($_GET['method'], 'numeric')) { $method = $_GET['method']; } } $result = delete_category($_GET['delete'], $method); // Check to see if category was deleted or not if ($result === "INVALID_ID") { $error = lang_parse('error_invalid_given', array(lang('id'))); } else { if ($result === "INVALID_METHOD") { $error = lang_parse('error_invalid_given', array(lang('method'))); } else { if ($result === "INVALID_CATEGORY") { $error = lang_parse('error_invalid_given', array(lang('category'))); } else { if ($result === "DELETING_CATEGORY") { $error = lang('error_deleting_cat'); } else { if ($result == "DELETING_POSTS") { $error = lang('error_deleting_posts');
require 'lib/common.php'; if (!admin()) { header("location: login.php"); } require 'inc/header.php'; require 'inc/menu.php'; if (empty($_GET['cat'])) { $category = 0; } else { $category = $_GET['cat']; } if (isset($_POST['insert_cat'])) { insert_category($_POST['category'], $category); } if (isset($_GET['deletecat'])) { delete_category($_GET['deletecat']); } ?> <div class='col-12'> <h1>Categories</h1> <?php $sql = "SELECT * FROM Categories WHERE parent_cat = ?"; $stm = $conn->prepare($sql); $stm->execute(array($cat)); $category = $stm->fetchAll(); ?> <ul class='list-group'>
$selectedState = ''; } $catSelectBox .= '<option value="' . $thisFormCategory['cat_id'] . '"' . $selectedState . '>' . htmlspecialchars($thisFormCategory['cat_title']) . '</option>'; } $catSelectBox .= '</select><br />' . "\n"; } else { $catSelectBox = ''; } $formForumNameValue = isset($_REQUEST['forumName']) ? $_REQUEST['forumName'] : $forumSettingList['forum_name']; $formForumDescriptionValue = isset($_REQUEST['forumDesc']) ? $_REQUEST['forumDesc'] : $forumSettingList['forum_desc']; $formForumPostUnallowedState = $_REQUEST['cmd'] == 'exEdForum' ? isset($_REQUEST['forumPostUnallowed']) ? ' checked="checked" ' : '' : ($forumSettingList['forum_access'] == 0 ? ' checked="checked" ' : ''); $htmlEditForum = '<strong>' . get_lang('Edit forum') . '</strong>' . "\n" . '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="cmd" value="exEdForum" />' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . '<input type="hidden" name="forumId" value="' . $forumSettingList['forum_id'] . '" />' . "\n" . '<label for="forumName">' . get_lang('Name') . ': </label><br />' . "\n" . '<input type="text" name="forumName" id="forumName"' . ' value="' . htmlspecialchars($formForumNameValue) . '" /><br />' . "\n" . '<label for="forumDesc">' . get_lang('Description') . ' : </label><br />' . "\n" . '<textarea name="forumDesc" id="forumDesc" cols="50" rows="3">' . "\n" . htmlspecialchars($formForumDescriptionValue) . '</textarea><br />' . "\n" . $catSelectBox . "\n" . '<br />' . "\n" . '<input type="checkbox" id="forumPostUnallowed" name="forumPostUnallowed" ' . $formForumPostUnallowedState . ' />' . "\n" . '<label for="forumPostUnallowed">' . get_lang('Locked') . ' <small>(' . get_lang('No new post allowed') . ')</small></label><br />' . "\n" . '<br />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" /> ' . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . '</form>' . "\n\n"; $dialogBox->form($htmlEditForum); } if ($cmd == 'exDelCat') { if (delete_category($_REQUEST['catId'])) { $dialogBox->success(get_lang('Category deleted')); } else { $dialogBox->error(get_lang('Unable to delete category')); if (claro_failure::get_last_failure() == 'GROUP_FORUMS_CATEGORY_REMOVALE_FORBIDDEN') { $dialogBox->error(get_lang('Group forums category can\'t be deleted')); } elseif (claro_failure::get_last_failure() == 'GROUP_FORUM_REMOVALE_FORBIDDEN') { $dialogBox->error(get_lang('You can not remove a group forum. You have to remove the group first')); } } } if ($cmd == 'exDelForum') { $forumSettingList = get_forum_settings($_REQUEST['forumId']); if (is_null($forumSettingList['idGroup'])) { if (delete_forum($_REQUEST['forumId'])) { $dialogBox->success(get_lang('Forum deleted'));
<?php // include function files for this application require_once 'book_sc_fns.php'; session_start(); do_html_header('Deleting category'); if (check_admin_user()) { if (isset($HTTP_POST_VARS['catid'])) { if (delete_category($HTTP_POST_VARS['catid'])) { echo 'Category was deleted.<br />'; } else { echo 'Category could not be deleted.<br />' . 'This is usually because it is not empty.<br />'; } } else { echo 'No category specified. Please try again.<br />'; } do_html_url('admin.php', 'Back to administration menu'); } else { echo 'You are not authorised to view this page.'; } do_html_footer();
function submit_delete_category($config) { $id = $_POST['id']; return delete_category($config, $id); }
$_SESSION['deleted'] = ""; } if (!isset($_SESSION['deleted_category'])) { $_SESSION['deleted_category'] = ""; } if (isset($_SESSION['deleted']) && !empty($_SESSION['deleted']) || isset($_SESSION['deleted_category']) && !empty($_SESSION['deleted_category'])) { if ($_SERVER['QUERY_STRING'] == $_SESSION['deleted']) { echo "nuk fshihet"; if (preg_match_all("/(?<=-)(.*?)(?=-)/s", $_SESSION['deleted'], $result)) { if (delete_subcategory($mysqli, $result[0][0])) { } } } else { if ($_SERVER['QUERY_STRING'] == $_SESSION['deleted_category']) { if (preg_match_all("/(?<=-)(.*?)(?=-)/s", $_SESSION['deleted_category'], $result)) { if (delete_category($mysqli, $result[0][0])) { } } } } } echo "<form method='post' action='?new-category'>"; $get = ""; $get_cat_id = ""; $category_id_all = array(); if ($prep_stmt = "SELECT category_id , name FROM category WHERE parent = 1 order by category_id") { } $stmt = $mysqli->prepare($prep_stmt); if ($stmt) { $stmt->execute(); // Execute the prepared query.
$urlview = urlencode($_GET['urlview']); } else { $urlview = ''; } if (isset($_GET['socialview'])) { $socialview = true; $socialview_param = '&socialview'; } else { $socialview = false; $socialview_param = ''; } if (isset($_GET['deletecategory'])) { $id = $_GET['id']; delete_category($id); Session::Messages($langGroupCategoryDeleted, 'alert-success'); redirect_to_home_page("modules/group/index.php"); } elseif (isset($_GET['deletegroup'])) { $id = $_GET['id']; delete_group($id); Session::Messages($langGroupDeleted, 'alert-success'); redirect_to_home_page("modules/group/index.php"); } if (isset($_GET['group'])) { $group_name = $_POST['name']; $group_desc = $_POST['description']; $v = new Valitron\Validator($_POST); $v->rule('required', array('maxStudent'));
dberror($result); } else { $manage_cat2 .= '<span class=err>category cannot be empty!</span>'; } } } //delete category function delete_category() { $cat_id = $_POST['remove_cat']; $query = "update categories set status='delete' where id={$cat_id}"; $result = $db->query($query); dberror($result); } if ($_POST['sure']) { delete_category(); } //show category $query = "select id, name from categories where status='active'"; $result = $db->query($query); dberror($result); while ($row = $result->fetchRow()) { $select_str .= '<option class=saved id=' . $row[0] . '>' . $row[1] . '</option>'; } if ($_POST['save_article'] == 'SAVE') { //add_article $title = $_POST['title']; $desc = $_POST['desc']; $category = $_POST['category']; if (!trim($title) || !trim($desc) || !$category) { $manage_art2 .= '<span class=err>title,desc or category was empty</span>';
$functions = $_POST['functions']; if (($action == 1) && ($sessionToken == $formToken)) { $totalAppClass = trim ($totalAppClass, ","); if (is_array($functions)) { $functions = implode (" ", $functions); } $categoryname = str_replace (" ", "_", $categoryname); add_new_category($categoryname, $totalAppClass, $categorydescription, $categorytype, $functions); echo "Category $categoryname added<br>"; $sessionToken = $sessionToken + 1; $_SESSION["token"] = $sessionToken; } elseif (($action == 2) && ($sessionToken == $formToken)) { delete_category($categoryname); echo "Category $categoryname deleted<br>"; $sessionToken = $sessionToken + 1; $_SESSION["token"] = $sessionToken; } elseif (($action == 3) && ($sessionToken == $formToken)) { $totalAppClass = trim ($totalAppClass, ","); if (is_array($functions)) { $functions = implode (" ", $functions); } update_category($categoryname, $totalAppClass, $categorydescription, $categorytype,$functions); echo "Category $categoryname updated <br>"; $sessionToken = $sessionToken + 1; $_SESSION["token"] = $sessionToken;
public function testContentCategories() { $params = array('title' => 'My categories page', 'content_type' => 'page', 'subtype' => 'dynamic', 'is_active' => 1); //saving $parent_page_id = save_content($params); $parent_page_data = get_content_by_id($parent_page_id); $params = array('title' => 'Test Category 1', 'parent_page' => $parent_page_id); //saving $category_id = save_category($params); $category_data = get_category_by_id($category_id); $category_page = get_page_for_category($category_data['id']); $delete_category = delete_category($category_id); $delete_page = delete_content($parent_page_id); $deleted_page = get_content_by_id($parent_page_id); $params = array('title' => 'Test Category with invalid position', 'position' => 'uga buga'); $category_with_invalid_pos = save_category($params); //PHPUnit $this->assertEquals(true, intval($parent_page_id) > 0); $this->assertEquals(true, intval($category_id) > 0); $this->assertEquals(true, is_array($category_data)); $this->assertEquals(true, is_array($category_page)); $this->assertEquals($category_page['title'], $parent_page_data['title']); $this->assertEquals(true, $delete_category); $this->assertEquals(false, $deleted_page); $this->assertEquals(true, intval($category_with_invalid_pos) > 0); $this->assertEquals(true, is_array($delete_page)); }
$reset = ""; } if (isset($_POST['btn_pop_category'])) { $cat_id = $_POST['cat_id']; $action = $_POST['option-action']; $option = $_POST['option-option']; if ($_POST['btn_pop_category'] == "GO") { if ($action == "delete") { foreach ($cat_id as $post_cat_id) { // CALL FUNCTION $listing_child = get_inspirations($post_cat_id); if ($listing_child['rows'] > 0) { $_SESSION['alert'] = 'error'; $_SESSION['msg'] = "Can't delete item(s) because it contains one or more item(s)"; } else { delete_category($post_cat_id); $_SESSION['alert'] = 'success'; $_SESSION['msg'] = "Item(s) has been successfully removed"; } } } else { if ($action == 'visibility') { foreach ($cat_id as $post_cat_id) { if ($option == 'yes') { update_category_visibility(1, $post_cat_id); } else { if ($option == 'no') { update_category_visibility(0, $post_cat_id); } } $_SESSION['alert'] = 'success';
require_once 'model/category_db.php'; $action = strtolower(filter_input(INPUT_POST, 'action')); if ($action == NULL) { $action = strtolower(filter_input(INPUT_GET, 'action')); if ($action == NULL) { $action = 'list_categories'; } } switch ($action) { case 'list_categories': $categories = get_categories(); include 'category_list.php'; break; case 'delete_category': $category_id = filter_input(INPUT_POST, 'category_id', FILTER_VALIDATE_INT); delete_category($category_id); header("Location: ."); break; case 'add_category': $name = filter_input(INPUT_POST, 'name'); // Validate inputs if (empty($name)) { display_error('You must include a name for the category. Please try again.'); } else { $category_id = add_category($name); } header("Location: ."); break; case 'update_category': $category_id = filter_input(INPUT_POST, 'category_id', FILTER_VALIDATE_INT);
//var_dump($obj); $buff = array(); $i = 0; $arr = $obj; $p_id = 0; linearize($arr, $buff, $i, $p_id); modify_permissions($buff); $query = "UPDATE " . PREFIX . 'codo_categories ' . 'SET cat_order=:cat_order,cat_pid=:cat_pid WHERE cat_id=:cat_id'; $stmt = $db->prepare($query); foreach ($buff as $value) { $stmt->execute($value); } echo "Order Has Been Saved!"; } else { if ($_GET['action'] == 'delete' && isset($_POST['CSRF_token']) && CODOF\Access\CSRF::valid($_POST['CSRF_token'])) { delete_category($_POST['del_cat_id'], $_POST['del_cat_children']); } else { if ($_GET['action'] == 'edit') { $tpl = 'category_edit.tpl'; $smarty->assign('cat_id', $_GET['cat_id']); if (isset($_POST['mode']) && $_POST['mode'] == 'edit' && CODOF\Access\CSRF::valid($_POST['CSRF_token'])) { $query = "UPDATE " . PREFIX . "codo_categories SET cat_name=:cat_name,cat_description=:cat_description"; $imgql = ""; $cond = " WHERE cat_id=:cat_id"; $arr[':cat_name'] = $_POST['cat_name']; $arr[':cat_description'] = $_POST['cat_description']; $arr[':cat_id'] = $_GET['cat_id']; //$image=$_FILES['cat_img']; if (isset($_FILES['cat_img'])) { $image = $_FILES['cat_img']; if (!\CODOF\File\Upload::valid($image) or !\CODOF\File\Upload::not_empty($image) or !\CODOF\File\Upload::type($image, array('jpg', 'jpeg', 'png', 'gif', 'pjpeg', 'bmp', 'svg'))) {