|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Simple Machines Forum (SMF) |
|
4
|
|
|
* |
|
5
|
|
|
* @package SMF |
|
6
|
|
|
* @author Simple Machines http://www.simplemachines.org |
|
7
|
|
|
* @copyright 2017 Simple Machines and individual contributors |
|
8
|
|
|
* @license http://www.simplemachines.org/about/smf/license.php BSD |
|
9
|
|
|
* |
|
10
|
|
|
* @version 2.1 Beta 4 |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* The top part of the outer layer of the boardindex |
|
15
|
|
|
*/ |
|
16
|
|
|
function template_boardindex_outer_above() |
|
17
|
|
|
{ |
|
18
|
|
|
template_newsfader(); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* This shows the newsfader |
|
23
|
|
|
*/ |
|
24
|
|
|
function template_newsfader() |
|
25
|
|
|
{ |
|
26
|
|
|
global $context, $settings; |
|
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
// Show the news fader? (assuming there are things to show...) |
|
29
|
|
|
if (!empty($settings['show_newsfader']) && !empty($context['news_lines'])) |
|
30
|
|
|
{ |
|
31
|
|
|
echo ' |
|
32
|
|
|
<ul id="smf_slider" class="roundframe">'; |
|
33
|
|
|
|
|
34
|
|
|
foreach ($context['news_lines'] as $news) |
|
35
|
|
|
{ |
|
36
|
|
|
echo ' |
|
37
|
|
|
<li>', $news, '</li>'; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
echo ' |
|
41
|
|
|
</ul> |
|
42
|
|
|
<script> |
|
43
|
|
|
jQuery("#smf_slider").slippry({ |
|
44
|
|
|
pause: ', $settings['newsfader_time'], ', |
|
45
|
|
|
adaptiveHeight: 0, |
|
46
|
|
|
captions: 0, |
|
47
|
|
|
controls: 0, |
|
48
|
|
|
}); |
|
49
|
|
|
</script>'; |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* This actually displays the board index |
|
55
|
|
|
*/ |
|
56
|
|
|
function template_main() |
|
57
|
|
|
{ |
|
58
|
|
|
global $context, $txt, $scripturl; |
|
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
echo ' |
|
61
|
|
|
<div id="boardindex_table" class="boardindex_table">'; |
|
62
|
|
|
|
|
63
|
|
|
/* Each category in categories is made up of: |
|
64
|
|
|
id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?), |
|
65
|
|
|
new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image), |
|
66
|
|
|
and boards. (see below.) */ |
|
67
|
|
|
foreach ($context['categories'] as $category) |
|
68
|
|
|
{ |
|
69
|
|
|
// If theres no parent boards we can see, avoid showing an empty category (unless its collapsed) |
|
70
|
|
|
if (empty($category['boards']) && !$category['is_collapsed']) |
|
71
|
|
|
continue; |
|
72
|
|
|
|
|
73
|
|
|
echo ' |
|
74
|
|
|
<div class="main_container"> |
|
75
|
|
|
<div class="cat_bar ', $category['is_collapsed'] ? 'collapsed' : '','" id="category_', $category['id'], '"> |
|
76
|
|
|
<h3 class="catbg">'; |
|
77
|
|
|
|
|
78
|
|
|
// If this category even can collapse, show a link to collapse it. |
|
79
|
|
|
if ($category['can_collapse']) |
|
80
|
|
|
echo ' |
|
81
|
|
|
<span id="category_', $category['id'], '_upshrink" class="', $category['is_collapsed'] ? 'toggle_down' : 'toggle_up', ' floatright" data-collapsed="', (int) $category['is_collapsed'], '" title="', !$category['is_collapsed'] ? $txt['hide_category'] : $txt['show_category'], '" style="display: none;"></span>'; |
|
82
|
|
|
|
|
83
|
|
|
echo ' |
|
84
|
|
|
', $category['link'], ' |
|
85
|
|
|
</h3>', !empty($category['description']) ? ' |
|
86
|
|
|
<div class="desc">' . $category['description'] . '</div>' : '', ' |
|
87
|
|
|
</div> |
|
88
|
|
|
<div id="category_', $category['id'], '_boards" ', (!empty($category['css_class']) ? ('class="' . $category['css_class'] . '"') : ''), '>'; |
|
89
|
|
|
|
|
90
|
|
|
/* Each board in each category's boards has: |
|
91
|
|
|
new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.), |
|
92
|
|
|
children (see below.), link_children (easier to use.), children_new (are they new?), |
|
93
|
|
|
topics (# of), posts (# of), link, href, and last_post. (see below.) */ |
|
94
|
|
|
foreach ($category['boards'] as $board) |
|
95
|
|
|
{ |
|
96
|
|
|
echo ' |
|
97
|
|
|
<div id="board_', $board['id'], '" class="up_contain ', (!empty($board['css_class']) ? $board['css_class'] : ''), '"> |
|
98
|
|
|
<div class="board_icon">', function_exists('template_bi_' . $board['type'] . '_icon') ? call_user_func('template_bi_' . $board['type'] . '_icon', $board) : template_bi_board_icon($board), ' |
|
99
|
|
|
</div> |
|
100
|
|
|
<div class="info">', function_exists('template_bi_' . $board['type'] . '_info') ? call_user_func('template_bi_' . $board['type'] . '_info', $board) : template_bi_board_info($board); |
|
101
|
|
|
|
|
102
|
|
|
// Show some basic information about the number of posts, etc. |
|
103
|
|
|
echo ' |
|
104
|
|
|
</div> |
|
105
|
|
|
<div class="board_stats">', function_exists('template_bi_' . $board['type'] . '_stats') ? call_user_func('template_bi_' . $board['type'] . '_stats', $board) : template_bi_board_stats($board), ' |
|
106
|
|
|
</div> |
|
107
|
|
|
<div class="lastpost ',!empty($board['last_post']['id']) ? 'lpr_border' : 'hidden', '">', function_exists('template_bi_' . $board['type'] . '_lastpost') ? call_user_func('template_bi_' . $board['type'] . '_lastpost', $board) : template_bi_board_lastpost($board), ' |
|
108
|
|
|
</div>'; |
|
109
|
|
|
|
|
110
|
|
|
// Won't somebody think of the children! |
|
111
|
|
|
if (function_exists('template_bi_' . $board['type'] . '_children')) |
|
112
|
|
|
call_user_func('template_bi_' . $board['type'] . '_children', $board); |
|
113
|
|
|
else |
|
114
|
|
|
template_bi_board_children($board); |
|
115
|
|
|
|
|
116
|
|
|
echo ' |
|
117
|
|
|
</div><!-- #board_[id] -->'; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
echo ' |
|
121
|
|
|
</div><!-- #category_[id]_boards --> |
|
122
|
|
|
</div><!-- .main_container -->'; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
echo ' |
|
126
|
|
|
</div><!-- #boardindex_table -->'; |
|
127
|
|
|
|
|
128
|
|
|
// Show the mark all as read button? |
|
129
|
|
|
if ($context['user']['is_logged'] && !empty($context['categories'])) |
|
130
|
|
|
echo ' |
|
131
|
|
|
<div class="mark_read"> |
|
132
|
|
|
', template_button_strip($context['mark_read_button'], 'right'), ' |
|
133
|
|
|
</div>'; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* Outputs the board icon for a standard board. |
|
138
|
|
|
* |
|
139
|
|
|
* @param array $board Current board information. |
|
140
|
|
|
*/ |
|
141
|
|
|
function template_bi_board_icon($board) |
|
142
|
|
|
{ |
|
143
|
|
|
global $context, $scripturl; |
|
|
|
|
|
|
144
|
|
|
|
|
145
|
|
|
echo ' |
|
146
|
|
|
<a href="', ($context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '" class="board_', $board['board_class'], '"', !empty($board['board_tooltip']) ? ' title="' . $board['board_tooltip'] . '"' : '', '></a>'; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* Outputs the board icon for a redirect. |
|
151
|
|
|
* |
|
152
|
|
|
* @param array $board Current board information. |
|
153
|
|
|
*/ |
|
154
|
|
|
function template_bi_redirect_icon($board) |
|
155
|
|
|
{ |
|
156
|
|
|
global $context, $scripturl; |
|
|
|
|
|
|
157
|
|
|
|
|
158
|
|
|
echo ' |
|
159
|
|
|
<a href="', $board['href'], '" class="board_', $board['board_class'], '"', !empty($board['board_tooltip']) ? ' title="' . $board['board_tooltip'] . '"' : '', '></a>'; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* Outputs the board info for a standard board or redirect. |
|
164
|
|
|
* |
|
165
|
|
|
* @param array $board Current board information. |
|
166
|
|
|
*/ |
|
167
|
|
|
function template_bi_board_info($board) |
|
168
|
|
|
{ |
|
169
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
|
|
170
|
|
|
|
|
171
|
|
|
echo ' |
|
172
|
|
|
<a class="subject mobile_subject" href="', $board['href'], '" id="b', $board['id'], '"> |
|
173
|
|
|
', $board['name'], ' |
|
174
|
|
|
<p class="board_description mobile_display">', $board['description'], '</p> |
|
175
|
|
|
</a>'; |
|
176
|
|
|
|
|
177
|
|
|
// Has it outstanding posts for approval? |
|
178
|
|
View Code Duplication |
if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) |
|
179
|
|
|
echo ' |
|
180
|
|
|
<a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>'; |
|
181
|
|
|
|
|
182
|
|
|
echo ' |
|
183
|
|
|
<p class="board_description">', $board['description'], '</p>'; |
|
184
|
|
|
|
|
185
|
|
|
// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.) |
|
186
|
|
View Code Duplication |
if (!empty($board['link_moderators'])) |
|
187
|
|
|
echo ' |
|
188
|
|
|
<p class="moderators">', count($board['link_moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>'; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
/** |
|
192
|
|
|
* Outputs the board stats for a standard board. |
|
193
|
|
|
* |
|
194
|
|
|
* @param array $board Current board information. |
|
195
|
|
|
*/ |
|
196
|
|
|
function template_bi_board_stats($board) |
|
197
|
|
|
{ |
|
198
|
|
|
global $txt; |
|
|
|
|
|
|
199
|
|
|
|
|
200
|
|
|
echo ' |
|
201
|
|
|
<p> |
|
202
|
|
|
', comma_format($board['posts']), ' ', $txt['posts'], ' |
|
203
|
|
|
', '<br> ' . comma_format($board['topics']) . ' ' . $txt['board_topics'], ' |
|
204
|
|
|
</p>'; |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* Outputs the board stats for a redirect. |
|
209
|
|
|
* |
|
210
|
|
|
* @param array $board Current board information. |
|
211
|
|
|
*/ |
|
212
|
|
|
function template_bi_redirect_stats($board) |
|
213
|
|
|
{ |
|
214
|
|
|
global $txt; |
|
|
|
|
|
|
215
|
|
|
|
|
216
|
|
|
echo ' |
|
217
|
|
|
<p> |
|
218
|
|
|
', comma_format($board['posts']), ' ', $txt['redirects'], ' |
|
219
|
|
|
</p>'; |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
/** |
|
223
|
|
|
* Outputs the board lastposts for a standard board or a redirect. |
|
224
|
|
|
* When on a mobile device, this may be hidden if no last post exists. |
|
225
|
|
|
* |
|
226
|
|
|
* @param array $board Current board information. |
|
227
|
|
|
*/ |
|
228
|
|
|
function template_bi_board_lastpost($board) |
|
229
|
|
|
{ |
|
230
|
|
View Code Duplication |
if (!empty($board['last_post']['id'])) |
|
231
|
|
|
echo ' |
|
232
|
|
|
<p>', $board['last_post']['last_post_message'], '</p>'; |
|
233
|
|
|
} |
|
234
|
|
|
|
|
235
|
|
|
/** |
|
236
|
|
|
* Outputs the board children for a standard board. |
|
237
|
|
|
* |
|
238
|
|
|
* @param array $board Current board information. |
|
239
|
|
|
*/ |
|
240
|
|
|
function template_bi_board_children($board) |
|
241
|
|
|
{ |
|
242
|
|
|
global $txt, $scripturl, $context; |
|
|
|
|
|
|
243
|
|
|
|
|
244
|
|
|
// Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...) |
|
245
|
|
|
if (!empty($board['children'])) |
|
246
|
|
|
{ |
|
247
|
|
|
// Sort the links into an array with new boards bold so it can be imploded. |
|
248
|
|
|
$children = array(); |
|
249
|
|
|
/* Each child in each board's children has: |
|
250
|
|
|
id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */ |
|
251
|
|
|
foreach ($board['children'] as $child) |
|
252
|
|
|
{ |
|
253
|
|
|
if (!$child['is_redirect']) |
|
254
|
|
|
$child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
255
|
|
|
else |
|
256
|
|
|
$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
|
257
|
|
|
|
|
258
|
|
|
// Has it posts awaiting approval? |
|
259
|
|
|
if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) |
|
260
|
|
|
$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
261
|
|
|
|
|
262
|
|
|
$children[] = $child['new'] ? '<span class="strong">' . $child['link'] . '</span>' : '<span>' . $child['link'] . '</span>'; |
|
263
|
|
|
} |
|
264
|
|
|
|
|
265
|
|
|
echo ' |
|
266
|
|
|
<div id="board_', $board['id'], '_children" class="children"> |
|
267
|
|
|
<p><strong id="child_list_', $board['id'], '">', $txt['sub_boards'], '</strong>', implode($children), '</p> |
|
268
|
|
|
</div>'; |
|
269
|
|
|
} |
|
270
|
|
|
} |
|
271
|
|
|
|
|
272
|
|
|
/** |
|
273
|
|
|
* The lower part of the outer layer of the board index |
|
274
|
|
|
*/ |
|
275
|
|
|
function template_boardindex_outer_below() |
|
276
|
|
|
{ |
|
277
|
|
|
template_info_center(); |
|
278
|
|
|
} |
|
279
|
|
|
|
|
280
|
|
|
/** |
|
281
|
|
|
* Displays the info center |
|
282
|
|
|
*/ |
|
283
|
|
|
function template_info_center() |
|
284
|
|
|
{ |
|
285
|
|
|
global $context, $options, $txt; |
|
|
|
|
|
|
286
|
|
|
|
|
287
|
|
|
if (empty($context['info_center'])) |
|
288
|
|
|
return; |
|
289
|
|
|
|
|
290
|
|
|
// Here's where the "Info Center" starts... |
|
291
|
|
|
echo ' |
|
292
|
|
|
<div class="roundframe" id="info_center"> |
|
293
|
|
|
<div class="title_bar"> |
|
294
|
|
|
<h3 class="titlebg"> |
|
295
|
|
|
<span class="toggle_up floatright" id="upshrink_ic" title="', $txt['hide_infocenter'], '" style="display: none;"></span> |
|
296
|
|
|
<a href="#" id="upshrink_link">', sprintf($txt['info_center_title'], $context['forum_name_html_safe']), '</a> |
|
297
|
|
|
</h3> |
|
298
|
|
|
</div> |
|
299
|
|
|
<div id="upshrinkHeaderIC"', empty($options['collapse_header_ic']) ? '' : ' style="display: none;"', '>'; |
|
300
|
|
|
|
|
301
|
|
|
foreach ($context['info_center'] as $block) |
|
302
|
|
|
{ |
|
303
|
|
|
$func = 'template_ic_block_' . $block['tpl']; |
|
304
|
|
|
$func(); |
|
305
|
|
|
} |
|
306
|
|
|
|
|
307
|
|
|
echo ' |
|
308
|
|
|
</div><!-- #upshrinkHeaderIC --> |
|
309
|
|
|
</div><!-- #info_center -->'; |
|
310
|
|
|
|
|
311
|
|
|
// Info center collapse object. |
|
312
|
|
|
echo ' |
|
313
|
|
|
<script> |
|
314
|
|
|
var oInfoCenterToggle = new smc_Toggle({ |
|
315
|
|
|
bToggleEnabled: true, |
|
316
|
|
|
bCurrentlyCollapsed: ', empty($options['collapse_header_ic']) ? 'false' : 'true', ', |
|
317
|
|
|
aSwappableContainers: [ |
|
318
|
|
|
\'upshrinkHeaderIC\' |
|
319
|
|
|
], |
|
320
|
|
|
aSwapImages: [ |
|
321
|
|
|
{ |
|
322
|
|
|
sId: \'upshrink_ic\', |
|
323
|
|
|
altExpanded: ', JavaScriptEscape($txt['hide_infocenter']), ', |
|
324
|
|
|
altCollapsed: ', JavaScriptEscape($txt['show_infocenter']), ' |
|
325
|
|
|
} |
|
326
|
|
|
], |
|
327
|
|
|
aSwapLinks: [ |
|
328
|
|
|
{ |
|
329
|
|
|
sId: \'upshrink_link\', |
|
330
|
|
|
msgExpanded: ', JavaScriptEscape(sprintf($txt['info_center_title'], $context['forum_name_html_safe'])), ', |
|
331
|
|
|
msgCollapsed: ', JavaScriptEscape(sprintf($txt['info_center_title'], $context['forum_name_html_safe'])), ' |
|
332
|
|
|
} |
|
333
|
|
|
], |
|
334
|
|
|
oThemeOptions: { |
|
335
|
|
|
bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ', |
|
336
|
|
|
sOptionName: \'collapse_header_ic\', |
|
337
|
|
|
sSessionId: smf_session_id, |
|
338
|
|
|
sSessionVar: smf_session_var, |
|
339
|
|
|
}, |
|
340
|
|
|
oCookieOptions: { |
|
341
|
|
|
bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ', |
|
342
|
|
|
sCookieName: \'upshrinkIC\' |
|
343
|
|
|
} |
|
344
|
|
|
}); |
|
345
|
|
|
</script>'; |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
/** |
|
349
|
|
|
* The recent posts section of the info center |
|
350
|
|
|
*/ |
|
351
|
|
|
function template_ic_block_recent() |
|
352
|
|
|
{ |
|
353
|
|
|
global $context, $scripturl, $settings, $txt; |
|
|
|
|
|
|
354
|
|
|
|
|
355
|
|
|
// This is the "Recent Posts" bar. |
|
356
|
|
|
echo ' |
|
357
|
|
|
<div class="sub_bar"> |
|
358
|
|
|
<h4 class="subbg"> |
|
359
|
|
|
<a href="', $scripturl, '?action=recent"><span class="xx"></span>', $txt['recent_posts'], '</a> |
|
360
|
|
|
</h4> |
|
361
|
|
|
</div> |
|
362
|
|
|
<div id="recent_posts_content">'; |
|
363
|
|
|
|
|
364
|
|
|
// Only show one post. |
|
365
|
|
|
if ($settings['number_recent_posts'] == 1) |
|
366
|
|
|
{ |
|
367
|
|
|
// latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.) |
|
368
|
|
|
echo ' |
|
369
|
|
|
<p id="infocenter_onepost" class="inline"> |
|
370
|
|
|
<a href="', $scripturl, '?action=recent">', $txt['recent_view'], '</a> "', sprintf($txt['is_recent_updated'], '"' . $context['latest_post']['link'], '"'), ' (', $context['latest_post']['time'], ')<br> |
|
371
|
|
|
</p>'; |
|
372
|
|
|
} |
|
373
|
|
|
// Show lots of posts. |
|
374
|
|
|
elseif (!empty($context['latest_posts'])) |
|
375
|
|
|
{ |
|
376
|
|
|
echo ' |
|
377
|
|
|
<table id="ic_recentposts"> |
|
378
|
|
|
<tr class="windowbg"> |
|
379
|
|
|
<th class="recentpost">', $txt['message'], '</th> |
|
380
|
|
|
<th class="recentposter">', $txt['author'], '</th> |
|
381
|
|
|
<th class="recentboard">', $txt['board'], '</th> |
|
382
|
|
|
<th class="recenttime">', $txt['date'], '</th> |
|
383
|
|
|
</tr>'; |
|
384
|
|
|
|
|
385
|
|
|
/* Each post in latest_posts has: |
|
386
|
|
|
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.), |
|
387
|
|
|
subject, short_subject (shortened with...), time, link, and href. */ |
|
388
|
|
|
foreach ($context['latest_posts'] as $post) |
|
389
|
|
|
echo ' |
|
390
|
|
|
<tr class="windowbg"> |
|
391
|
|
|
<td class="recentpost"><strong>', $post['link'], '</strong></td> |
|
392
|
|
|
<td class="recentposter">', $post['poster']['link'], '</td> |
|
393
|
|
|
<td class="recentboard">', $post['board']['link'], '</td> |
|
394
|
|
|
<td class="recenttime">', $post['time'], '</td> |
|
395
|
|
|
</tr>'; |
|
396
|
|
|
echo ' |
|
397
|
|
|
</table>'; |
|
398
|
|
|
} |
|
399
|
|
|
echo ' |
|
400
|
|
|
</div><!-- #recent_posts_content -->'; |
|
401
|
|
|
} |
|
402
|
|
|
|
|
403
|
|
|
/** |
|
404
|
|
|
* The calendar section of the info center |
|
405
|
|
|
*/ |
|
406
|
|
|
function template_ic_block_calendar() |
|
407
|
|
|
{ |
|
408
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
|
|
409
|
|
|
|
|
410
|
|
|
// Show information about events, birthdays, and holidays on the calendar. |
|
411
|
|
|
echo ' |
|
412
|
|
|
<div class="sub_bar"> |
|
413
|
|
|
<h4 class="subbg"> |
|
414
|
|
|
<a href="', $scripturl, '?action=calendar' . '"><span class="generic_icons calendar"></span> ', $context['calendar_only_today'] ? $txt['calendar_today'] : $txt['calendar_upcoming'], '</a> |
|
415
|
|
|
</h4> |
|
416
|
|
|
</div>'; |
|
417
|
|
|
|
|
418
|
|
|
// Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P |
|
|
|
|
|
|
419
|
|
|
if (!empty($context['calendar_holidays'])) |
|
420
|
|
|
echo ' |
|
421
|
|
|
<p class="inline holiday"> |
|
422
|
|
|
<span>', $txt['calendar_prompt'], '</span> ', implode(', ', $context['calendar_holidays']), ' |
|
423
|
|
|
</p>'; |
|
424
|
|
|
|
|
425
|
|
|
// People's birthdays. Like mine. And yours, I guess. Kidding. |
|
426
|
|
|
if (!empty($context['calendar_birthdays'])) |
|
427
|
|
|
{ |
|
428
|
|
|
echo ' |
|
429
|
|
|
<p class="inline"> |
|
430
|
|
|
<span class="birthday">', $context['calendar_only_today'] ? $txt['birthdays'] : $txt['birthdays_upcoming'], '</span>'; |
|
431
|
|
|
|
|
432
|
|
|
// Each member in calendar_birthdays has: id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) |
|
433
|
|
|
foreach ($context['calendar_birthdays'] as $member) |
|
434
|
|
|
echo ' |
|
435
|
|
|
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<strong class="fix_rtl_names">' : '', $member['name'], $member['is_today'] ? '</strong>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '' : ', '; |
|
436
|
|
|
|
|
437
|
|
|
echo ' |
|
438
|
|
|
</p>'; |
|
439
|
|
|
} |
|
440
|
|
|
|
|
441
|
|
|
// Events like community get-togethers. |
|
442
|
|
|
if (!empty($context['calendar_events'])) |
|
443
|
|
|
{ |
|
444
|
|
|
echo ' |
|
445
|
|
|
<p class="inline"> |
|
446
|
|
|
<span class="event">', $context['calendar_only_today'] ? $txt['events'] : $txt['events_upcoming'], '</span> '; |
|
447
|
|
|
|
|
448
|
|
|
// Each event in calendar_events should have: |
|
449
|
|
|
// title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. |
|
450
|
|
|
foreach ($context['calendar_events'] as $event) |
|
451
|
|
|
echo ' |
|
452
|
|
|
', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" title="' . $txt['calendar_edit'] . '"><span class="generic_icons calendar_modify"></span></a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<strong>' . $event['title'] . '</strong>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br>' : ', '; |
|
453
|
|
|
echo ' |
|
454
|
|
|
</p>'; |
|
455
|
|
|
} |
|
456
|
|
|
} |
|
457
|
|
|
|
|
458
|
|
|
/** |
|
459
|
|
|
* The stats section of the info center |
|
460
|
|
|
*/ |
|
461
|
|
|
function template_ic_block_stats() |
|
462
|
|
|
{ |
|
463
|
|
|
global $scripturl, $txt, $context, $settings; |
|
|
|
|
|
|
464
|
|
|
|
|
465
|
|
|
// Show statistical style information... |
|
466
|
|
|
echo ' |
|
467
|
|
|
<div class="sub_bar"> |
|
468
|
|
|
<h4 class="subbg"> |
|
469
|
|
|
<a href="', $scripturl, '?action=stats" title="', $txt['more_stats'], '"><span class="generic_icons stats"></span> ', $txt['forum_stats'], '</a> |
|
470
|
|
|
</h4> |
|
471
|
|
|
</div> |
|
472
|
|
|
<p class="inline"> |
|
473
|
|
|
', $context['common_stats']['boardindex_total_posts'], '', !empty($settings['show_latest_member']) ? ' - ' . $txt['latest_member'] . ': <strong> ' . $context['common_stats']['latest_member']['link'] . '</strong>' : '', '<br> |
|
474
|
|
|
', (!empty($context['latest_post']) ? $txt['latest_post'] . ': <strong>"' . $context['latest_post']['link'] . '"</strong> (' . $context['latest_post']['time'] . ')<br>' : ''), ' |
|
475
|
|
|
<a href="', $scripturl, '?action=recent">', $txt['recent_view'], '</a> |
|
476
|
|
|
</p>'; |
|
477
|
|
|
} |
|
478
|
|
|
|
|
479
|
|
|
/** |
|
480
|
|
|
* The who's online section of the admin center |
|
481
|
|
|
*/ |
|
482
|
|
|
function template_ic_block_online() |
|
483
|
|
|
{ |
|
484
|
|
|
global $context, $scripturl, $txt, $modSettings, $settings; |
|
|
|
|
|
|
485
|
|
|
// "Users online" - in order of activity. |
|
486
|
|
|
echo ' |
|
487
|
|
|
<div class="sub_bar"> |
|
488
|
|
|
<h4 class="subbg"> |
|
489
|
|
|
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', '<span class="generic_icons people"></span> ', $txt['online_users'], '', $context['show_who'] ? '</a>' : '', ' |
|
490
|
|
|
</h4> |
|
491
|
|
|
</div> |
|
492
|
|
|
<p class="inline"> |
|
493
|
|
|
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', '<strong>', $txt['online'], ': </strong>', comma_format($context['num_guests']), ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users']; |
|
494
|
|
|
|
|
495
|
|
|
// Handle hidden users and buddies. |
|
496
|
|
|
$bracketList = array(); |
|
497
|
|
|
|
|
498
|
|
View Code Duplication |
if ($context['show_buddies']) |
|
499
|
|
|
$bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
500
|
|
View Code Duplication |
if (!empty($context['num_spiders'])) |
|
501
|
|
|
$bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
502
|
|
|
if (!empty($context['num_users_hidden'])) |
|
503
|
|
|
$bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']); |
|
504
|
|
|
|
|
505
|
|
|
if (!empty($bracketList)) |
|
506
|
|
|
echo ' (' . implode(', ', $bracketList) . ')'; |
|
507
|
|
|
|
|
508
|
|
|
echo $context['show_who'] ? '</a>' : '', ' |
|
509
|
|
|
|
|
510
|
|
|
- ', $txt['most_online_today'], ': <strong>', comma_format($modSettings['mostOnlineToday']), '</strong> - |
|
511
|
|
|
', $txt['most_online_ever'], ': ', comma_format($modSettings['mostOnline']), ' (', timeformat($modSettings['mostDate']), ')<br>'; |
|
512
|
|
|
|
|
513
|
|
|
// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link. |
|
514
|
|
|
if (!empty($context['users_online'])) |
|
515
|
|
|
{ |
|
516
|
|
|
echo ' |
|
517
|
|
|
', sprintf($txt['users_active'], $modSettings['lastActive']), ': ', implode(', ', $context['list_users_online']); |
|
518
|
|
|
|
|
519
|
|
|
// Showing membergroups? |
|
520
|
|
View Code Duplication |
if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) |
|
521
|
|
|
echo ' |
|
522
|
|
|
<span class="membergroups">' . implode(', ', $context['membergroups']) . '</span>'; |
|
523
|
|
|
} |
|
524
|
|
|
|
|
525
|
|
|
echo ' |
|
526
|
|
|
</p>'; |
|
527
|
|
|
} |
|
528
|
|
|
|
|
529
|
|
|
?> |
Instead of relying on
globalstate, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state