Issues (1358)

modules/Feedback/index.php (9 issues)

1
<?php
2
/**
3
 * @package  Feedback
4
 * @category modules
5
 * @author   Nazar Mokrynskyi <[email protected]>
6
 * @license  0BSD
7
 */
8
namespace cs;
9
use
10
	h;
11
12
$Config = Config::instance();
13
$L      = Language::instance();
14
$Page   = Page::instance();
15
$User   = User::instance();
16
$Page->content(
17
	h::{'cs-form form'}(
18
		h::{'section.cs-feedback-form article'}(
19
			h::{'header h2.cs-text-center'}($L->Feedback).
0 ignored issues
show
Bug Best Practice introduced by
The property Feedback does not exist on cs\Language. Since you implemented __get, consider adding a @property annotation.
Loading history...
20
			h::{'table.cs-table[center] tr| td'}(
21
				[
22
					h::{'cs-input-text input[name=name][required]'}(
23
						[
24
							'placeholder' => $L->feedback_name,
0 ignored issues
show
Bug Best Practice introduced by
The property feedback_name does not exist on cs\Language. Since you implemented __get, consider adding a @property annotation.
Loading history...
25
							'value'       => $User->user() ? $User->username() : (isset($_POST['name']) ? $_POST['name'] : '')
26
						]
27
					),
28
					h::{'cs-input-text input[type=email][name=email][required]'}(
29
						[
30
							'placeholder' => $L->feedback_email,
0 ignored issues
show
Bug Best Practice introduced by
The property feedback_email does not exist on cs\Language. Since you implemented __get, consider adding a @property annotation.
Loading history...
31
							'value'       => $User->user() ? $User->email : (isset($_POST['email']) ? $_POST['email'] : '')
32
						]
33
					),
34
					h::{'cs-textarea[autosize] textarea[name=text][required]'}(
35
						[
36
							'placeholder' => $L->feedback_text,
0 ignored issues
show
Bug Best Practice introduced by
The property feedback_text does not exist on cs\Language. Since you implemented __get, consider adding a @property annotation.
Loading history...
37
							'value'       => isset($_POST['text']) ? $_POST['text'] : ''
38
						]
39
					),
40
					h::{'cs-button button[type=submit]'}($L->feedback_send)
0 ignored issues
show
Bug Best Practice introduced by
The property feedback_send does not exist on cs\Language. Since you implemented __get, consider adding a @property annotation.
Loading history...
41
				]
42
			)
43
		)
44
	)
45
);
46
if (isset($_POST['name'], $_POST['email'], $_POST['text'])) {
47
	if (!$_POST['name'] || !$_POST['email'] || !$_POST['text']) {
48
		$Page->warning($L->feedback_fill_all_fields);
0 ignored issues
show
Bug Best Practice introduced by
The property feedback_fill_all_fields does not exist on cs\Language. Since you implemented __get, consider adding a @property annotation.
Loading history...
49
		return;
50
	}
51
	$result = Mail::instance()->send_to(
52
		$Config->core['admin_email'],
53
		$L->feedback_email_from(xap($_POST['name']), $Config->core['site_name']),
0 ignored issues
show
The method feedback_email_from() does not exist on cs\Language. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

53
		$L->/** @scrutinizer ignore-call */ 
54
      feedback_email_from(xap($_POST['name']), $Config->core['site_name']),
Loading history...
54
		xap($_POST['text']),
55
		null,
56
		null,
57
		$_POST['email']
58
	);
59
	if ($result) {
60
		$Page->success($L->feedback_sent_successfully);
0 ignored issues
show
Bug Best Practice introduced by
The property feedback_sent_successfully does not exist on cs\Language. Since you implemented __get, consider adding a @property annotation.
Loading history...
61
	} else {
62
		$Page->warning($L->feedback_sending_error);
0 ignored issues
show
Bug Best Practice introduced by
The property feedback_sending_error does not exist on cs\Language. Since you implemented __get, consider adding a @property annotation.
Loading history...
63
	}
64
}
65