Chris@76
|
1 <?php
|
Chris@76
|
2 /**
|
Chris@76
|
3 * Simple Machines Forum (SMF)
|
Chris@76
|
4 *
|
Chris@76
|
5 * @package SMF
|
Chris@76
|
6 * @author Simple Machines
|
Chris@76
|
7 * @copyright 2011 Simple Machines
|
Chris@76
|
8 * @license http://www.simplemachines.org/about/smf/license.php BSD
|
Chris@76
|
9 *
|
Chris@76
|
10 * @version 2.0
|
Chris@76
|
11 */
|
Chris@76
|
12
|
Chris@76
|
13 /* This template is, perhaps, the most important template in the theme. It
|
Chris@76
|
14 contains the main template layer that displays the header and footer of
|
Chris@76
|
15 the forum, namely with main_above and main_below. It also contains the
|
Chris@76
|
16 menu sub template, which appropriately displays the menu; the init sub
|
Chris@76
|
17 template, which is there to set the theme up; (init can be missing.) and
|
Chris@76
|
18 the linktree sub template, which sorts out the link tree.
|
Chris@76
|
19
|
Chris@76
|
20 The init sub template should load any data and set any hardcoded options.
|
Chris@76
|
21
|
Chris@76
|
22 The main_above sub template is what is shown above the main content, and
|
Chris@76
|
23 should contain anything that should be shown up there.
|
Chris@76
|
24
|
Chris@76
|
25 The main_below sub template, conversely, is shown after the main content.
|
Chris@76
|
26 It should probably contain the copyright statement and some other things.
|
Chris@76
|
27
|
Chris@76
|
28 The linktree sub template should display the link tree, using the data
|
Chris@76
|
29 in the $context['linktree'] variable.
|
Chris@76
|
30
|
Chris@76
|
31 The menu sub template should display all the relevant buttons the user
|
Chris@76
|
32 wants and or needs.
|
Chris@76
|
33
|
Chris@76
|
34 For more information on the templating system, please see the site at:
|
Chris@76
|
35 http://www.simplemachines.org/
|
Chris@76
|
36 */
|
Chris@76
|
37
|
Chris@76
|
38 // Initialize the template... mainly little settings.
|
Chris@76
|
39 function template_init()
|
Chris@76
|
40 {
|
Chris@76
|
41 global $context, $settings, $options, $txt;
|
Chris@76
|
42
|
Chris@76
|
43 /* Use images from default theme when using templates from the default theme?
|
Chris@76
|
44 if this is 'always', images from the default theme will be used.
|
Chris@76
|
45 if this is 'defaults', images from the default theme will only be used with default templates.
|
Chris@76
|
46 if this is 'never' or isn't set at all, images from the default theme will not be used. */
|
Chris@76
|
47 $settings['use_default_images'] = 'never';
|
Chris@76
|
48
|
Chris@76
|
49 /* What document type definition is being used? (for font size and other issues.)
|
Chris@76
|
50 'xhtml' for an XHTML 1.0 document type definition.
|
Chris@76
|
51 'html' for an HTML 4.01 document type definition. */
|
Chris@76
|
52 $settings['doctype'] = 'xhtml';
|
Chris@76
|
53
|
Chris@76
|
54 /* The version this template/theme is for.
|
Chris@76
|
55 This should probably be the version of SMF it was created for. */
|
Chris@76
|
56 $settings['theme_version'] = '2.0';
|
Chris@76
|
57
|
Chris@76
|
58 /* Set a setting that tells the theme that it can render the tabs. */
|
Chris@76
|
59 $settings['use_tabs'] = true;
|
Chris@76
|
60
|
Chris@76
|
61 /* Use plain buttons - as opposed to text buttons? */
|
Chris@76
|
62 $settings['use_buttons'] = true;
|
Chris@76
|
63
|
Chris@76
|
64 /* Show sticky and lock status separate from topic icons? */
|
Chris@76
|
65 $settings['separate_sticky_lock'] = true;
|
Chris@76
|
66
|
Chris@76
|
67 /* Does this theme use the strict doctype? */
|
Chris@76
|
68 $settings['strict_doctype'] = false;
|
Chris@76
|
69
|
Chris@76
|
70 /* Does this theme use post previews on the message index? */
|
Chris@76
|
71 $settings['message_index_preview'] = false;
|
Chris@76
|
72
|
Chris@76
|
73 /* Set the following variable to true if this theme requires the optional theme strings file to be loaded. */
|
Chris@76
|
74 $settings['require_theme_strings'] = false;
|
Chris@76
|
75 }
|
Chris@76
|
76
|
Chris@76
|
77 // The main sub template above the content.
|
Chris@76
|
78 function template_html_above()
|
Chris@76
|
79 {
|
Chris@76
|
80 global $context, $settings, $options, $scripturl, $txt, $modSettings;
|
Chris@76
|
81
|
Chris@76
|
82 // Show right to left and the character set for ease of translating.
|
Chris@76
|
83 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
Chris@76
|
84 <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head>';
|
Chris@76
|
85
|
Chris@76
|
86 // The ?fin20 part of this link is just here to make sure browsers don't cache it wrongly.
|
Chris@76
|
87 echo '
|
Chris@76
|
88 <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?fin20" />';
|
Chris@76
|
89
|
Chris@76
|
90 // Some browsers need an extra stylesheet due to bugs/compatibility issues.
|
Chris@76
|
91 foreach (array('ie7', 'ie6', 'webkit') as $cssfix)
|
Chris@76
|
92 if ($context['browser']['is_' . $cssfix])
|
Chris@76
|
93 echo '
|
Chris@76
|
94 <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/', $cssfix, '.css" />';
|
Chris@76
|
95
|
Chris@76
|
96 // RTL languages require an additional stylesheet.
|
Chris@76
|
97 if ($context['right_to_left'])
|
Chris@76
|
98 echo '
|
Chris@76
|
99 <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/rtl.css" />';
|
Chris@76
|
100
|
Chris@76
|
101 // Here comes the JavaScript bits!
|
Chris@76
|
102 echo '
|
Chris@76
|
103 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js?fin20"></script>
|
Chris@76
|
104 <script type="text/javascript" src="', $settings['theme_url'], '/scripts/theme.js?fin20"></script>
|
Chris@76
|
105 <script type="text/javascript"><!-- // --><![CDATA[
|
Chris@76
|
106 var smf_theme_url = "', $settings['theme_url'], '";
|
Chris@76
|
107 var smf_default_theme_url = "', $settings['default_theme_url'], '";
|
Chris@76
|
108 var smf_images_url = "', $settings['images_url'], '";
|
Chris@76
|
109 var smf_scripturl = "', $scripturl, '";
|
Chris@76
|
110 var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
|
Chris@76
|
111 var smf_charset = "', $context['character_set'], '";', $context['show_pm_popup'] ? '
|
Chris@76
|
112 var fPmPopup = function ()
|
Chris@76
|
113 {
|
Chris@76
|
114 if (confirm("' . $txt['show_personal_messages'] . '"))
|
Chris@76
|
115 window.open(smf_prepareScriptUrl(smf_scripturl) + "action=pm");
|
Chris@76
|
116 }
|
Chris@76
|
117 addLoadEvent(fPmPopup);' : '', '
|
Chris@76
|
118 var ajax_notification_text = "', $txt['ajax_in_progress'], '";
|
Chris@76
|
119 var ajax_notification_cancel_text = "', $txt['modify_cancel'], '";
|
Chris@76
|
120 // ]]></script>';
|
Chris@76
|
121
|
Chris@76
|
122 echo '
|
Chris@76
|
123 <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
|
Chris@76
|
124 <meta name="description" content="', $context['page_title_html_safe'], '" />', !empty($context['meta_keywords']) ? '
|
Chris@76
|
125 <meta name="keywords" content="' . $context['meta_keywords'] . '" />' : '', '
|
Chris@76
|
126 <title>', $context['page_title_html_safe'], '</title>';
|
Chris@76
|
127
|
Chris@76
|
128 // Please don't index these Mr Robot.
|
Chris@76
|
129 if (!empty($context['robot_no_index']))
|
Chris@76
|
130 echo '
|
Chris@76
|
131 <meta name="robots" content="noindex" />';
|
Chris@76
|
132
|
Chris@76
|
133 // Present a canonical url for search engines to prevent duplicate content in their indices.
|
Chris@76
|
134 if (!empty($context['canonical_url']))
|
Chris@76
|
135 echo '
|
Chris@76
|
136 <link rel="canonical" href="', $context['canonical_url'], '" />';
|
Chris@76
|
137
|
Chris@76
|
138 // Show all the relative links, such as help, search, contents, and the like.
|
Chris@76
|
139 echo '
|
Chris@76
|
140 <link rel="help" href="', $scripturl, '?action=help" />
|
Chris@76
|
141 <link rel="search" href="' . $scripturl . '?action=search" />
|
Chris@76
|
142 <link rel="contents" href="', $scripturl, '" />';
|
Chris@76
|
143
|
Chris@76
|
144 // If RSS feeds are enabled, advertise the presence of one.
|
Chris@76
|
145 if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
|
Chris@76
|
146 echo '
|
Chris@76
|
147 <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss;action=.xml" />';
|
Chris@76
|
148
|
Chris@76
|
149 // If we're viewing a topic, these should be the previous and next topics, respectively.
|
Chris@76
|
150 if (!empty($context['current_topic']))
|
Chris@76
|
151 echo '
|
Chris@76
|
152 <link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />
|
Chris@76
|
153 <link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />';
|
Chris@76
|
154
|
Chris@76
|
155 // If we're in a board, or a topic for that matter, the index will be the board's index.
|
Chris@76
|
156 if (!empty($context['current_board']))
|
Chris@76
|
157 echo '
|
Chris@76
|
158 <link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0" />';
|
Chris@76
|
159
|
Chris@76
|
160 // We'll have to use the cookie to remember the header...
|
Chris@76
|
161 if ($context['user']['is_guest'])
|
Chris@76
|
162 {
|
Chris@76
|
163 $options['collapse_header'] = !empty($_COOKIE['upshrink']);
|
Chris@76
|
164 $options['collapse_header_ic'] = !empty($_COOKIE['upshrinkIC']);
|
Chris@76
|
165 }
|
Chris@76
|
166
|
Chris@76
|
167 // Output any remaining HTML headers. (from mods, maybe?)
|
Chris@76
|
168 echo $context['html_headers'];
|
Chris@76
|
169
|
Chris@76
|
170 echo '
|
Chris@76
|
171 </head>
|
Chris@76
|
172 <body>';
|
Chris@76
|
173 }
|
Chris@76
|
174
|
Chris@76
|
175 function template_body_above()
|
Chris@76
|
176 {
|
Chris@76
|
177 global $context, $settings, $options, $scripturl, $txt, $modSettings;
|
Chris@76
|
178
|
Chris@76
|
179 echo '
|
Chris@76
|
180 <div id="mainframe"', !empty($settings['forum_width']) ? ' style="width: ' . $settings['forum_width'] . '"' : '', '>
|
Chris@76
|
181 <div class="tborder">
|
Chris@76
|
182 <div class="catbg">
|
Chris@76
|
183 <img class="floatright" id="smflogo" src="', $settings['images_url'], '/smflogo.gif" alt="Simple Machines Forum" />
|
Chris@76
|
184 <h1 id="forum_name">';
|
Chris@76
|
185
|
Chris@76
|
186 if (empty($context['header_logo_url_html_safe']))
|
Chris@76
|
187 echo $context['forum_name_html_safe'];
|
Chris@76
|
188 else
|
Chris@76
|
189 echo '
|
Chris@76
|
190 <img src="', $context['header_logo_url_html_safe'], '" alt="', $context['forum_name_html_safe'], '" />';
|
Chris@76
|
191
|
Chris@76
|
192 echo '
|
Chris@76
|
193 </h1>
|
Chris@76
|
194 </div>';
|
Chris@76
|
195
|
Chris@76
|
196 // Display user name and time.
|
Chris@76
|
197 echo '
|
Chris@76
|
198 <ul id="greeting_section" class="reset titlebg2">
|
Chris@76
|
199 <li id="time" class="smalltext floatright">
|
Chris@76
|
200 ', $context['current_time'], '
|
Chris@76
|
201 <img id="upshrink" src="', $settings['images_url'], '/upshrink.gif" alt="*" title="', $txt['upshrink_description'], '" align="bottom" style="display: none;" />
|
Chris@76
|
202 </li>';
|
Chris@76
|
203
|
Chris@76
|
204 if ($context['user']['is_logged'])
|
Chris@76
|
205 echo '
|
Chris@76
|
206 <li id="name">', $txt['hello_member_ndt'], ' <em>', $context['user']['name'], '</em></li>';
|
Chris@76
|
207 else
|
Chris@76
|
208 echo '
|
Chris@76
|
209 <li id="name">', $txt['hello_guest'], ' <em>', $txt['guest'], '</em></li>';
|
Chris@76
|
210
|
Chris@76
|
211 echo '
|
Chris@76
|
212 </ul>';
|
Chris@76
|
213
|
Chris@76
|
214 if ($context['user']['is_logged'] || !empty($context['show_login_bar']))
|
Chris@76
|
215 echo '
|
Chris@76
|
216 <div id="user_section" class="bordercolor"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
|
Chris@76
|
217 <div class="windowbg2 clearfix">';
|
Chris@76
|
218
|
Chris@76
|
219 if (!empty($context['user']['avatar']))
|
Chris@76
|
220 echo '
|
Chris@76
|
221 <div id="myavatar">', $context['user']['avatar']['image'], '</div>';
|
Chris@76
|
222
|
Chris@76
|
223 // If the user is logged in, display stuff like their name, new messages, etc.
|
Chris@76
|
224 if ($context['user']['is_logged'])
|
Chris@76
|
225 {
|
Chris@76
|
226 echo '
|
Chris@76
|
227 <ul class="reset">
|
Chris@76
|
228 <li><a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a></li>
|
Chris@76
|
229 <li><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a></li>';
|
Chris@76
|
230
|
Chris@76
|
231 // Is the forum in maintenance mode?
|
Chris@76
|
232 if ($context['in_maintenance'] && $context['user']['is_admin'])
|
Chris@76
|
233 echo '
|
Chris@76
|
234 <li class="notice">', $txt['maintain_mode_on'], '</li>';
|
Chris@76
|
235
|
Chris@76
|
236 // Are there any members waiting for approval?
|
Chris@76
|
237 if (!empty($context['unapproved_members']))
|
Chris@76
|
238 echo '
|
Chris@76
|
239 <li>', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=admin;area=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a> ', $txt['approve_members_waiting'], '</li>';
|
Chris@76
|
240
|
Chris@76
|
241 // Show the total time logged in?
|
Chris@76
|
242 if (!empty($context['user']['total_time_logged_in']))
|
Chris@76
|
243 {
|
Chris@76
|
244 echo '
|
Chris@76
|
245 <li>', $txt['totalTimeLogged1'];
|
Chris@76
|
246
|
Chris@76
|
247 // If days is just zero, don't bother to show it.
|
Chris@76
|
248 if ($context['user']['total_time_logged_in']['days'] > 0)
|
Chris@76
|
249 echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];
|
Chris@76
|
250
|
Chris@76
|
251 // Same with hours - only show it if it's above zero.
|
Chris@76
|
252 if ($context['user']['total_time_logged_in']['hours'] > 0)
|
Chris@76
|
253 echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];
|
Chris@76
|
254
|
Chris@76
|
255 // But, let's always show minutes - Time wasted here: 0 minutes ;).
|
Chris@76
|
256 echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '
|
Chris@76
|
257 </li>';
|
Chris@76
|
258 }
|
Chris@76
|
259
|
Chris@76
|
260 if (!empty($context['open_mod_reports']) && $context['show_open_reports'])
|
Chris@76
|
261 echo '
|
Chris@76
|
262 <li><a href="', $scripturl, '?action=moderate;area=reports">', sprintf($txt['mod_reports_waiting'], $context['open_mod_reports']), '</a></li>';
|
Chris@76
|
263 echo '
|
Chris@76
|
264 </ul>';
|
Chris@76
|
265 }
|
Chris@76
|
266 // Otherwise they're a guest - this time ask them to either register or login - lazy bums...
|
Chris@76
|
267 elseif (!empty($context['show_login_bar']))
|
Chris@76
|
268 {
|
Chris@76
|
269 echo '
|
Chris@76
|
270 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
|
Chris@76
|
271 <form class="windowbg" id="guest_form" action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
|
Chris@76
|
272 ', $txt['login_or_register'], '<br />
|
Chris@76
|
273 <input type="text" name="user" size="10" class="input_text" />
|
Chris@76
|
274 <input type="password" name="passwrd" size="10" class="input_password" />
|
Chris@76
|
275 <select name="cookielength">
|
Chris@76
|
276 <option value="60">', $txt['one_hour'], '</option>
|
Chris@76
|
277 <option value="1440">', $txt['one_day'], '</option>
|
Chris@76
|
278 <option value="10080">', $txt['one_week'], '</option>
|
Chris@76
|
279 <option value="43200">', $txt['one_month'], '</option>
|
Chris@76
|
280 <option value="-1" selected="selected">', $txt['forever'], '</option>
|
Chris@76
|
281 </select>
|
Chris@76
|
282 <input type="submit" value="', $txt['login'], '" class="button_submit" /><br />
|
Chris@76
|
283 ', $txt['quick_login_dec'];
|
Chris@76
|
284
|
Chris@76
|
285 if (!empty($modSettings['enableOpenID']))
|
Chris@76
|
286 echo '
|
Chris@76
|
287 <br />
|
Chris@76
|
288 <input type="text" name="openid_identifier" id="openid_url" size="25" class="input_text openid_login" />';
|
Chris@76
|
289
|
Chris@76
|
290 echo '
|
Chris@76
|
291 <input type="hidden" name="hash_passwrd" value="" />
|
Chris@76
|
292 </form>';
|
Chris@76
|
293 }
|
Chris@76
|
294
|
Chris@76
|
295 if ($context['user']['is_logged'] || !empty($context['show_login_bar']))
|
Chris@76
|
296 echo '
|
Chris@76
|
297 </div>
|
Chris@76
|
298 </div>';
|
Chris@76
|
299
|
Chris@76
|
300 echo '
|
Chris@76
|
301 <div id="news_section" class="titlebg2 clearfix"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
|
Chris@76
|
302 <form class="floatright" id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
|
Chris@76
|
303 <a href="', $scripturl, '?action=search;advanced" title="', $txt['search_advanced'], '"><img id="advsearch" src="'.$settings['images_url'].'/filter.gif" align="middle" alt="', $txt['search_advanced'], '" /></a>
|
Chris@76
|
304 <input type="text" name="search" value="" style="width: 190px;" class="input_text" />
|
Chris@76
|
305 <input type="submit" name="submit" value="', $txt['search'], '" style="width: 11ex;" class="button_submit" />
|
Chris@76
|
306 <input type="hidden" name="advanced" value="0" />';
|
Chris@76
|
307
|
Chris@76
|
308 // Search within current topic?
|
Chris@76
|
309 if (!empty($context['current_topic']))
|
Chris@76
|
310 echo '
|
Chris@76
|
311 <input type="hidden" name="topic" value="', $context['current_topic'], '" />';
|
Chris@76
|
312 // If we're on a certain board, limit it to this board ;).
|
Chris@76
|
313 elseif (!empty($context['current_board']))
|
Chris@76
|
314 echo '
|
Chris@76
|
315 <input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';
|
Chris@76
|
316
|
Chris@76
|
317 echo '
|
Chris@76
|
318 </form>';
|
Chris@76
|
319
|
Chris@76
|
320 // Show a random news item? (or you could pick one from news_lines...)
|
Chris@76
|
321 if (!empty($settings['enable_news']))
|
Chris@76
|
322 echo '
|
Chris@76
|
323 <div id="random_news"><h3>', $txt['news'], ':</h3><p>', $context['random_news_line'], '</p></div>';
|
Chris@76
|
324
|
Chris@76
|
325 echo '
|
Chris@76
|
326 </div>
|
Chris@76
|
327 </div>';
|
Chris@76
|
328
|
Chris@76
|
329 // Define the upper_section toggle in JavaScript.
|
Chris@76
|
330 echo '
|
Chris@76
|
331 <script type="text/javascript"><!-- // --><![CDATA[
|
Chris@76
|
332 var oMainHeaderToggle = new smc_Toggle({
|
Chris@76
|
333 bToggleEnabled: true,
|
Chris@76
|
334 bCurrentlyCollapsed: ', empty($options['collapse_header']) ? 'false' : 'true', ',
|
Chris@76
|
335 aSwappableContainers: [
|
Chris@76
|
336 \'user_section\',
|
Chris@76
|
337 \'news_section\'
|
Chris@76
|
338 ],
|
Chris@76
|
339 aSwapImages: [
|
Chris@76
|
340 {
|
Chris@76
|
341 sId: \'upshrink\',
|
Chris@76
|
342 srcExpanded: smf_images_url + \'/upshrink.gif\',
|
Chris@76
|
343 altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
|
Chris@76
|
344 srcCollapsed: smf_images_url + \'/upshrink2.gif\',
|
Chris@76
|
345 altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
|
Chris@76
|
346 }
|
Chris@76
|
347 ],
|
Chris@76
|
348 oThemeOptions: {
|
Chris@76
|
349 bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
|
Chris@76
|
350 sOptionName: \'collapse_header\',
|
Chris@76
|
351 sSessionVar: ', JavaScriptEscape($context['session_var']), ',
|
Chris@76
|
352 sSessionId: ', JavaScriptEscape($context['session_id']), '
|
Chris@76
|
353 },
|
Chris@76
|
354 oCookieOptions: {
|
Chris@76
|
355 bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
|
Chris@76
|
356 sCookieName: \'upshrink\'
|
Chris@76
|
357 }
|
Chris@76
|
358 });
|
Chris@76
|
359 // ]]></script>';
|
Chris@76
|
360
|
Chris@76
|
361 // Show the menu here, according to the menu sub template.
|
Chris@76
|
362 template_menu();
|
Chris@76
|
363
|
Chris@76
|
364 // Show the navigation tree.
|
Chris@76
|
365 theme_linktree();
|
Chris@76
|
366
|
Chris@76
|
367 // The main content should go here.
|
Chris@76
|
368 echo '
|
Chris@76
|
369 <div id="bodyarea">';
|
Chris@76
|
370 }
|
Chris@76
|
371
|
Chris@76
|
372 function template_body_below()
|
Chris@76
|
373 {
|
Chris@76
|
374 global $context, $settings, $options, $scripturl, $txt, $modSettings;
|
Chris@76
|
375
|
Chris@76
|
376 echo '
|
Chris@76
|
377 </div>';
|
Chris@76
|
378
|
Chris@76
|
379 // Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
|
Chris@76
|
380 echo '
|
Chris@76
|
381 <div id="footerarea" class="headerpadding topmargin clearfix">
|
Chris@76
|
382 <ul class="reset smalltext">
|
Chris@76
|
383 <li class="copyright">', theme_copyright(), '</li>
|
Chris@76
|
384 <li><a id="button_xhtml" href="http://validator.w3.org/check?uri=referer" target="_blank" class="new_win" title="', $txt['valid_xhtml'], '"><span>', $txt['xhtml'], '</span></a></li>
|
Chris@76
|
385 ', !empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']) ? '<li><a id="button_rss" href="' . $scripturl . '?action=.xml;type=rss" class="new_win"><span>' . $txt['rss'] . '</span></a></li>' : '', '
|
Chris@76
|
386 <li class="last"><a id="button_wap2" href="', $scripturl , '?wap2" class="new_win"><span>', $txt['wap2'], '</span></a></li>
|
Chris@76
|
387 </ul>';
|
Chris@76
|
388
|
Chris@76
|
389 // Show the load time?
|
Chris@76
|
390 if ($context['show_load_time'])
|
Chris@76
|
391 echo '
|
Chris@76
|
392 <p class="smalltext" id="show_loadtime">', $txt['page_created'], $context['load_time'], $txt['seconds_with'], $context['load_queries'], $txt['queries'], '</p>';
|
Chris@76
|
393
|
Chris@76
|
394 echo '
|
Chris@76
|
395 </div>
|
Chris@76
|
396 </div>';
|
Chris@76
|
397 }
|
Chris@76
|
398
|
Chris@76
|
399 function template_html_below()
|
Chris@76
|
400 {
|
Chris@76
|
401 global $context, $settings, $options, $scripturl, $txt, $modSettings;
|
Chris@76
|
402
|
Chris@76
|
403 echo '
|
Chris@76
|
404 </body></html>';
|
Chris@76
|
405 }
|
Chris@76
|
406
|
Chris@76
|
407 // Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
|
Chris@76
|
408 function theme_linktree($force_show = false)
|
Chris@76
|
409 {
|
Chris@76
|
410 global $context, $settings, $options, $shown_linktree;
|
Chris@76
|
411
|
Chris@76
|
412 // If linktree is empty, just return - also allow an override.
|
Chris@76
|
413 if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
|
Chris@76
|
414 return;
|
Chris@76
|
415
|
Chris@76
|
416 echo '
|
Chris@76
|
417 <ul class="linktree" id="linktree_', empty($shown_linktree) ? 'upper' : 'lower', '">';
|
Chris@76
|
418
|
Chris@76
|
419 // Each tree item has a URL and name. Some may have extra_before and extra_after.
|
Chris@76
|
420 foreach ($context['linktree'] as $link_num => $tree)
|
Chris@76
|
421 {
|
Chris@76
|
422 echo '
|
Chris@76
|
423 <li', ($link_num == count($context['linktree']) - 1) ? ' class="last"' : '', '>';
|
Chris@76
|
424
|
Chris@76
|
425 // Show something before the link?
|
Chris@76
|
426 if (isset($tree['extra_before']))
|
Chris@76
|
427 echo $tree['extra_before'];
|
Chris@76
|
428
|
Chris@76
|
429 // Show the link, including a URL if it should have one.
|
Chris@76
|
430 echo $settings['linktree_link'] && isset($tree['url']) ? '
|
Chris@76
|
431 <a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>' : '<span>' . $tree['name'] . '</span>';
|
Chris@76
|
432
|
Chris@76
|
433 // Show something after the link...?
|
Chris@76
|
434 if (isset($tree['extra_after']))
|
Chris@76
|
435 echo $tree['extra_after'];
|
Chris@76
|
436
|
Chris@76
|
437 // Don't show a separator for the last one.
|
Chris@76
|
438 if ($link_num != count($context['linktree']) - 1)
|
Chris@76
|
439 echo ' >';
|
Chris@76
|
440
|
Chris@76
|
441 echo '
|
Chris@76
|
442 </li>';
|
Chris@76
|
443 }
|
Chris@76
|
444 echo '
|
Chris@76
|
445 </ul>';
|
Chris@76
|
446
|
Chris@76
|
447 $shown_linktree = true;
|
Chris@76
|
448 }
|
Chris@76
|
449
|
Chris@76
|
450 // Show the menu up top. Something like [home] [help] [profile] [logout]...
|
Chris@76
|
451 function template_menu()
|
Chris@76
|
452 {
|
Chris@76
|
453 global $context, $settings, $options, $scripturl, $txt;
|
Chris@76
|
454
|
Chris@76
|
455 echo '
|
Chris@76
|
456 <div class="main_menu">
|
Chris@76
|
457 <ul class="reset clearfix">';
|
Chris@76
|
458
|
Chris@76
|
459 foreach ($context['menu_buttons'] as $act => $button)
|
Chris@76
|
460 {
|
Chris@76
|
461 $classes = array();
|
Chris@76
|
462 if (!empty($button['active_button']))
|
Chris@76
|
463 $classes[] = 'active';
|
Chris@76
|
464 if (!empty($button['is_last']))
|
Chris@76
|
465 $classes[] = 'last';
|
Chris@76
|
466 /* IE6 can't do multiple class selectors */
|
Chris@76
|
467 if ($context['browser']['is_ie6'] && !empty($button['active_button']) && !empty($button['is_last']))
|
Chris@76
|
468 $classes[] = 'lastactive';
|
Chris@76
|
469
|
Chris@76
|
470 $classes = implode(' ', $classes);
|
Chris@76
|
471
|
Chris@76
|
472 echo '
|
Chris@76
|
473 <li id="button_', $act, '"', !empty($classes) ? ' class="' . $classes . '"' : '', '>
|
Chris@76
|
474 <a title="', !empty($button['alttitle']) ? $button['alttitle'] : $button['title'], '" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
|
Chris@76
|
475 <span>', ($button['active_button'] ? '<em>' : ''), $button['title'], ($button['active_button'] ? '</em>' : ''), '</span>
|
Chris@76
|
476 </a>
|
Chris@76
|
477 </li>';
|
Chris@76
|
478 }
|
Chris@76
|
479
|
Chris@76
|
480 echo '
|
Chris@76
|
481 </ul>
|
Chris@76
|
482 </div>';
|
Chris@76
|
483 }
|
Chris@76
|
484
|
Chris@76
|
485 // Generate a strip of buttons.
|
Chris@76
|
486 function template_button_strip($button_strip, $direction = 'top', $strip_options = array())
|
Chris@76
|
487 {
|
Chris@76
|
488 global $settings, $context, $txt, $scripturl;
|
Chris@76
|
489
|
Chris@76
|
490 if (!is_array($strip_options))
|
Chris@76
|
491 $strip_options = array();
|
Chris@76
|
492
|
Chris@76
|
493 // Right to left menu should be in reverse order.
|
Chris@76
|
494 if ($context['right_to_left'])
|
Chris@76
|
495 $button_strip = array_reverse($button_strip, true);
|
Chris@76
|
496
|
Chris@76
|
497 // Create the buttons...
|
Chris@76
|
498 $buttons = array();
|
Chris@76
|
499 foreach ($button_strip as $key => $value)
|
Chris@76
|
500 if (!isset($value['test']) || !empty($context[$value['test']]))
|
Chris@76
|
501 $buttons[] = '
|
Chris@76
|
502 <li' . (isset($value['active']) ? ' class="active"' : '') . '><a' . (isset($value['id']) ? ' id="button_strip_' . $value['id'] . '"' : '') . ' class="button_strip_' . $key . '" href="' . $value['url'] . '"' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '><span>' . (isset($value['active']) ? '<em>' . $txt[$value['text']] . '</em>' : $txt[$value['text']]) . '</span></a></li>';
|
Chris@76
|
503
|
Chris@76
|
504 // No buttons? No button strip either.
|
Chris@76
|
505 if (empty($buttons))
|
Chris@76
|
506 return;
|
Chris@76
|
507
|
Chris@76
|
508 // Make the last one, as easy as possible.
|
Chris@76
|
509 $list_item = array('<li>', '<li class="active">');
|
Chris@76
|
510 $active_item = array('<li class="last">', '<li class="active last lastactive">');
|
Chris@76
|
511
|
Chris@76
|
512 $buttons[count($buttons) - 1] = str_replace($list_item, $active_item, $buttons[count($buttons) - 1]);
|
Chris@76
|
513
|
Chris@76
|
514 echo '
|
Chris@76
|
515 <div class="buttonlist', $direction != 'top' ? '_bottom' : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"': ''), '>
|
Chris@76
|
516 <ul class="reset clearfix">',
|
Chris@76
|
517 implode('', $buttons), '
|
Chris@76
|
518 </ul>
|
Chris@76
|
519 </div>';
|
Chris@76
|
520 }
|
Chris@76
|
521
|
Chris@76
|
522 ?> |