Issues (1014)

Themes/default/Reports.template.php (1 issue)

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.0
11
 */
12
13
/**
14
 * Choose which type of report to run?
15
 */
16
function template_report_type()
17
{
18
	global $context, $scripturl, $txt;
19
20
	echo '
21
		<form action="', $scripturl, '?action=admin;area=reports" method="post" accept-charset="', $context['character_set'], '">
22
			<div class="cat_bar">
23
				<h3 class="catbg">', $txt['generate_reports_type'], '</h3>
24
			</div>
25
			<div class="windowbg">
26
				<dl class="settings">';
27
28
	// Go through each type of report they can run.
29
	foreach ($context['report_types'] as $type)
30
	{
31
		if (isset($type['description']))
32
			echo '
33
					<dt>', $type['description'], '</dt>';
34
35
		echo '
36
					<dd>
37
						<input type="radio" id="rt_', $type['id'], '" name="rt" value="', $type['id'], '"', $type['is_first'] ? ' checked' : '', '>
38
						<strong><label for="rt_', $type['id'], '">', $type['title'], '</label></strong>
39
					</dd>';
40
	}
41
	echo '
42
				</dl>
43
				<input type="submit" name="continue" value="', $txt['generate_reports_continue'], '" class="button">
44
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
45
			</div><!-- .windowbg -->
46
		</form>';
47
}
48
49
/**
50
 * This is the standard template for showing reports.
51
 */
52
function template_main()
53
{
54
	global $context, $txt;
55
56
	echo '
57
		<div class="cat_bar">
58
			<h3 class="catbg">', $txt['results'], '</h3>
59
		</div>
60
		<div id="report_buttons">';
61
62
	if (!empty($context['report_buttons']))
63
		template_button_strip($context['report_buttons'], 'right');
64
65
	echo '
66
		</div>';
67
68
	// Go through each table!
69
	foreach ($context['tables'] as $table)
70
	{
71
		echo '
72
		<table class="table_grid report_results">';
73
74
		if (!empty($table['title']))
75
			echo '
76
			<thead>
77
				<tr class="title_bar">
78
					<th scope="col" colspan="', $table['column_count'], '">', $table['title'], '</th>
79
				</tr>
80
			</thead>
81
			<tbody>';
82
83
		// Now do each row!
84
		$row_number = 0;
85
		foreach ($table['data'] as $row)
86
		{
87
			if ($row_number == 0 && !empty($table['shading']['top']))
88
				echo '
89
				<tr class="windowbg table_caption">';
90
			else
91
				echo '
92
				<tr class="', !empty($row[0]['separator']) ? 'title_bar' : 'windowbg', '">';
93
94
			// Now do each column.
95
			$column_number = 0;
96
97
			foreach ($row as $data)
98
			{
99
				// If this is a special separator, skip over!
100
				if (!empty($data['separator']) && $column_number == 0)
101
				{
102
					echo '
103
					<td colspan="', $table['column_count'], '" class="smalltext">
104
						', $data['v'], ':
105
					</td>';
106
					break;
107
				}
108
109
				// Shaded?
110
				if ($column_number == 0 && !empty($table['shading']['left']))
111
					echo '
112
					<td class="table_caption ', $table['align']['shaded'], 'text"', $table['width']['shaded'] != 'auto' ? ' width="' . $table['width']['shaded'] . '"' : '', '>
113
						', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
114
					</td>';
115
				else
116
					echo '
117
					<td class="smalltext centertext" ', $table['width']['normal'] != 'auto' ? ' width="' . $table['width']['normal'] . '"' : '', !empty($data['style']) ? ' style="' . $data['style'] . '"' : '', '>
118
						', $data['v'], '
119
					</td>';
120
121
				$column_number++;
122
			}
123
124
			echo '
125
				</tr>';
126
127
			$row_number++;
128
		}
129
		echo '
130
			</tbody>
131
		</table>';
132
	}
133
}
134
135
/**
136
 * Header of the print page!
137
 */
138
function template_print_above()
139
{
140
	global $context, $settings, $modSettings;
141
142
	echo '<!DOCTYPE html>
143
<html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
144
	<head>
145
		<meta charset="', $context['character_set'], '">
146
		<title>', $context['page_title'], '</title>
147
		<link rel="stylesheet" href="', $settings['default_theme_url'], '/css/report.css', $context['browser_cache'], '">
148
	</head>
149
	<body>';
150
}
151
152
/**
153
 * The main print page
154
 */
155
function template_print()
156
{
157
	global $context;
158
159
	// Go through each table!
160
	foreach ($context['tables'] as $table)
161
	{
162
		echo '
163
		<div style="overflow: visible;', $table['max_width'] != 'auto' ? ' width: ' . $table['max_width'] . 'px;' : '', '">
164
			<table class="bordercolor">';
165
166
		if (!empty($table['title']))
167
			echo '
168
				<tr class="title_bar">
169
					<td colspan="', $table['column_count'], '">
170
						', $table['title'], '
171
					</td>
172
				</tr>';
173
174
		// Now do each row!
175
		$row_number = 0;
176
		foreach ($table['data'] as $row)
177
		{
178
			if ($row_number == 0 && !empty($table['shading']['top']))
179
				echo '
180
				<tr class="titlebg">';
181
			else
182
				echo '
183
				<tr class="windowbg">';
184
185
			// Now do each column!!
186
			$column_number = 0;
187
			foreach ($row as $data)
188
			{
189
				// If this is a special separator, skip over!
190
				if (!empty($data['separator']) && $column_number == 0)
191
				{
192
					echo '
193
					<td colspan="', $table['column_count'], '" class="smalltext">
194
						<strong>', $data['v'], ':</strong>
195
					</td>';
196
					break;
197
				}
198
199
				// Shaded?
200
				if ($column_number == 0 && !empty($table['shading']['left']))
201
					echo '
202
					<td class="titlebg ', $table['align']['shaded'], 'text"', $table['width']['shaded'] != 'auto' ? ' width="' . $table['width']['shaded'] . '"' : '', '>
203
						', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
204
					</td>';
205
				else
206
					echo '
207
					<td class="centertext" ', $table['width']['normal'] != 'auto' ? ' width="' . $table['width']['normal'] . '"' : '', !empty($data['style']) ? ' style="' . $data['style'] . '"' : '', '>
208
						', $data['v'], '
209
					</td>';
210
211
				$column_number++;
212
			}
213
214
			echo '
215
				</tr>';
216
217
			$row_number++;
218
		}
219
		echo '
220
			</table>
221
		</div>
222
		<br>';
223
	}
224
}
225
226
/**
227
 * Footer of the print page.
228
 */
229
function template_print_below()
230
{
231
	echo '
232
		<div class="copyright">', theme_copyright(), '</div>
0 ignored issues
show
Are you sure the usage of theme_copyright() 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...
233
	</body>
234
</html>';
235
}
236
237
?>