Issues (4388)

Security Analysis    no vulnerabilities found

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Controller/TicketsController.php (78 issues)

1
<?php
0 ignored issues
show
Filename "TicketsController.php" doesn't match the expected filename "ticketscontroller.php"
Loading history...
The PHP open tag does not have a corresponding PHP close tag
Loading history...
This file is missing a doc comment.
Loading history...
Class found in ".php" file; use ".inc" extension instead
Loading history...
2
0 ignored issues
show
Missing file doc comment
Loading history...
3
namespace App\Controller;
4
5
use App\Controller\AppController;
0 ignored issues
show
Unused use statement
Loading history...
6
use Cake\I18n\Time;
7
use Cake\I18n\I18n;
0 ignored issues
show
Unused use statement
Loading history...
8
9
/**
10
 * Tickets Controller
11
 *
12
 * @property \App\Model\Table\TicketsTable $Tickets
13
 */
0 ignored issues
show
Missing @category tag in class comment
Loading history...
Missing @package tag in class comment
Loading history...
Missing @link tag in class comment
Loading history...
Missing @license tag in class comment
Loading history...
Missing @author tag in class comment
Loading history...
14
class TicketsController extends AppController {
0 ignored issues
show
Opening brace of a class must be on the line after the definition
Loading history...
15
16
    /**
17
     * Index method
18
     *
19
     * @return \Cake\Network\Response|null
0 ignored issues
show
Function return type is not void, but function has no return statement
Loading history...
@return doc comment specified, but function has no return statement
Loading history...
20
     */
21 1
    public function index() {
0 ignored issues
show
Expected 0 blank lines after opening function brace; 1 found
Loading history...
Opening brace should be on a new line
Loading history...
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
Parameter comment must be on the next line
Loading history...
33
     * @return \Cake\Network\Response|null
0 ignored issues
show
@return doc comment specified, but function has no return statement
Loading history...
Function return type is not void, but function has no return statement
Loading history...
Separate the @param and @return sections by a blank line.
Loading history...
34
     * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
0 ignored issues
show
@throws comment must be on the next line
Loading history...
Separate the @return and @throws sections by a blank line.
Loading history...
35
     */
36 1
    public function view($id = null) {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
37 1
        $ticket = $this->Tickets->get($id, [
38 1
            'contain' => ['Operations', 'Tickettypes']
0 ignored issues
show
A comma should follow the last multiline array item. Found: ]
Loading history...
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
Opening brace should be on a new line
Loading history...
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
No blank line found after control structure
Loading history...
59
            $this->Flash->error(__('The ticket could not be saved. Please, try again.'));
60
        }
0 ignored issues
show
No blank line found after control structure
Loading history...
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.

Loading history...
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
Parameter comment must be on the next line
Loading history...
71
     * @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
0 ignored issues
show
Separate the @param and @return sections by a blank line.
Loading history...
72
     * @throws \Cake\Network\Exception\NotFoundException When record not found.
0 ignored issues
show
Separate the @return and @throws sections by a blank line.
Loading history...
@throws comment must be on the next line
Loading history...
73
     */
74 1
    public function edit($id = null) {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
75 1
        $ticket = $this->Tickets->get($id, [
76 1
            'contain' => ['Tickettypes']
0 ignored issues
show
A comma should follow the last multiline array item. Found: ]
Loading history...
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
No blank line found after control structure
Loading history...
85
            $this->Flash->error(__('The ticket could not be saved. Please, try again.'));
86
        }
0 ignored issues
show
No blank line found after control structure
Loading history...
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.

Loading history...
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
Parameter comment must be on the next line
Loading history...
97
     * @return \Cake\Network\Response|null Redirects to index.
0 ignored issues
show
Separate the @param and @return sections by a blank line.
Loading history...
98
     * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
0 ignored issues
show
Separate the @return and @throws sections by a blank line.
Loading history...
@throws comment must be on the next line
Loading history...
99
     */
100 1
    public function delete($id = null) {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
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
Expected newline after closing brace
Loading history...
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
Missing doc comment for function addOperation()
Loading history...
Opening brace should be on a new line
Loading history...
Missing function doc comment
Loading history...
113
        $ticket = $this->Tickets->get($id, [
114
            'contain' => []
0 ignored issues
show
A comma should follow the last multiline array item. Found: ]
Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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
No blank line found after control structure
Loading history...
130
            $this->Flash->error(__('The new operation could not be saved. Please, try again.'));
131
        }
0 ignored issues
show
No blank line found after control structure
Loading history...
132
        $newOperation->ticket_id = $id;
133
        $this->set('newOperation', $newOperation);
134
    }
135
136
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
137
     * @param null $operation_id
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $operation_id is correct as it would always require null to be passed?
Loading history...
Missing parameter comment
Loading history...
138
     * @return \Cake\Network\Response|null
139
     */
140
    public function editOperation($operation_id = null) {
0 ignored issues
show
Type hint "null" missing for $operation_id
Loading history...
Expected 0 blank lines after opening function brace; 1 found
Loading history...
Opening brace should be on a new line
Loading history...
141
142
        $this->loadModel('Operations');
143
        $operation = $this->Operations->get($operation_id, [
144
            'contain' => ['Tickets']
0 ignored issues
show
A comma should follow the last multiline array item. Found: ]
Loading history...
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.

Loading history...
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.

Loading history...
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
No blank line found after control structure
Loading history...
156
            $this->Flash->error(__('The operation could not be saved. Please, try again.'));
157
        }
0 ignored issues
show
No blank line found after control structure
Loading history...
158
        $this->set(compact('operation'));
159
        $this->set('_serialize', ['operation']);
160
    }
161
162
    public function viewOperation($id = null) {
0 ignored issues
show
Missing doc comment for function viewOperation()
Loading history...
Missing function doc comment
Loading history...
Expected 0 blank lines after opening function brace; 1 found
Loading history...
Opening brace should be on a new line
Loading history...
163
164
        $this->loadModel('Operations');
165
        $operation = $this->Operations->get($id, [
166
            'contain' => ['Tickets']
0 ignored issues
show
A comma should follow the last multiline array item. Found: ]
Loading history...
167
        ]);
168
169
        $this->set('operation', $operation);
170
        $this->set('_serialize', ['operation']);
171
    }
172
173
    public function deleteOperation($id = null) {
0 ignored issues
show
Missing doc comment for function deleteOperation()
Loading history...
Opening brace should be on a new line
Loading history...
Expected 0 blank lines after opening function brace; 1 found
Loading history...
Missing function doc comment
Loading history...
174
175
        $this->loadModel('Operations');
176
        $this->request->allowMethod(['post', 'delete']);
177
        $operation = $this->Operations->get($id, [
178
            'contain' => ['Tickets']
0 ignored issues
show
A comma should follow the last multiline array item. Found: ]
Loading history...
179
                ]
0 ignored issues
show
Array close brace not indented correctly; expected 8 spaces but found 16
Loading history...
180
        );
181
        if ($this->Operations->delete($operation)) {
182
            $this->Flash->success(__('The operation has been deleted.'));
183
        } else {
0 ignored issues
show
Expected newline after closing brace
Loading history...
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