mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 05:43:55 -07:00
feat(admin_ranks): Added confirmation on rank deleting (#1888)
* feat(admin_ranks): Added confirmation on rank deleting * Update functions.php * Update admin_ranks.php
This commit is contained in:
parent
25224e6dfd
commit
e510ebc3ba
2 changed files with 30 additions and 15 deletions
|
@ -29,6 +29,10 @@ if (isset($_GET['mode']) || isset($_POST['mode'])) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($mode == 'delete' && isset($_POST['cancel'])) {
|
||||
$mode = '';
|
||||
}
|
||||
|
||||
if ($mode != '') {
|
||||
if ($mode == 'edit' || $mode == 'add') {
|
||||
//
|
||||
|
@ -123,12 +127,14 @@ if ($mode != '') {
|
|||
// Ok, they want to delete their rank
|
||||
//
|
||||
|
||||
$confirmed = isset($_POST['confirm']);
|
||||
if (isset($_POST['id']) || isset($_GET['id'])) {
|
||||
$rank_id = isset($_POST['id']) ? (int)$_POST['id'] : (int)$_GET['id'];
|
||||
} else {
|
||||
$rank_id = 0;
|
||||
}
|
||||
|
||||
if ($confirmed) {
|
||||
if ($rank_id) {
|
||||
$sql = 'DELETE FROM ' . BB_RANKS . " WHERE rank_id = $rank_id";
|
||||
|
||||
|
@ -147,6 +153,15 @@ if ($mode != '') {
|
|||
} else {
|
||||
bb_die($lang['MUST_SELECT_RANK']);
|
||||
}
|
||||
} else {
|
||||
$hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
|
||||
$hidden_fields .= '<input type="hidden" name="id" value="' . $rank_id . '" />';
|
||||
|
||||
print_confirmation([
|
||||
'FORM_ACTION' => 'admin_ranks.php',
|
||||
'HIDDEN_FIELDS' => $hidden_fields,
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
bb_die('Invalid mode');
|
||||
}
|
||||
|
|
|
@ -1592,7 +1592,7 @@ function build_topic_pagination($url, $replies, $per_page)
|
|||
return $pg;
|
||||
}
|
||||
|
||||
function print_confirmation($tpl_vars)
|
||||
function print_confirmation($tpl_vars): void
|
||||
{
|
||||
global $template, $lang;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue