/
delete.php
47 lines (43 loc) · 1.74 KB
/
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
47
<?php
//$Id: delete.php,v 1.19 2005/12/01 22:36:21 ackbarr Exp $
require_once('header.php');
require_once(XHELP_INCLUDE_PATH.'/events.php');
include_once(XHELP_BASE_PATH.'/functions.php');
/**
* @todo move these into ticket.php and profile.php respectivly
*/
if($xoopsUser){
$uid = $xoopsUser->getVar('uid');
if(isset($_POST['delete_ticket'])){
$hTicket =& xhelpGetHandler('ticket');
if(isset($_POST['ticketid'])){
$xhelp_id = $_POST['ticketid'];
}
$ticketInfo =& $hTicket->get($xhelp_id); // Retrieve ticket information
if($hTicket->delete(& $ticketInfo)){
$message = _XHELP_MESSAGE_DELETE_TICKET;
$_eventsrv->trigger('delete_ticket', array(&$ticketInfo));
} else {
$message = _XHELP_MESSAGE_DELETE_TICKET_ERROR;
}
redirect_header(XHELP_BASE_URL.'/index.php', 3, $message);
} elseif(isset($_POST['delete_responseTpl'])){
//Should only the owner of a template be able to delete it?
$hResponseTpl = xhelpGetHandler('responseTemplates');
$displayTpl =& $hResponseTpl->get($_POST['tplID']);
if ($xoopsUser->getVar('uid') != $displayTpl->getVar('uid')) {
$message = _NOPERM;
} else {
if($hResponseTpl->delete($displayTpl)){
$message = _XHELP_MESSAGE_DELETE_RESPONSE_TPL;
$_eventsrv->trigger('delete_responseTpl', array($displayTpl));
} else {
$message = _XHELP_MESSAGE_DELETE_RESPONSE_TPL_ERROR;
}
}
redirect_header(XHELP_BASE_URL."/profile.php", 3, $message);
}
} else { // If not a user
redirect_header(XOOPS_URL .'/user.php', 3);
}
?>