1
|
|
|
<?php defined('BASEPATH') OR exit('No direct script access allowed'); |
2
|
|
|
|
3
|
|
|
class ReportIssue extends MY_Controller { |
4
|
|
|
public function __construct() { |
5
|
|
|
parent::__construct(); |
6
|
|
|
$this->load->helper('form'); |
7
|
|
|
$this->load->library('form_validation'); |
8
|
|
|
} |
9
|
|
|
|
10
|
|
|
public function index() : void { |
11
|
|
|
$this->header_data['title'] = 'Report Issue'; |
12
|
|
|
$this->header_data['page'] = 'report-issue'; |
13
|
|
|
|
14
|
|
|
show_404(); |
15
|
|
|
return; |
16
|
|
|
|
17
|
|
|
$this->form_validation->set_rules('issue_description', 'Description', 'required|max_length[1000]'); |
|
|
|
|
18
|
|
|
$this->form_validation->set_rules('issue_url', 'URL', 'valid_url'); |
19
|
|
|
|
20
|
|
|
|
21
|
|
|
$this->body_data['issue_submitted'] = FALSE; |
22
|
|
|
if($isValid = ($this->form_validation->run() === TRUE)) { |
23
|
|
|
//send report |
24
|
|
|
|
25
|
|
|
if(!empty($this->input->post('website'))) { |
26
|
|
|
$this->body_data['issue_submitted'] = FALSE; |
27
|
|
|
log_message('error', 'Bot attempting to spam report issue form: "' . $this->input->post('issue_description') . '"'); |
|
|
|
|
28
|
|
|
} else { |
29
|
|
|
$this->body_data['issue_submitted'] = $this->Tracker->issue->report('USERID:' . $this->User->id . ' ||| ' . $this->input->post('issue_description'), NULL, $this->input->post('issue_url')); |
30
|
|
|
} |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
$this->body_data['form_description'] = [ |
34
|
|
|
'name' => 'issue_description', |
35
|
|
|
|
36
|
|
|
'value' => $this->form_validation->set_value('issue_description') ?: '', |
37
|
|
|
|
38
|
|
|
'class' => 'form-control', |
39
|
|
|
'rows' => '3', |
40
|
|
|
|
41
|
|
|
'placeholder' => 'Please describe your issue and provide as much info as possible. If you have any feature requests, please use submit an issue to our Github instead.', |
42
|
|
|
|
43
|
|
|
'required' => TRUE |
44
|
|
|
]; |
45
|
|
|
|
46
|
|
|
$this->body_data['form_url'] = array( |
47
|
|
|
'name' => 'issue_url', |
48
|
|
|
|
49
|
|
|
'class' => 'form-control', |
50
|
|
|
|
51
|
|
|
'value' => $this->form_validation->set_value('issue_url') ?: $this->input->get('url', TRUE) ?: '' |
52
|
|
|
); |
53
|
|
|
|
54
|
|
|
if(!$isValid) { |
55
|
|
|
$this->body_data['form_url']['value'] = ''; |
56
|
|
|
} |
57
|
|
|
$this->_render_page('ReportIssue'); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.