1 | <?php |
||
2 | /** |
||
3 | * Simple Machines Forum (SMF) |
||
4 | * |
||
5 | * @package SMF |
||
6 | * @author Simple Machines https://www.simplemachines.org |
||
7 | * @copyright 2020 Simple Machines and individual contributors |
||
8 | * @license https://www.simplemachines.org/about/smf/license.php BSD |
||
9 | * |
||
10 | * @version 2.1 RC2 |
||
11 | */ |
||
12 | |||
13 | /** |
||
14 | * Template for showing recent posts |
||
15 | */ |
||
16 | function template_recent() |
||
17 | { |
||
18 | global $context, $txt, $scripturl; |
||
19 | |||
20 | echo ' |
||
21 | <div id="recent" class="main_section"> |
||
22 | <div class="cat_bar"> |
||
23 | <h3 class="catbg"> |
||
24 | <span class="xx"></span>', $txt['recent_posts'], ' |
||
25 | </h3> |
||
26 | </div> |
||
27 | <div class="pagesection">', $context['page_index'], '</div>'; |
||
28 | |||
29 | if (empty($context['posts'])) |
||
30 | echo ' |
||
31 | <div class="windowbg">', $txt['no_messages'], '</div>'; |
||
32 | |||
33 | foreach ($context['posts'] as $post) |
||
34 | { |
||
35 | echo ' |
||
36 | <div class="', $post['css_class'], '"> |
||
37 | <div class="counter">', $post['counter'], '</div> |
||
38 | <div class="topic_details"> |
||
39 | <h5>', $post['board']['link'], ' / ', $post['link'], '</h5> |
||
40 | <span class="smalltext">', $txt['last_poster'], ' <strong>', $post['poster']['link'], ' </strong> - ', $post['time'], '</span> |
||
41 | </div> |
||
42 | <div class="list_posts">', $post['message'], '</div>'; |
||
43 | |||
44 | // Post options |
||
45 | template_quickbuttons($post['quickbuttons'], 'recent'); |
||
46 | |||
47 | echo ' |
||
48 | </div><!-- $post[css_class] -->'; |
||
49 | } |
||
50 | |||
51 | echo ' |
||
52 | <div class="pagesection">', $context['page_index'], '</div> |
||
53 | </div><!-- #recent -->'; |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * Template for showing unread posts |
||
58 | */ |
||
59 | function template_unread() |
||
60 | { |
||
61 | global $context, $settings, $txt, $scripturl, $modSettings; |
||
62 | |||
63 | echo ' |
||
64 | <div id="recent" class="main_content">'; |
||
65 | |||
66 | if ($context['showCheckboxes']) |
||
67 | echo ' |
||
68 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm"> |
||
69 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
||
70 | <input type="hidden" name="qaction" value="markread"> |
||
71 | <input type="hidden" name="redirect_url" value="action=unread', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '">'; |
||
72 | |||
73 | if (!empty($context['topics'])) |
||
74 | { |
||
75 | echo ' |
||
76 | <div class="pagesection"> |
||
77 | ', $context['menu_separator'], ' |
||
78 | <div class="pagelinks floatleft"> |
||
79 | <a href="#bot" class="button">', $txt['go_down'], '</a> |
||
80 | ', $context['page_index'], ' |
||
81 | </div> |
||
82 | ', !empty($context['recent_buttons']) ? template_button_strip($context['recent_buttons'], 'right') : '', ' |
||
0 ignored issues
–
show
|
|||
83 | </div>'; |
||
84 | |||
85 | echo ' |
||
86 | <div id="unread"> |
||
87 | <div id="topic_header" class="title_bar"> |
||
88 | <div class="board_icon"></div> |
||
89 | <div class="info"> |
||
90 | <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
||
91 | </div> |
||
92 | <div class="board_stats centertext"> |
||
93 | <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
||
94 | </div> |
||
95 | <div class="lastpost"> |
||
96 | <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] == 'last_post' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
||
97 | </div>'; |
||
98 | |||
99 | // Show a "select all" box for quick moderation? |
||
100 | if ($context['showCheckboxes']) |
||
101 | echo ' |
||
102 | <div class="moderation"> |
||
103 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');"> |
||
104 | </div>'; |
||
105 | |||
106 | echo ' |
||
107 | </div><!-- #topic_header --> |
||
108 | <div id="topic_container">'; |
||
109 | |||
110 | foreach ($context['topics'] as $topic) |
||
111 | { |
||
112 | echo ' |
||
113 | <div class="', $topic['css_class'], '"> |
||
114 | <div class="board_icon"> |
||
115 | <img src="', $topic['first_post']['icon_url'], '" alt=""> |
||
116 | ', $topic['is_posted_in'] ? '<img class="posted" src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="">' : '', ' |
||
117 | </div> |
||
118 | <div class="info">'; |
||
119 | |||
120 | // Now we handle the icons |
||
121 | echo ' |
||
122 | <div class="icons floatright">'; |
||
123 | |||
124 | if ($topic['is_locked']) |
||
125 | echo ' |
||
126 | <span class="main_icons lock"></span>'; |
||
127 | |||
128 | if ($topic['is_sticky']) |
||
129 | echo ' |
||
130 | <span class="main_icons sticky"></span>'; |
||
131 | |||
132 | if ($topic['is_poll']) |
||
133 | echo ' |
||
134 | <span class="main_icons poll"></span>'; |
||
135 | |||
136 | echo ' |
||
137 | </div>'; |
||
138 | |||
139 | echo ' |
||
140 | <div class="recent_title"> |
||
141 | <a href="', $topic['new_href'], '" id="newicon', $topic['first_post']['id'], '" class="new_posts">' . $txt['new'] . '</a> |
||
142 | ', $topic['is_sticky'] ? '<strong>' : '', '<span class="preview" title="', $topic[(empty($modSettings['message_index_preview_first']) ? 'last_post' : 'first_post')]['preview'], '"><span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span></span>', $topic['is_sticky'] ? '</strong>' : '', ' |
||
143 | </div> |
||
144 | <p class="floatleft"> |
||
145 | ', $topic['first_post']['started_by'], ' |
||
146 | </p> |
||
147 | ', !empty($topic['pages']) ? '<span id="pages' . $topic['first_post']['id'] . '" class="topic_pages">' . $topic['pages'] . '</span>' : '', ' |
||
148 | </div><!-- .info --> |
||
149 | <div class="board_stats centertext"> |
||
150 | <p> |
||
151 | ', $topic['replies'], ' ', $txt['replies'], ' |
||
152 | <br> |
||
153 | ', $topic['views'], ' ', $txt['views'], ' |
||
154 | </p> |
||
155 | </div> |
||
156 | <div class="lastpost"> |
||
157 | ', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), ' |
||
158 | </div>'; |
||
159 | |||
160 | if ($context['showCheckboxes']) |
||
161 | echo ' |
||
162 | <div class="moderation"> |
||
163 | <input type="checkbox" name="topics[]" value="', $topic['id'], '"> |
||
164 | </div>'; |
||
165 | |||
166 | echo ' |
||
167 | </div><!-- $topic[css_class] -->'; |
||
168 | } |
||
169 | |||
170 | if (empty($context['topics'])) |
||
171 | echo ' |
||
172 | <div style="display: none;"></div>'; |
||
173 | |||
174 | echo ' |
||
175 | </div><!-- #topic_container --> |
||
176 | </div><!-- #unread -->'; |
||
177 | |||
178 | echo ' |
||
179 | <div class="pagesection"> |
||
180 | ', !empty($context['recent_buttons']) ? template_button_strip($context['recent_buttons'], 'right') : '', ' |
||
0 ignored issues
–
show
Are you sure the usage of
template_button_strip($c...ent_buttons'], 'right') 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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
181 | ', $context['menu_separator'], ' |
||
182 | <div class="pagelinks"> |
||
183 | <a href="#recent" class="button">', $txt['go_up'], '</a> |
||
184 | ', $context['page_index'], ' |
||
185 | </div> |
||
186 | </div>'; |
||
187 | } |
||
188 | else |
||
189 | echo ' |
||
190 | <div class="cat_bar"> |
||
191 | <h3 class="catbg centertext"> |
||
192 | ', $context['showing_all_topics'] ? $txt['topic_alert_none'] : $txt['unread_topics_visit_none'], ' |
||
193 | </h3> |
||
194 | </div>'; |
||
195 | |||
196 | if ($context['showCheckboxes']) |
||
197 | echo ' |
||
198 | </form>'; |
||
199 | |||
200 | echo ' |
||
201 | </div><!-- #recent -->'; |
||
202 | |||
203 | if (empty($context['no_topic_listing'])) |
||
204 | template_topic_legend(); |
||
205 | } |
||
206 | |||
207 | /** |
||
208 | * Template for showing unread replies (eg new replies to topics you've posted in) |
||
209 | */ |
||
210 | function template_replies() |
||
211 | { |
||
212 | global $context, $settings, $txt, $scripturl, $modSettings; |
||
213 | |||
214 | echo ' |
||
215 | <div id="recent">'; |
||
216 | |||
217 | if ($context['showCheckboxes']) |
||
218 | echo ' |
||
219 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm"> |
||
220 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
||
221 | <input type="hidden" name="qaction" value="markread"> |
||
222 | <input type="hidden" name="redirect_url" value="action=unreadreplies', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '">'; |
||
223 | |||
224 | if (!empty($context['topics'])) |
||
225 | { |
||
226 | echo ' |
||
227 | <div class="pagesection"> |
||
228 | ', $context['menu_separator'], ' |
||
229 | <div class="pagelinks floatleft"> |
||
230 | <a href="#bot" class="button">', $txt['go_down'], '</a> |
||
231 | ', $context['page_index'], ' |
||
232 | </div> |
||
233 | ', !empty($context['recent_buttons']) ? template_button_strip($context['recent_buttons'], 'right') : '', ' |
||
0 ignored issues
–
show
Are you sure the usage of
template_button_strip($c...ent_buttons'], 'right') 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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
234 | </div>'; |
||
235 | |||
236 | echo ' |
||
237 | <div id="unreadreplies"> |
||
238 | <div id="topic_header" class="title_bar"> |
||
239 | <div class="board_icon"></div> |
||
240 | <div class="info"> |
||
241 | <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=subject', $context['sort_by'] === 'subject' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] === 'subject' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
||
242 | </div> |
||
243 | <div class="board_stats centertext"> |
||
244 | <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] === 'replies' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] === 'replies' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
||
245 | </div> |
||
246 | <div class="lastpost"> |
||
247 | <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] === 'last_post' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] === 'last_post' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
||
248 | </div>'; |
||
249 | |||
250 | // Show a "select all" box for quick moderation? |
||
251 | if ($context['showCheckboxes']) |
||
252 | echo ' |
||
253 | <div class="moderation"> |
||
254 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');"> |
||
255 | </div>'; |
||
256 | |||
257 | echo ' |
||
258 | </div><!-- #topic_header --> |
||
259 | <div id="topic_container">'; |
||
260 | |||
261 | foreach ($context['topics'] as $topic) |
||
262 | { |
||
263 | echo ' |
||
264 | <div class="', $topic['css_class'], '"> |
||
265 | <div class="board_icon"> |
||
266 | <img src="', $topic['first_post']['icon_url'], '" alt=""> |
||
267 | ', $topic['is_posted_in'] ? '<img class="posted" src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="">' : '', ' |
||
268 | </div> |
||
269 | <div class="info">'; |
||
270 | |||
271 | // Now we handle the icons |
||
272 | echo ' |
||
273 | <div class="icons floatright">'; |
||
274 | |||
275 | if ($topic['is_locked']) |
||
276 | echo ' |
||
277 | <span class="main_icons lock"></span>'; |
||
278 | |||
279 | if ($topic['is_sticky']) |
||
280 | echo ' |
||
281 | <span class="main_icons sticky"></span>'; |
||
282 | |||
283 | if ($topic['is_poll']) |
||
284 | echo ' |
||
285 | <span class="main_icons poll"></span>'; |
||
286 | |||
287 | echo ' |
||
288 | </div>'; |
||
289 | |||
290 | echo ' |
||
291 | <div class="recent_title"> |
||
292 | <a href="', $topic['new_href'], '" id="newicon', $topic['first_post']['id'], '" class="new_posts">' . $txt['new'] . '</a> |
||
293 | ', $topic['is_sticky'] ? '<strong>' : '', '<span title="', $topic[(empty($modSettings['message_index_preview_first']) ? 'last_post' : 'first_post')]['preview'], '"><span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '</strong>' : '', ' |
||
294 | </div> |
||
295 | <p class="floatleft"> |
||
296 | ', $topic['first_post']['started_by'], ' |
||
297 | </p> |
||
298 | ', !empty($topic['pages']) ? '<span id="pages' . $topic['first_post']['id'] . '" class="topic_pages">' . $topic['pages'] . '</span>' : '', ' |
||
299 | </div><!-- .info --> |
||
300 | <div class="board_stats centertext"> |
||
301 | <p> |
||
302 | ', $topic['replies'], ' ', $txt['replies'], ' |
||
303 | <br> |
||
304 | ', $topic['views'], ' ', $txt['views'], ' |
||
305 | </p> |
||
306 | </div> |
||
307 | <div class="lastpost"> |
||
308 | ', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), ' |
||
309 | </div>'; |
||
310 | |||
311 | if ($context['showCheckboxes']) |
||
312 | echo ' |
||
313 | <div class="moderation"> |
||
314 | <input type="checkbox" name="topics[]" value="', $topic['id'], '"> |
||
315 | </div>'; |
||
316 | |||
317 | echo ' |
||
318 | </div><!-- $topic[css_class] -->'; |
||
319 | } |
||
320 | |||
321 | echo ' |
||
322 | </div><!-- #topic_container --> |
||
323 | </div><!-- #unreadreplies --> |
||
324 | <div class="pagesection"> |
||
325 | ', !empty($context['recent_buttons']) ? template_button_strip($context['recent_buttons'], 'right') : '', ' |
||
0 ignored issues
–
show
Are you sure the usage of
template_button_strip($c...ent_buttons'], 'right') 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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
326 | ', $context['menu_separator'], ' |
||
327 | <div class="pagelinks"> |
||
328 | <a href="#recent" class="button">', $txt['go_up'], '</a> |
||
329 | ', $context['page_index'], ' |
||
330 | </div> |
||
331 | </div>'; |
||
332 | } |
||
333 | else |
||
334 | echo ' |
||
335 | <div class="cat_bar"> |
||
336 | <h3 class="catbg centertext"> |
||
337 | ', $context['showing_all_topics'] ? $txt['topic_alert_none'] : $txt['updated_topics_visit_none'], ' |
||
338 | </h3> |
||
339 | </div>'; |
||
340 | |||
341 | if ($context['showCheckboxes']) |
||
342 | echo ' |
||
343 | </form>'; |
||
344 | |||
345 | echo ' |
||
346 | </div><!-- #recent -->'; |
||
347 | |||
348 | if (empty($context['no_topic_listing'])) |
||
349 | template_topic_legend(); |
||
350 | } |
||
351 | |||
352 | ?> |
This check looks for function or method calls that always return null and whose return value is used.
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.