|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @name ElkArte Forum |
|
5
|
|
|
* @copyright ElkArte Forum contributors |
|
6
|
|
|
* @license BSD http://opensource.org/licenses/BSD-3-Clause |
|
7
|
|
|
* |
|
8
|
|
|
* This file contains code covered by: |
|
9
|
|
|
* copyright: 2011 Simple Machines (http://www.simplemachines.org) |
|
10
|
|
|
* license: BSD, See included LICENSE.TXT for terms and conditions. |
|
11
|
|
|
* |
|
12
|
|
|
* @version 1.1 |
|
13
|
|
|
* |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* This template is, perhaps, the most important template in the theme. It |
|
18
|
|
|
* contains the main template layer that displays the header and footer of |
|
19
|
|
|
* the forum, namely with body_above and body_below. It also contains the |
|
20
|
|
|
* menu sub template, which appropriately displays the menu; the init sub |
|
21
|
|
|
* template, which is there to set the theme up; (init can be missing.) and |
|
22
|
|
|
* the linktree sub template, which sorts out the link tree. |
|
23
|
|
|
* |
|
24
|
|
|
* The init sub template should load any data and set any hardcoded options. |
|
25
|
|
|
* |
|
26
|
|
|
* The body_above sub template is what is shown above the main content, and |
|
27
|
|
|
* should contain anything that should be shown up there. |
|
28
|
|
|
* |
|
29
|
|
|
* The body_below sub template, conversely, is shown after the main content. |
|
30
|
|
|
* It should probably contain the copyright statement and some other things. |
|
31
|
|
|
* |
|
32
|
|
|
* The linktree sub template should display the link tree, using the data |
|
33
|
|
|
* in the $context['linktree'] variable. |
|
34
|
|
|
* |
|
35
|
|
|
* The menu sub template should display all the relevant buttons the user |
|
36
|
|
|
* wants and or needs. |
|
37
|
|
|
*/ |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Initialize the template... mainly little settings. |
|
41
|
|
|
* load any data and set any hardcoded options. |
|
42
|
|
|
*/ |
|
43
|
|
|
function template_init() |
|
44
|
|
|
{ |
|
45
|
|
|
return array( |
|
46
|
|
|
/* Use images from default theme when using templates from the default theme? |
|
47
|
|
|
if this is 'always', images from the default theme will be used. |
|
48
|
|
|
if this is 'defaults', images from the default theme will only be used with default templates. |
|
49
|
|
|
if this is 'never' or isn't set at all, images from the default theme will not be used. */ |
|
50
|
|
|
'use_default_images' => 'never', |
|
51
|
|
|
|
|
52
|
|
|
// Set to true if you want to include font awesome's css file |
|
53
|
|
|
'require_font-awesome' => false, |
|
54
|
|
|
|
|
55
|
|
|
// The version this template/theme is for. This should probably be the version of the forum it was created for. |
|
56
|
|
|
'theme_version' => '1.0', |
|
57
|
|
|
|
|
58
|
|
|
// Set the following variable to true if this theme requires the optional theme strings file to be loaded. |
|
59
|
|
|
'require_theme_strings' => false, |
|
60
|
|
|
|
|
61
|
|
|
// This is used for the color variants. |
|
62
|
|
|
'theme_variants' => array('light', 'besocial'), |
|
63
|
|
|
|
|
64
|
|
|
// Provides avatars for use on various indexes. |
|
65
|
|
|
// Possible values: |
|
66
|
|
|
// * 0 or not set, no avatars are available |
|
67
|
|
|
// * 1 avatar of the poster of the last message |
|
68
|
|
|
// * 2 avatar of the poster of the first message |
|
69
|
|
|
// * 3 both avatars |
|
70
|
|
|
// Since grabbing the avatar requires some work, it is better to |
|
71
|
|
|
// set the variable to a sensible value depending on the needs of the theme |
|
72
|
|
|
'avatars_on_indexes' => 1, |
|
73
|
|
|
|
|
74
|
|
|
// This is used in the main menus to create a number next to the title of the menu to indicate the number of unread messages, |
|
75
|
|
|
// moderation reports, etc. You can style each menu level indicator as desired. |
|
76
|
|
|
'menu_numeric_notice' => array( |
|
77
|
|
|
// Top level menu entries |
|
78
|
|
|
0 => ' <span class="pm_indicator">%1$s</span>', |
|
79
|
|
|
// First dropdown |
|
80
|
|
|
1 => ' <span>[<strong>%1$s</strong>]</span>', |
|
81
|
|
|
// Second level dropdown |
|
82
|
|
|
2 => ' <span>[<strong>%1$s</strong>]</span>', |
|
83
|
|
|
), |
|
84
|
|
|
|
|
85
|
|
|
// This slightly more complex array, instead, will deal with page indexes as frequently requested by Ant :P |
|
86
|
|
|
// Oh no you don't. :D This slightly less complex array now has cleaner markup. :P |
|
87
|
|
|
// @todo - God it's still ugly though. Can't we just have links where we need them, without all those spans? |
|
88
|
|
|
// How do we get anchors only, where they will work? Spans and strong only where necessary? |
|
89
|
|
|
'page_index_template' => array( |
|
90
|
|
|
'base_link' => '<li class="linavPages"><a class="navPages" href="{base_link}" role="menuitem">%2$s</a></li>', |
|
91
|
|
|
'previous_page' => '<span class="previous_page" role="menuitem">{prev_txt}</span>', |
|
92
|
|
|
'current_page' => '<li class="linavPages"><strong class="current_page" role="menuitem">%1$s</strong></li>', |
|
93
|
|
|
'next_page' => '<span class="next_page" role="menuitem">{next_txt}</span>', |
|
94
|
|
|
'expand_pages' => '<li class="linavPages expand_pages" role="menuitem" {custom}> <a href="#">...</a> </li>', |
|
95
|
|
|
'all' => '<span class="linavPages all_pages" role="menuitem">{all_txt}</span>', |
|
96
|
|
|
), |
|
97
|
|
|
|
|
98
|
|
|
// @todo find a better place if we are going to create a notifications template |
|
99
|
|
|
'mentions' => array('mentioner_template' => '<a href="{mem_url}" class="mentionavatar">{avatar_img}{mem_name}</a>') |
|
100
|
|
|
); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Simplify the use of callbacks in the templates. |
|
105
|
|
|
* |
|
106
|
|
|
* @param string $id - A prefix for the template functions the final name |
|
107
|
|
|
* should look like: template_{$id}_{$array[n]} |
|
108
|
|
|
* @param string[] $array - The array of function suffixes |
|
109
|
|
|
*/ |
|
110
|
|
|
function call_template_callbacks($id, $array) |
|
111
|
|
|
{ |
|
112
|
|
|
if (empty($array)) |
|
113
|
|
|
return; |
|
114
|
|
|
|
|
115
|
|
|
foreach ($array as $callback) |
|
116
|
|
|
{ |
|
117
|
|
|
$func = 'template_' . $id . '_' . $callback; |
|
118
|
|
|
if (function_exists($func)) |
|
119
|
|
|
$func(); |
|
120
|
|
|
} |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* The main sub template above the content. |
|
125
|
|
|
*/ |
|
126
|
|
|
function template_html_above() |
|
127
|
|
|
{ |
|
128
|
|
|
global $context, $scripturl, $txt, $modSettings; |
|
129
|
|
|
|
|
130
|
|
|
// Show right to left and the character set for ease of translating. |
|
131
|
|
|
echo '<!DOCTYPE html> |
|
132
|
|
|
<html', $context['right_to_left'] ? ' dir="rtl"' : '', '> |
|
133
|
|
|
<head> |
|
134
|
|
|
<title>', $context['page_title_html_safe'], '</title> |
|
135
|
|
|
<meta charset="UTF-8" />'; |
|
136
|
|
|
|
|
137
|
|
|
// Tell IE to render the page in standards not compatibility mode. really for ie >= 8 |
|
138
|
|
|
// Note if this is not in the first 4k, its ignored, that's why its here |
|
139
|
|
|
if (isBrowser('ie')) |
|
140
|
|
|
echo ' |
|
141
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />'; |
|
142
|
|
|
|
|
143
|
|
|
echo ' |
|
144
|
|
|
<meta name="viewport" content="width=device-width" /> |
|
145
|
|
|
<meta name="mobile-web-app-capable" content="yes" /> |
|
146
|
|
|
<meta name="description" content="', $context['page_title_html_safe'], '" />'; |
|
147
|
|
|
|
|
148
|
|
|
// OpenID enabled? Advertise the location of our endpoint using YADIS protocol. |
|
149
|
|
|
if (!empty($modSettings['enableOpenID'])) |
|
150
|
|
|
echo ' |
|
151
|
|
|
<meta http-equiv="x-xrds-location" content="' . $scripturl . '?action=xrds" />'; |
|
152
|
|
|
|
|
153
|
|
|
// Please don't index these Mr Robot. |
|
154
|
|
|
if (!empty($context['robot_no_index'])) |
|
155
|
|
|
echo ' |
|
156
|
|
|
<meta name="robots" content="noindex" />'; |
|
157
|
|
|
|
|
158
|
|
|
// load in any css from addons or themes so they can overwrite if wanted |
|
159
|
|
|
template_css(); |
|
160
|
|
|
|
|
161
|
|
|
// Present a canonical url for search engines to prevent duplicate content in their indices. |
|
162
|
|
|
if (!empty($context['canonical_url'])) |
|
163
|
|
|
echo ' |
|
164
|
|
|
<link rel="canonical" href="', $context['canonical_url'], '" />'; |
|
165
|
|
|
|
|
166
|
|
|
// Show all the relative links, such as help, search, contents, and the like. |
|
167
|
|
|
echo ' |
|
168
|
|
|
<link rel="shortcut icon" sizes="196x196" href="' . $context['favicon'] . '" /> |
|
169
|
|
|
<link rel="help" href="', $scripturl, '?action=help" /> |
|
170
|
|
|
<link rel="contents" href="', $scripturl, '" />', ($context['allow_search'] ? ' |
|
171
|
|
|
<link rel="search" href="' . $scripturl . '?action=search" />' : ''); |
|
172
|
|
|
|
|
173
|
|
|
// If RSS feeds are enabled, advertise the presence of one. |
|
174
|
|
View Code Duplication |
if (!empty($context['newsfeed_urls'])) |
|
175
|
|
|
{ |
|
176
|
|
|
echo ' |
|
177
|
|
|
<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $context['newsfeed_urls']['rss'], '" /> |
|
178
|
|
|
<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $context['newsfeed_urls']['atom'], '" />'; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
// If we're viewing a topic, these should be the previous and next topics, respectively. |
|
182
|
|
View Code Duplication |
if (!empty($context['links']['next'])) |
|
183
|
|
|
{ |
|
184
|
|
|
echo ' |
|
185
|
|
|
<link rel="next" href="', $context['links']['next'], '" />'; |
|
186
|
|
|
} |
|
187
|
|
|
elseif (!empty($context['current_topic'])) |
|
188
|
|
|
{ |
|
189
|
|
|
echo ' |
|
190
|
|
|
<link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />'; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
View Code Duplication |
if (!empty($context['links']['prev'])) |
|
194
|
|
|
{ |
|
195
|
|
|
echo ' |
|
196
|
|
|
<link rel="prev" href="', $context['links']['prev'], '" />'; |
|
197
|
|
|
} |
|
198
|
|
|
elseif (!empty($context['current_topic'])) |
|
199
|
|
|
{ |
|
200
|
|
|
echo ' |
|
201
|
|
|
<link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />'; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
// If we're in a board, or a topic for that matter, the index will be the board's index. |
|
205
|
|
|
if (!empty($context['current_board'])) |
|
206
|
|
|
{ |
|
207
|
|
|
echo ' |
|
208
|
|
|
<link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0" />'; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
// load in any javascript files from addons and themes |
|
212
|
|
|
theme()->template_javascript(); |
|
213
|
|
|
|
|
214
|
|
|
// load in any javascript files from addons and themes |
|
215
|
|
|
theme()->template_inlinecss(); |
|
216
|
|
|
|
|
217
|
|
|
// Output any remaining HTML headers. (from addons, maybe?) |
|
218
|
|
|
echo $context['html_headers']; |
|
219
|
|
|
|
|
220
|
|
|
echo ' |
|
221
|
|
|
</head> |
|
222
|
|
|
<body id="', $context['browser_body_id'], '" class="action_', !empty($context['current_action']) ? htmlspecialchars($context['current_action'], ENT_COMPAT, 'UTF-8') : (!empty($context['current_board']) ? |
|
223
|
|
|
'messageindex' : (!empty($context['current_topic']) ? 'display' : 'home')), |
|
224
|
|
|
!empty($context['current_board']) ? ' board_' . htmlspecialchars($context['current_board'], ENT_COMPAT, 'UTF-8') : '', '">'; |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
/** |
|
228
|
|
|
* Section above the main contents of the page, after opening the body tag |
|
229
|
|
|
*/ |
|
230
|
|
|
function template_body_above() |
|
231
|
|
|
{ |
|
232
|
|
|
global $context, $settings, $scripturl, $txt; |
|
233
|
|
|
|
|
234
|
|
|
// Go to top/bottom of page links and skipnav link for a11y. |
|
235
|
|
|
echo ' |
|
236
|
|
|
<a id="top" href="#skipnav" tabindex="0">', $txt['skip_nav'], '</a> |
|
237
|
|
|
<a href="#top" id="gotop" title="', $txt['go_up'], '">↑</a> |
|
238
|
|
|
<a href="#bot" id="gobottom" title="', $txt['go_down'], '">↓</a>'; |
|
239
|
|
|
|
|
240
|
|
|
// Skip nav link. |
|
241
|
|
|
echo ' |
|
242
|
|
|
<header id="top_section"> |
|
243
|
|
|
<aside class="wrapper">'; |
|
244
|
|
|
|
|
245
|
|
|
call_template_callbacks('th', $context['theme_header_callbacks']); |
|
246
|
|
|
|
|
247
|
|
|
echo ' |
|
248
|
|
|
</aside> |
|
249
|
|
|
<section id="header" class="wrapper', !empty($settings['header_layout']) ? ($settings['header_layout'] == 1 ? ' centerheader' : ' rightheader') : '', empty($context['minmax_preferences']['upshrink']) ? '"' : ' hide" aria-hidden="true"', '> |
|
250
|
|
|
<h1 id="forumtitle"> |
|
251
|
|
|
<a class="forumlink" href="', $scripturl, '">', $context['forum_name'], '</a>'; |
|
252
|
|
|
|
|
253
|
|
|
echo ' |
|
254
|
|
|
<span id="logobox"> |
|
255
|
|
|
<img id="logo" src="', $context['header_logo_url_html_safe'], '" alt="', $context['forum_name_html_safe'], '" title="', $context['forum_name_html_safe'], '" />', empty($settings['site_slogan']) ? '' : ' |
|
256
|
|
|
<span id="siteslogan">' . $settings['site_slogan'] . '</span>', ' |
|
257
|
|
|
</span> |
|
258
|
|
|
</h1>'; |
|
259
|
|
|
|
|
260
|
|
|
// Show the menu here, according to the menu sub template. |
|
261
|
|
|
echo ' |
|
262
|
|
|
</section>'; |
|
263
|
|
|
|
|
264
|
|
|
template_menu(); |
|
265
|
|
|
|
|
266
|
|
|
echo ' |
|
267
|
|
|
</header> |
|
268
|
|
|
<div id="wrapper" class="wrapper"> |
|
269
|
|
|
<aside id="upper_section"', empty($context['minmax_preferences']['upshrink']) ? '' : ' class="hide" aria-hidden="true"', '>'; |
|
270
|
|
|
|
|
271
|
|
|
call_template_callbacks('uc', $context['upper_content_callbacks']); |
|
272
|
|
|
|
|
273
|
|
|
echo ' |
|
274
|
|
|
</aside>'; |
|
275
|
|
|
|
|
276
|
|
|
// Show the navigation tree. |
|
277
|
|
|
theme_linktree(); |
|
278
|
|
|
|
|
279
|
|
|
// The main content should go here. |
|
280
|
|
|
echo ' |
|
281
|
|
|
<div id="main_content_section"><a id="skipnav"></a>'; |
|
282
|
|
|
} |
|
283
|
|
|
|
|
284
|
|
|
/** |
|
285
|
|
|
* If the user is logged in, display the time, or a maintenance warning for admins. |
|
286
|
|
|
* @todo - TBH I always intended the time/date to be more or less a place holder for more important things. |
|
287
|
|
|
* The maintenance mode warning for admins is an obvious one, but this could also be used for moderation notifications. |
|
288
|
|
|
* I also assumed this would be an obvious place for sites to put a string of icons to link to their FB, Twitter, etc. |
|
289
|
|
|
* This could still be done via conditional, so that administration and moderation notices were still active when |
|
290
|
|
|
* applicable. |
|
291
|
|
|
*/ |
|
292
|
|
|
function template_th_login_bar() |
|
293
|
|
|
{ |
|
294
|
|
|
global $context, $modSettings, $txt, $scripturl; |
|
295
|
|
|
|
|
296
|
|
|
echo ' |
|
297
|
|
|
<div id="top_section_notice" class="user"> |
|
298
|
|
|
<form action="', $scripturl, '?action=login2;quicklogin" method="post" accept-charset="UTF-8" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '> |
|
299
|
|
|
<div id="password_login"> |
|
300
|
|
|
<input type="text" name="user" size="10" class="input_text" placeholder="', $txt['username'], '" /> |
|
301
|
|
|
<input type="password" name="passwrd" size="10" class="input_password" placeholder="', $txt['password'], '" /> |
|
302
|
|
|
<select name="cookielength"> |
|
303
|
|
|
<option value="60">', $txt['one_hour'], '</option> |
|
304
|
|
|
<option value="1440">', $txt['one_day'], '</option> |
|
305
|
|
|
<option value="10080">', $txt['one_week'], '</option> |
|
306
|
|
|
<option value="43200">', $txt['one_month'], '</option> |
|
307
|
|
|
<option value="-1" selected="selected">', $txt['forever'], '</option> |
|
308
|
|
|
</select> |
|
309
|
|
|
<input type="submit" value="', $txt['login'], '" /> |
|
310
|
|
|
<input type="hidden" name="hash_passwrd" value="" /> |
|
311
|
|
|
<input type="hidden" name="old_hash_passwrd" value="" /> |
|
312
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
|
313
|
|
|
<input type="hidden" name="', $context['login_token_var'], '" value="', $context['login_token'], '" />'; |
|
314
|
|
|
|
|
315
|
|
|
if (!empty($modSettings['enableOpenID'])) |
|
316
|
|
|
echo ' |
|
317
|
|
|
<a class="icon icon-margin i-openid" href="', $scripturl, '?action=login;openid" title="' . $txt['openid'] . '"><s>' . $txt['openid'] . '"</s></a>'; |
|
318
|
|
|
echo ' |
|
319
|
|
|
</div> |
|
320
|
|
|
</form> |
|
321
|
|
|
</div>'; |
|
322
|
|
|
} |
|
323
|
|
|
|
|
324
|
|
|
/** |
|
325
|
|
|
* A simple search bar (used in the header) |
|
326
|
|
|
*/ |
|
327
|
|
|
function template_th_search_bar() |
|
328
|
|
|
{ |
|
329
|
|
|
global $context, $modSettings, $txt, $scripturl; |
|
330
|
|
|
|
|
331
|
|
|
echo ' |
|
332
|
|
|
<form id="search_form" action="', $scripturl, '?action=search;sa=results" method="post" accept-charset="UTF-8"> |
|
333
|
|
|
<label for="quicksearch"> |
|
334
|
|
|
<input type="text" name="search" id="quicksearch" value="" class="input_text" placeholder="', $txt['search'], '" /> |
|
335
|
|
|
</label>'; |
|
336
|
|
|
|
|
337
|
|
|
// Using the quick search dropdown? |
|
338
|
|
|
if (!empty($modSettings['search_dropdown'])) |
|
339
|
|
|
{ |
|
340
|
|
|
$selected = !empty($context['current_topic']) ? 'current_topic' : (!empty($context['current_board']) ? 'current_board' : 'all'); |
|
341
|
|
|
|
|
342
|
|
|
echo ' |
|
343
|
|
|
<label for="search_selection"> |
|
344
|
|
|
<select name="search_selection" id="search_selection"> |
|
345
|
|
|
<option value="all"', ($selected == 'all' ? ' selected="selected"' : ''), '>', $txt['search_entireforum'], ' </option>'; |
|
346
|
|
|
|
|
347
|
|
|
// Can't limit it to a specific topic if we are not in one |
|
348
|
|
|
if (!empty($context['current_topic'])) |
|
349
|
|
|
echo ' |
|
350
|
|
|
<option value="topic"', ($selected == 'current_topic' ? ' selected="selected"' : ''), '>', $txt['search_thistopic'], '</option>'; |
|
351
|
|
|
|
|
352
|
|
|
// Can't limit it to a specific board if we are not in one |
|
353
|
|
|
if (!empty($context['current_board'])) |
|
354
|
|
|
echo ' |
|
355
|
|
|
<option value="board"', ($selected == 'current_board' ? ' selected="selected"' : ''), '>', $txt['search_thisbrd'], '</option>'; |
|
356
|
|
|
|
|
357
|
|
|
if (!empty($context['additional_dropdown_search'])) |
|
358
|
|
|
foreach ($context['additional_dropdown_search'] as $name => $engine) |
|
359
|
|
|
echo ' |
|
360
|
|
|
<option value="', $name, '">', $engine['name'], '</option>'; |
|
361
|
|
|
|
|
362
|
|
|
echo ' |
|
363
|
|
|
<option value="members"', ($selected == 'members' ? ' selected="selected"' : ''), '>', $txt['search_members'], ' </option> |
|
364
|
|
|
</select> |
|
365
|
|
|
</label>'; |
|
366
|
|
|
} |
|
367
|
|
|
|
|
368
|
|
|
// Search within current topic? |
|
369
|
|
|
if (!empty($context['current_topic'])) |
|
370
|
|
|
echo ' |
|
371
|
|
|
<input type="hidden" name="', (!empty($modSettings['search_dropdown']) ? 'sd_topic' : 'topic'), '" value="', $context['current_topic'], '" />'; |
|
372
|
|
|
// If we're on a certain board, limit it to this board ;). |
|
373
|
|
|
if (!empty($context['current_board'])) |
|
374
|
|
|
echo ' |
|
375
|
|
|
<input type="hidden" name="', (!empty($modSettings['search_dropdown']) ? 'sd_brd[' : 'brd['), $context['current_board'], ']"', ' value="', $context['current_board'], '" />'; |
|
376
|
|
|
|
|
377
|
|
|
echo ' |
|
378
|
|
|
<button type="submit" name="search;sa=results" class="', (!empty($modSettings['search_dropdown'])) ? 'with_select' : '', '"><i class="icon i-search icon-shade"></i></button> |
|
379
|
|
|
<input type="hidden" name="advanced" value="0" /> |
|
380
|
|
|
</form>'; |
|
381
|
|
|
} |
|
382
|
|
|
|
|
383
|
|
|
/** |
|
384
|
|
|
* The news fader wrapped in a div and with "news" text |
|
385
|
|
|
*/ |
|
386
|
|
|
function template_uc_news_fader() |
|
387
|
|
|
{ |
|
388
|
|
|
global $settings, $context, $txt; |
|
389
|
|
|
|
|
390
|
|
|
// Display either news fader and random news lines (not both). These now run most of the same mark up and CSS. Less complication = happier n00bz. :) |
|
391
|
|
|
if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) |
|
392
|
|
|
{ |
|
393
|
|
|
echo ' |
|
394
|
|
|
<div id="news"> |
|
395
|
|
|
<h2>', $txt['news'], '</h2>'; |
|
396
|
|
|
|
|
397
|
|
|
template_news_fader(); |
|
398
|
|
|
|
|
399
|
|
|
echo ' |
|
400
|
|
|
</div>'; |
|
401
|
|
|
} |
|
402
|
|
|
} |
|
403
|
|
|
|
|
404
|
|
|
/** |
|
405
|
|
|
* All your data are belong to us (cit.) |
|
406
|
|
|
*/ |
|
407
|
|
|
function template_uc_agreement_accepted() |
|
408
|
|
|
{ |
|
409
|
|
|
global $txt; |
|
410
|
|
|
|
|
411
|
|
|
echo ' |
|
412
|
|
|
<div id="agreement"> |
|
413
|
|
|
<h2>', $txt['agreement_accepted'], '</h2> |
|
414
|
|
|
</div>'; |
|
415
|
|
|
} |
|
416
|
|
|
|
|
417
|
|
|
/** |
|
418
|
|
|
* Section down the page, before closing body |
|
419
|
|
|
*/ |
|
420
|
|
|
function template_body_below() |
|
421
|
|
|
{ |
|
422
|
|
|
global $context, $txt; |
|
423
|
|
|
|
|
424
|
|
|
echo ' |
|
425
|
|
|
</div> |
|
426
|
|
|
</div>'; |
|
427
|
|
|
|
|
428
|
|
|
// Show RSS link, as well as the copyright. |
|
429
|
|
|
// Footer is full-width. Wrapper inside automatically matches admin width setting. |
|
430
|
|
|
echo ' |
|
431
|
|
|
<footer id="footer_section"><a id="bot"></a> |
|
432
|
|
|
<div class="wrapper"> |
|
433
|
|
|
<ul> |
|
434
|
|
|
<li class="copyright">', |
|
435
|
|
|
theme_copyright(), ' |
|
436
|
|
|
</li>', |
|
437
|
|
|
!empty($context['newsfeed_urls']['rss']) ? '<li> |
|
438
|
|
|
<a id="button_rss" href="' . $context['newsfeed_urls']['rss'] . '" class="rssfeeds new_win"><i class="icon icon-margin i-rss icon-big"><s>' . $txt['rss'] . '</s></i></a> |
|
439
|
|
|
</li>' : '', |
|
440
|
|
|
'</ul>'; |
|
441
|
|
|
|
|
442
|
|
|
// Show the load time? |
|
443
|
|
|
if ($context['show_load_time']) |
|
444
|
|
|
echo ' |
|
445
|
|
|
<p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>'; |
|
446
|
|
|
} |
|
447
|
|
|
|
|
448
|
|
|
/** |
|
449
|
|
|
* Section down the page, at closing html tag |
|
450
|
|
|
*/ |
|
451
|
|
|
function template_html_below() |
|
452
|
|
|
{ |
|
453
|
|
|
global $context; |
|
454
|
|
|
|
|
455
|
|
|
echo ' |
|
456
|
|
|
</div> |
|
457
|
|
|
</footer>'; |
|
458
|
|
|
|
|
459
|
|
|
// load in any javascript that could be deferred to the end of the page |
|
460
|
|
|
theme()->template_javascript(true); |
|
461
|
|
|
|
|
462
|
|
|
// Anything special to put out? |
|
463
|
|
|
if (!empty($context['insert_after_template'])) |
|
464
|
|
|
echo $context['insert_after_template']; |
|
465
|
|
|
|
|
466
|
|
|
echo ' |
|
467
|
|
|
</body> |
|
468
|
|
|
</html>'; |
|
469
|
|
|
} |
|
470
|
|
|
|
|
471
|
|
|
/** |
|
472
|
|
|
* Show a linktree. This is that thing that shows |
|
473
|
|
|
* "My Community | General Category | General Discussion".. |
|
474
|
|
|
* |
|
475
|
|
|
* @param string $default a string representing the index in $context where |
|
476
|
|
|
* the linktree is stored (default value is 'linktree') |
|
477
|
|
|
*/ |
|
478
|
|
|
function theme_linktree($default = 'linktree') |
|
479
|
|
|
{ |
|
480
|
|
|
global $context, $settings, $txt; |
|
481
|
|
|
|
|
482
|
|
|
// If linktree is empty, just return - also allow an override. |
|
483
|
|
|
if (empty($context[$default])) |
|
484
|
|
|
return; |
|
485
|
|
|
|
|
486
|
|
|
// @todo - Look at changing markup here slightly. Need to incorporate relevant aria roles. |
|
487
|
|
|
echo ' |
|
488
|
|
|
<nav> |
|
489
|
|
|
<ul class="navigate_section">'; |
|
490
|
|
|
|
|
491
|
|
|
// Each tree item has a URL and name. Some may have extra_before and extra_after. |
|
492
|
|
|
// Added a linktree class to make targeting dividers easy. |
|
493
|
|
|
foreach ($context[$default] as $pos => $tree) |
|
494
|
|
|
{ |
|
495
|
|
|
echo ' |
|
496
|
|
|
<li class="linktree"> |
|
497
|
|
|
<span>'; |
|
498
|
|
|
|
|
499
|
|
|
// Dividers moved to pseudo-elements in CSS. |
|
500
|
|
|
// Show something before the link? |
|
501
|
|
|
if (isset($tree['extra_before'])) |
|
502
|
|
|
echo $tree['extra_before']; |
|
503
|
|
|
|
|
504
|
|
|
// Show the link, including a URL if it should have one. |
|
505
|
|
|
echo $settings['linktree_link'] && isset($tree['url']) ? '<a href="' . $tree['url'] . '">' . ($pos == 0 ? '<i class="icon i-home"><s>' . $txt['home'] . '</s></i>' : $tree['name']) . '</a>' : $tree['name']; |
|
506
|
|
|
|
|
507
|
|
|
// Show something after the link...? |
|
508
|
|
|
if (isset($tree['extra_after'])) |
|
509
|
|
|
echo $tree['extra_after']; |
|
510
|
|
|
|
|
511
|
|
|
echo ' |
|
512
|
|
|
</span> |
|
513
|
|
|
</li>'; |
|
514
|
|
|
} |
|
515
|
|
|
|
|
516
|
|
|
echo ' |
|
517
|
|
|
</ul> |
|
518
|
|
|
</nav>'; |
|
519
|
|
|
} |
|
520
|
|
|
|
|
521
|
|
|
/** |
|
522
|
|
|
* Show the menu up top. Something like [home] [help] [profile] [logout]... |
|
523
|
|
|
*/ |
|
524
|
|
|
function template_menu() |
|
525
|
|
|
{ |
|
526
|
|
|
global $context, $txt; |
|
527
|
|
|
|
|
528
|
|
|
// WAI-ARIA a11y tweaks have been applied here. |
|
529
|
|
|
echo ' |
|
530
|
|
|
<nav id="menu_nav"> |
|
531
|
|
|
<ul id="main_menu" class="wrapper" role="menubar">'; |
|
532
|
|
|
|
|
533
|
|
|
// The upshrink image, right-floated. |
|
534
|
|
|
echo ' |
|
535
|
|
|
<li id="collapse_button" class="listlevel1"> |
|
536
|
|
|
<a class="linklevel1 panel_toggle"> |
|
537
|
|
|
<i id="upshrink" class="hide chevricon i-chevron-up icon icon-lg" title="', $txt['upshrink_description'], '"></i> |
|
538
|
|
|
</a> |
|
539
|
|
|
</li>'; |
|
540
|
|
|
|
|
541
|
|
|
foreach ($context['menu_buttons'] as $act => $button) |
|
542
|
|
|
{ |
|
543
|
|
|
echo ' |
|
544
|
|
|
<li id="button_', $act, '" class="listlevel1', !empty($button['sub_buttons']) ? ' subsections" aria-haspopup="true"' : '"', '> |
|
545
|
|
|
<a class="linklevel1', !empty($button['active_button']) ? ' active' : '', (!empty($button['indicator']) ? ' indicator' : ''), '" href="', $button['href'], '" ', isset($button['target']) ? 'target="' . $button['target'] . '"' : '', '>', (!empty($button['data-icon']) ? '<i class="icon icon-menu icon-lg ' . $button['data-icon'] . '" title="' . (!empty($button['alttitle']) ? $button['alttitle'] : $button['title']) . '"></i> ' : ''), '<span class="button_title" aria-hidden="true">', $button['title'], '</span></a>'; |
|
546
|
|
|
|
|
547
|
|
|
// Any 2nd level menus? |
|
548
|
|
|
if (!empty($button['sub_buttons'])) |
|
549
|
|
|
{ |
|
550
|
|
|
echo ' |
|
551
|
|
|
<ul class="menulevel2" role="menu">'; |
|
552
|
|
|
|
|
553
|
|
|
foreach ($button['sub_buttons'] as $childact => $childbutton) |
|
554
|
|
|
{ |
|
555
|
|
|
echo ' |
|
556
|
|
|
<li id="button_', $childact, '" class="listlevel2', !empty($childbutton['sub_buttons']) ? ' subsections" aria-haspopup="true"' : '"', '> |
|
557
|
|
|
<a class="linklevel2" href="', $childbutton['href'], '" ', isset($childbutton['target']) ? 'target="' . $childbutton['target'] . '"' : '', '>', $childbutton['title'], '</a>'; |
|
558
|
|
|
|
|
559
|
|
|
// 3rd level menus :) |
|
560
|
|
|
if (!empty($childbutton['sub_buttons'])) |
|
561
|
|
|
{ |
|
562
|
|
|
echo ' |
|
563
|
|
|
<ul class="menulevel3" role="menu">'; |
|
564
|
|
|
|
|
565
|
|
|
foreach ($childbutton['sub_buttons'] as $grandchildact => $grandchildbutton) |
|
566
|
|
|
echo ' |
|
567
|
|
|
<li id="button_', $grandchildact, '" class="listlevel3"> |
|
568
|
|
|
<a class="linklevel3" href="', $grandchildbutton['href'], '" ', isset($grandchildbutton['target']) ? 'target="' . $grandchildbutton['target'] . '"' : '', '>', $grandchildbutton['title'], '</a> |
|
569
|
|
|
</li>'; |
|
570
|
|
|
|
|
571
|
|
|
echo ' |
|
572
|
|
|
</ul>'; |
|
573
|
|
|
} |
|
574
|
|
|
|
|
575
|
|
|
echo ' |
|
576
|
|
|
</li>'; |
|
577
|
|
|
} |
|
578
|
|
|
|
|
579
|
|
|
echo ' |
|
580
|
|
|
</ul>'; |
|
581
|
|
|
} |
|
582
|
|
|
|
|
583
|
|
|
echo ' |
|
584
|
|
|
</li>'; |
|
585
|
|
|
} |
|
586
|
|
|
|
|
587
|
|
|
echo ' |
|
588
|
|
|
</ul> |
|
589
|
|
|
</nav>'; |
|
590
|
|
|
|
|
591
|
|
|
// Define the upper_section toggle in javascript. |
|
592
|
|
|
addInlineJavascript(' |
|
593
|
|
|
var oMainHeaderToggle = new elk_Toggle({ |
|
594
|
|
|
bToggleEnabled: true, |
|
595
|
|
|
bCurrentlyCollapsed: ' . (empty($context['minmax_preferences']['upshrink']) ? 'false' : 'true') . ', |
|
596
|
|
|
aSwappableContainers: [ |
|
597
|
|
|
\'upper_section\',\'header\' |
|
598
|
|
|
], |
|
599
|
|
|
aSwapClasses: [ |
|
600
|
|
|
{ |
|
601
|
|
|
sId: \'upshrink\', |
|
602
|
|
|
classExpanded: \'chevricon i-chevron-up icon-lg\', |
|
603
|
|
|
titleExpanded: ' . JavaScriptEscape($txt['upshrink_description']) . ', |
|
604
|
|
|
classCollapsed: \'chevricon i-chevron-down icon-lg\', |
|
605
|
|
|
titleCollapsed: ' . JavaScriptEscape($txt['upshrink_description']) . ' |
|
606
|
|
|
} |
|
607
|
|
|
], |
|
608
|
|
|
oThemeOptions: { |
|
609
|
|
|
bUseThemeSettings: ' . ($context['user']['is_guest'] ? 'false' : 'true') . ', |
|
610
|
|
|
sOptionName: \'minmax_preferences\', |
|
611
|
|
|
sSessionId: elk_session_id, |
|
612
|
|
|
sSessionVar: elk_session_var, |
|
613
|
|
|
sAdditionalVars: \';minmax_key=upshrink\' |
|
614
|
|
|
}, |
|
615
|
|
|
oCookieOptions: { |
|
616
|
|
|
bUseCookie: elk_member_id == 0 ? true : false, |
|
617
|
|
|
sCookieName: \'upshrink\' |
|
618
|
|
|
} |
|
619
|
|
|
}); |
|
620
|
|
|
', true); |
|
621
|
|
|
} |
|
622
|
|
|
|
|
623
|
|
|
/** |
|
624
|
|
|
* Generate a strip of buttons. |
|
625
|
|
|
* |
|
626
|
|
|
* @param mixed[] $button_strip |
|
627
|
|
|
* @param string $direction = '' |
|
628
|
|
|
* @param string[] $strip_options = array() |
|
629
|
|
|
* |
|
630
|
|
|
* @return string as echoed content |
|
631
|
|
|
*/ |
|
632
|
|
|
function template_button_strip($button_strip, $direction = '', $strip_options = array()) |
|
633
|
|
|
{ |
|
634
|
|
|
global $context, $txt; |
|
635
|
|
|
|
|
636
|
|
|
// Not sure if this can happen, but people can misuse functions very efficiently |
|
637
|
|
|
if (empty($button_strip)) |
|
638
|
|
|
return ''; |
|
639
|
|
|
|
|
640
|
|
|
if (!is_array($strip_options)) |
|
641
|
|
|
$strip_options = array(); |
|
642
|
|
|
|
|
643
|
|
|
// List the buttons in reverse order for RTL languages. |
|
644
|
|
|
if ($context['right_to_left']) |
|
645
|
|
|
$button_strip = array_reverse($button_strip, true); |
|
646
|
|
|
|
|
647
|
|
|
// Create the buttons... now with cleaner markup (yay!). |
|
648
|
|
|
$buttons = array(); |
|
649
|
|
|
foreach ($button_strip as $key => $value) |
|
650
|
|
|
{ |
|
651
|
|
|
if (!isset($value['test']) || !empty($context[$value['test']])) |
|
652
|
|
|
$buttons[] = ' |
|
653
|
|
|
<li role="menuitem"><a' . (isset($value['id']) ? ' id="button_strip_' . $value['id'] . '"' : '') . ' class="linklevel1 button_strip_' . $key . (!empty($value['active']) ? ' active' : '') . '" href="' . $value['url'] . '"' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>' . $txt[$value['text']] . '</a></li>'; |
|
654
|
|
|
} |
|
655
|
|
|
|
|
656
|
|
|
// No buttons? No button strip either. |
|
657
|
|
|
if (empty($buttons)) |
|
658
|
|
|
return ''; |
|
659
|
|
|
|
|
660
|
|
|
echo ' |
|
661
|
|
|
<ul role="menubar" class="buttonlist', !empty($direction) ? ' float' . $direction : '', (empty($buttons) ? ' hide"' : '"'), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"' : ''), '> |
|
662
|
|
|
', implode('', $buttons), ' |
|
663
|
|
|
</ul>'; |
|
664
|
|
|
} |
|
665
|
|
|
|
|
666
|
|
|
/** |
|
667
|
|
|
* Generate a strip of "quick" buttons (those present next to each message) |
|
668
|
|
|
* |
|
669
|
|
|
* What it does: |
|
670
|
|
|
* |
|
671
|
|
|
* - Create a quick button, pass an array of the button name with key values |
|
672
|
|
|
* - array('somename' => array(href => '' text => '' custom => '' test => '')) |
|
673
|
|
|
* - href => link to call when button is pressed |
|
674
|
|
|
* - text => text to display in the button |
|
675
|
|
|
* - custom => custom action to perform, generally used to add 'onclick' events (optional) |
|
676
|
|
|
* - test => key to check in the $tests array before showing the button (optional) |
|
677
|
|
|
* - override => full and complete <li></li> to use for the button |
|
678
|
|
|
* - checkboxes can be shown as well as buttons, |
|
679
|
|
|
* - use array('check' => array(checkbox => (true | always), name => value =>) |
|
680
|
|
|
* - if true follows show moderation as checkbox setting, always will always show |
|
681
|
|
|
* - name => name of the checkbox array, like delete, will have [] added for the form |
|
682
|
|
|
* - value => value for the checkbox to return in the post |
|
683
|
|
|
* |
|
684
|
|
|
* @param array $strip - the $context index where the strip is stored |
|
685
|
|
|
* @param bool[] $tests - an array of tests to determine if the button should be displayed or not |
|
686
|
|
|
* @return string of buttons |
|
687
|
|
|
*/ |
|
688
|
|
|
function template_quickbutton_strip($strip, $tests = array()) |
|
689
|
|
|
{ |
|
690
|
|
|
global $options; |
|
691
|
|
|
|
|
692
|
|
|
$buttons = array(); |
|
693
|
|
|
|
|
694
|
|
|
foreach ($strip as $key => $value) |
|
695
|
|
|
{ |
|
696
|
|
|
if (isset($value['checkbox'])) |
|
697
|
|
|
{ |
|
698
|
|
|
if (!empty($value['checkbox']) && ((!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) || $value['checkbox'] === 'always')) |
|
699
|
|
|
{ |
|
700
|
|
|
$buttons[] = ' |
|
701
|
|
|
<li class="listlevel1 ' . $key . '"> |
|
702
|
|
|
<input class="input_check ' . $key . '_check" type="checkbox" name="' . $value['name'] . '[]" value="' . $value['value'] . '" /> |
|
703
|
|
|
</li>'; |
|
704
|
|
|
} |
|
705
|
|
|
} |
|
706
|
|
|
elseif (!isset($value['test']) || !empty($tests[$value['test']])) |
|
707
|
|
|
{ |
|
708
|
|
|
if (!empty($value['override'])) |
|
709
|
|
|
{ |
|
710
|
|
|
$buttons[] = $value['override']; |
|
711
|
|
|
} |
|
712
|
|
|
else |
|
713
|
|
|
{ |
|
714
|
|
|
$buttons[] = ' |
|
715
|
|
|
<li class="listlevel1"> |
|
716
|
|
|
<a href="' . $value['href'] . '" class="linklevel1 ' . $key . '_button"' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>' . $value['text'] . '</a> |
|
717
|
|
|
</li>'; |
|
718
|
|
|
} |
|
719
|
|
|
} |
|
720
|
|
|
} |
|
721
|
|
|
|
|
722
|
|
|
// No buttons? No button strip either. |
|
723
|
|
|
if (empty($buttons)) |
|
724
|
|
|
{ |
|
725
|
|
|
return ''; |
|
726
|
|
|
} |
|
727
|
|
|
|
|
728
|
|
|
echo ' |
|
729
|
|
|
<ul class="quickbuttons">', implode(' |
|
730
|
|
|
', $buttons), ' |
|
731
|
|
|
</ul>'; |
|
732
|
|
|
} |
|
733
|
|
|
|
|
734
|
|
|
/** |
|
735
|
|
|
* Very simple and basic template to display a legend explaining the meaning |
|
736
|
|
|
* of some icons used in the messages listing (locked, sticky, etc.) |
|
737
|
|
|
*/ |
|
738
|
|
|
function template_basicicons_legend() |
|
739
|
|
|
{ |
|
740
|
|
|
global $context, $modSettings, $txt; |
|
741
|
|
|
|
|
742
|
|
|
echo ' |
|
743
|
|
|
<p class="floatleft">', !empty($modSettings['enableParticipation']) && $context['user']['is_logged'] ? ' |
|
744
|
|
|
<span class="topicicon i-profile"></span> ' . $txt['participation_caption'] : '<span class="topicicon img_normal"> </span>' . $txt['normal_topic'], '<br /> |
|
745
|
|
|
' . (!empty($modSettings['pollMode']) ? '<span class="topicicon i-poll"> </span>' . $txt['poll'] : '') . ' |
|
746
|
|
|
</p> |
|
747
|
|
|
<p> |
|
748
|
|
|
<span class="topicicon i-locked"> </span>' . $txt['locked_topic'] . '<br /> |
|
749
|
|
|
<span class="topicicon i-sticky"> </span>' . $txt['sticky_topic'] . '<br /> |
|
750
|
|
|
</p>'; |
|
751
|
|
|
} |
|
752
|
|
|
|
|
753
|
|
|
/** |
|
754
|
|
|
* Show a box with a message, mostly used to show errors, but can be used to show |
|
755
|
|
|
* success as well |
|
756
|
|
|
* |
|
757
|
|
|
* Looks for the display information in the $context[$error_id] array |
|
758
|
|
|
* Keys of array are 'type' |
|
759
|
|
|
* - empty or success for successbox |
|
760
|
|
|
* - serious for error box |
|
761
|
|
|
* - warning for warning box |
|
762
|
|
|
* 'title' - optional value to place above list |
|
763
|
|
|
* 'errors' - array of text strings to display in the box |
|
764
|
|
|
* |
|
765
|
|
|
* @param string $error_id |
|
766
|
|
|
*/ |
|
767
|
|
|
function template_show_error($error_id) |
|
768
|
|
|
{ |
|
769
|
|
|
global $context; |
|
770
|
|
|
|
|
771
|
|
|
if (empty($error_id)) |
|
772
|
|
|
return; |
|
773
|
|
|
|
|
774
|
|
|
$error = isset($context[$error_id]) ? $context[$error_id] : array(); |
|
775
|
|
|
|
|
776
|
|
|
echo ' |
|
777
|
|
|
<div id="', $error_id, '" class="', (isset($error['type']) ? ($error['type'] === 'serious' ? 'errorbox' : 'warningbox') : 'successbox'), empty($error['errors']) ? ' hide"' : '"', '>'; |
|
778
|
|
|
|
|
779
|
|
|
// Optional title for our results |
|
780
|
|
|
if (!empty($error['title'])) |
|
781
|
|
|
echo ' |
|
782
|
|
|
<dl> |
|
783
|
|
|
<dt> |
|
784
|
|
|
<strong id="', $error_id, '_title">', $error['title'], '</strong> |
|
785
|
|
|
</dt> |
|
786
|
|
|
<dd>'; |
|
787
|
|
|
|
|
788
|
|
|
// Everything that went wrong, or correctly :) |
|
789
|
|
|
if (!empty($error['errors'])) |
|
790
|
|
|
{ |
|
791
|
|
|
echo ' |
|
792
|
|
|
<ul', (isset($error['type']) ? ' class="error"' : ''), ' id="', $error_id, '_list">'; |
|
793
|
|
|
|
|
794
|
|
|
foreach ($error['errors'] as $key => $err) |
|
795
|
|
|
echo ' |
|
796
|
|
|
<li id="', $error_id, '_', $key, '">', $err, '</li>'; |
|
797
|
|
|
echo ' |
|
798
|
|
|
</ul>'; |
|
799
|
|
|
} |
|
800
|
|
|
|
|
801
|
|
|
// All done |
|
802
|
|
|
if (!empty($error['title'])) |
|
803
|
|
|
echo ' |
|
804
|
|
|
</dd> |
|
805
|
|
|
</dl>'; |
|
806
|
|
|
|
|
807
|
|
|
echo ' |
|
808
|
|
|
</div>'; |
|
809
|
|
|
} |
|
810
|
|
|
|
|
811
|
|
|
function template_uc_generic_infobox() |
|
812
|
|
|
{ |
|
813
|
|
|
global $context; |
|
814
|
|
|
|
|
815
|
|
|
if (empty($context['generic_infobox'])) |
|
816
|
|
|
{ |
|
817
|
|
|
return; |
|
818
|
|
|
} |
|
819
|
|
|
|
|
820
|
|
|
foreach ($context['generic_infobox'] as $key) |
|
821
|
|
|
{ |
|
822
|
|
|
template_show_error($key); |
|
823
|
|
|
} |
|
824
|
|
|
} |
|
825
|
|
|
|
|
826
|
|
|
/** |
|
827
|
|
|
* Another used and abused piece of template that can be found everywhere |
|
828
|
|
|
* |
|
829
|
|
|
* @param string|boolean $button_strip index of $context to create the button strip |
|
830
|
|
|
* @param string $strip_direction direction of the button strip (see template_button_strip for details) |
|
831
|
|
|
* @param array $options array of optional values, possible values: |
|
832
|
|
|
* - 'page_index' (string) index of $context where is located the pages index generated by constructPageIndex |
|
833
|
|
|
* - 'page_index_markup' (string) markup for the page index, overrides 'page_index' and can be used if |
|
834
|
|
|
* the page index code is not in the first level of $context |
|
835
|
|
|
* - 'extra' (string) used to add html markup at the end of the template |
|
836
|
|
|
* |
|
837
|
|
|
* @return string as echoed content |
|
838
|
|
|
*/ |
|
839
|
|
|
function template_pagesection($button_strip = false, $strip_direction = '', $options = array()) |
|
840
|
|
|
{ |
|
841
|
|
|
global $context; |
|
842
|
|
|
|
|
843
|
|
|
// Hmmm. I'm a tad wary of having floatleft here but anyway............ |
|
844
|
|
|
// @todo - Try using table-cell display here. Should do auto rtl support. Less markup, less css. :) |
|
845
|
|
|
if (!empty($options['page_index_markup'])) |
|
846
|
|
|
$pages = '<ul ' . (isset($options['page_index_id']) ? 'id="' . $options['page_index_id'] . '" ' : '') . 'class="pagelinks floatleft" role="menubar">' . $options['page_index_markup'] . '</ul>'; |
|
847
|
|
|
else |
|
848
|
|
|
{ |
|
849
|
|
|
if (!isset($options['page_index'])) |
|
850
|
|
|
$options['page_index'] = 'page_index'; |
|
851
|
|
|
$pages = empty($context[$options['page_index']]) ? '' : '<ul ' . (isset($options['page_index_id']) ? 'id="' . $options['page_index_id'] . '" ' : '') . 'class="pagelinks floatleft" role="menubar">' . $context[$options['page_index']] . '</ul>'; |
|
852
|
|
|
} |
|
853
|
|
|
|
|
854
|
|
|
if (!isset($options['extra'])) |
|
855
|
|
|
$options['extra'] = ''; |
|
856
|
|
|
|
|
857
|
|
|
echo ' |
|
858
|
|
|
<nav class="pagesection"> |
|
859
|
|
|
', $pages, ' |
|
860
|
|
|
', !empty($button_strip) && !empty($context[$button_strip]) ? template_button_strip($context[$button_strip], $strip_direction) : '', |
|
861
|
|
|
$options['extra'], ' |
|
862
|
|
|
</nav>'; |
|
863
|
|
|
} |
|
864
|
|
|
|
|
865
|
|
|
/** |
|
866
|
|
|
* This is the news fader |
|
867
|
|
|
*/ |
|
868
|
|
|
function template_news_fader() |
|
869
|
|
|
{ |
|
870
|
|
|
global $settings, $context; |
|
871
|
|
|
|
|
872
|
|
|
echo ' |
|
873
|
|
|
<ul id="elkFadeScroller"> |
|
874
|
|
|
<li> |
|
875
|
|
|
', $settings['enable_news'] == 2 ? implode('</li><li>', $context['news_lines']) : $context['random_news_line'], ' |
|
876
|
|
|
</li> |
|
877
|
|
|
</ul>'; |
|
878
|
|
|
|
|
879
|
|
|
addInlineJavascript(' |
|
880
|
|
|
$(\'#elkFadeScroller\').Elk_NewsFader(' . (empty($settings['newsfader_time']) ? '' : '{\'iFadeDelay\': ' . $settings['newsfader_time'] . '}') . ');', true); |
|
881
|
|
|
} |
|
882
|
|
|
|
|
883
|
|
|
/** |
|
884
|
|
|
* |
|
885
|
|
|
* @TODO: These need to be moved somewhere appropriate >_> |
|
886
|
|
|
* |
|
887
|
|
|
* @param array $member |
|
888
|
|
|
* @param bool $link |
|
889
|
|
|
* |
|
890
|
|
|
* @return string |
|
891
|
|
|
*/ |
|
892
|
|
|
function template_member_online($member, $link = true) |
|
893
|
|
|
{ |
|
894
|
|
|
global $context; |
|
895
|
|
|
|
|
896
|
|
|
return ((!empty($context['can_send_pm']) && $link) ? '<a href="' . $member['online']['href'] . '" title="' . $member['online']['text'] . '">' : '') . |
|
897
|
|
|
'<i class="' . ($member['online']['is_online'] ? 'iconline' : 'icoffline') . '" title="' . $member['online']['text'] . '"></i>' . |
|
898
|
|
|
((!empty($context['can_send_pm']) && $link) ? '</a>' : ''); |
|
899
|
|
|
} |
|
900
|
|
|
|
|
901
|
|
|
/** |
|
902
|
|
|
* Similar to the above. Wanted to centralize this to make it easier to pull out the emailuser action and replace with |
|
903
|
|
|
* a mailto: href, which many sane board admins would prefer. |
|
904
|
|
|
* |
|
905
|
|
|
* @param array $member |
|
906
|
|
|
* @param bool $text |
|
907
|
|
|
* |
|
908
|
|
|
* @return string |
|
909
|
|
|
*/ |
|
910
|
|
|
function template_member_email($member, $text = false) |
|
911
|
|
|
{ |
|
912
|
|
|
global $context, $txt, $scripturl; |
|
913
|
|
|
|
|
914
|
|
|
if ($context['can_send_email']) |
|
915
|
|
|
{ |
|
916
|
|
|
if ($text) |
|
917
|
|
|
{ |
|
918
|
|
|
if ($member['show_email'] === 'no_through_forum') |
|
919
|
|
|
{ |
|
920
|
|
|
return '<a class="linkbutton" href="' . $scripturl . '?action=emailuser;sa=email;uid=' . $member['id'] . '">' . $txt['email'] . '</a>'; |
|
921
|
|
|
} |
|
922
|
|
|
elseif ($member['show_email'] === 'yes_permission_override' || $member['show_email'] === 'yes') |
|
923
|
|
|
{ |
|
924
|
|
|
return '<a class="linkbutton" href="' . $scripturl . '?action=emailuser;sa=email;uid=' . $member['id'] . '">' . $member['email'] . '</a>'; |
|
925
|
|
|
} |
|
926
|
|
|
else |
|
927
|
|
|
{ |
|
928
|
|
|
return $txt['hidden']; |
|
929
|
|
|
} |
|
930
|
|
|
} |
|
931
|
|
|
else |
|
932
|
|
|
{ |
|
933
|
|
|
if ($member['show_email'] !== 'no') |
|
934
|
|
|
{ |
|
935
|
|
|
return '<a href="' . $scripturl . '?action=emailuser;sa=email;uid=' . $member['id'] . '" class="icon i-envelope-o' . ($member['online']['is_online'] ? '' : '-blank') . '" title="' . $txt['email'] . ' ' . $member['name'] . '"><s>' . $txt['email'] . ' ' . $member['name'] . '</s></a>'; |
|
936
|
|
|
} |
|
937
|
|
View Code Duplication |
else |
|
938
|
|
|
{ |
|
939
|
|
|
return '<i class="icon i-envelope-o" title="' . $txt['email'] . ' ' . $txt['hidden'] . '"><s>' . $txt['email'] . ' ' . $txt['hidden'] . '</s></i>'; |
|
940
|
|
|
} |
|
941
|
|
|
} |
|
942
|
|
|
} |
|
943
|
|
|
|
|
944
|
|
|
return ''; |
|
945
|
|
|
} |
|
946
|
|
|
|
|
947
|
|
|
/** |
|
948
|
|
|
* Sometimes we only get a message id. |
|
949
|
|
|
* |
|
950
|
|
|
* @param $id |
|
951
|
|
|
* @param bool|mixed[] $member |
|
952
|
|
|
* |
|
953
|
|
|
* @return string |
|
954
|
|
|
*/ |
|
955
|
|
|
function template_msg_email($id, $member = false) |
|
956
|
|
|
{ |
|
957
|
|
|
global $context, $txt, $scripturl; |
|
958
|
|
|
|
|
959
|
|
|
if ($context['can_send_email']) |
|
960
|
|
|
{ |
|
961
|
|
|
if ($member === false || $member['show_email'] != 'no') |
|
962
|
|
|
{ |
|
963
|
|
|
if (empty($member['id'])) |
|
964
|
|
|
{ |
|
965
|
|
|
return '<a href="' . $scripturl . '?action=emailuser;sa=email;msg=' . $id . '" class="icon i-envelope-o' . (($member !== false && $member['online']['is_online']) ? '' : '-blank') . '" title="' . $txt['email'] . '"><s>' . $txt['email'] . '</s></a>'; |
|
966
|
|
|
} |
|
967
|
|
|
else |
|
968
|
|
|
{ |
|
969
|
|
|
return '<a href="' . $scripturl . '?action=emailuser;sa=email;uid=' . $member['id'] . '" class="icon i-envelope-o' . (($member !== false && $member['online']['is_online']) ? '' : '-blank') . '" title="' . $txt['email'] . '"><s>' . $txt['email'] . '</s></a>'; |
|
970
|
|
|
} |
|
971
|
|
|
} |
|
972
|
|
View Code Duplication |
else |
|
973
|
|
|
{ |
|
974
|
|
|
return '<i class="icon i-envelope-o" title="' . $txt['email'] . ' ' . $txt['hidden'] . '"><s>' . $txt['email'] . ' ' . $txt['hidden'] . '</s></i>'; |
|
975
|
|
|
} |
|
976
|
|
|
} |
|
977
|
|
|
|
|
978
|
|
|
return ''; |
|
979
|
|
|
} |
|
980
|
|
|
|