1 | <?php |
||||||
2 | |||||||
3 | /** |
||||||
4 | * @package ElkArte Forum |
||||||
5 | * @copyright ElkArte Forum contributors |
||||||
6 | * @license BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file) |
||||||
7 | * |
||||||
8 | * This file contains code covered by: |
||||||
9 | * copyright: 2011 Simple Machines (http://www.simplemachines.org) |
||||||
10 | * |
||||||
11 | * @version 2.0 dev |
||||||
12 | * |
||||||
13 | */ |
||||||
14 | |||||||
15 | /** |
||||||
16 | * What's this, verification?! |
||||||
17 | * |
||||||
18 | * @param int $verify_id |
||||||
19 | * @param string $before |
||||||
20 | * @param string $after |
||||||
21 | */ |
||||||
22 | function template_verification_controls($verify_id, $before = '', $after = '') |
||||||
23 | { |
||||||
24 | global $context; |
||||||
25 | |||||||
26 | $verify_context = &$context['controls']['verification'][$verify_id]; |
||||||
27 | |||||||
28 | $i = 0; |
||||||
29 | |||||||
30 | if ($verify_context['render']) |
||||||
31 | { |
||||||
32 | echo $before; |
||||||
33 | } |
||||||
34 | |||||||
35 | // Loop through each item to show them. |
||||||
36 | foreach ($verify_context['test'] as $verification) |
||||||
37 | { |
||||||
38 | if (empty($verification['values']) || empty($verification['template'])) |
||||||
39 | { |
||||||
40 | continue; |
||||||
41 | } |
||||||
42 | |||||||
43 | echo ' |
||||||
44 | <div id="verification_control_', $i, '" class="verification_control">'; |
||||||
45 | |||||||
46 | call_user_func('template_verification_control_' . $verification['template'], $verify_id, $verification['values']); |
||||||
47 | |||||||
48 | echo ' |
||||||
49 | </div>'; |
||||||
50 | |||||||
51 | $i++; |
||||||
52 | } |
||||||
53 | |||||||
54 | if ($verify_context['render']) |
||||||
55 | { |
||||||
56 | echo $after; |
||||||
57 | } |
||||||
58 | } |
||||||
59 | |||||||
60 | /** |
||||||
61 | * Used to show a verification question |
||||||
62 | * |
||||||
63 | * @param int $verify_id |
||||||
64 | * @param mixed[] $verify_context |
||||||
65 | */ |
||||||
66 | function template_verification_control_questions($verify_id, $verify_context) |
||||||
67 | { |
||||||
68 | global $context; |
||||||
69 | |||||||
70 | foreach ($verify_context as $question) |
||||||
71 | { |
||||||
72 | echo ' |
||||||
73 | <div class="verification_question"> |
||||||
74 | <label for="', $verify_id, '_vv[q][', $question['id'], ']">', $question['q'], ':</label> |
||||||
75 | <input type="text" id="', $verify_id, '_vv[q][', $question['id'], ']" name="', $verify_id, '_vv[q][', $question['id'], ']" size="30" value="', $question['a'], '" ', $question['is_error'] ? ' class="border_error"' : '', ' tabindex="', $context['tabindex']++, '" class="input_text" /> |
||||||
76 | </div>'; |
||||||
77 | } |
||||||
78 | } |
||||||
79 | |||||||
80 | /** |
||||||
81 | * Display the empty field verification |
||||||
82 | * |
||||||
83 | * @param int $verify_id |
||||||
84 | * @param mixed[] $verify_context |
||||||
85 | */ |
||||||
86 | function template_verification_control_emptyfield($verify_id, $verify_context) |
||||||
0 ignored issues
–
show
|
|||||||
87 | { |
||||||
88 | global $context, $txt; |
||||||
89 | |||||||
90 | // Display an empty field verification |
||||||
91 | echo ' |
||||||
92 | <div class="verification_control_valid"> |
||||||
93 | <label for="', $verify_context['field_name'], '">', $txt['visual_verification_hidden'], '</label>: |
||||||
94 | <input type="text" id="', $verify_context['field_name'], '" name="', $verify_context['field_name'], '" autocomplete="off" size="30" value="', (empty($verify_context['user_value']) ? '' : $verify_context['user_value']), '" tabindex="', $context['tabindex']++, '" class="', $verify_context['is_error'] ? 'border_error ' : '', 'input_text" /> |
||||||
95 | </div>'; |
||||||
96 | } |
||||||
97 | |||||||
98 | /** |
||||||
99 | * Google reCaptcha, Empty div to be populated by the JS |
||||||
100 | */ |
||||||
101 | function template_verification_control_recaptcha($id, $values) |
||||||
0 ignored issues
–
show
The parameter
$id is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
102 | { |
||||||
103 | echo ' |
||||||
104 | <div id="g-recaptcha" data-sitekey="' . $values['site_key'] . '" style="display: flex; justify-content: center;"></div>'; |
||||||
105 | } |
||||||
106 | |||||||
107 | /** |
||||||
108 | * hCaptcha, Empty div to be populated by the JS |
||||||
109 | */ |
||||||
110 | function template_verification_control_hcaptcha($id, $values) |
||||||
0 ignored issues
–
show
The parameter
$id is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
111 | { |
||||||
112 | echo ' |
||||||
113 | <div id="h-captcha" data-sitekey="' . $values['site_key'] . '" style="display: flex; justify-content: center;"></div>'; |
||||||
114 | } |
||||||
115 | |||||||
116 | /** |
||||||
117 | * keyCaptcha, Empty div to be populated by the JS |
||||||
118 | */ |
||||||
119 | function template_verification_control_keycaptcha($id, $values) |
||||||
0 ignored issues
–
show
The parameter
$id is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() The parameter
$values is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
120 | { |
||||||
121 | echo ' |
||||||
122 | <div style="display: flex; justify-content: center;"> |
||||||
123 | <div id="div_for_keycaptcha"> |
||||||
124 | <input name="key-capcode" id="key-capcode" type="hidden" value=""> |
||||||
125 | </div> |
||||||
126 | </div>'; |
||||||
127 | } |
||||||
128 | |||||||
129 | /** |
||||||
130 | * Turnstile, Empty div to be populated by the JS |
||||||
131 | */ |
||||||
132 | function template_verification_control_turnstile() |
||||||
133 | { |
||||||
134 | echo ' |
||||||
135 | <div id="TurnstileControl" style="display: flex; justify-content: center;"></div>'; |
||||||
136 | } |
||||||
137 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.