/
ticket_create.php
111 lines (98 loc) · 3.71 KB
/
ticket_create.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/**
* i-MSCP - internet Multi Server Control Panel
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is "VHCS - Virtual Hosting Control System".
*
* The Initial Developer of the Original Code is moleSoftware GmbH.
* Portions created by Initial Developer are Copyright (C) 2001-2006
* by moleSoftware GmbH. All Rights Reserved.
*
* Portions created by the ispCP Team are Copyright (C) 2006-2010 by
* isp Control Panel. All Rights Reserved.
*
* Portions created by the i-MSCP Team are Copyright (C) 2010-2017 by
* i-MSCP - internet Multi Server Control Panel. All Rights Reserved.
*/
/***********************************************************************************************************************
* Main
*/
require_once 'imscp-lib.php';
require_once LIBRARY_PATH . '/Functions/Tickets.php';
check_login('reseller');
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onResellerScriptStart);
resellerHasFeature('support') or showBadRequestErrorPage();
if (isset($_POST['uaction'])) {
if (empty($_POST['subject'])) {
set_page_message(tr('You must specify a subject.'), 'error');
} elseif (empty($_POST['user_message'])) {
set_page_message(tr('You must specify a message.'), 'error');
} else {
createTicket($_SESSION['user_id'], $_SESSION['user_created_by'],
$_POST['urgency'], $_POST['subject'], $_POST['user_message'], 2);
redirectTo('ticket_system.php');
}
}
$userdata = [
'OPT_URGENCY_1' => '',
'OPT_URGENCY_2' => '',
'OPT_URGENCY_3' => '',
'OPT_URGENCY_4' => ''];
if (isset($_POST['urgency'])) {
$userdata['URGENCY'] = intval($_POST['urgency']);
} else {
$userdata['URGENCY'] = 2;
}
switch ($userdata['URGENCY']) {
case 1:
$userdata['OPT_URGENCY_1'] = ' selected';
break;
case 3:
$userdata['OPT_URGENCY_3'] = ' selected';
break;
case 4:
$userdata['OPT_URGENCY_4'] = ' selected';
break;
default:
$userdata['OPT_URGENCY_2'] = ' selected';
}
$userdata['SUBJECT'] = isset($_POST['subject']) ? clean_input($_POST['subject']) : '';
$userdata['USER_MESSAGE'] = isset($_POST['user_message']) ? clean_input($_POST['user_message']) : '';
$tpl = new iMSCP_pTemplate();
$tpl->define_dynamic([
'layout' => 'shared/layouts/ui.tpl',
'page' => 'reseller/ticket_create.tpl',
'page_message' => 'layout'
]);
$tpl->assign(
[
'TR_PAGE_TITLE' => tr('Reseller / Support / New Ticket'),
'TR_NEW_TICKET' => tr('New ticket'),
'TR_LOW' => tr('Low'),
'TR_MEDIUM' => tr('Medium'),
'TR_HIGH' => tr('High'),
'TR_VERY_HIGH' => tr('Very high'),
'TR_URGENCY' => tr('Priority'),
'TR_EMAIL' => tr('Email'),
'TR_SUBJECT' => tr('Subject'),
'TR_YOUR_MESSAGE' => tr('Message'),
'TR_CREATE' => tr('Create'),
'TR_OPEN_TICKETS' => tr('Open tickets'),
'TR_CLOSED_TICKETS' => tr('Closed tickets')]);
$tpl->assign($userdata);
generateNavigation($tpl);
generatePageMessage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onResellerScriptEnd, ['templateEngine' => $tpl]);
$tpl->prnt();
unsetMessages();