This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
2 | |||
0 ignored issues
–
show
|
|||
3 | namespace App\Controller; |
||
4 | |||
5 | use App\Controller\AppController; |
||
0 ignored issues
–
show
|
|||
6 | use Cake\I18n\Time; |
||
7 | use Cake\I18n\I18n; |
||
0 ignored issues
–
show
|
|||
8 | |||
9 | /** |
||
10 | * Tickets Controller |
||
11 | * |
||
12 | * @property \App\Model\Table\TicketsTable $Tickets |
||
13 | */ |
||
0 ignored issues
–
show
|
|||
14 | class TicketsController extends AppController { |
||
0 ignored issues
–
show
|
|||
15 | |||
16 | /** |
||
17 | * Index method |
||
18 | * |
||
19 | * @return \Cake\Network\Response|null |
||
0 ignored issues
–
show
|
|||
20 | */ |
||
21 | 1 | public function index() { |
|
0 ignored issues
–
show
|
|||
22 | |||
23 | 1 | $tickets = $this->paginate($this->Tickets->find('all', ['contain' => ['Tickettypes', 'Ticketstatuses']])); |
|
24 | |||
25 | 1 | $this->set(compact('tickets')); |
|
26 | 1 | $this->set('_serialize', ['tickets']); |
|
27 | 1 | } |
|
28 | |||
29 | /** |
||
30 | * View method |
||
31 | * |
||
32 | * @param string|null $id Ticket id. |
||
0 ignored issues
–
show
|
|||
33 | * @return \Cake\Network\Response|null |
||
0 ignored issues
–
show
|
|||
34 | * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. |
||
0 ignored issues
–
show
|
|||
35 | */ |
||
36 | 1 | public function view($id = null) { |
|
0 ignored issues
–
show
|
|||
37 | 1 | $ticket = $this->Tickets->get($id, [ |
|
38 | 1 | 'contain' => ['Operations', 'Tickettypes'] |
|
0 ignored issues
–
show
|
|||
39 | ]); |
||
40 | |||
41 | 1 | $this->set('ticket', $ticket); |
|
42 | 1 | $this->set('_serialize', ['ticket']); |
|
43 | 1 | } |
|
44 | |||
45 | /** |
||
46 | * Add method |
||
47 | * |
||
48 | * @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise. |
||
49 | */ |
||
50 | 2 | public function add() { |
|
0 ignored issues
–
show
|
|||
51 | 2 | $ticket = $this->Tickets->newEmptyEntity(); |
|
52 | 2 | if ($this->request->is('post')) { |
|
53 | 2 | $ticket = $this->Tickets->patchEntity($ticket, $this->getRequest()->getData()); |
|
54 | 2 | if ($this->Tickets->save($ticket)) { |
|
55 | 2 | $this->Flash->success(__('The ticket has been saved.')); |
|
56 | |||
57 | 2 | return $this->redirect(['prefix' => false, 'controller' => 'Tickets', 'action' => 'index']); |
|
58 | } |
||
0 ignored issues
–
show
|
|||
59 | $this->Flash->error(__('The ticket could not be saved. Please, try again.')); |
||
60 | } |
||
0 ignored issues
–
show
|
|||
61 | 2 | $types = $this->Tickets->Tickettypes->find('list'); |
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
62 | 2 | $statuses = $this->Tickets->Ticketstatuses->find('list'); |
|
63 | 2 | $this->set(compact('ticket', 'types', 'statuses')); |
|
64 | 2 | $this->set('_serialize', ['ticket']); |
|
65 | 2 | } |
|
66 | |||
67 | /** |
||
68 | * Edit method |
||
69 | * |
||
70 | * @param string|null $id Ticket id. |
||
0 ignored issues
–
show
|
|||
71 | * @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise. |
||
0 ignored issues
–
show
|
|||
72 | * @throws \Cake\Network\Exception\NotFoundException When record not found. |
||
0 ignored issues
–
show
|
|||
73 | */ |
||
74 | 1 | public function edit($id = null) { |
|
0 ignored issues
–
show
|
|||
75 | 1 | $ticket = $this->Tickets->get($id, [ |
|
76 | 1 | 'contain' => ['Tickettypes'] |
|
0 ignored issues
–
show
|
|||
77 | ]); |
||
78 | 1 | if ($this->request->is(['patch', 'post', 'put'])) { |
|
79 | 1 | $ticket = $this->Tickets->patchEntity($ticket, $this->getRequest()->getData()); |
|
80 | 1 | if ($this->Tickets->save($ticket)) { |
|
81 | 1 | $this->Flash->success(__('The ticket has been saved.')); |
|
82 | |||
83 | 1 | return $this->redirect(['prefix' => false, 'controller' => 'Tickets', 'action' => 'index']); |
|
84 | } |
||
0 ignored issues
–
show
|
|||
85 | $this->Flash->error(__('The ticket could not be saved. Please, try again.')); |
||
86 | } |
||
0 ignored issues
–
show
|
|||
87 | 1 | $tickettypes = $this->Tickets->Tickettypes->find('list'); |
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
88 | 1 | $ticketstatuses = $this->Tickets->Ticketstatuses->find('list'); |
|
89 | 1 | $this->set(compact('ticket', 'tickettypes', 'ticketstatuses')); |
|
90 | 1 | $this->set('_serialize', ['ticket']); |
|
91 | 1 | } |
|
92 | |||
93 | /** |
||
94 | * Delete method |
||
95 | * |
||
96 | * @param string|null $id Ticket id. |
||
0 ignored issues
–
show
|
|||
97 | * @return \Cake\Network\Response|null Redirects to index. |
||
0 ignored issues
–
show
|
|||
98 | * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. |
||
0 ignored issues
–
show
|
|||
99 | */ |
||
100 | 1 | public function delete($id = null) { |
|
0 ignored issues
–
show
|
|||
101 | 1 | $this->request->allowMethod(['post', 'delete']); |
|
102 | 1 | $ticket = $this->Tickets->get($id); |
|
103 | 1 | if ($this->Tickets->delete($ticket)) { |
|
104 | 1 | $this->Flash->success(__('The ticket has been deleted.')); |
|
105 | } else { |
||
0 ignored issues
–
show
|
|||
106 | $this->Flash->error(__('The ticket could not be deleted. Please, try again.')); |
||
107 | } |
||
108 | |||
109 | 1 | return $this->redirect(['prefix' => false, 'controller' => 'Tickets', 'action' => 'index']); |
|
110 | } |
||
111 | |||
112 | public function addOperation($id = null) { |
||
0 ignored issues
–
show
|
|||
113 | $ticket = $this->Tickets->get($id, [ |
||
114 | 'contain' => [] |
||
0 ignored issues
–
show
|
|||
115 | ]); |
||
116 | |||
117 | $this->loadModel('Operations'); |
||
118 | $newOperation = $this->Operations->newEntity(); |
||
119 | if ($this->request->is('post')) { |
||
120 | $datetimeStart = Time::parseDateTime($this->request->data['start']); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 13 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
121 | $datetimeEnd = Time::parseDateTime($this->request->data['end']); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 15 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
122 | $newOperation->ticket_id = $this->request->data['ticket_id']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
123 | $newOperation->description = $this->request->data['description']; |
||
124 | $newOperation->start = $datetimeStart; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
125 | $newOperation->end = $datetimeEnd; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
126 | if ($this->Operations->save($newOperation)) { |
||
127 | $this->Flash->success(__('The new operation has been saved.')); |
||
128 | return $this->redirect(['prefix' => false, 'controller' => 'Tickets', 'action' => 'view', $this->request->data['ticket_id']]); |
||
129 | } |
||
0 ignored issues
–
show
|
|||
130 | $this->Flash->error(__('The new operation could not be saved. Please, try again.')); |
||
131 | } |
||
0 ignored issues
–
show
|
|||
132 | $newOperation->ticket_id = $id; |
||
133 | $this->set('newOperation', $newOperation); |
||
134 | } |
||
135 | |||
136 | /** |
||
0 ignored issues
–
show
|
|||
137 | * @param null $operation_id |
||
0 ignored issues
–
show
|
|||
138 | * @return \Cake\Network\Response|null |
||
139 | */ |
||
140 | public function editOperation($operation_id = null) { |
||
0 ignored issues
–
show
|
|||
141 | |||
142 | $this->loadModel('Operations'); |
||
143 | $operation = $this->Operations->get($operation_id, [ |
||
144 | 'contain' => ['Tickets'] |
||
0 ignored issues
–
show
|
|||
145 | ]); |
||
146 | if ($this->request->is(['patch', 'post', 'put'])) { |
||
147 | $this->request->data['start'] = Time::parseDateTime($this->request->data['start']); |
||
148 | $this->request->data['end'] = Time::parseDateTime($this->request->data['end']); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
149 | $operation = $this->Operations->patchEntity($operation, $this->request->data); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 20 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
150 | |||
151 | if ($this->Operations->save($operation)) { |
||
152 | $this->Flash->success(__('The operation has been saved.')); |
||
153 | |||
154 | return $this->redirect(['prefix' => false, 'controller' => 'Tickets', 'action' => 'view', $this->request->data['ticket_id']]); |
||
155 | } |
||
0 ignored issues
–
show
|
|||
156 | $this->Flash->error(__('The operation could not be saved. Please, try again.')); |
||
157 | } |
||
0 ignored issues
–
show
|
|||
158 | $this->set(compact('operation')); |
||
159 | $this->set('_serialize', ['operation']); |
||
160 | } |
||
161 | |||
162 | public function viewOperation($id = null) { |
||
0 ignored issues
–
show
|
|||
163 | |||
164 | $this->loadModel('Operations'); |
||
165 | $operation = $this->Operations->get($id, [ |
||
166 | 'contain' => ['Tickets'] |
||
0 ignored issues
–
show
|
|||
167 | ]); |
||
168 | |||
169 | $this->set('operation', $operation); |
||
170 | $this->set('_serialize', ['operation']); |
||
171 | } |
||
172 | |||
173 | public function deleteOperation($id = null) { |
||
0 ignored issues
–
show
|
|||
174 | |||
175 | $this->loadModel('Operations'); |
||
176 | $this->request->allowMethod(['post', 'delete']); |
||
177 | $operation = $this->Operations->get($id, [ |
||
178 | 'contain' => ['Tickets'] |
||
0 ignored issues
–
show
|
|||
179 | ] |
||
0 ignored issues
–
show
|
|||
180 | ); |
||
181 | if ($this->Operations->delete($operation)) { |
||
182 | $this->Flash->success(__('The operation has been deleted.')); |
||
183 | } else { |
||
0 ignored issues
–
show
|
|||
184 | $this->Flash->error(__('The operation could not be deleted. Please, try again.')); |
||
185 | } |
||
186 | |||
187 | return $this->redirect(['prefix' => false, 'controller' => 'Tickets', 'action' => 'view', $operation->ticket_id]); |
||
188 | } |
||
189 | |||
190 | } |
||
191 |