/** * @desc Eliminina categorías **/ function deleteCatego() { global $xoopsModule, $xoopsSecurity; $ids = RMHttpRequest::post('ids', 'array', array()); //Verificamos si se ha proporcionado una categoría if (empty($ids)) { RMUris::redirect_with_message(__('You must select at least one category', 'bxpress'), './categories.php', RMMSG_WARN); die; } if (!$xoopsSecurity->check()) { RMUris::redirect_with_message(__('Session token expired!', 'bxpress'), 'categories.php', RMMSG_ERROR); die; } $errors = ''; foreach ($ids as $k) { //Verificamos que la categoría sea válida if ($k <= 0) { $errors .= sprintf(__('Category ID %s is not valid!', 'bxpress'), '<strong>' . $k . '</strong>') . '<br />'; continue; } //Verificamos que categoría exista $cat = new bXCategory($k); if ($cat->isNew()) { $errors .= sprintf(__('Category with id %s does not exists!', 'bxpress'), '<strong>' . $k . '</strong>') . '<br />'; continue; } if (!$cat->delete()) { $errors .= sprintf(__('Category %s could not be deleted!', 'bxpress'), '<strong>' . $k . '</strong>') . '<br />'; } } if ($errors != '') { RMUris::redirect_with_message(__('There was errors during this operation', 'bxpress') . '<br />' . $errors, './categories.php', RMMSG_ERROR); die; } else { RMUris::redirect_with_message(__('Categories deleted successfully!', 'bxpress'), './categories.php', RMMSG_SUCCESS); die; } }
/** * @desc Eliminina categorías **/ function deleteCatego() { global $xoopsModule, $xoopsSecurity; $ids = rmc_server_var($_POST, 'ids', array()); //Verificamos si se ha proporcionado una categoría if (empty($ids)) { redirectMsg('./categos.php', __('You must select at least one category', 'bxpress'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('categos.php', __('Session token expired!', 'bxpress'), 1); die; } $errors = ''; foreach ($ids as $k) { //Verificamos que la categoría sea válida if ($k <= 0) { $errors .= sprintf(__('Category ID %s is not valid!', 'bxpress'), '<strong>' . $k . '</strong>') . '<br />'; continue; } //Verificamos que categoría exista $cat = new bXCategory($k); if ($cat->isNew()) { $errors .= sprintf(__('Category with id %s does not exists!', 'bxpress'), '<strong>' . $k . '</strong>') . '<br />'; continue; } if (!$cat->delete()) { $errors .= sprintf(__('Category %s could not be deleted!', 'bxpress'), '<strong>' . $k . '</strong>') . '<br />'; } } if ($errors != '') { redirectMsg('./categos.php', __('There was errors during this operation', 'bxpress') . '<br />' . $errors, 1); die; } else { redirectMsg('./categos.php', __('Categories deleted successfully!', 'bxpress'), 0); die; } }