Completed
Push — master ( 26776f...d9604e )
by Michael
11:31
created

delete.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
//$Id: delete.php,v 1.19 2005/12/01 22:36:21 ackbarr Exp $
3
require_once('header.php');
4
require_once(XHELP_INCLUDE_PATH.'/events.php');
5
include_once(XHELP_BASE_PATH.'/functions.php');
6
7
/**
8
 * @todo move these into ticket.php and profile.php respectivly
9
 */
10
if($xoopsUser){
11
    $uid = $xoopsUser->getVar('uid');
12
13
    if(isset($_POST['delete_ticket'])){
14
        $hTicket =& xhelpGetHandler('ticket');
15
        if(isset($_POST['ticketid'])){
16
            $xhelp_id = $_POST['ticketid'];
17
        }
18
        $ticketInfo =& $hTicket->get($xhelp_id);      // Retrieve ticket information
19 View Code Duplication
        if($hTicket->delete(& $ticketInfo)){
20
            $message = _XHELP_MESSAGE_DELETE_TICKET;
21
            $_eventsrv->trigger('delete_ticket', array(&$ticketInfo));
22
        } else {
23
            $message = _XHELP_MESSAGE_DELETE_TICKET_ERROR;
24
        }
25
        redirect_header(XHELP_BASE_URL.'/index.php', 3, $message);
26
    } elseif(isset($_POST['delete_responseTpl'])){
27
        //Should only the owner of a template be able to delete it?
28
        $hResponseTpl = xhelpGetHandler('responseTemplates');
29
        $displayTpl =& $hResponseTpl->get($_POST['tplID']);
30
        if ($xoopsUser->getVar('uid') != $displayTpl->getVar('uid')) {
31
            $message = _NOPERM;
32
        } else {
33
34
            if($hResponseTpl->delete($displayTpl)){
35
                $message = _XHELP_MESSAGE_DELETE_RESPONSE_TPL;
36
                $_eventsrv->trigger('delete_responseTpl', array($displayTpl));
37
            } else {
38
                $message = _XHELP_MESSAGE_DELETE_RESPONSE_TPL_ERROR;
39
            }
40
        }
41
        redirect_header(XHELP_BASE_URL."/profile.php", 3, $message);
42
    }
43
} else {    // If not a user
44
    redirect_header(XOOPS_URL .'/user.php', 3);
45
}
46
47
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...