|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Simple Machines Forum (SMF) |
|
4
|
|
|
* |
|
5
|
|
|
* @package SMF |
|
6
|
|
|
* @author Simple Machines http://www.simplemachines.org |
|
7
|
|
|
* @copyright 2016 Simple Machines and individual contributors |
|
8
|
|
|
* @license http://www.simplemachines.org/about/smf/license.php BSD |
|
9
|
|
|
* |
|
10
|
|
|
* @version 2.1 Beta 3 |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
/* This template is, perhaps, the most important template in the theme. It |
|
14
|
|
|
contains the main template layer that displays the header and footer of |
|
15
|
|
|
the forum, namely with main_above and main_below. It also contains the |
|
16
|
|
|
menu sub template, which appropriately displays the menu; the init sub |
|
17
|
|
|
template, which is there to set the theme up; (init can be missing.) and |
|
18
|
|
|
the linktree sub template, which sorts out the link tree. |
|
19
|
|
|
|
|
20
|
|
|
The init sub template should load any data and set any hardcoded options. |
|
21
|
|
|
|
|
22
|
|
|
The main_above sub template is what is shown above the main content, and |
|
23
|
|
|
should contain anything that should be shown up there. |
|
24
|
|
|
|
|
25
|
|
|
The main_below sub template, conversely, is shown after the main content. |
|
26
|
|
|
It should probably contain the copyright statement and some other things. |
|
27
|
|
|
|
|
28
|
|
|
The linktree sub template should display the link tree, using the data |
|
29
|
|
|
in the $context['linktree'] variable. |
|
30
|
|
|
|
|
31
|
|
|
The menu sub template should display all the relevant buttons the user |
|
32
|
|
|
wants and or needs. |
|
33
|
|
|
|
|
34
|
|
|
For more information on the templating system, please see the site at: |
|
35
|
|
|
http://www.simplemachines.org/ |
|
36
|
|
|
*/ |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Initialize the template... mainly little settings. |
|
40
|
|
|
*/ |
|
41
|
|
|
function template_init() |
|
42
|
|
|
{ |
|
43
|
|
|
global $settings, $txt; |
|
44
|
|
|
|
|
45
|
|
|
/* $context, $options and $txt may be available for use, but may not be fully populated yet. */ |
|
46
|
|
|
|
|
47
|
|
|
// The version this template/theme is for. This should probably be the version of SMF it was created for. |
|
48
|
|
|
$settings['theme_version'] = '2.1'; |
|
49
|
|
|
|
|
50
|
|
|
// Use plain buttons - as opposed to text buttons? |
|
51
|
|
|
$settings['use_buttons'] = true; |
|
52
|
|
|
|
|
53
|
|
|
// Set the following variable to true if this theme requires the optional theme strings file to be loaded. |
|
54
|
|
|
$settings['require_theme_strings'] = false; |
|
55
|
|
|
|
|
56
|
|
|
// Set the following variable to true is this theme wants to display the avatar of the user that posted the last and the first post on the message index and recent pages. |
|
57
|
|
|
$settings['avatars_on_indexes'] = false; |
|
58
|
|
|
|
|
59
|
|
|
// Set the following variable to true is this theme wants to display the avatar of the user that posted the last post on the board index. |
|
60
|
|
|
$settings['avatars_on_boardIndex'] = false; |
|
61
|
|
|
|
|
62
|
|
|
// This defines the formatting for the page indexes used throughout the forum. |
|
63
|
|
|
$settings['page_index'] = array( |
|
64
|
|
|
'extra_before' => '<span class="pages">' . $txt['pages'] . '</span>', |
|
65
|
|
|
'previous_page' => '<span class="generic_icons previous_page"></span>', |
|
66
|
|
|
'current_page' => '<span class="current_page">%1$d</span> ', |
|
67
|
|
|
'page' => '<a class="navPages" href="{URL}">%2$s</a> ', |
|
68
|
|
|
'expand_pages' => '<span class="expand_pages" onclick="expandPages(this, {LINK}, {FIRST_PAGE}, {LAST_PAGE}, {PER_PAGE});"> ... </span>', |
|
69
|
|
|
'next_page' => '<span class="generic_icons next_page"></span>', |
|
70
|
|
|
'extra_after' => '', |
|
71
|
|
|
); |
|
72
|
|
|
|
|
73
|
|
|
// Allow css/js files to be disable for this specific theme. |
|
74
|
|
|
// Add the identifier as an array key. IE array('smf_script'); Some external files might not add identifiers, on those cases SMF uses its filename as reference. |
|
75
|
|
|
if (!isset($settings['disable_files'])) |
|
76
|
|
|
$settings['disable_files'] = array(); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* The main sub template above the content. |
|
81
|
|
|
*/ |
|
82
|
|
|
function template_html_above() |
|
83
|
|
|
{ |
|
84
|
|
|
global $context, $settings, $scripturl, $txt, $modSettings, $mbname; |
|
85
|
|
|
|
|
86
|
|
|
// Show right to left, the language code, and the character set for ease of translating. |
|
87
|
|
|
echo '<!DOCTYPE html> |
|
88
|
|
|
<html', $context['right_to_left'] ? ' dir="rtl"' : '', !empty($txt['lang_locale']) ? ' lang="' . str_replace("_", "-", substr($txt['lang_locale'], 0, strcspn($txt['lang_locale'], "."))) . '"' : '' , '> |
|
89
|
|
|
<head> |
|
90
|
|
|
<meta charset="', $context['character_set'], '">'; |
|
91
|
|
|
|
|
92
|
|
|
// You don't need to manually load index.css, this will be set up for you. You can, of course, add |
|
93
|
|
|
// any other files you want, after template_css() has been run. Note that RTL will also be loaded for you. |
|
94
|
|
|
|
|
95
|
|
|
// The most efficient way of writing multi themes is to use a master index.css plus variant.css files. |
|
96
|
|
|
// If you've set them up properly (through $settings['theme_variants'], loadCSSFile will load the variant files for you. |
|
97
|
|
|
|
|
98
|
|
|
// load in any css from mods or themes so they can overwrite if wanted |
|
99
|
|
|
template_css(); |
|
100
|
|
|
|
|
101
|
|
|
// load in any javascript files from mods and themes |
|
102
|
|
|
template_javascript(); |
|
103
|
|
|
|
|
104
|
|
|
echo ' |
|
105
|
|
|
<title>', $context['page_title_html_safe'], '</title> |
|
106
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">'; |
|
107
|
|
|
|
|
108
|
|
|
// Content related meta tags, like description, keywords, Open Graph stuff, etc... |
|
109
|
|
|
foreach ($context['meta_tags'] as $meta_tag) |
|
110
|
|
|
{ |
|
111
|
|
|
echo ' |
|
112
|
|
|
<meta'; |
|
113
|
|
|
|
|
114
|
|
|
foreach ($meta_tag as $meta_key => $meta_value) |
|
115
|
|
|
echo ' ', $meta_key, '="', $meta_value, '"'; |
|
116
|
|
|
|
|
117
|
|
|
echo '>'; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/* What is your Lollipop's color? |
|
121
|
|
|
Theme Authors you can change here to make sure your theme's main color got visible on tab */ |
|
122
|
|
|
echo ' |
|
123
|
|
|
<meta name="theme-color" content="#557EA0">'; |
|
124
|
|
|
|
|
125
|
|
|
// Please don't index these Mr Robot. |
|
126
|
|
|
if (!empty($context['robot_no_index'])) |
|
127
|
|
|
echo ' |
|
128
|
|
|
<meta name="robots" content="noindex">'; |
|
129
|
|
|
|
|
130
|
|
|
// Present a canonical url for search engines to prevent duplicate content in their indices. |
|
131
|
|
|
if (!empty($context['canonical_url'])) |
|
132
|
|
|
echo ' |
|
133
|
|
|
<link rel="canonical" href="', $context['canonical_url'], '">'; |
|
134
|
|
|
|
|
135
|
|
|
// Show all the relative links, such as help, search, contents, and the like. |
|
136
|
|
|
echo ' |
|
137
|
|
|
<link rel="help" href="', $scripturl, '?action=help"> |
|
138
|
|
|
<link rel="contents" href="', $scripturl, '">', ($context['allow_search'] ? ' |
|
139
|
|
|
<link rel="search" href="' . $scripturl . '?action=search">' : ''); |
|
140
|
|
|
|
|
141
|
|
|
// If RSS feeds are enabled, advertise the presence of one. |
|
142
|
|
|
if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) |
|
143
|
|
|
echo ' |
|
144
|
|
|
<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss2;action=.xml"> |
|
145
|
|
|
<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?type=atom;action=.xml">'; |
|
146
|
|
|
|
|
147
|
|
|
// If we're viewing a topic, these should be the previous and next topics, respectively. |
|
148
|
|
View Code Duplication |
if (!empty($context['links']['next'])) |
|
|
|
|
|
|
149
|
|
|
{ |
|
150
|
|
|
echo ' |
|
151
|
|
|
<link rel="next" href="', $context['links']['next'], '">'; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
View Code Duplication |
if (!empty($context['links']['prev'])) |
|
|
|
|
|
|
155
|
|
|
{ |
|
156
|
|
|
echo ' |
|
157
|
|
|
<link rel="prev" href="', $context['links']['prev'], '">'; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
// If we're in a board, or a topic for that matter, the index will be the board's index. |
|
161
|
|
|
if (!empty($context['current_board'])) |
|
162
|
|
|
echo ' |
|
163
|
|
|
<link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0">'; |
|
164
|
|
|
|
|
165
|
|
|
// Output any remaining HTML headers. (from mods, maybe?) |
|
166
|
|
|
echo $context['html_headers']; |
|
167
|
|
|
|
|
168
|
|
|
echo ' |
|
169
|
|
|
</head> |
|
170
|
|
|
<body id="', $context['browser_body_id'], '" class="action_', !empty($context['current_action']) ? $context['current_action'] : (!empty($context['current_board']) ? |
|
171
|
|
|
'messageindex' : (!empty($context['current_topic']) ? 'display' : 'home')), !empty($context['current_board']) ? ' board_' . $context['current_board'] : '', '"> |
|
172
|
|
|
<div id="footerfix">'; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* The upper part of the main template layer. This is the stuff that shows above the main forum content. |
|
177
|
|
|
*/ |
|
178
|
|
|
function template_body_above() |
|
179
|
|
|
{ |
|
180
|
|
|
global $context, $settings, $scripturl, $txt, $modSettings; |
|
181
|
|
|
|
|
182
|
|
|
// Wrapper div now echoes permanently for better layout options. h1 a is now target for "Go up" links. |
|
183
|
|
|
echo ' |
|
184
|
|
|
<div id="top_section">'; |
|
185
|
|
|
|
|
186
|
|
|
// If the user is logged in, display some things that might be useful. |
|
187
|
|
|
if ($context['user']['is_logged']) |
|
188
|
|
|
{ |
|
189
|
|
|
// Firstly, the user's menu |
|
190
|
|
|
echo ' |
|
191
|
|
|
<ul class="floatleft" id="top_info"> |
|
192
|
|
|
<li> |
|
193
|
|
|
<a href="', $scripturl, '?action=profile"', !empty($context['self_profile']) ? ' class="active"' : '', ' id="profile_menu_top" onclick="return false;">'; |
|
194
|
|
|
if (!empty($context['user']['avatar'])) |
|
195
|
|
|
echo $context['user']['avatar']['image']; |
|
196
|
|
|
echo $context['user']['name'], '</a> |
|
197
|
|
|
<div id="profile_menu" class="top_menu"></div> |
|
198
|
|
|
</li>'; |
|
199
|
|
|
|
|
200
|
|
|
// Secondly, PMs if we're doing them |
|
201
|
|
|
if ($context['allow_pm']) |
|
202
|
|
|
{ |
|
203
|
|
|
echo ' |
|
204
|
|
|
<li> |
|
205
|
|
|
<a href="', $scripturl, '?action=pm"', !empty($context['self_pm']) ? ' class="active"' : '', ' id="pm_menu_top">', $txt['pm_short'], !empty($context['user']['unread_messages']) ? ' <span class="amt">' . $context['user']['unread_messages'] . '</span>' : '', '</a> |
|
206
|
|
|
<div id="pm_menu" class="top_menu scrollable"></div> |
|
207
|
|
|
</li>'; |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
// Thirdly, alerts |
|
211
|
|
|
echo ' |
|
212
|
|
|
<li> |
|
213
|
|
|
<a href="', $scripturl, '?action=profile;area=showalerts;u=', $context['user']['id'] ,'"', !empty($context['self_alerts']) ? ' class="active"' : '', ' id="alerts_menu_top">', $txt['alerts'], !empty($context['user']['alerts']) ? ' <span class="amt">' . $context['user']['alerts'] . '</span>' : '', '</a> |
|
214
|
|
|
<div id="alerts_menu" class="top_menu scrollable"></div> |
|
215
|
|
|
</li>'; |
|
216
|
|
|
|
|
217
|
|
|
// And now we're done. |
|
218
|
|
|
echo ' |
|
219
|
|
|
</ul>'; |
|
220
|
|
|
} |
|
221
|
|
|
// Otherwise they're a guest. Ask them to either register or login. |
|
222
|
|
|
else |
|
223
|
|
|
echo ' |
|
224
|
|
|
<ul class="floatleft welcome"> |
|
225
|
|
|
<li>', sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'), '</li> |
|
226
|
|
|
</ul>'; |
|
227
|
|
|
|
|
228
|
|
|
if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1) |
|
229
|
|
|
{ |
|
230
|
|
|
echo ' |
|
231
|
|
|
<form id="languages_form" method="get" class="floatright"> |
|
232
|
|
|
<select id="language_select" name="language" onchange="this.form.submit()">'; |
|
233
|
|
|
|
|
234
|
|
|
foreach ($context['languages'] as $language) |
|
235
|
|
|
echo ' |
|
236
|
|
|
<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', str_replace('-utf8', '', $language['name']), '</option>'; |
|
237
|
|
|
|
|
238
|
|
|
echo ' |
|
239
|
|
|
</select> |
|
240
|
|
|
<noscript> |
|
241
|
|
|
<input type="submit" value="', $txt['quick_mod_go'], '" /> |
|
242
|
|
|
</noscript> |
|
243
|
|
|
</form>'; |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
if ($context['allow_search']) |
|
247
|
|
|
{ |
|
248
|
|
|
echo ' |
|
249
|
|
|
<form id="search_form" class="floatright" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '"> |
|
250
|
|
|
<input type="search" name="search" value="" class="input_text"> '; |
|
251
|
|
|
|
|
252
|
|
|
// Using the quick search dropdown? |
|
253
|
|
|
$selected = !empty($context['current_topic']) ? 'current_topic' : (!empty($context['current_board']) ? 'current_board' : 'all'); |
|
254
|
|
|
|
|
255
|
|
|
echo ' |
|
256
|
|
|
<select name="search_selection"> |
|
257
|
|
|
<option value="all"', ($selected == 'all' ? ' selected' : ''), '>', $txt['search_entireforum'], ' </option>'; |
|
258
|
|
|
|
|
259
|
|
|
// Can't limit it to a specific topic if we are not in one |
|
260
|
|
|
if (!empty($context['current_topic'])) |
|
261
|
|
|
echo ' |
|
262
|
|
|
<option value="topic"', ($selected == 'current_topic' ? ' selected' : ''), '>', $txt['search_thistopic'], '</option>'; |
|
263
|
|
|
|
|
264
|
|
|
// Can't limit it to a specific board if we are not in one |
|
265
|
|
|
if (!empty($context['current_board'])) |
|
266
|
|
|
echo ' |
|
267
|
|
|
<option value="board"', ($selected == 'current_board' ? ' selected' : ''), '>', $txt['search_thisbrd'], '</option>'; |
|
268
|
|
|
|
|
269
|
|
|
// Can't search for members if we can't see the memberlist |
|
270
|
|
|
if (!empty($context['allow_memberlist'])) |
|
271
|
|
|
echo ' |
|
272
|
|
|
<option value="members"', ($selected == 'members' ? ' selected' : ''), '>', $txt['search_members'], ' </option>'; |
|
273
|
|
|
|
|
274
|
|
|
echo ' |
|
275
|
|
|
</select>'; |
|
276
|
|
|
|
|
277
|
|
|
// Search within current topic? |
|
278
|
|
View Code Duplication |
if (!empty($context['current_topic'])) |
|
|
|
|
|
|
279
|
|
|
echo ' |
|
280
|
|
|
<input type="hidden" name="sd_topic" value="', $context['current_topic'], '">'; |
|
281
|
|
|
// If we're on a certain board, limit it to this board ;). |
|
282
|
|
|
elseif (!empty($context['current_board'])) |
|
283
|
|
|
echo ' |
|
284
|
|
|
<input type="hidden" name="sd_brd" value="', $context['current_board'], '">'; |
|
285
|
|
|
|
|
286
|
|
|
echo ' |
|
287
|
|
|
<input type="submit" name="search2" value="', $txt['search'], '" class="button_submit"> |
|
288
|
|
|
<input type="hidden" name="advanced" value="0"> |
|
289
|
|
|
</form>'; |
|
290
|
|
|
} |
|
291
|
|
|
|
|
292
|
|
|
echo ' |
|
293
|
|
|
</div>'; |
|
294
|
|
|
|
|
295
|
|
|
echo ' |
|
296
|
|
|
<div id="header"> |
|
297
|
|
|
<h1 class="forumtitle"> |
|
298
|
|
|
<a id="top" href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name_html_safe'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name_html_safe'] . '">', '</a> |
|
299
|
|
|
</h1>'; |
|
300
|
|
|
|
|
301
|
|
|
echo ' |
|
302
|
|
|
', empty($settings['site_slogan']) ? '<img id="smflogo" src="' . $settings['images_url'] . '/smflogo.png" alt="Simple Machines Forum" title="Simple Machines Forum">' : '<div id="siteslogan" class="floatright">' . $settings['site_slogan'] . '</div>', ''; |
|
303
|
|
|
|
|
304
|
|
|
echo' |
|
305
|
|
|
</div> |
|
306
|
|
|
<div id="wrapper"> |
|
307
|
|
|
<div id="upper_section"> |
|
308
|
|
|
<div id="inner_section"> |
|
309
|
|
|
<div id="inner_wrap"> |
|
310
|
|
|
<div class="user"> |
|
311
|
|
|
', $context['current_time'], ' |
|
312
|
|
|
</div>'; |
|
313
|
|
|
// Show a random news item? (or you could pick one from news_lines...) |
|
314
|
|
|
if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) |
|
315
|
|
|
echo ' |
|
316
|
|
|
<div class="news"> |
|
317
|
|
|
<h2>', $txt['news'], ': </h2> |
|
318
|
|
|
<p>', $context['random_news_line'], '</p> |
|
319
|
|
|
</div>'; |
|
320
|
|
|
|
|
321
|
|
|
echo ' |
|
322
|
|
|
<hr class="clear"> |
|
323
|
|
|
</div>'; |
|
324
|
|
|
|
|
325
|
|
|
// Load mobile menu here |
|
326
|
|
|
echo ' |
|
327
|
|
|
<a class="menu_icon mobile_user_menu"></a> |
|
328
|
|
|
<div id="mobile_user_menu" class="popup_container"> |
|
329
|
|
|
<div class="popup_window description"> |
|
330
|
|
|
<div class="popup_heading">', $txt['mobile_user_menu'],' |
|
331
|
|
|
<a href="javascript:void(0);" class="generic_icons hide_popup"></a></div> |
|
332
|
|
|
', template_menu(), ' |
|
333
|
|
|
</div> |
|
334
|
|
|
</div>'; |
|
335
|
|
|
|
|
336
|
|
|
// Show the menu here, according to the menu sub template, followed by the navigation tree. |
|
337
|
|
|
echo ' |
|
338
|
|
|
<div id="main_menu">'; |
|
339
|
|
|
template_menu(); |
|
340
|
|
|
|
|
341
|
|
|
echo ' |
|
342
|
|
|
</div>'; |
|
343
|
|
|
|
|
344
|
|
|
theme_linktree(); |
|
345
|
|
|
|
|
346
|
|
|
echo ' |
|
347
|
|
|
</div> |
|
348
|
|
|
</div>'; |
|
349
|
|
|
|
|
350
|
|
|
// The main content should go here. |
|
351
|
|
|
echo ' |
|
352
|
|
|
<div id="content_section"> |
|
353
|
|
|
<div id="main_content_section">'; |
|
354
|
|
|
} |
|
355
|
|
|
|
|
356
|
|
|
/** |
|
357
|
|
|
* The stuff shown immediately below the main content, including the footer |
|
358
|
|
|
*/ |
|
359
|
|
|
function template_body_below() |
|
360
|
|
|
{ |
|
361
|
|
|
global $context, $txt, $scripturl, $modSettings; |
|
362
|
|
|
|
|
363
|
|
|
echo ' |
|
364
|
|
|
</div> |
|
365
|
|
|
</div> |
|
366
|
|
|
</div> |
|
367
|
|
|
</div>'; |
|
368
|
|
|
|
|
369
|
|
|
// Show the XHTML, RSS and WAP2 links, as well as the copyright. |
|
370
|
|
|
// Footer is now full-width by default. |
|
371
|
|
|
echo ' |
|
372
|
|
|
<div id="footer">'; |
|
373
|
|
|
|
|
374
|
|
|
// There is now a global "Go to top" link at the right. |
|
375
|
|
|
echo ' |
|
376
|
|
|
<ul> |
|
377
|
|
|
<li class="floatright"><a href="', $scripturl, '?action=help">', $txt['help'], '</a> ', (!empty($modSettings['requireAgreement'])) ? '| <a href="'. $scripturl. '?action=help;sa=rules">'. $txt['terms_and_rules']. '</a>' : '', ' | <a href="#top_section">', $txt['go_up'], ' ▲</a></li> |
|
378
|
|
|
<li class="copyright">', theme_copyright(), '</li> |
|
379
|
|
|
</ul>'; |
|
380
|
|
|
|
|
381
|
|
|
// Show the load time? |
|
382
|
|
|
if ($context['show_load_time']) |
|
383
|
|
|
echo ' |
|
384
|
|
|
<p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>'; |
|
385
|
|
|
|
|
386
|
|
|
echo ' |
|
387
|
|
|
</div>'; |
|
388
|
|
|
|
|
389
|
|
|
} |
|
390
|
|
|
|
|
391
|
|
|
/** |
|
392
|
|
|
* This shows any deferred JavaScript and closes out the HTML |
|
393
|
|
|
*/ |
|
394
|
|
|
function template_html_below() |
|
395
|
|
|
{ |
|
396
|
|
|
// load in any javascipt that could be deferred to the end of the page |
|
397
|
|
|
template_javascript(true); |
|
398
|
|
|
|
|
399
|
|
|
echo ' |
|
400
|
|
|
</body> |
|
401
|
|
|
</html>'; |
|
402
|
|
|
} |
|
403
|
|
|
|
|
404
|
|
|
/** |
|
405
|
|
|
* Show a linktree. This is that thing that shows "My Community | General Category | General Discussion".. |
|
406
|
|
|
* |
|
407
|
|
|
* @param bool $force_show Whether to force showing it even if settings say otherwise |
|
408
|
|
|
*/ |
|
409
|
|
|
function theme_linktree($force_show = false) |
|
410
|
|
|
{ |
|
411
|
|
|
global $context, $shown_linktree, $scripturl, $txt; |
|
412
|
|
|
|
|
413
|
|
|
// If linktree is empty, just return - also allow an override. |
|
414
|
|
|
if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show)) |
|
415
|
|
|
return; |
|
416
|
|
|
|
|
417
|
|
|
echo ' |
|
418
|
|
|
<div class="navigate_section"> |
|
419
|
|
|
<ul>'; |
|
420
|
|
|
|
|
421
|
|
|
if ($context['user']['is_logged']) |
|
422
|
|
|
echo ' |
|
423
|
|
|
<li class="unread_links"> |
|
424
|
|
|
<a href="', $scripturl, '?action=unread" title="', $txt['unread_since_visit'], '">', $txt['view_unread_category'], '</a> |
|
425
|
|
|
<a href="', $scripturl, '?action=unreadreplies" title="', $txt['show_unread_replies'], '">', $txt['unread_replies'], '</a> |
|
426
|
|
|
</li>'; |
|
427
|
|
|
|
|
428
|
|
|
// Each tree item has a URL and name. Some may have extra_before and extra_after. |
|
429
|
|
|
foreach ($context['linktree'] as $link_num => $tree) |
|
430
|
|
|
{ |
|
431
|
|
|
echo ' |
|
432
|
|
|
<li', ($link_num == count($context['linktree']) - 1) ? ' class="last"' : '', '>'; |
|
433
|
|
|
|
|
434
|
|
|
// Don't show a separator for the first one. |
|
435
|
|
|
// Better here. Always points to the next level when the linktree breaks to a second line. |
|
436
|
|
|
// Picked a better looking HTML entity, and added support for RTL plus a span for styling. |
|
437
|
|
|
if ($link_num != 0) |
|
438
|
|
|
echo ' |
|
439
|
|
|
<span class="dividers">', $context['right_to_left'] ? ' ◄ ' : ' ► ', '</span>'; |
|
440
|
|
|
|
|
441
|
|
|
// Show something before the link? |
|
442
|
|
|
if (isset($tree['extra_before'])) |
|
443
|
|
|
echo $tree['extra_before'], ' '; |
|
444
|
|
|
|
|
445
|
|
|
// Show the link, including a URL if it should have one. |
|
446
|
|
|
if (isset($tree['url'])) |
|
447
|
|
|
echo ' |
|
448
|
|
|
<a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>'; |
|
449
|
|
|
else |
|
450
|
|
|
echo ' |
|
451
|
|
|
<span>' . $tree['name'] . '</span>'; |
|
452
|
|
|
|
|
453
|
|
|
// Show something after the link...? |
|
454
|
|
|
if (isset($tree['extra_after'])) |
|
455
|
|
|
echo ' ', $tree['extra_after']; |
|
456
|
|
|
|
|
457
|
|
|
echo ' |
|
458
|
|
|
</li>'; |
|
459
|
|
|
} |
|
460
|
|
|
|
|
461
|
|
|
echo ' |
|
462
|
|
|
</ul> |
|
463
|
|
|
</div>'; |
|
464
|
|
|
|
|
465
|
|
|
$shown_linktree = true; |
|
466
|
|
|
} |
|
467
|
|
|
|
|
468
|
|
|
/** |
|
469
|
|
|
* Show the menu up top. Something like [home] [help] [profile] [logout]... |
|
470
|
|
|
*/ |
|
471
|
|
|
function template_menu() |
|
472
|
|
|
{ |
|
473
|
|
|
global $context; |
|
474
|
|
|
|
|
475
|
|
|
echo ' |
|
476
|
|
|
<ul class="dropmenu menu_nav">'; |
|
477
|
|
|
|
|
478
|
|
|
// Note: Menu markup has been cleaned up to remove unnecessary spans and classes. |
|
479
|
|
|
foreach ($context['menu_buttons'] as $act => $button) |
|
480
|
|
|
{ |
|
481
|
|
|
echo ' |
|
482
|
|
|
<li class="button_', $act, '', !empty($button['sub_buttons']) ? ' subsections"' :'"', '> |
|
483
|
|
|
<a', $button['active_button'] ? ' class="active"' : '', ' href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '> |
|
484
|
|
|
', $button['icon'],'<span class="textmenu">', $button['title'], '</span> |
|
485
|
|
|
</a>'; |
|
486
|
|
|
|
|
487
|
|
|
if (!empty($button['sub_buttons'])) |
|
488
|
|
|
{ |
|
489
|
|
|
echo ' |
|
490
|
|
|
<ul>'; |
|
491
|
|
|
|
|
492
|
|
|
foreach ($button['sub_buttons'] as $childbutton) |
|
493
|
|
|
{ |
|
494
|
|
|
echo ' |
|
495
|
|
|
<li', !empty($childbutton['sub_buttons']) ? ' class="subsections"' :'', '> |
|
496
|
|
|
<a href="', $childbutton['href'], '"' , isset($childbutton['target']) ? ' target="' . $childbutton['target'] . '"' : '', '> |
|
497
|
|
|
', $childbutton['title'], ' |
|
498
|
|
|
</a>'; |
|
499
|
|
|
// 3rd level menus :) |
|
500
|
|
|
if (!empty($childbutton['sub_buttons'])) |
|
501
|
|
|
{ |
|
502
|
|
|
echo ' |
|
503
|
|
|
<ul>'; |
|
504
|
|
|
|
|
505
|
|
|
foreach ($childbutton['sub_buttons'] as $grandchildbutton) |
|
506
|
|
|
echo ' |
|
507
|
|
|
<li> |
|
508
|
|
|
<a href="', $grandchildbutton['href'], '"' , isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '> |
|
509
|
|
|
', $grandchildbutton['title'], ' |
|
510
|
|
|
</a> |
|
511
|
|
|
</li>'; |
|
512
|
|
|
|
|
513
|
|
|
echo ' |
|
514
|
|
|
</ul>'; |
|
515
|
|
|
} |
|
516
|
|
|
|
|
517
|
|
|
echo ' |
|
518
|
|
|
</li>'; |
|
519
|
|
|
} |
|
520
|
|
|
echo ' |
|
521
|
|
|
</ul>'; |
|
522
|
|
|
} |
|
523
|
|
|
echo ' |
|
524
|
|
|
</li>'; |
|
525
|
|
|
} |
|
526
|
|
|
|
|
527
|
|
|
echo ' |
|
528
|
|
|
</ul>'; |
|
529
|
|
|
} |
|
530
|
|
|
|
|
531
|
|
|
/** |
|
532
|
|
|
* Generate a strip of buttons. |
|
533
|
|
|
* |
|
534
|
|
|
* @param array $button_strip An array with info for displaying the strip |
|
535
|
|
|
* @param string $direction The direction |
|
536
|
|
|
* @param array $strip_options Options for the button strip |
|
537
|
|
|
*/ |
|
538
|
|
|
function template_button_strip($button_strip, $direction = '', $strip_options = array()) |
|
|
|
|
|
|
539
|
|
|
{ |
|
540
|
|
|
global $context, $txt; |
|
541
|
|
|
|
|
542
|
|
|
if (!is_array($strip_options)) |
|
543
|
|
|
$strip_options = array(); |
|
544
|
|
|
|
|
545
|
|
|
// Create the buttons... |
|
546
|
|
|
$buttons = array(); |
|
547
|
|
|
foreach ($button_strip as $key => $value) |
|
548
|
|
|
{ |
|
549
|
|
|
// As of 2.1, the 'test' for each button happens while the array is being generated. The extra 'test' check here is deprecated but kept for backward compatibility (update your mods, folks!) |
|
550
|
|
|
if (!isset($value['test']) || !empty($context[$value['test']])) |
|
551
|
|
|
{ |
|
552
|
|
|
if (!isset($value['id'])) |
|
553
|
|
|
$value['id'] = $key; |
|
554
|
|
|
|
|
555
|
|
|
$button = ' |
|
556
|
|
|
<a class="button button_strip_' . $key . (!empty($value['active']) ? ' active' : '') . (isset($value['class']) ? ' '. $value['class'] : '') . '" ' . (!empty($value['url']) ? 'href="'. $value['url'] .'"' : '') . ' ' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>' . $txt[$value['text']] . '</a>'; |
|
557
|
|
|
|
|
558
|
|
|
if (!empty($value['sub_buttons'])) |
|
559
|
|
|
{ |
|
560
|
|
|
$button .= ' |
|
561
|
|
|
<div class="top_menu dropmenu ' . $key . '_dropdown"> |
|
562
|
|
|
<div class="viewport"> |
|
563
|
|
|
<div class="overview">'; |
|
564
|
|
|
foreach ($value['sub_buttons'] as $element) |
|
565
|
|
|
{ |
|
566
|
|
|
if (isset($element['test']) && empty($context[$element['test']])) |
|
567
|
|
|
continue; |
|
568
|
|
|
|
|
569
|
|
|
$button .= ' |
|
570
|
|
|
<a href="' . $element['url'] . '"><strong>' . $txt[$element['text']] . '</strong>'; |
|
571
|
|
|
if (isset($txt[$element['text'] . '_desc'])) |
|
572
|
|
|
$button .= '<br /><span>' . $txt[$element['text'] . '_desc'] . '</span>'; |
|
573
|
|
|
$button .= '</a>'; |
|
574
|
|
|
} |
|
575
|
|
|
$button .= ' |
|
576
|
|
|
</div> |
|
577
|
|
|
</div> |
|
578
|
|
|
</div>'; |
|
579
|
|
|
} |
|
580
|
|
|
|
|
581
|
|
|
$buttons[] = $button; |
|
582
|
|
|
} |
|
583
|
|
|
} |
|
584
|
|
|
|
|
585
|
|
|
// No buttons? No button strip either. |
|
586
|
|
|
if (empty($buttons)) |
|
587
|
|
|
return; |
|
588
|
|
|
|
|
589
|
|
|
echo ' |
|
590
|
|
|
<div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"': ''), '> |
|
591
|
|
|
',implode('', $buttons), ' |
|
592
|
|
|
</div>'; |
|
593
|
|
|
} |
|
594
|
|
|
|
|
595
|
|
|
/** |
|
596
|
|
|
* The upper part of the maintenance warning box |
|
597
|
|
|
*/ |
|
598
|
|
|
function template_maint_warning_above() |
|
599
|
|
|
{ |
|
600
|
|
|
global $txt, $context, $scripturl; |
|
601
|
|
|
|
|
602
|
|
|
echo ' |
|
603
|
|
|
<div class="errorbox" id="errors"> |
|
604
|
|
|
<dl> |
|
605
|
|
|
<dt> |
|
606
|
|
|
<strong id="error_serious">', $txt['forum_in_maintenance'], '</strong> |
|
607
|
|
|
</dt> |
|
608
|
|
|
<dd class="error" id="error_list"> |
|
609
|
|
|
', sprintf($txt['maintenance_page'], $scripturl . '?action=admin;area=serversettings;' . $context['session_var'] . '=' . $context['session_id']), ' |
|
610
|
|
|
</dd> |
|
611
|
|
|
</dl> |
|
612
|
|
|
</div>'; |
|
613
|
|
|
} |
|
614
|
|
|
|
|
615
|
|
|
/** |
|
616
|
|
|
* The lower part of the maintenance warning box. |
|
617
|
|
|
*/ |
|
618
|
|
|
function template_maint_warning_below() |
|
619
|
|
|
{ |
|
620
|
|
|
|
|
621
|
|
|
} |
|
622
|
|
|
|
|
623
|
|
|
?> |
|
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.