-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.deleteevent.php
executable file
·45 lines (42 loc) · 1.3 KB
/
action.deleteevent.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
<?php
if (!isset($gCms)) exit;
if (!$this->CheckPermission('Use EventRegistration'))
{
echo $this->ProcessTemplate('accessdenied.tpl');
return false;
}
if(empty($params['eventid']))
$this->Redirect($id, "defaultadmin", '', Array("module_message"=>$this->Lang('event_does_not_exist')));
else
{
$db =& $this->GetDb();
$dict = NewDataDictionary($db);
$sql = 'SELECT * FROM '.cms_db_prefix().'module_eventregistration_events WHERE id=?';
$Res = $db->Execute($sql, Array($params['eventid']));
if($Res !== false)
{
if($row = $Res->FetchRow())
{
$eventid = $row['id'];
$sql = 'SELECT * FROM '.cms_db_prefix().'module_eventregistration_teams WHERE event_id=?';
$Res = $db->Execute($sql, Array($params['eventid']));
if($Res !== false)
{
while($row = $Res->FetchRow())
{
$teamid = $row['id'];
$sql = 'DELETE FROM '.cms_db_prefix().'module_eventregistration_teams WHERE id=?';
$db->Execute($sql, Array($teamid));
}
}
$sql = 'DELETE FROM '.cms_db_prefix().'module_eventregistration_events WHERE id=?';
$db->Execute($sql, Array($eventid));
$this->Redirect($id, 'defaultadmin', '', Array('module_message'=>$this->Lang('eventdeleted')));
}
else
{
$this->Redirect($id, 'defaultadmin', '', Array('module_message'=>$this->Lang('event_does_not_exist')));
}
}
}
?>