-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathadmin_group_delete.php
46 lines (40 loc) · 1.4 KB
/
admin_group_delete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/* Copyright (c) Anuko International Ltd. https://www.anuko.com
License: See license.txt */
require_once('initialize.php');
import('form.Form');
import('ttAdmin');
// Access checks.
if (!ttAccessAllowed('administer_site')) {
header('Location: access_denied.php');
exit();
}
$group_id = (int)$request->getParameter('id');
$group_name = ttAdmin::getGroupName($group_id);
if (!($group_id && $group_name != null)) {
header('Location: access_denied.php');
exit();
}
// End of access checks.
$form = new Form('groupForm');
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$group_id));
$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('label.delete')));
$form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->get('button.cancel')));
if ($request->isPost()) {
if ($request->getParameter('btn_delete')) {
if (ttAdmin::markGroupDeleted($group_id)) {
header('Location: admin_groups.php');
exit();
} else
$err->add($i18n->get('error.db'));
}
if ($request->getParameter('btn_cancel')) {
header('Location: admin_groups.php');
exit();
}
} // isPost
$smarty->assign('group_to_delete', $group_name);
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
$smarty->assign('title', $i18n->get('title.delete_group'));
$smarty->assign('content_page_name', 'admin_group_delete.tpl');
$smarty->display('index.tpl');