forked from f1desk/f1desk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createData.php
85 lines (64 loc) · 2.91 KB
/
createData.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
<?php
require_once('main.php');
/***************************************
* Create Submit *
****************************************/
$ObjTicket = new TicketHandler();
if (!empty($_POST) && $_POST['StAction'] == 'create') {
foreach ($_POST as &$StArg) {
UserHandler::SQLInjectionHandle($StArg);
}
$IDCategory = $_POST['StCategory'];
$IDPriority = $_POST['StPriority'];
$StTitle = $_POST['StTitle'];
$TxMessage = f1desk_escape_html($_POST['TxMessage']);
$IDDepartment = ($_POST['IDRecipient'] != 'null') ? $_POST['IDRecipient'] : '';
$IDDepartmentReader = (isset($_POST['IDReader']) && $_POST['IDReader'] != 'null') ? $_POST['IDReader'] : '';
$ArUsers = (isset($_POST['ArRecipients'])) ? explode(',',$_POST['ArRecipients']) : array();
$ArReaders = (isset($_POST['ArReaders'])) ? explode(',',$_POST['ArReaders']) : array();
$ArAttached = (isset($_POST['ArAttached'])) ? explode(',',$_POST['ArAttached']) : array();
if (F1DeskUtils::IsSupporter()) {
if (!empty($_FILES['Attachment']['name'])) {
$IDTicket = $ObjTicket->createSupporterTicket(getSessionProp('IDSupporter'),$IDCategory,$IDPriority,$StTitle,$TxMessage,$IDDepartment, $IDDepartmentReader,$ArUsers,$ArReaders,true,$_FILES);
} else {
$IDTicket = $ObjTicket->createSupporterTicket(getSessionProp('IDSupporter'),$IDCategory,$IDPriority,$StTitle,$TxMessage,$IDDepartment, $IDDepartmentReader,$ArUsers,$ArReaders,true);
}
} else {
if (!empty($_FILES['Attachment']['name'])) {
$IDTicket = $ObjTicket->createUserTicket(getSessionProp('IDClient'),$IDCategory,$IDPriority,$StTitle,$TxMessage,$IDDepartment,$_FILES);
} else {
$IDTicket = $ObjTicket->createUserTicket(getSessionProp('IDClient'),$IDCategory,$IDPriority,$StTitle,$TxMessage,$IDDepartment);
}
}
if (!empty($ArAttached)) {
foreach ($ArAttached as $IDAttach) {
if (! F1DeskUtils::isAttached($IDTicket,$IDAttach))
$ObjTicket->attachTicket($IDTicket,$IDAttach);
}
}
} elseif (!empty($_POST) && $_POST['StAction'] == 'addSupporters') {
$ArSupporters = F1DeskUtils::getAllSupporters();
if ($ArSupporters[0]['IDSupporter'] == 0) {
array_shift($ArSupporters);
}
}
/***************************************
* Create Data *
****************************************/
if (F1DeskUtils::isSupporter()) {
$BoCreate = F1DeskUtils::getPermission('BoCreateTicket',getSessionProp('IDSupporter'));
if ($BoCreate) {
$ArDepartments = F1DeskUtils::getPublicDepartments(false);
} else {
$ArDepartments = F1DeskUtils::getDepartmentsFormatted(getSessionProp('IDSupporter'));
}
} else {
$ArDepartments = F1DeskUtils::getPublicDepartments();
}
$ArTypes = F1DeskUtils::listTicketTypes();
$ArPriorities = F1DeskUtils::listPriorities();
$ArCategories = F1DeskUtils::listCategories();
if (F1DeskUtils::IsSupporter()) {
$ArSub = F1DeskUtils::getSubDepartments(getSessionProp('IDSupporter'));
}
?>