Issues (1065)

Themes/default/Help.template.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
 * Simple Machines Forum (SMF)
4
 *
5
 * @package SMF
6
 * @author Simple Machines https://www.simplemachines.org
7
 * @copyright 2022 Simple Machines and individual contributors
8
 * @license https://www.simplemachines.org/about/smf/license.php BSD
9
 *
10
 * @version 2.1.3
11
 */
12
13
/**
14
 * This displays a help popup thingy
15
 */
16
function template_popup()
17
{
18
	global $context, $settings, $txt, $modSettings;
19
20
	// Since this is a popup of its own we need to start the html, etc.
21
	echo '<!DOCTYPE html>
22
<html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
23
	<head>
24
		<meta charset="', $context['character_set'], '">
25
		<meta name="robots" content="noindex">
26
		<title>', $context['page_title'], '</title>
27
		', template_css(), '
0 ignored issues
show
Are you sure the usage of template_css() is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
28
		<script src="', $settings['default_theme_url'], '/scripts/script.js', $context['browser_cache'], '"></script>
29
	</head>
30
	<body id="help_popup">
31
		<div class="windowbg description">
32
			', $context['help_text'], '<br>
33
			<br>
34
			<a href="javascript:self.close();">', $txt['close_window'], '</a>
35
		</div>
36
	</body>
37
</html>';
38
}
39
40
/**
41
 * The template for the popup for finding members
42
 */
43
function template_find_members()
44
{
45
	global $context, $settings, $scripturl, $modSettings, $txt;
46
47
	echo '<!DOCTYPE html>
48
<html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
49
	<head>
50
		<title>', $txt['find_members'], '</title>
51
		<meta charset="', $context['character_set'], '">
52
		<meta name="robots" content="noindex">
53
		', template_css(), '
0 ignored issues
show
Are you sure the usage of template_css() is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
54
		<script src="', $settings['default_theme_url'], '/scripts/script.js', $context['browser_cache'], '"></script>
55
		<script>
56
			var membersAdded = [];
57
			function addMember(name)
58
			{
59
				var theTextBox = window.opener.document.getElementById("', $context['input_box_name'], '");
60
61
				if (name in membersAdded)
62
					return;
63
64
				// If we only accept one name don\'t remember what is there.
65
				if (', JavaScriptEscape($context['delimiter']), ' != \'null\')
66
					membersAdded[name] = true;
67
68
				if (theTextBox.value.length < 1 || ', JavaScriptEscape($context['delimiter']), ' == \'null\')
69
					theTextBox.value = ', $context['quote_results'] ? '"\"" + name + "\""' : 'name', ';
70
				else
71
					theTextBox.value += ', JavaScriptEscape($context['delimiter']), ' + ', $context['quote_results'] ? '"\"" + name + "\""' : 'name', ';
72
73
				window.focus();
74
			}
75
		</script>
76
	</head>
77
	<body id="help_popup">
78
		<form action="', $scripturl, '?action=findmember;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '" class="padding description">
79
			<div class="roundframe">
80
				<div class="cat_bar">
81
					<h3 class="catbg">', $txt['find_members'], '</h3>
82
				</div>
83
				<div class="padding">
84
					<strong>', $txt['find_username'], ':</strong><br>
85
					<input type="text" name="search" id="search" value="', isset($context['last_search']) ? $context['last_search'] : '', '" style="margin-top: 4px; width: 96%;"><br>
86
					<span class="smalltext"><em>', $txt['find_wildcards'], '</em></span><br>';
87
88
	// Only offer to search for buddies if we have some!
89
	if (!empty($context['show_buddies']))
90
		echo '
91
					<span class="smalltext">
92
						<label for="buddies"><input type="checkbox" name="buddies" id="buddies"', !empty($context['buddy_search']) ? ' checked' : '', '> ', $txt['find_buddies'], '</label>
93
					</span><br>';
94
95
	echo '
96
					<div class="padding righttext">
97
						<input type="submit" value="', $txt['search'], '" class="button">
98
						<input type="button" value="', $txt['find_close'], '" onclick="window.close();" class="button">
99
					</div>
100
				</div><!-- .padding -->
101
			</div><!-- .roundframe -->
102
			<br>
103
			<div class="roundframe">
104
				<div class="cat_bar">
105
					<h3 class="catbg">', $txt['find_results'], '</h3>
106
				</div>';
107
108
	if (empty($context['results']))
109
		echo '
110
				<p class="error">', $txt['find_no_results'], '</p>';
111
	else
112
	{
113
		echo '
114
				<ul class="padding">';
115
116
		foreach ($context['results'] as $result)
117
			echo '
118
					<li class="windowbg">
119
						<a href="', $result['href'], '" target="_blank" rel="noopener"> <span class="main_icons profile_sm"></span>
120
						<a href="javascript:void(0);" onclick="addMember(this.innerHTML); return false;">', $result['name'], '</a>
121
					</li>';
122
123
		echo '
124
				</ul>
125
				<div class="pagesection">
126
					<div class="pagelinks">', $context['page_index'], '</div>
127
				</div>';
128
	}
129
130
	echo '
131
			</div><!-- .roundframe -->
132
			<input type="hidden" name="input" value="', $context['input_box_name'], '">
133
			<input type="hidden" name="delim" value="', $context['delimiter'], '">
134
			<input type="hidden" name="quote" value="', $context['quote_results'] ? '1' : '0', '">
135
		</form>';
136
137
	if (empty($context['results']))
138
		echo '
139
		<script>
140
			document.getElementById("search").focus();
141
		</script>';
142
143
	echo '
144
	</body>
145
</html>';
146
}
147
148
/**
149
 * The main help page
150
 */
151
function template_manual()
152
{
153
	global $context, $scripturl, $txt;
154
155
	echo '
156
			<div class="cat_bar">
157
				<h3 class="catbg">', $txt['manual_smf_user_help'], '</h3>
158
			</div>
159
			<div id="help_container">
160
				<div id="helpmain" class="windowbg">
161
					<p>', sprintf($txt['manual_welcome'], $context['forum_name_html_safe']), '</p>
162
					<p>', $txt['manual_introduction'], '</p>
163
					<ul>';
164
165
	foreach ($context['manual_sections'] as $section_id => $wiki_id)
166
		echo '
167
						<li><a href="', $context['wiki_url'], '/', $context['wiki_prefix'], $wiki_id, ($txt['lang_dictionary'] != 'en' ? '/' . $txt['lang_dictionary'] : ''), '" target="_blank" rel="noopener">', $txt['manual_section_' . $section_id . '_title'], '</a> - ', $txt['manual_section_' . $section_id . '_desc'], '</li>';
168
169
	echo '
170
					</ul>
171
					<p>', sprintf($txt['manual_docs_and_credits'], $context['wiki_url'], $scripturl . '?action=credits'), '</p>
172
				</div><!-- #helpmain -->
173
			</div><!-- #help_container -->';
174
}
175
176
?>